1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-05-18 06:16:39 +02:00

refactor feature istantiation helpers

This commit is contained in:
koalyptus 2019-02-10 00:27:55 +11:00
parent 528d587a80
commit df0221d5e7
30 changed files with 475 additions and 416 deletions

View file

@ -102,7 +102,7 @@ return /******/ (function(modules) { // webpackBootstrap
/******/ if (__webpack_require__.nc) { /******/ if (__webpack_require__.nc) {
/******/ script.setAttribute("nonce", __webpack_require__.nc); /******/ script.setAttribute("nonce", __webpack_require__.nc);
/******/ } /******/ }
/******/ script.src = __webpack_require__.p + "tf-" + ({}[chunkId]||chunkId) + "-" + {"0":"973b3f20052aa524e437"}[chunkId] + ".js"; /******/ script.src = __webpack_require__.p + "tf-" + ({}[chunkId]||chunkId) + "-" + {"0":"0c56575d9b568fc4dedd"}[chunkId] + ".js";
/******/ var timeout = setTimeout(function(){ /******/ var timeout = setTimeout(function(){
/******/ onScriptComplete({ type: 'timeout', target: script }); /******/ onScriptComplete({ type: 'timeout', target: script });
/******/ }, 120000); /******/ }, 120000);
@ -15647,35 +15647,21 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IP_ADDRESS", function() { return IP_ADDRESS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IP_ADDRESS", function() { return IP_ADDRESS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AUTO_FILTER_DELAY", function() { return AUTO_FILTER_DELAY; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AUTO_FILTER_DELAY", function() { return AUTO_FILTER_DELAY; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FEATURES", function() { return FEATURES; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FEATURES", function() { return FEATURES; });
/* harmony import */ var _modules_dateType__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./modules/dateType */ "./src/modules/dateType.js"); // import {DateType} from './modules/dateType';
/* harmony import */ var _modules_help__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./modules/help */ "./src/modules/help.js"); // import {Help} from './modules/help';
/* harmony import */ var _modules_state__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./modules/state */ "./src/modules/state.js"); // import {State} from './modules/state';
/* harmony import */ var _modules_gridLayout__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./modules/gridLayout */ "./src/modules/gridLayout.js"); // import {GridLayout} from './modules/gridLayout';
/* harmony import */ var _modules_loader__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./modules/loader */ "./src/modules/loader.js"); // import {Loader} from './modules/loader';
/* harmony import */ var _modules_highlightKeywords__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./modules/highlightKeywords */ "./src/modules/highlightKeywords.js"); // import {HighlightKeyword} from './modules/highlightKeywords';
/* harmony import */ var _modules_popupFilter__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./modules/popupFilter */ "./src/modules/popupFilter.js"); // import {PopupFilter} from './modules/popupFilter';
/* harmony import */ var _modules_markActiveColumns__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./modules/markActiveColumns */ "./src/modules/markActiveColumns.js"); // import {MarkActiveColumns} from './modules/markActiveColumns';
/* harmony import */ var _modules_rowsCounter__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./modules/rowsCounter */ "./src/modules/rowsCounter.js"); // import {RowsCounter} from './modules/rowsCounter';
/* harmony import */ var _modules_statusBar__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./modules/statusBar */ "./src/modules/statusBar.js"); // import {StatusBar} from './modules/statusBar';
/* harmony import */ var _modules_clearButton__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./modules/clearButton */ "./src/modules/clearButton.js"); // import {ClearButton} from './modules/clearButton';
/* harmony import */ var _modules_alternateRows__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./modules/alternateRows */ "./src/modules/alternateRows.js"); // import {AlternateRows} from './modules/alternateRows';
/* harmony import */ var _modules_noResults__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./modules/noResults */ "./src/modules/noResults.js"); // import {NoResults} from './modules/noResults';
/* harmony import */ var _modules_paging__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./modules/paging */ "./src/modules/paging.js"); // import {Paging} from './modules/paging';
/* harmony import */ var _modules_toolbar__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./modules/toolbar */ "./src/modules/toolbar.js"); // import {Toolbar} from './modules/toolbar';
/** /**
* Filter types * Filter types
@ -15685,7 +15671,6 @@ __webpack_require__.r(__webpack_exports__);
* Input filter type * Input filter type
* @type {String} * @type {String}
*/ */
var INPUT = 'input'; var INPUT = 'input';
/** /**
* Select filter type * Select filter type
@ -15807,76 +15792,76 @@ var IP_ADDRESS = 'ipaddress';
var AUTO_FILTER_DELAY = 750; var AUTO_FILTER_DELAY = 750;
/** /**
* TableFilter features definitions * TableFilter features definitions
* @type {Object} * @type {Array}
*/ */
var FEATURES = { var FEATURES = []; // export const FEATURES = {
dateType: { // dateType: {
class: _modules_dateType__WEBPACK_IMPORTED_MODULE_0__["DateType"], // class: DateType,
name: 'dateType' // name: 'dateType'
}, // },
help: { // help: {
class: _modules_help__WEBPACK_IMPORTED_MODULE_1__["Help"], // class: Help,
name: 'help', // name: 'help',
enforce: true // enforce: true
}, // },
state: { // state: {
class: _modules_state__WEBPACK_IMPORTED_MODULE_2__["State"], // class: State,
name: 'state' // name: 'state'
}, // },
markActiveColumns: { // markActiveColumns: {
class: _modules_markActiveColumns__WEBPACK_IMPORTED_MODULE_7__["MarkActiveColumns"], // class: MarkActiveColumns,
name: 'markActiveColumns' // name: 'markActiveColumns'
}, // },
gridLayout: { // gridLayout: {
class: _modules_gridLayout__WEBPACK_IMPORTED_MODULE_3__["GridLayout"], // class: GridLayout,
name: 'gridLayout' // name: 'gridLayout'
}, // },
loader: { // loader: {
class: _modules_loader__WEBPACK_IMPORTED_MODULE_4__["Loader"], // class: Loader,
name: 'loader' // name: 'loader'
}, // },
highlightKeyword: { // highlightKeyword: {
class: _modules_highlightKeywords__WEBPACK_IMPORTED_MODULE_5__["HighlightKeyword"], // class: HighlightKeyword,
name: 'highlightKeyword', // name: 'highlightKeyword',
property: 'highlightKeywords' // property: 'highlightKeywords'
}, // },
popupFilter: { // popupFilter: {
class: _modules_popupFilter__WEBPACK_IMPORTED_MODULE_6__["PopupFilter"], // class: PopupFilter,
name: 'popupFilter', // name: 'popupFilter',
property: 'popupFilters' // property: 'popupFilters'
}, // },
rowsCounter: { // rowsCounter: {
class: _modules_rowsCounter__WEBPACK_IMPORTED_MODULE_8__["RowsCounter"], // class: RowsCounter,
name: 'rowsCounter' // name: 'rowsCounter'
}, // },
statusBar: { // statusBar: {
class: _modules_statusBar__WEBPACK_IMPORTED_MODULE_9__["StatusBar"], // class: StatusBar,
name: 'statusBar' // name: 'statusBar'
}, // },
clearButton: { // clearButton: {
class: _modules_clearButton__WEBPACK_IMPORTED_MODULE_10__["ClearButton"], // class: ClearButton,
name: 'clearButton', // name: 'clearButton',
property: 'btnReset' // property: 'btnReset'
}, // },
alternateRows: { // alternateRows: {
class: _modules_alternateRows__WEBPACK_IMPORTED_MODULE_11__["AlternateRows"], // class: AlternateRows,
name: 'alternateRows' // name: 'alternateRows'
}, // },
noResults: { // noResults: {
class: _modules_noResults__WEBPACK_IMPORTED_MODULE_12__["NoResults"], // class: NoResults,
name: 'noResults' // name: 'noResults'
}, // },
paging: { // paging: {
class: _modules_paging__WEBPACK_IMPORTED_MODULE_13__["Paging"], // class: Paging,
name: 'paging' // name: 'paging'
}, // },
toolbar: { // toolbar: {
class: _modules_toolbar__WEBPACK_IMPORTED_MODULE_14__["Toolbar"], // class: Toolbar,
name: 'toolbar', // name: 'toolbar',
enforce: true // enforce: true
} // }
}; // };
/***/ }), /***/ }),
@ -16462,9 +16447,9 @@ function (_Register) {
/** /**
* Creates an instance of Feature * Creates an instance of Feature
* @param {Object} tf TableFilter instance * @param {Object} tf TableFilter instance
* @param {String} feature Feature name known by TableFilter * @param {Class} feature Feature class for TableFilter registration
*/ */
function Feature(tf, feature, cls) { function Feature(tf, cls) {
var _this; var _this;
_classCallCheck(this, Feature); _classCallCheck(this, Feature);
@ -16474,20 +16459,20 @@ function (_Register) {
* TableFilter instance * TableFilter instance
* @type {TableFilter} * @type {TableFilter}
*/ */
//this.tf = tf;
_this.tf = tf;
/** /**
* Feature name * Feature name
* @type {String} * @type {String}
*/ */
// this.feature = feature;
_this.feature = feature;
/** /**
* TableFilter feature setting * TableFilter feature setting
* @type {Boolean} * @type {Boolean}
*/ */
_this.enabled = tf[feature]; _this.enabled = tf[_this.feature];
/** /**
* TableFilter configuration * TableFilter configuration
* @type {Object} * @type {Object}
@ -16633,7 +16618,7 @@ function (_Feature) {
_classCallCheck(this, AlternateRows); _classCallCheck(this, AlternateRows);
_this = _possibleConstructorReturn(this, _getPrototypeOf(AlternateRows).call(this, tf, 'alternateRows')); _this = _possibleConstructorReturn(this, _getPrototypeOf(AlternateRows).call(this, tf, AlternateRows));
var config = _this.config; var config = _this.config;
/** /**
* Css class for even rows (default: 'even') * Css class for even rows (default: 'even')
@ -16837,14 +16822,14 @@ function (_Feature) {
_classCallCheck(this, BaseDropdown); _classCallCheck(this, BaseDropdown);
_this = _possibleConstructorReturn(this, _getPrototypeOf(BaseDropdown).call(this, tf, 'baseDropdown')); _this = _possibleConstructorReturn(this, _getPrototypeOf(BaseDropdown).call(this, tf, BaseDropdown));
var f = _this.config; var f = _this.config;
/** /**
* Filter options custom sorter on a column basis * Filter options custom sorter on a column basis
* @type {Object} * @type {Object}
*/ */
_this.customSorter = Object(_types__WEBPACK_IMPORTED_MODULE_2__["isObj"])(f.filter_options_sorter) && Object(_types__WEBPACK_IMPORTED_MODULE_2__["isArray"])(f.filter_options_sorter.col) && Object(_types__WEBPACK_IMPORTED_MODULE_2__["isArray"])(f.filter_options_sorter.comparer) ? f.filter_options_sorter : null; // TODO: move here all properties shared by Dropdown CheckList _this.customSorter = Object(_types__WEBPACK_IMPORTED_MODULE_2__["isObj"])(f.filter_options_sorter) && Object(_types__WEBPACK_IMPORTED_MODULE_2__["isArray"])(f.filter_options_sorter.col) && Object(_types__WEBPACK_IMPORTED_MODULE_2__["isArray"])(f.filter_options_sorter.comparer) ? f.filter_options_sorter : null; // TODO: move here all properties shared by Dropdown and CheckList
/** /**
* Has custom options * Has custom options
@ -17056,7 +17041,7 @@ function (_BaseDropdown) {
_classCallCheck(this, CheckList); _classCallCheck(this, CheckList);
_this = _possibleConstructorReturn(this, _getPrototypeOf(CheckList).call(this, tf, 'checkList')); _this = _possibleConstructorReturn(this, _getPrototypeOf(CheckList).call(this, tf, CheckList));
var f = _this.config; var f = _this.config;
/** /**
* List of container DOM elements * List of container DOM elements
@ -17640,7 +17625,7 @@ function (_Feature) {
_classCallCheck(this, ClearButton); _classCallCheck(this, ClearButton);
_this = _possibleConstructorReturn(this, _getPrototypeOf(ClearButton).call(this, tf, 'btnReset')); _this = _possibleConstructorReturn(this, _getPrototypeOf(ClearButton).call(this, tf, ClearButton));
var f = _this.config.btn_reset || {}; var f = _this.config.btn_reset || {};
/** /**
* Container element ID * Container element ID
@ -17774,7 +17759,9 @@ function (_Feature) {
return ClearButton; return ClearButton;
}(_feature__WEBPACK_IMPORTED_MODULE_0__["Feature"]); // TODO: remove as soon as feature name is fixed }(_feature__WEBPACK_IMPORTED_MODULE_0__["Feature"]); // TODO: remove as soon as feature name is fixed
ClearButton.altName = 'btnReset'; ClearButton.meta = {
altName: 'btnReset'
};
/***/ }), /***/ }),
@ -17840,7 +17827,7 @@ function (_Feature) {
_classCallCheck(this, DateType); _classCallCheck(this, DateType);
_this = _possibleConstructorReturn(this, _getPrototypeOf(DateType).call(this, tf, 'dateType')); _this = _possibleConstructorReturn(this, _getPrototypeOf(DateType).call(this, tf, DateType));
/** /**
* Global locale * Global locale
* @type {String} * @type {String}
@ -18062,7 +18049,7 @@ function (_BaseDropdown) {
_classCallCheck(this, Dropdown); _classCallCheck(this, Dropdown);
_this = _possibleConstructorReturn(this, _getPrototypeOf(Dropdown).call(this, tf, 'dropdown')); // Configuration object _this = _possibleConstructorReturn(this, _getPrototypeOf(Dropdown).call(this, tf, Dropdown)); // Configuration object
var f = _this.config; var f = _this.config;
/** /**
@ -18512,7 +18499,7 @@ function (_Feature) {
_classCallCheck(this, GridLayout); _classCallCheck(this, GridLayout);
_this = _possibleConstructorReturn(this, _getPrototypeOf(GridLayout).call(this, tf, 'gridLayout')); _this = _possibleConstructorReturn(this, _getPrototypeOf(GridLayout).call(this, tf, GridLayout));
var f = _this.config.grid_layout || {}; var f = _this.config.grid_layout || {};
/** /**
* Grid-layout container width as CSS string * Grid-layout container width as CSS string
@ -19125,7 +19112,7 @@ function () {
this.lastHash = hash; this.lastHash = hash;
} }
/** /**
* Converts a URL hash into a state JSON object * Converts a URL hash into a JSON object
* *
* @param {String} hash URL hash fragment * @param {String} hash URL hash fragment
* @returns {Object} JSON object * @returns {Object} JSON object
@ -19246,7 +19233,7 @@ function (_Feature) {
_classCallCheck(this, Help); _classCallCheck(this, Help);
_this = _possibleConstructorReturn(this, _getPrototypeOf(Help).call(this, tf, 'help')); _this = _possibleConstructorReturn(this, _getPrototypeOf(Help).call(this, tf, Help));
var f = _this.config.help_instructions || {}; var f = _this.config.help_instructions || {};
/** /**
* ID of main custom container element * ID of main custom container element
@ -19468,7 +19455,9 @@ function (_Feature) {
return Help; return Help;
}(_feature__WEBPACK_IMPORTED_MODULE_0__["Feature"]); // TODO: remove as soon as feature name is fixed }(_feature__WEBPACK_IMPORTED_MODULE_0__["Feature"]); // TODO: remove as soon as feature name is fixed
Help.alwaysInstantiate = true; Help.meta = {
alwaysInstantiate: true
};
/***/ }), /***/ }),
@ -19682,7 +19671,9 @@ function () {
return HighlightKeyword; return HighlightKeyword;
}(); // TODO: remove as soon as feature name is fixed }(); // TODO: remove as soon as feature name is fixed
HighlightKeyword.altName = 'highlightKeywords'; HighlightKeyword.meta = {
altName: 'highlightKeywords'
};
/***/ }), /***/ }),
@ -19751,7 +19742,7 @@ function (_Feature) {
_classCallCheck(this, Loader); _classCallCheck(this, Loader);
_this = _possibleConstructorReturn(this, _getPrototypeOf(Loader).call(this, tf, 'loader')); _this = _possibleConstructorReturn(this, _getPrototypeOf(Loader).call(this, tf, Loader));
var f = _this.config.loader || {}; var f = _this.config.loader || {};
/** /**
* ID of custom container element * ID of custom container element
@ -19970,7 +19961,7 @@ function (_Feature) {
_classCallCheck(this, MarkActiveColumns); _classCallCheck(this, MarkActiveColumns);
_this = _possibleConstructorReturn(this, _getPrototypeOf(MarkActiveColumns).call(this, tf, 'markActiveColumns')); _this = _possibleConstructorReturn(this, _getPrototypeOf(MarkActiveColumns).call(this, tf, MarkActiveColumns));
var config = _this.config.mark_active_columns || {}; var config = _this.config.mark_active_columns || {};
/** /**
* Css class for filtered (active) columns * Css class for filtered (active) columns
@ -20183,7 +20174,7 @@ function (_Feature) {
_classCallCheck(this, NoResults); _classCallCheck(this, NoResults);
_this = _possibleConstructorReturn(this, _getPrototypeOf(NoResults).call(this, tf, 'noResults')); //configuration object _this = _possibleConstructorReturn(this, _getPrototypeOf(NoResults).call(this, tf, NoResults)); //configuration object
var f = _this.config.no_results_message || {}; var f = _this.config.no_results_message || {};
/** /**
@ -20439,7 +20430,7 @@ function (_Feature) {
_classCallCheck(this, Paging); _classCallCheck(this, Paging);
_this = _possibleConstructorReturn(this, _getPrototypeOf(Paging).call(this, tf, 'paging')); // Configuration object _this = _possibleConstructorReturn(this, _getPrototypeOf(Paging).call(this, tf, Paging)); // Configuration object
var f = _this.config.paging || {}; var f = _this.config.paging || {};
/** /**
@ -21413,7 +21404,7 @@ function (_Feature) {
_classCallCheck(this, PopupFilter); _classCallCheck(this, PopupFilter);
_this = _possibleConstructorReturn(this, _getPrototypeOf(PopupFilter).call(this, tf, 'popupFilters')); // Configuration object _this = _possibleConstructorReturn(this, _getPrototypeOf(PopupFilter).call(this, tf, PopupFilter)); // Configuration object
var f = _this.config.popup_filters || {}; var f = _this.config.popup_filters || {};
/** /**
@ -21913,7 +21904,9 @@ function (_Feature) {
return PopupFilter; return PopupFilter;
}(_feature__WEBPACK_IMPORTED_MODULE_0__["Feature"]); // TODO: remove as soon as feature name is fixed }(_feature__WEBPACK_IMPORTED_MODULE_0__["Feature"]); // TODO: remove as soon as feature name is fixed
PopupFilter.altName = 'popupFilters'; PopupFilter.meta = {
altName: 'popupFilters'
};
/***/ }), /***/ }),
@ -21976,7 +21969,7 @@ function (_Feature) {
_classCallCheck(this, RowsCounter); _classCallCheck(this, RowsCounter);
_this = _possibleConstructorReturn(this, _getPrototypeOf(RowsCounter).call(this, tf, 'rowsCounter', RowsCounter)); // TableFilter configuration _this = _possibleConstructorReturn(this, _getPrototypeOf(RowsCounter).call(this, tf, RowsCounter)); // TableFilter configuration
var f = _this.config.rows_counter || {}; var f = _this.config.rows_counter || {};
/** /**
@ -22233,7 +22226,7 @@ function (_Feature) {
_classCallCheck(this, State); _classCallCheck(this, State);
_this = _possibleConstructorReturn(this, _getPrototypeOf(State).call(this, tf, 'state')); _this = _possibleConstructorReturn(this, _getPrototypeOf(State).call(this, tf, State));
var cfg = _this.config.state || {}; var cfg = _this.config.state || {};
/** /**
* Determines whether state is persisted with URL hash * Determines whether state is persisted with URL hash
@ -22890,7 +22883,7 @@ function (_Feature) {
_classCallCheck(this, StatusBar); _classCallCheck(this, StatusBar);
_this = _possibleConstructorReturn(this, _getPrototypeOf(StatusBar).call(this, tf, 'statusBar')); // Configuration object _this = _possibleConstructorReturn(this, _getPrototypeOf(StatusBar).call(this, tf, StatusBar)); // Configuration object
var f = _this.config.status_bar || {}; var f = _this.config.status_bar || {};
/** /**
@ -23479,7 +23472,7 @@ function (_Feature) {
_classCallCheck(this, Toolbar); _classCallCheck(this, Toolbar);
_this = _possibleConstructorReturn(this, _getPrototypeOf(Toolbar).call(this, tf, 'toolbar')); // Configuration object _this = _possibleConstructorReturn(this, _getPrototypeOf(Toolbar).call(this, tf, Toolbar)); // Configuration object
var f = _this.config.toolbar || {}; var f = _this.config.toolbar || {};
/** /**
@ -23680,7 +23673,9 @@ function (_Feature) {
return Toolbar; return Toolbar;
}(_feature__WEBPACK_IMPORTED_MODULE_0__["Feature"]); // TODO: remove as soon as feature name is fixed }(_feature__WEBPACK_IMPORTED_MODULE_0__["Feature"]); // TODO: remove as soon as feature name is fixed
Toolbar.alwaysInstantiate = true; Toolbar.meta = {
alwaysInstantiate: true
};
/***/ }), /***/ }),
@ -23730,27 +23725,26 @@ var parse = function parse(value) {
/*!*************************!*\ /*!*************************!*\
!*** ./src/register.js ***! !*** ./src/register.js ***!
\*************************/ \*************************/
/*! exports provided: FeaturesRegistry, Register */ /*! exports provided: Register */
/***/ (function(module, __webpack_exports__, __webpack_require__) { /***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict"; "use strict";
__webpack_require__.r(__webpack_exports__); __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FeaturesRegistry", function() { return FeaturesRegistry; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Register", function() { return Register; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Register", function() { return Register; });
/* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./settings */ "./src/settings.js"); /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./settings */ "./src/settings.js");
/* harmony import */ var _string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./string */ "./src/string.js"); /* harmony import */ var _string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./string */ "./src/string.js");
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } /* harmony import */ var _const__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./const */ "./src/const.js");
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var FeaturesRegistry = {};
var Register = function Register(tf) { var Register = function Register(tf) {
var cls = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var cls = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
_classCallCheck(this, Register); _classCallCheck(this, Register);
cls.meta = cls.meta || {};
console.log(tf, cls); console.log(tf, cls);
/** /**
* TableFilter instance * TableFilter instance
@ -23759,28 +23753,16 @@ var Register = function Register(tf) {
this.tf = tf; this.tf = tf;
/** /**
* Feature name, retrieved from alternate class name * Feature name, retrieved from alternate class name if found or from
* if found defined or from camelised class name * camelised class name as per TableFilter convention
* @type {String} * @type {String}
*/ */
this.feature = Object(_settings__WEBPACK_IMPORTED_MODULE_0__["defaultsStr"])(cls.altName, Object(_string__WEBPACK_IMPORTED_MODULE_1__["toCamelCase"])(cls.name)); this.feature = Object(_settings__WEBPACK_IMPORTED_MODULE_0__["defaultsStr"])(cls.meta.altName, Object(_string__WEBPACK_IMPORTED_MODULE_1__["toCamelCase"])(cls.name));
console.log(cls !== {}, _typeof({}), _typeof(cls)); cls.meta.name = this.feature; // this.tf._mod_[this.feature] = cls;
if (cls !== {}) { _const__WEBPACK_IMPORTED_MODULE_2__["FEATURES"][this.feature] = cls;
this.tf._mod_[this.feature] = cls; };
} // this.instantiate(cls, this.feature);
} // instantiate(cls, name) {
// let Cls = cls;
// console.log(Boolean(this.tf[name]),
// Boolean(Cls.alwaysInstantiate));
// if (!this.tf.hasConfig || Boolean(this.tf[name])
// || Boolean(cls.alwaysInstantiate)) {
// this.tf.Mod[name] = this.tf.Mod[name] || new Cls(tf);
// }
// }
;
/***/ }), /***/ }),
@ -24137,8 +24119,22 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _emitter__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./emitter */ "./src/emitter.js"); /* harmony import */ var _emitter__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./emitter */ "./src/emitter.js");
/* harmony import */ var _modules_dropdown__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./modules/dropdown */ "./src/modules/dropdown.js"); /* harmony import */ var _modules_dropdown__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./modules/dropdown */ "./src/modules/dropdown.js");
/* harmony import */ var _modules_checkList__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./modules/checkList */ "./src/modules/checkList.js"); /* harmony import */ var _modules_checkList__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./modules/checkList */ "./src/modules/checkList.js");
/* harmony import */ var _const__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./const */ "./src/const.js"); /* harmony import */ var _modules_dateType__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./modules/dateType */ "./src/modules/dateType.js");
/* harmony import */ var _modules_rowsCounter__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./modules/rowsCounter */ "./src/modules/rowsCounter.js"); /* harmony import */ var _modules_help__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./modules/help */ "./src/modules/help.js");
/* harmony import */ var _modules_state__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./modules/state */ "./src/modules/state.js");
/* harmony import */ var _modules_gridLayout__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./modules/gridLayout */ "./src/modules/gridLayout.js");
/* harmony import */ var _modules_loader__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./modules/loader */ "./src/modules/loader.js");
/* harmony import */ var _modules_highlightKeywords__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./modules/highlightKeywords */ "./src/modules/highlightKeywords.js");
/* harmony import */ var _modules_popupFilter__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./modules/popupFilter */ "./src/modules/popupFilter.js");
/* harmony import */ var _modules_markActiveColumns__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./modules/markActiveColumns */ "./src/modules/markActiveColumns.js");
/* harmony import */ var _modules_rowsCounter__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./modules/rowsCounter */ "./src/modules/rowsCounter.js");
/* harmony import */ var _modules_statusBar__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./modules/statusBar */ "./src/modules/statusBar.js");
/* harmony import */ var _modules_clearButton__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./modules/clearButton */ "./src/modules/clearButton.js");
/* harmony import */ var _modules_alternateRows__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./modules/alternateRows */ "./src/modules/alternateRows.js");
/* harmony import */ var _modules_noResults__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./modules/noResults */ "./src/modules/noResults.js");
/* harmony import */ var _modules_paging__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./modules/paging */ "./src/modules/paging.js");
/* harmony import */ var _modules_toolbar__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./modules/toolbar */ "./src/modules/toolbar.js");
/* harmony import */ var _const__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./const */ "./src/const.js");
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@ -24152,6 +24148,20 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
@ -24303,7 +24313,7 @@ function () {
this.filterTypes = [].map.call((this.dom().rows[this.refRow] || this.dom().rows[0]).cells, function (cell, idx) { this.filterTypes = [].map.call((this.dom().rows[this.refRow] || this.dom().rows[0]).cells, function (cell, idx) {
var colType = _this.cfg["col_".concat(idx)]; var colType = _this.cfg["col_".concat(idx)];
return !colType ? _const__WEBPACK_IMPORTED_MODULE_10__["INPUT"] : colType.toLowerCase(); return !colType ? _const__WEBPACK_IMPORTED_MODULE_25__["INPUT"] : colType.toLowerCase();
}); });
/** /**
* Base path for static assets * Base path for static assets
@ -24342,7 +24352,7 @@ function () {
* @type {String} * @type {String}
*/ */
this.fltCellTag = Object(_settings__WEBPACK_IMPORTED_MODULE_5__["defaultsStr"])(f.filters_cell_tag, _const__WEBPACK_IMPORTED_MODULE_10__["CELL_TAG"]); this.fltCellTag = Object(_settings__WEBPACK_IMPORTED_MODULE_5__["defaultsStr"])(f.filters_cell_tag, _const__WEBPACK_IMPORTED_MODULE_25__["CELL_TAG"]);
/** /**
* List of filters IDs * List of filters IDs
* @type {Array} * @type {Array}
@ -24881,7 +24891,7 @@ function () {
* @type {Number} * @type {Number}
*/ */
this.autoFilterDelay = Object(_types__WEBPACK_IMPORTED_MODULE_3__["isObj"])(f.auto_filter) && Object(_types__WEBPACK_IMPORTED_MODULE_3__["isNumber"])(f.auto_filter.delay) ? f.auto_filter.delay : _const__WEBPACK_IMPORTED_MODULE_10__["AUTO_FILTER_DELAY"]; this.autoFilterDelay = Object(_types__WEBPACK_IMPORTED_MODULE_3__["isObj"])(f.auto_filter) && Object(_types__WEBPACK_IMPORTED_MODULE_3__["isNumber"])(f.auto_filter.delay) ? f.auto_filter.delay : _const__WEBPACK_IMPORTED_MODULE_25__["AUTO_FILTER_DELAY"];
/** /**
* Indicate whether user is typing * Indicate whether user is typing
* @type {Boolean} * @type {Boolean}
@ -25049,7 +25059,6 @@ function () {
*/ */
this.Mod = {}; this.Mod = {};
this._mod_ = {};
/** /**
* Extensions registry * Extensions registry
* @private * @private
@ -25057,9 +25066,9 @@ function () {
this.ExtRegistry = {}; // conditionally instantiate required features this.ExtRegistry = {}; // conditionally instantiate required features
this.instantiateFeatures(Object.keys(_const__WEBPACK_IMPORTED_MODULE_10__["FEATURES"]).map(function (item) { this.instantiateFeatures( // //Object.keys(FEATURES).map((item) => FEATURES[item])
return _const__WEBPACK_IMPORTED_MODULE_10__["FEATURES"][item]; // //FEATURES
})); // console.log(this.Mod, this._mod_); [_modules_toolbar__WEBPACK_IMPORTED_MODULE_24__["Toolbar"]]);
} }
/** /**
* Initialise features and layout * Initialise features and layout
@ -25080,25 +25089,20 @@ function () {
var Mod = this.Mod; var Mod = this.Mod;
var inpclass; //loads theme var inpclass; //loads theme
this.loadThemes(); this.loadThemes(); // const { dateType, help, state, markActiveColumns, gridLayout, loader,
var dateType = _const__WEBPACK_IMPORTED_MODULE_10__["FEATURES"].dateType, // highlightKeyword, popupFilter, rowsCounter, statusBar, clearButton,
help = _const__WEBPACK_IMPORTED_MODULE_10__["FEATURES"].help, // alternateRows, noResults, paging, toolbar } = FEATURES;
state = _const__WEBPACK_IMPORTED_MODULE_10__["FEATURES"].state, //explicitly initialise features in given order
markActiveColumns = _const__WEBPACK_IMPORTED_MODULE_10__["FEATURES"].markActiveColumns,
gridLayout = _const__WEBPACK_IMPORTED_MODULE_10__["FEATURES"].gridLayout,
loader = _const__WEBPACK_IMPORTED_MODULE_10__["FEATURES"].loader,
highlightKeyword = _const__WEBPACK_IMPORTED_MODULE_10__["FEATURES"].highlightKeyword,
popupFilter = _const__WEBPACK_IMPORTED_MODULE_10__["FEATURES"].popupFilter,
rowsCounter = _const__WEBPACK_IMPORTED_MODULE_10__["FEATURES"].rowsCounter,
statusBar = _const__WEBPACK_IMPORTED_MODULE_10__["FEATURES"].statusBar,
clearButton = _const__WEBPACK_IMPORTED_MODULE_10__["FEATURES"].clearButton,
alternateRows = _const__WEBPACK_IMPORTED_MODULE_10__["FEATURES"].alternateRows,
noResults = _const__WEBPACK_IMPORTED_MODULE_10__["FEATURES"].noResults,
paging = _const__WEBPACK_IMPORTED_MODULE_10__["FEATURES"].paging,
toolbar = _const__WEBPACK_IMPORTED_MODULE_10__["FEATURES"].toolbar;
console.log(this.Mod, this._mod_); //explicitly initialise features in given order
this.initFeatures([dateType, help, state, markActiveColumns, gridLayout, loader, highlightKeyword, popupFilter]); //filters grid is not generated this.initFeatures([// dateType,
// help,
// state,
// markActiveColumns,
// gridLayout,
// loader,
// highlightKeyword,
// popupFilter
_modules_dateType__WEBPACK_IMPORTED_MODULE_10__["DateType"], _modules_help__WEBPACK_IMPORTED_MODULE_11__["Help"], _modules_state__WEBPACK_IMPORTED_MODULE_12__["State"], _modules_markActiveColumns__WEBPACK_IMPORTED_MODULE_17__["MarkActiveColumns"], _modules_gridLayout__WEBPACK_IMPORTED_MODULE_13__["GridLayout"], _modules_loader__WEBPACK_IMPORTED_MODULE_14__["Loader"], _modules_highlightKeywords__WEBPACK_IMPORTED_MODULE_15__["HighlightKeyword"], _modules_popupFilter__WEBPACK_IMPORTED_MODULE_16__["PopupFilter"]]); //filters grid is not generated
if (!this.fltGrid) { if (!this.fltGrid) {
this._initNoFilters(); this._initNoFilters();
@ -25125,16 +25129,16 @@ function () {
inpclass = i === n - 1 && this.displayBtn ? this.fltSmallCssClass : this.fltCssClass; //only 1 input for single search inpclass = i === n - 1 && this.displayBtn ? this.fltSmallCssClass : this.fltCssClass; //only 1 input for single search
if (this.singleFlt) { if (this.singleFlt) {
col = _const__WEBPACK_IMPORTED_MODULE_10__["INPUT"]; col = _const__WEBPACK_IMPORTED_MODULE_25__["INPUT"];
inpclass = this.singleFltCssClass; inpclass = this.singleFltCssClass;
} //drop-down filters } //drop-down filters
if (col === _const__WEBPACK_IMPORTED_MODULE_10__["SELECT"] || col === _const__WEBPACK_IMPORTED_MODULE_10__["MULTIPLE"]) { if (col === _const__WEBPACK_IMPORTED_MODULE_25__["SELECT"] || col === _const__WEBPACK_IMPORTED_MODULE_25__["MULTIPLE"]) {
Mod.dropdown = Mod.dropdown || new _modules_dropdown__WEBPACK_IMPORTED_MODULE_8__["Dropdown"](this); Mod.dropdown = Mod.dropdown || new _modules_dropdown__WEBPACK_IMPORTED_MODULE_8__["Dropdown"](this);
Mod.dropdown.init(i, this.isExternalFlt(), fltCell); Mod.dropdown.init(i, this.isExternalFlt(), fltCell);
} // checklist } // checklist
else if (col === _const__WEBPACK_IMPORTED_MODULE_10__["CHECKLIST"]) { else if (col === _const__WEBPACK_IMPORTED_MODULE_25__["CHECKLIST"]) {
Mod.checkList = Mod.checkList || new _modules_checkList__WEBPACK_IMPORTED_MODULE_9__["CheckList"](this); Mod.checkList = Mod.checkList || new _modules_checkList__WEBPACK_IMPORTED_MODULE_9__["CheckList"](this);
Mod.checkList.init(i, this.isExternalFlt(), fltCell); Mod.checkList.init(i, this.isExternalFlt(), fltCell);
} else { } else {
@ -25164,7 +25168,14 @@ function () {
this.setExcludeRows(); this.setExcludeRows();
} }
this.initFeatures([rowsCounter, statusBar, clearButton, alternateRows, noResults, paging, toolbar]); this.initFeatures([// rowsCounter,
// statusBar,
// clearButton,
// alternateRows,
// noResults,
// paging,
// toolbar
_modules_rowsCounter__WEBPACK_IMPORTED_MODULE_18__["RowsCounter"], _modules_statusBar__WEBPACK_IMPORTED_MODULE_19__["StatusBar"], _modules_clearButton__WEBPACK_IMPORTED_MODULE_20__["ClearButton"], _modules_alternateRows__WEBPACK_IMPORTED_MODULE_21__["AlternateRows"], _modules_noResults__WEBPACK_IMPORTED_MODULE_22__["NoResults"], _modules_paging__WEBPACK_IMPORTED_MODULE_23__["Paging"], _modules_toolbar__WEBPACK_IMPORTED_MODULE_24__["Toolbar"]]);
this.setColWidths(); //TF css class is added to table this.setColWidths(); //TF css class is added to table
if (!this.gridLayout) { if (!this.gridLayout) {
@ -25202,7 +25213,7 @@ function () {
return; return;
} }
if (Object(_event__WEBPACK_IMPORTED_MODULE_0__["isKeyPressed"])(evt, [_const__WEBPACK_IMPORTED_MODULE_10__["ENTER_KEY"]])) { if (Object(_event__WEBPACK_IMPORTED_MODULE_0__["isKeyPressed"])(evt, [_const__WEBPACK_IMPORTED_MODULE_25__["ENTER_KEY"]])) {
this.filter(); this.filter();
Object(_event__WEBPACK_IMPORTED_MODULE_0__["cancelEvt"])(evt); Object(_event__WEBPACK_IMPORTED_MODULE_0__["cancelEvt"])(evt);
Object(_event__WEBPACK_IMPORTED_MODULE_0__["stopEvt"])(evt); Object(_event__WEBPACK_IMPORTED_MODULE_0__["stopEvt"])(evt);
@ -25237,7 +25248,7 @@ function () {
} }
} }
if (Object(_event__WEBPACK_IMPORTED_MODULE_0__["isKeyPressed"])(evt, [_const__WEBPACK_IMPORTED_MODULE_10__["ENTER_KEY"], _const__WEBPACK_IMPORTED_MODULE_10__["TAB_KEY"], _const__WEBPACK_IMPORTED_MODULE_10__["ESC_KEY"], _const__WEBPACK_IMPORTED_MODULE_10__["UP_ARROW_KEY"], _const__WEBPACK_IMPORTED_MODULE_10__["DOWN_ARROW_KEY"]])) { if (Object(_event__WEBPACK_IMPORTED_MODULE_0__["isKeyPressed"])(evt, [_const__WEBPACK_IMPORTED_MODULE_25__["ENTER_KEY"], _const__WEBPACK_IMPORTED_MODULE_25__["TAB_KEY"], _const__WEBPACK_IMPORTED_MODULE_25__["ESC_KEY"], _const__WEBPACK_IMPORTED_MODULE_25__["UP_ARROW_KEY"], _const__WEBPACK_IMPORTED_MODULE_25__["DOWN_ARROW_KEY"]])) {
_root__WEBPACK_IMPORTED_MODULE_6__["root"].clearInterval(this.autoFilterTimer); _root__WEBPACK_IMPORTED_MODULE_6__["root"].clearInterval(this.autoFilterTimer);
this.autoFilterTimer = null; this.autoFilterTimer = null;
} else { } else {
@ -25310,7 +25321,7 @@ function () {
fltrow.className = this.fltsRowCssClass; fltrow.className = this.fltsRowCssClass;
if (this.isExternalFlt()) { if (this.isExternalFlt()) {
fltrow.style.display = _const__WEBPACK_IMPORTED_MODULE_10__["NONE"]; fltrow.style.display = _const__WEBPACK_IMPORTED_MODULE_25__["NONE"];
} }
this.emitter.emit('filters-row-inserted', this, fltrow); this.emitter.emit('filters-row-inserted', this, fltrow);
@ -25344,8 +25355,8 @@ function () {
var col = this.getFilterType(colIndex); var col = this.getFilterType(colIndex);
var externalFltTgtId = this.isExternalFlt() ? this.externalFltIds[colIndex] : null; var externalFltTgtId = this.isExternalFlt() ? this.externalFltIds[colIndex] : null;
var inpType = col === _const__WEBPACK_IMPORTED_MODULE_10__["INPUT"] ? 'text' : 'hidden'; var inpType = col === _const__WEBPACK_IMPORTED_MODULE_25__["INPUT"] ? 'text' : 'hidden';
var inp = Object(_dom__WEBPACK_IMPORTED_MODULE_1__["createElm"])(_const__WEBPACK_IMPORTED_MODULE_10__["INPUT"], ['id', this.buildFilterId(colIndex)], ['type', inpType], ['ct', colIndex]); var inp = Object(_dom__WEBPACK_IMPORTED_MODULE_1__["createElm"])(_const__WEBPACK_IMPORTED_MODULE_25__["INPUT"], ['id', this.buildFilterId(colIndex)], ['type', inpType], ['ct', colIndex]);
if (inpType !== 'hidden' && this.watermark) { if (inpType !== 'hidden' && this.watermark) {
inp.setAttribute('placeholder', this.isWatermarkArray ? this.watermark[colIndex] || '' : this.watermark); inp.setAttribute('placeholder', this.isWatermarkArray ? this.watermark[colIndex] || '' : this.watermark);
@ -25386,7 +25397,7 @@ function () {
value: function _buildSubmitButton(container) { value: function _buildSubmitButton(container) {
var _this4 = this; var _this4 = this;
var btn = Object(_dom__WEBPACK_IMPORTED_MODULE_1__["createElm"])(_const__WEBPACK_IMPORTED_MODULE_10__["INPUT"], ['type', 'button'], ['value', this.btnText]); var btn = Object(_dom__WEBPACK_IMPORTED_MODULE_1__["createElm"])(_const__WEBPACK_IMPORTED_MODULE_25__["INPUT"], ['type', 'button'], ['value', this.btnText]);
btn.className = this.btnCssClass; //filter is appended in container element btn.className = this.btnCssClass; //filter is appended in container element
container.appendChild(btn); container.appendChild(btn);
@ -25395,14 +25406,10 @@ function () {
}); });
} }
/** /**
* Istantiate the collection of features required by the * Conditionally istantiate each feature class in passed collection if
* configuration and add them to the features registry. A feature is * required by configuration and add it to the features registry. A feature
* described by a `class` and `name` fields and and optional `property` * class meta information contains a `name` field and optional `altName` and
* field: * `alwaysInstantiate` fields
* {
* class: AClass,
* name: 'aClass'
* }
* @param {Array} [features=[]] * @param {Array} [features=[]]
* @private * @private
*/ */
@ -25413,27 +25420,31 @@ function () {
var _this5 = this; var _this5 = this;
var features = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; var features = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
features.forEach(function (feature) { // features.forEach((feature) => {
// TODO: remove the property field. // // TODO: remove the property field.
// Due to naming convention inconsistencies, a `property` // // Due to naming convention inconsistencies, a `property`
// field is added to allow a conditional instanciation based // // field is added to allow a conditional instanciation based
// on that property on TableFilter, if supplied. // // on that property on TableFilter, if supplied.
feature.property = feature.property || feature.name; // feature.property = feature.property || feature.name;
// if (!this.hasConfig || this[feature.property] === true ||
// feature.enforce === true) {
// let {class: Cls, name} = feature;
// this.Mod[name] = this.Mod[name] || new Cls(this);
// }
// });
features.forEach(function (featureCls) {
var Cls = featureCls;
var inst = new Cls(_this5);
var meta = Cls.meta;
var name = meta.name;
if (!_this5.hasConfig || _this5[feature.property] === true || feature.enforce === true) { if (!_this5.hasConfig || _this5[name] === true || Boolean(meta.alwaysInstantiate)) {
var Cls = feature.class, _this5.Mod[name] = _this5.Mod[name] || inst;
name = feature.name;
_this5.Mod[name] = _this5.Mod[name] || new Cls(_this5);
} }
}); });
} }
/** /**
* Initialise the passed features collection. A feature is described by a * Initialise each feature class in passed collection.
* `class` and `name` fields and and optional `property` field:
* {
* class: AClass,
* name: 'aClass'
* }
* @param {Array} [features=[]] * @param {Array} [features=[]]
* @private * @private
*/ */
@ -25444,11 +25455,19 @@ function () {
var _this6 = this; var _this6 = this;
var features = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; var features = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
features.forEach(function (feature) { // features.forEach((feature) => {
var property = feature.property, // let {property, name} = feature;
name = feature.name; // if (this[property] === true && this.Mod[name]) {
// this.Mod[name].init();
// }
// });
// this.instantiateFeatures(features);
features.forEach(function (featureCls) {
_this6.instantiateFeatures([featureCls]);
if (_this6[property] === true && _this6.Mod[name]) { var name = featureCls.meta.name;
if (_this6[name] === true && _this6.Mod[name]) {
_this6.Mod[name].init(); _this6.Mod[name].init();
} }
}); });
@ -25911,7 +25930,7 @@ function () {
hasNM = reNm === term, hasNM = reNm === term,
hasRE = reRe.test(term); // Check for dates or resolve date type hasRE = reRe.test(term); // Check for dates or resolve date type
if (this.hasType(colIdx, [_const__WEBPACK_IMPORTED_MODULE_10__["DATE"]])) { if (this.hasType(colIdx, [_const__WEBPACK_IMPORTED_MODULE_25__["DATE"]])) {
var dte1, dte2; var dte1, dte2;
var dateType = this.Mod.dateType; var dateType = this.Mod.dateType;
var isValidDate = dateType.isValid.bind(dateType); var isValidDate = dateType.isValid.bind(dateType);
@ -26021,7 +26040,7 @@ function () {
} else { } else {
// If numeric type data, perform a strict equality test and // If numeric type data, perform a strict equality test and
// fallback to unformatted number string comparison // fallback to unformatted number string comparison
if (numData && this.hasType(colIdx, [_const__WEBPACK_IMPORTED_MODULE_10__["NUMBER"], _const__WEBPACK_IMPORTED_MODULE_10__["FORMATTED_NUMBER"]]) && !this.singleFlt) { if (numData && this.hasType(colIdx, [_const__WEBPACK_IMPORTED_MODULE_25__["NUMBER"], _const__WEBPACK_IMPORTED_MODULE_25__["FORMATTED_NUMBER"]]) && !this.singleFlt) {
// parseNb can return 0 for strings which are not // parseNb can return 0 for strings which are not
// formatted numbers, in that case return the original // formatted numbers, in that case return the original
// string. TODO: handle this in parseNb // string. TODO: handle this in parseNb
@ -26127,13 +26146,13 @@ function () {
var fltColType = this.getFilterType(index); var fltColType = this.getFilterType(index);
if (fltColType !== _const__WEBPACK_IMPORTED_MODULE_10__["MULTIPLE"] && fltColType !== _const__WEBPACK_IMPORTED_MODULE_10__["CHECKLIST"]) { if (fltColType !== _const__WEBPACK_IMPORTED_MODULE_25__["MULTIPLE"] && fltColType !== _const__WEBPACK_IMPORTED_MODULE_25__["CHECKLIST"]) {
fltValue = flt.value; fltValue = flt.value;
} //mutiple select } //mutiple select
else if (fltColType === _const__WEBPACK_IMPORTED_MODULE_10__["MULTIPLE"]) { else if (fltColType === _const__WEBPACK_IMPORTED_MODULE_25__["MULTIPLE"]) {
fltValue = this.feature('dropdown').getValues(index); fltValue = this.feature('dropdown').getValues(index);
} //checklist } //checklist
else if (fltColType === _const__WEBPACK_IMPORTED_MODULE_10__["CHECKLIST"]) { else if (fltColType === _const__WEBPACK_IMPORTED_MODULE_25__["CHECKLIST"]) {
fltValue = this.feature('checkList').getValues(index); fltValue = this.feature('checkList').getValues(index);
} //return an empty string if collection is empty or contains a single } //return an empty string if collection is empty or contains a single
//empty string //empty string
@ -26299,11 +26318,11 @@ function () {
var colIndex = cell.cellIndex; var colIndex = cell.cellIndex;
var value = this.getCellValue(cell); var value = this.getCellValue(cell);
if (this.hasType(colIndex, [_const__WEBPACK_IMPORTED_MODULE_10__["FORMATTED_NUMBER"]])) { if (this.hasType(colIndex, [_const__WEBPACK_IMPORTED_MODULE_25__["FORMATTED_NUMBER"]])) {
return Object(_number__WEBPACK_IMPORTED_MODULE_4__["parse"])(value, this.getDecimal(colIndex)); return Object(_number__WEBPACK_IMPORTED_MODULE_4__["parse"])(value, this.getDecimal(colIndex));
} else if (this.hasType(colIndex, [_const__WEBPACK_IMPORTED_MODULE_10__["NUMBER"]])) { } else if (this.hasType(colIndex, [_const__WEBPACK_IMPORTED_MODULE_25__["NUMBER"]])) {
return Number(value); return Number(value);
} else if (this.hasType(colIndex, [_const__WEBPACK_IMPORTED_MODULE_10__["DATE"]])) { } else if (this.hasType(colIndex, [_const__WEBPACK_IMPORTED_MODULE_25__["DATE"]])) {
var dateType = this.Mod.dateType; var dateType = this.Mod.dateType;
return dateType.parse(value, dateType.getLocale(colIndex)); return dateType.parse(value, dateType.getLocale(colIndex));
} }
@ -26641,7 +26660,7 @@ function () {
isValid = true; isValid = true;
} }
var displayFlag = isValid ? '' : _const__WEBPACK_IMPORTED_MODULE_10__["NONE"], var displayFlag = isValid ? '' : _const__WEBPACK_IMPORTED_MODULE_25__["NONE"],
validFlag = isValid ? 'true' : 'false'; validFlag = isValid ? 'true' : 'false';
row.style.display = displayFlag; row.style.display = displayFlag;
@ -26698,7 +26717,7 @@ function () {
} //multiple selects } //multiple selects
if (fltColType === _const__WEBPACK_IMPORTED_MODULE_10__["MULTIPLE"]) { if (fltColType === _const__WEBPACK_IMPORTED_MODULE_25__["MULTIPLE"]) {
var values = Object(_types__WEBPACK_IMPORTED_MODULE_3__["isArray"])(query) ? query : query.split(' ' + this.orOperator + ' '); var values = Object(_types__WEBPACK_IMPORTED_MODULE_3__["isArray"])(query) ? query : query.split(' ' + this.orOperator + ' ');
if (this.loadFltOnDemand && !this.initialized) { if (this.loadFltOnDemand && !this.initialized) {
@ -26707,7 +26726,7 @@ function () {
this.emitter.emit('select-options', this, index, values); this.emitter.emit('select-options', this, index, values);
} //checklist } //checklist
else if (fltColType === _const__WEBPACK_IMPORTED_MODULE_10__["CHECKLIST"]) { else if (fltColType === _const__WEBPACK_IMPORTED_MODULE_25__["CHECKLIST"]) {
var _values = []; var _values = [];
if (this.loadFltOnDemand && !this.initialized) { if (this.loadFltOnDemand && !this.initialized) {
@ -26941,7 +26960,7 @@ function () {
key: "isExactMatch", key: "isExactMatch",
value: function isExactMatch(colIndex) { value: function isExactMatch(colIndex) {
var fltType = this.getFilterType(colIndex); var fltType = this.getFilterType(colIndex);
return this.exactMatchByCol[colIndex] || this.exactMatch || fltType !== _const__WEBPACK_IMPORTED_MODULE_10__["INPUT"]; return this.exactMatchByCol[colIndex] || this.exactMatch || fltType !== _const__WEBPACK_IMPORTED_MODULE_25__["INPUT"];
} }
/** /**
* Check if passed row is valid * Check if passed row is valid
@ -27178,7 +27197,7 @@ function () {
var eachRow = this.eachRow(); var eachRow = this.eachRow();
eachRow(function (row) { eachRow(function (row) {
if (!_this19.paging) { if (!_this19.paging) {
if (_this19.getRowDisplay(row) !== _const__WEBPACK_IMPORTED_MODULE_10__["NONE"]) { if (_this19.getRowDisplay(row) !== _const__WEBPACK_IMPORTED_MODULE_25__["NONE"]) {
_this19.validRowsIndex.push(row.rowIndex); _this19.validRowsIndex.push(row.rowIndex);
} }
} else { } else {
@ -27362,7 +27381,7 @@ function () {
value: function getDecimal(colIndex) { value: function getDecimal(colIndex) {
var decimal = this.decimalSeparator; var decimal = this.decimalSeparator;
if (this.hasType(colIndex, [_const__WEBPACK_IMPORTED_MODULE_10__["FORMATTED_NUMBER"]])) { if (this.hasType(colIndex, [_const__WEBPACK_IMPORTED_MODULE_25__["FORMATTED_NUMBER"]])) {
var colType = this.colTypes[colIndex]; var colType = this.colTypes[colIndex];
if (colType.hasOwnProperty('decimal')) { if (colType.hasOwnProperty('decimal')) {

File diff suppressed because one or more lines are too long

View file

@ -1,18 +1,18 @@
import {DateType} from './modules/dateType'; // import {DateType} from './modules/dateType';
import {Help} from './modules/help'; // import {Help} from './modules/help';
import {State} from './modules/state'; // import {State} from './modules/state';
import {GridLayout} from './modules/gridLayout'; // import {GridLayout} from './modules/gridLayout';
import {Loader} from './modules/loader'; // import {Loader} from './modules/loader';
import {HighlightKeyword} from './modules/highlightKeywords'; // import {HighlightKeyword} from './modules/highlightKeywords';
import {PopupFilter} from './modules/popupFilter'; // import {PopupFilter} from './modules/popupFilter';
import {MarkActiveColumns} from './modules/markActiveColumns'; // import {MarkActiveColumns} from './modules/markActiveColumns';
import {RowsCounter} from './modules/rowsCounter'; // import {RowsCounter} from './modules/rowsCounter';
import {StatusBar} from './modules/statusBar'; // import {StatusBar} from './modules/statusBar';
import {ClearButton} from './modules/clearButton'; // import {ClearButton} from './modules/clearButton';
import {AlternateRows} from './modules/alternateRows'; // import {AlternateRows} from './modules/alternateRows';
import {NoResults} from './modules/noResults'; // import {NoResults} from './modules/noResults';
import {Paging} from './modules/paging'; // import {Paging} from './modules/paging';
import {Toolbar} from './modules/toolbar'; // import {Toolbar} from './modules/toolbar';
/** /**
* Filter types * Filter types
@ -135,72 +135,73 @@ export const AUTO_FILTER_DELAY = 750;
/** /**
* TableFilter features definitions * TableFilter features definitions
* @type {Object} * @type {Array}
*/ */
export const FEATURES = { export const FEATURES = [];
dateType: { // export const FEATURES = {
class: DateType, // dateType: {
name: 'dateType' // class: DateType,
}, // name: 'dateType'
help: { // },
class: Help, // help: {
name: 'help', // class: Help,
enforce: true // name: 'help',
}, // enforce: true
state: { // },
class: State, // state: {
name: 'state' // class: State,
}, // name: 'state'
markActiveColumns: { // },
class: MarkActiveColumns, // markActiveColumns: {
name: 'markActiveColumns' // class: MarkActiveColumns,
}, // name: 'markActiveColumns'
gridLayout: { // },
class: GridLayout, // gridLayout: {
name: 'gridLayout' // class: GridLayout,
}, // name: 'gridLayout'
loader: { // },
class: Loader, // loader: {
name: 'loader' // class: Loader,
}, // name: 'loader'
highlightKeyword: { // },
class: HighlightKeyword, // highlightKeyword: {
name: 'highlightKeyword', // class: HighlightKeyword,
property: 'highlightKeywords' // name: 'highlightKeyword',
}, // property: 'highlightKeywords'
popupFilter: { // },
class: PopupFilter, // popupFilter: {
name: 'popupFilter', // class: PopupFilter,
property: 'popupFilters' // name: 'popupFilter',
}, // property: 'popupFilters'
rowsCounter: { // },
class: RowsCounter, // rowsCounter: {
name: 'rowsCounter' // class: RowsCounter,
}, // name: 'rowsCounter'
statusBar: { // },
class: StatusBar, // statusBar: {
name: 'statusBar' // class: StatusBar,
}, // name: 'statusBar'
clearButton: { // },
class: ClearButton, // clearButton: {
name: 'clearButton', // class: ClearButton,
property: 'btnReset' // name: 'clearButton',
}, // property: 'btnReset'
alternateRows: { // },
class: AlternateRows, // alternateRows: {
name: 'alternateRows' // class: AlternateRows,
}, // name: 'alternateRows'
noResults: { // },
class: NoResults, // noResults: {
name: 'noResults' // class: NoResults,
}, // name: 'noResults'
paging: { // },
class: Paging, // paging: {
name: 'paging' // class: Paging,
}, // name: 'paging'
toolbar: { // },
class: Toolbar, // toolbar: {
name: 'toolbar', // class: Toolbar,
enforce: true // name: 'toolbar',
} // enforce: true
}; // }
// };

View file

@ -21,7 +21,7 @@ export default class AdapterEzEditTable extends Feature {
* @param {Object} cfg Configuration options for ezEditTable library * @param {Object} cfg Configuration options for ezEditTable library
*/ */
constructor(tf, cfg) { constructor(tf, cfg) {
super(tf, cfg.name); super(tf, AdapterEzEditTable);
/** /**
* Module description * Module description
@ -505,3 +505,5 @@ export default class AdapterEzEditTable extends Feature {
this.initialized = false; this.initialized = false;
} }
} }
AdapterEzEditTable.meta = {altName: 'advancedGrid'};

View file

@ -33,7 +33,7 @@ export default class ColOps extends Feature {
* @param {Object} opts Configuration object * @param {Object} opts Configuration object
*/ */
constructor(tf, opts) { constructor(tf, opts) {
super(tf, opts.name); super(tf, ColOps);
/** /**
* Callback fired before columns operations start * Callback fired before columns operations start

View file

@ -23,7 +23,7 @@ export default class ColsVisibility extends Feature {
* @param {Object} Configuration object * @param {Object} Configuration object
*/ */
constructor(tf, f) { constructor(tf, f) {
super(tf, f.name); super(tf, ColsVisibility);
// Configuration object // Configuration object
let cfg = this.config; let cfg = this.config;

View file

@ -18,7 +18,7 @@ export default class FiltersVisibility extends Feature {
* @param {Object} Configuration object * @param {Object} Configuration object
*/ */
constructor(tf, f) { constructor(tf, f) {
super(tf, f.name); super(tf, FiltersVisibility);
/** /**
* Module name * Module name

View file

@ -20,7 +20,7 @@ export default class AdapterSortableTable extends Feature {
* @param {Object} opts Configuration object * @param {Object} opts Configuration object
*/ */
constructor(tf, opts) { constructor(tf, opts) {
super(tf, opts.name); super(tf, AdapterSortableTable);
/** /**
* Module name * Module name
@ -508,6 +508,8 @@ export default class AdapterSortableTable extends Feature {
} }
AdapterSortableTable.meta = {altName: 'sort'};
//Converters //Converters
function ipAddress(value) { function ipAddress(value) {
let vals = value.split('.'); let vals = value.split('.');

View file

@ -9,28 +9,28 @@ export class Feature extends Register {
/** /**
* Creates an instance of Feature * Creates an instance of Feature
* @param {Object} tf TableFilter instance * @param {Object} tf TableFilter instance
* @param {String} feature Feature name known by TableFilter * @param {Class} feature Feature class for TableFilter registration
*/ */
constructor(tf, feature, cls) { constructor(tf, cls) {
super(tf, cls); super(tf, cls);
/** /**
* TableFilter instance * TableFilter instance
* @type {TableFilter} * @type {TableFilter}
*/ */
this.tf = tf; //this.tf = tf;
/** /**
* Feature name * Feature name
* @type {String} * @type {String}
*/ */
this.feature = feature; // this.feature = feature;
/** /**
* TableFilter feature setting * TableFilter feature setting
* @type {Boolean} * @type {Boolean}
*/ */
this.enabled = tf[feature]; this.enabled = tf[this.feature];
/** /**
* TableFilter configuration * TableFilter configuration

View file

@ -14,9 +14,10 @@ export class AlternateRows extends Feature {
* @param {Object} tf TableFilter instance * @param {Object} tf TableFilter instance
*/ */
constructor(tf) { constructor(tf) {
super(tf, 'alternateRows'); super(tf, AlternateRows);
let config = this.config; let config = this.config;
/** /**
* Css class for even rows (default: 'even') * Css class for even rows (default: 'even')
* @type {String} * @type {String}

View file

@ -19,7 +19,7 @@ export class BaseDropdown extends Feature {
* @param {TableFilter} tf * @param {TableFilter} tf
*/ */
constructor(tf) { constructor(tf) {
super(tf, 'baseDropdown'); super(tf, BaseDropdown);
let f = this.config; let f = this.config;
@ -33,7 +33,7 @@ export class BaseDropdown extends Feature {
f.filter_options_sorter : f.filter_options_sorter :
null; null;
// TODO: move here all properties shared by Dropdown CheckList // TODO: move here all properties shared by Dropdown and CheckList
/** /**
* Has custom options * Has custom options

View file

@ -22,7 +22,7 @@ export class CheckList extends BaseDropdown {
* @param {TableFilter} tf TableFilter instance * @param {TableFilter} tf TableFilter instance
*/ */
constructor(tf) { constructor(tf) {
super(tf, 'checkList'); super(tf, CheckList);
let f = this.config; let f = this.config;

View file

@ -15,7 +15,7 @@ export class ClearButton extends Feature {
* @param {TableFilter} tf TableFilter instance * @param {TableFilter} tf TableFilter instance
*/ */
constructor(tf) { constructor(tf) {
super(tf, 'btnReset'); super(tf, ClearButton);
let f = this.config.btn_reset || {}; let f = this.config.btn_reset || {};
@ -139,4 +139,4 @@ export class ClearButton extends Feature {
} }
// TODO: remove as soon as feature name is fixed // TODO: remove as soon as feature name is fixed
ClearButton.altName = 'btnReset'; ClearButton.meta = {altName: 'btnReset'};

View file

@ -17,7 +17,7 @@ export class DateType extends Feature {
* @param {TableFilter} tf TableFilter instance * @param {TableFilter} tf TableFilter instance
*/ */
constructor(tf) { constructor(tf) {
super(tf, 'dateType'); super(tf, DateType);
/** /**
* Global locale * Global locale

View file

@ -19,7 +19,7 @@ export class Dropdown extends BaseDropdown {
* @param {TableFilter} tf TableFilter instance * @param {TableFilter} tf TableFilter instance
*/ */
constructor(tf) { constructor(tf) {
super(tf, 'dropdown'); super(tf, Dropdown);
// Configuration object // Configuration object
let f = this.config; let f = this.config;

View file

@ -17,7 +17,7 @@ export class GridLayout extends Feature {
* @param {TableFilter} tf TableFilter instance * @param {TableFilter} tf TableFilter instance
*/ */
constructor(tf) { constructor(tf) {
super(tf, 'gridLayout'); super(tf, GridLayout);
let f = this.config.grid_layout || {}; let f = this.config.grid_layout || {};

View file

@ -86,7 +86,7 @@ export class Hash {
} }
/** /**
* Converts a URL hash into a state JSON object * Converts a URL hash into a JSON object
* *
* @param {String} hash URL hash fragment * @param {String} hash URL hash fragment
* @returns {Object} JSON object * @returns {Object} JSON object

View file

@ -21,7 +21,7 @@ export class Help extends Feature {
* @param {TableFilter} tf TableFilter instance * @param {TableFilter} tf TableFilter instance
*/ */
constructor(tf) { constructor(tf) {
super(tf, 'help'); super(tf, Help);
let f = this.config.help_instructions || {}; let f = this.config.help_instructions || {};
@ -240,4 +240,4 @@ export class Help extends Feature {
} }
// TODO: remove as soon as feature name is fixed // TODO: remove as soon as feature name is fixed
Help.alwaysInstantiate = true; Help.meta = {alwaysInstantiate: true};

View file

@ -174,4 +174,4 @@ export class HighlightKeyword {
} }
// TODO: remove as soon as feature name is fixed // TODO: remove as soon as feature name is fixed
HighlightKeyword.altName = 'highlightKeywords'; HighlightKeyword.meta = {altName: 'highlightKeywords'};

View file

@ -44,7 +44,7 @@ export class Loader extends Feature {
* @param {TableFilter} tf TableFilter instance * @param {TableFilter} tf TableFilter instance
*/ */
constructor(tf) { constructor(tf) {
super(tf, 'loader'); super(tf, Loader);
let f = this.config.loader || {}; let f = this.config.loader || {};

View file

@ -16,7 +16,7 @@ export class MarkActiveColumns extends Feature {
* @param {TableFilter} tf TableFilter instance * @param {TableFilter} tf TableFilter instance
*/ */
constructor(tf) { constructor(tf) {
super(tf, 'markActiveColumns'); super(tf, MarkActiveColumns);
let config = this.config.mark_active_columns || {}; let config = this.config.mark_active_columns || {};

View file

@ -17,7 +17,7 @@ export class NoResults extends Feature {
* @param {TableFilter} tf TableFilter instance * @param {TableFilter} tf TableFilter instance
*/ */
constructor(tf) { constructor(tf) {
super(tf, 'noResults'); super(tf, NoResults);
//configuration object //configuration object
let f = this.config.no_results_message || {}; let f = this.config.no_results_message || {};

View file

@ -21,7 +21,7 @@ export class Paging extends Feature {
* @param {TableFilter} tf TableFilter instance * @param {TableFilter} tf TableFilter instance
*/ */
constructor(tf) { constructor(tf) {
super(tf, 'paging'); super(tf, Paging);
// Configuration object // Configuration object
let f = this.config.paging || {}; let f = this.config.paging || {};

View file

@ -19,7 +19,7 @@ export class PopupFilter extends Feature {
* @param {TableFilter} tf TableFilter instance * @param {TableFilter} tf TableFilter instance
*/ */
constructor(tf) { constructor(tf) {
super(tf, 'popupFilters'); super(tf, PopupFilter);
// Configuration object // Configuration object
let f = this.config.popup_filters || {}; let f = this.config.popup_filters || {};
@ -458,4 +458,4 @@ export class PopupFilter extends Feature {
} }
// TODO: remove as soon as feature name is fixed // TODO: remove as soon as feature name is fixed
PopupFilter.altName = 'popupFilters'; PopupFilter.meta = {altName: 'popupFilters'};

View file

@ -17,7 +17,7 @@ export class RowsCounter extends Feature {
* @param {TableFilter} tf TableFilter instance * @param {TableFilter} tf TableFilter instance
*/ */
constructor(tf) { constructor(tf) {
super(tf, 'rowsCounter', RowsCounter); super(tf, RowsCounter);
// TableFilter configuration // TableFilter configuration
let f = this.config.rows_counter || {}; let f = this.config.rows_counter || {};

View file

@ -19,7 +19,7 @@ export class State extends Feature {
* @param {TableFilter} tf TableFilter instance * @param {TableFilter} tf TableFilter instance
*/ */
constructor(tf) { constructor(tf) {
super(tf, 'state'); super(tf, State);
let cfg = this.config.state || {}; let cfg = this.config.state || {};

View file

@ -30,7 +30,7 @@ export class StatusBar extends Feature {
* @param {TableFilter} tf TableFilter instance * @param {TableFilter} tf TableFilter instance
*/ */
constructor(tf) { constructor(tf) {
super(tf, 'statusBar'); super(tf, StatusBar);
// Configuration object // Configuration object
let f = this.config.status_bar || {}; let f = this.config.status_bar || {};

View file

@ -29,7 +29,7 @@ export class Toolbar extends Feature {
* @memberof Toolbar * @memberof Toolbar
*/ */
constructor(tf) { constructor(tf) {
super(tf, 'toolbar'); super(tf, Toolbar);
// Configuration object // Configuration object
let f = this.config.toolbar || {}; let f = this.config.toolbar || {};
@ -221,4 +221,4 @@ export class Toolbar extends Feature {
} }
// TODO: remove as soon as feature name is fixed // TODO: remove as soon as feature name is fixed
Toolbar.alwaysInstantiate = true; Toolbar.meta = {alwaysInstantiate: true};

View file

@ -1,11 +1,11 @@
import {defaultsStr} from './settings'; import {defaultsStr} from './settings';
import {toCamelCase} from './string'; import {toCamelCase} from './string';
import {FEATURES} from './const';
export const FeaturesRegistry = {};
export class Register { export class Register {
constructor(tf, cls = {}) { constructor(tf, cls = {}) {
console.log(tf, cls); cls.meta = cls.meta || {};
/** /**
* TableFilter instance * TableFilter instance
* @type {TableFilter} * @type {TableFilter}
@ -13,24 +13,15 @@ export class Register {
this.tf = tf; this.tf = tf;
/** /**
* Feature name, retrieved from alternate class name * Feature name, retrieved from alternate class name if found or from
* if found defined or from camelised class name * camelised class name as per TableFilter convention
* @type {String} * @type {String}
*/ */
this.feature = defaultsStr(cls.altName, toCamelCase(cls.name)); this.feature = defaultsStr(cls.meta.altName, toCamelCase(cls.name));
this.tf._mod_[this.feature] = cls; cls.meta.name = this.feature;
FEATURES[this.feature] = cls;
// this.instantiate(cls, this.feature);
} }
// instantiate(cls, name) {
// let Cls = cls;
// console.log(Boolean(this.tf[name]),
// Boolean(Cls.alwaysInstantiate));
// if (!this.tf.hasConfig || Boolean(this.tf[name])
// || Boolean(cls.alwaysInstantiate)) {
// this.tf.Mod[name] = this.tf.Mod[name] || new Cls(tf);
// }
// }
} }

View file

@ -17,6 +17,21 @@ import {root} from './root';
import {Emitter} from './emitter'; import {Emitter} from './emitter';
import {Dropdown} from './modules/dropdown'; import {Dropdown} from './modules/dropdown';
import {CheckList} from './modules/checkList'; import {CheckList} from './modules/checkList';
import {DateType} from './modules/dateType';
import {Help} from './modules/help';
import {State} from './modules/state';
import {GridLayout} from './modules/gridLayout';
import {Loader} from './modules/loader';
import {HighlightKeyword} from './modules/highlightKeywords';
import {PopupFilter} from './modules/popupFilter';
import {MarkActiveColumns} from './modules/markActiveColumns';
import {RowsCounter} from './modules/rowsCounter';
import {StatusBar} from './modules/statusBar';
import {ClearButton} from './modules/clearButton';
import {AlternateRows} from './modules/alternateRows';
import {NoResults} from './modules/noResults';
import {Paging} from './modules/paging';
import {Toolbar} from './modules/toolbar';
import { import {
INPUT, SELECT, MULTIPLE, CHECKLIST, NONE, INPUT, SELECT, MULTIPLE, CHECKLIST, NONE,
@ -24,7 +39,6 @@ import {
CELL_TAG, AUTO_FILTER_DELAY, NUMBER, DATE, FORMATTED_NUMBER, CELL_TAG, AUTO_FILTER_DELAY, NUMBER, DATE, FORMATTED_NUMBER,
FEATURES FEATURES
} from './const'; } from './const';
import { RowsCounter } from './modules/rowsCounter';
let doc = root.document; let doc = root.document;
@ -920,7 +934,6 @@ export class TableFilter {
* @private * @private
*/ */
this.Mod = {}; this.Mod = {};
this._mod_ = {};
/** /**
* Extensions registry * Extensions registry
@ -930,9 +943,10 @@ export class TableFilter {
// conditionally instantiate required features // conditionally instantiate required features
this.instantiateFeatures( this.instantiateFeatures(
Object.keys(FEATURES).map((item) => FEATURES[item]) // //Object.keys(FEATURES).map((item) => FEATURES[item])
// //FEATURES
[Toolbar]
); );
// console.log(this.Mod, this._mod_);
} }
/** /**
@ -952,20 +966,28 @@ export class TableFilter {
//loads theme //loads theme
this.loadThemes(); this.loadThemes();
const { dateType, help, state, markActiveColumns, gridLayout, loader, // const { dateType, help, state, markActiveColumns, gridLayout, loader,
highlightKeyword, popupFilter, rowsCounter, statusBar, clearButton, // highlightKeyword, popupFilter, rowsCounter, statusBar, clearButton,
alternateRows, noResults, paging, toolbar } = FEATURES; // alternateRows, noResults, paging, toolbar } = FEATURES;
console.log(this.Mod, this._mod_);
//explicitly initialise features in given order //explicitly initialise features in given order
this.initFeatures([ this.initFeatures([
dateType, // dateType,
help, // help,
state, // state,
markActiveColumns, // markActiveColumns,
gridLayout, // gridLayout,
loader, // loader,
highlightKeyword, // highlightKeyword,
popupFilter // popupFilter
DateType,
Help,
State,
MarkActiveColumns,
GridLayout,
Loader,
HighlightKeyword,
PopupFilter
]); ]);
//filters grid is not generated //filters grid is not generated
@ -1038,13 +1060,20 @@ export class TableFilter {
} }
this.initFeatures([ this.initFeatures([
rowsCounter, // rowsCounter,
statusBar, // statusBar,
clearButton, // clearButton,
alternateRows, // alternateRows,
noResults, // noResults,
paging, // paging,
toolbar // toolbar
RowsCounter,
StatusBar,
ClearButton,
AlternateRows,
NoResults,
Paging,
Toolbar
]); ]);
this.setColWidths(); this.setColWidths();
@ -1253,47 +1282,61 @@ export class TableFilter {
} }
/** /**
* Istantiate the collection of features required by the * Conditionally istantiate each feature class in passed collection if
* configuration and add them to the features registry. A feature is * required by configuration and add it to the features registry. A feature
* described by a `class` and `name` fields and and optional `property` * class meta information contains a `name` field and optional `altName` and
* field: * `alwaysInstantiate` fields
* {
* class: AClass,
* name: 'aClass'
* }
* @param {Array} [features=[]] * @param {Array} [features=[]]
* @private * @private
*/ */
instantiateFeatures(features = []) { instantiateFeatures(features = []) {
features.forEach((feature) => { // features.forEach((feature) => {
// TODO: remove the property field. // // TODO: remove the property field.
// Due to naming convention inconsistencies, a `property` // // Due to naming convention inconsistencies, a `property`
// field is added to allow a conditional instanciation based // // field is added to allow a conditional instanciation based
// on that property on TableFilter, if supplied. // // on that property on TableFilter, if supplied.
feature.property = feature.property || feature.name; // feature.property = feature.property || feature.name;
if (!this.hasConfig || this[feature.property] === true || // if (!this.hasConfig || this[feature.property] === true ||
feature.enforce === true) { // feature.enforce === true) {
let {class: Cls, name} = feature; // let {class: Cls, name} = feature;
this.Mod[name] = this.Mod[name] || new Cls(this); // this.Mod[name] = this.Mod[name] || new Cls(this);
// }
// });
features.forEach(featureCls => {
let Cls = featureCls;
let inst = new Cls(this);
let {meta} = Cls;
let {name} = meta;
if (!this.hasConfig || this[name] === true
|| Boolean(meta.alwaysInstantiate)) {
this.Mod[name] = this.Mod[name] || inst;
} }
}); });
} }
/** /**
* Initialise the passed features collection. A feature is described by a * Initialise each feature class in passed collection.
* `class` and `name` fields and and optional `property` field:
* {
* class: AClass,
* name: 'aClass'
* }
* @param {Array} [features=[]] * @param {Array} [features=[]]
* @private * @private
*/ */
initFeatures(features = []) { initFeatures(features = []) {
features.forEach((feature) => { // features.forEach((feature) => {
let {property, name} = feature; // let {property, name} = feature;
if (this[property] === true && this.Mod[name]) { // if (this[property] === true && this.Mod[name]) {
// this.Mod[name].init();
// }
// });
// this.instantiateFeatures(features);
features.forEach(featureCls => {
this.instantiateFeatures([featureCls]);
let {name} = featureCls.meta;
if (this[name] === true && this.Mod[name]) {
this.Mod[name].init(); this.Mod[name].init();
} }
}); });