@acorex/cdk 20.2.0-next.0 → 20.2.0-next.10
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/carousel/index.d.ts +1 -0
- package/common/index.d.ts +144 -27
- package/drag-drop/index.d.ts +1 -0
- package/fesm2022/acorex-cdk-carousel.mjs +8 -2
- package/fesm2022/acorex-cdk-carousel.mjs.map +1 -1
- package/fesm2022/acorex-cdk-common.mjs +266 -116
- package/fesm2022/acorex-cdk-common.mjs.map +1 -1
- package/fesm2022/acorex-cdk-drag-drop.mjs +6 -3
- package/fesm2022/acorex-cdk-drag-drop.mjs.map +1 -1
- package/fesm2022/acorex-cdk-drawer.mjs +0 -2
- package/fesm2022/acorex-cdk-drawer.mjs.map +1 -1
- package/fesm2022/acorex-cdk-selection.mjs.map +1 -1
- package/package.json +1 -1
- package/selection/index.d.ts +2 -2
|
@@ -1082,10 +1082,12 @@ class AXDataSource {
|
|
|
1082
1082
|
this._page = 0;
|
|
1083
1083
|
this._totalCount = 0;
|
|
1084
1084
|
}
|
|
1085
|
-
refresh() {
|
|
1085
|
+
refresh(options = { reset: true }) {
|
|
1086
1086
|
const currentFilter = this._query.filter;
|
|
1087
1087
|
const currentSort = this._query.sort;
|
|
1088
|
-
|
|
1088
|
+
if (options.reset) {
|
|
1089
|
+
this.reset();
|
|
1090
|
+
}
|
|
1089
1091
|
this._query.filter = currentFilter;
|
|
1090
1092
|
this._query.sort = currentSort;
|
|
1091
1093
|
this.load();
|
|
@@ -1619,9 +1621,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImpor
|
|
|
1619
1621
|
type: Injectable
|
|
1620
1622
|
}] });
|
|
1621
1623
|
|
|
1624
|
+
/**
|
|
1625
|
+
* Service that manages selection state and caching for selection components
|
|
1626
|
+
*/
|
|
1622
1627
|
class MXSelectionBridgeService {
|
|
1623
1628
|
constructor() {
|
|
1629
|
+
/** Array of currently selected items */
|
|
1624
1630
|
this.selectedItems = [];
|
|
1631
|
+
/** Cache for normalized items keyed by their unique identifier */
|
|
1625
1632
|
this.cacheList = {};
|
|
1626
1633
|
}
|
|
1627
1634
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: MXSelectionBridgeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
@@ -1630,209 +1637,352 @@ class MXSelectionBridgeService {
|
|
|
1630
1637
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: MXSelectionBridgeService, decorators: [{
|
|
1631
1638
|
type: Injectable
|
|
1632
1639
|
}] });
|
|
1640
|
+
/**
|
|
1641
|
+
* Injection token for the selection bridge service
|
|
1642
|
+
*/
|
|
1633
1643
|
const AX_SELECTION_DATA_TOKEN = new InjectionToken('AX_SELECTION_DATA_TOKEN');
|
|
1644
|
+
/**
|
|
1645
|
+
* Abstract base component for selection-based value components
|
|
1646
|
+
* Provides common functionality for components that support item selection
|
|
1647
|
+
*/
|
|
1634
1648
|
class MXSelectionValueComponent extends MXValueComponent {
|
|
1635
1649
|
constructor() {
|
|
1636
1650
|
super(...arguments);
|
|
1651
|
+
// #region Services
|
|
1637
1652
|
this.formatService = inject(AXFormatService);
|
|
1638
1653
|
this.dataService = inject(AX_SELECTION_DATA_TOKEN);
|
|
1654
|
+
// #region Field Configuration Properties
|
|
1639
1655
|
this._valueField = 'id';
|
|
1640
|
-
this._textTemplate = '';
|
|
1641
1656
|
this._textField = 'text';
|
|
1657
|
+
this._textTemplate = '';
|
|
1642
1658
|
this._disabledField = 'disabled';
|
|
1643
1659
|
this._multiple = false;
|
|
1644
1660
|
}
|
|
1661
|
+
/** Field name used to extract the unique value from items */
|
|
1645
1662
|
get valueField() {
|
|
1646
1663
|
return this._valueField;
|
|
1647
1664
|
}
|
|
1648
|
-
set valueField(
|
|
1649
|
-
this.setOption({
|
|
1650
|
-
name: 'valueField',
|
|
1651
|
-
value: v,
|
|
1652
|
-
});
|
|
1653
|
-
}
|
|
1654
|
-
get textTemplate() {
|
|
1655
|
-
return this._textTemplate;
|
|
1656
|
-
}
|
|
1657
|
-
set textTemplate(v) {
|
|
1658
|
-
this.setOption({
|
|
1659
|
-
name: 'textTemplate',
|
|
1660
|
-
value: v,
|
|
1661
|
-
});
|
|
1665
|
+
set valueField(value) {
|
|
1666
|
+
this.setOption({ name: 'valueField', value });
|
|
1662
1667
|
}
|
|
1668
|
+
/** Field name used to extract the display text from items */
|
|
1663
1669
|
get textField() {
|
|
1664
1670
|
return this._textField;
|
|
1665
1671
|
}
|
|
1666
|
-
set textField(
|
|
1667
|
-
this.setOption({
|
|
1668
|
-
name: 'textField',
|
|
1669
|
-
value: v,
|
|
1670
|
-
});
|
|
1672
|
+
set textField(value) {
|
|
1673
|
+
this.setOption({ name: 'textField', value });
|
|
1671
1674
|
}
|
|
1675
|
+
/** Template string for formatting item display text */
|
|
1676
|
+
get textTemplate() {
|
|
1677
|
+
return this._textTemplate;
|
|
1678
|
+
}
|
|
1679
|
+
set textTemplate(value) {
|
|
1680
|
+
this.setOption({ name: 'textTemplate', value });
|
|
1681
|
+
}
|
|
1682
|
+
/** Field name used to determine if an item is disabled */
|
|
1672
1683
|
get disabledField() {
|
|
1673
1684
|
return this._disabledField;
|
|
1674
1685
|
}
|
|
1675
|
-
set disabledField(
|
|
1676
|
-
this.setOption({
|
|
1677
|
-
name: 'disabledField',
|
|
1678
|
-
value: v,
|
|
1679
|
-
});
|
|
1686
|
+
set disabledField(value) {
|
|
1687
|
+
this.setOption({ name: 'disabledField', value });
|
|
1680
1688
|
}
|
|
1689
|
+
/** Whether multiple items can be selected */
|
|
1681
1690
|
get multiple() {
|
|
1682
1691
|
return this._multiple;
|
|
1683
1692
|
}
|
|
1684
|
-
set multiple(
|
|
1693
|
+
set multiple(value) {
|
|
1685
1694
|
this.setOption({
|
|
1686
1695
|
name: 'multiple',
|
|
1687
|
-
value
|
|
1688
|
-
afterCallback: () =>
|
|
1689
|
-
this.reset(false);
|
|
1690
|
-
},
|
|
1696
|
+
value,
|
|
1697
|
+
afterCallback: () => this.reset(false),
|
|
1691
1698
|
});
|
|
1692
1699
|
}
|
|
1700
|
+
// #endregion
|
|
1701
|
+
// #region Computed Properties
|
|
1702
|
+
/** Gets the currently selected items */
|
|
1693
1703
|
get selectedItems() {
|
|
1694
1704
|
return this.dataService.selectedItems || [];
|
|
1695
1705
|
}
|
|
1706
|
+
// #endregion
|
|
1707
|
+
// #region Override Methods
|
|
1708
|
+
/**
|
|
1709
|
+
* Internal method to set and normalize the component value
|
|
1710
|
+
* @param value The value to set (can be single item or array)
|
|
1711
|
+
* @returns Normalized value based on multiple selection mode
|
|
1712
|
+
*/
|
|
1696
1713
|
internalSetValue(value) {
|
|
1697
1714
|
const isArray = Array.isArray(value);
|
|
1698
|
-
|
|
1715
|
+
// Handle null/empty values
|
|
1716
|
+
if (value == null || (isArray && value.length === 0)) {
|
|
1699
1717
|
return this.multiple ? [] : null;
|
|
1700
1718
|
}
|
|
1701
|
-
|
|
1702
|
-
|
|
1719
|
+
// Normalize items and find by key if needed
|
|
1720
|
+
const itemsToNormalize = isArray ? value : [value];
|
|
1721
|
+
const normalizedItems = this.normalizeItemsList(itemsToNormalize, true);
|
|
1722
|
+
if (normalizedItems.length === 0) {
|
|
1703
1723
|
return this.multiple ? [] : null;
|
|
1704
1724
|
}
|
|
1705
|
-
|
|
1706
|
-
return
|
|
1725
|
+
// Extract values based on selection mode
|
|
1726
|
+
return this.multiple
|
|
1727
|
+
? normalizedItems.map(item => item[this.valueField])
|
|
1728
|
+
: normalizedItems[0]?.[this.valueField] ?? null;
|
|
1707
1729
|
}
|
|
1730
|
+
/**
|
|
1731
|
+
* Override to normalize selected items when value changes
|
|
1732
|
+
*/
|
|
1708
1733
|
emitOnValueChangedEvent(oldValue, newValue) {
|
|
1709
1734
|
this._normalizeSelectedItems();
|
|
1710
1735
|
super.emitOnValueChangedEvent(oldValue, newValue);
|
|
1711
1736
|
}
|
|
1712
|
-
|
|
1713
|
-
|
|
1737
|
+
// #endregion
|
|
1738
|
+
// #region Private Normalization Methods
|
|
1739
|
+
/**
|
|
1740
|
+
* Normalizes a list of items, filtering out null values
|
|
1741
|
+
* @param items Array of items to normalize
|
|
1742
|
+
* @param findByKey Whether to attempt finding items by key
|
|
1743
|
+
* @returns Array of normalized items
|
|
1744
|
+
*/
|
|
1745
|
+
normalizeItemsList(items, findByKey = false) {
|
|
1746
|
+
if (!items?.length)
|
|
1714
1747
|
return [];
|
|
1715
|
-
return items
|
|
1748
|
+
return items
|
|
1749
|
+
.filter(item => item != null)
|
|
1750
|
+
.map(item => this.normalizeItem(item, findByKey));
|
|
1716
1751
|
}
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
const
|
|
1727
|
-
|
|
1728
|
-
|
|
1752
|
+
/**
|
|
1753
|
+
* Normalizes a single item, handling caching and async loading
|
|
1754
|
+
* @param item Item to normalize
|
|
1755
|
+
* @param findByKey Whether to attempt finding the item by key
|
|
1756
|
+
* @returns Normalized item object
|
|
1757
|
+
*/
|
|
1758
|
+
normalizeItem(item, findByKey = false) {
|
|
1759
|
+
const isComplexObject = typeof item === 'object' && item !== null;
|
|
1760
|
+
const itemRecord = item;
|
|
1761
|
+
const key = isComplexObject ? String(itemRecord[this.valueField]) : String(item);
|
|
1762
|
+
const cacheKey = this.createCacheKey(key);
|
|
1763
|
+
// Return cached item if available and has text
|
|
1764
|
+
const cachedItem = this.dataService.cacheList[cacheKey];
|
|
1765
|
+
if (cachedItem && cachedItem[this.textField]) {
|
|
1766
|
+
return cachedItem;
|
|
1767
|
+
}
|
|
1768
|
+
const hasTextProperty = !isComplexObject || itemRecord[this.textField] != null;
|
|
1769
|
+
const normalizedObj = {};
|
|
1770
|
+
if (isComplexObject && hasTextProperty) {
|
|
1771
|
+
// Item already has all required properties
|
|
1772
|
+
Object.assign(normalizedObj, item);
|
|
1729
1773
|
}
|
|
1730
1774
|
else {
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1775
|
+
// Need to find or create item properties
|
|
1776
|
+
this.handleItemNormalization(normalizedObj, item, key, findByKey, cacheKey);
|
|
1777
|
+
}
|
|
1778
|
+
this.dataService.cacheList[cacheKey] = normalizedObj;
|
|
1779
|
+
return normalizedObj;
|
|
1780
|
+
}
|
|
1781
|
+
/**
|
|
1782
|
+
* Handles the normalization logic for items that need property assignment
|
|
1783
|
+
*/
|
|
1784
|
+
handleItemNormalization(normalizedObj, originalItem, key, findByKey, cacheKey) {
|
|
1785
|
+
const existingItem = findByKey ? this.getItemByKey(key) : null;
|
|
1786
|
+
if (existingItem instanceof Promise) {
|
|
1787
|
+
this.handleAsyncItem(normalizedObj, key, existingItem, cacheKey);
|
|
1788
|
+
}
|
|
1789
|
+
else if (existingItem) {
|
|
1790
|
+
this.assignItemProperties(normalizedObj, existingItem, true);
|
|
1791
|
+
}
|
|
1792
|
+
else {
|
|
1793
|
+
this.assignItemProperties(normalizedObj, originalItem, false);
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
/**
|
|
1797
|
+
* Handles async item loading with loading state
|
|
1798
|
+
*/
|
|
1799
|
+
handleAsyncItem(obj, key, promise, cacheKey) {
|
|
1800
|
+
// Set loading state
|
|
1801
|
+
obj[this.valueField] = key;
|
|
1802
|
+
obj['isLoading'] = true;
|
|
1803
|
+
obj[this.textField] = 'Loading';
|
|
1804
|
+
promise
|
|
1805
|
+
.then(result => {
|
|
1806
|
+
if (typeof result === 'object' && result) {
|
|
1807
|
+
Object.assign(obj, cloneDeep(result));
|
|
1758
1808
|
}
|
|
1759
1809
|
else {
|
|
1760
|
-
obj[this.valueField] =
|
|
1761
|
-
obj[this.textField] =
|
|
1810
|
+
obj[this.valueField] = result || key;
|
|
1811
|
+
obj[this.textField] = result;
|
|
1762
1812
|
}
|
|
1813
|
+
})
|
|
1814
|
+
.finally(() => {
|
|
1815
|
+
delete obj['isLoading'];
|
|
1816
|
+
this.dataService.cacheList[cacheKey] = obj;
|
|
1817
|
+
this.cdr.markForCheck();
|
|
1818
|
+
});
|
|
1819
|
+
}
|
|
1820
|
+
/**
|
|
1821
|
+
* Assigns value and text properties to the normalized object
|
|
1822
|
+
*/
|
|
1823
|
+
assignItemProperties(obj, sourceItem, isComplexSource) {
|
|
1824
|
+
const isSourceObject = typeof sourceItem === 'object' && sourceItem !== null;
|
|
1825
|
+
const sourceRecord = sourceItem;
|
|
1826
|
+
if (isComplexSource && isSourceObject) {
|
|
1827
|
+
obj[this.valueField] = sourceRecord[this.valueField];
|
|
1828
|
+
obj[this.textField] = sourceRecord[this.textField];
|
|
1829
|
+
}
|
|
1830
|
+
else {
|
|
1831
|
+
obj[this.valueField] = isSourceObject ? sourceRecord[this.valueField] : sourceItem;
|
|
1832
|
+
obj[this.textField] = isSourceObject ? sourceRecord[this.textField] : sourceItem;
|
|
1763
1833
|
}
|
|
1764
|
-
this.dataService.cacheList[cacheKey] = obj;
|
|
1765
|
-
return obj;
|
|
1766
1834
|
}
|
|
1835
|
+
/**
|
|
1836
|
+
* Creates a consistent cache key for an item
|
|
1837
|
+
*/
|
|
1838
|
+
createCacheKey(key) {
|
|
1839
|
+
return `k-${key}`;
|
|
1840
|
+
}
|
|
1841
|
+
/**
|
|
1842
|
+
* Normalizes currently selected items and updates the data service
|
|
1843
|
+
*/
|
|
1767
1844
|
_normalizeSelectedItems() {
|
|
1768
|
-
const values = Array.isArray(this.value)
|
|
1769
|
-
|
|
1845
|
+
const values = Array.isArray(this.value)
|
|
1846
|
+
? this.value
|
|
1847
|
+
: this.value != null ? [this.value] : [];
|
|
1848
|
+
this.dataService.selectedItems = values.map(value => this.normalizeItem(value));
|
|
1770
1849
|
}
|
|
1850
|
+
// #endregion
|
|
1851
|
+
// #region Public Selection Methods
|
|
1852
|
+
/**
|
|
1853
|
+
* Unselects the specified items from the selection
|
|
1854
|
+
* @param items Items to unselect
|
|
1855
|
+
*/
|
|
1771
1856
|
unselectItems(...items) {
|
|
1772
|
-
if (!items
|
|
1857
|
+
if (!items?.length) {
|
|
1773
1858
|
this.commitValue([], true);
|
|
1774
1859
|
return;
|
|
1775
1860
|
}
|
|
1776
|
-
const
|
|
1777
|
-
const newSelectedItems = this.selectedItems.filter(
|
|
1861
|
+
const normalizedItems = this.normalizeItemsList(items);
|
|
1862
|
+
const newSelectedItems = this.selectedItems.filter(selectedItem => !normalizedItems.some(normalizedItem => normalizedItem[this.valueField] === selectedItem[this.valueField]));
|
|
1778
1863
|
this.commitValue(newSelectedItems, true);
|
|
1779
1864
|
}
|
|
1865
|
+
/**
|
|
1866
|
+
* Selects the specified items
|
|
1867
|
+
* @param items Items to select
|
|
1868
|
+
*/
|
|
1780
1869
|
selectItems(...items) {
|
|
1781
|
-
if (items
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
}
|
|
1790
|
-
this.commitValue(newSelectedItems, true);
|
|
1791
|
-
}
|
|
1870
|
+
if (!items?.length)
|
|
1871
|
+
return;
|
|
1872
|
+
const currentValue = Array.isArray(this.value) ? this.value : [this.value];
|
|
1873
|
+
const normalizedItems = this.normalizeItemsList(items);
|
|
1874
|
+
const newSelectedItems = this.multiple
|
|
1875
|
+
? [...currentValue, ...normalizedItems]
|
|
1876
|
+
: normalizedItems;
|
|
1877
|
+
this.commitValue(newSelectedItems, true);
|
|
1792
1878
|
}
|
|
1879
|
+
/**
|
|
1880
|
+
* Toggles the selection state of the specified items
|
|
1881
|
+
* @param items Items to toggle
|
|
1882
|
+
*/
|
|
1793
1883
|
toggleSelect(...items) {
|
|
1794
|
-
items?.forEach(
|
|
1884
|
+
items?.forEach(item => {
|
|
1795
1885
|
if (this.multiple) {
|
|
1796
|
-
this.isItemSelected(item)
|
|
1886
|
+
this.isItemSelected(item)
|
|
1887
|
+
? this.unselectItems(item)
|
|
1888
|
+
: this.selectItems(item);
|
|
1797
1889
|
}
|
|
1798
1890
|
else {
|
|
1799
1891
|
this.selectItems(item);
|
|
1800
1892
|
}
|
|
1801
1893
|
});
|
|
1802
1894
|
}
|
|
1895
|
+
// #endregion
|
|
1896
|
+
// #region Public Utility Methods
|
|
1897
|
+
/**
|
|
1898
|
+
* Checks if an item is currently selected
|
|
1899
|
+
* @param item Item to check
|
|
1900
|
+
* @returns True if the item is selected
|
|
1901
|
+
*/
|
|
1803
1902
|
isItemSelected(item) {
|
|
1804
|
-
|
|
1903
|
+
const normalizedItem = this.normalizeItem(item);
|
|
1904
|
+
return this.selectedItems.some(selectedItem => selectedItem[this.valueField] === normalizedItem[this.valueField]);
|
|
1805
1905
|
}
|
|
1906
|
+
/**
|
|
1907
|
+
* Checks if an item is disabled
|
|
1908
|
+
* @param item Item to check
|
|
1909
|
+
* @returns True if the item is disabled
|
|
1910
|
+
*/
|
|
1806
1911
|
isItemDisabled(item) {
|
|
1912
|
+
const itemRecord = item;
|
|
1807
1913
|
return (this.disabled ||
|
|
1808
|
-
coerceBooleanProperty(
|
|
1809
|
-
(this.disabledCallback
|
|
1914
|
+
coerceBooleanProperty(itemRecord[this.disabledField]) === true ||
|
|
1915
|
+
(this.disabledCallback?.({ item, index: -1 }) ?? false));
|
|
1810
1916
|
}
|
|
1811
|
-
//
|
|
1812
|
-
//
|
|
1813
|
-
|
|
1814
|
-
|
|
1917
|
+
// #endregion
|
|
1918
|
+
// #region Protected Utility Methods
|
|
1919
|
+
/**
|
|
1920
|
+
* Gets the display text for an item using template or text field
|
|
1921
|
+
* @param item Item to get display text for
|
|
1922
|
+
* @returns Formatted display text
|
|
1923
|
+
*/
|
|
1815
1924
|
getDisplayText(item) {
|
|
1816
|
-
const
|
|
1817
|
-
|
|
1818
|
-
if (this.textTemplate
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1925
|
+
const normalizedItem = this.normalizeItem(item);
|
|
1926
|
+
// Try template formatting first
|
|
1927
|
+
if (this.textTemplate) {
|
|
1928
|
+
const formattedTemplate = this.formatService.format(this.textTemplate, 'string', normalizedItem);
|
|
1929
|
+
if (formattedTemplate !== this.textTemplate) {
|
|
1930
|
+
return formattedTemplate;
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1933
|
+
// Use text field or fallback to value field
|
|
1934
|
+
if (normalizedItem[this.textField]) {
|
|
1935
|
+
return String(normalizedItem[this.textField]);
|
|
1936
|
+
}
|
|
1937
|
+
// Attempt to load item by key if text is missing
|
|
1938
|
+
const value = normalizedItem[this.valueField];
|
|
1939
|
+
this.loadAndCacheItemByKey(value);
|
|
1940
|
+
return String(value);
|
|
1822
1941
|
}
|
|
1942
|
+
/**
|
|
1943
|
+
* Gets the value of an item
|
|
1944
|
+
* @param item Item to get value from
|
|
1945
|
+
* @returns Item value
|
|
1946
|
+
*/
|
|
1823
1947
|
getValue(item) {
|
|
1824
|
-
const
|
|
1825
|
-
return
|
|
1948
|
+
const normalizedItem = this.normalizeItem(item);
|
|
1949
|
+
return normalizedItem[this.valueField];
|
|
1826
1950
|
}
|
|
1951
|
+
/**
|
|
1952
|
+
* Clears the selection cache and selected items
|
|
1953
|
+
*/
|
|
1827
1954
|
clearSelectionCache() {
|
|
1828
1955
|
this.dataService.cacheList = {};
|
|
1829
1956
|
this.dataService.selectedItems = [];
|
|
1830
1957
|
this.cdr.markForCheck();
|
|
1831
1958
|
}
|
|
1959
|
+
/**
|
|
1960
|
+
* Clears only the cache while preserving selected items
|
|
1961
|
+
*/
|
|
1832
1962
|
softClearSelectionCache() {
|
|
1833
1963
|
this.dataService.cacheList = {};
|
|
1834
1964
|
this.cdr.markForCheck();
|
|
1835
1965
|
}
|
|
1966
|
+
// #endregion
|
|
1967
|
+
// #region Private Helper Methods
|
|
1968
|
+
/**
|
|
1969
|
+
* Asynchronously loads an item by its key and caches the result
|
|
1970
|
+
* @param key Key to load item by
|
|
1971
|
+
*/
|
|
1972
|
+
async loadAndCacheItemByKey(key) {
|
|
1973
|
+
try {
|
|
1974
|
+
const item = await this.getItemByKey(key);
|
|
1975
|
+
if (item) {
|
|
1976
|
+
const normalizedItem = this.normalizeItem(item);
|
|
1977
|
+
const cacheKey = this.createCacheKey(String(normalizedItem[this.valueField]));
|
|
1978
|
+
this.dataService.cacheList[cacheKey] = normalizedItem;
|
|
1979
|
+
this.cdr.markForCheck();
|
|
1980
|
+
}
|
|
1981
|
+
}
|
|
1982
|
+
catch (error) {
|
|
1983
|
+
console.warn('Failed to load item by key:', key, error);
|
|
1984
|
+
}
|
|
1985
|
+
}
|
|
1836
1986
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: MXSelectionValueComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1837
1987
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: MXSelectionValueComponent }); }
|
|
1838
1988
|
}
|