@keenthemes/ktui 1.2.4 → 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 +590 -131
- package/dist/ktui.min.js +1 -1
- package/dist/ktui.min.js.map +1 -1
- package/dist/styles.css +76 -40
- 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 +3 -3
- package/lib/cjs/components/datatable/datatable-contracts.d.ts.map +1 -1
- package/lib/cjs/components/datatable/datatable-local-provider.d.ts.map +1 -1
- package/lib/cjs/components/datatable/datatable-local-provider.js +13 -7
- package/lib/cjs/components/datatable/datatable-local-provider.js.map +1 -1
- package/lib/cjs/components/datatable/datatable-pagination-renderer.d.ts.map +1 -1
- package/lib/cjs/components/datatable/datatable-pagination-renderer.js +31 -15
- package/lib/cjs/components/datatable/datatable-pagination-renderer.js.map +1 -1
- package/lib/cjs/components/datatable/datatable-remote-provider.d.ts.map +1 -1
- package/lib/cjs/components/datatable/datatable-remote-provider.js +3 -0
- package/lib/cjs/components/datatable/datatable-remote-provider.js.map +1 -1
- package/lib/cjs/components/datatable/datatable-table-renderer.d.ts.map +1 -1
- package/lib/cjs/components/datatable/datatable-table-renderer.js +14 -6
- package/lib/cjs/components/datatable/datatable-table-renderer.js.map +1 -1
- package/lib/cjs/components/datatable/datatable.d.ts.map +1 -1
- package/lib/cjs/components/datatable/datatable.js +120 -54
- 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/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 +4 -0
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/index.js +5 -1
- package/lib/cjs/index.js.map +1 -1
- 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 +3 -3
- package/lib/esm/components/datatable/datatable-contracts.d.ts.map +1 -1
- package/lib/esm/components/datatable/datatable-local-provider.d.ts.map +1 -1
- package/lib/esm/components/datatable/datatable-local-provider.js +13 -7
- package/lib/esm/components/datatable/datatable-local-provider.js.map +1 -1
- package/lib/esm/components/datatable/datatable-pagination-renderer.d.ts.map +1 -1
- package/lib/esm/components/datatable/datatable-pagination-renderer.js +31 -15
- package/lib/esm/components/datatable/datatable-pagination-renderer.js.map +1 -1
- package/lib/esm/components/datatable/datatable-remote-provider.d.ts.map +1 -1
- package/lib/esm/components/datatable/datatable-remote-provider.js +3 -0
- package/lib/esm/components/datatable/datatable-remote-provider.js.map +1 -1
- package/lib/esm/components/datatable/datatable-table-renderer.d.ts.map +1 -1
- package/lib/esm/components/datatable/datatable-table-renderer.js +14 -6
- package/lib/esm/components/datatable/datatable-table-renderer.js.map +1 -1
- package/lib/esm/components/datatable/datatable.d.ts.map +1 -1
- package/lib/esm/components/datatable/datatable.js +120 -54
- 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/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 +4 -0
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js +3 -0
- package/lib/esm/index.js.map +1 -1
- package/package.json +5 -11
- package/src/components/datatable/datatable-checkbox.ts +34 -23
- package/src/components/datatable/datatable-contracts.ts +3 -3
- package/src/components/datatable/datatable-local-provider.ts +12 -13
- package/src/components/datatable/datatable-pagination-renderer.ts +34 -20
- package/src/components/datatable/datatable-remote-provider.ts +3 -0
- package/src/components/datatable/datatable-table-renderer.ts +40 -32
- package/src/components/datatable/datatable.ts +122 -79
- 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/select.css +23 -20
- package/src/components/select/select.ts +15 -1
- package/src/components/select/tags.ts +14 -1
- package/src/index.ts +9 -0
package/dist/ktui.js
CHANGED
|
@@ -5263,19 +5263,25 @@ function createCheckboxHandler(element, config, fireEvent) {
|
|
|
5263
5263
|
var targetElements = null;
|
|
5264
5264
|
// Default: preserve selection across all pages
|
|
5265
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
|
+
}
|
|
5266
5274
|
// Helper: get selectedRows from state, always as string[]
|
|
5267
5275
|
function getSelectedRows() {
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
return config._state.selectedRows.map(String);
|
|
5276
|
+
var state = ensureState();
|
|
5277
|
+
if (!Array.isArray(state.selectedRows))
|
|
5278
|
+
state.selectedRows = [];
|
|
5279
|
+
return state.selectedRows.map(String);
|
|
5273
5280
|
}
|
|
5274
5281
|
// Helper: set selectedRows in state
|
|
5275
5282
|
function setSelectedRows(rows) {
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
config._state.selectedRows = Array.from(new Set(rows.map(String)));
|
|
5283
|
+
var state = ensureState();
|
|
5284
|
+
state.selectedRows = Array.from(new Set(rows.map(String)));
|
|
5279
5285
|
}
|
|
5280
5286
|
// Helper: get all visible row IDs (values)
|
|
5281
5287
|
function getVisibleRowIds() {
|
|
@@ -5290,22 +5296,31 @@ function createCheckboxHandler(element, config, fireEvent) {
|
|
|
5290
5296
|
checkboxToggle(event);
|
|
5291
5297
|
};
|
|
5292
5298
|
function init() {
|
|
5293
|
-
|
|
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);
|
|
5294
5304
|
if (!headerCheckElement)
|
|
5295
5305
|
return;
|
|
5296
5306
|
headerChecked = headerCheckElement.checked;
|
|
5297
|
-
targetElements = element.querySelectorAll(
|
|
5307
|
+
targetElements = element.querySelectorAll(attrs.checkbox);
|
|
5298
5308
|
checkboxHandler();
|
|
5299
5309
|
reapplyCheckedStates();
|
|
5300
5310
|
updateHeaderCheckboxState();
|
|
5301
5311
|
}
|
|
5302
5312
|
function checkboxHandler() {
|
|
5313
|
+
var _a;
|
|
5303
5314
|
if (!headerCheckElement)
|
|
5304
5315
|
return;
|
|
5316
|
+
var rowCheckboxSelector = (_a = config.attributes) === null || _a === void 0 ? void 0 : _a.checkbox;
|
|
5317
|
+
if (!rowCheckboxSelector)
|
|
5318
|
+
return;
|
|
5305
5319
|
headerCheckElement.addEventListener('click', checkboxListener);
|
|
5306
|
-
event_handler_1.default.on(document.body,
|
|
5307
|
-
|
|
5308
|
-
|
|
5320
|
+
event_handler_1.default.on(document.body, rowCheckboxSelector, 'input', (function (event) {
|
|
5321
|
+
if (event)
|
|
5322
|
+
handleRowCheckboxChange(event);
|
|
5323
|
+
}));
|
|
5309
5324
|
}
|
|
5310
5325
|
// When a row checkbox is changed
|
|
5311
5326
|
function handleRowCheckboxChange(event) {
|
|
@@ -5452,8 +5467,12 @@ function createCheckboxHandler(element, config, fireEvent) {
|
|
|
5452
5467
|
updateHeaderCheckboxState();
|
|
5453
5468
|
}
|
|
5454
5469
|
function updateState() {
|
|
5455
|
-
|
|
5456
|
-
|
|
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);
|
|
5457
5476
|
reapplyCheckedStates();
|
|
5458
5477
|
updateHeaderCheckboxState();
|
|
5459
5478
|
}
|
|
@@ -5578,6 +5597,7 @@ var KTDataTableLocalDataProvider = /** @class */ (function () {
|
|
|
5578
5597
|
});
|
|
5579
5598
|
};
|
|
5580
5599
|
KTDataTableLocalDataProvider.prototype.fetchSync = function () {
|
|
5600
|
+
var _a, _b;
|
|
5581
5601
|
var state = this.options.stateStore.getState();
|
|
5582
5602
|
var originalData = state.originalData;
|
|
5583
5603
|
if (!this.options.elements().tableElement ||
|
|
@@ -5585,22 +5605,26 @@ var KTDataTableLocalDataProvider = /** @class */ (function () {
|
|
|
5585
5605
|
this.tableConfigInvalidate() ||
|
|
5586
5606
|
this.localTableHeaderInvalidate() ||
|
|
5587
5607
|
this.localTableContentInvalidate()) {
|
|
5588
|
-
var
|
|
5608
|
+
var _c = this.localExtractTableContent(), originalData_1 = _c.originalData, originalDataAttributes = _c.originalDataAttributes;
|
|
5589
5609
|
this.options.stateStore.setOriginalData(originalData_1, originalDataAttributes);
|
|
5590
5610
|
}
|
|
5591
5611
|
originalData = this.options.stateStore.getState().originalData;
|
|
5592
5612
|
var data = __spreadArray([], originalData, true);
|
|
5593
5613
|
var filteredData = data;
|
|
5594
|
-
var
|
|
5614
|
+
var _d = this.options.stateStore.getState(), sortField = _d.sortField, sortOrder = _d.sortOrder, page = _d.page, pageSize = _d.pageSize, search = _d.search;
|
|
5595
5615
|
if (search) {
|
|
5596
5616
|
var searchTerm = typeof search === 'string' ? search : '';
|
|
5597
|
-
|
|
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
|
+
}
|
|
5598
5621
|
}
|
|
5622
|
+
var sortCallback = (_b = this.options.config.sort) === null || _b === void 0 ? void 0 : _b.callback;
|
|
5599
5623
|
if (sortField !== undefined &&
|
|
5600
5624
|
sortOrder !== undefined &&
|
|
5601
5625
|
sortOrder !== '' &&
|
|
5602
|
-
typeof
|
|
5603
|
-
data =
|
|
5626
|
+
typeof sortCallback === 'function') {
|
|
5627
|
+
data = sortCallback.call(this, data, sortField, sortOrder);
|
|
5604
5628
|
}
|
|
5605
5629
|
if ((data === null || data === void 0 ? void 0 : data.length) > 0) {
|
|
5606
5630
|
var startIndex = (page - 1) * pageSize;
|
|
@@ -5622,9 +5646,10 @@ var KTDataTableLocalDataProvider = /** @class */ (function () {
|
|
|
5622
5646
|
return false;
|
|
5623
5647
|
};
|
|
5624
5648
|
KTDataTableLocalDataProvider.prototype.tableConfigInvalidate = function () {
|
|
5625
|
-
var _a
|
|
5649
|
+
var _a;
|
|
5650
|
+
var _b = this.options.config, _state = _b._state, restConfig = __rest(_b, ["_state"]);
|
|
5626
5651
|
var checksum = utils_1.default.checksum(JSON.stringify(restConfig));
|
|
5627
|
-
if (_state._configChecksum !== checksum) {
|
|
5652
|
+
if (((_a = _state === null || _state === void 0 ? void 0 : _state._configChecksum) !== null && _a !== void 0 ? _a : '') !== checksum) {
|
|
5628
5653
|
this.options.stateStore.patchState({ _configChecksum: checksum });
|
|
5629
5654
|
return true;
|
|
5630
5655
|
}
|
|
@@ -5707,15 +5732,21 @@ var KTDataTableDomPaginationRenderer = /** @class */ (function () {
|
|
|
5707
5732
|
}
|
|
5708
5733
|
KTDataTableDomPaginationRenderer.prototype.render = function (input) {
|
|
5709
5734
|
var _this = this;
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
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
|
+
}
|
|
5714
5743
|
return function () {
|
|
5715
5744
|
if (input.sizeElement) {
|
|
5716
5745
|
input.sizeElement.onchange = null;
|
|
5717
5746
|
}
|
|
5718
|
-
|
|
5747
|
+
if (input.paginationElement) {
|
|
5748
|
+
_this.removeChildElements(input.paginationElement);
|
|
5749
|
+
}
|
|
5719
5750
|
};
|
|
5720
5751
|
};
|
|
5721
5752
|
KTDataTableDomPaginationRenderer.prototype.removeChildElements = function (container) {
|
|
@@ -5727,12 +5758,14 @@ var KTDataTableDomPaginationRenderer = /** @class */ (function () {
|
|
|
5727
5758
|
}
|
|
5728
5759
|
};
|
|
5729
5760
|
KTDataTableDomPaginationRenderer.prototype.createPageSizeControls = function (input) {
|
|
5761
|
+
var _a;
|
|
5730
5762
|
if (!input.sizeElement) {
|
|
5731
|
-
return
|
|
5763
|
+
return;
|
|
5732
5764
|
}
|
|
5765
|
+
var pageSizes = (_a = input.config.pageSizes) !== null && _a !== void 0 ? _a : [5, 10, 20, 30, 50];
|
|
5733
5766
|
setTimeout(function () {
|
|
5734
5767
|
var _a;
|
|
5735
|
-
var options =
|
|
5768
|
+
var options = pageSizes.map(function (size) {
|
|
5736
5769
|
var option = document.createElement('option');
|
|
5737
5770
|
option.value = String(size);
|
|
5738
5771
|
option.text = String(size);
|
|
@@ -5744,12 +5777,9 @@ var KTDataTableDomPaginationRenderer = /** @class */ (function () {
|
|
|
5744
5777
|
input.sizeElement.onchange = function (event) {
|
|
5745
5778
|
input.reloadPageSize(Number(event.target.value), 1);
|
|
5746
5779
|
};
|
|
5747
|
-
return input.sizeElement;
|
|
5748
5780
|
};
|
|
5749
5781
|
KTDataTableDomPaginationRenderer.prototype.createPaginationControls = function (input) {
|
|
5750
|
-
if (!input.
|
|
5751
|
-
!input.paginationElement ||
|
|
5752
|
-
input.dataLength === 0) {
|
|
5782
|
+
if (!input.paginationElement || input.dataLength === 0) {
|
|
5753
5783
|
return null;
|
|
5754
5784
|
}
|
|
5755
5785
|
this.setPaginationInfoText(input);
|
|
@@ -5757,14 +5787,25 @@ var KTDataTableDomPaginationRenderer = /** @class */ (function () {
|
|
|
5757
5787
|
return input.paginationElement;
|
|
5758
5788
|
};
|
|
5759
5789
|
KTDataTableDomPaginationRenderer.prototype.setPaginationInfoText = function (input) {
|
|
5760
|
-
|
|
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
|
|
5761
5796
|
.replace('{start}', (input.state.page - 1) * input.state.pageSize + 1 + '')
|
|
5762
5797
|
.replace('{end}', Math.min(input.state.page * input.state.pageSize, input.state.totalItems) + '')
|
|
5763
5798
|
.replace('{total}', input.state.totalItems + '');
|
|
5764
5799
|
};
|
|
5765
5800
|
KTDataTableDomPaginationRenderer.prototype.createPaginationButtons = function (paginationContainer, input) {
|
|
5766
|
-
var _a
|
|
5767
|
-
var
|
|
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;
|
|
5768
5809
|
var createButton = function (text, className, disabled, handleClick) {
|
|
5769
5810
|
var button = document.createElement('button');
|
|
5770
5811
|
button.className = className;
|
|
@@ -5775,7 +5816,7 @@ var KTDataTableDomPaginationRenderer = /** @class */ (function () {
|
|
|
5775
5816
|
};
|
|
5776
5817
|
paginationContainer.appendChild(createButton(previous.text, "".concat(previous.class).concat(currentPage === 1 ? ' disabled' : ''), currentPage === 1, function () { return input.paginateData(currentPage - 1); }));
|
|
5777
5818
|
if (input.config.pageMore) {
|
|
5778
|
-
var range_1 = this.calculatePageRange(currentPage, totalPages,
|
|
5819
|
+
var range_1 = this.calculatePageRange(currentPage, totalPages, pageMoreLimit);
|
|
5779
5820
|
if (range_1.start > 1) {
|
|
5780
5821
|
paginationContainer.appendChild(createButton(more.text, more.class, false, function () {
|
|
5781
5822
|
return input.paginateData(Math.max(1, range_1.start - 1));
|
|
@@ -5991,6 +6032,9 @@ var KTDataTableRemoteDataProvider = /** @class */ (function () {
|
|
|
5991
6032
|
requestMethod = this.options.config.requestMethod;
|
|
5992
6033
|
requestBody = undefined;
|
|
5993
6034
|
apiEndpoint = this.options.config.apiEndpoint;
|
|
6035
|
+
if (!apiEndpoint) {
|
|
6036
|
+
throw new Error('KTDataTable: apiEndpoint is required for remote fetch');
|
|
6037
|
+
}
|
|
5994
6038
|
if (this.abortController) {
|
|
5995
6039
|
this.abortController.abort();
|
|
5996
6040
|
}
|
|
@@ -6378,18 +6422,26 @@ var KTDataTableDomTableRenderer = /** @class */ (function () {
|
|
|
6378
6422
|
}
|
|
6379
6423
|
td.innerHTML = value;
|
|
6380
6424
|
this.applyOriginalTdClass(input, td, rowIndex, colIndex);
|
|
6381
|
-
this.applyDataRowAttributes(td, dataRowAttributes, colIndex);
|
|
6425
|
+
this.applyDataRowAttributes(td, dataRowAttributes !== null && dataRowAttributes !== void 0 ? dataRowAttributes : null, colIndex);
|
|
6382
6426
|
row.appendChild(td);
|
|
6383
6427
|
}
|
|
6384
6428
|
};
|
|
6385
6429
|
KTDataTableDomTableRenderer.prototype.renderConfiguredColumns = function (input, row, item, rowIndex) {
|
|
6386
6430
|
var _this = this;
|
|
6387
|
-
|
|
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;
|
|
6388
6441
|
var td = document.createElement('td');
|
|
6389
|
-
var columnDef = input.config.columns[key];
|
|
6390
6442
|
_this.applyOriginalTdClass(input, td, rowIndex, colIndex);
|
|
6391
6443
|
if (typeof columnDef.render === 'function') {
|
|
6392
|
-
var result = columnDef.render.call(input.context, item[
|
|
6444
|
+
var result = columnDef.render.call(input.context, item[colKey], item, input.context);
|
|
6393
6445
|
if (result instanceof HTMLElement ||
|
|
6394
6446
|
result instanceof DocumentFragment) {
|
|
6395
6447
|
td.appendChild(result);
|
|
@@ -6399,10 +6451,10 @@ var KTDataTableDomTableRenderer = /** @class */ (function () {
|
|
|
6399
6451
|
}
|
|
6400
6452
|
}
|
|
6401
6453
|
else {
|
|
6402
|
-
td.textContent = item[
|
|
6454
|
+
td.textContent = item[colKey];
|
|
6403
6455
|
}
|
|
6404
6456
|
if (typeof columnDef.createdCell === 'function') {
|
|
6405
|
-
columnDef.createdCell.call(input.context, td, item[
|
|
6457
|
+
columnDef.createdCell.call(input.context, td, item[colKey], item, row);
|
|
6406
6458
|
}
|
|
6407
6459
|
row.appendChild(td);
|
|
6408
6460
|
});
|
|
@@ -6534,6 +6586,9 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
6534
6586
|
_this._originalTheadClass = ''; // Store original thead class
|
|
6535
6587
|
_this._originalTdClasses = []; // Store original td classes as a 2D array [row][col]
|
|
6536
6588
|
_this._originalThClasses = []; // Store original th classes
|
|
6589
|
+
_this._infoElement = null;
|
|
6590
|
+
_this._sizeElement = null;
|
|
6591
|
+
_this._paginationElement = null;
|
|
6537
6592
|
_this._cleanupCallbacks = [];
|
|
6538
6593
|
_this._data = [];
|
|
6539
6594
|
_this._isFetching = false;
|
|
@@ -6547,6 +6602,9 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
6547
6602
|
}
|
|
6548
6603
|
_this._defaultConfig = _this._initDefaultConfig(config);
|
|
6549
6604
|
_this._init(element);
|
|
6605
|
+
if (!_this._element) {
|
|
6606
|
+
return _this;
|
|
6607
|
+
}
|
|
6550
6608
|
_this._buildConfig();
|
|
6551
6609
|
_this._stateStore = new datatable_state_store_1.KTDataTableConfigStateStore(_this._config);
|
|
6552
6610
|
_this._eventAdapter = (0, datatable_event_adapter_1.createDataTableEventAdapter)(_this._fireEvent.bind(_this), _this._dispatchEvent.bind(_this));
|
|
@@ -6812,33 +6870,31 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
6812
6870
|
* @returns {void}
|
|
6813
6871
|
*/
|
|
6814
6872
|
KTDataTable.prototype._initElements = function () {
|
|
6815
|
-
|
|
6816
|
-
|
|
6817
|
-
|
|
6818
|
-
|
|
6819
|
-
|
|
6820
|
-
|
|
6821
|
-
|
|
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;
|
|
6822
6884
|
this._tbodyElement =
|
|
6823
6885
|
this._tableElement.tBodies[0] || this._tableElement.createTBody();
|
|
6824
|
-
|
|
6825
|
-
|
|
6826
|
-
*/
|
|
6827
|
-
this._theadElement = this._tableElement.tHead;
|
|
6828
|
-
// Store original classes
|
|
6886
|
+
this._theadElement =
|
|
6887
|
+
(_a = this._tableElement.tHead) !== null && _a !== void 0 ? _a : this._tableElement.createTHead();
|
|
6829
6888
|
this._storeOriginalClasses();
|
|
6830
|
-
|
|
6831
|
-
|
|
6832
|
-
|
|
6833
|
-
this.
|
|
6834
|
-
|
|
6835
|
-
|
|
6836
|
-
|
|
6837
|
-
|
|
6838
|
-
|
|
6839
|
-
* Pagination element
|
|
6840
|
-
*/
|
|
6841
|
-
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;
|
|
6842
6898
|
};
|
|
6843
6899
|
/**
|
|
6844
6900
|
* Store original classes from table elements
|
|
@@ -6922,7 +6978,8 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
6922
6978
|
* @returns {void}
|
|
6923
6979
|
*/
|
|
6924
6980
|
KTDataTable.prototype._finalize = function () {
|
|
6925
|
-
|
|
6981
|
+
var _a;
|
|
6982
|
+
(_a = this._element) === null || _a === void 0 ? void 0 : _a.classList.add('datatable-initialized');
|
|
6926
6983
|
// Initialize checkbox logic
|
|
6927
6984
|
this._checkbox.init();
|
|
6928
6985
|
// Re-initialize sort handler to restore click listeners after table redraw
|
|
@@ -6944,6 +7001,7 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
6944
7001
|
*/
|
|
6945
7002
|
KTDataTable.prototype._attachSearchEvent = function () {
|
|
6946
7003
|
var _this = this;
|
|
7004
|
+
var _a, _b;
|
|
6947
7005
|
var tableId = this._tableId();
|
|
6948
7006
|
var searchElement = document.querySelector("[data-kt-datatable-search=\"#".concat(tableId, "\"]"));
|
|
6949
7007
|
// Get search state
|
|
@@ -6967,7 +7025,7 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
6967
7025
|
// Create a new debounced search function
|
|
6968
7026
|
var debouncedSearch = this._debounce(function () {
|
|
6969
7027
|
_this.search(searchElement.value);
|
|
6970
|
-
}, this._config.search.delay);
|
|
7028
|
+
}, (_b = (_a = this._config.search) === null || _a === void 0 ? void 0 : _a.delay) !== null && _b !== void 0 ? _b : 500);
|
|
6971
7029
|
// Store the new debounced function as a property of the element
|
|
6972
7030
|
searchWithDebounce._debouncedSearch = debouncedSearch;
|
|
6973
7031
|
// Add the new debounced event listener
|
|
@@ -7007,7 +7065,10 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
7007
7065
|
* @returns {URL} The resulting URL object.
|
|
7008
7066
|
*/
|
|
7009
7067
|
KTDataTable.prototype._createUrl = function (pathOrUrl, baseUrl) {
|
|
7010
|
-
|
|
7068
|
+
var _a;
|
|
7069
|
+
if (baseUrl === void 0) { baseUrl = typeof window !== 'undefined'
|
|
7070
|
+
? window.location.origin
|
|
7071
|
+
: null; }
|
|
7011
7072
|
// Regular expression to check if the input is a full URL
|
|
7012
7073
|
var isFullUrl = /^[a-zA-Z][a-zA-Z\d+\-.]*:\/\//.test(pathOrUrl);
|
|
7013
7074
|
if (isFullUrl) {
|
|
@@ -7017,7 +7078,38 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
7017
7078
|
var normalizedPath = pathOrUrl.startsWith('/')
|
|
7018
7079
|
? pathOrUrl
|
|
7019
7080
|
: "/".concat(pathOrUrl);
|
|
7020
|
-
|
|
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)."));
|
|
7021
7113
|
};
|
|
7022
7114
|
/**
|
|
7023
7115
|
* Update the table and pagination controls with new data
|
|
@@ -7035,7 +7127,7 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
7035
7127
|
if (this._theadElement && this._tbodyElement) {
|
|
7036
7128
|
this._updateTable();
|
|
7037
7129
|
}
|
|
7038
|
-
if (this._infoElement
|
|
7130
|
+
if (this._infoElement || this._sizeElement || this._paginationElement) {
|
|
7039
7131
|
this._updatePagination();
|
|
7040
7132
|
}
|
|
7041
7133
|
this._emit('drew');
|
|
@@ -7118,30 +7210,46 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
7118
7210
|
};
|
|
7119
7211
|
// Method to show the loading spinner
|
|
7120
7212
|
KTDataTable.prototype._showSpinner = function () {
|
|
7121
|
-
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();
|
|
7122
7220
|
if (spinner) {
|
|
7123
7221
|
spinner.style.display = 'block';
|
|
7124
7222
|
}
|
|
7125
|
-
|
|
7223
|
+
root === null || root === void 0 ? void 0 : root.classList.add((_b = this._config.loadingClass) !== null && _b !== void 0 ? _b : 'loading');
|
|
7126
7224
|
};
|
|
7127
7225
|
// Method to hide the loading spinner
|
|
7128
7226
|
KTDataTable.prototype._hideSpinner = function () {
|
|
7129
|
-
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;
|
|
7130
7233
|
if (spinner) {
|
|
7131
7234
|
spinner.style.display = 'none';
|
|
7132
7235
|
}
|
|
7133
|
-
|
|
7236
|
+
root === null || root === void 0 ? void 0 : root.classList.remove((_b = this._config.loadingClass) !== null && _b !== void 0 ? _b : 'loading');
|
|
7134
7237
|
};
|
|
7135
7238
|
// Method to create a spinner element if it doesn't exist
|
|
7136
7239
|
KTDataTable.prototype._createSpinner = function () {
|
|
7137
|
-
|
|
7240
|
+
var loading = this._config.loading;
|
|
7241
|
+
if (!loading) {
|
|
7138
7242
|
return null;
|
|
7139
7243
|
}
|
|
7140
7244
|
var template = document.createElement('template');
|
|
7141
|
-
template.innerHTML =
|
|
7245
|
+
template.innerHTML = loading.template
|
|
7142
7246
|
.trim()
|
|
7143
|
-
.replace('{content}',
|
|
7144
|
-
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;
|
|
7145
7253
|
spinner.setAttribute('data-kt-datatable-spinner', 'true');
|
|
7146
7254
|
this._tableElement.appendChild(spinner);
|
|
7147
7255
|
return spinner;
|
|
@@ -7199,22 +7307,26 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
7199
7307
|
};
|
|
7200
7308
|
KTDataTable.prototype._tableId = function () {
|
|
7201
7309
|
var _a, _b;
|
|
7202
|
-
var
|
|
7203
|
-
|
|
7204
|
-
|
|
7205
|
-
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;
|
|
7206
7313
|
}
|
|
7207
|
-
|
|
7208
|
-
if (
|
|
7209
|
-
|
|
7314
|
+
var rootIdAttr = (_b = this._element) === null || _b === void 0 ? void 0 : _b.getAttribute('id');
|
|
7315
|
+
if (rootIdAttr) {
|
|
7316
|
+
return rootIdAttr;
|
|
7210
7317
|
}
|
|
7211
|
-
return
|
|
7318
|
+
return '';
|
|
7212
7319
|
};
|
|
7213
7320
|
/**
|
|
7214
7321
|
* Clean up all event listeners, handlers, and DOM nodes created by this instance.
|
|
7215
7322
|
* This method is called before re-rendering or when disposing the component.
|
|
7216
7323
|
*/
|
|
7217
7324
|
KTDataTable.prototype._dispose = function () {
|
|
7325
|
+
var _a, _b, _c;
|
|
7326
|
+
var root = this._element;
|
|
7327
|
+
if (!root) {
|
|
7328
|
+
return;
|
|
7329
|
+
}
|
|
7218
7330
|
this._cleanupCallbacks.forEach(function (cleanup) { return cleanup(); });
|
|
7219
7331
|
this._cleanupCallbacks = [];
|
|
7220
7332
|
// --- 1. Remove search input event listener (debounced) ---
|
|
@@ -7245,10 +7357,12 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
7245
7357
|
checkboxWithDispose.dispose();
|
|
7246
7358
|
}
|
|
7247
7359
|
else {
|
|
7248
|
-
|
|
7249
|
-
|
|
7250
|
-
|
|
7251
|
-
|
|
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
|
+
}
|
|
7252
7366
|
}
|
|
7253
7367
|
}
|
|
7254
7368
|
// KTDataTableSortAPI does not have a dispose method, but we can remove th click listeners by replacing them
|
|
@@ -7259,16 +7373,20 @@ var KTDataTable = /** @class */ (function (_super) {
|
|
|
7259
7373
|
});
|
|
7260
7374
|
}
|
|
7261
7375
|
// --- 5. Remove spinner DOM node if it exists ---
|
|
7262
|
-
var
|
|
7263
|
-
if (
|
|
7264
|
-
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
|
+
}
|
|
7265
7382
|
}
|
|
7266
|
-
|
|
7383
|
+
root.classList.remove((_c = this._config.loadingClass) !== null && _c !== void 0 ? _c : 'loading');
|
|
7267
7384
|
// --- 6. Remove instance reference from the DOM element ---
|
|
7268
|
-
var elementWithInstance = KTDataTable.asElementWithInstance(
|
|
7385
|
+
var elementWithInstance = KTDataTable.asElementWithInstance(root);
|
|
7269
7386
|
if (elementWithInstance.instance) {
|
|
7270
7387
|
delete elementWithInstance.instance;
|
|
7271
7388
|
}
|
|
7389
|
+
data_1.default.remove(root, this._name);
|
|
7272
7390
|
// --- 7. (Optional) Clear localStorage state ---
|
|
7273
7391
|
// Uncomment the following line if you want to clear state on dispose:
|
|
7274
7392
|
// this._deleteState();
|
|
@@ -8421,15 +8539,20 @@ var KTDropdown = /** @class */ (function (_super) {
|
|
|
8421
8539
|
return _this;
|
|
8422
8540
|
}
|
|
8423
8541
|
_this._init(element);
|
|
8542
|
+
if (!_this._element) {
|
|
8543
|
+
return _this;
|
|
8544
|
+
}
|
|
8424
8545
|
_this._buildConfig(config);
|
|
8425
|
-
|
|
8426
|
-
if (!
|
|
8546
|
+
var toggle = _this._element.querySelector('[data-kt-dropdown-toggle]');
|
|
8547
|
+
if (!toggle) {
|
|
8427
8548
|
return _this;
|
|
8428
8549
|
}
|
|
8429
|
-
|
|
8430
|
-
if (!
|
|
8550
|
+
var menu = _this._element.querySelector('[data-kt-dropdown-menu]');
|
|
8551
|
+
if (!menu) {
|
|
8431
8552
|
return _this;
|
|
8432
8553
|
}
|
|
8554
|
+
_this._toggleElement = toggle;
|
|
8555
|
+
_this._menuElement = menu;
|
|
8433
8556
|
data_1.default.set(_this._menuElement, 'dropdownElement', _this._element);
|
|
8434
8557
|
_this._setupNestedDropdowns();
|
|
8435
8558
|
_this._handleContainer();
|
|
@@ -8475,10 +8598,13 @@ var KTDropdown = /** @class */ (function (_super) {
|
|
|
8475
8598
|
return;
|
|
8476
8599
|
if (this._getOption('trigger') !== 'hover')
|
|
8477
8600
|
return;
|
|
8478
|
-
|
|
8479
|
-
|
|
8480
|
-
|
|
8481
|
-
|
|
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');
|
|
8482
8608
|
}
|
|
8483
8609
|
this._show();
|
|
8484
8610
|
};
|
|
@@ -8488,17 +8614,20 @@ var KTDropdown = /** @class */ (function (_super) {
|
|
|
8488
8614
|
return;
|
|
8489
8615
|
if (this._getOption('trigger') !== 'hover')
|
|
8490
8616
|
return;
|
|
8617
|
+
var root = this._element;
|
|
8618
|
+
if (!root)
|
|
8619
|
+
return;
|
|
8491
8620
|
var relatedTarget = event.relatedTarget;
|
|
8492
|
-
var isWithinDropdown =
|
|
8621
|
+
var isWithinDropdown = relatedTarget !== null && root.contains(relatedTarget);
|
|
8493
8622
|
if (isWithinDropdown)
|
|
8494
8623
|
return;
|
|
8495
8624
|
var timeout = setTimeout(function () {
|
|
8496
|
-
if (data_1.default.get(
|
|
8625
|
+
if (data_1.default.get(root, 'hover') === '1') {
|
|
8497
8626
|
_this._hide();
|
|
8498
8627
|
}
|
|
8499
8628
|
}, parseInt(this._getOption('hoverTimeout')));
|
|
8500
|
-
data_1.default.set(
|
|
8501
|
-
data_1.default.set(
|
|
8629
|
+
data_1.default.set(root, 'hover', '1');
|
|
8630
|
+
data_1.default.set(root, 'timeout', timeout);
|
|
8502
8631
|
};
|
|
8503
8632
|
KTDropdown.prototype._toggle = function () {
|
|
8504
8633
|
if (this._isOpen) {
|
|
@@ -8518,9 +8647,12 @@ var KTDropdown = /** @class */ (function (_super) {
|
|
|
8518
8647
|
this._dispatchEvent('show', payload);
|
|
8519
8648
|
if (payload.cancel)
|
|
8520
8649
|
return;
|
|
8521
|
-
|
|
8650
|
+
var root = this._element;
|
|
8651
|
+
if (!root)
|
|
8652
|
+
return;
|
|
8653
|
+
KTDropdown.hide(root);
|
|
8522
8654
|
var zIndex = parseInt(this._getOption('zindex'));
|
|
8523
|
-
var parentZindex = dom_1.default.getHighestZindex(
|
|
8655
|
+
var parentZindex = dom_1.default.getHighestZindex(root);
|
|
8524
8656
|
if (parentZindex !== null && parentZindex >= zIndex) {
|
|
8525
8657
|
zIndex = parentZindex + 1;
|
|
8526
8658
|
}
|
|
@@ -8534,7 +8666,7 @@ var KTDropdown = /** @class */ (function (_super) {
|
|
|
8534
8666
|
this._menuElement.classList.remove(this._getOption('hiddenClass'));
|
|
8535
8667
|
this._toggleElement.classList.add('active');
|
|
8536
8668
|
this._menuElement.classList.add('open');
|
|
8537
|
-
|
|
8669
|
+
root.classList.add('open');
|
|
8538
8670
|
this._initPopper();
|
|
8539
8671
|
dom_1.default.transitionEnd(this._menuElement, function () {
|
|
8540
8672
|
_this._isTransitioning = false;
|
|
@@ -8556,12 +8688,15 @@ var KTDropdown = /** @class */ (function (_super) {
|
|
|
8556
8688
|
this._dispatchEvent('hide', payload);
|
|
8557
8689
|
if (payload.cancel)
|
|
8558
8690
|
return;
|
|
8691
|
+
var root = this._element;
|
|
8692
|
+
if (!root)
|
|
8693
|
+
return;
|
|
8559
8694
|
this._menuElement.style.opacity = '1';
|
|
8560
8695
|
dom_1.default.reflow(this._menuElement);
|
|
8561
8696
|
this._menuElement.style.opacity = '0';
|
|
8562
8697
|
this._menuElement.classList.remove('open');
|
|
8563
8698
|
this._toggleElement.classList.remove('active');
|
|
8564
|
-
|
|
8699
|
+
root.classList.remove('open');
|
|
8565
8700
|
dom_1.default.transitionEnd(this._menuElement, function () {
|
|
8566
8701
|
_this._isTransitioning = false;
|
|
8567
8702
|
_this._isOpen = false;
|
|
@@ -8587,17 +8722,26 @@ var KTDropdown = /** @class */ (function (_super) {
|
|
|
8587
8722
|
}
|
|
8588
8723
|
if (reference) {
|
|
8589
8724
|
var popper = (0, core_1.createPopper)(reference, this._menuElement, this._getPopperConfig());
|
|
8590
|
-
|
|
8725
|
+
var root = this._element;
|
|
8726
|
+
if (root) {
|
|
8727
|
+
data_1.default.set(root, 'popper', popper);
|
|
8728
|
+
}
|
|
8591
8729
|
}
|
|
8592
8730
|
};
|
|
8593
8731
|
KTDropdown.prototype._destroyPopper = function () {
|
|
8594
|
-
|
|
8595
|
-
|
|
8596
|
-
|
|
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');
|
|
8597
8738
|
}
|
|
8598
8739
|
};
|
|
8599
8740
|
KTDropdown.prototype._isDropdownOpen = function () {
|
|
8600
|
-
|
|
8741
|
+
var root = this._element;
|
|
8742
|
+
if (!root)
|
|
8743
|
+
return false;
|
|
8744
|
+
return (root.classList.contains('open') &&
|
|
8601
8745
|
this._menuElement.classList.contains('open'));
|
|
8602
8746
|
};
|
|
8603
8747
|
KTDropdown.prototype._getPopperConfig = function () {
|
|
@@ -8702,10 +8846,11 @@ var KTDropdown = /** @class */ (function (_super) {
|
|
|
8702
8846
|
return null;
|
|
8703
8847
|
};
|
|
8704
8848
|
KTDropdown.getInstance = function (element) {
|
|
8705
|
-
|
|
8706
|
-
if (!
|
|
8849
|
+
var resolved = this.getElement(element);
|
|
8850
|
+
if (!resolved) {
|
|
8707
8851
|
return null;
|
|
8708
8852
|
}
|
|
8853
|
+
element = resolved;
|
|
8709
8854
|
if (data_1.default.has(element, 'dropdown')) {
|
|
8710
8855
|
var instance = data_1.default.get(element, 'dropdown');
|
|
8711
8856
|
return instance;
|
|
@@ -8761,6 +8906,8 @@ var KTDropdown = /** @class */ (function (_super) {
|
|
|
8761
8906
|
KTDropdown.handleKeyboard = function () {
|
|
8762
8907
|
document.addEventListener('keydown', function (event) {
|
|
8763
8908
|
var dropdownEl = document.querySelector('.open[data-kt-dropdown-initialized]');
|
|
8909
|
+
if (!dropdownEl)
|
|
8910
|
+
return;
|
|
8764
8911
|
var dropdown = KTDropdown.getInstance(dropdownEl);
|
|
8765
8912
|
if (!dropdown || !dropdown._getOption('keyboard'))
|
|
8766
8913
|
return;
|
|
@@ -8771,36 +8918,44 @@ var KTDropdown = /** @class */ (function (_super) {
|
|
|
8771
8918
|
});
|
|
8772
8919
|
};
|
|
8773
8920
|
KTDropdown.handleMouseover = function () {
|
|
8774
|
-
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;
|
|
8775
8924
|
var dropdown = KTDropdown.getInstance(target);
|
|
8776
8925
|
if (dropdown && dropdown._getOption('trigger') === 'hover') {
|
|
8777
8926
|
dropdown.mouseover(event);
|
|
8778
8927
|
}
|
|
8779
|
-
});
|
|
8928
|
+
}));
|
|
8780
8929
|
};
|
|
8781
8930
|
KTDropdown.handleMouseout = function () {
|
|
8782
|
-
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;
|
|
8783
8934
|
var dropdown = KTDropdown.getInstance(target);
|
|
8784
8935
|
if (dropdown && dropdown._getOption('trigger') === 'hover') {
|
|
8785
8936
|
dropdown.mouseout(event);
|
|
8786
8937
|
}
|
|
8787
|
-
});
|
|
8938
|
+
}));
|
|
8788
8939
|
};
|
|
8789
8940
|
KTDropdown.handleClick = function () {
|
|
8790
|
-
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;
|
|
8791
8944
|
var dropdown = KTDropdown.getInstance(target);
|
|
8792
8945
|
if (dropdown) {
|
|
8793
8946
|
dropdown.click(event);
|
|
8794
8947
|
}
|
|
8795
|
-
});
|
|
8948
|
+
}));
|
|
8796
8949
|
};
|
|
8797
8950
|
KTDropdown.handleDismiss = function () {
|
|
8798
|
-
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;
|
|
8799
8954
|
var dropdown = KTDropdown.getInstance(target);
|
|
8800
8955
|
if (dropdown) {
|
|
8801
8956
|
dropdown.hide();
|
|
8802
8957
|
}
|
|
8803
|
-
});
|
|
8958
|
+
}));
|
|
8804
8959
|
};
|
|
8805
8960
|
KTDropdown.initHandlers = function () {
|
|
8806
8961
|
this.handleClickAway();
|
|
@@ -9112,6 +9267,282 @@ var image_input_1 = __webpack_require__(/*! ./image-input */ "./src/components/i
|
|
|
9112
9267
|
Object.defineProperty(exports, "KTImageInput", ({ enumerable: true, get: function () { return image_input_1.KTImageInput; } }));
|
|
9113
9268
|
|
|
9114
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
|
+
|
|
9115
9546
|
/***/ }),
|
|
9116
9547
|
|
|
9117
9548
|
/***/ "./src/components/modal/index.ts":
|
|
@@ -11803,7 +12234,8 @@ exports.DefaultConfig = {
|
|
|
11803
12234
|
selectAllText: 'Select all', // Text for the "Select All" option (if implemented)
|
|
11804
12235
|
clearAllText: 'Clear all', // Text for the "Clear All" option (if implemented)
|
|
11805
12236
|
enableSelectAll: false, // Enable/disable "Select All" button for multi-select
|
|
11806
|
-
showSelectedCount:
|
|
12237
|
+
showSelectedCount: false, // Tags mode: show "N selected" before chips when true
|
|
12238
|
+
selectedCountText: '{{count}} selected', // Tags mode; use {{count}} placeholder
|
|
11807
12239
|
renderSelected: undefined, // Custom function to render the selected value(s) in the display area
|
|
11808
12240
|
// Accessibility & Usability
|
|
11809
12241
|
label: 'Select an option', // Label for the select component (for screen readers)
|
|
@@ -14630,11 +15062,24 @@ var KTSelect = /** @class */ (function (_super) {
|
|
|
14630
15062
|
return this._searchInputElement;
|
|
14631
15063
|
};
|
|
14632
15064
|
/**
|
|
14633
|
-
*
|
|
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.
|
|
14634
15068
|
*/
|
|
14635
15069
|
KTSelect.prototype.getSelectedOptions = function () {
|
|
14636
15070
|
return this._state.getSelectedOptions();
|
|
14637
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
|
+
};
|
|
14638
15083
|
/**
|
|
14639
15084
|
* Get configuration
|
|
14640
15085
|
*/
|
|
@@ -15656,6 +16101,7 @@ var KTSelectTags = /** @class */ (function () {
|
|
|
15656
16101
|
*/
|
|
15657
16102
|
KTSelectTags.prototype.updateTagsDisplay = function (selectedOptions) {
|
|
15658
16103
|
var _this = this;
|
|
16104
|
+
var _a;
|
|
15659
16105
|
if (!this._valueDisplayElement)
|
|
15660
16106
|
return;
|
|
15661
16107
|
var valueDisplayElement = this._valueDisplayElement;
|
|
@@ -15673,6 +16119,15 @@ var KTSelectTags = /** @class */ (function () {
|
|
|
15673
16119
|
}
|
|
15674
16120
|
// Clear all existing content before adding tags
|
|
15675
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
|
+
}
|
|
15676
16131
|
// Insert each tag before the display element
|
|
15677
16132
|
selectedOptions.forEach(function (optionValue) {
|
|
15678
16133
|
var _a;
|
|
@@ -19610,7 +20065,7 @@ exports["default"] = KTUtils;
|
|
|
19610
20065
|
* Copyright 2025 by Keenthemes Inc
|
|
19611
20066
|
*/
|
|
19612
20067
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
19613
|
-
exports.KTComponents = 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.KTContextMenu = exports.KTDropdown = void 0;
|
|
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;
|
|
19614
20069
|
var dropdown_1 = __webpack_require__(/*! ./components/dropdown */ "./src/components/dropdown/index.ts");
|
|
19615
20070
|
var context_menu_1 = __webpack_require__(/*! ./components/context-menu */ "./src/components/context-menu/index.ts");
|
|
19616
20071
|
var modal_1 = __webpack_require__(/*! ./components/modal */ "./src/components/modal/index.ts");
|
|
@@ -19638,6 +20093,7 @@ var repeater_1 = __webpack_require__(/*! ./components/repeater */ "./src/compone
|
|
|
19638
20093
|
var clipboard_1 = __webpack_require__(/*! ./components/clipboard */ "./src/components/clipboard/index.ts");
|
|
19639
20094
|
var range_slider_1 = __webpack_require__(/*! ./components/range-slider */ "./src/components/range-slider/index.ts");
|
|
19640
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");
|
|
19641
20097
|
var carousel_1 = __webpack_require__(/*! ./components/carousel */ "./src/components/carousel/index.ts");
|
|
19642
20098
|
var dropdown_2 = __webpack_require__(/*! ./components/dropdown */ "./src/components/dropdown/index.ts");
|
|
19643
20099
|
Object.defineProperty(exports, "KTDropdown", ({ enumerable: true, get: function () { return dropdown_2.KTDropdown; } }));
|
|
@@ -19693,6 +20149,8 @@ var range_slider_2 = __webpack_require__(/*! ./components/range-slider */ "./src
|
|
|
19693
20149
|
Object.defineProperty(exports, "KTRangeSlider", ({ enumerable: true, get: function () { return range_slider_2.KTRangeSlider; } }));
|
|
19694
20150
|
var pin_input_2 = __webpack_require__(/*! ./components/pin-input */ "./src/components/pin-input/index.ts");
|
|
19695
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; } }));
|
|
19696
20154
|
var carousel_2 = __webpack_require__(/*! ./components/carousel */ "./src/components/carousel/index.ts");
|
|
19697
20155
|
Object.defineProperty(exports, "KTCarousel", ({ enumerable: true, get: function () { return carousel_2.KTCarousel; } }));
|
|
19698
20156
|
exports.KTComponents = {
|
|
@@ -19724,6 +20182,7 @@ exports.KTComponents = {
|
|
|
19724
20182
|
clipboard_1.KTClipboard.init();
|
|
19725
20183
|
range_slider_1.KTRangeSlider.init();
|
|
19726
20184
|
pin_input_1.KTPinInput.init();
|
|
20185
|
+
input_number_1.KTInputNumber.init();
|
|
19727
20186
|
carousel_1.KTCarousel.init();
|
|
19728
20187
|
},
|
|
19729
20188
|
};
|