@keenthemes/ktui 1.0.25 → 1.0.27
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 +335 -36
- package/dist/ktui.min.js +1 -1
- package/dist/ktui.min.js.map +1 -1
- package/dist/styles.css +216 -13
- package/examples/datatable/checkbox-events-test.html +400 -0
- package/examples/datatable/credentials-test.html +423 -0
- package/examples/datatable/remote-checkbox-test.html +365 -0
- package/examples/modal/persistent.html +205 -0
- package/examples/modal/remote-select-dropdown.html +166 -0
- package/examples/modal/select-dropdown-container.html +129 -0
- package/examples/select/formdata-remote.html +161 -0
- package/examples/select/modal-positioning-test.html +338 -0
- package/lib/cjs/components/datatable/datatable-checkbox.js +16 -3
- package/lib/cjs/components/datatable/datatable-checkbox.js.map +1 -1
- package/lib/cjs/components/datatable/datatable.js +3 -5
- package/lib/cjs/components/datatable/datatable.js.map +1 -1
- package/lib/cjs/components/image-input/image-input.js.map +1 -1
- package/lib/cjs/components/modal/modal.js +16 -2
- package/lib/cjs/components/modal/modal.js.map +1 -1
- package/lib/cjs/components/select/config.js +5 -0
- package/lib/cjs/components/select/config.js.map +1 -1
- package/lib/cjs/components/select/dropdown.js +54 -3
- package/lib/cjs/components/select/dropdown.js.map +1 -1
- package/lib/cjs/components/select/select.js +241 -23
- package/lib/cjs/components/select/select.js.map +1 -1
- package/lib/cjs/components/select/templates.js.map +1 -1
- package/lib/esm/components/datatable/datatable-checkbox.js +16 -3
- package/lib/esm/components/datatable/datatable-checkbox.js.map +1 -1
- package/lib/esm/components/datatable/datatable.js +3 -5
- package/lib/esm/components/datatable/datatable.js.map +1 -1
- package/lib/esm/components/image-input/image-input.js.map +1 -1
- package/lib/esm/components/modal/modal.js +16 -2
- package/lib/esm/components/modal/modal.js.map +1 -1
- package/lib/esm/components/select/config.js +5 -0
- package/lib/esm/components/select/config.js.map +1 -1
- package/lib/esm/components/select/dropdown.js +54 -3
- package/lib/esm/components/select/dropdown.js.map +1 -1
- package/lib/esm/components/select/select.js +241 -23
- package/lib/esm/components/select/select.js.map +1 -1
- package/lib/esm/components/select/templates.js.map +1 -1
- package/package.json +1 -1
- package/src/components/datatable/datatable-checkbox.ts +18 -3
- package/src/components/datatable/datatable.ts +3 -0
- package/src/components/datatable/types.ts +1 -0
- package/src/components/image-input/image-input.ts +12 -15
- package/src/components/modal/modal.ts +20 -2
- package/src/components/select/config.ts +6 -0
- package/src/components/select/dropdown.ts +69 -4
- package/src/components/select/select.ts +306 -36
- package/src/components/select/templates.ts +2 -1
- package/lib/cjs/components/config.js +0 -26
- package/lib/cjs/components/config.js.map +0 -1
- package/lib/cjs/components/config.umd.js +0 -23
- package/lib/cjs/components/config.umd.js.map +0 -1
- package/lib/cjs/components/menu/index.js +0 -6
- package/lib/cjs/components/menu/index.js.map +0 -1
- package/lib/cjs/components/menu/menu.js +0 -1021
- package/lib/cjs/components/menu/menu.js.map +0 -1
- package/lib/cjs/components/menu/types.js +0 -3
- package/lib/cjs/components/menu/types.js.map +0 -1
- package/lib/cjs/components/theme/index.js +0 -6
- package/lib/cjs/components/theme/index.js.map +0 -1
- package/lib/cjs/components/theme/theme.js +0 -147
- package/lib/cjs/components/theme/theme.js.map +0 -1
- package/lib/cjs/components/theme/types.js +0 -3
- package/lib/cjs/components/theme/types.js.map +0 -1
- package/lib/esm/components/config.js +0 -24
- package/lib/esm/components/config.js.map +0 -1
- package/lib/esm/components/config.umd.js +0 -23
- package/lib/esm/components/config.umd.js.map +0 -1
- package/lib/esm/components/menu/index.js +0 -2
- package/lib/esm/components/menu/index.js.map +0 -1
- package/lib/esm/components/menu/menu.js +0 -1018
- package/lib/esm/components/menu/menu.js.map +0 -1
- package/lib/esm/components/menu/types.js +0 -2
- package/lib/esm/components/menu/types.js.map +0 -1
- package/lib/esm/components/theme/index.js +0 -2
- package/lib/esm/components/theme/index.js.map +0 -1
- package/lib/esm/components/theme/theme.js +0 -144
- package/lib/esm/components/theme/theme.js.map +0 -1
- package/lib/esm/components/theme/types.js +0 -2
- package/lib/esm/components/theme/types.js.map +0 -1
- /package/examples/select/{dark-mode-test.html → dark-mode.html} +0 -0
- /package/examples/select/{dropdowncontainer-test.html → dropdowncontainer.html} +0 -0
- /package/examples/select/{global-config-test.html → global-config.html} +0 -0
|
@@ -311,6 +311,15 @@ export class KTSelect extends KTComponent {
|
|
|
311
311
|
// Initialize options
|
|
312
312
|
this._preSelectOptions(this._element);
|
|
313
313
|
|
|
314
|
+
// Prevent browser auto-selection when placeholder is configured
|
|
315
|
+
if (
|
|
316
|
+
this._config.placeholder &&
|
|
317
|
+
this._state.getSelectedOptions().length === 0 &&
|
|
318
|
+
this._preSelectedValues.length === 0
|
|
319
|
+
) {
|
|
320
|
+
(this._element as HTMLSelectElement).value = '';
|
|
321
|
+
}
|
|
322
|
+
|
|
314
323
|
// Apply pre-selected values captured before remote data was loaded
|
|
315
324
|
if (this._preSelectedValues.length > 0) {
|
|
316
325
|
if (this._config.debug) {
|
|
@@ -638,6 +647,14 @@ export class KTSelect extends KTComponent {
|
|
|
638
647
|
// Initialize options
|
|
639
648
|
this._preSelectOptions(this._element);
|
|
640
649
|
|
|
650
|
+
// Prevent browser auto-selection when placeholder is configured
|
|
651
|
+
if (
|
|
652
|
+
this._config.placeholder &&
|
|
653
|
+
this._state.getSelectedOptions().length === 0
|
|
654
|
+
) {
|
|
655
|
+
(this._element as HTMLSelectElement).value = '';
|
|
656
|
+
}
|
|
657
|
+
|
|
641
658
|
// Apply disabled state if needed
|
|
642
659
|
this._applyInitialDisabledState();
|
|
643
660
|
|
|
@@ -1223,6 +1240,24 @@ export class KTSelect extends KTComponent {
|
|
|
1223
1240
|
});
|
|
1224
1241
|
}
|
|
1225
1242
|
|
|
1243
|
+
/**
|
|
1244
|
+
* Sync native select value attribute for FormData support
|
|
1245
|
+
*/
|
|
1246
|
+
private _syncNativeSelectValue(): void {
|
|
1247
|
+
const selectedOptions = this.getSelectedOptions();
|
|
1248
|
+
|
|
1249
|
+
if (this._config.multiple) {
|
|
1250
|
+
// For multiple select, the selected options are marked via option.selected
|
|
1251
|
+
// The native select's value property will return the first selected option's value
|
|
1252
|
+
// FormData will include all selected values automatically
|
|
1253
|
+
} else {
|
|
1254
|
+
// For single select, set the value attribute explicitly
|
|
1255
|
+
const selectedValue =
|
|
1256
|
+
selectedOptions.length > 0 ? selectedOptions[0] : '';
|
|
1257
|
+
(this._element as HTMLSelectElement).value = selectedValue;
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1226
1261
|
/**
|
|
1227
1262
|
* Update selected option display value
|
|
1228
1263
|
*/
|
|
@@ -1231,6 +1266,9 @@ export class KTSelect extends KTComponent {
|
|
|
1231
1266
|
const tagsEnabled = this._config.tags && this._tagsModule;
|
|
1232
1267
|
const valueDisplayEl = this.getValueDisplayElement();
|
|
1233
1268
|
|
|
1269
|
+
// Sync native select value for FormData support
|
|
1270
|
+
this._syncNativeSelectValue();
|
|
1271
|
+
|
|
1234
1272
|
if (tagsEnabled) {
|
|
1235
1273
|
// Tags module will render tags if selectedOptions > 0, or clear them if selectedOptions === 0.
|
|
1236
1274
|
this._tagsModule.updateTagsDisplay(selectedOptions);
|
|
@@ -1349,6 +1387,9 @@ export class KTSelect extends KTComponent {
|
|
|
1349
1387
|
(opt as HTMLOptionElement).selected = false;
|
|
1350
1388
|
});
|
|
1351
1389
|
|
|
1390
|
+
// Clear native select value
|
|
1391
|
+
(this._element as HTMLSelectElement).value = '';
|
|
1392
|
+
|
|
1352
1393
|
this.updateSelectedOptionDisplay();
|
|
1353
1394
|
this._updateSelectedOptionClass();
|
|
1354
1395
|
|
|
@@ -1805,46 +1846,274 @@ export class KTSelect extends KTComponent {
|
|
|
1805
1846
|
|
|
1806
1847
|
/**
|
|
1807
1848
|
* Update the dropdown to sync with native select element changes
|
|
1808
|
-
*
|
|
1809
|
-
*
|
|
1849
|
+
* For remote selects, refetches data from the server and preserves selections
|
|
1850
|
+
* Optionally accepts new options to replace existing ones (static selects only)
|
|
1851
|
+
*
|
|
1852
|
+
* @param newOptions Optional array of new options [{value, text}, ...] (static selects only)
|
|
1810
1853
|
* @public
|
|
1854
|
+
* @remarks
|
|
1855
|
+
* - For static selects: rebuilds dropdown from native select or new options
|
|
1856
|
+
* - For remote selects: fetches fresh data, preserves matching selections
|
|
1857
|
+
* - Selections are preserved if their values exist in new remote data
|
|
1858
|
+
* - Selections are cleared if their values don't exist in new data
|
|
1859
|
+
* @fires updated - After update completes successfully
|
|
1860
|
+
* @fires updateError - If remote data fetch fails
|
|
1811
1861
|
*/
|
|
1812
1862
|
public update(newOptions?: Array<{ value: string; text: string }>): void {
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
this.
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1863
|
+
// For remote selects, refetch data
|
|
1864
|
+
if (this._config.remote && this._remoteModule) {
|
|
1865
|
+
this._remoteModule
|
|
1866
|
+
.fetchData()
|
|
1867
|
+
.then((items) => {
|
|
1868
|
+
// Capture currently selected values before clearing
|
|
1869
|
+
const currentlySelected = this._state.getSelectedOptions();
|
|
1870
|
+
|
|
1871
|
+
// Clear existing options (also captures to _preSelectedValues)
|
|
1872
|
+
this._clearExistingOptions();
|
|
1873
|
+
|
|
1874
|
+
// Get all available values from new remote data
|
|
1875
|
+
const availableValues = items.map((item) => item.id);
|
|
1876
|
+
|
|
1877
|
+
// Filter to only values that exist in new data
|
|
1878
|
+
const validSelections = currentlySelected.filter((value) =>
|
|
1879
|
+
availableValues.includes(value),
|
|
1880
|
+
);
|
|
1881
|
+
|
|
1882
|
+
if (this._config.debug && currentlySelected.length > 0) {
|
|
1883
|
+
console.log(
|
|
1884
|
+
'update(): Preserving selections that exist in new data:',
|
|
1885
|
+
validSelections,
|
|
1886
|
+
);
|
|
1887
|
+
}
|
|
1888
|
+
|
|
1889
|
+
// Add new options from remote data and restore selection state
|
|
1890
|
+
items.forEach((item) => {
|
|
1891
|
+
const option = document.createElement('option');
|
|
1892
|
+
option.value = item.id;
|
|
1893
|
+
option.textContent = item.title;
|
|
1894
|
+
if (item.disabled) option.disabled = true;
|
|
1895
|
+
|
|
1896
|
+
// Restore selected attribute for preserved selections
|
|
1897
|
+
if (validSelections.includes(item.id)) {
|
|
1898
|
+
option.selected = true;
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1901
|
+
this._element.appendChild(option);
|
|
1902
|
+
});
|
|
1903
|
+
|
|
1904
|
+
// Rebuild dropdown
|
|
1905
|
+
this._rebuildOptionsFromNative();
|
|
1906
|
+
|
|
1907
|
+
// Sync selection state from native select (now has selected attributes)
|
|
1908
|
+
this._syncSelectionFromNative();
|
|
1909
|
+
|
|
1910
|
+
// Dispatch updated event
|
|
1911
|
+
this._dispatchEvent('updated');
|
|
1912
|
+
this._fireEvent('updated');
|
|
1913
|
+
})
|
|
1914
|
+
.catch((error) => {
|
|
1915
|
+
console.error('Error updating remote data:', error);
|
|
1916
|
+
this._dispatchEvent('updateError');
|
|
1917
|
+
this._fireEvent('updateError');
|
|
1918
|
+
});
|
|
1919
|
+
} else {
|
|
1920
|
+
// For static selects, handle new options
|
|
1921
|
+
if (newOptions) {
|
|
1922
|
+
// Clear existing options except placeholder
|
|
1923
|
+
this._clearExistingOptions();
|
|
1924
|
+
|
|
1925
|
+
// Add new options to native select
|
|
1926
|
+
newOptions.forEach((opt) => {
|
|
1927
|
+
const option = document.createElement('option');
|
|
1928
|
+
option.value = opt.value;
|
|
1929
|
+
option.textContent = opt.text;
|
|
1930
|
+
this._element.appendChild(option);
|
|
1931
|
+
});
|
|
1932
|
+
}
|
|
1933
|
+
|
|
1934
|
+
// Rebuild dropdown from native select
|
|
1935
|
+
this._rebuildOptionsFromNative();
|
|
1936
|
+
|
|
1937
|
+
// Dispatch updated event
|
|
1938
|
+
this._dispatchEvent('updated');
|
|
1939
|
+
this._fireEvent('updated');
|
|
1940
|
+
}
|
|
1941
|
+
}
|
|
1942
|
+
|
|
1943
|
+
/**
|
|
1944
|
+
* Reload remote data and rebuild the dropdown
|
|
1945
|
+
* Only works with remote data enabled
|
|
1946
|
+
* @returns Promise that resolves when reload completes
|
|
1947
|
+
* @public
|
|
1948
|
+
*/
|
|
1949
|
+
public reload(): Promise<void> {
|
|
1950
|
+
// Guard clause: only works with remote data
|
|
1951
|
+
if (!this._config.remote || !this._remoteModule) {
|
|
1952
|
+
console.warn('reload() only works with remote data enabled');
|
|
1953
|
+
return Promise.resolve();
|
|
1824
1954
|
}
|
|
1825
1955
|
|
|
1826
|
-
//
|
|
1827
|
-
this.
|
|
1956
|
+
// Dispatch reload start event
|
|
1957
|
+
this._dispatchEvent('reloadStart');
|
|
1958
|
+
this._fireEvent('reloadStart');
|
|
1828
1959
|
|
|
1829
|
-
//
|
|
1830
|
-
this.
|
|
1831
|
-
|
|
1960
|
+
// Capture currently selected values before clearing
|
|
1961
|
+
const currentlySelected = this._state.getSelectedOptions();
|
|
1962
|
+
|
|
1963
|
+
// Fetch fresh remote data
|
|
1964
|
+
return this._remoteModule
|
|
1965
|
+
.fetchData()
|
|
1966
|
+
.then((items) => {
|
|
1967
|
+
// Clear existing options (captures to _preSelectedValues)
|
|
1968
|
+
this._clearExistingOptions();
|
|
1969
|
+
|
|
1970
|
+
// Update state with new items
|
|
1971
|
+
return this._state.setItems(items).then(() => {
|
|
1972
|
+
// Generate new options HTML
|
|
1973
|
+
this._generateOptionsHtml(this._element);
|
|
1974
|
+
|
|
1975
|
+
// Preserve selections by marking matching options as selected
|
|
1976
|
+
const availableValues = items.map((item) =>
|
|
1977
|
+
item.id !== undefined ? String(item.id) : '',
|
|
1978
|
+
);
|
|
1979
|
+
const validSelections = currentlySelected.filter((value) =>
|
|
1980
|
+
availableValues.includes(value),
|
|
1981
|
+
);
|
|
1982
|
+
|
|
1983
|
+
if (this._config.debug && currentlySelected.length > 0) {
|
|
1984
|
+
console.log(
|
|
1985
|
+
'reload(): Preserving selections that exist in new data:',
|
|
1986
|
+
validSelections,
|
|
1987
|
+
);
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1990
|
+
// Mark preserved selections on new options
|
|
1991
|
+
validSelections.forEach((value) => {
|
|
1992
|
+
const option = Array.from(
|
|
1993
|
+
this._element.querySelectorAll('option'),
|
|
1994
|
+
).find((opt) => opt.value === value) as HTMLOptionElement;
|
|
1995
|
+
if (option) {
|
|
1996
|
+
option.selected = true;
|
|
1997
|
+
}
|
|
1998
|
+
});
|
|
1999
|
+
|
|
2000
|
+
// Update the dropdown
|
|
2001
|
+
this._updateDropdownWithNewOptions();
|
|
2002
|
+
|
|
2003
|
+
// Sync selection state from native select (now has selected attributes)
|
|
2004
|
+
this._syncSelectionFromNative();
|
|
2005
|
+
|
|
2006
|
+
// Update visual display
|
|
2007
|
+
this.updateSelectedOptionDisplay();
|
|
2008
|
+
this._updateSelectedOptionClass();
|
|
2009
|
+
|
|
2010
|
+
// Update select all button state if applicable
|
|
2011
|
+
if (this._config.multiple && this._config.enableSelectAll) {
|
|
2012
|
+
this.updateSelectAllButtonState();
|
|
2013
|
+
}
|
|
2014
|
+
|
|
2015
|
+
// Dispatch reload complete event
|
|
2016
|
+
this._dispatchEvent('reloadComplete');
|
|
2017
|
+
this._fireEvent('reloadComplete');
|
|
2018
|
+
});
|
|
2019
|
+
})
|
|
2020
|
+
.catch((error) => {
|
|
2021
|
+
console.error('Error reloading remote data:', error);
|
|
2022
|
+
|
|
2023
|
+
// Dispatch reload error event with error details
|
|
2024
|
+
this._dispatchEvent('reloadError', { error });
|
|
2025
|
+
this._fireEvent('reloadError', { error });
|
|
2026
|
+
|
|
2027
|
+
// Re-throw error so caller can handle it
|
|
2028
|
+
throw error;
|
|
2029
|
+
});
|
|
1832
2030
|
}
|
|
1833
2031
|
|
|
1834
2032
|
/**
|
|
1835
2033
|
* Refresh the visual display and state without rebuilding options
|
|
2034
|
+
* For remote selects, refetches data from the server and preserves selections
|
|
2035
|
+
* that exist in the newly fetched data
|
|
2036
|
+
*
|
|
1836
2037
|
* @public
|
|
2038
|
+
* @remarks
|
|
2039
|
+
* - For static selects: syncs visual state with native select
|
|
2040
|
+
* - For remote selects: fetches fresh data, preserves matching selections
|
|
2041
|
+
* - Selections are preserved if their values exist in new remote data
|
|
2042
|
+
* - Selections are cleared if their values don't exist in new data
|
|
2043
|
+
* @fires refreshed - After refresh completes successfully
|
|
2044
|
+
* @fires refreshError - If remote data fetch fails
|
|
1837
2045
|
*/
|
|
1838
2046
|
public refresh(): void {
|
|
1839
|
-
//
|
|
1840
|
-
this.
|
|
2047
|
+
// For remote selects, refetch data
|
|
2048
|
+
if (this._config.remote && this._remoteModule) {
|
|
2049
|
+
this._remoteModule
|
|
2050
|
+
.fetchData()
|
|
2051
|
+
.then((items) => {
|
|
2052
|
+
// Capture currently selected values before clearing
|
|
2053
|
+
const currentlySelected = this._state.getSelectedOptions();
|
|
1841
2054
|
|
|
1842
|
-
|
|
1843
|
-
|
|
2055
|
+
// Clear existing options (also captures to _preSelectedValues)
|
|
2056
|
+
this._clearExistingOptions();
|
|
2057
|
+
|
|
2058
|
+
// Get all available values from new remote data
|
|
2059
|
+
const availableValues = items.map((item) => item.id);
|
|
1844
2060
|
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
2061
|
+
// Filter to only values that exist in new data
|
|
2062
|
+
const validSelections = currentlySelected.filter((value) =>
|
|
2063
|
+
availableValues.includes(value),
|
|
2064
|
+
);
|
|
2065
|
+
|
|
2066
|
+
if (this._config.debug && currentlySelected.length > 0) {
|
|
2067
|
+
console.log(
|
|
2068
|
+
'refresh(): Preserving selections that exist in new data:',
|
|
2069
|
+
validSelections,
|
|
2070
|
+
);
|
|
2071
|
+
}
|
|
2072
|
+
|
|
2073
|
+
// Add new options and restore selection state
|
|
2074
|
+
items.forEach((item) => {
|
|
2075
|
+
const option = document.createElement('option');
|
|
2076
|
+
option.value = item.id;
|
|
2077
|
+
option.textContent = item.title;
|
|
2078
|
+
if (item.disabled) option.disabled = true;
|
|
2079
|
+
|
|
2080
|
+
// Restore selected attribute for preserved selections
|
|
2081
|
+
if (validSelections.includes(item.id)) {
|
|
2082
|
+
option.selected = true;
|
|
2083
|
+
}
|
|
2084
|
+
|
|
2085
|
+
this._element.appendChild(option);
|
|
2086
|
+
});
|
|
2087
|
+
|
|
2088
|
+
// Rebuild dropdown
|
|
2089
|
+
this._rebuildOptionsFromNative();
|
|
2090
|
+
|
|
2091
|
+
// Sync selection state from native select (now has selected attributes)
|
|
2092
|
+
this._syncSelectionFromNative();
|
|
2093
|
+
|
|
2094
|
+
// Reapply ARIA attributes
|
|
2095
|
+
this._setAriaAttributes();
|
|
2096
|
+
|
|
2097
|
+
// Dispatch refreshed event
|
|
2098
|
+
this._dispatchEvent('refreshed');
|
|
2099
|
+
this._fireEvent('refreshed');
|
|
2100
|
+
})
|
|
2101
|
+
.catch((error) => {
|
|
2102
|
+
console.error('Error refreshing remote data:', error);
|
|
2103
|
+
this._dispatchEvent('refreshError');
|
|
2104
|
+
this._fireEvent('refreshError');
|
|
2105
|
+
});
|
|
2106
|
+
} else {
|
|
2107
|
+
// For static selects, just sync visual state
|
|
2108
|
+
this._syncSelectionFromNative();
|
|
2109
|
+
|
|
2110
|
+
// Reapply ARIA attributes
|
|
2111
|
+
this._setAriaAttributes();
|
|
2112
|
+
|
|
2113
|
+
// Dispatch refreshed event
|
|
2114
|
+
this._dispatchEvent('refreshed');
|
|
2115
|
+
this._fireEvent('refreshed');
|
|
2116
|
+
}
|
|
1848
2117
|
}
|
|
1849
2118
|
|
|
1850
2119
|
/**
|
|
@@ -1853,7 +2122,6 @@ export class KTSelect extends KTComponent {
|
|
|
1853
2122
|
* ========================================================================
|
|
1854
2123
|
*/
|
|
1855
2124
|
|
|
1856
|
-
|
|
1857
2125
|
/**
|
|
1858
2126
|
* Create instances of KTSelect for all matching elements
|
|
1859
2127
|
*/
|
|
@@ -2091,7 +2359,9 @@ export class KTSelect extends KTComponent {
|
|
|
2091
2359
|
});
|
|
2092
2360
|
|
|
2093
2361
|
if (this._config.debug) {
|
|
2094
|
-
console.log(
|
|
2362
|
+
console.log(
|
|
2363
|
+
`Updated original select with ${items.length} search results`,
|
|
2364
|
+
);
|
|
2095
2365
|
}
|
|
2096
2366
|
}
|
|
2097
2367
|
|
|
@@ -2367,16 +2637,16 @@ export class KTSelect extends KTComponent {
|
|
|
2367
2637
|
return;
|
|
2368
2638
|
}
|
|
2369
2639
|
const selectOption = new KTSelectOption(optionElement, this._config);
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2640
|
+
const renderedOption = selectOption.render();
|
|
2641
|
+
optionsContainer.appendChild(renderedOption);
|
|
2642
|
+
});
|
|
2643
|
+
// Update internal references
|
|
2644
|
+
this._options = this._dropdownContentElement.querySelectorAll(
|
|
2645
|
+
'[data-kt-select-option]',
|
|
2646
|
+
) as NodeListOf<HTMLElement>;
|
|
2647
|
+
}
|
|
2377
2648
|
}
|
|
2378
|
-
|
|
2379
|
-
// Sync selection after rebuilding
|
|
2649
|
+
// Sync selection after rebuilding
|
|
2380
2650
|
this._syncSelectionFromNative();
|
|
2381
2651
|
this.updateSelectedOptionDisplay();
|
|
2382
2652
|
this._updateSelectedOptionClass();
|
|
@@ -393,7 +393,8 @@ export const defaultTemplates: KTSelectTemplateInterface = {
|
|
|
393
393
|
config: KTSelectConfigInterface,
|
|
394
394
|
): HTMLElement => {
|
|
395
395
|
let template = getTemplateStrings(config).tag;
|
|
396
|
-
let preparedContent =
|
|
396
|
+
let preparedContent =
|
|
397
|
+
option.textContent || option.innerText || option.value || ''; // Default content is the option's text
|
|
397
398
|
|
|
398
399
|
if (config.tagTemplate) {
|
|
399
400
|
let tagTemplateString = config.tagTemplate;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/* eslint-disable max-len */
|
|
4
|
-
var KTGlobalComponentsConfig = {
|
|
5
|
-
modal: {
|
|
6
|
-
backdropClass: 'transition-all duration-300',
|
|
7
|
-
},
|
|
8
|
-
drawer: {
|
|
9
|
-
backdropClass: 'transition-all duration-300',
|
|
10
|
-
hiddenClass: 'hidden'
|
|
11
|
-
},
|
|
12
|
-
collapse: {
|
|
13
|
-
hiddenClass: 'hidden',
|
|
14
|
-
},
|
|
15
|
-
dismiss: {
|
|
16
|
-
hiddenClass: 'hidden',
|
|
17
|
-
},
|
|
18
|
-
tabs: {
|
|
19
|
-
hiddenClass: 'hidden',
|
|
20
|
-
},
|
|
21
|
-
accordion: {
|
|
22
|
-
hiddenClass: 'hidden',
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
exports.default = KTGlobalComponentsConfig;
|
|
26
|
-
//# sourceMappingURL=config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/components/config.ts"],"names":[],"mappings":";;AAAA,4BAA4B;AAC5B,IAAM,wBAAwB,GAAG;IAC/B,KAAK,EAAE;QACL,aAAa,EAAE,6BAA6B;KAC7C;IACD,MAAM,EAAE;QACN,aAAa,EAAE,6BAA6B;QAC5C,WAAW,EAAE,QAAQ;KACtB;IACD,QAAQ,EAAE;QACR,WAAW,EAAE,QAAQ;KACtB;IACD,OAAO,EAAE;QACP,WAAW,EAAE,QAAQ;KACtB;IACD,IAAI,EAAE;QACJ,WAAW,EAAE,QAAQ;KACtB;IACD,SAAS,EAAE;QACT,WAAW,EAAE,QAAQ;KACtB;CACF,CAAC;AAEF,kBAAe,wBAAwB,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/* eslint-disable max-len */
|
|
2
|
-
window.KTGlobalComponentsConfig = {
|
|
3
|
-
modal: {
|
|
4
|
-
backdropClass: 'transition-all duration-300',
|
|
5
|
-
},
|
|
6
|
-
drawer: {
|
|
7
|
-
backdropClass: 'transition-all duration-300',
|
|
8
|
-
hiddenClass: 'hidden'
|
|
9
|
-
},
|
|
10
|
-
collapse: {
|
|
11
|
-
hiddenClass: 'hidden',
|
|
12
|
-
},
|
|
13
|
-
dismiss: {
|
|
14
|
-
hiddenClass: 'hidden',
|
|
15
|
-
},
|
|
16
|
-
tabs: {
|
|
17
|
-
hiddenClass: 'hidden',
|
|
18
|
-
},
|
|
19
|
-
accordion: {
|
|
20
|
-
hiddenClass: 'hidden',
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=config.umd.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.umd.js","sourceRoot":"","sources":["../../../src/components/config.umd.js"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,MAAM,CAAC,wBAAwB,GAAG;IAChC,KAAK,EAAE;QACL,aAAa,EAAE,6BAA6B;KAC7C;IACD,MAAM,EAAE;QACN,aAAa,EAAE,6BAA6B;QAC5C,WAAW,EAAE,QAAQ;KACtB;IACD,QAAQ,EAAE;QACR,WAAW,EAAE,QAAQ;KACtB;IACD,OAAO,EAAE;QACP,WAAW,EAAE,QAAQ;KACtB;IACD,IAAI,EAAE;QACJ,WAAW,EAAE,QAAQ;KACtB;IACD,SAAS,EAAE;QACT,WAAW,EAAE,QAAQ;KACtB;CACF,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.KTMenu = void 0;
|
|
4
|
-
var menu_1 = require("./menu");
|
|
5
|
-
Object.defineProperty(exports, "KTMenu", { enumerable: true, get: function () { return menu_1.KTMenu; } });
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/menu/index.ts"],"names":[],"mappings":";;;AAAA,+BAAgC;AAAvB,8FAAA,MAAM,OAAA"}
|