[InlineFilters] Don't bind if disabled
This commit is contained in:
parent
9ab618855f
commit
a467d164a9
51
dist/frappe-datatable.cjs.js
vendored
51
dist/frappe-datatable.cjs.js
vendored
@ -211,12 +211,10 @@ var isObject_1 = isObject;
|
||||
|
||||
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
||||
|
||||
/** Detect free variable `global` from Node.js. */
|
||||
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
||||
|
||||
var _freeGlobal = freeGlobal;
|
||||
|
||||
/** Detect free variable `self`. */
|
||||
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
||||
|
||||
/** Used as a reference to the global object. */
|
||||
@ -224,34 +222,16 @@ var root = _freeGlobal || freeSelf || Function('return this')();
|
||||
|
||||
var _root = root;
|
||||
|
||||
/**
|
||||
* Gets the timestamp of the number of milliseconds that have elapsed since
|
||||
* the Unix epoch (1 January 1970 00:00:00 UTC).
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 2.4.0
|
||||
* @category Date
|
||||
* @returns {number} Returns the timestamp.
|
||||
* @example
|
||||
*
|
||||
* _.defer(function(stamp) {
|
||||
* console.log(_.now() - stamp);
|
||||
* }, _.now());
|
||||
* // => Logs the number of milliseconds it took for the deferred invocation.
|
||||
*/
|
||||
var now = function() {
|
||||
return _root.Date.now();
|
||||
};
|
||||
|
||||
var now_1 = now;
|
||||
|
||||
/** Built-in value references. */
|
||||
var Symbol = _root.Symbol;
|
||||
|
||||
var _Symbol = Symbol;
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
@ -319,7 +299,6 @@ function objectToString(value) {
|
||||
|
||||
var _objectToString = objectToString;
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
var nullTag = '[object Null]';
|
||||
var undefinedTag = '[object Undefined]';
|
||||
|
||||
@ -374,7 +353,6 @@ function isObjectLike(value) {
|
||||
|
||||
var isObjectLike_1 = isObjectLike;
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
var symbolTag = '[object Symbol]';
|
||||
|
||||
/**
|
||||
@ -401,7 +379,6 @@ function isSymbol(value) {
|
||||
|
||||
var isSymbol_1 = isSymbol;
|
||||
|
||||
/** Used as references for various `Number` constants. */
|
||||
var NAN = 0 / 0;
|
||||
|
||||
/** Used to match leading and trailing whitespace. */
|
||||
@ -465,7 +442,6 @@ function toNumber(value) {
|
||||
|
||||
var toNumber_1 = toNumber;
|
||||
|
||||
/** Error message constants. */
|
||||
var FUNC_ERROR_TEXT = 'Expected a function';
|
||||
|
||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||
@ -652,7 +628,6 @@ function debounce(func, wait, options) {
|
||||
|
||||
var debounce_1 = debounce;
|
||||
|
||||
/** Error message constants. */
|
||||
var FUNC_ERROR_TEXT$1 = 'Expected a function';
|
||||
|
||||
/**
|
||||
@ -1379,10 +1354,13 @@ class ColumnManager {
|
||||
$('thead', this.header).innerHTML = html;
|
||||
|
||||
this.$filterRow = $('.data-table-row[data-is-filter]', this.header);
|
||||
// hide filter row immediately, so it doesn't disturb layout
|
||||
$.style(this.$filterRow, {
|
||||
display: 'none'
|
||||
});
|
||||
|
||||
if (this.$filterRow) {
|
||||
// hide filter row immediately, so it doesn't disturb layout
|
||||
$.style(this.$filterRow, {
|
||||
display: 'none'
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// refresh dom state
|
||||
const $cols = $.each('.data-table-col', this.header);
|
||||
@ -1642,6 +1620,7 @@ class ColumnManager {
|
||||
}
|
||||
|
||||
bindFilter() {
|
||||
if (!this.options.enableInlineFilters) return;
|
||||
const handler = e => {
|
||||
const $filterCell = $.closest('.data-table-col', e.target);
|
||||
const { colIndex } = $.data($filterCell);
|
||||
@ -1851,13 +1830,15 @@ class CellManager {
|
||||
this.deactivateEditing();
|
||||
});
|
||||
|
||||
this.keyboard.on('ctrl+f', (e) => {
|
||||
const $cell = $.closest('.data-table-col', e.target);
|
||||
let { colIndex } = $.data($cell);
|
||||
if (this.options.enableInlineFilters) {
|
||||
this.keyboard.on('ctrl+f', (e) => {
|
||||
const $cell = $.closest('.data-table-col', e.target);
|
||||
let { colIndex } = $.data($cell);
|
||||
|
||||
this.activateFilter(colIndex);
|
||||
return true;
|
||||
});
|
||||
this.activateFilter(colIndex);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
bindKeyboardSelection() {
|
||||
|
||||
51
dist/frappe-datatable.js
vendored
51
dist/frappe-datatable.js
vendored
@ -210,12 +210,10 @@ var isObject_1 = isObject;
|
||||
|
||||
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
||||
|
||||
/** Detect free variable `global` from Node.js. */
|
||||
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
||||
|
||||
var _freeGlobal = freeGlobal;
|
||||
|
||||
/** Detect free variable `self`. */
|
||||
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
||||
|
||||
/** Used as a reference to the global object. */
|
||||
@ -223,34 +221,16 @@ var root = _freeGlobal || freeSelf || Function('return this')();
|
||||
|
||||
var _root = root;
|
||||
|
||||
/**
|
||||
* Gets the timestamp of the number of milliseconds that have elapsed since
|
||||
* the Unix epoch (1 January 1970 00:00:00 UTC).
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 2.4.0
|
||||
* @category Date
|
||||
* @returns {number} Returns the timestamp.
|
||||
* @example
|
||||
*
|
||||
* _.defer(function(stamp) {
|
||||
* console.log(_.now() - stamp);
|
||||
* }, _.now());
|
||||
* // => Logs the number of milliseconds it took for the deferred invocation.
|
||||
*/
|
||||
var now = function() {
|
||||
return _root.Date.now();
|
||||
};
|
||||
|
||||
var now_1 = now;
|
||||
|
||||
/** Built-in value references. */
|
||||
var Symbol = _root.Symbol;
|
||||
|
||||
var _Symbol = Symbol;
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
@ -318,7 +298,6 @@ function objectToString(value) {
|
||||
|
||||
var _objectToString = objectToString;
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
var nullTag = '[object Null]';
|
||||
var undefinedTag = '[object Undefined]';
|
||||
|
||||
@ -373,7 +352,6 @@ function isObjectLike(value) {
|
||||
|
||||
var isObjectLike_1 = isObjectLike;
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
var symbolTag = '[object Symbol]';
|
||||
|
||||
/**
|
||||
@ -400,7 +378,6 @@ function isSymbol(value) {
|
||||
|
||||
var isSymbol_1 = isSymbol;
|
||||
|
||||
/** Used as references for various `Number` constants. */
|
||||
var NAN = 0 / 0;
|
||||
|
||||
/** Used to match leading and trailing whitespace. */
|
||||
@ -464,7 +441,6 @@ function toNumber(value) {
|
||||
|
||||
var toNumber_1 = toNumber;
|
||||
|
||||
/** Error message constants. */
|
||||
var FUNC_ERROR_TEXT = 'Expected a function';
|
||||
|
||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||
@ -651,7 +627,6 @@ function debounce(func, wait, options) {
|
||||
|
||||
var debounce_1 = debounce;
|
||||
|
||||
/** Error message constants. */
|
||||
var FUNC_ERROR_TEXT$1 = 'Expected a function';
|
||||
|
||||
/**
|
||||
@ -1378,10 +1353,13 @@ class ColumnManager {
|
||||
$('thead', this.header).innerHTML = html;
|
||||
|
||||
this.$filterRow = $('.data-table-row[data-is-filter]', this.header);
|
||||
// hide filter row immediately, so it doesn't disturb layout
|
||||
$.style(this.$filterRow, {
|
||||
display: 'none'
|
||||
});
|
||||
|
||||
if (this.$filterRow) {
|
||||
// hide filter row immediately, so it doesn't disturb layout
|
||||
$.style(this.$filterRow, {
|
||||
display: 'none'
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// refresh dom state
|
||||
const $cols = $.each('.data-table-col', this.header);
|
||||
@ -1641,6 +1619,7 @@ class ColumnManager {
|
||||
}
|
||||
|
||||
bindFilter() {
|
||||
if (!this.options.enableInlineFilters) return;
|
||||
const handler = e => {
|
||||
const $filterCell = $.closest('.data-table-col', e.target);
|
||||
const { colIndex } = $.data($filterCell);
|
||||
@ -1850,13 +1829,15 @@ class CellManager {
|
||||
this.deactivateEditing();
|
||||
});
|
||||
|
||||
this.keyboard.on('ctrl+f', (e) => {
|
||||
const $cell = $.closest('.data-table-col', e.target);
|
||||
let { colIndex } = $.data($cell);
|
||||
if (this.options.enableInlineFilters) {
|
||||
this.keyboard.on('ctrl+f', (e) => {
|
||||
const $cell = $.closest('.data-table-col', e.target);
|
||||
let { colIndex } = $.data($cell);
|
||||
|
||||
this.activateFilter(colIndex);
|
||||
return true;
|
||||
});
|
||||
this.activateFilter(colIndex);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
bindKeyboardSelection() {
|
||||
|
||||
@ -70,7 +70,7 @@
|
||||
layout: 'fluid',
|
||||
columns,
|
||||
data,
|
||||
enableInlineFilters: true,
|
||||
// enableInlineFilters: true,
|
||||
getEditor(colIndex, rowIndex, value, parent) {
|
||||
// editing obj only for date field
|
||||
if (colIndex != 6) return;
|
||||
|
||||
@ -108,13 +108,15 @@ export default class CellManager {
|
||||
this.deactivateEditing();
|
||||
});
|
||||
|
||||
this.keyboard.on('ctrl+f', (e) => {
|
||||
const $cell = $.closest('.data-table-col', e.target);
|
||||
let { colIndex } = $.data($cell);
|
||||
if (this.options.enableInlineFilters) {
|
||||
this.keyboard.on('ctrl+f', (e) => {
|
||||
const $cell = $.closest('.data-table-col', e.target);
|
||||
let { colIndex } = $.data($cell);
|
||||
|
||||
this.activateFilter(colIndex);
|
||||
return true;
|
||||
});
|
||||
this.activateFilter(colIndex);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
bindKeyboardSelection() {
|
||||
|
||||
@ -40,10 +40,13 @@ export default class ColumnManager {
|
||||
$('thead', this.header).innerHTML = html;
|
||||
|
||||
this.$filterRow = $('.data-table-row[data-is-filter]', this.header);
|
||||
// hide filter row immediately, so it doesn't disturb layout
|
||||
$.style(this.$filterRow, {
|
||||
display: 'none'
|
||||
});
|
||||
|
||||
if (this.$filterRow) {
|
||||
// hide filter row immediately, so it doesn't disturb layout
|
||||
$.style(this.$filterRow, {
|
||||
display: 'none'
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// refresh dom state
|
||||
const $cols = $.each('.data-table-col', this.header);
|
||||
@ -303,6 +306,7 @@ export default class ColumnManager {
|
||||
}
|
||||
|
||||
bindFilter() {
|
||||
if (!this.options.enableInlineFilters) return;
|
||||
const handler = e => {
|
||||
const $filterCell = $.closest('.data-table-col', e.target);
|
||||
const { colIndex } = $.data($filterCell);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user