@capillarytech/blaze-ui 1.1.0-alpha.1 → 1.2.3
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/CapAlert/index.js +85 -9
- package/dist/CapAlert/index.js.map +1 -1
- package/dist/CapButton/index.js +104 -78
- package/dist/CapButton/index.js.map +1 -1
- package/dist/CapCard/index.js +85 -9
- package/dist/CapCard/index.js.map +1 -1
- package/dist/CapCheckbox/index.js +86 -10
- package/dist/CapCheckbox/index.js.map +1 -1
- package/dist/CapColumn/index.js +85 -9
- package/dist/CapColumn/index.js.map +1 -1
- package/dist/CapDivider/index.js +85 -9
- package/dist/CapDivider/index.js.map +1 -1
- package/dist/CapDropdown/index.js +85 -9
- package/dist/CapDropdown/index.js.map +1 -1
- package/dist/CapForm/index.js +85 -9
- package/dist/CapForm/index.js.map +1 -1
- package/dist/CapFormItem/index.js +85 -9
- package/dist/CapFormItem/index.js.map +1 -1
- package/dist/CapIcon/CapIcon.d.ts.map +1 -1
- package/dist/CapIcon/index.js +103 -77
- package/dist/CapIcon/index.js.map +1 -1
- package/dist/CapLabel/index.js +85 -9
- package/dist/CapLabel/index.js.map +1 -1
- package/dist/CapMenu/index.js +85 -9
- package/dist/CapMenu/index.js.map +1 -1
- package/dist/CapRadio/index.js +86 -10
- package/dist/CapRadio/index.js.map +1 -1
- package/dist/CapRow/index.js +85 -9
- package/dist/CapRow/index.js.map +1 -1
- package/dist/CapSwitch/index.js +85 -9
- package/dist/CapSwitch/index.js.map +1 -1
- package/dist/CapTab/index.js +85 -9
- package/dist/CapTab/index.js.map +1 -1
- package/dist/CapTable/index.js +17213 -13
- package/dist/CapTable/index.js.map +1 -1
- package/dist/CapTooltip/index.js +85 -9
- package/dist/CapTooltip/index.js.map +1 -1
- package/dist/CapTooltipWithInfo/index.js +105 -79
- package/dist/CapTooltipWithInfo/index.js.map +1 -1
- package/dist/CapUnifiedSelect/CapUnifiedSelect.d.ts +21 -20
- package/dist/CapUnifiedSelect/CapUnifiedSelect.d.ts.map +1 -1
- package/dist/CapUnifiedSelect/CustomDropdown.d.ts +46 -0
- package/dist/CapUnifiedSelect/CustomDropdown.d.ts.map +1 -0
- package/dist/CapUnifiedSelect/DropdownHeader.d.ts +10 -0
- package/dist/CapUnifiedSelect/DropdownHeader.d.ts.map +1 -0
- package/dist/CapUnifiedSelect/components.d.ts +9 -0
- package/dist/CapUnifiedSelect/components.d.ts.map +1 -0
- package/dist/CapUnifiedSelect/constants.d.ts +31 -0
- package/dist/CapUnifiedSelect/constants.d.ts.map +1 -0
- package/dist/CapUnifiedSelect/enhanceOptions.d.ts +8 -0
- package/dist/CapUnifiedSelect/enhanceOptions.d.ts.map +1 -0
- package/dist/CapUnifiedSelect/index.js +42774 -1540
- package/dist/CapUnifiedSelect/index.js.map +1 -1
- package/dist/CapUnifiedSelect/messages.d.ts +4 -0
- package/dist/CapUnifiedSelect/messages.d.ts.map +1 -1
- package/dist/CapUnifiedSelect/testData.d.ts +75 -0
- package/dist/CapUnifiedSelect/testData.d.ts.map +1 -0
- package/dist/CapUnifiedSelect/types.d.ts +45 -0
- package/dist/CapUnifiedSelect/types.d.ts.map +1 -0
- package/dist/CapUnifiedSelect/useCapUnifiedSelect.d.ts +48 -0
- package/dist/CapUnifiedSelect/useCapUnifiedSelect.d.ts.map +1 -0
- package/dist/CapUnifiedSelect/useInfiniteScroll.d.ts +27 -0
- package/dist/CapUnifiedSelect/useInfiniteScroll.d.ts.map +1 -0
- package/dist/CapUnifiedSelect/utils.d.ts +45 -0
- package/dist/CapUnifiedSelect/utils.d.ts.map +1 -0
- package/dist/index.js +61762 -3468
- package/dist/index.js.map +1 -1
- package/dist/styled/variables.d.ts +1 -0
- package/dist/styled/variables.d.ts.map +1 -1
- package/dist/styled/variables.scss +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/styles.d.ts +1 -1
- package/dist/utils/styles.d.ts.map +1 -1
- package/package.json +150 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../components/CapUnifiedSelect/messages.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../components/CapUnifiedSelect/messages.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,wBAyBG"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const mockOptions: {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
}[];
|
|
6
|
+
export declare const mockTreeOptions: {
|
|
7
|
+
label: string;
|
|
8
|
+
value: string;
|
|
9
|
+
children: {
|
|
10
|
+
label: string;
|
|
11
|
+
value: string;
|
|
12
|
+
}[];
|
|
13
|
+
}[];
|
|
14
|
+
export declare const mockTreeOptionsWithMixed: {
|
|
15
|
+
label: string;
|
|
16
|
+
value: string;
|
|
17
|
+
children: {
|
|
18
|
+
label: string;
|
|
19
|
+
value: string;
|
|
20
|
+
}[];
|
|
21
|
+
}[];
|
|
22
|
+
export declare const mockAsyncResults: {
|
|
23
|
+
label: string;
|
|
24
|
+
value: string;
|
|
25
|
+
}[];
|
|
26
|
+
export declare const mockAsyncResultsForCache: {
|
|
27
|
+
label: string;
|
|
28
|
+
value: string;
|
|
29
|
+
}[];
|
|
30
|
+
export declare const mockAsyncResultsForResetSearch: {
|
|
31
|
+
label: string;
|
|
32
|
+
value: string;
|
|
33
|
+
}[];
|
|
34
|
+
export declare const mockAsyncResultsForScroll: {
|
|
35
|
+
label: string;
|
|
36
|
+
value: string;
|
|
37
|
+
}[];
|
|
38
|
+
export declare const mockSimpleAsyncResult: {
|
|
39
|
+
label: string;
|
|
40
|
+
value: string;
|
|
41
|
+
}[];
|
|
42
|
+
export declare const mockInitialOptions: {
|
|
43
|
+
label: string;
|
|
44
|
+
value: string;
|
|
45
|
+
}[];
|
|
46
|
+
export declare const mockUpdatedOptions: {
|
|
47
|
+
label: string;
|
|
48
|
+
value: string;
|
|
49
|
+
}[];
|
|
50
|
+
export declare const mockNewOptions: {
|
|
51
|
+
label: string;
|
|
52
|
+
value: string;
|
|
53
|
+
}[];
|
|
54
|
+
export declare const getMockOptionsWithReactTitle: () => {
|
|
55
|
+
label: string;
|
|
56
|
+
value: string;
|
|
57
|
+
title: React.DetailedReactHTMLElement<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
58
|
+
}[];
|
|
59
|
+
export declare const mockEmptyOptions: Array<{
|
|
60
|
+
label: string;
|
|
61
|
+
value: string;
|
|
62
|
+
}>;
|
|
63
|
+
export declare const simpleOptions: {
|
|
64
|
+
label: string;
|
|
65
|
+
value: string;
|
|
66
|
+
}[];
|
|
67
|
+
export declare const treeOptions: {
|
|
68
|
+
label: string;
|
|
69
|
+
value: string;
|
|
70
|
+
children: {
|
|
71
|
+
label: string;
|
|
72
|
+
value: string;
|
|
73
|
+
}[];
|
|
74
|
+
}[];
|
|
75
|
+
//# sourceMappingURL=testData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testData.d.ts","sourceRoot":"","sources":["../../components/CapUnifiedSelect/testData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,eAAO,MAAM,WAAW;;;GAIvB,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;GAc3B,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;;;;GASpC,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;GAG5B,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;GAGpC,CAAC;AAEF,eAAO,MAAM,8BAA8B;;;GAG1C,CAAC;AAEF,eAAO,MAAM,yBAAyB;;;GAGrC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;GAAyC,CAAC;AAE5E,eAAO,MAAM,kBAAkB;;;GAG9B,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;GAG9B,CAAC;AAEF,eAAO,MAAM,cAAc;;;GAG1B,CAAC;AAEF,eAAO,MAAM,4BAA4B;;;;GAWxC,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAM,CAAC;AAE5E,eAAO,MAAM,aAAa;;;GAMzB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;GA4BvB,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Represents a single option in the unified select component
|
|
4
|
+
*/
|
|
5
|
+
export interface OptionData {
|
|
6
|
+
label?: React.ReactNode;
|
|
7
|
+
value?: string | number;
|
|
8
|
+
key?: string | number;
|
|
9
|
+
title?: React.ReactNode;
|
|
10
|
+
children?: OptionData[];
|
|
11
|
+
optionSuffix?: React.ReactNode;
|
|
12
|
+
optionSuffixInfo?: React.ReactNode;
|
|
13
|
+
optionTooltipInfo?: React.ReactNode;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
hoverText?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Tree data structure maps for efficient tree operations
|
|
20
|
+
*/
|
|
21
|
+
export interface TreeMaps {
|
|
22
|
+
leafValues: (string | number)[];
|
|
23
|
+
parentChildMap: Record<string | number, (string | number)[]>;
|
|
24
|
+
nodeMap: Record<string | number, OptionData>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Props for the NoResult component
|
|
28
|
+
*/
|
|
29
|
+
export interface NoResultProps {
|
|
30
|
+
noResultCustomText?: string;
|
|
31
|
+
className?: string;
|
|
32
|
+
options?: OptionData[];
|
|
33
|
+
noResultCustomIcon?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Props for the SelectAllCheckbox component
|
|
37
|
+
*/
|
|
38
|
+
export interface SelectAllCheckboxProps {
|
|
39
|
+
currentItems: OptionData[];
|
|
40
|
+
tempValue: (string | number)[] | undefined;
|
|
41
|
+
setTempValue: (value: (string | number)[]) => void;
|
|
42
|
+
processTreeData: (nodes: OptionData[]) => TreeMaps;
|
|
43
|
+
disabled?: boolean;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../components/CapUnifiedSelect/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC/B,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC,iBAAiB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,UAAU,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAChC,cAAc,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;IAC7D,OAAO,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,UAAU,CAAC,CAAC;CAC9C;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,UAAU,EAAE,CAAC;IAC3B,SAAS,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG,SAAS,CAAC;IAC3C,YAAY,EAAE,CAAC,KAAK,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,KAAK,IAAI,CAAC;IACnD,eAAe,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,QAAQ,CAAC;IACnD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type SelectType } from './constants';
|
|
3
|
+
import type { OptionData } from './types';
|
|
4
|
+
interface UseCapUnifiedSelectProps {
|
|
5
|
+
type: SelectType;
|
|
6
|
+
options: OptionData[];
|
|
7
|
+
value: string | number | (string | number)[] | undefined;
|
|
8
|
+
onChange?: (value: string | number | (string | number)[] | undefined) => void;
|
|
9
|
+
staticValue: boolean;
|
|
10
|
+
onSearch?: (query: string) => void;
|
|
11
|
+
searchDebounce: number;
|
|
12
|
+
searchBasedOn: 'label' | 'value' | 'key';
|
|
13
|
+
onConfirm?: (value: string | number | (string | number)[] | undefined) => void;
|
|
14
|
+
resetSearch: boolean;
|
|
15
|
+
resetData?: () => void;
|
|
16
|
+
fetchMissingOptions?: (missingValues: (string | number)[]) => void;
|
|
17
|
+
onPopupScroll?: () => void | Promise<void>;
|
|
18
|
+
hasMore: boolean;
|
|
19
|
+
customPopupRender: boolean;
|
|
20
|
+
isMulti: boolean;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare const useCapUnifiedSelect: ({ type: _type, options, value, onChange, staticValue, onSearch, searchDebounce, searchBasedOn, onConfirm, resetSearch, resetData, fetchMissingOptions, onPopupScroll, hasMore, customPopupRender, isMulti, disabled, }: UseCapUnifiedSelectProps) => {
|
|
24
|
+
searchText: string;
|
|
25
|
+
setSearchText: React.Dispatch<React.SetStateAction<string>>;
|
|
26
|
+
tempValue: string | number | (string | number)[] | undefined;
|
|
27
|
+
setTempValue: React.Dispatch<React.SetStateAction<string | number | (string | number)[] | undefined>>;
|
|
28
|
+
dropdownOpen: boolean;
|
|
29
|
+
isSearching: boolean;
|
|
30
|
+
isLoadingOnScroll: boolean;
|
|
31
|
+
isResettingData: boolean;
|
|
32
|
+
orderedOptions: OptionData[] | null;
|
|
33
|
+
filteredTree: OptionData[];
|
|
34
|
+
treeMaps: import("./types").TreeMaps;
|
|
35
|
+
selectedLeafCount: number;
|
|
36
|
+
displayValue: string | number | (string | number)[] | undefined;
|
|
37
|
+
handleSearch: (query: string) => void;
|
|
38
|
+
handleSearchChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
39
|
+
handleSearchKeyDown: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
40
|
+
handleConfirm: () => void;
|
|
41
|
+
handleClearAll: () => void;
|
|
42
|
+
handleDropdownVisibilityChange: (open: boolean) => void;
|
|
43
|
+
handleSingleSelectChange: (newValue: string | number | (string | number)[] | undefined) => void;
|
|
44
|
+
handleMultiSelectChange: (newValue: string | number | (string | number)[] | undefined) => void;
|
|
45
|
+
selectedItemsCacheRef: React.MutableRefObject<Map<string | number, OptionData>>;
|
|
46
|
+
};
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=useCapUnifiedSelect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCapUnifiedSelect.d.ts","sourceRoot":"","sources":["../../components/CapUnifiedSelect/useCapUnifiedSelect.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAY,KAAK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C,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC;;;2CAzElC,OAAO;yCAoGH,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG,SAAS;wCAcjD,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG,SAAS;;CAqD/D,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type MutableRefObject } from 'react';
|
|
2
|
+
import type { OptionData } from './types';
|
|
3
|
+
interface UseInfiniteScrollProps {
|
|
4
|
+
/**
|
|
5
|
+
* Callback triggered when user scrolls near the bottom of the dropdown.
|
|
6
|
+
* Can optionally return a Promise to indicate API call completion.
|
|
7
|
+
* If a Promise is returned, loading state will be tied to Promise resolution/rejection.
|
|
8
|
+
* If no Promise is returned, loading state will be determined by options change detection.
|
|
9
|
+
*/
|
|
10
|
+
onPopupScroll?: () => void | Promise<void>;
|
|
11
|
+
hasMore: boolean;
|
|
12
|
+
options: OptionData[];
|
|
13
|
+
dropdownOpen: boolean;
|
|
14
|
+
optionsRef: MutableRefObject<OptionData[]>;
|
|
15
|
+
hasInteractedRef: MutableRefObject<boolean>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Custom hook for handling infinite scroll/pagination in dropdown
|
|
19
|
+
* Manages scroll event listeners, loading states, and triggers onPopupScroll callback
|
|
20
|
+
*/
|
|
21
|
+
export declare const useInfiniteScroll: ({ onPopupScroll, hasMore, options, dropdownOpen, optionsRef, hasInteractedRef, }: UseInfiniteScrollProps) => {
|
|
22
|
+
isLoadingOnScroll: boolean;
|
|
23
|
+
resetScrollState: () => void;
|
|
24
|
+
scrollTriggerOptionsCountRef: MutableRefObject<number>;
|
|
25
|
+
};
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=useInfiniteScroll.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInfiniteScroll.d.ts","sourceRoot":"","sources":["../../components/CapUnifiedSelect/useInfiniteScroll.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,KAAK,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAGxF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAG1C,UAAU,sBAAsB;IAC9B;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,gBAAgB,CAAC,UAAU,EAAE,CAAC,CAAC;IAC3C,gBAAgB,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;CAC7C;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,kFAO/B,sBAAsB;;;;CA8OxB,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { OptionData, TreeMaps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Builds tree maps for efficient tree operations
|
|
4
|
+
* Creates maps for leaf values, parent-child relationships, and node lookups
|
|
5
|
+
*/
|
|
6
|
+
export declare const buildTreeMaps: (nodes?: OptionData[]) => TreeMaps;
|
|
7
|
+
/**
|
|
8
|
+
* Counts the number of selected leaf nodes in a tree structure
|
|
9
|
+
* Handles parent-child relationships by expanding selected parent nodes
|
|
10
|
+
*/
|
|
11
|
+
export declare const countSelectedLeaves: (treeMaps: TreeMaps, selectedValues?: (string | number)[]) => number;
|
|
12
|
+
/**
|
|
13
|
+
* Filters tree data based on search query
|
|
14
|
+
* Includes nodes that match search OR are selected OR have matching children
|
|
15
|
+
* Supports searching by label, value, or key
|
|
16
|
+
*/
|
|
17
|
+
export declare const filterTreeData: (data: OptionData[], search?: string, searchBasedOn?: "label" | "value" | "key", selectedValues?: (string | number)[]) => OptionData[];
|
|
18
|
+
/**
|
|
19
|
+
* Checks if a value exists in options (recursive for tree structures)
|
|
20
|
+
*/
|
|
21
|
+
export declare const findValueInOptions: (opts: OptionData[], targetValue: string | number) => boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Finds selected values that don't exist in the current options
|
|
24
|
+
*/
|
|
25
|
+
export declare const findMissingValues: (selectedValues: (string | number)[], currentOptions: OptionData[]) => (string | number)[];
|
|
26
|
+
/**
|
|
27
|
+
* Reorders options based on selection order
|
|
28
|
+
* Selected items are moved to top in the order they were selected
|
|
29
|
+
* For tree structures, maintains parent-child relationships
|
|
30
|
+
* For flat lists, directly reorders items
|
|
31
|
+
* Works for all data types: flat lists, tree structures, nested trees
|
|
32
|
+
*/
|
|
33
|
+
export declare const reorderOptionsBySelection: (opts: OptionData[], selectedOrder: (string | number)[]) => OptionData[];
|
|
34
|
+
/**
|
|
35
|
+
* Prepares data source with virtual options for selected values not in current options
|
|
36
|
+
* Returns raw options without React component enhancement
|
|
37
|
+
*/
|
|
38
|
+
export declare const prepareDataSource: (options: OptionData[], orderedOptions: OptionData[] | null, searchText: string, value: string | number | (string | number)[] | undefined, staticValue: boolean, selectedItemsCache: Map<string | number, OptionData>) => OptionData[];
|
|
39
|
+
/**
|
|
40
|
+
* Finds the scrollable container element within the dropdown
|
|
41
|
+
* Checks for tree list holder, virtual list holder, or dropdown itself
|
|
42
|
+
* Returns the first scrollable container found, or null if none
|
|
43
|
+
*/
|
|
44
|
+
export declare const getScrollContainer: () => HTMLElement | null;
|
|
45
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../components/CapUnifiedSelect/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEpD;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,QAAQ,UAAU,EAAE,KAAG,QAyBpD,CAAC;AAEF;;;GAGG;AACH,eA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