@keenthemes/ktui 1.2.3 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ktui.js +2244 -1061
- package/dist/ktui.min.js +1 -1
- package/dist/ktui.min.js.map +1 -1
- package/dist/styles.css +185 -40
- package/lib/cjs/components/context-menu/context-menu.d.ts +66 -0
- package/lib/cjs/components/context-menu/context-menu.d.ts.map +1 -0
- package/lib/cjs/components/context-menu/context-menu.js +423 -0
- package/lib/cjs/components/context-menu/context-menu.js.map +1 -0
- package/lib/cjs/components/context-menu/index.d.ts +7 -0
- package/lib/cjs/components/context-menu/index.d.ts.map +1 -0
- package/lib/cjs/components/context-menu/index.js +10 -0
- package/lib/cjs/components/context-menu/index.js.map +1 -0
- package/lib/cjs/components/context-menu/types.d.ts +30 -0
- package/lib/cjs/components/context-menu/types.d.ts.map +1 -0
- package/lib/cjs/components/context-menu/types.js +7 -0
- package/lib/cjs/components/context-menu/types.js.map +1 -0
- package/lib/cjs/components/datatable/datatable-checkbox.d.ts.map +1 -1
- package/lib/cjs/components/datatable/datatable-checkbox.js +34 -15
- package/lib/cjs/components/datatable/datatable-checkbox.js.map +1 -1
- package/lib/cjs/components/datatable/datatable-contracts.d.ts +66 -0
- package/lib/cjs/components/datatable/datatable-contracts.d.ts.map +1 -0
- package/lib/cjs/components/datatable/datatable-contracts.js +7 -0
- package/lib/cjs/components/datatable/datatable-contracts.js.map +1 -0
- package/lib/cjs/components/datatable/datatable-event-adapter.d.ts +7 -0
- package/lib/cjs/components/datatable/datatable-event-adapter.d.ts.map +1 -0
- package/lib/cjs/components/datatable/datatable-event-adapter.js +16 -0
- package/lib/cjs/components/datatable/datatable-event-adapter.js.map +1 -0
- package/lib/cjs/components/datatable/datatable-local-provider.d.ts +25 -0
- package/lib/cjs/components/datatable/datatable-local-provider.d.ts.map +1 -0
- package/lib/cjs/components/datatable/datatable-local-provider.js +190 -0
- package/lib/cjs/components/datatable/datatable-local-provider.js.map +1 -0
- package/lib/cjs/components/datatable/datatable-pagination-renderer.d.ts +15 -0
- package/lib/cjs/components/datatable/datatable-pagination-renderer.d.ts.map +1 -0
- package/lib/cjs/components/datatable/datatable-pagination-renderer.js +144 -0
- package/lib/cjs/components/datatable/datatable-pagination-renderer.js.map +1 -0
- package/lib/cjs/components/datatable/datatable-remote-provider.d.ts +25 -0
- package/lib/cjs/components/datatable/datatable-remote-provider.d.ts.map +1 -0
- package/lib/cjs/components/datatable/datatable-remote-provider.js +191 -0
- package/lib/cjs/components/datatable/datatable-remote-provider.js.map +1 -0
- package/lib/cjs/components/datatable/datatable-state-store.d.ts +21 -0
- package/lib/cjs/components/datatable/datatable-state-store.d.ts.map +1 -0
- package/lib/cjs/components/datatable/datatable-state-store.js +81 -0
- package/lib/cjs/components/datatable/datatable-state-store.js.map +1 -0
- package/lib/cjs/components/datatable/datatable-table-renderer.d.ts +16 -0
- package/lib/cjs/components/datatable/datatable-table-renderer.d.ts.map +1 -0
- package/lib/cjs/components/datatable/datatable-table-renderer.js +141 -0
- package/lib/cjs/components/datatable/datatable-table-renderer.js.map +1 -0
- package/lib/cjs/components/datatable/datatable.d.ts +9 -87
- package/lib/cjs/components/datatable/datatable.d.ts.map +1 -1
- package/lib/cjs/components/datatable/datatable.js +234 -740
- package/lib/cjs/components/datatable/datatable.js.map +1 -1
- package/lib/cjs/components/dropdown/dropdown.d.ts +2 -2
- package/lib/cjs/components/dropdown/dropdown.d.ts.map +1 -1
- package/lib/cjs/components/dropdown/dropdown.js +68 -31
- package/lib/cjs/components/dropdown/dropdown.js.map +1 -1
- package/lib/cjs/components/input-number/index.d.ts +7 -0
- package/lib/cjs/components/input-number/index.d.ts.map +1 -0
- package/lib/cjs/components/input-number/index.js +10 -0
- package/lib/cjs/components/input-number/index.js.map +1 -0
- package/lib/cjs/components/input-number/input-number.d.ts +40 -0
- package/lib/cjs/components/input-number/input-number.d.ts.map +1 -0
- package/lib/cjs/components/input-number/input-number.js +248 -0
- package/lib/cjs/components/input-number/input-number.js.map +1 -0
- package/lib/cjs/components/input-number/types.d.ts +30 -0
- package/lib/cjs/components/input-number/types.d.ts.map +1 -0
- package/lib/cjs/components/input-number/types.js +7 -0
- package/lib/cjs/components/input-number/types.js.map +1 -0
- package/lib/cjs/components/select/config.d.ts +1 -0
- package/lib/cjs/components/select/config.d.ts.map +1 -1
- package/lib/cjs/components/select/config.js +2 -1
- package/lib/cjs/components/select/config.js.map +1 -1
- package/lib/cjs/components/select/index.d.ts +1 -1
- package/lib/cjs/components/select/index.d.ts.map +1 -1
- package/lib/cjs/components/select/select.d.ts +8 -1
- package/lib/cjs/components/select/select.d.ts.map +1 -1
- package/lib/cjs/components/select/select.js +14 -1
- package/lib/cjs/components/select/select.js.map +1 -1
- package/lib/cjs/components/select/tags.d.ts.map +1 -1
- package/lib/cjs/components/select/tags.js +10 -0
- package/lib/cjs/components/select/tags.js.map +1 -1
- package/lib/cjs/index.d.ts +9 -1
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/index.js +11 -7
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/init-all.d.ts +6 -0
- package/lib/cjs/init-all.d.ts.map +1 -0
- package/lib/cjs/init-all.js +17 -0
- package/lib/cjs/init-all.js.map +1 -0
- package/lib/cjs/legacy.d.ts +8 -0
- package/lib/cjs/legacy.d.ts.map +1 -0
- package/lib/cjs/legacy.js +26 -0
- package/lib/cjs/legacy.js.map +1 -0
- package/lib/esm/components/context-menu/context-menu.d.ts +66 -0
- package/lib/esm/components/context-menu/context-menu.d.ts.map +1 -0
- package/lib/esm/components/context-menu/context-menu.js +420 -0
- package/lib/esm/components/context-menu/context-menu.js.map +1 -0
- package/lib/esm/components/context-menu/index.d.ts +7 -0
- package/lib/esm/components/context-menu/index.d.ts.map +1 -0
- package/lib/esm/components/context-menu/index.js +6 -0
- package/lib/esm/components/context-menu/index.js.map +1 -0
- package/lib/esm/components/context-menu/types.d.ts +30 -0
- package/lib/esm/components/context-menu/types.d.ts.map +1 -0
- package/lib/esm/components/context-menu/types.js +6 -0
- package/lib/esm/components/context-menu/types.js.map +1 -0
- package/lib/esm/components/datatable/datatable-checkbox.d.ts.map +1 -1
- package/lib/esm/components/datatable/datatable-checkbox.js +34 -15
- package/lib/esm/components/datatable/datatable-checkbox.js.map +1 -1
- package/lib/esm/components/datatable/datatable-contracts.d.ts +66 -0
- package/lib/esm/components/datatable/datatable-contracts.d.ts.map +1 -0
- package/lib/esm/components/datatable/datatable-contracts.js +6 -0
- package/lib/esm/components/datatable/datatable-contracts.js.map +1 -0
- package/lib/esm/components/datatable/datatable-event-adapter.d.ts +7 -0
- package/lib/esm/components/datatable/datatable-event-adapter.d.ts.map +1 -0
- package/lib/esm/components/datatable/datatable-event-adapter.js +13 -0
- package/lib/esm/components/datatable/datatable-event-adapter.js.map +1 -0
- package/lib/esm/components/datatable/datatable-local-provider.d.ts +25 -0
- package/lib/esm/components/datatable/datatable-local-provider.d.ts.map +1 -0
- package/lib/esm/components/datatable/datatable-local-provider.js +187 -0
- package/lib/esm/components/datatable/datatable-local-provider.js.map +1 -0
- package/lib/esm/components/datatable/datatable-pagination-renderer.d.ts +15 -0
- package/lib/esm/components/datatable/datatable-pagination-renderer.d.ts.map +1 -0
- package/lib/esm/components/datatable/datatable-pagination-renderer.js +141 -0
- package/lib/esm/components/datatable/datatable-pagination-renderer.js.map +1 -0
- package/lib/esm/components/datatable/datatable-remote-provider.d.ts +25 -0
- package/lib/esm/components/datatable/datatable-remote-provider.d.ts.map +1 -0
- package/lib/esm/components/datatable/datatable-remote-provider.js +188 -0
- package/lib/esm/components/datatable/datatable-remote-provider.js.map +1 -0
- package/lib/esm/components/datatable/datatable-state-store.d.ts +21 -0
- package/lib/esm/components/datatable/datatable-state-store.d.ts.map +1 -0
- package/lib/esm/components/datatable/datatable-state-store.js +78 -0
- package/lib/esm/components/datatable/datatable-state-store.js.map +1 -0
- package/lib/esm/components/datatable/datatable-table-renderer.d.ts +16 -0
- package/lib/esm/components/datatable/datatable-table-renderer.d.ts.map +1 -0
- package/lib/esm/components/datatable/datatable-table-renderer.js +138 -0
- package/lib/esm/components/datatable/datatable-table-renderer.js.map +1 -0
- package/lib/esm/components/datatable/datatable.d.ts +9 -87
- package/lib/esm/components/datatable/datatable.d.ts.map +1 -1
- package/lib/esm/components/datatable/datatable.js +234 -740
- package/lib/esm/components/datatable/datatable.js.map +1 -1
- package/lib/esm/components/dropdown/dropdown.d.ts +2 -2
- package/lib/esm/components/dropdown/dropdown.d.ts.map +1 -1
- package/lib/esm/components/dropdown/dropdown.js +68 -31
- package/lib/esm/components/dropdown/dropdown.js.map +1 -1
- package/lib/esm/components/input-number/index.d.ts +7 -0
- package/lib/esm/components/input-number/index.d.ts.map +1 -0
- package/lib/esm/components/input-number/index.js +6 -0
- package/lib/esm/components/input-number/index.js.map +1 -0
- package/lib/esm/components/input-number/input-number.d.ts +40 -0
- package/lib/esm/components/input-number/input-number.d.ts.map +1 -0
- package/lib/esm/components/input-number/input-number.js +245 -0
- package/lib/esm/components/input-number/input-number.js.map +1 -0
- package/lib/esm/components/input-number/types.d.ts +30 -0
- package/lib/esm/components/input-number/types.d.ts.map +1 -0
- package/lib/esm/components/input-number/types.js +6 -0
- package/lib/esm/components/input-number/types.js.map +1 -0
- package/lib/esm/components/select/config.d.ts +1 -0
- package/lib/esm/components/select/config.d.ts.map +1 -1
- package/lib/esm/components/select/config.js +2 -1
- package/lib/esm/components/select/config.js.map +1 -1
- package/lib/esm/components/select/index.d.ts +1 -1
- package/lib/esm/components/select/index.d.ts.map +1 -1
- package/lib/esm/components/select/select.d.ts +8 -1
- package/lib/esm/components/select/select.d.ts.map +1 -1
- package/lib/esm/components/select/select.js +14 -1
- package/lib/esm/components/select/select.js.map +1 -1
- package/lib/esm/components/select/tags.d.ts.map +1 -1
- package/lib/esm/components/select/tags.js +11 -1
- package/lib/esm/components/select/tags.js.map +1 -1
- package/lib/esm/index.d.ts +9 -1
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js +7 -5
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/init-all.d.ts +6 -0
- package/lib/esm/init-all.d.ts.map +1 -0
- package/lib/esm/init-all.js +13 -0
- package/lib/esm/init-all.js.map +1 -0
- package/lib/esm/legacy.d.ts +8 -0
- package/lib/esm/legacy.d.ts.map +1 -0
- package/lib/esm/legacy.js +8 -0
- package/lib/esm/legacy.js.map +1 -0
- package/package.json +35 -11
- package/src/__tests__/entrypoints.test.ts +71 -0
- package/src/components/context-menu/__tests__/context-menu.test.ts +117 -0
- package/src/components/context-menu/context-menu.css +32 -0
- package/src/components/context-menu/context-menu.ts +529 -0
- package/src/components/context-menu/index.ts +10 -0
- package/src/components/context-menu/types.ts +32 -0
- package/src/components/datatable/__tests__/architecture-boundaries.test.ts +259 -0
- package/src/components/datatable/datatable-checkbox.ts +34 -23
- package/src/components/datatable/datatable-contracts.ts +96 -0
- package/src/components/datatable/datatable-event-adapter.ts +21 -0
- package/src/components/datatable/datatable-local-provider.ts +193 -0
- package/src/components/datatable/datatable-pagination-renderer.ts +225 -0
- package/src/components/datatable/datatable-remote-provider.ts +178 -0
- package/src/components/datatable/datatable-state-store.ts +94 -0
- package/src/components/datatable/datatable-table-renderer.ts +214 -0
- package/src/components/datatable/datatable.ts +250 -918
- package/src/components/dropdown/dropdown.ts +86 -58
- package/src/components/input/input-group.css +14 -1
- package/src/components/input-number/__tests__/input-number.test.ts +278 -0
- package/src/components/input-number/index.ts +11 -0
- package/src/components/input-number/input-number.ts +267 -0
- package/src/components/input-number/types.ts +32 -0
- package/src/components/select/__tests__/ux-behaviors.test.ts +72 -0
- package/src/components/select/config.ts +3 -1
- package/src/components/select/index.ts +1 -1
- package/src/components/select/select.css +23 -20
- package/src/components/select/select.ts +15 -1
- package/src/components/select/tags.ts +14 -1
- package/src/index.ts +18 -5
- package/src/init-all.ts +15 -0
- package/src/legacy.ts +9 -0
- package/styles.css +1 -0
package/dist/ktui.js
CHANGED
|
@@ -4781,10 +4781,10 @@ exports["default"] = KTComponent;
|
|
|
4781
4781
|
|
|
4782
4782
|
/***/ }),
|
|
4783
4783
|
|
|
4784
|
-
/***/ "./src/components/
|
|
4785
|
-
|
|
4786
|
-
!*** ./src/components/
|
|
4787
|
-
|
|
4784
|
+
/***/ "./src/components/context-menu/context-menu.ts":
|
|
4785
|
+
/*!*****************************************************!*\
|
|
4786
|
+
!*** ./src/components/context-menu/context-menu.ts ***!
|
|
4787
|
+
\*****************************************************/
|
|
4788
4788
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
4789
4789
|
|
|
4790
4790
|
|
|
@@ -4792,230 +4792,1277 @@ exports["default"] = KTComponent;
|
|
|
4792
4792
|
* KTUI - Free & Open-Source Tailwind UI Components by Keenthemes
|
|
4793
4793
|
* Copyright 2025 by Keenthemes Inc
|
|
4794
4794
|
*/
|
|
4795
|
-
var
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
}
|
|
4802
|
-
return
|
|
4803
|
-
|
|
4795
|
+
var __extends = (this && this.__extends) || (function () {
|
|
4796
|
+
var extendStatics = function (d, b) {
|
|
4797
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4798
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
4799
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
4800
|
+
return extendStatics(d, b);
|
|
4801
|
+
};
|
|
4802
|
+
return function (d, b) {
|
|
4803
|
+
if (typeof b !== "function" && b !== null)
|
|
4804
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
4805
|
+
extendStatics(d, b);
|
|
4806
|
+
function __() { this.constructor = d; }
|
|
4807
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
4808
|
+
};
|
|
4809
|
+
})();
|
|
4804
4810
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4805
|
-
exports.
|
|
4811
|
+
exports.KTContextMenu = void 0;
|
|
4812
|
+
var core_1 = __webpack_require__(/*! @popperjs/core */ "./node_modules/@popperjs/core/lib/index.js");
|
|
4813
|
+
var dom_1 = __webpack_require__(/*! ../../helpers/dom */ "./src/helpers/dom.ts");
|
|
4814
|
+
var data_1 = __webpack_require__(/*! ../../helpers/data */ "./src/helpers/data.ts");
|
|
4806
4815
|
var event_handler_1 = __webpack_require__(/*! ../../helpers/event-handler */ "./src/helpers/event-handler.ts");
|
|
4807
|
-
|
|
4808
|
-
function
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
if (!
|
|
4844
|
-
return;
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
updateHeaderCheckboxState();
|
|
4850
|
-
}
|
|
4851
|
-
function checkboxHandler() {
|
|
4852
|
-
if (!headerCheckElement)
|
|
4853
|
-
return;
|
|
4854
|
-
headerCheckElement.addEventListener('click', checkboxListener);
|
|
4855
|
-
event_handler_1.default.on(document.body, config.attributes.checkbox, 'input', function (event) {
|
|
4856
|
-
handleRowCheckboxChange(event);
|
|
4857
|
-
});
|
|
4816
|
+
var component_1 = __webpack_require__(/*! ../component */ "./src/components/component.ts");
|
|
4817
|
+
var KTContextMenu = /** @class */ (function (_super) {
|
|
4818
|
+
__extends(KTContextMenu, _super);
|
|
4819
|
+
function KTContextMenu(element, config) {
|
|
4820
|
+
var _this = _super.call(this) || this;
|
|
4821
|
+
_this._name = 'context-menu';
|
|
4822
|
+
_this._defaultConfig = {
|
|
4823
|
+
zindex: 105,
|
|
4824
|
+
placement: 'right-start',
|
|
4825
|
+
placementRtl: 'left-start',
|
|
4826
|
+
permanent: false,
|
|
4827
|
+
dismiss: true,
|
|
4828
|
+
keyboard: true,
|
|
4829
|
+
offset: '0px, 4px',
|
|
4830
|
+
offsetRtl: '0px, 4px',
|
|
4831
|
+
hiddenClass: 'hidden',
|
|
4832
|
+
container: '',
|
|
4833
|
+
preventNativeMenu: true,
|
|
4834
|
+
flip: true,
|
|
4835
|
+
overflow: false,
|
|
4836
|
+
};
|
|
4837
|
+
_this._config = _this._defaultConfig;
|
|
4838
|
+
_this._isTransitioning = false;
|
|
4839
|
+
_this._isOpen = false;
|
|
4840
|
+
_this._shownAt = 0;
|
|
4841
|
+
_this._lastPoint = { x: 0, y: 0 };
|
|
4842
|
+
if (data_1.default.has(element, _this._name))
|
|
4843
|
+
return _this;
|
|
4844
|
+
_this._init(element);
|
|
4845
|
+
_this._buildConfig(config);
|
|
4846
|
+
if (!_this._element)
|
|
4847
|
+
return _this;
|
|
4848
|
+
_this._targetElement = _this._resolveTargetElement(_this._element);
|
|
4849
|
+
if (!_this._targetElement)
|
|
4850
|
+
return _this;
|
|
4851
|
+
_this._menuElement = _this._resolveMenuElement(_this._element);
|
|
4852
|
+
if (!_this._menuElement)
|
|
4853
|
+
return _this;
|
|
4854
|
+
data_1.default.set(_this._menuElement, 'contextMenuElement', _this._element);
|
|
4855
|
+
_this._setupNestedSubmenus();
|
|
4856
|
+
_this._handleContainer();
|
|
4857
|
+
return _this;
|
|
4858
4858
|
}
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4859
|
+
KTContextMenu.prototype._resolveTargetElement = function (root) {
|
|
4860
|
+
var selector = root.getAttribute('data-kt-context-menu-target') || '';
|
|
4861
|
+
if (selector) {
|
|
4862
|
+
var target = document.querySelector(selector);
|
|
4863
|
+
if (target)
|
|
4864
|
+
return target;
|
|
4865
|
+
}
|
|
4866
|
+
var localTarget = root.querySelector('[data-kt-context-menu-trigger]');
|
|
4867
|
+
var localToggle = root.querySelector('[data-kt-context-menu-toggle]');
|
|
4868
|
+
return localTarget || localToggle || root;
|
|
4869
|
+
};
|
|
4870
|
+
KTContextMenu.prototype._resolveMenuElement = function (root) {
|
|
4871
|
+
var menu = root.querySelector('[data-kt-context-menu-menu]');
|
|
4872
|
+
return menu;
|
|
4873
|
+
};
|
|
4874
|
+
KTContextMenu.prototype._handleContainer = function () {
|
|
4875
|
+
var _a;
|
|
4876
|
+
var container = this._getOption('container');
|
|
4877
|
+
if (!container)
|
|
4863
4878
|
return;
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
var wasChecked = selectedRows.includes(value);
|
|
4867
|
-
var isNowChecked = input.checked;
|
|
4868
|
-
// Update state first
|
|
4869
|
-
if (isNowChecked) {
|
|
4870
|
-
if (!wasChecked)
|
|
4871
|
-
selectedRows.push(value);
|
|
4879
|
+
if (container === 'body') {
|
|
4880
|
+
document.body.appendChild(this._menuElement);
|
|
4872
4881
|
}
|
|
4873
4882
|
else {
|
|
4874
|
-
|
|
4883
|
+
(_a = document
|
|
4884
|
+
.querySelector(container)) === null || _a === void 0 ? void 0 : _a.appendChild(this._menuElement);
|
|
4875
4885
|
}
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4886
|
+
};
|
|
4887
|
+
KTContextMenu.prototype._setupNestedSubmenus = function () {
|
|
4888
|
+
var submenus = this._menuElement.querySelectorAll('[data-kt-context-menu]');
|
|
4889
|
+
submenus.forEach(function (submenu) {
|
|
4890
|
+
new KTContextMenu(submenu);
|
|
4891
|
+
});
|
|
4892
|
+
};
|
|
4893
|
+
KTContextMenu.prototype._updatePoint = function (x, y) {
|
|
4894
|
+
this._lastPoint = { x: x, y: y };
|
|
4895
|
+
};
|
|
4896
|
+
KTContextMenu.prototype._toggleAtEvent = function (event) {
|
|
4897
|
+
if (this._isOpen) {
|
|
4898
|
+
this._hide();
|
|
4899
|
+
return;
|
|
4881
4900
|
}
|
|
4882
|
-
|
|
4883
|
-
|
|
4901
|
+
this._showAt(event.clientX, event.clientY);
|
|
4902
|
+
};
|
|
4903
|
+
KTContextMenu.prototype._showAtEvent = function (event) {
|
|
4904
|
+
event.stopPropagation();
|
|
4905
|
+
if (this._getOption('preventNativeMenu') === true) {
|
|
4906
|
+
event.preventDefault();
|
|
4884
4907
|
}
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
// Update state first, then fire events
|
|
4892
|
-
change(checked);
|
|
4893
|
-
// Fire checked/unchecked events after state is updated
|
|
4894
|
-
var eventType = checked ? 'checked' : 'unchecked';
|
|
4895
|
-
fireEvent(eventType);
|
|
4896
|
-
}
|
|
4897
|
-
// Change all visible checkboxes and update selectedRows
|
|
4898
|
-
function change(checked) {
|
|
4908
|
+
this._toggleAtEvent(event);
|
|
4909
|
+
};
|
|
4910
|
+
KTContextMenu.prototype._showAt = function (x, y) {
|
|
4911
|
+
var _this = this;
|
|
4912
|
+
if (this._isOpen || this._isTransitioning)
|
|
4913
|
+
return;
|
|
4899
4914
|
var payload = { cancel: false };
|
|
4900
|
-
|
|
4901
|
-
|
|
4915
|
+
this._fireEvent('show', payload);
|
|
4916
|
+
this._dispatchEvent('show', payload);
|
|
4917
|
+
if (payload.cancel)
|
|
4902
4918
|
return;
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
if (checked) {
|
|
4910
|
-
// Add all visible IDs to selectedRows
|
|
4911
|
-
selectedRows = preserveSelection
|
|
4912
|
-
? Array.from(new Set(__spreadArray(__spreadArray([], selectedRows, true), visibleIds_1, true)))
|
|
4913
|
-
: visibleIds_1;
|
|
4914
|
-
}
|
|
4915
|
-
else {
|
|
4916
|
-
// Remove all visible IDs from selectedRows
|
|
4917
|
-
selectedRows = preserveSelection
|
|
4918
|
-
? selectedRows.filter(function (v) { return !visibleIds_1.includes(v); })
|
|
4919
|
-
: [];
|
|
4920
|
-
}
|
|
4921
|
-
setSelectedRows(selectedRows);
|
|
4922
|
-
// Update visible checkboxes
|
|
4923
|
-
targetElements.forEach(function (element) {
|
|
4924
|
-
if (element) {
|
|
4925
|
-
element.checked = checked;
|
|
4926
|
-
}
|
|
4927
|
-
});
|
|
4919
|
+
KTContextMenu.hide(this._element);
|
|
4920
|
+
this._updatePoint(x, y);
|
|
4921
|
+
var zIndex = parseInt(this._getOption('zindex'), 10);
|
|
4922
|
+
var parentZindex = dom_1.default.getHighestZindex(this._targetElement);
|
|
4923
|
+
if (parentZindex !== null && parentZindex >= zIndex) {
|
|
4924
|
+
zIndex = parentZindex + 1;
|
|
4928
4925
|
}
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4926
|
+
if (zIndex > 0) {
|
|
4927
|
+
this._menuElement.style.zIndex = zIndex.toString();
|
|
4928
|
+
}
|
|
4929
|
+
this._menuElement.style.display = 'block';
|
|
4930
|
+
this._menuElement.style.opacity = '0';
|
|
4931
|
+
dom_1.default.reflow(this._menuElement);
|
|
4932
|
+
this._menuElement.style.opacity = '1';
|
|
4933
|
+
this._menuElement.classList.remove(this._getOption('hiddenClass'));
|
|
4934
|
+
this._menuElement.classList.add('open');
|
|
4935
|
+
this._element.classList.add('open');
|
|
4936
|
+
this._initPopper();
|
|
4937
|
+
dom_1.default.transitionEnd(this._menuElement, function () {
|
|
4938
|
+
_this._isTransitioning = false;
|
|
4939
|
+
_this._isOpen = true;
|
|
4940
|
+
_this._fireEvent('shown');
|
|
4941
|
+
_this._dispatchEvent('shown');
|
|
4942
|
+
});
|
|
4943
|
+
this._shownAt = Date.now();
|
|
4944
|
+
};
|
|
4945
|
+
KTContextMenu.prototype._hide = function () {
|
|
4946
|
+
var _this = this;
|
|
4947
|
+
if (!this._isOpen || this._isTransitioning)
|
|
4936
4948
|
return;
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4949
|
+
var payload = { cancel: false };
|
|
4950
|
+
this._fireEvent('hide', payload);
|
|
4951
|
+
this._dispatchEvent('hide', payload);
|
|
4952
|
+
if (payload.cancel)
|
|
4953
|
+
return;
|
|
4954
|
+
this._menuElement.style.opacity = '1';
|
|
4955
|
+
dom_1.default.reflow(this._menuElement);
|
|
4956
|
+
this._menuElement.style.opacity = '0';
|
|
4957
|
+
this._menuElement.classList.remove('open');
|
|
4958
|
+
this._element.classList.remove('open');
|
|
4959
|
+
dom_1.default.transitionEnd(this._menuElement, function () {
|
|
4960
|
+
_this._isTransitioning = false;
|
|
4961
|
+
_this._isOpen = false;
|
|
4962
|
+
_this._menuElement.classList.add(_this._getOption('hiddenClass'));
|
|
4963
|
+
_this._menuElement.style.display = '';
|
|
4964
|
+
_this._menuElement.style.zIndex = '';
|
|
4965
|
+
_this._destroyPopper();
|
|
4966
|
+
_this._fireEvent('hidden');
|
|
4967
|
+
_this._dispatchEvent('hidden');
|
|
4968
|
+
});
|
|
4969
|
+
};
|
|
4970
|
+
KTContextMenu.prototype._getVirtualReference = function () {
|
|
4971
|
+
var point = this._lastPoint;
|
|
4972
|
+
return {
|
|
4973
|
+
getBoundingClientRect: function () {
|
|
4974
|
+
return ({
|
|
4975
|
+
x: point.x,
|
|
4976
|
+
y: point.y,
|
|
4977
|
+
top: point.y,
|
|
4978
|
+
left: point.x,
|
|
4979
|
+
right: point.x,
|
|
4980
|
+
bottom: point.y,
|
|
4981
|
+
width: 0,
|
|
4982
|
+
height: 0,
|
|
4983
|
+
toJSON: function () { return ({}); },
|
|
4984
|
+
});
|
|
4985
|
+
},
|
|
4986
|
+
};
|
|
4987
|
+
};
|
|
4988
|
+
KTContextMenu.prototype._initPopper = function () {
|
|
4989
|
+
var popper = (0, core_1.createPopper)(this._getVirtualReference(), this._menuElement, this._getPopperConfig());
|
|
4990
|
+
data_1.default.set(this._element, 'popper', popper);
|
|
4991
|
+
};
|
|
4992
|
+
KTContextMenu.prototype._destroyPopper = function () {
|
|
4993
|
+
if (data_1.default.has(this._element, 'popper')) {
|
|
4994
|
+
data_1.default.get(this._element, 'popper').destroy();
|
|
4995
|
+
data_1.default.remove(this._element, 'popper');
|
|
4996
|
+
}
|
|
4997
|
+
};
|
|
4998
|
+
KTContextMenu.prototype._getPopperConfig = function () {
|
|
4999
|
+
var isRtl = dom_1.default.isRTL();
|
|
5000
|
+
var placement = this._getOption('placement');
|
|
5001
|
+
if (isRtl && this._getOption('placementRtl')) {
|
|
5002
|
+
placement = this._getOption('placementRtl');
|
|
5003
|
+
}
|
|
5004
|
+
var offsetValue = this._getOption('offset');
|
|
5005
|
+
if (isRtl && this._getOption('offsetRtl')) {
|
|
5006
|
+
offsetValue = this._getOption('offsetRtl');
|
|
5007
|
+
}
|
|
5008
|
+
var offset = offsetValue
|
|
5009
|
+
? offsetValue
|
|
5010
|
+
.toString()
|
|
5011
|
+
.split(',')
|
|
5012
|
+
.map(function (value) { return parseInt(value.trim(), 10); })
|
|
5013
|
+
: [0, 0];
|
|
5014
|
+
var strategy = this._getOption('overflow') === true ? 'absolute' : 'fixed';
|
|
5015
|
+
var altAxis = this._getOption('flip') !== false;
|
|
5016
|
+
return {
|
|
5017
|
+
placement: placement,
|
|
5018
|
+
strategy: strategy,
|
|
5019
|
+
modifiers: [
|
|
5020
|
+
{ name: 'offset', options: { offset: offset } },
|
|
5021
|
+
{ name: 'preventOverflow', options: { altAxis: altAxis } },
|
|
5022
|
+
{ name: 'flip', options: { flipVariations: false } },
|
|
5023
|
+
],
|
|
5024
|
+
};
|
|
5025
|
+
};
|
|
5026
|
+
KTContextMenu.prototype._isContextMenuOpen = function () {
|
|
5027
|
+
return (this._element.classList.contains('open') &&
|
|
5028
|
+
this._menuElement.classList.contains('open'));
|
|
5029
|
+
};
|
|
5030
|
+
KTContextMenu.prototype.showAt = function (x, y) {
|
|
5031
|
+
this._showAt(x, y);
|
|
5032
|
+
};
|
|
5033
|
+
KTContextMenu.prototype.showAtEvent = function (event) {
|
|
5034
|
+
this._showAtEvent(event);
|
|
5035
|
+
};
|
|
5036
|
+
KTContextMenu.prototype.hide = function () {
|
|
5037
|
+
this._hide();
|
|
5038
|
+
};
|
|
5039
|
+
KTContextMenu.prototype.toggleAtEvent = function (event) {
|
|
5040
|
+
this._toggleAtEvent(event);
|
|
5041
|
+
};
|
|
5042
|
+
KTContextMenu.prototype.isOpen = function () {
|
|
5043
|
+
return this._isContextMenuOpen();
|
|
5044
|
+
};
|
|
5045
|
+
KTContextMenu.prototype.getMenuElement = function () {
|
|
5046
|
+
return this._menuElement;
|
|
5047
|
+
};
|
|
5048
|
+
KTContextMenu.prototype.getTargetElement = function () {
|
|
5049
|
+
return this._targetElement;
|
|
5050
|
+
};
|
|
5051
|
+
KTContextMenu.getElement = function (reference) {
|
|
5052
|
+
if (reference &&
|
|
5053
|
+
reference.hasAttribute('data-kt-context-menu-initialized')) {
|
|
5054
|
+
return reference;
|
|
5055
|
+
}
|
|
5056
|
+
var initializedParent = reference === null || reference === void 0 ? void 0 : reference.closest('[data-kt-context-menu-initialized]');
|
|
5057
|
+
if (initializedParent)
|
|
5058
|
+
return initializedParent;
|
|
5059
|
+
var container = reference === null || reference === void 0 ? void 0 : reference.closest('[data-kt-context-menu]');
|
|
5060
|
+
if (container)
|
|
5061
|
+
return container;
|
|
5062
|
+
if (reference &&
|
|
5063
|
+
reference.hasAttribute('data-kt-context-menu-menu') &&
|
|
5064
|
+
data_1.default.has(reference, 'contextMenuElement')) {
|
|
5065
|
+
return data_1.default.get(reference, 'contextMenuElement');
|
|
5066
|
+
}
|
|
5067
|
+
return null;
|
|
5068
|
+
};
|
|
5069
|
+
KTContextMenu.getInstance = function (element) {
|
|
5070
|
+
element = this.getElement(element);
|
|
5071
|
+
if (!element)
|
|
5072
|
+
return null;
|
|
5073
|
+
if (data_1.default.has(element, 'context-menu')) {
|
|
5074
|
+
return data_1.default.get(element, 'context-menu');
|
|
5075
|
+
}
|
|
5076
|
+
if (element.getAttribute('data-kt-context-menu-initialized') === 'true') {
|
|
5077
|
+
return new KTContextMenu(element);
|
|
5078
|
+
}
|
|
5079
|
+
return null;
|
|
5080
|
+
};
|
|
5081
|
+
KTContextMenu.getOrCreateInstance = function (element, config) {
|
|
5082
|
+
return this.getInstance(element) || new KTContextMenu(element, config);
|
|
5083
|
+
};
|
|
5084
|
+
KTContextMenu.update = function () {
|
|
5085
|
+
document
|
|
5086
|
+
.querySelectorAll('.open[data-kt-context-menu-initialized]')
|
|
5087
|
+
.forEach(function (item) {
|
|
5088
|
+
if (data_1.default.has(item, 'popper')) {
|
|
5089
|
+
data_1.default.get(item, 'popper').forceUpdate();
|
|
5090
|
+
}
|
|
5091
|
+
});
|
|
5092
|
+
};
|
|
5093
|
+
KTContextMenu.hide = function (skipElement) {
|
|
5094
|
+
document
|
|
5095
|
+
.querySelectorAll('.open[data-kt-context-menu-initialized]:not([data-kt-context-menu-permanent="true"])')
|
|
5096
|
+
.forEach(function (item) {
|
|
5097
|
+
if (skipElement && (skipElement === item || item.contains(skipElement)))
|
|
5098
|
+
return;
|
|
5099
|
+
var contextMenu = KTContextMenu.getInstance(item);
|
|
5100
|
+
if (contextMenu)
|
|
5101
|
+
contextMenu.hide();
|
|
5102
|
+
});
|
|
5103
|
+
};
|
|
5104
|
+
KTContextMenu.handleOpen = function () {
|
|
5105
|
+
event_handler_1.default.on(document.body, '[data-kt-context-menu-trigger], [data-kt-context-menu-target], [data-kt-context-menu]', 'contextmenu', function (event, target) {
|
|
5106
|
+
var contextMenu = KTContextMenu.getInstance(target);
|
|
5107
|
+
if (contextMenu) {
|
|
5108
|
+
contextMenu.showAtEvent(event);
|
|
5109
|
+
}
|
|
5110
|
+
});
|
|
5111
|
+
};
|
|
5112
|
+
KTContextMenu.handleToggle = function () {
|
|
5113
|
+
event_handler_1.default.on(document.body, '[data-kt-context-menu-toggle]', 'click', function (event, target) {
|
|
5114
|
+
event.preventDefault();
|
|
5115
|
+
event.stopPropagation();
|
|
5116
|
+
var contextMenu = KTContextMenu.getInstance(target);
|
|
5117
|
+
if (contextMenu) {
|
|
5118
|
+
var rect = target.getBoundingClientRect();
|
|
5119
|
+
contextMenu.showAt(rect.right, rect.top);
|
|
5120
|
+
}
|
|
5121
|
+
});
|
|
5122
|
+
};
|
|
5123
|
+
KTContextMenu.handleClickAway = function () {
|
|
5124
|
+
document.addEventListener('click', function (event) {
|
|
5125
|
+
document
|
|
5126
|
+
.querySelectorAll('.open[data-kt-context-menu-initialized]:not([data-kt-context-menu-permanent="true"])')
|
|
5127
|
+
.forEach(function (element) {
|
|
5128
|
+
var contextMenu = KTContextMenu.getInstance(element);
|
|
5129
|
+
if (!contextMenu)
|
|
5130
|
+
return;
|
|
5131
|
+
var menuElement = contextMenu.getMenuElement();
|
|
5132
|
+
var targetElement = contextMenu.getTargetElement();
|
|
5133
|
+
if (targetElement === event.target ||
|
|
5134
|
+
targetElement.contains(event.target) ||
|
|
5135
|
+
menuElement === event.target ||
|
|
5136
|
+
menuElement.contains(event.target)) {
|
|
5137
|
+
return;
|
|
5138
|
+
}
|
|
5139
|
+
contextMenu.hide();
|
|
5140
|
+
});
|
|
5141
|
+
});
|
|
5142
|
+
};
|
|
5143
|
+
KTContextMenu.handleKeyboard = function () {
|
|
5144
|
+
document.addEventListener('keydown', function (event) {
|
|
5145
|
+
var contextMenuEl = document.querySelector('.open[data-kt-context-menu-initialized]');
|
|
5146
|
+
var contextMenu = KTContextMenu.getInstance(contextMenuEl);
|
|
5147
|
+
if (!contextMenu || !contextMenu._getOption('keyboard'))
|
|
5148
|
+
return;
|
|
5149
|
+
if (event.key === 'Escape' &&
|
|
5150
|
+
!(event.ctrlKey || event.altKey || event.shiftKey)) {
|
|
5151
|
+
contextMenu.hide();
|
|
5152
|
+
}
|
|
5153
|
+
});
|
|
5154
|
+
};
|
|
5155
|
+
KTContextMenu.handleDismiss = function () {
|
|
5156
|
+
event_handler_1.default.on(document.body, '[data-kt-context-menu-dismiss], [data-kt-dropdown-dismiss]', 'click', function (_event, target) {
|
|
5157
|
+
var contextMenu = KTContextMenu.getInstance(target);
|
|
5158
|
+
if (contextMenu) {
|
|
5159
|
+
contextMenu.hide();
|
|
5160
|
+
}
|
|
5161
|
+
});
|
|
5162
|
+
};
|
|
5163
|
+
KTContextMenu.initHandlers = function () {
|
|
5164
|
+
this.handleOpen();
|
|
5165
|
+
this.handleToggle();
|
|
5166
|
+
this.handleClickAway();
|
|
5167
|
+
this.handleKeyboard();
|
|
5168
|
+
this.handleDismiss();
|
|
5169
|
+
};
|
|
5170
|
+
KTContextMenu.createInstances = function () {
|
|
5171
|
+
var elements = document.querySelectorAll('[data-kt-context-menu]');
|
|
5172
|
+
elements.forEach(function (element) {
|
|
5173
|
+
new KTContextMenu(element);
|
|
5174
|
+
});
|
|
5175
|
+
};
|
|
5176
|
+
KTContextMenu.init = function () {
|
|
5177
|
+
KTContextMenu.createInstances();
|
|
5178
|
+
if (window.KT_CONTEXT_MENU_INITIALIZED !== true) {
|
|
5179
|
+
KTContextMenu.initHandlers();
|
|
5180
|
+
window.KT_CONTEXT_MENU_INITIALIZED = true;
|
|
5181
|
+
}
|
|
5182
|
+
};
|
|
5183
|
+
KTContextMenu.reinit = function () {
|
|
5184
|
+
var elements = document.querySelectorAll('[data-kt-context-menu]');
|
|
5185
|
+
elements.forEach(function (element) {
|
|
5186
|
+
try {
|
|
5187
|
+
var instance = KTContextMenu.getInstance(element);
|
|
5188
|
+
if (instance && typeof instance.hide === 'function') {
|
|
5189
|
+
instance.hide();
|
|
5190
|
+
}
|
|
5191
|
+
data_1.default.remove(element, 'context-menu');
|
|
5192
|
+
data_1.default.remove(element, 'popper');
|
|
5193
|
+
element.removeAttribute('data-kt-context-menu-initialized');
|
|
5194
|
+
var menu = element.querySelector('[data-kt-context-menu-menu]');
|
|
5195
|
+
if (menu) {
|
|
5196
|
+
data_1.default.remove(menu, 'contextMenuElement');
|
|
5197
|
+
}
|
|
5198
|
+
}
|
|
5199
|
+
catch (_a) {
|
|
5200
|
+
// ignore per-element cleanup errors
|
|
5201
|
+
}
|
|
5202
|
+
});
|
|
5203
|
+
KTContextMenu.createInstances();
|
|
5204
|
+
KTContextMenu.initHandlers();
|
|
5205
|
+
};
|
|
5206
|
+
return KTContextMenu;
|
|
5207
|
+
}(component_1.default));
|
|
5208
|
+
exports.KTContextMenu = KTContextMenu;
|
|
5209
|
+
if (typeof window !== 'undefined') {
|
|
5210
|
+
window.KTContextMenu = KTContextMenu;
|
|
5211
|
+
}
|
|
5212
|
+
|
|
5213
|
+
|
|
5214
|
+
/***/ }),
|
|
5215
|
+
|
|
5216
|
+
/***/ "./src/components/context-menu/index.ts":
|
|
5217
|
+
/*!**********************************************!*\
|
|
5218
|
+
!*** ./src/components/context-menu/index.ts ***!
|
|
5219
|
+
\**********************************************/
|
|
5220
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
5221
|
+
|
|
5222
|
+
|
|
5223
|
+
/**
|
|
5224
|
+
* KTUI - Free & Open-Source Tailwind UI Components by Keenthemes
|
|
5225
|
+
* Copyright 2025 by Keenthemes Inc
|
|
5226
|
+
*/
|
|
5227
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
5228
|
+
exports.KTContextMenu = void 0;
|
|
5229
|
+
var context_menu_1 = __webpack_require__(/*! ./context-menu */ "./src/components/context-menu/context-menu.ts");
|
|
5230
|
+
Object.defineProperty(exports, "KTContextMenu", ({ enumerable: true, get: function () { return context_menu_1.KTContextMenu; } }));
|
|
5231
|
+
|
|
5232
|
+
|
|
5233
|
+
/***/ }),
|
|
5234
|
+
|
|
5235
|
+
/***/ "./src/components/datatable/datatable-checkbox.ts":
|
|
5236
|
+
/*!********************************************************!*\
|
|
5237
|
+
!*** ./src/components/datatable/datatable-checkbox.ts ***!
|
|
5238
|
+
\********************************************************/
|
|
5239
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
5240
|
+
|
|
5241
|
+
|
|
5242
|
+
/**
|
|
5243
|
+
* KTUI - Free & Open-Source Tailwind UI Components by Keenthemes
|
|
5244
|
+
* Copyright 2025 by Keenthemes Inc
|
|
5245
|
+
*/
|
|
5246
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
5247
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
5248
|
+
if (ar || !(i in from)) {
|
|
5249
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
5250
|
+
ar[i] = from[i];
|
|
5251
|
+
}
|
|
5252
|
+
}
|
|
5253
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
5254
|
+
};
|
|
5255
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
5256
|
+
exports.createCheckboxHandler = createCheckboxHandler;
|
|
5257
|
+
var event_handler_1 = __webpack_require__(/*! ../../helpers/event-handler */ "./src/helpers/event-handler.ts");
|
|
5258
|
+
// Main function to create checkbox logic for a datatable instance
|
|
5259
|
+
function createCheckboxHandler(element, config, fireEvent) {
|
|
5260
|
+
var _a;
|
|
5261
|
+
var headerChecked = false;
|
|
5262
|
+
var headerCheckElement = null;
|
|
5263
|
+
var targetElements = null;
|
|
5264
|
+
// Default: preserve selection across all pages
|
|
5265
|
+
var preserveSelection = ((_a = config.checkbox) === null || _a === void 0 ? void 0 : _a.preserveSelection) !== false;
|
|
5266
|
+
function ensureState() {
|
|
5267
|
+
var state = config._state;
|
|
5268
|
+
if (!state) {
|
|
5269
|
+
state = {};
|
|
5270
|
+
config._state = state;
|
|
5271
|
+
}
|
|
5272
|
+
return state;
|
|
5273
|
+
}
|
|
5274
|
+
// Helper: get selectedRows from state, always as string[]
|
|
5275
|
+
function getSelectedRows() {
|
|
5276
|
+
var state = ensureState();
|
|
5277
|
+
if (!Array.isArray(state.selectedRows))
|
|
5278
|
+
state.selectedRows = [];
|
|
5279
|
+
return state.selectedRows.map(String);
|
|
5280
|
+
}
|
|
5281
|
+
// Helper: set selectedRows in state
|
|
5282
|
+
function setSelectedRows(rows) {
|
|
5283
|
+
var state = ensureState();
|
|
5284
|
+
state.selectedRows = Array.from(new Set(rows.map(String)));
|
|
5285
|
+
}
|
|
5286
|
+
// Helper: get all visible row IDs (values)
|
|
5287
|
+
function getVisibleRowIds() {
|
|
5288
|
+
if (!targetElements)
|
|
5289
|
+
return [];
|
|
5290
|
+
return Array.from(targetElements)
|
|
5291
|
+
.map(function (el) { return el.value; })
|
|
5292
|
+
.filter(function (v) { return v != null && v !== ''; });
|
|
5293
|
+
}
|
|
5294
|
+
// Listener for header checkbox
|
|
5295
|
+
var checkboxListener = function (event) {
|
|
5296
|
+
checkboxToggle(event);
|
|
5297
|
+
};
|
|
5298
|
+
function init() {
|
|
5299
|
+
var attrs = config.attributes;
|
|
5300
|
+
if (!(attrs === null || attrs === void 0 ? void 0 : attrs.check) || !attrs.checkbox) {
|
|
5301
|
+
return;
|
|
5302
|
+
}
|
|
5303
|
+
headerCheckElement = element.querySelector(attrs.check);
|
|
5304
|
+
if (!headerCheckElement)
|
|
5305
|
+
return;
|
|
5306
|
+
headerChecked = headerCheckElement.checked;
|
|
5307
|
+
targetElements = element.querySelectorAll(attrs.checkbox);
|
|
5308
|
+
checkboxHandler();
|
|
5309
|
+
reapplyCheckedStates();
|
|
5310
|
+
updateHeaderCheckboxState();
|
|
5311
|
+
}
|
|
5312
|
+
function checkboxHandler() {
|
|
5313
|
+
var _a;
|
|
5314
|
+
if (!headerCheckElement)
|
|
5315
|
+
return;
|
|
5316
|
+
var rowCheckboxSelector = (_a = config.attributes) === null || _a === void 0 ? void 0 : _a.checkbox;
|
|
5317
|
+
if (!rowCheckboxSelector)
|
|
5318
|
+
return;
|
|
5319
|
+
headerCheckElement.addEventListener('click', checkboxListener);
|
|
5320
|
+
event_handler_1.default.on(document.body, rowCheckboxSelector, 'input', (function (event) {
|
|
5321
|
+
if (event)
|
|
5322
|
+
handleRowCheckboxChange(event);
|
|
5323
|
+
}));
|
|
5324
|
+
}
|
|
5325
|
+
// When a row checkbox is changed
|
|
5326
|
+
function handleRowCheckboxChange(event) {
|
|
5327
|
+
var input = event.target;
|
|
5328
|
+
if (!input)
|
|
5329
|
+
return;
|
|
5330
|
+
var value = input.value;
|
|
5331
|
+
var selectedRows = getSelectedRows();
|
|
5332
|
+
var wasChecked = selectedRows.includes(value);
|
|
5333
|
+
var isNowChecked = input.checked;
|
|
5334
|
+
// Update state first
|
|
5335
|
+
if (isNowChecked) {
|
|
5336
|
+
if (!wasChecked)
|
|
5337
|
+
selectedRows.push(value);
|
|
5338
|
+
}
|
|
5339
|
+
else {
|
|
5340
|
+
selectedRows = selectedRows.filter(function (v) { return v !== value; });
|
|
5341
|
+
}
|
|
5342
|
+
setSelectedRows(selectedRows);
|
|
5343
|
+
updateHeaderCheckboxState();
|
|
5344
|
+
// Fire specific checked/unchecked events after state is updated
|
|
5345
|
+
if (isNowChecked && !wasChecked) {
|
|
5346
|
+
fireEvent('checked');
|
|
5347
|
+
}
|
|
5348
|
+
else if (!isNowChecked && wasChecked) {
|
|
5349
|
+
fireEvent('unchecked');
|
|
5350
|
+
}
|
|
5351
|
+
// Always fire changed event for backward compatibility
|
|
5352
|
+
fireEvent('changed');
|
|
5353
|
+
}
|
|
5354
|
+
// When the header checkbox is toggled
|
|
5355
|
+
function checkboxToggle(_event) {
|
|
5356
|
+
var checked = !isChecked();
|
|
5357
|
+
// Update state first, then fire events
|
|
5358
|
+
change(checked);
|
|
5359
|
+
// Fire checked/unchecked events after state is updated
|
|
5360
|
+
var eventType = checked ? 'checked' : 'unchecked';
|
|
5361
|
+
fireEvent(eventType);
|
|
5362
|
+
}
|
|
5363
|
+
// Change all visible checkboxes and update selectedRows
|
|
5364
|
+
function change(checked) {
|
|
5365
|
+
var payload = { cancel: false };
|
|
5366
|
+
fireEvent('change', payload);
|
|
5367
|
+
if (payload.cancel === true)
|
|
5368
|
+
return;
|
|
5369
|
+
headerChecked = checked;
|
|
5370
|
+
if (headerCheckElement)
|
|
5371
|
+
headerCheckElement.checked = checked;
|
|
5372
|
+
if (targetElements) {
|
|
5373
|
+
var visibleIds_1 = getVisibleRowIds();
|
|
5374
|
+
var selectedRows = getSelectedRows();
|
|
5375
|
+
if (checked) {
|
|
5376
|
+
// Add all visible IDs to selectedRows
|
|
5377
|
+
selectedRows = preserveSelection
|
|
5378
|
+
? Array.from(new Set(__spreadArray(__spreadArray([], selectedRows, true), visibleIds_1, true)))
|
|
5379
|
+
: visibleIds_1;
|
|
5380
|
+
}
|
|
5381
|
+
else {
|
|
5382
|
+
// Remove all visible IDs from selectedRows
|
|
5383
|
+
selectedRows = preserveSelection
|
|
5384
|
+
? selectedRows.filter(function (v) { return !visibleIds_1.includes(v); })
|
|
5385
|
+
: [];
|
|
5386
|
+
}
|
|
5387
|
+
setSelectedRows(selectedRows);
|
|
5388
|
+
// Update visible checkboxes
|
|
5389
|
+
targetElements.forEach(function (element) {
|
|
5390
|
+
if (element) {
|
|
5391
|
+
element.checked = checked;
|
|
5392
|
+
}
|
|
5393
|
+
});
|
|
5394
|
+
}
|
|
5395
|
+
updateHeaderCheckboxState();
|
|
5396
|
+
fireEvent('changed');
|
|
5397
|
+
}
|
|
5398
|
+
// Reapply checked state to visible checkboxes based on selectedRows
|
|
5399
|
+
function reapplyCheckedStates() {
|
|
5400
|
+
var selectedRows = getSelectedRows();
|
|
5401
|
+
if (!targetElements)
|
|
5402
|
+
return;
|
|
5403
|
+
targetElements.forEach(function (element) {
|
|
5404
|
+
var _a;
|
|
5405
|
+
if (!element)
|
|
5406
|
+
return;
|
|
5407
|
+
var value = element.value;
|
|
5408
|
+
element.checked = selectedRows.includes(value);
|
|
5409
|
+
// Update row class
|
|
5410
|
+
var row = element.closest('tr');
|
|
5411
|
+
if (row && ((_a = config.checkbox) === null || _a === void 0 ? void 0 : _a.checkedClass)) {
|
|
5412
|
+
if (element.checked) {
|
|
5413
|
+
row.classList.add(config.checkbox.checkedClass);
|
|
5414
|
+
}
|
|
5415
|
+
else {
|
|
5416
|
+
row.classList.remove(config.checkbox.checkedClass);
|
|
5417
|
+
}
|
|
5418
|
+
}
|
|
5419
|
+
});
|
|
5420
|
+
}
|
|
5421
|
+
// Update header checkbox state (checked/indeterminate/unchecked)
|
|
5422
|
+
function updateHeaderCheckboxState() {
|
|
5423
|
+
if (!headerCheckElement || !targetElements)
|
|
5424
|
+
return;
|
|
5425
|
+
var total = targetElements.length;
|
|
5426
|
+
var checked = 0;
|
|
5427
|
+
for (var i = 0; i < total; i++) {
|
|
5428
|
+
if (targetElements[i].checked)
|
|
5429
|
+
checked++;
|
|
5430
|
+
}
|
|
5431
|
+
if (checked === 0) {
|
|
5432
|
+
headerCheckElement.indeterminate = false;
|
|
5433
|
+
headerCheckElement.checked = false;
|
|
5434
|
+
headerChecked = false;
|
|
5435
|
+
}
|
|
5436
|
+
else if (checked > 0 && checked < total) {
|
|
5437
|
+
headerCheckElement.indeterminate = true;
|
|
5438
|
+
headerCheckElement.checked = false;
|
|
5439
|
+
headerChecked = false;
|
|
5440
|
+
}
|
|
5441
|
+
else if (checked === total) {
|
|
5442
|
+
headerCheckElement.indeterminate = false;
|
|
5443
|
+
headerCheckElement.checked = true;
|
|
5444
|
+
headerChecked = true;
|
|
5445
|
+
}
|
|
5446
|
+
}
|
|
5447
|
+
// Fix: isChecked() implementation
|
|
5448
|
+
function isChecked() {
|
|
5449
|
+
return headerChecked;
|
|
5450
|
+
}
|
|
5451
|
+
function getChecked() {
|
|
5452
|
+
return getSelectedRows();
|
|
5453
|
+
}
|
|
5454
|
+
function check() {
|
|
5455
|
+
change(true);
|
|
5456
|
+
reapplyCheckedStates();
|
|
5457
|
+
updateHeaderCheckboxState();
|
|
5458
|
+
}
|
|
5459
|
+
function uncheck() {
|
|
5460
|
+
change(false);
|
|
5461
|
+
reapplyCheckedStates();
|
|
5462
|
+
updateHeaderCheckboxState();
|
|
5463
|
+
}
|
|
5464
|
+
function toggle() {
|
|
5465
|
+
checkboxToggle();
|
|
5466
|
+
reapplyCheckedStates();
|
|
5467
|
+
updateHeaderCheckboxState();
|
|
5468
|
+
}
|
|
5469
|
+
function updateState() {
|
|
5470
|
+
var _a;
|
|
5471
|
+
var rowCheckSel = (_a = config.attributes) === null || _a === void 0 ? void 0 : _a.checkbox;
|
|
5472
|
+
if (!rowCheckSel) {
|
|
5473
|
+
return;
|
|
5474
|
+
}
|
|
5475
|
+
targetElements = element.querySelectorAll(rowCheckSel);
|
|
5476
|
+
reapplyCheckedStates();
|
|
5477
|
+
updateHeaderCheckboxState();
|
|
5478
|
+
}
|
|
5479
|
+
return {
|
|
5480
|
+
init: init,
|
|
5481
|
+
check: check,
|
|
5482
|
+
uncheck: uncheck,
|
|
5483
|
+
toggle: toggle,
|
|
5484
|
+
isChecked: isChecked,
|
|
5485
|
+
getChecked: getChecked,
|
|
5486
|
+
updateState: updateState,
|
|
5487
|
+
};
|
|
5488
|
+
}
|
|
5489
|
+
|
|
5490
|
+
|
|
5491
|
+
/***/ }),
|
|
5492
|
+
|
|
5493
|
+
/***/ "./src/components/datatable/datatable-event-adapter.ts":
|
|
5494
|
+
/*!*************************************************************!*\
|
|
5495
|
+
!*** ./src/components/datatable/datatable-event-adapter.ts ***!
|
|
5496
|
+
\*************************************************************/
|
|
5497
|
+
/***/ (function(__unused_webpack_module, exports) {
|
|
5498
|
+
|
|
5499
|
+
|
|
5500
|
+
/**
|
|
5501
|
+
* KTUI - Free & Open-Source Tailwind UI Components by Keenthemes
|
|
5502
|
+
* Copyright 2025 by Keenthemes Inc
|
|
5503
|
+
*/
|
|
5504
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
5505
|
+
exports.createDataTableEventAdapter = createDataTableEventAdapter;
|
|
5506
|
+
function createDataTableEventAdapter(fireEvent, dispatchEvent) {
|
|
5507
|
+
return {
|
|
5508
|
+
emit: function (eventName, eventData) {
|
|
5509
|
+
fireEvent(eventName, eventData);
|
|
5510
|
+
dispatchEvent(eventName, eventData);
|
|
5511
|
+
},
|
|
5512
|
+
};
|
|
5513
|
+
}
|
|
5514
|
+
|
|
5515
|
+
|
|
5516
|
+
/***/ }),
|
|
5517
|
+
|
|
5518
|
+
/***/ "./src/components/datatable/datatable-local-provider.ts":
|
|
5519
|
+
/*!**************************************************************!*\
|
|
5520
|
+
!*** ./src/components/datatable/datatable-local-provider.ts ***!
|
|
5521
|
+
\**************************************************************/
|
|
5522
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
5523
|
+
|
|
5524
|
+
|
|
5525
|
+
/**
|
|
5526
|
+
* KTUI - Free & Open-Source Tailwind UI Components by Keenthemes
|
|
5527
|
+
* Copyright 2025 by Keenthemes Inc
|
|
5528
|
+
*/
|
|
5529
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5530
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5531
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5532
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5533
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
5534
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
5535
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
5536
|
+
});
|
|
5537
|
+
};
|
|
5538
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
5539
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
5540
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
5541
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
5542
|
+
function step(op) {
|
|
5543
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
5544
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
5545
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
5546
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
5547
|
+
switch (op[0]) {
|
|
5548
|
+
case 0: case 1: t = op; break;
|
|
5549
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
5550
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
5551
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
5552
|
+
default:
|
|
5553
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
5554
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
5555
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
5556
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
5557
|
+
if (t[2]) _.ops.pop();
|
|
5558
|
+
_.trys.pop(); continue;
|
|
5559
|
+
}
|
|
5560
|
+
op = body.call(thisArg, _);
|
|
5561
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
5562
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
5563
|
+
}
|
|
5564
|
+
};
|
|
5565
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
5566
|
+
var t = {};
|
|
5567
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5568
|
+
t[p] = s[p];
|
|
5569
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
5570
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
5571
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
5572
|
+
t[p[i]] = s[p[i]];
|
|
5573
|
+
}
|
|
5574
|
+
return t;
|
|
5575
|
+
};
|
|
5576
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
5577
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
5578
|
+
if (ar || !(i in from)) {
|
|
5579
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
5580
|
+
ar[i] = from[i];
|
|
5581
|
+
}
|
|
5582
|
+
}
|
|
5583
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
5584
|
+
};
|
|
5585
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
5586
|
+
exports.KTDataTableLocalDataProvider = void 0;
|
|
5587
|
+
var utils_1 = __webpack_require__(/*! ../../helpers/utils */ "./src/helpers/utils.ts");
|
|
5588
|
+
var KTDataTableLocalDataProvider = /** @class */ (function () {
|
|
5589
|
+
function KTDataTableLocalDataProvider(options) {
|
|
5590
|
+
this.options = options;
|
|
5591
|
+
}
|
|
5592
|
+
KTDataTableLocalDataProvider.prototype.fetch = function () {
|
|
5593
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5594
|
+
return __generator(this, function (_a) {
|
|
5595
|
+
return [2 /*return*/, this.fetchSync()];
|
|
5596
|
+
});
|
|
5597
|
+
});
|
|
5598
|
+
};
|
|
5599
|
+
KTDataTableLocalDataProvider.prototype.fetchSync = function () {
|
|
5600
|
+
var _a, _b;
|
|
5601
|
+
var state = this.options.stateStore.getState();
|
|
5602
|
+
var originalData = state.originalData;
|
|
5603
|
+
if (!this.options.elements().tableElement ||
|
|
5604
|
+
originalData === undefined ||
|
|
5605
|
+
this.tableConfigInvalidate() ||
|
|
5606
|
+
this.localTableHeaderInvalidate() ||
|
|
5607
|
+
this.localTableContentInvalidate()) {
|
|
5608
|
+
var _c = this.localExtractTableContent(), originalData_1 = _c.originalData, originalDataAttributes = _c.originalDataAttributes;
|
|
5609
|
+
this.options.stateStore.setOriginalData(originalData_1, originalDataAttributes);
|
|
5610
|
+
}
|
|
5611
|
+
originalData = this.options.stateStore.getState().originalData;
|
|
5612
|
+
var data = __spreadArray([], originalData, true);
|
|
5613
|
+
var filteredData = data;
|
|
5614
|
+
var _d = this.options.stateStore.getState(), sortField = _d.sortField, sortOrder = _d.sortOrder, page = _d.page, pageSize = _d.pageSize, search = _d.search;
|
|
5615
|
+
if (search) {
|
|
5616
|
+
var searchTerm = typeof search === 'string' ? search : '';
|
|
5617
|
+
var searchCallback = (_a = this.options.config.search) === null || _a === void 0 ? void 0 : _a.callback;
|
|
5618
|
+
if (searchCallback) {
|
|
5619
|
+
filteredData = data = searchCallback.call(this, data, searchTerm);
|
|
5620
|
+
}
|
|
5621
|
+
}
|
|
5622
|
+
var sortCallback = (_b = this.options.config.sort) === null || _b === void 0 ? void 0 : _b.callback;
|
|
5623
|
+
if (sortField !== undefined &&
|
|
5624
|
+
sortOrder !== undefined &&
|
|
5625
|
+
sortOrder !== '' &&
|
|
5626
|
+
typeof sortCallback === 'function') {
|
|
5627
|
+
data = sortCallback.call(this, data, sortField, sortOrder);
|
|
5628
|
+
}
|
|
5629
|
+
if ((data === null || data === void 0 ? void 0 : data.length) > 0) {
|
|
5630
|
+
var startIndex = (page - 1) * pageSize;
|
|
5631
|
+
var endIndex = startIndex + pageSize;
|
|
5632
|
+
data = data.slice(startIndex, endIndex);
|
|
5633
|
+
}
|
|
5634
|
+
return {
|
|
5635
|
+
data: data,
|
|
5636
|
+
totalItems: filteredData.length,
|
|
5637
|
+
};
|
|
5638
|
+
};
|
|
5639
|
+
KTDataTableLocalDataProvider.prototype.localTableContentInvalidate = function () {
|
|
5640
|
+
var tbodyElement = this.options.elements().tbodyElement;
|
|
5641
|
+
var checksum = utils_1.default.checksum(JSON.stringify(tbodyElement.innerHTML));
|
|
5642
|
+
if (this.options.stateStore.getState()._contentChecksum !== checksum) {
|
|
5643
|
+
this.options.stateStore.patchState({ _contentChecksum: checksum });
|
|
5644
|
+
return true;
|
|
5645
|
+
}
|
|
5646
|
+
return false;
|
|
5647
|
+
};
|
|
5648
|
+
KTDataTableLocalDataProvider.prototype.tableConfigInvalidate = function () {
|
|
5649
|
+
var _a;
|
|
5650
|
+
var _b = this.options.config, _state = _b._state, restConfig = __rest(_b, ["_state"]);
|
|
5651
|
+
var checksum = utils_1.default.checksum(JSON.stringify(restConfig));
|
|
5652
|
+
if (((_a = _state === null || _state === void 0 ? void 0 : _state._configChecksum) !== null && _a !== void 0 ? _a : '') !== checksum) {
|
|
5653
|
+
this.options.stateStore.patchState({ _configChecksum: checksum });
|
|
5654
|
+
return true;
|
|
5655
|
+
}
|
|
5656
|
+
return false;
|
|
5657
|
+
};
|
|
5658
|
+
KTDataTableLocalDataProvider.prototype.localExtractTableContent = function () {
|
|
5659
|
+
var originalData = [];
|
|
5660
|
+
var originalDataAttributes = [];
|
|
5661
|
+
var _a = this.options.elements(), tbodyElement = _a.tbodyElement, theadElement = _a.theadElement;
|
|
5662
|
+
this.options.storeOriginalClasses();
|
|
5663
|
+
var rows = tbodyElement.querySelectorAll('tr');
|
|
5664
|
+
var allThs = theadElement
|
|
5665
|
+
? theadElement.querySelectorAll('th')
|
|
5666
|
+
: [];
|
|
5667
|
+
var ths = Array.from(allThs).filter(function (th) {
|
|
5668
|
+
return th.hasAttribute('data-kt-datatable-column');
|
|
5669
|
+
});
|
|
5670
|
+
var columnsByIndex = ths.length > 0 && ths.length !== allThs.length ? Array.from(allThs) : ths;
|
|
5671
|
+
rows.forEach(function (row) {
|
|
5672
|
+
var dataRow = {};
|
|
5673
|
+
var dataRowAttribute = {};
|
|
5674
|
+
row.querySelectorAll('td').forEach(function (td, index) {
|
|
5675
|
+
var _a, _b, _c;
|
|
5676
|
+
var colName = (_a = columnsByIndex[index]) === null || _a === void 0 ? void 0 : _a.getAttribute('data-kt-datatable-column');
|
|
5677
|
+
if (colName) {
|
|
5678
|
+
dataRow[colName] = (_b = td.innerHTML) === null || _b === void 0 ? void 0 : _b.trim();
|
|
5679
|
+
}
|
|
5680
|
+
else {
|
|
5681
|
+
dataRow[index] = (_c = td.innerHTML) === null || _c === void 0 ? void 0 : _c.trim();
|
|
5682
|
+
}
|
|
5683
|
+
});
|
|
5684
|
+
if (Object.keys(dataRow).length > 0) {
|
|
5685
|
+
originalData.push(dataRow);
|
|
5686
|
+
originalDataAttributes.push(dataRowAttribute);
|
|
5687
|
+
}
|
|
5688
|
+
});
|
|
5689
|
+
return { originalData: originalData, originalDataAttributes: originalDataAttributes };
|
|
5690
|
+
};
|
|
5691
|
+
KTDataTableLocalDataProvider.prototype.localTableHeaderInvalidate = function () {
|
|
5692
|
+
var originalData = this.options.stateStore.getState().originalData;
|
|
5693
|
+
var theadElement = this.options.elements().theadElement;
|
|
5694
|
+
var totalColumns = originalData.length
|
|
5695
|
+
? Object.keys(originalData[0]).length
|
|
5696
|
+
: 0;
|
|
5697
|
+
var allThs = theadElement
|
|
5698
|
+
? theadElement.querySelectorAll('th')
|
|
5699
|
+
: [];
|
|
5700
|
+
var thsWithColumn = Array.from(allThs).filter(function (th) {
|
|
5701
|
+
return th.hasAttribute('data-kt-datatable-column');
|
|
5702
|
+
});
|
|
5703
|
+
var currentTableHeaders = thsWithColumn.length > 0
|
|
5704
|
+
? thsWithColumn.length !== allThs.length
|
|
5705
|
+
? allThs.length
|
|
5706
|
+
: thsWithColumn.length
|
|
5707
|
+
: this.options.getLogicalColumnCount();
|
|
5708
|
+
return currentTableHeaders !== totalColumns;
|
|
5709
|
+
};
|
|
5710
|
+
return KTDataTableLocalDataProvider;
|
|
5711
|
+
}());
|
|
5712
|
+
exports.KTDataTableLocalDataProvider = KTDataTableLocalDataProvider;
|
|
5713
|
+
|
|
5714
|
+
|
|
5715
|
+
/***/ }),
|
|
5716
|
+
|
|
5717
|
+
/***/ "./src/components/datatable/datatable-pagination-renderer.ts":
|
|
5718
|
+
/*!*******************************************************************!*\
|
|
5719
|
+
!*** ./src/components/datatable/datatable-pagination-renderer.ts ***!
|
|
5720
|
+
\*******************************************************************/
|
|
5721
|
+
/***/ (function(__unused_webpack_module, exports) {
|
|
5722
|
+
|
|
5723
|
+
|
|
5724
|
+
/**
|
|
5725
|
+
* KTUI - Free & Open-Source Tailwind UI Components by Keenthemes
|
|
5726
|
+
* Copyright 2025 by Keenthemes Inc
|
|
5727
|
+
*/
|
|
5728
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
5729
|
+
exports.KTDataTableDomPaginationRenderer = void 0;
|
|
5730
|
+
var KTDataTableDomPaginationRenderer = /** @class */ (function () {
|
|
5731
|
+
function KTDataTableDomPaginationRenderer() {
|
|
5732
|
+
}
|
|
5733
|
+
KTDataTableDomPaginationRenderer.prototype.render = function (input) {
|
|
5734
|
+
var _this = this;
|
|
5735
|
+
if (input.sizeElement) {
|
|
5736
|
+
this.removeChildElements(input.sizeElement);
|
|
5737
|
+
this.createPageSizeControls(input);
|
|
5738
|
+
}
|
|
5739
|
+
if (input.paginationElement) {
|
|
5740
|
+
this.removeChildElements(input.paginationElement);
|
|
5741
|
+
this.createPaginationControls(input);
|
|
5742
|
+
}
|
|
5743
|
+
return function () {
|
|
5744
|
+
if (input.sizeElement) {
|
|
5745
|
+
input.sizeElement.onchange = null;
|
|
5746
|
+
}
|
|
5747
|
+
if (input.paginationElement) {
|
|
5748
|
+
_this.removeChildElements(input.paginationElement);
|
|
5749
|
+
}
|
|
5750
|
+
};
|
|
5751
|
+
};
|
|
5752
|
+
KTDataTableDomPaginationRenderer.prototype.removeChildElements = function (container) {
|
|
5753
|
+
if (!container) {
|
|
5754
|
+
return;
|
|
5755
|
+
}
|
|
5756
|
+
while (container.firstChild) {
|
|
5757
|
+
container.removeChild(container.firstChild);
|
|
5758
|
+
}
|
|
5759
|
+
};
|
|
5760
|
+
KTDataTableDomPaginationRenderer.prototype.createPageSizeControls = function (input) {
|
|
5761
|
+
var _a;
|
|
5762
|
+
if (!input.sizeElement) {
|
|
5763
|
+
return;
|
|
5764
|
+
}
|
|
5765
|
+
var pageSizes = (_a = input.config.pageSizes) !== null && _a !== void 0 ? _a : [5, 10, 20, 30, 50];
|
|
5766
|
+
setTimeout(function () {
|
|
5767
|
+
var _a;
|
|
5768
|
+
var options = pageSizes.map(function (size) {
|
|
5769
|
+
var option = document.createElement('option');
|
|
5770
|
+
option.value = String(size);
|
|
5771
|
+
option.text = String(size);
|
|
5772
|
+
option.selected = input.state.pageSize === size;
|
|
5773
|
+
return option;
|
|
5774
|
+
});
|
|
5775
|
+
(_a = input.sizeElement).append.apply(_a, options);
|
|
5776
|
+
}, 100);
|
|
5777
|
+
input.sizeElement.onchange = function (event) {
|
|
5778
|
+
input.reloadPageSize(Number(event.target.value), 1);
|
|
5779
|
+
};
|
|
5780
|
+
};
|
|
5781
|
+
KTDataTableDomPaginationRenderer.prototype.createPaginationControls = function (input) {
|
|
5782
|
+
if (!input.paginationElement || input.dataLength === 0) {
|
|
5783
|
+
return null;
|
|
5784
|
+
}
|
|
5785
|
+
this.setPaginationInfoText(input);
|
|
5786
|
+
this.createPaginationButtons(input.paginationElement, input);
|
|
5787
|
+
return input.paginationElement;
|
|
5788
|
+
};
|
|
5789
|
+
KTDataTableDomPaginationRenderer.prototype.setPaginationInfoText = function (input) {
|
|
5790
|
+
var _a;
|
|
5791
|
+
if (!input.infoElement) {
|
|
5792
|
+
return;
|
|
5793
|
+
}
|
|
5794
|
+
var infoTemplate = (_a = input.config.info) !== null && _a !== void 0 ? _a : '{start}-{end} of {total}';
|
|
5795
|
+
input.infoElement.textContent = infoTemplate
|
|
5796
|
+
.replace('{start}', (input.state.page - 1) * input.state.pageSize + 1 + '')
|
|
5797
|
+
.replace('{end}', Math.min(input.state.page * input.state.pageSize, input.state.totalItems) + '')
|
|
5798
|
+
.replace('{total}', input.state.totalItems + '');
|
|
5799
|
+
};
|
|
5800
|
+
KTDataTableDomPaginationRenderer.prototype.createPaginationButtons = function (paginationContainer, input) {
|
|
5801
|
+
var _a;
|
|
5802
|
+
var pagination = input.config.pagination;
|
|
5803
|
+
if (!pagination) {
|
|
5804
|
+
return;
|
|
5805
|
+
}
|
|
5806
|
+
var _b = input.state, currentPage = _b.page, totalPages = _b.totalPages;
|
|
5807
|
+
var previous = pagination.previous, next = pagination.next, number = pagination.number, more = pagination.more;
|
|
5808
|
+
var pageMoreLimit = (_a = input.config.pageMoreLimit) !== null && _a !== void 0 ? _a : 3;
|
|
5809
|
+
var createButton = function (text, className, disabled, handleClick) {
|
|
5810
|
+
var button = document.createElement('button');
|
|
5811
|
+
button.className = className;
|
|
5812
|
+
button.innerHTML = text;
|
|
5813
|
+
button.disabled = disabled;
|
|
5814
|
+
button.onclick = handleClick;
|
|
5815
|
+
return button;
|
|
5816
|
+
};
|
|
5817
|
+
paginationContainer.appendChild(createButton(previous.text, "".concat(previous.class).concat(currentPage === 1 ? ' disabled' : ''), currentPage === 1, function () { return input.paginateData(currentPage - 1); }));
|
|
5818
|
+
if (input.config.pageMore) {
|
|
5819
|
+
var range_1 = this.calculatePageRange(currentPage, totalPages, pageMoreLimit);
|
|
5820
|
+
if (range_1.start > 1) {
|
|
5821
|
+
paginationContainer.appendChild(createButton(more.text, more.class, false, function () {
|
|
5822
|
+
return input.paginateData(Math.max(1, range_1.start - 1));
|
|
5823
|
+
}));
|
|
5824
|
+
}
|
|
5825
|
+
var _loop_1 = function (i) {
|
|
5826
|
+
paginationContainer.appendChild(createButton(number.text.replace('{page}', i.toString()), "".concat(number.class).concat(currentPage === i ? ' active disabled' : ''), currentPage === i, function () { return input.paginateData(i); }));
|
|
5827
|
+
};
|
|
5828
|
+
for (var i = range_1.start; i <= range_1.end; i++) {
|
|
5829
|
+
_loop_1(i);
|
|
5830
|
+
}
|
|
5831
|
+
if (range_1.end < totalPages) {
|
|
5832
|
+
paginationContainer.appendChild(createButton(more.text, more.class, false, function () {
|
|
5833
|
+
return input.paginateData(Math.min(totalPages, range_1.end + 1));
|
|
5834
|
+
}));
|
|
5835
|
+
}
|
|
5836
|
+
}
|
|
5837
|
+
else {
|
|
5838
|
+
var _loop_2 = function (i) {
|
|
5839
|
+
paginationContainer.appendChild(createButton(number.text.replace('{page}', i.toString()), "".concat(number.class).concat(currentPage === i ? ' active disabled' : ''), currentPage === i, function () { return input.paginateData(i); }));
|
|
5840
|
+
};
|
|
5841
|
+
for (var i = 1; i <= totalPages; i++) {
|
|
5842
|
+
_loop_2(i);
|
|
5843
|
+
}
|
|
5844
|
+
}
|
|
5845
|
+
paginationContainer.appendChild(createButton(next.text, "".concat(next.class).concat(currentPage === totalPages ? ' disabled' : ''), currentPage === totalPages, function () { return input.paginateData(currentPage + 1); }));
|
|
5846
|
+
};
|
|
5847
|
+
KTDataTableDomPaginationRenderer.prototype.calculatePageRange = function (currentPage, totalPages, maxButtons) {
|
|
5848
|
+
var startPage, endPage;
|
|
5849
|
+
var halfMaxButtons = Math.floor(maxButtons / 2);
|
|
5850
|
+
if (totalPages <= maxButtons) {
|
|
5851
|
+
startPage = 1;
|
|
5852
|
+
endPage = totalPages;
|
|
5853
|
+
}
|
|
5854
|
+
else {
|
|
5855
|
+
startPage = Math.max(currentPage - halfMaxButtons, 1);
|
|
5856
|
+
endPage = Math.min(startPage + maxButtons - 1, totalPages);
|
|
5857
|
+
if (endPage - startPage < maxButtons - 1) {
|
|
5858
|
+
startPage = Math.max(endPage - maxButtons + 1, 1);
|
|
5859
|
+
}
|
|
5860
|
+
}
|
|
5861
|
+
return { start: startPage, end: endPage };
|
|
5862
|
+
};
|
|
5863
|
+
return KTDataTableDomPaginationRenderer;
|
|
5864
|
+
}());
|
|
5865
|
+
exports.KTDataTableDomPaginationRenderer = KTDataTableDomPaginationRenderer;
|
|
5866
|
+
|
|
5867
|
+
|
|
5868
|
+
/***/ }),
|
|
5869
|
+
|
|
5870
|
+
/***/ "./src/components/datatable/datatable-remote-provider.ts":
|
|
5871
|
+
/*!***************************************************************!*\
|
|
5872
|
+
!*** ./src/components/datatable/datatable-remote-provider.ts ***!
|
|
5873
|
+
\***************************************************************/
|
|
5874
|
+
/***/ (function(__unused_webpack_module, exports) {
|
|
5875
|
+
|
|
5876
|
+
|
|
5877
|
+
/**
|
|
5878
|
+
* KTUI - Free & Open-Source Tailwind UI Components by Keenthemes
|
|
5879
|
+
* Copyright 2025 by Keenthemes Inc
|
|
5880
|
+
*/
|
|
5881
|
+
var __assign = (this && this.__assign) || function () {
|
|
5882
|
+
__assign = Object.assign || function(t) {
|
|
5883
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5884
|
+
s = arguments[i];
|
|
5885
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
5886
|
+
t[p] = s[p];
|
|
5887
|
+
}
|
|
5888
|
+
return t;
|
|
5889
|
+
};
|
|
5890
|
+
return __assign.apply(this, arguments);
|
|
5891
|
+
};
|
|
5892
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5893
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5894
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5895
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5896
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
5897
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
5898
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
5899
|
+
});
|
|
5900
|
+
};
|
|
5901
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
5902
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
5903
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
5904
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
5905
|
+
function step(op) {
|
|
5906
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
5907
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
5908
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
5909
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
5910
|
+
switch (op[0]) {
|
|
5911
|
+
case 0: case 1: t = op; break;
|
|
5912
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
5913
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
5914
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
5915
|
+
default:
|
|
5916
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
5917
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
5918
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
5919
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
5920
|
+
if (t[2]) _.ops.pop();
|
|
5921
|
+
_.trys.pop(); continue;
|
|
5922
|
+
}
|
|
5923
|
+
op = body.call(thisArg, _);
|
|
5924
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
5925
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
5926
|
+
}
|
|
5927
|
+
};
|
|
5928
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
5929
|
+
exports.KTDataTableRemoteDataProvider = void 0;
|
|
5930
|
+
var KTDataTableRemoteDataProvider = /** @class */ (function () {
|
|
5931
|
+
function KTDataTableRemoteDataProvider(options) {
|
|
5932
|
+
this.options = options;
|
|
5933
|
+
this.abortController = null;
|
|
5934
|
+
this.requestId = 0;
|
|
5935
|
+
}
|
|
5936
|
+
KTDataTableRemoteDataProvider.prototype.dispose = function () {
|
|
5937
|
+
if (this.abortController) {
|
|
5938
|
+
this.abortController.abort();
|
|
5939
|
+
this.abortController = null;
|
|
5940
|
+
}
|
|
5941
|
+
};
|
|
5942
|
+
KTDataTableRemoteDataProvider.prototype.fetch = function () {
|
|
5943
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5944
|
+
var currentRequestId, queryParams, response, error_1, responseData, error_2;
|
|
5945
|
+
return __generator(this, function (_a) {
|
|
5946
|
+
switch (_a.label) {
|
|
5947
|
+
case 0:
|
|
5948
|
+
currentRequestId = ++this.requestId;
|
|
5949
|
+
queryParams = this.getQueryParamsForFetchRequest();
|
|
5950
|
+
_a.label = 1;
|
|
5951
|
+
case 1:
|
|
5952
|
+
_a.trys.push([1, 3, , 4]);
|
|
5953
|
+
return [4 /*yield*/, this.performFetchRequest(queryParams)];
|
|
5954
|
+
case 2:
|
|
5955
|
+
response = _a.sent();
|
|
5956
|
+
return [3 /*break*/, 4];
|
|
5957
|
+
case 3:
|
|
5958
|
+
error_1 = _a.sent();
|
|
5959
|
+
if (error_1.name === 'AbortError') {
|
|
5960
|
+
return [2 /*return*/, { data: [], totalItems: 0, skipped: true }];
|
|
5961
|
+
}
|
|
5962
|
+
throw error_1;
|
|
5963
|
+
case 4:
|
|
5964
|
+
if (currentRequestId !== this.requestId) {
|
|
5965
|
+
return [2 /*return*/, { data: [], totalItems: 0, skipped: true }];
|
|
5966
|
+
}
|
|
5967
|
+
responseData = null;
|
|
5968
|
+
_a.label = 5;
|
|
5969
|
+
case 5:
|
|
5970
|
+
_a.trys.push([5, 7, , 8]);
|
|
5971
|
+
return [4 /*yield*/, response.json()];
|
|
5972
|
+
case 6:
|
|
5973
|
+
responseData = _a.sent();
|
|
5974
|
+
return [3 /*break*/, 8];
|
|
5975
|
+
case 7:
|
|
5976
|
+
error_2 = _a.sent();
|
|
5977
|
+
this.options.eventAdapter.emit('parseError', {
|
|
5978
|
+
response: response,
|
|
5979
|
+
error: String(error_2),
|
|
5980
|
+
status: response.status,
|
|
5981
|
+
statusText: response.statusText,
|
|
5982
|
+
});
|
|
5983
|
+
return [2 /*return*/, { data: [], totalItems: 0, skipped: true }];
|
|
5984
|
+
case 8:
|
|
5985
|
+
if (currentRequestId !== this.requestId) {
|
|
5986
|
+
return [2 /*return*/, { data: [], totalItems: 0, skipped: true }];
|
|
5987
|
+
}
|
|
5988
|
+
this.options.eventAdapter.emit('fetched', { response: responseData });
|
|
5989
|
+
if (typeof this.options.config.mapResponse === 'function') {
|
|
5990
|
+
responseData = this.options.config.mapResponse.call(this, responseData);
|
|
5991
|
+
}
|
|
5992
|
+
return [2 /*return*/, {
|
|
5993
|
+
data: responseData.data,
|
|
5994
|
+
totalItems: responseData.totalCount,
|
|
5995
|
+
response: responseData,
|
|
5996
|
+
}];
|
|
4951
5997
|
}
|
|
4952
|
-
}
|
|
5998
|
+
});
|
|
4953
5999
|
});
|
|
4954
|
-
}
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
if (targetElements[i].checked)
|
|
4963
|
-
checked++;
|
|
6000
|
+
};
|
|
6001
|
+
KTDataTableRemoteDataProvider.prototype.getQueryParamsForFetchRequest = function () {
|
|
6002
|
+
var _a = this.options.stateStore.getState(), page = _a.page, pageSize = _a.pageSize, sortField = _a.sortField, sortOrder = _a.sortOrder, filters = _a.filters, search = _a.search;
|
|
6003
|
+
var queryParams = new URLSearchParams();
|
|
6004
|
+
queryParams.set('page', String(page));
|
|
6005
|
+
queryParams.set('size', String(pageSize));
|
|
6006
|
+
if (sortOrder !== undefined) {
|
|
6007
|
+
queryParams.set('sortOrder', String(sortOrder));
|
|
4964
6008
|
}
|
|
4965
|
-
if (
|
|
4966
|
-
|
|
4967
|
-
headerCheckElement.checked = false;
|
|
4968
|
-
headerChecked = false;
|
|
6009
|
+
if (sortField !== undefined) {
|
|
6010
|
+
queryParams.set('sortField', String(sortField));
|
|
4969
6011
|
}
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
6012
|
+
if (Array.isArray(filters) && filters.length) {
|
|
6013
|
+
queryParams.set('filters', JSON.stringify(filters.map(function (filter) { return ({
|
|
6014
|
+
column: filter.column,
|
|
6015
|
+
type: filter.type,
|
|
6016
|
+
value: filter.value,
|
|
6017
|
+
}); })));
|
|
4974
6018
|
}
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
headerCheckElement.checked = true;
|
|
4978
|
-
headerChecked = true;
|
|
6019
|
+
if (search) {
|
|
6020
|
+
queryParams.set('search', typeof search === 'object' ? JSON.stringify(search) : search);
|
|
4979
6021
|
}
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
return
|
|
4984
|
-
}
|
|
4985
|
-
function getChecked() {
|
|
4986
|
-
return getSelectedRows();
|
|
4987
|
-
}
|
|
4988
|
-
function check() {
|
|
4989
|
-
change(true);
|
|
4990
|
-
reapplyCheckedStates();
|
|
4991
|
-
updateHeaderCheckboxState();
|
|
4992
|
-
}
|
|
4993
|
-
function uncheck() {
|
|
4994
|
-
change(false);
|
|
4995
|
-
reapplyCheckedStates();
|
|
4996
|
-
updateHeaderCheckboxState();
|
|
4997
|
-
}
|
|
4998
|
-
function toggle() {
|
|
4999
|
-
checkboxToggle();
|
|
5000
|
-
reapplyCheckedStates();
|
|
5001
|
-
updateHeaderCheckboxState();
|
|
5002
|
-
}
|
|
5003
|
-
function updateState() {
|
|
5004
|
-
// Called after redraw/pagination
|
|
5005
|
-
targetElements = element.querySelectorAll(config.attributes.checkbox);
|
|
5006
|
-
reapplyCheckedStates();
|
|
5007
|
-
updateHeaderCheckboxState();
|
|
5008
|
-
}
|
|
5009
|
-
return {
|
|
5010
|
-
init: init,
|
|
5011
|
-
check: check,
|
|
5012
|
-
uncheck: uncheck,
|
|
5013
|
-
toggle: toggle,
|
|
5014
|
-
isChecked: isChecked,
|
|
5015
|
-
getChecked: getChecked,
|
|
5016
|
-
updateState: updateState,
|
|
6022
|
+
if (typeof this.options.config.mapRequest === 'function') {
|
|
6023
|
+
queryParams = this.options.config.mapRequest.call(this, queryParams);
|
|
6024
|
+
}
|
|
6025
|
+
return queryParams;
|
|
5017
6026
|
};
|
|
5018
|
-
|
|
6027
|
+
KTDataTableRemoteDataProvider.prototype.performFetchRequest = function (queryParams) {
|
|
6028
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6029
|
+
var requestMethod, requestBody, apiEndpoint, apiEndpointWithQueryParams;
|
|
6030
|
+
var _this = this;
|
|
6031
|
+
return __generator(this, function (_a) {
|
|
6032
|
+
requestMethod = this.options.config.requestMethod;
|
|
6033
|
+
requestBody = undefined;
|
|
6034
|
+
apiEndpoint = this.options.config.apiEndpoint;
|
|
6035
|
+
if (!apiEndpoint) {
|
|
6036
|
+
throw new Error('KTDataTable: apiEndpoint is required for remote fetch');
|
|
6037
|
+
}
|
|
6038
|
+
if (this.abortController) {
|
|
6039
|
+
this.abortController.abort();
|
|
6040
|
+
}
|
|
6041
|
+
this.abortController = new AbortController();
|
|
6042
|
+
if (requestMethod === 'POST') {
|
|
6043
|
+
requestBody = queryParams;
|
|
6044
|
+
}
|
|
6045
|
+
else if (requestMethod === 'GET') {
|
|
6046
|
+
apiEndpointWithQueryParams = this.options.createUrl(apiEndpoint);
|
|
6047
|
+
apiEndpointWithQueryParams.search = queryParams.toString();
|
|
6048
|
+
apiEndpoint = apiEndpointWithQueryParams.toString();
|
|
6049
|
+
}
|
|
6050
|
+
return [2 /*return*/, fetch(apiEndpoint, __assign(__assign({ method: requestMethod, body: requestBody, headers: this.options.config.requestHeaders }, (this.options.config.requestCredentials && {
|
|
6051
|
+
credentials: this.options.config.requestCredentials,
|
|
6052
|
+
})), (this.abortController && { signal: this.abortController.signal }))).catch(function (error) {
|
|
6053
|
+
if (error.name === 'AbortError') {
|
|
6054
|
+
return Promise.reject(error);
|
|
6055
|
+
}
|
|
6056
|
+
_this.options.eventAdapter.emit('error', { error: error });
|
|
6057
|
+
_this.options.noticeOnTable('Error performing fetch request: ' + String(error));
|
|
6058
|
+
throw error;
|
|
6059
|
+
})];
|
|
6060
|
+
});
|
|
6061
|
+
});
|
|
6062
|
+
};
|
|
6063
|
+
return KTDataTableRemoteDataProvider;
|
|
6064
|
+
}());
|
|
6065
|
+
exports.KTDataTableRemoteDataProvider = KTDataTableRemoteDataProvider;
|
|
5019
6066
|
|
|
5020
6067
|
|
|
5021
6068
|
/***/ }),
|
|
@@ -5191,6 +6238,246 @@ function createSortHandler(config, theadElement, getState, setState, fireEvent,
|
|
|
5191
6238
|
}
|
|
5192
6239
|
|
|
5193
6240
|
|
|
6241
|
+
/***/ }),
|
|
6242
|
+
|
|
6243
|
+
/***/ "./src/components/datatable/datatable-state-store.ts":
|
|
6244
|
+
/*!***********************************************************!*\
|
|
6245
|
+
!*** ./src/components/datatable/datatable-state-store.ts ***!
|
|
6246
|
+
\***********************************************************/
|
|
6247
|
+
/***/ (function(__unused_webpack_module, exports) {
|
|
6248
|
+
|
|
6249
|
+
|
|
6250
|
+
/**
|
|
6251
|
+
* KTUI - Free & Open-Source Tailwind UI Components by Keenthemes
|
|
6252
|
+
* Copyright 2025 by Keenthemes Inc
|
|
6253
|
+
*/
|
|
6254
|
+
var __assign = (this && this.__assign) || function () {
|
|
6255
|
+
__assign = Object.assign || function(t) {
|
|
6256
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6257
|
+
s = arguments[i];
|
|
6258
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6259
|
+
t[p] = s[p];
|
|
6260
|
+
}
|
|
6261
|
+
return t;
|
|
6262
|
+
};
|
|
6263
|
+
return __assign.apply(this, arguments);
|
|
6264
|
+
};
|
|
6265
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
6266
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
6267
|
+
if (ar || !(i in from)) {
|
|
6268
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6269
|
+
ar[i] = from[i];
|
|
6270
|
+
}
|
|
6271
|
+
}
|
|
6272
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
6273
|
+
};
|
|
6274
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
6275
|
+
exports.KTDataTableConfigStateStore = void 0;
|
|
6276
|
+
var KTDataTableConfigStateStore = /** @class */ (function () {
|
|
6277
|
+
function KTDataTableConfigStateStore(config) {
|
|
6278
|
+
this.config = config;
|
|
6279
|
+
this.ensureState();
|
|
6280
|
+
}
|
|
6281
|
+
KTDataTableConfigStateStore.prototype.getState = function () {
|
|
6282
|
+
this.ensureState();
|
|
6283
|
+
return __assign({ page: 1, sortField: null, sortOrder: '', pageSize: this.config.pageSize, filters: [] }, this.config._state);
|
|
6284
|
+
};
|
|
6285
|
+
KTDataTableConfigStateStore.prototype.replaceState = function (state) {
|
|
6286
|
+
this.config._state = state;
|
|
6287
|
+
this.ensureState();
|
|
6288
|
+
};
|
|
6289
|
+
KTDataTableConfigStateStore.prototype.patchState = function (state) {
|
|
6290
|
+
this.ensureState();
|
|
6291
|
+
this.config._state = __assign(__assign({}, this.config._state), state);
|
|
6292
|
+
};
|
|
6293
|
+
KTDataTableConfigStateStore.prototype.setPage = function (page) {
|
|
6294
|
+
this.patchState({ page: page });
|
|
6295
|
+
};
|
|
6296
|
+
KTDataTableConfigStateStore.prototype.setPageSize = function (pageSize, page) {
|
|
6297
|
+
if (page === void 0) { page = 1; }
|
|
6298
|
+
this.patchState({ pageSize: pageSize, page: page });
|
|
6299
|
+
};
|
|
6300
|
+
KTDataTableConfigStateStore.prototype.setSort = function (field, order) {
|
|
6301
|
+
this.patchState({
|
|
6302
|
+
sortField: field,
|
|
6303
|
+
sortOrder: order,
|
|
6304
|
+
});
|
|
6305
|
+
};
|
|
6306
|
+
KTDataTableConfigStateStore.prototype.setSearch = function (search) {
|
|
6307
|
+
this.patchState({ search: search, page: 1 });
|
|
6308
|
+
};
|
|
6309
|
+
KTDataTableConfigStateStore.prototype.setFilter = function (filter) {
|
|
6310
|
+
var filters = __spreadArray(__spreadArray([], (this.getState().filters || []).filter(function (currentFilter) { return currentFilter.column !== filter.column; }), true), [
|
|
6311
|
+
filter,
|
|
6312
|
+
], false);
|
|
6313
|
+
this.patchState({ filters: filters, page: 1 });
|
|
6314
|
+
};
|
|
6315
|
+
KTDataTableConfigStateStore.prototype.setOriginalData = function (originalData, originalDataAttributes) {
|
|
6316
|
+
this.patchState({
|
|
6317
|
+
originalData: originalData,
|
|
6318
|
+
originalDataAttributes: originalDataAttributes,
|
|
6319
|
+
});
|
|
6320
|
+
};
|
|
6321
|
+
KTDataTableConfigStateStore.prototype.ensureState = function () {
|
|
6322
|
+
if (!this.config._state) {
|
|
6323
|
+
this.config._state = {};
|
|
6324
|
+
}
|
|
6325
|
+
};
|
|
6326
|
+
return KTDataTableConfigStateStore;
|
|
6327
|
+
}());
|
|
6328
|
+
exports.KTDataTableConfigStateStore = KTDataTableConfigStateStore;
|
|
6329
|
+
|
|
6330
|
+
|
|
6331
|
+
/***/ }),
|
|
6332
|
+
|
|
6333
|
+
/***/ "./src/components/datatable/datatable-table-renderer.ts":
|
|
6334
|
+
/*!**************************************************************!*\
|
|
6335
|
+
!*** ./src/components/datatable/datatable-table-renderer.ts ***!
|
|
6336
|
+
\**************************************************************/
|
|
6337
|
+
/***/ (function(__unused_webpack_module, exports) {
|
|
6338
|
+
|
|
6339
|
+
|
|
6340
|
+
/**
|
|
6341
|
+
* KTUI - Free & Open-Source Tailwind UI Components by Keenthemes
|
|
6342
|
+
* Copyright 2025 by Keenthemes Inc
|
|
6343
|
+
*/
|
|
6344
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
6345
|
+
exports.KTDataTableDomTableRenderer = void 0;
|
|
6346
|
+
var KTDataTableDomTableRenderer = /** @class */ (function () {
|
|
6347
|
+
function KTDataTableDomTableRenderer() {
|
|
6348
|
+
}
|
|
6349
|
+
KTDataTableDomTableRenderer.prototype.render = function (input) {
|
|
6350
|
+
while (input.tableElement.tBodies.length) {
|
|
6351
|
+
input.tableElement.removeChild(input.tableElement.tBodies[0]);
|
|
6352
|
+
}
|
|
6353
|
+
var tbodyElement = input.tableElement.createTBody();
|
|
6354
|
+
if (input.originalTbodyClass) {
|
|
6355
|
+
tbodyElement.className = input.originalTbodyClass;
|
|
6356
|
+
}
|
|
6357
|
+
this.renderContent(input, tbodyElement);
|
|
6358
|
+
return tbodyElement;
|
|
6359
|
+
};
|
|
6360
|
+
KTDataTableDomTableRenderer.prototype.notice = function (tableElement, getLogicalColumnCount, message) {
|
|
6361
|
+
if (message === void 0) { message = ''; }
|
|
6362
|
+
var row = tableElement.tBodies[0].insertRow();
|
|
6363
|
+
var cell = row.insertCell();
|
|
6364
|
+
var logicalCount = getLogicalColumnCount();
|
|
6365
|
+
cell.colSpan = logicalCount > 0 ? logicalCount : 1;
|
|
6366
|
+
cell.innerHTML = message;
|
|
6367
|
+
};
|
|
6368
|
+
KTDataTableDomTableRenderer.prototype.renderContent = function (input, tbodyElement) {
|
|
6369
|
+
var _this = this;
|
|
6370
|
+
var fragment = document.createDocumentFragment();
|
|
6371
|
+
tbodyElement.textContent = '';
|
|
6372
|
+
if (input.data.length === 0) {
|
|
6373
|
+
this.notice(input.tableElement, input.getLogicalColumnCount, input.config.infoEmpty || '');
|
|
6374
|
+
return tbodyElement;
|
|
6375
|
+
}
|
|
6376
|
+
var allThs = input.theadElement
|
|
6377
|
+
? input.theadElement.querySelectorAll('th')
|
|
6378
|
+
: [];
|
|
6379
|
+
var ths = Array.from(allThs).filter(function (th) {
|
|
6380
|
+
return th.hasAttribute('data-kt-datatable-column');
|
|
6381
|
+
});
|
|
6382
|
+
var columnsToRender = ths.length > 0 && ths.length !== allThs.length ? Array.from(allThs) : ths;
|
|
6383
|
+
var logicalColumnCount = columnsToRender.length > 0
|
|
6384
|
+
? columnsToRender.length
|
|
6385
|
+
: input.getLogicalColumnCount();
|
|
6386
|
+
input.data.forEach(function (item, rowIndex) {
|
|
6387
|
+
var row = document.createElement('tr');
|
|
6388
|
+
if (input.originalTrClasses && input.originalTrClasses[rowIndex]) {
|
|
6389
|
+
row.className = input.originalTrClasses[rowIndex];
|
|
6390
|
+
}
|
|
6391
|
+
if (!input.config.columns) {
|
|
6392
|
+
_this.renderImplicitColumns(input, row, item, rowIndex, {
|
|
6393
|
+
columnsToRender: columnsToRender,
|
|
6394
|
+
logicalColumnCount: logicalColumnCount,
|
|
6395
|
+
});
|
|
6396
|
+
}
|
|
6397
|
+
else {
|
|
6398
|
+
_this.renderConfiguredColumns(input, row, item, rowIndex);
|
|
6399
|
+
}
|
|
6400
|
+
fragment.appendChild(row);
|
|
6401
|
+
});
|
|
6402
|
+
tbodyElement.appendChild(fragment);
|
|
6403
|
+
return tbodyElement;
|
|
6404
|
+
};
|
|
6405
|
+
KTDataTableDomTableRenderer.prototype.renderImplicitColumns = function (input, row, item, rowIndex, options) {
|
|
6406
|
+
var dataRowAttributes = input.getState().originalDataAttributes
|
|
6407
|
+
? input.getState().originalDataAttributes[rowIndex]
|
|
6408
|
+
: null;
|
|
6409
|
+
for (var colIndex = 0; colIndex < options.logicalColumnCount; colIndex++) {
|
|
6410
|
+
var th = options.columnsToRender[colIndex];
|
|
6411
|
+
var colName = th === null || th === void 0 ? void 0 : th.getAttribute('data-kt-datatable-column');
|
|
6412
|
+
var td = document.createElement('td');
|
|
6413
|
+
var value = void 0;
|
|
6414
|
+
if (colName && Object.prototype.hasOwnProperty.call(item, colName)) {
|
|
6415
|
+
value = item[colName];
|
|
6416
|
+
}
|
|
6417
|
+
else if (Object.prototype.hasOwnProperty.call(item, colIndex)) {
|
|
6418
|
+
value = item[colIndex];
|
|
6419
|
+
}
|
|
6420
|
+
else {
|
|
6421
|
+
value = '';
|
|
6422
|
+
}
|
|
6423
|
+
td.innerHTML = value;
|
|
6424
|
+
this.applyOriginalTdClass(input, td, rowIndex, colIndex);
|
|
6425
|
+
this.applyDataRowAttributes(td, dataRowAttributes !== null && dataRowAttributes !== void 0 ? dataRowAttributes : null, colIndex);
|
|
6426
|
+
row.appendChild(td);
|
|
6427
|
+
}
|
|
6428
|
+
};
|
|
6429
|
+
KTDataTableDomTableRenderer.prototype.renderConfiguredColumns = function (input, row, item, rowIndex) {
|
|
6430
|
+
var _this = this;
|
|
6431
|
+
var columns = input.config.columns;
|
|
6432
|
+
if (!columns) {
|
|
6433
|
+
return;
|
|
6434
|
+
}
|
|
6435
|
+
Object.keys(columns).forEach(function (key, colIndex) {
|
|
6436
|
+
var columnDef = columns[key];
|
|
6437
|
+
if (!columnDef) {
|
|
6438
|
+
return;
|
|
6439
|
+
}
|
|
6440
|
+
var colKey = key;
|
|
6441
|
+
var td = document.createElement('td');
|
|
6442
|
+
_this.applyOriginalTdClass(input, td, rowIndex, colIndex);
|
|
6443
|
+
if (typeof columnDef.render === 'function') {
|
|
6444
|
+
var result = columnDef.render.call(input.context, item[colKey], item, input.context);
|
|
6445
|
+
if (result instanceof HTMLElement ||
|
|
6446
|
+
result instanceof DocumentFragment) {
|
|
6447
|
+
td.appendChild(result);
|
|
6448
|
+
}
|
|
6449
|
+
else if (typeof result === 'string') {
|
|
6450
|
+
td.innerHTML = result;
|
|
6451
|
+
}
|
|
6452
|
+
}
|
|
6453
|
+
else {
|
|
6454
|
+
td.textContent = item[colKey];
|
|
6455
|
+
}
|
|
6456
|
+
if (typeof columnDef.createdCell === 'function') {
|
|
6457
|
+
columnDef.createdCell.call(input.context, td, item[colKey], item, row);
|
|
6458
|
+
}
|
|
6459
|
+
row.appendChild(td);
|
|
6460
|
+
});
|
|
6461
|
+
};
|
|
6462
|
+
KTDataTableDomTableRenderer.prototype.applyOriginalTdClass = function (input, td, rowIndex, colIndex) {
|
|
6463
|
+
if (input.originalTdClasses &&
|
|
6464
|
+
input.originalTdClasses[rowIndex] &&
|
|
6465
|
+
input.originalTdClasses[rowIndex][colIndex]) {
|
|
6466
|
+
td.className = input.originalTdClasses[rowIndex][colIndex];
|
|
6467
|
+
}
|
|
6468
|
+
};
|
|
6469
|
+
KTDataTableDomTableRenderer.prototype.applyDataRowAttributes = function (td, dataRowAttributes, colIndex) {
|
|
6470
|
+
if (dataRowAttributes && dataRowAttributes[colIndex]) {
|
|
6471
|
+
for (var attr in dataRowAttributes[colIndex]) {
|
|
6472
|
+
td.setAttribute(attr, dataRowAttributes[colIndex][attr]);
|
|
6473
|
+
}
|
|
6474
|
+
}
|
|
6475
|
+
};
|
|
6476
|
+
return KTDataTableDomTableRenderer;
|
|
6477
|
+
}());
|
|
6478
|
+
exports.KTDataTableDomTableRenderer = KTDataTableDomTableRenderer;
|
|
6479
|
+
|
|
6480
|
+
|
|
5194
6481
|
/***/ }),
|
|
5195
6482
|
|
|
5196
6483
|
/***/ "./src/components/datatable/datatable.ts":
|
|
@@ -5248,53 +6535,38 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
5248
6535
|
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
5249
6536
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
5250
6537
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
5251
|
-
switch (op[0]) {
|
|
5252
|
-
case 0: case 1: t = op; break;
|
|
5253
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
5254
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
5255
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
5256
|
-
default:
|
|
5257
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
5258
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
5259
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
5260
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
5261
|
-
if (t[2]) _.ops.pop();
|
|
5262
|
-
_.trys.pop(); continue;
|
|
5263
|
-
}
|
|
5264
|
-
op = body.call(thisArg, _);
|
|
5265
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
5266
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
5267
|
-
}
|
|
5268
|
-
};
|
|
5269
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
5270
|
-
var t = {};
|
|
5271
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5272
|
-
t[p] = s[p];
|
|
5273
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
5274
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
5275
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
5276
|
-
t[p[i]] = s[p[i]];
|
|
5277
|
-
}
|
|
5278
|
-
return t;
|
|
5279
|
-
};
|
|
5280
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
5281
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
5282
|
-
if (ar || !(i in from)) {
|
|
5283
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
5284
|
-
ar[i] = from[i];
|
|
5285
|
-
}
|
|
6538
|
+
switch (op[0]) {
|
|
6539
|
+
case 0: case 1: t = op; break;
|
|
6540
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
6541
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
6542
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
6543
|
+
default:
|
|
6544
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
6545
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
6546
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
6547
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
6548
|
+
if (t[2]) _.ops.pop();
|
|
6549
|
+
_.trys.pop(); continue;
|
|
6550
|
+
}
|
|
6551
|
+
op = body.call(thisArg, _);
|
|
6552
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
6553
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
5286
6554
|
}
|
|
5287
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
5288
6555
|
};
|
|
5289
6556
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
5290
6557
|
exports.KTDataTable = void 0;
|
|
5291
6558
|
exports.initAllDataTables = initAllDataTables;
|
|
5292
6559
|
var component_1 = __webpack_require__(/*! ../component */ "./src/components/component.ts");
|
|
5293
|
-
var utils_1 = __webpack_require__(/*! ../../helpers/utils */ "./src/helpers/utils.ts");
|
|
5294
6560
|
var index_1 = __webpack_require__(/*! ../../index */ "./src/index.ts");
|
|
5295
6561
|
var data_1 = __webpack_require__(/*! ../../helpers/data */ "./src/helpers/data.ts");
|
|
5296
6562
|
var datatable_checkbox_1 = __webpack_require__(/*! ./datatable-checkbox */ "./src/components/datatable/datatable-checkbox.ts");
|
|
5297
6563
|
var datatable_sort_1 = __webpack_require__(/*! ./datatable-sort */ "./src/components/datatable/datatable-sort.ts");
|
|
6564
|
+
var datatable_event_adapter_1 = __webpack_require__(/*! ./datatable-event-adapter */ "./src/components/datatable/datatable-event-adapter.ts");
|
|
6565
|
+
var datatable_local_provider_1 = __webpack_require__(/*! ./datatable-local-provider */ "./src/components/datatable/datatable-local-provider.ts");
|
|
6566
|
+
var datatable_remote_provider_1 = __webpack_require__(/*! ./datatable-remote-provider */ "./src/components/datatable/datatable-remote-provider.ts");
|
|
6567
|
+
var datatable_state_store_1 = __webpack_require__(/*! ./datatable-state-store */ "./src/components/datatable/datatable-state-store.ts");
|
|
6568
|
+
var datatable_pagination_renderer_1 = __webpack_require__(/*! ./datatable-pagination-renderer */ "./src/components/datatable/datatable-pagination-renderer.ts");
|
|
6569
|
+
var datatable_table_renderer_1 = __webpack_require__(/*! ./datatable-table-renderer */ "./src/components/datatable/datatable-table-renderer.ts");
|
|
5298
6570
|
/**
|
|
5299
6571
|
* Custom DataTable plugin class with server-side API, pagination, and sorting
|
|
5300
6572
|
* @classdesc A custom KTComponent class that integrates server-side API, pagination, and sorting functionality into a table.
|
|
@@ -5314,18 +6586,12 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
5314
6586
|
_this._originalTheadClass = ''; // Store original thead class
|
|
5315
6587
|
_this._originalTdClasses = []; // Store original td classes as a 2D array [row][col]
|
|
5316
6588
|
_this._originalThClasses = []; // Store original th classes
|
|
6589
|
+
_this._infoElement = null;
|
|
6590
|
+
_this._sizeElement = null;
|
|
6591
|
+
_this._paginationElement = null;
|
|
6592
|
+
_this._cleanupCallbacks = [];
|
|
5317
6593
|
_this._data = [];
|
|
5318
6594
|
_this._isFetching = false;
|
|
5319
|
-
/**
|
|
5320
|
-
* AbortController for cancelling previous fetch requests
|
|
5321
|
-
* Used to prevent race conditions when multiple requests are triggered rapidly
|
|
5322
|
-
*/
|
|
5323
|
-
_this._abortController = null;
|
|
5324
|
-
/**
|
|
5325
|
-
* Request ID counter for tracking request sequence
|
|
5326
|
-
* Used to detect and ignore stale responses from older requests
|
|
5327
|
-
*/
|
|
5328
|
-
_this._requestId = 0;
|
|
5329
6595
|
if (data_1.default.has(element, _this._name)) {
|
|
5330
6596
|
// Already initialized (e.g. by createInstances). Merge user config so columns/sortType etc. apply.
|
|
5331
6597
|
var existing = KTDataTable.getInstance(element);
|
|
@@ -5336,22 +6602,26 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
5336
6602
|
}
|
|
5337
6603
|
_this._defaultConfig = _this._initDefaultConfig(config);
|
|
5338
6604
|
_this._init(element);
|
|
6605
|
+
if (!_this._element) {
|
|
6606
|
+
return _this;
|
|
6607
|
+
}
|
|
5339
6608
|
_this._buildConfig();
|
|
6609
|
+
_this._stateStore = new datatable_state_store_1.KTDataTableConfigStateStore(_this._config);
|
|
6610
|
+
_this._eventAdapter = (0, datatable_event_adapter_1.createDataTableEventAdapter)(_this._fireEvent.bind(_this), _this._dispatchEvent.bind(_this));
|
|
5340
6611
|
// Store the instance directly on the element
|
|
5341
6612
|
KTDataTable.asElementWithInstance(element).instance = _this;
|
|
5342
6613
|
_this._initElements();
|
|
6614
|
+
_this._tableRenderer = new datatable_table_renderer_1.KTDataTableDomTableRenderer();
|
|
6615
|
+
_this._paginationRenderer = new datatable_pagination_renderer_1.KTDataTableDomPaginationRenderer();
|
|
6616
|
+
_this._initDataProviders();
|
|
5343
6617
|
// Initialize checkbox handler
|
|
5344
|
-
_this._checkbox = (0, datatable_checkbox_1.createCheckboxHandler)(_this._element, _this._config,
|
|
5345
|
-
_this._fireEvent(eventName, eventData);
|
|
5346
|
-
_this._dispatchEvent(eventName, eventData);
|
|
5347
|
-
});
|
|
6618
|
+
_this._checkbox = (0, datatable_checkbox_1.createCheckboxHandler)(_this._element, _this._config, _this._emit.bind(_this));
|
|
5348
6619
|
// Initialize sort handler
|
|
5349
6620
|
_this._sortHandler = (0, datatable_sort_1.createSortHandler)(_this._config, _this._theadElement, function () { return ({
|
|
5350
6621
|
sortField: _this.getState().sortField,
|
|
5351
6622
|
sortOrder: _this.getState().sortOrder,
|
|
5352
6623
|
}); }, function (field, order) {
|
|
5353
|
-
_this.
|
|
5354
|
-
_this._config._state.sortOrder = order;
|
|
6624
|
+
_this._stateStore.setSort(field, order);
|
|
5355
6625
|
}, _this._fireEvent.bind(_this), _this._dispatchEvent.bind(_this), _this._updateData.bind(_this));
|
|
5356
6626
|
_this._sortHandler.initSort();
|
|
5357
6627
|
if (_this._config.stateSave === false) {
|
|
@@ -5361,8 +6631,7 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
5361
6631
|
_this._loadState();
|
|
5362
6632
|
}
|
|
5363
6633
|
_this._updateData();
|
|
5364
|
-
_this.
|
|
5365
|
-
_this._dispatchEvent('init');
|
|
6634
|
+
_this._emit('init');
|
|
5366
6635
|
return _this;
|
|
5367
6636
|
}
|
|
5368
6637
|
KTDataTable.asElementWithInstance = function (element) {
|
|
@@ -5371,6 +6640,30 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
5371
6640
|
KTDataTable.asSearchElementWithDebounce = function (element) {
|
|
5372
6641
|
return element;
|
|
5373
6642
|
};
|
|
6643
|
+
KTDataTable.prototype._emit = function (eventName, eventData) {
|
|
6644
|
+
this._eventAdapter.emit(eventName, eventData);
|
|
6645
|
+
};
|
|
6646
|
+
KTDataTable.prototype._initDataProviders = function () {
|
|
6647
|
+
var _this = this;
|
|
6648
|
+
this._localProvider = new datatable_local_provider_1.KTDataTableLocalDataProvider({
|
|
6649
|
+
config: this._config,
|
|
6650
|
+
elements: function () { return ({
|
|
6651
|
+
tableElement: _this._tableElement,
|
|
6652
|
+
tbodyElement: _this._tbodyElement,
|
|
6653
|
+
theadElement: _this._theadElement,
|
|
6654
|
+
}); },
|
|
6655
|
+
getLogicalColumnCount: this._getLogicalColumnCount.bind(this),
|
|
6656
|
+
storeOriginalClasses: this._storeOriginalClasses.bind(this),
|
|
6657
|
+
stateStore: this._stateStore,
|
|
6658
|
+
});
|
|
6659
|
+
this._remoteProvider = new datatable_remote_provider_1.KTDataTableRemoteDataProvider({
|
|
6660
|
+
config: this._config,
|
|
6661
|
+
createUrl: this._createUrl.bind(this),
|
|
6662
|
+
eventAdapter: this._eventAdapter,
|
|
6663
|
+
noticeOnTable: this._noticeOnTable.bind(this),
|
|
6664
|
+
stateStore: this._stateStore,
|
|
6665
|
+
});
|
|
6666
|
+
};
|
|
5374
6667
|
/**
|
|
5375
6668
|
* Initialize default configuration for the datatable
|
|
5376
6669
|
* @param config User-provided configuration options
|
|
@@ -5577,33 +6870,31 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
5577
6870
|
* @returns {void}
|
|
5578
6871
|
*/
|
|
5579
6872
|
KTDataTable.prototype._initElements = function () {
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
|
|
5583
|
-
|
|
5584
|
-
|
|
5585
|
-
|
|
5586
|
-
|
|
6873
|
+
var _a;
|
|
6874
|
+
var root = this._element;
|
|
6875
|
+
var attrs = this._config.attributes;
|
|
6876
|
+
if (!root || !(attrs === null || attrs === void 0 ? void 0 : attrs.table)) {
|
|
6877
|
+
throw new Error('KTDataTable: root element and table selector are required');
|
|
6878
|
+
}
|
|
6879
|
+
var tableEl = root.querySelector(attrs.table);
|
|
6880
|
+
if (!tableEl) {
|
|
6881
|
+
throw new Error("KTDataTable: table element not found (".concat(attrs.table, ")"));
|
|
6882
|
+
}
|
|
6883
|
+
this._tableElement = tableEl;
|
|
5587
6884
|
this._tbodyElement =
|
|
5588
6885
|
this._tableElement.tBodies[0] || this._tableElement.createTBody();
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
*/
|
|
5592
|
-
this._theadElement = this._tableElement.tHead;
|
|
5593
|
-
// Store original classes
|
|
6886
|
+
this._theadElement =
|
|
6887
|
+
(_a = this._tableElement.tHead) !== null && _a !== void 0 ? _a : this._tableElement.createTHead();
|
|
5594
6888
|
this._storeOriginalClasses();
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
this.
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
* Pagination element
|
|
5605
|
-
*/
|
|
5606
|
-
this._paginationElement = this._element.querySelector(this._config.attributes.pagination);
|
|
6889
|
+
this._infoElement = attrs.info
|
|
6890
|
+
? root.querySelector(attrs.info)
|
|
6891
|
+
: null;
|
|
6892
|
+
this._sizeElement = attrs.size
|
|
6893
|
+
? root.querySelector(attrs.size)
|
|
6894
|
+
: null;
|
|
6895
|
+
this._paginationElement = attrs.pagination
|
|
6896
|
+
? root.querySelector(attrs.pagination)
|
|
6897
|
+
: null;
|
|
5607
6898
|
};
|
|
5608
6899
|
/**
|
|
5609
6900
|
* Store original classes from table elements
|
|
@@ -5640,32 +6931,39 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
5640
6931
|
*/
|
|
5641
6932
|
KTDataTable.prototype._updateData = function () {
|
|
5642
6933
|
return __awaiter(this, void 0, void 0, function () {
|
|
5643
|
-
|
|
5644
|
-
|
|
6934
|
+
var result, _a;
|
|
6935
|
+
return __generator(this, function (_b) {
|
|
6936
|
+
switch (_b.label) {
|
|
5645
6937
|
case 0:
|
|
5646
6938
|
if (this._isFetching)
|
|
5647
6939
|
return [2 /*return*/]; // Prevent duplicate fetches
|
|
5648
6940
|
this._isFetching = true;
|
|
5649
|
-
|
|
6941
|
+
_b.label = 1;
|
|
5650
6942
|
case 1:
|
|
5651
|
-
|
|
6943
|
+
_b.trys.push([1, , 8, 9]);
|
|
5652
6944
|
this._showSpinner(); // Show spinner before fetching data
|
|
5653
|
-
|
|
5654
|
-
return [
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
6945
|
+
this._emit('fetch');
|
|
6946
|
+
if (!(typeof this._config.apiEndpoint === 'undefined')) return [3 /*break*/, 2];
|
|
6947
|
+
_a = this._localProvider.fetchSync();
|
|
6948
|
+
return [3 /*break*/, 4];
|
|
6949
|
+
case 2: return [4 /*yield*/, this._remoteProvider.fetch()];
|
|
5658
6950
|
case 3:
|
|
5659
|
-
_a.sent();
|
|
5660
|
-
|
|
5661
|
-
case 4:
|
|
6951
|
+
_a = _b.sent();
|
|
6952
|
+
_b.label = 4;
|
|
6953
|
+
case 4:
|
|
6954
|
+
result = _a;
|
|
6955
|
+
if (!!result.skipped) return [3 /*break*/, 6];
|
|
6956
|
+
this._data = result.data;
|
|
6957
|
+
this._stateStore.patchState({ totalItems: result.totalItems });
|
|
6958
|
+
return [4 /*yield*/, this._draw()];
|
|
5662
6959
|
case 5:
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
6960
|
+
_b.sent();
|
|
6961
|
+
this._emit('fetched');
|
|
6962
|
+
_b.label = 6;
|
|
6963
|
+
case 6: return [4 /*yield*/, this._finalize()];
|
|
6964
|
+
case 7:
|
|
6965
|
+
_b.sent();
|
|
6966
|
+
return [3 /*break*/, 9];
|
|
5669
6967
|
case 8:
|
|
5670
6968
|
// Finally block now correctly executes after promises resolve, not immediately
|
|
5671
6969
|
this._isFetching = false;
|
|
@@ -5680,377 +6978,77 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
5680
6978
|
* @returns {void}
|
|
5681
6979
|
*/
|
|
5682
6980
|
KTDataTable.prototype._finalize = function () {
|
|
5683
|
-
|
|
6981
|
+
var _a;
|
|
6982
|
+
(_a = this._element) === null || _a === void 0 ? void 0 : _a.classList.add('datatable-initialized');
|
|
5684
6983
|
// Initialize checkbox logic
|
|
5685
6984
|
this._checkbox.init();
|
|
5686
6985
|
// Re-initialize sort handler to restore click listeners after table redraw
|
|
5687
6986
|
if (this._sortHandler) {
|
|
5688
6987
|
this._sortHandler.initSort();
|
|
5689
|
-
}
|
|
5690
|
-
this._attachSearchEvent();
|
|
5691
|
-
if (typeof index_1.default !== 'undefined') {
|
|
5692
|
-
index_1.default.init();
|
|
5693
|
-
}
|
|
5694
|
-
/**
|
|
5695
|
-
* Hide spinner
|
|
5696
|
-
*/
|
|
5697
|
-
this._hideSpinner();
|
|
5698
|
-
};
|
|
5699
|
-
/**
|
|
5700
|
-
* Attach search event to the search input element
|
|
5701
|
-
* @returns {void}
|
|
5702
|
-
*/
|
|
5703
|
-
KTDataTable.prototype._attachSearchEvent = function () {
|
|
5704
|
-
var _this = this;
|
|
5705
|
-
var tableId = this._tableId();
|
|
5706
|
-
var searchElement = document.querySelector("[data-kt-datatable-search=\"#".concat(tableId, "\"]"));
|
|
5707
|
-
// Get search state
|
|
5708
|
-
var search = this.getState().search;
|
|
5709
|
-
// Set search value
|
|
5710
|
-
if (searchElement) {
|
|
5711
|
-
searchElement.value =
|
|
5712
|
-
search === undefined || search === null
|
|
5713
|
-
? ''
|
|
5714
|
-
: typeof search === 'string'
|
|
5715
|
-
? search
|
|
5716
|
-
: String(search);
|
|
5717
|
-
}
|
|
5718
|
-
if (searchElement) {
|
|
5719
|
-
// Check if a debounced search function already exists
|
|
5720
|
-
var searchWithDebounce = KTDataTable.asSearchElementWithDebounce(searchElement);
|
|
5721
|
-
if (searchWithDebounce._debouncedSearch) {
|
|
5722
|
-
// Remove the existing debounced event listener
|
|
5723
|
-
searchElement.removeEventListener('keyup', searchWithDebounce._debouncedSearch);
|
|
5724
|
-
}
|
|
5725
|
-
// Create a new debounced search function
|
|
5726
|
-
var debouncedSearch = this._debounce(function () {
|
|
5727
|
-
_this.search(searchElement.value);
|
|
5728
|
-
}, this._config.search.delay);
|
|
5729
|
-
// Store the new debounced function as a property of the element
|
|
5730
|
-
searchWithDebounce._debouncedSearch = debouncedSearch;
|
|
5731
|
-
// Add the new debounced event listener
|
|
5732
|
-
searchElement.addEventListener('keyup', debouncedSearch);
|
|
5733
|
-
}
|
|
5734
|
-
};
|
|
5735
|
-
/**
|
|
5736
|
-
* Fetch data from the DOM
|
|
5737
|
-
* Fetch data from the table element and save it to the `originalData` state property.
|
|
5738
|
-
* This method is used when the data is not fetched from the server via an API endpoint.
|
|
5739
|
-
*/
|
|
5740
|
-
KTDataTable.prototype._fetchDataFromLocal = function () {
|
|
5741
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
5742
|
-
var _a, sortField, sortOrder, page, pageSize, search, originalData, _b, originalData_1, originalDataAttributes, _temp, searchTerm, startIndex, endIndex;
|
|
5743
|
-
var _c;
|
|
5744
|
-
return __generator(this, function (_d) {
|
|
5745
|
-
switch (_d.label) {
|
|
5746
|
-
case 0:
|
|
5747
|
-
this._fireEvent('fetch');
|
|
5748
|
-
this._dispatchEvent('fetch');
|
|
5749
|
-
_a = this.getState(), sortField = _a.sortField, sortOrder = _a.sortOrder, page = _a.page, pageSize = _a.pageSize, search = _a.search;
|
|
5750
|
-
originalData = this.getState().originalData;
|
|
5751
|
-
// If the table element or the original data is not defined, bail
|
|
5752
|
-
if (!this._tableElement ||
|
|
5753
|
-
originalData === undefined ||
|
|
5754
|
-
this._tableConfigInvalidate() ||
|
|
5755
|
-
this._localTableHeaderInvalidate() ||
|
|
5756
|
-
this._localTableContentInvalidate()) {
|
|
5757
|
-
this._deleteState();
|
|
5758
|
-
_b = this._localExtractTableContent(), originalData_1 = _b.originalData, originalDataAttributes = _b.originalDataAttributes;
|
|
5759
|
-
this._config._state.originalData = originalData_1;
|
|
5760
|
-
this._config._state.originalDataAttributes = originalDataAttributes;
|
|
5761
|
-
}
|
|
5762
|
-
// Update the original data variable
|
|
5763
|
-
originalData = this.getState().originalData;
|
|
5764
|
-
_temp = (this._data = __spreadArray([], originalData, true));
|
|
5765
|
-
if (search) {
|
|
5766
|
-
searchTerm = typeof search === 'string' ? search : '';
|
|
5767
|
-
_temp = this._data = this._config.search.callback.call(this, this._data, searchTerm);
|
|
5768
|
-
}
|
|
5769
|
-
// If sorting is defined, sort the data
|
|
5770
|
-
if (sortField !== undefined &&
|
|
5771
|
-
sortOrder !== undefined &&
|
|
5772
|
-
sortOrder !== '') {
|
|
5773
|
-
if (typeof this._config.sort.callback === 'function') {
|
|
5774
|
-
this._data = this._config.sort.callback.call(this, this._data, sortField, sortOrder);
|
|
5775
|
-
}
|
|
5776
|
-
}
|
|
5777
|
-
// If there is data, slice it to the current page size
|
|
5778
|
-
if (((_c = this._data) === null || _c === void 0 ? void 0 : _c.length) > 0) {
|
|
5779
|
-
startIndex = (page - 1) * pageSize;
|
|
5780
|
-
endIndex = startIndex + pageSize;
|
|
5781
|
-
this._data = this._data.slice(startIndex, endIndex);
|
|
5782
|
-
}
|
|
5783
|
-
// Determine number of total rows
|
|
5784
|
-
this._config._state.totalItems = _temp.length;
|
|
5785
|
-
// Draw the data
|
|
5786
|
-
return [4 /*yield*/, this._draw()];
|
|
5787
|
-
case 1:
|
|
5788
|
-
// Draw the data
|
|
5789
|
-
_d.sent();
|
|
5790
|
-
this._fireEvent('fetched');
|
|
5791
|
-
this._dispatchEvent('fetched');
|
|
5792
|
-
return [2 /*return*/];
|
|
5793
|
-
}
|
|
5794
|
-
});
|
|
5795
|
-
});
|
|
5796
|
-
};
|
|
5797
|
-
/**
|
|
5798
|
-
* Checks if the table content has been invalidated by comparing the current checksum of the table body
|
|
5799
|
-
* with the stored checksum in the state. If the checksums are different, the state is updated with the
|
|
5800
|
-
* new checksum and `true` is returned. Otherwise, `false` is returned.
|
|
5801
|
-
*
|
|
5802
|
-
* @returns {boolean} `true` if the table content has been invalidated, `false` otherwise.
|
|
5803
|
-
*/
|
|
5804
|
-
KTDataTable.prototype._localTableContentInvalidate = function () {
|
|
5805
|
-
var checksum = utils_1.default.checksum(JSON.stringify(this._tbodyElement.innerHTML));
|
|
5806
|
-
if (this.getState()._contentChecksum !== checksum) {
|
|
5807
|
-
this._config._state._contentChecksum = checksum;
|
|
5808
|
-
return true;
|
|
5809
|
-
}
|
|
5810
|
-
return false;
|
|
5811
|
-
};
|
|
5812
|
-
KTDataTable.prototype._tableConfigInvalidate = function () {
|
|
5813
|
-
// Remove _data and _state from config
|
|
5814
|
-
var _a = this._config, _state = _a._state, restConfig = __rest(_a, ["_state"]);
|
|
5815
|
-
var checksum = utils_1.default.checksum(JSON.stringify(restConfig));
|
|
5816
|
-
if (_state._configChecksum !== checksum) {
|
|
5817
|
-
this._config._state._configChecksum = checksum;
|
|
5818
|
-
return true;
|
|
5819
|
-
}
|
|
5820
|
-
return false;
|
|
5821
|
-
};
|
|
5822
|
-
/**
|
|
5823
|
-
* Extract the table content and returns it as an object containing an array of original data and an array of original data attributes.
|
|
5824
|
-
*
|
|
5825
|
-
* @returns {{originalData: T[], originalDataAttributes: KTDataTableAttributeInterface[]}} - An object containing an array of original data and an array of original data attributes.
|
|
5826
|
-
*/
|
|
5827
|
-
KTDataTable.prototype._localExtractTableContent = function () {
|
|
5828
|
-
var originalData = [];
|
|
5829
|
-
var originalDataAttributes = [];
|
|
5830
|
-
this._storeOriginalClasses();
|
|
5831
|
-
var rows = this._tbodyElement.querySelectorAll('tr');
|
|
5832
|
-
// Filter th elements to only include those with data-kt-datatable-column attribute
|
|
5833
|
-
var allThs = this._theadElement
|
|
5834
|
-
? this._theadElement.querySelectorAll('th')
|
|
5835
|
-
: [];
|
|
5836
|
-
var ths = Array.from(allThs).filter(function (th) {
|
|
5837
|
-
return th.hasAttribute('data-kt-datatable-column');
|
|
5838
|
-
});
|
|
5839
|
-
rows.forEach(function (row) {
|
|
5840
|
-
var dataRow = {};
|
|
5841
|
-
var dataRowAttribute = {};
|
|
5842
|
-
row.querySelectorAll('td').forEach(function (td, index) {
|
|
5843
|
-
var _a, _b, _c;
|
|
5844
|
-
var colName = (_a = ths[index]) === null || _a === void 0 ? void 0 : _a.getAttribute('data-kt-datatable-column');
|
|
5845
|
-
if (colName) {
|
|
5846
|
-
dataRow[colName] = (_b = td.innerHTML) === null || _b === void 0 ? void 0 : _b.trim();
|
|
5847
|
-
}
|
|
5848
|
-
else {
|
|
5849
|
-
// Store the original HTML for fallback
|
|
5850
|
-
dataRow[index] = (_c = td.innerHTML) === null || _c === void 0 ? void 0 : _c.trim();
|
|
5851
|
-
}
|
|
5852
|
-
});
|
|
5853
|
-
if (Object.keys(dataRow).length > 0) {
|
|
5854
|
-
originalData.push(dataRow);
|
|
5855
|
-
originalDataAttributes.push(dataRowAttribute);
|
|
5856
|
-
}
|
|
5857
|
-
});
|
|
5858
|
-
return { originalData: originalData, originalDataAttributes: originalDataAttributes };
|
|
5859
|
-
};
|
|
5860
|
-
/**
|
|
5861
|
-
* Check if the table header is invalidated
|
|
5862
|
-
* @returns {boolean} - Returns true if the table header is invalidated, false otherwise
|
|
5863
|
-
*/
|
|
5864
|
-
KTDataTable.prototype._localTableHeaderInvalidate = function () {
|
|
5865
|
-
var originalData = this.getState().originalData;
|
|
5866
|
-
var totalColumns = originalData.length
|
|
5867
|
-
? Object.keys(originalData[0]).length
|
|
5868
|
-
: 0;
|
|
5869
|
-
// Count th elements with data-kt-datatable-column; when none (e.g. multi-row headers), use logical column count so we don't falsely invalidate
|
|
5870
|
-
var allThs = this._theadElement
|
|
5871
|
-
? this._theadElement.querySelectorAll('th')
|
|
5872
|
-
: [];
|
|
5873
|
-
var thsWithColumn = Array.from(allThs).filter(function (th) {
|
|
5874
|
-
return th.hasAttribute('data-kt-datatable-column');
|
|
5875
|
-
});
|
|
5876
|
-
var currentTableHeaders = thsWithColumn.length > 0
|
|
5877
|
-
? thsWithColumn.length
|
|
5878
|
-
: this._getLogicalColumnCount();
|
|
5879
|
-
return currentTableHeaders !== totalColumns;
|
|
5880
|
-
};
|
|
5881
|
-
/**
|
|
5882
|
-
* Returns the logical data column count (number of data columns), used for multi-row headers
|
|
5883
|
-
* where querySelectorAll('th') would overcount. Prefers state.originalData, then first tbody row td count.
|
|
5884
|
-
* @returns {number} Number of data columns, or 0 if unknown
|
|
5885
|
-
*/
|
|
5886
|
-
KTDataTable.prototype._getLogicalColumnCount = function () {
|
|
5887
|
-
var originalData = this.getState().originalData;
|
|
5888
|
-
if (originalData && originalData.length > 0) {
|
|
5889
|
-
return Object.keys(originalData[0]).length;
|
|
5890
|
-
}
|
|
5891
|
-
if (this._tbodyElement) {
|
|
5892
|
-
var firstRow = this._tbodyElement.querySelector('tr');
|
|
5893
|
-
if (firstRow) {
|
|
5894
|
-
return firstRow.querySelectorAll('td').length;
|
|
5895
|
-
}
|
|
5896
|
-
}
|
|
5897
|
-
return 0;
|
|
5898
|
-
};
|
|
5899
|
-
/**
|
|
5900
|
-
* Fetch data from the server
|
|
5901
|
-
*/
|
|
5902
|
-
KTDataTable.prototype._fetchDataFromServer = function () {
|
|
5903
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
5904
|
-
var currentRequestId, queryParams, response, error_1, responseData, error_2;
|
|
5905
|
-
return __generator(this, function (_a) {
|
|
5906
|
-
switch (_a.label) {
|
|
5907
|
-
case 0:
|
|
5908
|
-
currentRequestId = ++this._requestId;
|
|
5909
|
-
this._fireEvent('fetch');
|
|
5910
|
-
this._dispatchEvent('fetch');
|
|
5911
|
-
queryParams = this._getQueryParamsForFetchRequest();
|
|
5912
|
-
_a.label = 1;
|
|
5913
|
-
case 1:
|
|
5914
|
-
_a.trys.push([1, 3, , 4]);
|
|
5915
|
-
return [4 /*yield*/, this._performFetchRequest(queryParams)];
|
|
5916
|
-
case 2:
|
|
5917
|
-
response = _a.sent();
|
|
5918
|
-
return [3 /*break*/, 4];
|
|
5919
|
-
case 3:
|
|
5920
|
-
error_1 = _a.sent();
|
|
5921
|
-
// Silently ignore AbortError - request was cancelled
|
|
5922
|
-
if (error_1.name === 'AbortError') {
|
|
5923
|
-
return [2 /*return*/];
|
|
5924
|
-
}
|
|
5925
|
-
throw error_1;
|
|
5926
|
-
case 4:
|
|
5927
|
-
// Check if this response is stale (a newer request has been initiated)
|
|
5928
|
-
if (currentRequestId !== this._requestId) {
|
|
5929
|
-
// Ignore stale response - a more recent request is in progress or has completed
|
|
5930
|
-
return [2 /*return*/];
|
|
5931
|
-
}
|
|
5932
|
-
responseData = null;
|
|
5933
|
-
_a.label = 5;
|
|
5934
|
-
case 5:
|
|
5935
|
-
_a.trys.push([5, 7, , 8]);
|
|
5936
|
-
return [4 /*yield*/, response.json()];
|
|
5937
|
-
case 6:
|
|
5938
|
-
responseData = _a.sent();
|
|
5939
|
-
return [3 /*break*/, 8];
|
|
5940
|
-
case 7:
|
|
5941
|
-
error_2 = _a.sent();
|
|
5942
|
-
// Fire event with complete error context for application handling
|
|
5943
|
-
this._fireEvent('parseError', {
|
|
5944
|
-
response: response,
|
|
5945
|
-
error: String(error_2),
|
|
5946
|
-
status: response.status,
|
|
5947
|
-
statusText: response.statusText,
|
|
5948
|
-
});
|
|
5949
|
-
this._dispatchEvent('parseError', {
|
|
5950
|
-
response: response,
|
|
5951
|
-
error: String(error_2),
|
|
5952
|
-
status: response.status,
|
|
5953
|
-
statusText: response.statusText,
|
|
5954
|
-
});
|
|
5955
|
-
return [2 /*return*/];
|
|
5956
|
-
case 8:
|
|
5957
|
-
// Double-check request ID after JSON parsing (additional safety)
|
|
5958
|
-
if (currentRequestId !== this._requestId) {
|
|
5959
|
-
return [2 /*return*/];
|
|
5960
|
-
}
|
|
5961
|
-
this._fireEvent('fetched', { response: responseData });
|
|
5962
|
-
this._dispatchEvent('fetched', { response: responseData });
|
|
5963
|
-
// Use the mapResponse function to transform the data if provided
|
|
5964
|
-
if (typeof this._config.mapResponse === 'function') {
|
|
5965
|
-
responseData = this._config.mapResponse.call(this, responseData);
|
|
5966
|
-
}
|
|
5967
|
-
this._data = responseData.data;
|
|
5968
|
-
this._config._state.totalItems = responseData.totalCount;
|
|
5969
|
-
return [4 /*yield*/, this._draw()];
|
|
5970
|
-
case 9:
|
|
5971
|
-
_a.sent();
|
|
5972
|
-
this._fireEvent('fetched');
|
|
5973
|
-
this._dispatchEvent('fetched');
|
|
5974
|
-
return [2 /*return*/];
|
|
5975
|
-
}
|
|
5976
|
-
});
|
|
5977
|
-
});
|
|
6988
|
+
}
|
|
6989
|
+
this._attachSearchEvent();
|
|
6990
|
+
if (typeof index_1.default !== 'undefined') {
|
|
6991
|
+
index_1.default.init();
|
|
6992
|
+
}
|
|
6993
|
+
/**
|
|
6994
|
+
* Hide spinner
|
|
6995
|
+
*/
|
|
6996
|
+
this._hideSpinner();
|
|
5978
6997
|
};
|
|
5979
6998
|
/**
|
|
5980
|
-
*
|
|
5981
|
-
* @returns
|
|
6999
|
+
* Attach search event to the search input element
|
|
7000
|
+
* @returns {void}
|
|
5982
7001
|
*/
|
|
5983
|
-
KTDataTable.prototype.
|
|
5984
|
-
|
|
5985
|
-
var _a
|
|
5986
|
-
|
|
5987
|
-
var
|
|
5988
|
-
//
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
|
|
5995
|
-
|
|
5996
|
-
|
|
7002
|
+
KTDataTable.prototype._attachSearchEvent = function () {
|
|
7003
|
+
var _this = this;
|
|
7004
|
+
var _a, _b;
|
|
7005
|
+
var tableId = this._tableId();
|
|
7006
|
+
var searchElement = document.querySelector("[data-kt-datatable-search=\"#".concat(tableId, "\"]"));
|
|
7007
|
+
// Get search state
|
|
7008
|
+
var search = this.getState().search;
|
|
7009
|
+
// Set search value
|
|
7010
|
+
if (searchElement) {
|
|
7011
|
+
searchElement.value =
|
|
7012
|
+
search === undefined || search === null
|
|
7013
|
+
? ''
|
|
7014
|
+
: typeof search === 'string'
|
|
7015
|
+
? search
|
|
7016
|
+
: String(search);
|
|
5997
7017
|
}
|
|
5998
|
-
|
|
5999
|
-
|
|
6000
|
-
|
|
6001
|
-
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
|
|
7018
|
+
if (searchElement) {
|
|
7019
|
+
// Check if a debounced search function already exists
|
|
7020
|
+
var searchWithDebounce = KTDataTable.asSearchElementWithDebounce(searchElement);
|
|
7021
|
+
if (searchWithDebounce._debouncedSearch) {
|
|
7022
|
+
// Remove the existing debounced event listener
|
|
7023
|
+
searchElement.removeEventListener('keyup', searchWithDebounce._debouncedSearch);
|
|
7024
|
+
}
|
|
7025
|
+
// Create a new debounced search function
|
|
7026
|
+
var debouncedSearch = this._debounce(function () {
|
|
7027
|
+
_this.search(searchElement.value);
|
|
7028
|
+
}, (_b = (_a = this._config.search) === null || _a === void 0 ? void 0 : _a.delay) !== null && _b !== void 0 ? _b : 500);
|
|
7029
|
+
// Store the new debounced function as a property of the element
|
|
7030
|
+
searchWithDebounce._debouncedSearch = debouncedSearch;
|
|
7031
|
+
// Add the new debounced event listener
|
|
7032
|
+
searchElement.addEventListener('keyup', debouncedSearch);
|
|
6006
7033
|
}
|
|
6007
|
-
|
|
6008
|
-
|
|
7034
|
+
};
|
|
7035
|
+
/**
|
|
7036
|
+
* Returns the logical data column count (number of data columns), used for multi-row headers
|
|
7037
|
+
* where querySelectorAll('th') would overcount. Prefers state.originalData, then first tbody row td count.
|
|
7038
|
+
* @returns {number} Number of data columns, or 0 if unknown
|
|
7039
|
+
*/
|
|
7040
|
+
KTDataTable.prototype._getLogicalColumnCount = function () {
|
|
7041
|
+
var originalData = this.getState().originalData;
|
|
7042
|
+
if (originalData && originalData.length > 0) {
|
|
7043
|
+
return Object.keys(originalData[0]).length;
|
|
6009
7044
|
}
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
|
|
7045
|
+
if (this._tbodyElement) {
|
|
7046
|
+
var firstRow = this._tbodyElement.querySelector('tr');
|
|
7047
|
+
if (firstRow) {
|
|
7048
|
+
return firstRow.querySelectorAll('td').length;
|
|
7049
|
+
}
|
|
6013
7050
|
}
|
|
6014
|
-
|
|
6015
|
-
return queryParams;
|
|
6016
|
-
};
|
|
6017
|
-
KTDataTable.prototype._performFetchRequest = function (queryParams) {
|
|
6018
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
6019
|
-
var requestMethod, requestBody, apiEndpointWithQueryParams;
|
|
6020
|
-
var _this = this;
|
|
6021
|
-
return __generator(this, function (_a) {
|
|
6022
|
-
requestMethod = this._config.requestMethod;
|
|
6023
|
-
requestBody = undefined;
|
|
6024
|
-
// Cancel previous request to prevent race conditions
|
|
6025
|
-
if (this._abortController) {
|
|
6026
|
-
this._abortController.abort();
|
|
6027
|
-
}
|
|
6028
|
-
// Create new AbortController for this request
|
|
6029
|
-
this._abortController = new AbortController();
|
|
6030
|
-
// If the request method is POST, send the query params as the request body
|
|
6031
|
-
if (requestMethod === 'POST') {
|
|
6032
|
-
requestBody = queryParams;
|
|
6033
|
-
}
|
|
6034
|
-
else if (requestMethod === 'GET') {
|
|
6035
|
-
apiEndpointWithQueryParams = this._createUrl(this._config.apiEndpoint);
|
|
6036
|
-
apiEndpointWithQueryParams.search = queryParams.toString();
|
|
6037
|
-
this._config.apiEndpoint = apiEndpointWithQueryParams.toString();
|
|
6038
|
-
}
|
|
6039
|
-
return [2 /*return*/, fetch(this._config.apiEndpoint, __assign(__assign({ method: requestMethod, body: requestBody, headers: this._config.requestHeaders }, (this._config.requestCredentials && {
|
|
6040
|
-
credentials: this._config.requestCredentials,
|
|
6041
|
-
})), (this._abortController && { signal: this._abortController.signal }))).catch(function (error) {
|
|
6042
|
-
// Silently ignore AbortError - this is expected when requests are cancelled
|
|
6043
|
-
if (error.name === 'AbortError') {
|
|
6044
|
-
return Promise.reject(error);
|
|
6045
|
-
}
|
|
6046
|
-
// Trigger an error event for non-abort errors
|
|
6047
|
-
_this._fireEvent('error', { error: error });
|
|
6048
|
-
_this._dispatchEvent('error', { error: error });
|
|
6049
|
-
_this._noticeOnTable('Error performing fetch request: ' + String(error));
|
|
6050
|
-
throw error;
|
|
6051
|
-
})];
|
|
6052
|
-
});
|
|
6053
|
-
});
|
|
7051
|
+
return 0;
|
|
6054
7052
|
};
|
|
6055
7053
|
/**
|
|
6056
7054
|
* Creates a complete URL from a relative path or a full URL.
|
|
@@ -6067,7 +7065,10 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
6067
7065
|
* @returns {URL} The resulting URL object.
|
|
6068
7066
|
*/
|
|
6069
7067
|
KTDataTable.prototype._createUrl = function (pathOrUrl, baseUrl) {
|
|
6070
|
-
|
|
7068
|
+
var _a;
|
|
7069
|
+
if (baseUrl === void 0) { baseUrl = typeof window !== 'undefined'
|
|
7070
|
+
? window.location.origin
|
|
7071
|
+
: null; }
|
|
6071
7072
|
// Regular expression to check if the input is a full URL
|
|
6072
7073
|
var isFullUrl = /^[a-zA-Z][a-zA-Z\d+\-.]*:\/\//.test(pathOrUrl);
|
|
6073
7074
|
if (isFullUrl) {
|
|
@@ -6077,7 +7078,38 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
6077
7078
|
var normalizedPath = pathOrUrl.startsWith('/')
|
|
6078
7079
|
? pathOrUrl
|
|
6079
7080
|
: "/".concat(pathOrUrl);
|
|
6080
|
-
|
|
7081
|
+
// Opaque origins (e.g. srcdoc iframes) serialize as the string "null", which is not a valid URL base.
|
|
7082
|
+
var bases = [];
|
|
7083
|
+
if (baseUrl && baseUrl !== 'null') {
|
|
7084
|
+
bases.push(baseUrl);
|
|
7085
|
+
}
|
|
7086
|
+
if (typeof window !== 'undefined') {
|
|
7087
|
+
var href = window.location.href;
|
|
7088
|
+
if (href && !bases.includes(href)) {
|
|
7089
|
+
bases.push(href);
|
|
7090
|
+
}
|
|
7091
|
+
try {
|
|
7092
|
+
if (window.parent !== window && ((_a = window.parent.location) === null || _a === void 0 ? void 0 : _a.href)) {
|
|
7093
|
+
var parentHref = window.parent.location.href;
|
|
7094
|
+
if (parentHref && !bases.includes(parentHref)) {
|
|
7095
|
+
bases.push(parentHref);
|
|
7096
|
+
}
|
|
7097
|
+
}
|
|
7098
|
+
}
|
|
7099
|
+
catch (_b) {
|
|
7100
|
+
// parent is cross-origin
|
|
7101
|
+
}
|
|
7102
|
+
}
|
|
7103
|
+
for (var _i = 0, bases_1 = bases; _i < bases_1.length; _i++) {
|
|
7104
|
+
var base = bases_1[_i];
|
|
7105
|
+
try {
|
|
7106
|
+
return new URL(normalizedPath, base);
|
|
7107
|
+
}
|
|
7108
|
+
catch (_c) {
|
|
7109
|
+
// try next base
|
|
7110
|
+
}
|
|
7111
|
+
}
|
|
7112
|
+
throw new Error("KTDataTable: cannot resolve relative apiEndpoint \"".concat(pathOrUrl, "\" (no valid base URL; use an absolute apiEndpoint)."));
|
|
6081
7113
|
};
|
|
6082
7114
|
/**
|
|
6083
7115
|
* Update the table and pagination controls with new data
|
|
@@ -6086,20 +7118,19 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
6086
7118
|
KTDataTable.prototype._draw = function () {
|
|
6087
7119
|
return __awaiter(this, void 0, void 0, function () {
|
|
6088
7120
|
return __generator(this, function (_a) {
|
|
6089
|
-
this.
|
|
6090
|
-
Math.ceil(this.getState().totalItems / this.getState().pageSize) || 0
|
|
6091
|
-
|
|
6092
|
-
this.
|
|
7121
|
+
this._stateStore.patchState({
|
|
7122
|
+
totalPages: Math.ceil(this.getState().totalItems / this.getState().pageSize) || 0,
|
|
7123
|
+
});
|
|
7124
|
+
this._emit('draw');
|
|
6093
7125
|
this._dispose();
|
|
6094
7126
|
// Update the table and pagination controls
|
|
6095
7127
|
if (this._theadElement && this._tbodyElement) {
|
|
6096
7128
|
this._updateTable();
|
|
6097
7129
|
}
|
|
6098
|
-
if (this._infoElement
|
|
7130
|
+
if (this._infoElement || this._sizeElement || this._paginationElement) {
|
|
6099
7131
|
this._updatePagination();
|
|
6100
7132
|
}
|
|
6101
|
-
this.
|
|
6102
|
-
this._dispatchEvent('drew');
|
|
7133
|
+
this._emit('drew');
|
|
6103
7134
|
// Spinner is hidden in _finalize() to ensure it stays visible until the entire request completes
|
|
6104
7135
|
// Removed duplicate _hideSpinner() call here to prevent premature hiding
|
|
6105
7136
|
if (this._config.stateSave) {
|
|
@@ -6114,115 +7145,18 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
6114
7145
|
* @returns {HTMLTableSectionElement} The new table body element
|
|
6115
7146
|
*/
|
|
6116
7147
|
KTDataTable.prototype._updateTable = function () {
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
this
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
return tbodyElement;
|
|
6129
|
-
};
|
|
6130
|
-
/**
|
|
6131
|
-
* Update the table content
|
|
6132
|
-
* @param tbodyElement The table body element
|
|
6133
|
-
* @returns {HTMLTableSectionElement} The updated table body element
|
|
6134
|
-
*/
|
|
6135
|
-
KTDataTable.prototype._updateTableContent = function (tbodyElement) {
|
|
6136
|
-
var _this = this;
|
|
6137
|
-
var fragment = document.createDocumentFragment();
|
|
6138
|
-
tbodyElement.textContent = ''; // Clear the tbody element
|
|
6139
|
-
if (this._data.length === 0) {
|
|
6140
|
-
this._noticeOnTable(this._config.infoEmpty || '');
|
|
6141
|
-
return tbodyElement;
|
|
6142
|
-
}
|
|
6143
|
-
// Filter th elements to only include those with data-kt-datatable-column attribute
|
|
6144
|
-
// This prevents creating blank td elements for merged header cells (colspan/rowspan)
|
|
6145
|
-
var allThs = this._theadElement
|
|
6146
|
-
? this._theadElement.querySelectorAll('th')
|
|
6147
|
-
: [];
|
|
6148
|
-
var ths = Array.from(allThs).filter(function (th) {
|
|
6149
|
-
return th.hasAttribute('data-kt-datatable-column');
|
|
6150
|
-
});
|
|
6151
|
-
// When no th has data-kt-datatable-column (e.g. multi-row headers), use logical column count from tbody so we don't overcount thead cells
|
|
6152
|
-
var columnsToRender = ths.length > 0 ? ths : [];
|
|
6153
|
-
var logicalColumnCount = ths.length > 0 ? ths.length : this._getLogicalColumnCount();
|
|
6154
|
-
this._data.forEach(function (item, rowIndex) {
|
|
6155
|
-
var row = document.createElement('tr');
|
|
6156
|
-
// Apply original tr class if available
|
|
6157
|
-
if (_this._originalTrClasses && _this._originalTrClasses[rowIndex]) {
|
|
6158
|
-
row.className = _this._originalTrClasses[rowIndex];
|
|
6159
|
-
}
|
|
6160
|
-
if (!_this._config.columns) {
|
|
6161
|
-
var dataRowAttributes = _this.getState().originalDataAttributes
|
|
6162
|
-
? _this.getState().originalDataAttributes[rowIndex]
|
|
6163
|
-
: null;
|
|
6164
|
-
for (var colIndex = 0; colIndex < logicalColumnCount; colIndex++) {
|
|
6165
|
-
var th = columnsToRender[colIndex];
|
|
6166
|
-
var colName = th === null || th === void 0 ? void 0 : th.getAttribute('data-kt-datatable-column');
|
|
6167
|
-
var td = document.createElement('td');
|
|
6168
|
-
var value = void 0;
|
|
6169
|
-
if (colName && Object.prototype.hasOwnProperty.call(item, colName)) {
|
|
6170
|
-
value = item[colName];
|
|
6171
|
-
}
|
|
6172
|
-
else if (Object.prototype.hasOwnProperty.call(item, colIndex)) {
|
|
6173
|
-
value = item[colIndex];
|
|
6174
|
-
}
|
|
6175
|
-
else {
|
|
6176
|
-
value = '';
|
|
6177
|
-
}
|
|
6178
|
-
td.innerHTML = value;
|
|
6179
|
-
// Apply original td class if available
|
|
6180
|
-
if (_this._originalTdClasses &&
|
|
6181
|
-
_this._originalTdClasses[rowIndex] &&
|
|
6182
|
-
_this._originalTdClasses[rowIndex][colIndex]) {
|
|
6183
|
-
td.className = _this._originalTdClasses[rowIndex][colIndex];
|
|
6184
|
-
}
|
|
6185
|
-
if (dataRowAttributes && dataRowAttributes[colIndex]) {
|
|
6186
|
-
for (var attr in dataRowAttributes[colIndex]) {
|
|
6187
|
-
td.setAttribute(attr, dataRowAttributes[colIndex][attr]);
|
|
6188
|
-
}
|
|
6189
|
-
}
|
|
6190
|
-
row.appendChild(td);
|
|
6191
|
-
}
|
|
6192
|
-
}
|
|
6193
|
-
else {
|
|
6194
|
-
Object.keys(_this._config.columns).forEach(function (key, colIndex) {
|
|
6195
|
-
var td = document.createElement('td');
|
|
6196
|
-
var columnDef = _this._config.columns[key];
|
|
6197
|
-
// Apply original td class if available
|
|
6198
|
-
if (_this._originalTdClasses &&
|
|
6199
|
-
_this._originalTdClasses[rowIndex] &&
|
|
6200
|
-
_this._originalTdClasses[rowIndex][colIndex]) {
|
|
6201
|
-
td.className = _this._originalTdClasses[rowIndex][colIndex];
|
|
6202
|
-
}
|
|
6203
|
-
if (typeof columnDef.render === 'function') {
|
|
6204
|
-
var result = columnDef.render.call(_this, item[key], item, _this);
|
|
6205
|
-
if (result instanceof HTMLElement ||
|
|
6206
|
-
result instanceof DocumentFragment) {
|
|
6207
|
-
td.appendChild(result);
|
|
6208
|
-
}
|
|
6209
|
-
else if (typeof result === 'string') {
|
|
6210
|
-
td.innerHTML = result;
|
|
6211
|
-
}
|
|
6212
|
-
}
|
|
6213
|
-
else {
|
|
6214
|
-
td.textContent = item[key];
|
|
6215
|
-
}
|
|
6216
|
-
if (typeof columnDef.createdCell === 'function') {
|
|
6217
|
-
columnDef.createdCell.call(_this, td, item[key], item, row);
|
|
6218
|
-
}
|
|
6219
|
-
row.appendChild(td);
|
|
6220
|
-
});
|
|
6221
|
-
}
|
|
6222
|
-
fragment.appendChild(row);
|
|
7148
|
+
return this._tableRenderer.render({
|
|
7149
|
+
config: this._config,
|
|
7150
|
+
context: this,
|
|
7151
|
+
data: this._data,
|
|
7152
|
+
getLogicalColumnCount: this._getLogicalColumnCount.bind(this),
|
|
7153
|
+
getState: this.getState.bind(this),
|
|
7154
|
+
originalTbodyClass: this._originalTbodyClass,
|
|
7155
|
+
originalTrClasses: this._originalTrClasses,
|
|
7156
|
+
originalTdClasses: this._originalTdClasses,
|
|
7157
|
+
tableElement: this._tableElement,
|
|
7158
|
+
theadElement: this._theadElement,
|
|
6223
7159
|
});
|
|
6224
|
-
tbodyElement.appendChild(fragment);
|
|
6225
|
-
return tbodyElement;
|
|
6226
7160
|
};
|
|
6227
7161
|
/**
|
|
6228
7162
|
* Show a notice on the table
|
|
@@ -6231,66 +7165,22 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
6231
7165
|
*/
|
|
6232
7166
|
KTDataTable.prototype._noticeOnTable = function (message) {
|
|
6233
7167
|
if (message === void 0) { message = ''; }
|
|
6234
|
-
|
|
6235
|
-
var cell = row.insertCell();
|
|
6236
|
-
var logicalCount = this._getLogicalColumnCount();
|
|
6237
|
-
// Use logical column count so multi-row headers don't overcount; fallback to 1 when 0 so message still displays
|
|
6238
|
-
cell.colSpan = logicalCount > 0 ? logicalCount : 1;
|
|
6239
|
-
cell.innerHTML = message;
|
|
7168
|
+
this._tableRenderer.notice(this._tableElement, this._getLogicalColumnCount.bind(this), message);
|
|
6240
7169
|
};
|
|
6241
7170
|
KTDataTable.prototype._updatePagination = function () {
|
|
6242
|
-
this.
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
|
|
6251
|
-
|
|
6252
|
-
if (
|
|
6253
|
-
|
|
6254
|
-
}
|
|
6255
|
-
// Loop through all child elements of the container and remove them one by one
|
|
6256
|
-
while (container.firstChild) {
|
|
6257
|
-
// Remove the first child element (which is the first element in the list of child elements)
|
|
6258
|
-
container.removeChild(container.firstChild);
|
|
6259
|
-
}
|
|
6260
|
-
};
|
|
6261
|
-
/**
|
|
6262
|
-
* Creates a container element for the items per page selector.
|
|
6263
|
-
* @param _sizeElement The element to create the page size controls in.
|
|
6264
|
-
* @returns The container element.
|
|
6265
|
-
*/
|
|
6266
|
-
KTDataTable.prototype._createPageSizeControls = function (_sizeElement) {
|
|
6267
|
-
var _this = this;
|
|
6268
|
-
// If no element is provided, return early
|
|
6269
|
-
if (!_sizeElement) {
|
|
6270
|
-
return _sizeElement;
|
|
7171
|
+
var cleanup = this._paginationRenderer.render({
|
|
7172
|
+
config: this._config,
|
|
7173
|
+
dataLength: this._data.length,
|
|
7174
|
+
infoElement: this._infoElement,
|
|
7175
|
+
paginateData: this._paginateData.bind(this),
|
|
7176
|
+
paginationElement: this._paginationElement,
|
|
7177
|
+
reloadPageSize: this._reloadPageSize.bind(this),
|
|
7178
|
+
sizeElement: this._sizeElement,
|
|
7179
|
+
state: this.getState(),
|
|
7180
|
+
});
|
|
7181
|
+
if (typeof cleanup === 'function') {
|
|
7182
|
+
this._cleanupCallbacks.push(cleanup);
|
|
6271
7183
|
}
|
|
6272
|
-
// Wait for the element to be attached to the DOM
|
|
6273
|
-
setTimeout(function () {
|
|
6274
|
-
// Create <option> elements for each page size option
|
|
6275
|
-
var options = _this._config.pageSizes.map(function (size) {
|
|
6276
|
-
var option = document.createElement('option');
|
|
6277
|
-
option.value = String(size);
|
|
6278
|
-
option.text = String(size);
|
|
6279
|
-
option.selected = _this.getState().pageSize === size;
|
|
6280
|
-
return option;
|
|
6281
|
-
});
|
|
6282
|
-
// Add the <option> elements to the provided element
|
|
6283
|
-
_sizeElement.append.apply(_sizeElement, options);
|
|
6284
|
-
}, 100);
|
|
6285
|
-
// Create an event listener for the "change" event on the element
|
|
6286
|
-
var _pageSizeControlsEvent = function (event) {
|
|
6287
|
-
// When the element changes, reload the page with the new page size and page number 1
|
|
6288
|
-
_this._reloadPageSize(Number(event.target.value), 1);
|
|
6289
|
-
};
|
|
6290
|
-
// Bind the event listener to the component instance
|
|
6291
|
-
_sizeElement.onchange = _pageSizeControlsEvent.bind(this);
|
|
6292
|
-
// Return the element
|
|
6293
|
-
return _sizeElement;
|
|
6294
7184
|
};
|
|
6295
7185
|
/**
|
|
6296
7186
|
* Reloads the data with the specified page size and optional page number.
|
|
@@ -6300,120 +7190,10 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
6300
7190
|
KTDataTable.prototype._reloadPageSize = function (pageSize, page) {
|
|
6301
7191
|
if (page === void 0) { page = 1; }
|
|
6302
7192
|
// Update the page size and page number in the state
|
|
6303
|
-
this.
|
|
6304
|
-
this._config._state.page = page;
|
|
7193
|
+
this._stateStore.setPageSize(pageSize, page);
|
|
6305
7194
|
// Update the data with the new page size and page number
|
|
6306
7195
|
this._updateData();
|
|
6307
7196
|
};
|
|
6308
|
-
/**
|
|
6309
|
-
* Creates the pagination controls for the component.
|
|
6310
|
-
* @param _infoElement The element to set the info text in.
|
|
6311
|
-
* @param _paginationElement The element to create the pagination controls in.
|
|
6312
|
-
* @return {HTMLElement} The element containing the pagination controls.
|
|
6313
|
-
*/
|
|
6314
|
-
KTDataTable.prototype._createPaginationControls = function (_infoElement, _paginationElement) {
|
|
6315
|
-
if (!_infoElement || !_paginationElement || this._data.length === 0) {
|
|
6316
|
-
return null;
|
|
6317
|
-
}
|
|
6318
|
-
this._setPaginationInfoText(_infoElement);
|
|
6319
|
-
var paginationContainer = this._createPaginationContainer(_paginationElement);
|
|
6320
|
-
if (paginationContainer) {
|
|
6321
|
-
this._createPaginationButtons(paginationContainer);
|
|
6322
|
-
}
|
|
6323
|
-
return paginationContainer;
|
|
6324
|
-
};
|
|
6325
|
-
/**
|
|
6326
|
-
* Sets the info text for the pagination controls.
|
|
6327
|
-
* @param _infoElement The element to set the info text in.
|
|
6328
|
-
*/
|
|
6329
|
-
KTDataTable.prototype._setPaginationInfoText = function (_infoElement) {
|
|
6330
|
-
_infoElement.textContent = this._config.info
|
|
6331
|
-
.replace('{start}', (this.getState().page - 1) * this.getState().pageSize + 1 + '')
|
|
6332
|
-
.replace('{end}', Math.min(this.getState().page * this.getState().pageSize, this.getState().totalItems) + '')
|
|
6333
|
-
.replace('{total}', this.getState().totalItems + '');
|
|
6334
|
-
};
|
|
6335
|
-
/**
|
|
6336
|
-
* Creates the container element for the pagination controls.
|
|
6337
|
-
* @param _paginationElement The element to create the pagination controls in.
|
|
6338
|
-
* @return {HTMLElement} The container element.
|
|
6339
|
-
*/
|
|
6340
|
-
KTDataTable.prototype._createPaginationContainer = function (_paginationElement) {
|
|
6341
|
-
// No longer create a wrapping div. Just return the pagination element itself.
|
|
6342
|
-
return _paginationElement;
|
|
6343
|
-
};
|
|
6344
|
-
/**
|
|
6345
|
-
* Creates the pagination buttons for the component.
|
|
6346
|
-
* @param paginationContainer The container element for the pagination controls.
|
|
6347
|
-
*/
|
|
6348
|
-
KTDataTable.prototype._createPaginationButtons = function (paginationContainer) {
|
|
6349
|
-
var _this = this;
|
|
6350
|
-
var _a = this.getState(), currentPage = _a.page, totalPages = _a.totalPages;
|
|
6351
|
-
var _b = this._config.pagination, previous = _b.previous, next = _b.next, number = _b.number, more = _b.more;
|
|
6352
|
-
// Helper function to create a button
|
|
6353
|
-
var createButton = function (text, className, disabled, handleClick) {
|
|
6354
|
-
var button = document.createElement('button');
|
|
6355
|
-
button.className = className;
|
|
6356
|
-
button.innerHTML = text;
|
|
6357
|
-
button.disabled = disabled;
|
|
6358
|
-
button.onclick = handleClick;
|
|
6359
|
-
return button;
|
|
6360
|
-
};
|
|
6361
|
-
// Add Previous Button
|
|
6362
|
-
paginationContainer.appendChild(createButton(previous.text, "".concat(previous.class).concat(currentPage === 1 ? ' disabled' : ''), currentPage === 1, function () { return _this._paginateData(currentPage - 1); }));
|
|
6363
|
-
// Calculate range of pages
|
|
6364
|
-
var pageMoreEnabled = this._config.pageMore;
|
|
6365
|
-
if (pageMoreEnabled) {
|
|
6366
|
-
var maxButtons = this._config.pageMoreLimit;
|
|
6367
|
-
var range_1 = this._calculatePageRange(currentPage, totalPages, maxButtons);
|
|
6368
|
-
// Add start ellipsis
|
|
6369
|
-
if (range_1.start > 1) {
|
|
6370
|
-
paginationContainer.appendChild(createButton(more.text, more.class, false, function () {
|
|
6371
|
-
return _this._paginateData(Math.max(1, range_1.start - 1));
|
|
6372
|
-
}));
|
|
6373
|
-
}
|
|
6374
|
-
var _loop_1 = function (i) {
|
|
6375
|
-
paginationContainer.appendChild(createButton(number.text.replace('{page}', i.toString()), "".concat(number.class).concat(currentPage === i ? ' active disabled' : ''), currentPage === i, function () { return _this._paginateData(i); }));
|
|
6376
|
-
};
|
|
6377
|
-
// Add page buttons
|
|
6378
|
-
for (var i = range_1.start; i <= range_1.end; i++) {
|
|
6379
|
-
_loop_1(i);
|
|
6380
|
-
}
|
|
6381
|
-
// Add end ellipsis
|
|
6382
|
-
if (pageMoreEnabled && range_1.end < totalPages) {
|
|
6383
|
-
paginationContainer.appendChild(createButton(more.text, more.class, false, function () {
|
|
6384
|
-
return _this._paginateData(Math.min(totalPages, range_1.end + 1));
|
|
6385
|
-
}));
|
|
6386
|
-
}
|
|
6387
|
-
}
|
|
6388
|
-
else {
|
|
6389
|
-
var _loop_2 = function (i) {
|
|
6390
|
-
paginationContainer.appendChild(createButton(number.text.replace('{page}', i.toString()), "".concat(number.class).concat(currentPage === i ? ' active disabled' : ''), currentPage === i, function () { return _this._paginateData(i); }));
|
|
6391
|
-
};
|
|
6392
|
-
// Add page buttons
|
|
6393
|
-
for (var i = 1; i <= totalPages; i++) {
|
|
6394
|
-
_loop_2(i);
|
|
6395
|
-
}
|
|
6396
|
-
}
|
|
6397
|
-
// Add Next Button
|
|
6398
|
-
paginationContainer.appendChild(createButton(next.text, "".concat(next.class).concat(currentPage === totalPages ? ' disabled' : ''), currentPage === totalPages, function () { return _this._paginateData(currentPage + 1); }));
|
|
6399
|
-
};
|
|
6400
|
-
// New helper method to calculate page range
|
|
6401
|
-
KTDataTable.prototype._calculatePageRange = function (currentPage, totalPages, maxButtons) {
|
|
6402
|
-
var startPage, endPage;
|
|
6403
|
-
var halfMaxButtons = Math.floor(maxButtons / 2);
|
|
6404
|
-
if (totalPages <= maxButtons) {
|
|
6405
|
-
startPage = 1;
|
|
6406
|
-
endPage = totalPages;
|
|
6407
|
-
}
|
|
6408
|
-
else {
|
|
6409
|
-
startPage = Math.max(currentPage - halfMaxButtons, 1);
|
|
6410
|
-
endPage = Math.min(startPage + maxButtons - 1, totalPages);
|
|
6411
|
-
if (endPage - startPage < maxButtons - 1) {
|
|
6412
|
-
startPage = Math.max(endPage - maxButtons + 1, 1);
|
|
6413
|
-
}
|
|
6414
|
-
}
|
|
6415
|
-
return { start: startPage, end: endPage };
|
|
6416
|
-
};
|
|
6417
7197
|
/**
|
|
6418
7198
|
* Method for handling pagination
|
|
6419
7199
|
* @param page - The page number to navigate to
|
|
@@ -6422,39 +7202,54 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
6422
7202
|
if (page < 1 || !Number.isInteger(page)) {
|
|
6423
7203
|
return;
|
|
6424
7204
|
}
|
|
6425
|
-
this.
|
|
6426
|
-
this._dispatchEvent('pagination', { page: page });
|
|
7205
|
+
this._emit('pagination', { page: page });
|
|
6427
7206
|
if (page >= 1 && page <= this.getState().totalPages) {
|
|
6428
|
-
this.
|
|
7207
|
+
this._stateStore.setPage(page);
|
|
6429
7208
|
this._updateData();
|
|
6430
7209
|
}
|
|
6431
7210
|
};
|
|
6432
7211
|
// Method to show the loading spinner
|
|
6433
7212
|
KTDataTable.prototype._showSpinner = function () {
|
|
6434
|
-
var
|
|
7213
|
+
var _a, _b;
|
|
7214
|
+
var root = this._element;
|
|
7215
|
+
var spinnerSel = (_a = this._config.attributes) === null || _a === void 0 ? void 0 : _a.spinner;
|
|
7216
|
+
var fromDom = root && spinnerSel
|
|
7217
|
+
? root.querySelector(spinnerSel)
|
|
7218
|
+
: null;
|
|
7219
|
+
var spinner = fromDom !== null && fromDom !== void 0 ? fromDom : this._createSpinner();
|
|
6435
7220
|
if (spinner) {
|
|
6436
7221
|
spinner.style.display = 'block';
|
|
6437
7222
|
}
|
|
6438
|
-
|
|
7223
|
+
root === null || root === void 0 ? void 0 : root.classList.add((_b = this._config.loadingClass) !== null && _b !== void 0 ? _b : 'loading');
|
|
6439
7224
|
};
|
|
6440
7225
|
// Method to hide the loading spinner
|
|
6441
7226
|
KTDataTable.prototype._hideSpinner = function () {
|
|
6442
|
-
var
|
|
7227
|
+
var _a, _b;
|
|
7228
|
+
var root = this._element;
|
|
7229
|
+
var spinnerSel = (_a = this._config.attributes) === null || _a === void 0 ? void 0 : _a.spinner;
|
|
7230
|
+
var spinner = root && spinnerSel
|
|
7231
|
+
? root.querySelector(spinnerSel)
|
|
7232
|
+
: null;
|
|
6443
7233
|
if (spinner) {
|
|
6444
7234
|
spinner.style.display = 'none';
|
|
6445
7235
|
}
|
|
6446
|
-
|
|
7236
|
+
root === null || root === void 0 ? void 0 : root.classList.remove((_b = this._config.loadingClass) !== null && _b !== void 0 ? _b : 'loading');
|
|
6447
7237
|
};
|
|
6448
7238
|
// Method to create a spinner element if it doesn't exist
|
|
6449
7239
|
KTDataTable.prototype._createSpinner = function () {
|
|
6450
|
-
|
|
7240
|
+
var loading = this._config.loading;
|
|
7241
|
+
if (!loading) {
|
|
6451
7242
|
return null;
|
|
6452
7243
|
}
|
|
6453
7244
|
var template = document.createElement('template');
|
|
6454
|
-
template.innerHTML =
|
|
7245
|
+
template.innerHTML = loading.template
|
|
6455
7246
|
.trim()
|
|
6456
|
-
.replace('{content}',
|
|
6457
|
-
var
|
|
7247
|
+
.replace('{content}', loading.content);
|
|
7248
|
+
var first = template.content.firstChild;
|
|
7249
|
+
if (!first || !(first instanceof HTMLElement)) {
|
|
7250
|
+
return null;
|
|
7251
|
+
}
|
|
7252
|
+
var spinner = first;
|
|
6458
7253
|
spinner.setAttribute('data-kt-datatable-spinner', 'true');
|
|
6459
7254
|
this._tableElement.appendChild(spinner);
|
|
6460
7255
|
return spinner;
|
|
@@ -6464,8 +7259,7 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
6464
7259
|
* @returns {void}
|
|
6465
7260
|
*/
|
|
6466
7261
|
KTDataTable.prototype._saveState = function () {
|
|
6467
|
-
this.
|
|
6468
|
-
this._dispatchEvent('stateSave');
|
|
7262
|
+
this._emit('stateSave');
|
|
6469
7263
|
var ns = this._tableNamespace();
|
|
6470
7264
|
if (ns) {
|
|
6471
7265
|
localStorage.setItem(ns, JSON.stringify(this.getState()));
|
|
@@ -6482,7 +7276,7 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
6482
7276
|
try {
|
|
6483
7277
|
var state = JSON.parse(stateString);
|
|
6484
7278
|
if (state)
|
|
6485
|
-
this.
|
|
7279
|
+
this._stateStore.replaceState(state);
|
|
6486
7280
|
return state;
|
|
6487
7281
|
}
|
|
6488
7282
|
catch (_a) { }
|
|
@@ -6513,32 +7307,37 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
6513
7307
|
};
|
|
6514
7308
|
KTDataTable.prototype._tableId = function () {
|
|
6515
7309
|
var _a, _b;
|
|
6516
|
-
var
|
|
6517
|
-
|
|
6518
|
-
|
|
6519
|
-
id = this._tableElement.getAttribute('id');
|
|
7310
|
+
var tableIdAttr = (_a = this._tableElement) === null || _a === void 0 ? void 0 : _a.getAttribute('id');
|
|
7311
|
+
if (tableIdAttr) {
|
|
7312
|
+
return tableIdAttr;
|
|
6520
7313
|
}
|
|
6521
|
-
|
|
6522
|
-
if (
|
|
6523
|
-
|
|
7314
|
+
var rootIdAttr = (_b = this._element) === null || _b === void 0 ? void 0 : _b.getAttribute('id');
|
|
7315
|
+
if (rootIdAttr) {
|
|
7316
|
+
return rootIdAttr;
|
|
6524
7317
|
}
|
|
6525
|
-
return
|
|
7318
|
+
return '';
|
|
6526
7319
|
};
|
|
6527
7320
|
/**
|
|
6528
7321
|
* Clean up all event listeners, handlers, and DOM nodes created by this instance.
|
|
6529
7322
|
* This method is called before re-rendering or when disposing the component.
|
|
6530
7323
|
*/
|
|
6531
7324
|
KTDataTable.prototype._dispose = function () {
|
|
7325
|
+
var _a, _b, _c;
|
|
7326
|
+
var root = this._element;
|
|
7327
|
+
if (!root) {
|
|
7328
|
+
return;
|
|
7329
|
+
}
|
|
7330
|
+
this._cleanupCallbacks.forEach(function (cleanup) { return cleanup(); });
|
|
7331
|
+
this._cleanupCallbacks = [];
|
|
6532
7332
|
// --- 1. Remove search input event listener (debounced) ---
|
|
6533
7333
|
var tableId = this._tableId();
|
|
6534
7334
|
var searchElement = document.querySelector("[data-kt-datatable-search=\"#".concat(tableId, "\"]"));
|
|
6535
7335
|
if (searchElement) {
|
|
6536
7336
|
var searchWithDebounce = KTDataTable.asSearchElementWithDebounce(searchElement);
|
|
6537
|
-
if (
|
|
6538
|
-
|
|
7337
|
+
if (searchWithDebounce._debouncedSearch) {
|
|
7338
|
+
searchElement.removeEventListener('keyup', searchWithDebounce._debouncedSearch);
|
|
7339
|
+
delete searchWithDebounce._debouncedSearch;
|
|
6539
7340
|
}
|
|
6540
|
-
searchElement.removeEventListener('keyup', searchWithDebounce._debouncedSearch);
|
|
6541
|
-
delete searchWithDebounce._debouncedSearch;
|
|
6542
7341
|
}
|
|
6543
7342
|
// --- 2. Remove page size dropdown event listener ---
|
|
6544
7343
|
if (this._sizeElement && this._sizeElement.onchange) {
|
|
@@ -6558,10 +7357,12 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
6558
7357
|
checkboxWithDispose.dispose();
|
|
6559
7358
|
}
|
|
6560
7359
|
else {
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
|
|
7360
|
+
var checkSel = (_a = this._config.attributes) === null || _a === void 0 ? void 0 : _a.check;
|
|
7361
|
+
if (checkSel) {
|
|
7362
|
+
var headerCheckElement = root.querySelector(checkSel);
|
|
7363
|
+
if (headerCheckElement) {
|
|
7364
|
+
headerCheckElement.replaceWith(headerCheckElement.cloneNode(true));
|
|
7365
|
+
}
|
|
6565
7366
|
}
|
|
6566
7367
|
}
|
|
6567
7368
|
// KTDataTableSortAPI does not have a dispose method, but we can remove th click listeners by replacing them
|
|
@@ -6572,16 +7373,20 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
6572
7373
|
});
|
|
6573
7374
|
}
|
|
6574
7375
|
// --- 5. Remove spinner DOM node if it exists ---
|
|
6575
|
-
var
|
|
6576
|
-
if (
|
|
6577
|
-
spinner.
|
|
7376
|
+
var spinnerSel = (_b = this._config.attributes) === null || _b === void 0 ? void 0 : _b.spinner;
|
|
7377
|
+
if (spinnerSel) {
|
|
7378
|
+
var spinner = root.querySelector(spinnerSel);
|
|
7379
|
+
if (spinner === null || spinner === void 0 ? void 0 : spinner.parentNode) {
|
|
7380
|
+
spinner.parentNode.removeChild(spinner);
|
|
7381
|
+
}
|
|
6578
7382
|
}
|
|
6579
|
-
|
|
7383
|
+
root.classList.remove((_c = this._config.loadingClass) !== null && _c !== void 0 ? _c : 'loading');
|
|
6580
7384
|
// --- 6. Remove instance reference from the DOM element ---
|
|
6581
|
-
var elementWithInstance = KTDataTable.asElementWithInstance(
|
|
7385
|
+
var elementWithInstance = KTDataTable.asElementWithInstance(root);
|
|
6582
7386
|
if (elementWithInstance.instance) {
|
|
6583
7387
|
delete elementWithInstance.instance;
|
|
6584
7388
|
}
|
|
7389
|
+
data_1.default.remove(root, this._name);
|
|
6585
7390
|
// --- 7. (Optional) Clear localStorage state ---
|
|
6586
7391
|
// Uncomment the following line if you want to clear state on dispose:
|
|
6587
7392
|
// this._deleteState();
|
|
@@ -6605,24 +7410,8 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
6605
7410
|
* Gets the current state of the table.
|
|
6606
7411
|
* @returns {KTDataTableStateInterface} The current state of the table.
|
|
6607
7412
|
*/
|
|
6608
|
-
KTDataTable.prototype.getState = function () {
|
|
6609
|
-
return
|
|
6610
|
-
/**
|
|
6611
|
-
* The current page number.
|
|
6612
|
-
*/
|
|
6613
|
-
page: 1,
|
|
6614
|
-
/**
|
|
6615
|
-
* The field that the data is sorted by.
|
|
6616
|
-
*/
|
|
6617
|
-
sortField: null,
|
|
6618
|
-
/**
|
|
6619
|
-
* The sort order (ascending or descending).
|
|
6620
|
-
*/
|
|
6621
|
-
sortOrder: '',
|
|
6622
|
-
/**
|
|
6623
|
-
* The number of rows to display per page.
|
|
6624
|
-
*/
|
|
6625
|
-
pageSize: this._config.pageSize, filters: [] }, this._config._state);
|
|
7413
|
+
KTDataTable.prototype.getState = function () {
|
|
7414
|
+
return this._stateStore.getState();
|
|
6626
7415
|
};
|
|
6627
7416
|
/**
|
|
6628
7417
|
* Sorts the data in the table by the specified field.
|
|
@@ -6633,10 +7422,8 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
6633
7422
|
var state = this.getState();
|
|
6634
7423
|
var sortOrder = this._sortHandler.toggleSortOrder(state.sortField, state.sortOrder, field);
|
|
6635
7424
|
this._sortHandler.setSortIcon(field, sortOrder);
|
|
6636
|
-
this.
|
|
6637
|
-
this.
|
|
6638
|
-
this._fireEvent('sort', { field: field, order: sortOrder });
|
|
6639
|
-
this._dispatchEvent('sort', { field: field, order: sortOrder });
|
|
7425
|
+
this._stateStore.setSort(field, sortOrder);
|
|
7426
|
+
this._emit('sort', { field: field, order: sortOrder });
|
|
6640
7427
|
this._updateData();
|
|
6641
7428
|
};
|
|
6642
7429
|
/**
|
|
@@ -6669,15 +7456,13 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
6669
7456
|
* Triggers the 'reload' event and the 'kt.datatable.reload' custom event.
|
|
6670
7457
|
*/
|
|
6671
7458
|
KTDataTable.prototype.reload = function () {
|
|
6672
|
-
this.
|
|
6673
|
-
this._dispatchEvent('reload');
|
|
7459
|
+
this._emit('reload');
|
|
6674
7460
|
// Fetch the data from the server using the current sort and filter settings
|
|
6675
7461
|
this._updateData();
|
|
6676
7462
|
};
|
|
6677
7463
|
KTDataTable.prototype.redraw = function (page) {
|
|
6678
7464
|
if (page === void 0) { page = 1; }
|
|
6679
|
-
this.
|
|
6680
|
-
this._dispatchEvent('redraw');
|
|
7465
|
+
this._emit('redraw');
|
|
6681
7466
|
this._paginateData(page);
|
|
6682
7467
|
};
|
|
6683
7468
|
/**
|
|
@@ -6706,18 +7491,16 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
6706
7491
|
* @throws Error if the filter object is null or undefined.
|
|
6707
7492
|
*/
|
|
6708
7493
|
KTDataTable.prototype.setFilter = function (filter) {
|
|
6709
|
-
this.
|
|
6710
|
-
filter,
|
|
6711
|
-
], false);
|
|
6712
|
-
this._config._state.page = 1;
|
|
7494
|
+
this._stateStore.setFilter(filter);
|
|
6713
7495
|
return this;
|
|
6714
7496
|
};
|
|
6715
7497
|
KTDataTable.prototype.dispose = function () {
|
|
7498
|
+
var _a;
|
|
7499
|
+
(_a = this._remoteProvider) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
6716
7500
|
this._dispose();
|
|
6717
7501
|
};
|
|
6718
7502
|
KTDataTable.prototype.search = function (query) {
|
|
6719
|
-
this.
|
|
6720
|
-
this._config._state.page = 1;
|
|
7503
|
+
this._stateStore.setSearch(query);
|
|
6721
7504
|
this.reload();
|
|
6722
7505
|
};
|
|
6723
7506
|
/**
|
|
@@ -6810,8 +7593,7 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
6810
7593
|
*/
|
|
6811
7594
|
KTDataTable.prototype.check = function () {
|
|
6812
7595
|
this._checkbox.check();
|
|
6813
|
-
this.
|
|
6814
|
-
this._dispatchEvent('checked');
|
|
7596
|
+
this._emit('checked');
|
|
6815
7597
|
};
|
|
6816
7598
|
/**
|
|
6817
7599
|
* Uncheck all visible row checkboxes
|
|
@@ -6819,8 +7601,7 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
6819
7601
|
*/
|
|
6820
7602
|
KTDataTable.prototype.uncheck = function () {
|
|
6821
7603
|
this._checkbox.uncheck();
|
|
6822
|
-
this.
|
|
6823
|
-
this._dispatchEvent('unchecked');
|
|
7604
|
+
this._emit('unchecked');
|
|
6824
7605
|
};
|
|
6825
7606
|
/**
|
|
6826
7607
|
* Get all checked row IDs (across all pages if preserveSelection is true)
|
|
@@ -7758,15 +8539,20 @@ var KTDropdown = /** @class */ (function (_super) {
|
|
|
7758
8539
|
return _this;
|
|
7759
8540
|
}
|
|
7760
8541
|
_this._init(element);
|
|
8542
|
+
if (!_this._element) {
|
|
8543
|
+
return _this;
|
|
8544
|
+
}
|
|
7761
8545
|
_this._buildConfig(config);
|
|
7762
|
-
|
|
7763
|
-
if (!
|
|
8546
|
+
var toggle = _this._element.querySelector('[data-kt-dropdown-toggle]');
|
|
8547
|
+
if (!toggle) {
|
|
7764
8548
|
return _this;
|
|
7765
8549
|
}
|
|
7766
|
-
|
|
7767
|
-
if (!
|
|
8550
|
+
var menu = _this._element.querySelector('[data-kt-dropdown-menu]');
|
|
8551
|
+
if (!menu) {
|
|
7768
8552
|
return _this;
|
|
7769
8553
|
}
|
|
8554
|
+
_this._toggleElement = toggle;
|
|
8555
|
+
_this._menuElement = menu;
|
|
7770
8556
|
data_1.default.set(_this._menuElement, 'dropdownElement', _this._element);
|
|
7771
8557
|
_this._setupNestedDropdowns();
|
|
7772
8558
|
_this._handleContainer();
|
|
@@ -7812,10 +8598,13 @@ var KTDropdown = /** @class */ (function (_super) {
|
|
|
7812
8598
|
return;
|
|
7813
8599
|
if (this._getOption('trigger') !== 'hover')
|
|
7814
8600
|
return;
|
|
7815
|
-
|
|
7816
|
-
|
|
7817
|
-
|
|
7818
|
-
|
|
8601
|
+
var root = this._element;
|
|
8602
|
+
if (!root)
|
|
8603
|
+
return;
|
|
8604
|
+
if (data_1.default.get(root, 'hover') === '1') {
|
|
8605
|
+
clearTimeout(data_1.default.get(root, 'timeout'));
|
|
8606
|
+
data_1.default.remove(root, 'hover');
|
|
8607
|
+
data_1.default.remove(root, 'timeout');
|
|
7819
8608
|
}
|
|
7820
8609
|
this._show();
|
|
7821
8610
|
};
|
|
@@ -7825,17 +8614,20 @@ var KTDropdown = /** @class */ (function (_super) {
|
|
|
7825
8614
|
return;
|
|
7826
8615
|
if (this._getOption('trigger') !== 'hover')
|
|
7827
8616
|
return;
|
|
8617
|
+
var root = this._element;
|
|
8618
|
+
if (!root)
|
|
8619
|
+
return;
|
|
7828
8620
|
var relatedTarget = event.relatedTarget;
|
|
7829
|
-
var isWithinDropdown =
|
|
8621
|
+
var isWithinDropdown = relatedTarget !== null && root.contains(relatedTarget);
|
|
7830
8622
|
if (isWithinDropdown)
|
|
7831
8623
|
return;
|
|
7832
8624
|
var timeout = setTimeout(function () {
|
|
7833
|
-
if (data_1.default.get(
|
|
8625
|
+
if (data_1.default.get(root, 'hover') === '1') {
|
|
7834
8626
|
_this._hide();
|
|
7835
8627
|
}
|
|
7836
8628
|
}, parseInt(this._getOption('hoverTimeout')));
|
|
7837
|
-
data_1.default.set(
|
|
7838
|
-
data_1.default.set(
|
|
8629
|
+
data_1.default.set(root, 'hover', '1');
|
|
8630
|
+
data_1.default.set(root, 'timeout', timeout);
|
|
7839
8631
|
};
|
|
7840
8632
|
KTDropdown.prototype._toggle = function () {
|
|
7841
8633
|
if (this._isOpen) {
|
|
@@ -7855,9 +8647,12 @@ var KTDropdown = /** @class */ (function (_super) {
|
|
|
7855
8647
|
this._dispatchEvent('show', payload);
|
|
7856
8648
|
if (payload.cancel)
|
|
7857
8649
|
return;
|
|
7858
|
-
|
|
8650
|
+
var root = this._element;
|
|
8651
|
+
if (!root)
|
|
8652
|
+
return;
|
|
8653
|
+
KTDropdown.hide(root);
|
|
7859
8654
|
var zIndex = parseInt(this._getOption('zindex'));
|
|
7860
|
-
var parentZindex = dom_1.default.getHighestZindex(
|
|
8655
|
+
var parentZindex = dom_1.default.getHighestZindex(root);
|
|
7861
8656
|
if (parentZindex !== null && parentZindex >= zIndex) {
|
|
7862
8657
|
zIndex = parentZindex + 1;
|
|
7863
8658
|
}
|
|
@@ -7871,7 +8666,7 @@ var KTDropdown = /** @class */ (function (_super) {
|
|
|
7871
8666
|
this._menuElement.classList.remove(this._getOption('hiddenClass'));
|
|
7872
8667
|
this._toggleElement.classList.add('active');
|
|
7873
8668
|
this._menuElement.classList.add('open');
|
|
7874
|
-
|
|
8669
|
+
root.classList.add('open');
|
|
7875
8670
|
this._initPopper();
|
|
7876
8671
|
dom_1.default.transitionEnd(this._menuElement, function () {
|
|
7877
8672
|
_this._isTransitioning = false;
|
|
@@ -7893,12 +8688,15 @@ var KTDropdown = /** @class */ (function (_super) {
|
|
|
7893
8688
|
this._dispatchEvent('hide', payload);
|
|
7894
8689
|
if (payload.cancel)
|
|
7895
8690
|
return;
|
|
8691
|
+
var root = this._element;
|
|
8692
|
+
if (!root)
|
|
8693
|
+
return;
|
|
7896
8694
|
this._menuElement.style.opacity = '1';
|
|
7897
8695
|
dom_1.default.reflow(this._menuElement);
|
|
7898
8696
|
this._menuElement.style.opacity = '0';
|
|
7899
8697
|
this._menuElement.classList.remove('open');
|
|
7900
8698
|
this._toggleElement.classList.remove('active');
|
|
7901
|
-
|
|
8699
|
+
root.classList.remove('open');
|
|
7902
8700
|
dom_1.default.transitionEnd(this._menuElement, function () {
|
|
7903
8701
|
_this._isTransitioning = false;
|
|
7904
8702
|
_this._isOpen = false;
|
|
@@ -7924,17 +8722,26 @@ var KTDropdown = /** @class */ (function (_super) {
|
|
|
7924
8722
|
}
|
|
7925
8723
|
if (reference) {
|
|
7926
8724
|
var popper = (0, core_1.createPopper)(reference, this._menuElement, this._getPopperConfig());
|
|
7927
|
-
|
|
8725
|
+
var root = this._element;
|
|
8726
|
+
if (root) {
|
|
8727
|
+
data_1.default.set(root, 'popper', popper);
|
|
8728
|
+
}
|
|
7928
8729
|
}
|
|
7929
8730
|
};
|
|
7930
8731
|
KTDropdown.prototype._destroyPopper = function () {
|
|
7931
|
-
|
|
7932
|
-
|
|
7933
|
-
|
|
8732
|
+
var root = this._element;
|
|
8733
|
+
if (!root)
|
|
8734
|
+
return;
|
|
8735
|
+
if (data_1.default.has(root, 'popper')) {
|
|
8736
|
+
data_1.default.get(root, 'popper').destroy();
|
|
8737
|
+
data_1.default.remove(root, 'popper');
|
|
7934
8738
|
}
|
|
7935
8739
|
};
|
|
7936
8740
|
KTDropdown.prototype._isDropdownOpen = function () {
|
|
7937
|
-
|
|
8741
|
+
var root = this._element;
|
|
8742
|
+
if (!root)
|
|
8743
|
+
return false;
|
|
8744
|
+
return (root.classList.contains('open') &&
|
|
7938
8745
|
this._menuElement.classList.contains('open'));
|
|
7939
8746
|
};
|
|
7940
8747
|
KTDropdown.prototype._getPopperConfig = function () {
|
|
@@ -8039,10 +8846,11 @@ var KTDropdown = /** @class */ (function (_super) {
|
|
|
8039
8846
|
return null;
|
|
8040
8847
|
};
|
|
8041
8848
|
KTDropdown.getInstance = function (element) {
|
|
8042
|
-
|
|
8043
|
-
if (!
|
|
8849
|
+
var resolved = this.getElement(element);
|
|
8850
|
+
if (!resolved) {
|
|
8044
8851
|
return null;
|
|
8045
8852
|
}
|
|
8853
|
+
element = resolved;
|
|
8046
8854
|
if (data_1.default.has(element, 'dropdown')) {
|
|
8047
8855
|
var instance = data_1.default.get(element, 'dropdown');
|
|
8048
8856
|
return instance;
|
|
@@ -8098,6 +8906,8 @@ var KTDropdown = /** @class */ (function (_super) {
|
|
|
8098
8906
|
KTDropdown.handleKeyboard = function () {
|
|
8099
8907
|
document.addEventListener('keydown', function (event) {
|
|
8100
8908
|
var dropdownEl = document.querySelector('.open[data-kt-dropdown-initialized]');
|
|
8909
|
+
if (!dropdownEl)
|
|
8910
|
+
return;
|
|
8101
8911
|
var dropdown = KTDropdown.getInstance(dropdownEl);
|
|
8102
8912
|
if (!dropdown || !dropdown._getOption('keyboard'))
|
|
8103
8913
|
return;
|
|
@@ -8108,36 +8918,44 @@ var KTDropdown = /** @class */ (function (_super) {
|
|
|
8108
8918
|
});
|
|
8109
8919
|
};
|
|
8110
8920
|
KTDropdown.handleMouseover = function () {
|
|
8111
|
-
event_handler_1.default.on(document.body, '[data-kt-dropdown-toggle], [data-kt-dropdown-menu]', 'mouseover', function (event, target) {
|
|
8921
|
+
event_handler_1.default.on(document.body, '[data-kt-dropdown-toggle], [data-kt-dropdown-menu]', 'mouseover', (function (event, target) {
|
|
8922
|
+
if (!event || !target)
|
|
8923
|
+
return;
|
|
8112
8924
|
var dropdown = KTDropdown.getInstance(target);
|
|
8113
8925
|
if (dropdown && dropdown._getOption('trigger') === 'hover') {
|
|
8114
8926
|
dropdown.mouseover(event);
|
|
8115
8927
|
}
|
|
8116
|
-
});
|
|
8928
|
+
}));
|
|
8117
8929
|
};
|
|
8118
8930
|
KTDropdown.handleMouseout = function () {
|
|
8119
|
-
event_handler_1.default.on(document.body, '[data-kt-dropdown-toggle], [data-kt-dropdown-menu]', 'mouseout', function (event, target) {
|
|
8931
|
+
event_handler_1.default.on(document.body, '[data-kt-dropdown-toggle], [data-kt-dropdown-menu]', 'mouseout', (function (event, target) {
|
|
8932
|
+
if (!event || !target)
|
|
8933
|
+
return;
|
|
8120
8934
|
var dropdown = KTDropdown.getInstance(target);
|
|
8121
8935
|
if (dropdown && dropdown._getOption('trigger') === 'hover') {
|
|
8122
8936
|
dropdown.mouseout(event);
|
|
8123
8937
|
}
|
|
8124
|
-
});
|
|
8938
|
+
}));
|
|
8125
8939
|
};
|
|
8126
8940
|
KTDropdown.handleClick = function () {
|
|
8127
|
-
event_handler_1.default.on(document.body, '[data-kt-dropdown-toggle]', 'click', function (event, target) {
|
|
8941
|
+
event_handler_1.default.on(document.body, '[data-kt-dropdown-toggle]', 'click', (function (event, target) {
|
|
8942
|
+
if (!event || !target)
|
|
8943
|
+
return;
|
|
8128
8944
|
var dropdown = KTDropdown.getInstance(target);
|
|
8129
8945
|
if (dropdown) {
|
|
8130
8946
|
dropdown.click(event);
|
|
8131
8947
|
}
|
|
8132
|
-
});
|
|
8948
|
+
}));
|
|
8133
8949
|
};
|
|
8134
8950
|
KTDropdown.handleDismiss = function () {
|
|
8135
|
-
event_handler_1.default.on(document.body, '[data-kt-dropdown-dismiss]', 'click', function (event, target) {
|
|
8951
|
+
event_handler_1.default.on(document.body, '[data-kt-dropdown-dismiss]', 'click', (function (event, target) {
|
|
8952
|
+
if (!event || !target)
|
|
8953
|
+
return;
|
|
8136
8954
|
var dropdown = KTDropdown.getInstance(target);
|
|
8137
8955
|
if (dropdown) {
|
|
8138
8956
|
dropdown.hide();
|
|
8139
8957
|
}
|
|
8140
|
-
});
|
|
8958
|
+
}));
|
|
8141
8959
|
};
|
|
8142
8960
|
KTDropdown.initHandlers = function () {
|
|
8143
8961
|
this.handleClickAway();
|
|
@@ -8449,6 +9267,282 @@ var image_input_1 = __webpack_require__(/*! ./image-input */ "./src/components/i
|
|
|
8449
9267
|
Object.defineProperty(exports, "KTImageInput", ({ enumerable: true, get: function () { return image_input_1.KTImageInput; } }));
|
|
8450
9268
|
|
|
8451
9269
|
|
|
9270
|
+
/***/ }),
|
|
9271
|
+
|
|
9272
|
+
/***/ "./src/components/input-number/index.ts":
|
|
9273
|
+
/*!**********************************************!*\
|
|
9274
|
+
!*** ./src/components/input-number/index.ts ***!
|
|
9275
|
+
\**********************************************/
|
|
9276
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
9277
|
+
|
|
9278
|
+
|
|
9279
|
+
/**
|
|
9280
|
+
* KTUI - Free & Open-Source Tailwind UI Components by Keenthemes
|
|
9281
|
+
* Copyright 2025 by Keenthemes Inc
|
|
9282
|
+
*/
|
|
9283
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
9284
|
+
exports.KTInputNumber = void 0;
|
|
9285
|
+
var input_number_1 = __webpack_require__(/*! ./input-number */ "./src/components/input-number/input-number.ts");
|
|
9286
|
+
Object.defineProperty(exports, "KTInputNumber", ({ enumerable: true, get: function () { return input_number_1.KTInputNumber; } }));
|
|
9287
|
+
|
|
9288
|
+
|
|
9289
|
+
/***/ }),
|
|
9290
|
+
|
|
9291
|
+
/***/ "./src/components/input-number/input-number.ts":
|
|
9292
|
+
/*!*****************************************************!*\
|
|
9293
|
+
!*** ./src/components/input-number/input-number.ts ***!
|
|
9294
|
+
\*****************************************************/
|
|
9295
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
9296
|
+
|
|
9297
|
+
|
|
9298
|
+
/**
|
|
9299
|
+
* KTUI - Free & Open-Source Tailwind UI Components by Keenthemes
|
|
9300
|
+
* Copyright 2025 by Keenthemes Inc
|
|
9301
|
+
*/
|
|
9302
|
+
var __extends = (this && this.__extends) || (function () {
|
|
9303
|
+
var extendStatics = function (d, b) {
|
|
9304
|
+
extendStatics = Object.setPrototypeOf ||
|
|
9305
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
9306
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
9307
|
+
return extendStatics(d, b);
|
|
9308
|
+
};
|
|
9309
|
+
return function (d, b) {
|
|
9310
|
+
if (typeof b !== "function" && b !== null)
|
|
9311
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
9312
|
+
extendStatics(d, b);
|
|
9313
|
+
function __() { this.constructor = d; }
|
|
9314
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
9315
|
+
};
|
|
9316
|
+
})();
|
|
9317
|
+
var __assign = (this && this.__assign) || function () {
|
|
9318
|
+
__assign = Object.assign || function(t) {
|
|
9319
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
9320
|
+
s = arguments[i];
|
|
9321
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
9322
|
+
t[p] = s[p];
|
|
9323
|
+
}
|
|
9324
|
+
return t;
|
|
9325
|
+
};
|
|
9326
|
+
return __assign.apply(this, arguments);
|
|
9327
|
+
};
|
|
9328
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
9329
|
+
exports.KTInputNumber = void 0;
|
|
9330
|
+
var data_1 = __webpack_require__(/*! ../../helpers/data */ "./src/helpers/data.ts");
|
|
9331
|
+
var component_1 = __webpack_require__(/*! ../component */ "./src/components/component.ts");
|
|
9332
|
+
var KTInputNumber = /** @class */ (function (_super) {
|
|
9333
|
+
__extends(KTInputNumber, _super);
|
|
9334
|
+
function KTInputNumber(element, config) {
|
|
9335
|
+
if (config === void 0) { config = null; }
|
|
9336
|
+
var _a, _b, _c, _d, _e, _f;
|
|
9337
|
+
var _this = _super.call(this) || this;
|
|
9338
|
+
_this._name = 'input-number';
|
|
9339
|
+
_this._defaultConfig = {};
|
|
9340
|
+
_this._config = _this._defaultConfig;
|
|
9341
|
+
_this._numberInput = null;
|
|
9342
|
+
_this._onNativeInput = null;
|
|
9343
|
+
_this._onNativeChange = null;
|
|
9344
|
+
_this._onDecrementClick = null;
|
|
9345
|
+
_this._onIncrementClick = null;
|
|
9346
|
+
_this._decrementElement = null;
|
|
9347
|
+
_this._incrementElement = null;
|
|
9348
|
+
var input = KTInputNumber.findNumberInput(element);
|
|
9349
|
+
if (!input) {
|
|
9350
|
+
return _this;
|
|
9351
|
+
}
|
|
9352
|
+
if (_this._shouldSkipInit(element)) {
|
|
9353
|
+
return _this;
|
|
9354
|
+
}
|
|
9355
|
+
_this._numberInput = input;
|
|
9356
|
+
_this._init(element);
|
|
9357
|
+
_this._buildConfig(config);
|
|
9358
|
+
_this._onNativeInput = _this._handleNativeInput.bind(_this);
|
|
9359
|
+
_this._onNativeChange = _this._handleNativeChange.bind(_this);
|
|
9360
|
+
(_a = _this._element) === null || _a === void 0 ? void 0 : _a.addEventListener('input', _this._onNativeInput);
|
|
9361
|
+
(_b = _this._element) === null || _b === void 0 ? void 0 : _b.addEventListener('change', _this._onNativeChange);
|
|
9362
|
+
_this._decrementElement =
|
|
9363
|
+
(_d = (_c = _this._element) === null || _c === void 0 ? void 0 : _c.querySelector('[data-kt-input-number-decrement]')) !== null && _d !== void 0 ? _d : null;
|
|
9364
|
+
_this._incrementElement =
|
|
9365
|
+
(_f = (_e = _this._element) === null || _e === void 0 ? void 0 : _e.querySelector('[data-kt-input-number-increment]')) !== null && _f !== void 0 ? _f : null;
|
|
9366
|
+
_this._onDecrementClick = function (e) {
|
|
9367
|
+
e.preventDefault();
|
|
9368
|
+
if (!_this._numberInput || _this._numberInput.disabled)
|
|
9369
|
+
return;
|
|
9370
|
+
if (typeof _this._numberInput.stepDown === 'function') {
|
|
9371
|
+
_this._numberInput.stepDown();
|
|
9372
|
+
}
|
|
9373
|
+
};
|
|
9374
|
+
_this._onIncrementClick = function (e) {
|
|
9375
|
+
e.preventDefault();
|
|
9376
|
+
if (!_this._numberInput || _this._numberInput.disabled)
|
|
9377
|
+
return;
|
|
9378
|
+
if (typeof _this._numberInput.stepUp === 'function') {
|
|
9379
|
+
_this._numberInput.stepUp();
|
|
9380
|
+
}
|
|
9381
|
+
};
|
|
9382
|
+
if (_this._decrementElement && _this._onDecrementClick) {
|
|
9383
|
+
_this._decrementElement.addEventListener('click', _this._onDecrementClick);
|
|
9384
|
+
}
|
|
9385
|
+
if (_this._incrementElement && _this._onIncrementClick) {
|
|
9386
|
+
_this._incrementElement.addEventListener('click', _this._onIncrementClick);
|
|
9387
|
+
}
|
|
9388
|
+
return _this;
|
|
9389
|
+
}
|
|
9390
|
+
KTInputNumber.findNumberInput = function (root) {
|
|
9391
|
+
if (root instanceof HTMLInputElement && root.type === 'number') {
|
|
9392
|
+
return root;
|
|
9393
|
+
}
|
|
9394
|
+
return root.querySelector('input[type="number"]');
|
|
9395
|
+
};
|
|
9396
|
+
KTInputNumber.prototype._getNumericMin = function () {
|
|
9397
|
+
var input = this._numberInput;
|
|
9398
|
+
if (!input)
|
|
9399
|
+
return undefined;
|
|
9400
|
+
if (typeof input.min === 'string' && input.min !== '') {
|
|
9401
|
+
var n = parseFloat(input.min);
|
|
9402
|
+
if (Number.isFinite(n))
|
|
9403
|
+
return n;
|
|
9404
|
+
}
|
|
9405
|
+
return undefined;
|
|
9406
|
+
};
|
|
9407
|
+
KTInputNumber.prototype._getNumericMax = function () {
|
|
9408
|
+
var input = this._numberInput;
|
|
9409
|
+
if (!input)
|
|
9410
|
+
return undefined;
|
|
9411
|
+
if (typeof input.max === 'string' && input.max !== '') {
|
|
9412
|
+
var n = parseFloat(input.max);
|
|
9413
|
+
if (Number.isFinite(n))
|
|
9414
|
+
return n;
|
|
9415
|
+
}
|
|
9416
|
+
return undefined;
|
|
9417
|
+
};
|
|
9418
|
+
KTInputNumber.prototype._getStepForPayload = function () {
|
|
9419
|
+
var input = this._numberInput;
|
|
9420
|
+
if (!input)
|
|
9421
|
+
return undefined;
|
|
9422
|
+
var raw = input.getAttribute('step');
|
|
9423
|
+
if (raw === 'any')
|
|
9424
|
+
return undefined;
|
|
9425
|
+
if (raw === null || raw === '')
|
|
9426
|
+
return 1;
|
|
9427
|
+
var n = parseFloat(raw);
|
|
9428
|
+
return Number.isFinite(n) && n > 0 ? n : 1;
|
|
9429
|
+
};
|
|
9430
|
+
KTInputNumber.prototype._getCurrentNumericValue = function () {
|
|
9431
|
+
var input = this._numberInput;
|
|
9432
|
+
if (!input)
|
|
9433
|
+
return null;
|
|
9434
|
+
if (input.value === '') {
|
|
9435
|
+
return null;
|
|
9436
|
+
}
|
|
9437
|
+
var n = typeof input.valueAsNumber === 'number' &&
|
|
9438
|
+
!Number.isNaN(input.valueAsNumber)
|
|
9439
|
+
? input.valueAsNumber
|
|
9440
|
+
: parseFloat(input.value);
|
|
9441
|
+
return Number.isFinite(n) ? n : null;
|
|
9442
|
+
};
|
|
9443
|
+
KTInputNumber.prototype._buildEventPayload = function () {
|
|
9444
|
+
var _a;
|
|
9445
|
+
var input = this._numberInput;
|
|
9446
|
+
var min = this._getNumericMin();
|
|
9447
|
+
var max = this._getNumericMax();
|
|
9448
|
+
var step = this._getStepForPayload();
|
|
9449
|
+
var value = this._getCurrentNumericValue();
|
|
9450
|
+
var valueAsString = (_a = input === null || input === void 0 ? void 0 : input.value) !== null && _a !== void 0 ? _a : '';
|
|
9451
|
+
return __assign(__assign(__assign({ value: value, valueAsString: valueAsString }, (min !== undefined ? { min: min } : {})), (max !== undefined ? { max: max } : {})), (step !== undefined ? { step: step } : {}));
|
|
9452
|
+
};
|
|
9453
|
+
KTInputNumber.prototype._handleNativeInput = function (_event) {
|
|
9454
|
+
var event = _event;
|
|
9455
|
+
var target = event.target;
|
|
9456
|
+
if (!(target instanceof HTMLInputElement) || target.type !== 'number') {
|
|
9457
|
+
return;
|
|
9458
|
+
}
|
|
9459
|
+
this._numberInput = target;
|
|
9460
|
+
var payload = this._buildEventPayload();
|
|
9461
|
+
this._fireEvent('input', payload);
|
|
9462
|
+
this._dispatchEvent('kt.input-number.input', payload);
|
|
9463
|
+
};
|
|
9464
|
+
KTInputNumber.prototype._handleNativeChange = function (_event) {
|
|
9465
|
+
var event = _event;
|
|
9466
|
+
var target = event.target;
|
|
9467
|
+
if (!(target instanceof HTMLInputElement) || target.type !== 'number') {
|
|
9468
|
+
return;
|
|
9469
|
+
}
|
|
9470
|
+
this._numberInput = target;
|
|
9471
|
+
var payload = this._buildEventPayload();
|
|
9472
|
+
this._fireEvent('change', payload);
|
|
9473
|
+
this._dispatchEvent('kt.input-number.change', payload);
|
|
9474
|
+
};
|
|
9475
|
+
KTInputNumber.prototype.getNumberInput = function () {
|
|
9476
|
+
return this._numberInput;
|
|
9477
|
+
};
|
|
9478
|
+
KTInputNumber.prototype.getValue = function () {
|
|
9479
|
+
return this._getCurrentNumericValue();
|
|
9480
|
+
};
|
|
9481
|
+
KTInputNumber.prototype.dispose = function () {
|
|
9482
|
+
if (this._element) {
|
|
9483
|
+
if (this._onNativeInput) {
|
|
9484
|
+
this._element.removeEventListener('input', this._onNativeInput);
|
|
9485
|
+
}
|
|
9486
|
+
if (this._onNativeChange) {
|
|
9487
|
+
this._element.removeEventListener('change', this._onNativeChange);
|
|
9488
|
+
}
|
|
9489
|
+
}
|
|
9490
|
+
if (this._decrementElement && this._onDecrementClick) {
|
|
9491
|
+
this._decrementElement.removeEventListener('click', this._onDecrementClick);
|
|
9492
|
+
}
|
|
9493
|
+
if (this._incrementElement && this._onIncrementClick) {
|
|
9494
|
+
this._incrementElement.removeEventListener('click', this._onIncrementClick);
|
|
9495
|
+
}
|
|
9496
|
+
this._onNativeInput = null;
|
|
9497
|
+
this._onNativeChange = null;
|
|
9498
|
+
this._onDecrementClick = null;
|
|
9499
|
+
this._onIncrementClick = null;
|
|
9500
|
+
this._decrementElement = null;
|
|
9501
|
+
this._incrementElement = null;
|
|
9502
|
+
this._numberInput = null;
|
|
9503
|
+
_super.prototype.dispose.call(this);
|
|
9504
|
+
};
|
|
9505
|
+
KTInputNumber.getInstance = function (element) {
|
|
9506
|
+
if (!element) {
|
|
9507
|
+
return null;
|
|
9508
|
+
}
|
|
9509
|
+
if (data_1.default.has(element, 'input-number')) {
|
|
9510
|
+
return data_1.default.get(element, 'input-number');
|
|
9511
|
+
}
|
|
9512
|
+
return null;
|
|
9513
|
+
};
|
|
9514
|
+
KTInputNumber.getOrCreateInstance = function (element, config) {
|
|
9515
|
+
var existing = this.getInstance(element);
|
|
9516
|
+
if (existing) {
|
|
9517
|
+
return existing;
|
|
9518
|
+
}
|
|
9519
|
+
if (!this.findNumberInput(element)) {
|
|
9520
|
+
return null;
|
|
9521
|
+
}
|
|
9522
|
+
new KTInputNumber(element, config !== null && config !== void 0 ? config : undefined);
|
|
9523
|
+
return this.getInstance(element);
|
|
9524
|
+
};
|
|
9525
|
+
KTInputNumber.createInstances = function () {
|
|
9526
|
+
document
|
|
9527
|
+
.querySelectorAll('[data-kt-input-number]')
|
|
9528
|
+
.forEach(function (el) {
|
|
9529
|
+
if (el.getAttribute('data-kt-input-number-lazy') === 'true') {
|
|
9530
|
+
return;
|
|
9531
|
+
}
|
|
9532
|
+
new KTInputNumber(el);
|
|
9533
|
+
});
|
|
9534
|
+
};
|
|
9535
|
+
KTInputNumber.init = function () {
|
|
9536
|
+
KTInputNumber.createInstances();
|
|
9537
|
+
};
|
|
9538
|
+
return KTInputNumber;
|
|
9539
|
+
}(component_1.default));
|
|
9540
|
+
exports.KTInputNumber = KTInputNumber;
|
|
9541
|
+
if (typeof window !== 'undefined') {
|
|
9542
|
+
window.KTInputNumber = KTInputNumber;
|
|
9543
|
+
}
|
|
9544
|
+
|
|
9545
|
+
|
|
8452
9546
|
/***/ }),
|
|
8453
9547
|
|
|
8454
9548
|
/***/ "./src/components/modal/index.ts":
|
|
@@ -11140,7 +12234,8 @@ exports.DefaultConfig = {
|
|
|
11140
12234
|
selectAllText: 'Select all', // Text for the "Select All" option (if implemented)
|
|
11141
12235
|
clearAllText: 'Clear all', // Text for the "Clear All" option (if implemented)
|
|
11142
12236
|
enableSelectAll: false, // Enable/disable "Select All" button for multi-select
|
|
11143
|
-
showSelectedCount:
|
|
12237
|
+
showSelectedCount: false, // Tags mode: show "N selected" before chips when true
|
|
12238
|
+
selectedCountText: '{{count}} selected', // Tags mode; use {{count}} placeholder
|
|
11144
12239
|
renderSelected: undefined, // Custom function to render the selected value(s) in the display area
|
|
11145
12240
|
// Accessibility & Usability
|
|
11146
12241
|
label: 'Select an option', // Label for the select component (for screen readers)
|
|
@@ -13967,11 +15062,24 @@ var KTSelect = /** @class */ (function (_super) {
|
|
|
13967
15062
|
return this._searchInputElement;
|
|
13968
15063
|
};
|
|
13969
15064
|
/**
|
|
13970
|
-
*
|
|
15065
|
+
* Returns the current selection as **option value** strings (not labels, not DOM nodes).
|
|
15066
|
+
* For single-select, the array has zero or one entry; use {@link getValue} for a scalar.
|
|
15067
|
+
* For multiple-select, the array may contain multiple values in arbitrary order.
|
|
13971
15068
|
*/
|
|
13972
15069
|
KTSelect.prototype.getSelectedOptions = function () {
|
|
13973
15070
|
return this._state.getSelectedOptions();
|
|
13974
15071
|
};
|
|
15072
|
+
/**
|
|
15073
|
+
* Returns the selected option **value** for single-select, or `null` when nothing is selected.
|
|
15074
|
+
* When the select is configured with `multiple: true`, always returns `null` — use {@link getSelectedOptions} instead.
|
|
15075
|
+
*/
|
|
15076
|
+
KTSelect.prototype.getValue = function () {
|
|
15077
|
+
if (this._config.multiple) {
|
|
15078
|
+
return null;
|
|
15079
|
+
}
|
|
15080
|
+
var values = this._state.getSelectedOptions();
|
|
15081
|
+
return values.length > 0 ? values[0] : null;
|
|
15082
|
+
};
|
|
13975
15083
|
/**
|
|
13976
15084
|
* Get configuration
|
|
13977
15085
|
*/
|
|
@@ -14993,6 +16101,7 @@ var KTSelectTags = /** @class */ (function () {
|
|
|
14993
16101
|
*/
|
|
14994
16102
|
KTSelectTags.prototype.updateTagsDisplay = function (selectedOptions) {
|
|
14995
16103
|
var _this = this;
|
|
16104
|
+
var _a;
|
|
14996
16105
|
if (!this._valueDisplayElement)
|
|
14997
16106
|
return;
|
|
14998
16107
|
var valueDisplayElement = this._valueDisplayElement;
|
|
@@ -15010,6 +16119,15 @@ var KTSelectTags = /** @class */ (function () {
|
|
|
15010
16119
|
}
|
|
15011
16120
|
// Clear all existing content before adding tags
|
|
15012
16121
|
valueDisplayElement.innerHTML = '';
|
|
16122
|
+
// Optional summary count (config exists for tags mode; non-tag display uses templates instead)
|
|
16123
|
+
if (this._config.showSelectedCount && selectedOptions.length > 0) {
|
|
16124
|
+
var countEl = document.createElement('span');
|
|
16125
|
+
countEl.setAttribute('data-kt-select-selected-count', 'true');
|
|
16126
|
+
countEl.className = 'kt-select-selected-count';
|
|
16127
|
+
countEl.setAttribute('aria-live', 'polite');
|
|
16128
|
+
countEl.textContent = (0, utils_1.renderTemplateString)((_a = this._config.selectedCountText) !== null && _a !== void 0 ? _a : '{{count}} selected', { count: selectedOptions.length });
|
|
16129
|
+
valueDisplayElement.appendChild(countEl);
|
|
16130
|
+
}
|
|
15013
16131
|
// Insert each tag before the display element
|
|
15014
16132
|
selectedOptions.forEach(function (optionValue) {
|
|
15015
16133
|
var _a;
|
|
@@ -18947,9 +20065,9 @@ exports["default"] = KTUtils;
|
|
|
18947
20065
|
* Copyright 2025 by Keenthemes Inc
|
|
18948
20066
|
*/
|
|
18949
20067
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
18950
|
-
exports.KTCarousel = exports.KTPinInput = exports.KTRangeSlider = exports.KTClipboard = exports.KTRepeater = exports.KTRating = exports.KTToast = exports.KTSelect = exports.KTDataTable = exports.KTTogglePassword = exports.KTImageInput = exports.KTThemeSwitch = exports.KTStepper = exports.KTTooltip = exports.KTToggle = exports.KTReparent = exports.KTSticky = exports.KTScrollto = exports.KTScrollable = exports.KTScrollspy = exports.KTAccordion = exports.KTTabs = exports.KTDismiss = exports.KTCollapse = exports.KTDrawer = exports.KTModal = exports.KTDropdown = void 0;
|
|
18951
|
-
var dom_1 = __webpack_require__(/*! ./helpers/dom */ "./src/helpers/dom.ts");
|
|
20068
|
+
exports.KTComponents = exports.KTCarousel = exports.KTInputNumber = exports.KTPinInput = exports.KTRangeSlider = exports.KTClipboard = exports.KTRepeater = exports.KTRating = exports.KTToast = exports.KTSelect = exports.KTDataTable = exports.KTTogglePassword = exports.KTImageInput = exports.KTThemeSwitch = exports.KTStepper = exports.KTTooltip = exports.KTToggle = exports.KTReparent = exports.KTSticky = exports.KTScrollto = exports.KTScrollable = exports.KTScrollspy = exports.KTAccordion = exports.KTTabs = exports.KTDismiss = exports.KTCollapse = exports.KTDrawer = exports.KTModal = exports.KTContextMenu = exports.KTDropdown = void 0;
|
|
18952
20069
|
var dropdown_1 = __webpack_require__(/*! ./components/dropdown */ "./src/components/dropdown/index.ts");
|
|
20070
|
+
var context_menu_1 = __webpack_require__(/*! ./components/context-menu */ "./src/components/context-menu/index.ts");
|
|
18953
20071
|
var modal_1 = __webpack_require__(/*! ./components/modal */ "./src/components/modal/index.ts");
|
|
18954
20072
|
var drawer_1 = __webpack_require__(/*! ./components/drawer */ "./src/components/drawer/index.ts");
|
|
18955
20073
|
var collapse_1 = __webpack_require__(/*! ./components/collapse */ "./src/components/collapse/index.ts");
|
|
@@ -18975,9 +20093,12 @@ var repeater_1 = __webpack_require__(/*! ./components/repeater */ "./src/compone
|
|
|
18975
20093
|
var clipboard_1 = __webpack_require__(/*! ./components/clipboard */ "./src/components/clipboard/index.ts");
|
|
18976
20094
|
var range_slider_1 = __webpack_require__(/*! ./components/range-slider */ "./src/components/range-slider/index.ts");
|
|
18977
20095
|
var pin_input_1 = __webpack_require__(/*! ./components/pin-input */ "./src/components/pin-input/index.ts");
|
|
20096
|
+
var input_number_1 = __webpack_require__(/*! ./components/input-number */ "./src/components/input-number/index.ts");
|
|
18978
20097
|
var carousel_1 = __webpack_require__(/*! ./components/carousel */ "./src/components/carousel/index.ts");
|
|
18979
20098
|
var dropdown_2 = __webpack_require__(/*! ./components/dropdown */ "./src/components/dropdown/index.ts");
|
|
18980
20099
|
Object.defineProperty(exports, "KTDropdown", ({ enumerable: true, get: function () { return dropdown_2.KTDropdown; } }));
|
|
20100
|
+
var context_menu_2 = __webpack_require__(/*! ./components/context-menu */ "./src/components/context-menu/index.ts");
|
|
20101
|
+
Object.defineProperty(exports, "KTContextMenu", ({ enumerable: true, get: function () { return context_menu_2.KTContextMenu; } }));
|
|
18981
20102
|
var modal_2 = __webpack_require__(/*! ./components/modal */ "./src/components/modal/index.ts");
|
|
18982
20103
|
Object.defineProperty(exports, "KTModal", ({ enumerable: true, get: function () { return modal_2.KTModal; } }));
|
|
18983
20104
|
var drawer_2 = __webpack_require__(/*! ./components/drawer */ "./src/components/drawer/index.ts");
|
|
@@ -19028,11 +20149,14 @@ var range_slider_2 = __webpack_require__(/*! ./components/range-slider */ "./src
|
|
|
19028
20149
|
Object.defineProperty(exports, "KTRangeSlider", ({ enumerable: true, get: function () { return range_slider_2.KTRangeSlider; } }));
|
|
19029
20150
|
var pin_input_2 = __webpack_require__(/*! ./components/pin-input */ "./src/components/pin-input/index.ts");
|
|
19030
20151
|
Object.defineProperty(exports, "KTPinInput", ({ enumerable: true, get: function () { return pin_input_2.KTPinInput; } }));
|
|
20152
|
+
var input_number_2 = __webpack_require__(/*! ./components/input-number */ "./src/components/input-number/index.ts");
|
|
20153
|
+
Object.defineProperty(exports, "KTInputNumber", ({ enumerable: true, get: function () { return input_number_2.KTInputNumber; } }));
|
|
19031
20154
|
var carousel_2 = __webpack_require__(/*! ./components/carousel */ "./src/components/carousel/index.ts");
|
|
19032
20155
|
Object.defineProperty(exports, "KTCarousel", ({ enumerable: true, get: function () { return carousel_2.KTCarousel; } }));
|
|
19033
|
-
|
|
20156
|
+
exports.KTComponents = {
|
|
19034
20157
|
init: function () {
|
|
19035
20158
|
dropdown_1.KTDropdown.init();
|
|
20159
|
+
context_menu_1.KTContextMenu.init();
|
|
19036
20160
|
modal_1.KTModal.init();
|
|
19037
20161
|
drawer_1.KTDrawer.init();
|
|
19038
20162
|
collapse_1.KTCollapse.init();
|
|
@@ -19058,13 +20182,72 @@ var KTComponents = {
|
|
|
19058
20182
|
clipboard_1.KTClipboard.init();
|
|
19059
20183
|
range_slider_1.KTRangeSlider.init();
|
|
19060
20184
|
pin_input_1.KTPinInput.init();
|
|
20185
|
+
input_number_1.KTInputNumber.init();
|
|
19061
20186
|
carousel_1.KTCarousel.init();
|
|
19062
20187
|
},
|
|
19063
20188
|
};
|
|
19064
|
-
exports["default"] = KTComponents;
|
|
19065
|
-
|
|
19066
|
-
|
|
19067
|
-
})
|
|
20189
|
+
exports["default"] = exports.KTComponents;
|
|
20190
|
+
|
|
20191
|
+
|
|
20192
|
+
/***/ }),
|
|
20193
|
+
|
|
20194
|
+
/***/ "./src/init-all.ts":
|
|
20195
|
+
/*!*************************!*\
|
|
20196
|
+
!*** ./src/init-all.ts ***!
|
|
20197
|
+
\*************************/
|
|
20198
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
20199
|
+
|
|
20200
|
+
|
|
20201
|
+
/**
|
|
20202
|
+
* KTUI - Free & Open-Source Tailwind UI Components by Keenthemes
|
|
20203
|
+
* Copyright 2025 by Keenthemes Inc
|
|
20204
|
+
*/
|
|
20205
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
20206
|
+
exports.initAllComponents = void 0;
|
|
20207
|
+
var dom_1 = __webpack_require__(/*! ./helpers/dom */ "./src/helpers/dom.ts");
|
|
20208
|
+
var index_1 = __webpack_require__(/*! ./index */ "./src/index.ts");
|
|
20209
|
+
var initAllComponents = function () {
|
|
20210
|
+
dom_1.default.ready(function () {
|
|
20211
|
+
index_1.KTComponents.init();
|
|
20212
|
+
});
|
|
20213
|
+
};
|
|
20214
|
+
exports.initAllComponents = initAllComponents;
|
|
20215
|
+
(0, exports.initAllComponents)();
|
|
20216
|
+
|
|
20217
|
+
|
|
20218
|
+
/***/ }),
|
|
20219
|
+
|
|
20220
|
+
/***/ "./src/legacy.ts":
|
|
20221
|
+
/*!***********************!*\
|
|
20222
|
+
!*** ./src/legacy.ts ***!
|
|
20223
|
+
\***********************/
|
|
20224
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
20225
|
+
|
|
20226
|
+
|
|
20227
|
+
/**
|
|
20228
|
+
* KTUI - Free & Open-Source Tailwind UI Components by Keenthemes
|
|
20229
|
+
* Copyright 2025 by Keenthemes Inc
|
|
20230
|
+
*/
|
|
20231
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
20232
|
+
if (k2 === undefined) k2 = k;
|
|
20233
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20234
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
20235
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
20236
|
+
}
|
|
20237
|
+
Object.defineProperty(o, k2, desc);
|
|
20238
|
+
}) : (function(o, m, k, k2) {
|
|
20239
|
+
if (k2 === undefined) k2 = k;
|
|
20240
|
+
o[k2] = m[k];
|
|
20241
|
+
}));
|
|
20242
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
20243
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20244
|
+
};
|
|
20245
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
20246
|
+
exports["default"] = void 0;
|
|
20247
|
+
__exportStar(__webpack_require__(/*! ./index */ "./src/index.ts"), exports);
|
|
20248
|
+
var index_1 = __webpack_require__(/*! ./index */ "./src/index.ts");
|
|
20249
|
+
Object.defineProperty(exports, "default", ({ enumerable: true, get: function () { return index_1.default; } }));
|
|
20250
|
+
__webpack_require__(/*! ./init-all */ "./src/init-all.ts");
|
|
19068
20251
|
|
|
19069
20252
|
|
|
19070
20253
|
/***/ })
|
|
@@ -19135,7 +20318,7 @@ dom_1.default.ready(function () {
|
|
|
19135
20318
|
/******/ // startup
|
|
19136
20319
|
/******/ // Load entry module and return exports
|
|
19137
20320
|
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
19138
|
-
/******/ var __webpack_exports__ = __webpack_require__("./src/
|
|
20321
|
+
/******/ var __webpack_exports__ = __webpack_require__("./src/legacy.ts");
|
|
19139
20322
|
/******/
|
|
19140
20323
|
/******/ return __webpack_exports__;
|
|
19141
20324
|
/******/ })()
|