@keenthemes/ktui 1.0.21 → 1.0.23

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.
Files changed (43) hide show
  1. package/dist/ktui.js +23 -12
  2. package/dist/ktui.min.js +1 -1
  3. package/dist/ktui.min.js.map +1 -1
  4. package/dist/styles.css +181 -1
  5. package/examples/datatable/sorting-test.html +398 -0
  6. package/examples/select/modal.html +3 -1
  7. package/examples/select/{remote-data_.html → remote-data.html} +13 -12
  8. package/examples/select/tags-enhanced.html +86 -0
  9. package/examples/select/{tags-icons_.html → tags-icons.html} +1 -2
  10. package/examples/select/template-customization.html +0 -1
  11. package/lib/cjs/components/datatable/datatable.js +4 -0
  12. package/lib/cjs/components/datatable/datatable.js.map +1 -1
  13. package/lib/cjs/components/select/dropdown.js +1 -4
  14. package/lib/cjs/components/select/dropdown.js.map +1 -1
  15. package/lib/cjs/components/select/select.js +8 -2
  16. package/lib/cjs/components/select/select.js.map +1 -1
  17. package/lib/cjs/components/select/tags.js +9 -5
  18. package/lib/cjs/components/select/tags.js.map +1 -1
  19. package/lib/cjs/components/select/templates.js +1 -1
  20. package/lib/cjs/components/select/templates.js.map +1 -1
  21. package/lib/esm/components/datatable/datatable.js +4 -0
  22. package/lib/esm/components/datatable/datatable.js.map +1 -1
  23. package/lib/esm/components/select/dropdown.js +1 -4
  24. package/lib/esm/components/select/dropdown.js.map +1 -1
  25. package/lib/esm/components/select/select.js +8 -2
  26. package/lib/esm/components/select/select.js.map +1 -1
  27. package/lib/esm/components/select/tags.js +9 -5
  28. package/lib/esm/components/select/tags.js.map +1 -1
  29. package/lib/esm/components/select/templates.js +1 -1
  30. package/lib/esm/components/select/templates.js.map +1 -1
  31. package/package.json +1 -1
  32. package/src/components/datatable/datatable.ts +5 -0
  33. package/src/components/select/dropdown.ts +1 -3
  34. package/src/components/select/select.css +44 -0
  35. package/src/components/select/select.ts +10 -2
  36. package/src/components/select/tags.ts +10 -8
  37. package/src/components/select/templates.ts +1 -1
  38. package/examples/select/combobox-icons_.html +0 -59
  39. package/examples/select/combobox_.html +0 -46
  40. package/examples/select/tags-selected_.html +0 -59
  41. package/examples/select/tags_.html +0 -58
  42. package/examples/select/test-optimizations.html +0 -227
  43. package/examples/select/test-remote-search.html +0 -151
package/dist/ktui.js CHANGED
@@ -8126,6 +8126,10 @@ var KTDataTable = /** @class */ (function (_super) {
8126
8126
  this._element.classList.add('datatable-initialized');
8127
8127
  // Initialize checkbox logic
8128
8128
  this._checkbox.init();
8129
+ // Re-initialize sort handler to restore click listeners after table redraw
8130
+ if (this._sortHandler) {
8131
+ this._sortHandler.initSort();
8132
+ }
8129
8133
  this._attachSearchEvent();
8130
8134
  if (typeof index_1.default !== 'undefined') {
8131
8135
  index_1.default.init();
@@ -9849,16 +9853,13 @@ var KTSelectDropdown = /** @class */ (function (_super) {
9849
9853
  };
9850
9854
  KTSelectDropdown.prototype._resolveDropdownContainer = function () {
9851
9855
  var containerSelector = this._config.dropdownContainer;
9852
- if (containerSelector && containerSelector !== 'body') {
9856
+ if (containerSelector) {
9853
9857
  var containerElement = document.querySelector(containerSelector);
9854
9858
  if (!containerElement && this._config.debug) {
9855
9859
  console.warn("KTSelectDropdown: dropdownContainer selector \"".concat(containerSelector, "\" not found. Dropdown will remain in its default position."));
9856
9860
  }
9857
9861
  return containerElement;
9858
9862
  }
9859
- else if (containerSelector === 'body') {
9860
- return document.body;
9861
- }
9862
9863
  return null;
9863
9864
  };
9864
9865
  return KTSelectDropdown;
@@ -12491,8 +12492,10 @@ var KTSelect = /** @class */ (function (_super) {
12491
12492
  // Options are selected.
12492
12493
  if (tagsEnabled) {
12493
12494
  // Tags are enabled AND options are selected: tags module has rendered them.
12494
- // Clear valueDisplayEl as tags are the primary display.
12495
- valueDisplayEl.innerHTML = '';
12495
+ // Completely clear all content to avoid redundancy with tags
12496
+ // Don't touch the innerHTML here as tags module manages it
12497
+ // Just ensure no text content is generated
12498
+ return; // Exit early to prevent any text generation
12496
12499
  }
12497
12500
  else {
12498
12501
  // Tags are not enabled AND options are selected: render normal text display.
@@ -12561,6 +12564,10 @@ var KTSelect = /** @class */ (function (_super) {
12561
12564
  KTSelect.prototype.clearSelection = function () {
12562
12565
  // Clear the current selection
12563
12566
  this._state.setSelectedOptions([]);
12567
+ // Clear all native select options
12568
+ Array.from(this._element.querySelectorAll('option')).forEach(function (opt) {
12569
+ opt.selected = false;
12570
+ });
12564
12571
  this.updateSelectedOptionDisplay();
12565
12572
  this._updateSelectedOptionClass();
12566
12573
  // Update select all button state
@@ -15218,12 +15225,16 @@ var KTSelectTags = /** @class */ (function () {
15218
15225
  var wrapper = this._valueDisplayElement.parentElement;
15219
15226
  if (!wrapper)
15220
15227
  return;
15221
- // Remove all previous tags
15222
- Array.from(wrapper.querySelectorAll('[data-kt-select-tag]')).forEach(function (tag) { return tag.remove(); });
15223
- // If no options selected, do nothing (let display show placeholder)
15228
+ // If no options selected, ensure placeholder is shown
15224
15229
  if (selectedOptions.length === 0) {
15230
+ // Clear any existing content and show placeholder
15231
+ this._valueDisplayElement.innerHTML = '';
15232
+ var placeholderEl = templates_1.defaultTemplates.placeholder(this._config);
15233
+ this._valueDisplayElement.appendChild(placeholderEl);
15225
15234
  return;
15226
15235
  }
15236
+ // Clear all existing content before adding tags
15237
+ this._valueDisplayElement.innerHTML = '';
15227
15238
  // Insert each tag before the display element
15228
15239
  selectedOptions.forEach(function (optionValue) {
15229
15240
  // Find the original option element (in dropdown or select)
@@ -15257,8 +15268,8 @@ var KTSelectTags = /** @class */ (function () {
15257
15268
  _this._removeTag(optionValue);
15258
15269
  });
15259
15270
  }
15260
- // Insert tag before the display element
15261
- wrapper.insertBefore(tag, _this._valueDisplayElement);
15271
+ // Insert tag inside the display element
15272
+ _this._valueDisplayElement.appendChild(tag);
15262
15273
  });
15263
15274
  };
15264
15275
  /**
@@ -16899,7 +16910,7 @@ exports.defaultTemplates = {
16899
16910
  tag: function (option, config) {
16900
16911
  var _a;
16901
16912
  var template = getTemplateStrings(config).tag;
16902
- var preparedContent = option.title; // Default content is the option's title
16913
+ var preparedContent = option.textContent || option.innerText || option.value || ''; // Default content is the option's text
16903
16914
  if (config.tagTemplate) {
16904
16915
  var tagTemplateString_1 = config.tagTemplate;
16905
16916
  var optionValue = option.getAttribute('data-value') || option.value;