@uzum-tech/ui 2.0.6 → 2.0.8
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/index.js +159 -87
- package/dist/index.mjs +159 -87
- package/dist/index.prod.js +2 -2
- package/dist/index.prod.mjs +2 -2
- package/es/_internal/icons/index.d.ts +0 -1
- package/es/_internal/icons/index.mjs +0 -1
- package/es/components.d.ts +74 -31
- package/es/tree/src/Tree.d.ts +49 -24
- package/es/tree/src/Tree.mjs +18 -13
- package/es/tree/src/TreeNodeCheckbox.d.ts +4 -0
- package/es/tree/src/TreeNodeSwitcher.mjs +24 -26
- package/es/tree/src/styles/index.cssr.mjs +11 -8
- package/es/tree/styles/light.d.ts +4 -0
- package/es/tree/styles/light.mjs +2 -0
- package/es/tree-select/index.d.ts +1 -1
- package/es/tree-select/src/TreeSelect.d.ts +52 -17
- package/es/tree-select/src/TreeSelect.mjs +78 -45
- package/es/tree-select/src/interface.d.ts +7 -1
- package/es/tree-select/src/scroll-option-end.d.ts +3 -0
- package/es/tree-select/src/scroll-option-end.mjs +28 -0
- package/es/tree-select/styles/light.d.ts +2 -0
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/lib/_internal/icons/index.d.ts +0 -1
- package/lib/_internal/icons/index.js +1 -3
- package/lib/components.d.ts +74 -31
- package/lib/tree/src/Tree.d.ts +49 -24
- package/lib/tree/src/Tree.js +16 -15
- package/lib/tree/src/TreeNodeCheckbox.d.ts +4 -0
- package/lib/tree/src/TreeNodeSwitcher.js +11 -14
- package/lib/tree/src/styles/index.cssr.js +11 -8
- package/lib/tree/styles/light.d.ts +4 -0
- package/lib/tree/styles/light.js +2 -0
- package/lib/tree-select/index.d.ts +1 -1
- package/lib/tree-select/src/TreeSelect.d.ts +52 -17
- package/lib/tree-select/src/TreeSelect.js +79 -49
- package/lib/tree-select/src/interface.d.ts +7 -1
- package/lib/tree-select/src/scroll-option-end.d.ts +3 -0
- package/lib/tree-select/src/scroll-option-end.js +30 -0
- package/lib/tree-select/styles/light.d.ts +2 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +5 -4
- package/web-types.json +41 -1
- package/es/_internal/icons/Switcher.d.ts +0 -2
- package/es/_internal/icons/Switcher.mjs +0 -12
- package/lib/_internal/icons/Switcher.d.ts +0 -2
- package/lib/_internal/icons/Switcher.js +0 -10
|
@@ -28,6 +28,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
28
28
|
nodeColorPressed: string;
|
|
29
29
|
nodeColorActive: string;
|
|
30
30
|
arrowColor: string;
|
|
31
|
+
switcherColor: string;
|
|
32
|
+
switcherSize: string;
|
|
31
33
|
nodeTextColor: string;
|
|
32
34
|
nodeTextColorDisabled: string;
|
|
33
35
|
loadingColor: string;
|
|
@@ -147,6 +149,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
147
149
|
nodeColorPressed: string;
|
|
148
150
|
nodeColorActive: string;
|
|
149
151
|
arrowColor: string;
|
|
152
|
+
switcherColor: string;
|
|
153
|
+
switcherSize: string;
|
|
150
154
|
nodeTextColor: string;
|
|
151
155
|
nodeTextColorDisabled: string;
|
|
152
156
|
loadingColor: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, h, inject } from 'vue';
|
|
2
2
|
import { UBaseIcon, UBaseLoading, UIconSwitchTransition } from "../../_internal/index.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { ChevronRightIcon } from "../../_internal/icons/index.mjs";
|
|
4
4
|
import { treeInjectionKey } from "./interface.mjs";
|
|
5
5
|
export default defineComponent({
|
|
6
6
|
name: 'UTreeSwitcher',
|
|
@@ -28,6 +28,23 @@ export default defineComponent({
|
|
|
28
28
|
renderSwitcherIconRef,
|
|
29
29
|
spinPropsRef
|
|
30
30
|
} = inject(treeInjectionKey, null);
|
|
31
|
+
const renderSwitchIcon = () => {
|
|
32
|
+
const {
|
|
33
|
+
value: renderSwitcherIcon
|
|
34
|
+
} = renderSwitcherIconRef;
|
|
35
|
+
return h(UIconSwitchTransition, null, {
|
|
36
|
+
default: () => renderSwitcherIcon ? renderSwitcherIcon({
|
|
37
|
+
expanded: props.expanded,
|
|
38
|
+
selected: props.selected,
|
|
39
|
+
option: props.tmNode.rawNode
|
|
40
|
+
}) : h(UBaseIcon, {
|
|
41
|
+
clsPrefix: props.clsPrefix,
|
|
42
|
+
key: "switcher"
|
|
43
|
+
}, {
|
|
44
|
+
default: () => h(ChevronRightIcon, null)
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
};
|
|
31
48
|
return () => {
|
|
32
49
|
const {
|
|
33
50
|
clsPrefix,
|
|
@@ -45,31 +62,12 @@ export default defineComponent({
|
|
|
45
62
|
onClick: onClick
|
|
46
63
|
}, h("div", {
|
|
47
64
|
class: `${clsPrefix}-tree-node-switcher__icon`
|
|
48
|
-
}, h(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
radius: 85,
|
|
55
|
-
strokeWidth: 20
|
|
56
|
-
}, spinPropsRef === null || spinPropsRef === void 0 ? void 0 : spinPropsRef.value));
|
|
57
|
-
}
|
|
58
|
-
const {
|
|
59
|
-
value: renderSwitcherIcon
|
|
60
|
-
} = renderSwitcherIconRef;
|
|
61
|
-
return renderSwitcherIcon ? renderSwitcherIcon({
|
|
62
|
-
expanded: props.expanded,
|
|
63
|
-
selected: props.selected,
|
|
64
|
-
option: props.tmNode.rawNode
|
|
65
|
-
}) : h(UBaseIcon, {
|
|
66
|
-
clsPrefix: clsPrefix,
|
|
67
|
-
key: "switcher"
|
|
68
|
-
}, {
|
|
69
|
-
default: () => h(SwitcherIcon, null)
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
})));
|
|
65
|
+
}, props.loading ? h(UBaseLoading, Object.assign({
|
|
66
|
+
clsPrefix: clsPrefix,
|
|
67
|
+
key: "loading",
|
|
68
|
+
radius: 85,
|
|
69
|
+
strokeWidth: 20
|
|
70
|
+
}, spinPropsRef === null || spinPropsRef === void 0 ? void 0 : spinPropsRef.value)) : renderSwitchIcon()));
|
|
73
71
|
};
|
|
74
72
|
}
|
|
75
73
|
});
|
|
@@ -4,6 +4,8 @@ import { c, cB, cE, cM, cNotM } from "../../../_utils/cssr/index.mjs";
|
|
|
4
4
|
const iconSwitchTransitionNode = iconSwitchTransition();
|
|
5
5
|
// vars:
|
|
6
6
|
// --u-arrow-color
|
|
7
|
+
// --u-switcher-color
|
|
8
|
+
// --u-switcher-size
|
|
7
9
|
// --u-bezier
|
|
8
10
|
// --u-font-size
|
|
9
11
|
// --u-node-border-radius
|
|
@@ -95,19 +97,20 @@ export default cB('tree', `
|
|
|
95
97
|
vertical-align: bottom;
|
|
96
98
|
`, [cE('icon', `
|
|
97
99
|
position: relative;
|
|
98
|
-
height:
|
|
99
|
-
width:
|
|
100
|
+
height: var(--u-switcher-size);
|
|
101
|
+
width: var(--u-switcher-size);
|
|
100
102
|
display: flex;
|
|
103
|
+
align-items: center;
|
|
104
|
+
justify-content: center;
|
|
105
|
+
border-radius: 50%;
|
|
101
106
|
color: var(--u-arrow-color);
|
|
102
|
-
|
|
107
|
+
background-color: var(--u-switcher-color);
|
|
108
|
+
transition:
|
|
109
|
+
color .3s var(--u-bezier),
|
|
110
|
+
background-color .3s var(--u-bezier);
|
|
103
111
|
font-size: 14px;
|
|
104
112
|
`, [cB('icon', [iconSwitchTransitionNode]), cB('base-loading', `
|
|
105
113
|
color: var(--u-loading-color);
|
|
106
|
-
position: absolute;
|
|
107
|
-
left: 0;
|
|
108
|
-
top: 0;
|
|
109
|
-
right: 0;
|
|
110
|
-
bottom: 0;
|
|
111
114
|
`, [iconSwitchTransitionNode]), cB('base-icon', [iconSwitchTransitionNode])]), cM('hide', 'visibility: hidden;'), cM('expanded', 'transform: rotate(90deg);')]), cB('tree-node-checkbox', `
|
|
112
115
|
display: inline-flex;
|
|
113
116
|
height: var(--u-node-content-height);
|
|
@@ -9,6 +9,8 @@ export declare function self(vars: ThemeCommonVars): {
|
|
|
9
9
|
nodeColorPressed: string;
|
|
10
10
|
nodeColorActive: string;
|
|
11
11
|
arrowColor: string;
|
|
12
|
+
switcherColor: string;
|
|
13
|
+
switcherSize: string;
|
|
12
14
|
nodeTextColor: string;
|
|
13
15
|
nodeTextColorDisabled: string;
|
|
14
16
|
loadingColor: string;
|
|
@@ -25,6 +27,8 @@ declare const treeLight: import("../../_mixins").Theme<"Tree", {
|
|
|
25
27
|
nodeColorPressed: string;
|
|
26
28
|
nodeColorActive: string;
|
|
27
29
|
arrowColor: string;
|
|
30
|
+
switcherColor: string;
|
|
31
|
+
switcherSize: string;
|
|
28
32
|
nodeTextColor: string;
|
|
29
33
|
nodeTextColorDisabled: string;
|
|
30
34
|
loadingColor: string;
|
package/es/tree/styles/light.mjs
CHANGED
|
@@ -25,6 +25,8 @@ export function self(vars) {
|
|
|
25
25
|
nodeColorPressed: elementsQuaternary,
|
|
26
26
|
nodeColorActive: brandPrimary100,
|
|
27
27
|
arrowColor: elementsPrimary,
|
|
28
|
+
switcherColor: elementsTertiary,
|
|
29
|
+
switcherSize: '22px',
|
|
28
30
|
nodeTextColor: textPrimary,
|
|
29
31
|
nodeTextColorDisabled: textSecondary,
|
|
30
32
|
loadingColor: elementsPrimary,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { TreeOverrideNodeClickBehavior as TreeSelectOverrideNodeClickBehavior, TreeOverrideNodeClickBehaviorReturn as TreeSelectOverrideNodeClickBehaviorReturn } from '../tree';
|
|
2
|
-
export type { TreeSelectInst, TreeSelectNodeProps, TreeSelectOption, TreeSelectRenderLabel, TreeSelectRenderPrefix, TreeSelectRenderSuffix, TreeSelectRenderTag } from './src/interface';
|
|
2
|
+
export type { OnScrollOptionEnd, TreeSelectInst, TreeSelectNodeProps, TreeSelectOption, TreeSelectRenderLabel, TreeSelectRenderPrefix, TreeSelectRenderSuffix, TreeSelectRenderTag } from './src/interface';
|
|
3
3
|
export type * from './src/public-types';
|
|
4
4
|
export { treeSelectProps, default as UTreeSelect } from './src/TreeSelect';
|
|
5
5
|
export type { TreeSelectProps, TreeSelectSlots } from './src/TreeSelect';
|
|
@@ -7,15 +7,18 @@ import type { ExtractPublicPropTypes, MaybeArray } from '../../_utils';
|
|
|
7
7
|
import type { FormValidationStatus } from '../../form/src/interface';
|
|
8
8
|
import type { SelectBaseOption, SelectOption } from '../../select/src/interface';
|
|
9
9
|
import type { InternalTreeInst, Key, TreeOption } from '../../tree/src/interface';
|
|
10
|
-
import type { OnUpdateValue, TreeSelectNodeProps, TreeSelectOption, TreeSelectRenderLabel, TreeSelectRenderPrefix, TreeSelectRenderSuffix, TreeSelectRenderTag } from './interface';
|
|
10
|
+
import type { FilterHandler, OnScrollOptionEnd, OnUpdateValue, TreeSelectNodeProps, TreeSelectOption, TreeSelectRenderLabel, TreeSelectRenderPrefix, TreeSelectRenderSuffix, TreeSelectRenderTag } from './interface';
|
|
11
11
|
type OnLoad = (node: TreeSelectOption) => Promise<void>;
|
|
12
12
|
export declare const treeSelectProps: {
|
|
13
13
|
readonly renderLabel: PropType<TreeSelectRenderLabel>;
|
|
14
14
|
readonly renderPrefix: PropType<TreeSelectRenderPrefix>;
|
|
15
15
|
readonly renderSuffix: PropType<TreeSelectRenderSuffix>;
|
|
16
16
|
readonly nodeProps: PropType<TreeSelectNodeProps>;
|
|
17
|
-
readonly onBlur: PropType<(
|
|
18
|
-
readonly onFocus: PropType<(
|
|
17
|
+
readonly onBlur: PropType<(event: FocusEvent) => void>;
|
|
18
|
+
readonly onFocus: PropType<(event: FocusEvent) => void>;
|
|
19
|
+
readonly onScroll: PropType<MaybeArray<(event: Event) => void>>;
|
|
20
|
+
readonly onScrollOptionEnd: PropType<MaybeArray<OnScrollOptionEnd>>;
|
|
21
|
+
readonly onSearch: PropType<MaybeArray<(value: string) => void>>;
|
|
19
22
|
readonly onLoad: PropType<OnLoad>;
|
|
20
23
|
readonly onUpdateShow: PropType<MaybeArray<(show: boolean) => void>>;
|
|
21
24
|
readonly onUpdateValue: PropType<MaybeArray<OnUpdateValue>>;
|
|
@@ -88,6 +91,7 @@ export declare const treeSelectProps: {
|
|
|
88
91
|
readonly loading: BooleanConstructor;
|
|
89
92
|
readonly maxTagCount: PropType<number | "responsive">;
|
|
90
93
|
readonly multiple: BooleanConstructor;
|
|
94
|
+
readonly remote: BooleanConstructor;
|
|
91
95
|
readonly showPath: BooleanConstructor;
|
|
92
96
|
readonly separator: {
|
|
93
97
|
readonly type: StringConstructor;
|
|
@@ -139,6 +143,8 @@ export declare const treeSelectProps: {
|
|
|
139
143
|
nodeColorPressed: string;
|
|
140
144
|
nodeColorActive: string;
|
|
141
145
|
arrowColor: string;
|
|
146
|
+
switcherColor: string;
|
|
147
|
+
switcherSize: string;
|
|
142
148
|
nodeTextColor: string;
|
|
143
149
|
nodeTextColorDisabled: string;
|
|
144
150
|
loadingColor: string;
|
|
@@ -391,6 +397,8 @@ export declare const treeSelectProps: {
|
|
|
391
397
|
nodeColorPressed: string;
|
|
392
398
|
nodeColorActive: string;
|
|
393
399
|
arrowColor: string;
|
|
400
|
+
switcherColor: string;
|
|
401
|
+
switcherSize: string;
|
|
394
402
|
nodeTextColor: string;
|
|
395
403
|
nodeTextColorDisabled: string;
|
|
396
404
|
loadingColor: string;
|
|
@@ -643,6 +651,8 @@ export declare const treeSelectProps: {
|
|
|
643
651
|
nodeColorPressed: string;
|
|
644
652
|
nodeColorActive: string;
|
|
645
653
|
arrowColor: string;
|
|
654
|
+
switcherColor: string;
|
|
655
|
+
switcherSize: string;
|
|
646
656
|
nodeTextColor: string;
|
|
647
657
|
nodeTextColorDisabled: string;
|
|
648
658
|
loadingColor: string;
|
|
@@ -888,8 +898,11 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
888
898
|
readonly renderPrefix: PropType<TreeSelectRenderPrefix>;
|
|
889
899
|
readonly renderSuffix: PropType<TreeSelectRenderSuffix>;
|
|
890
900
|
readonly nodeProps: PropType<TreeSelectNodeProps>;
|
|
891
|
-
readonly onBlur: PropType<(
|
|
892
|
-
readonly onFocus: PropType<(
|
|
901
|
+
readonly onBlur: PropType<(event: FocusEvent) => void>;
|
|
902
|
+
readonly onFocus: PropType<(event: FocusEvent) => void>;
|
|
903
|
+
readonly onScroll: PropType<MaybeArray<(event: Event) => void>>;
|
|
904
|
+
readonly onScrollOptionEnd: PropType<MaybeArray<OnScrollOptionEnd>>;
|
|
905
|
+
readonly onSearch: PropType<MaybeArray<(value: string) => void>>;
|
|
893
906
|
readonly onLoad: PropType<OnLoad>;
|
|
894
907
|
readonly onUpdateShow: PropType<MaybeArray<(show: boolean) => void>>;
|
|
895
908
|
readonly onUpdateValue: PropType<MaybeArray<OnUpdateValue>>;
|
|
@@ -962,6 +975,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
962
975
|
readonly loading: BooleanConstructor;
|
|
963
976
|
readonly maxTagCount: PropType<number | "responsive">;
|
|
964
977
|
readonly multiple: BooleanConstructor;
|
|
978
|
+
readonly remote: BooleanConstructor;
|
|
965
979
|
readonly showPath: BooleanConstructor;
|
|
966
980
|
readonly separator: {
|
|
967
981
|
readonly type: StringConstructor;
|
|
@@ -1013,6 +1027,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
1013
1027
|
nodeColorPressed: string;
|
|
1014
1028
|
nodeColorActive: string;
|
|
1015
1029
|
arrowColor: string;
|
|
1030
|
+
switcherColor: string;
|
|
1031
|
+
switcherSize: string;
|
|
1016
1032
|
nodeTextColor: string;
|
|
1017
1033
|
nodeTextColorDisabled: string;
|
|
1018
1034
|
loadingColor: string;
|
|
@@ -1265,6 +1281,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
1265
1281
|
nodeColorPressed: string;
|
|
1266
1282
|
nodeColorActive: string;
|
|
1267
1283
|
arrowColor: string;
|
|
1284
|
+
switcherColor: string;
|
|
1285
|
+
switcherSize: string;
|
|
1268
1286
|
nodeTextColor: string;
|
|
1269
1287
|
nodeTextColorDisabled: string;
|
|
1270
1288
|
loadingColor: string;
|
|
@@ -1517,6 +1535,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
1517
1535
|
nodeColorPressed: string;
|
|
1518
1536
|
nodeColorActive: string;
|
|
1519
1537
|
arrowColor: string;
|
|
1538
|
+
switcherColor: string;
|
|
1539
|
+
switcherSize: string;
|
|
1520
1540
|
nodeTextColor: string;
|
|
1521
1541
|
nodeTextColorDisabled: string;
|
|
1522
1542
|
loadingColor: string;
|
|
@@ -1798,9 +1818,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
1798
1818
|
selectedOption: import("vue").ComputedRef<SelectBaseOption<string | number, string | ((option: SelectBaseOption<string | number, string | /*elided*/ any>, selected: boolean) => VNodeChild)> | null>;
|
|
1799
1819
|
selectedOptions: import("vue").ComputedRef<SelectBaseOption<string | number, string | ((option: SelectBaseOption<string | number, string | /*elided*/ any>, selected: boolean) => VNodeChild)>[] | null>;
|
|
1800
1820
|
pattern: import("vue").Ref<string, string>;
|
|
1821
|
+
treePattern: import("vue").ComputedRef<string>;
|
|
1801
1822
|
pendingNodeKey: import("vue").Ref<string | number | null, string | number | null>;
|
|
1802
1823
|
mergedCascade: import("vue").ComputedRef<boolean>;
|
|
1803
|
-
mergedFilter: import("vue").ComputedRef<
|
|
1824
|
+
mergedFilter: import("vue").ComputedRef<FilterHandler>;
|
|
1804
1825
|
selectionRenderTag: import("vue").ComputedRef<(({ option, handleClose }: {
|
|
1805
1826
|
option: SelectOption;
|
|
1806
1827
|
handleClose: () => void;
|
|
@@ -1815,22 +1836,23 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
1815
1836
|
}) => void;
|
|
1816
1837
|
handleMenuLeave: () => void;
|
|
1817
1838
|
handleTriggerClick: () => void;
|
|
1818
|
-
handleMenuClickoutside: (
|
|
1839
|
+
handleMenuClickoutside: (event: MouseEvent) => void;
|
|
1819
1840
|
handleUpdateCheckedKeys: (keys: Key[], _: unknown, meta: {
|
|
1820
1841
|
node: TreeOption | null;
|
|
1821
1842
|
action: "check" | "uncheck";
|
|
1822
1843
|
}) => void;
|
|
1823
1844
|
handleUpdateIndeterminateKeys: (keys: Key[]) => void;
|
|
1824
|
-
handleTriggerFocus: (
|
|
1825
|
-
handleTriggerBlur: (
|
|
1826
|
-
handleMenuFocusin: (
|
|
1827
|
-
handleMenuFocusout: (
|
|
1828
|
-
handleClear: (
|
|
1845
|
+
handleTriggerFocus: (event: FocusEvent) => void;
|
|
1846
|
+
handleTriggerBlur: (event: FocusEvent) => void;
|
|
1847
|
+
handleMenuFocusin: (event: FocusEvent) => void;
|
|
1848
|
+
handleMenuFocusout: (event: FocusEvent) => void;
|
|
1849
|
+
handleClear: (event: MouseEvent) => void;
|
|
1829
1850
|
handleDeleteOption: (option: SelectBaseOption) => void;
|
|
1830
|
-
handlePatternInput: (
|
|
1831
|
-
handleKeydown: (
|
|
1851
|
+
handlePatternInput: (event: InputEvent) => void;
|
|
1852
|
+
handleKeydown: (event: KeyboardEvent) => void;
|
|
1832
1853
|
handleTabOut: () => void;
|
|
1833
|
-
handleMenuMousedown: (
|
|
1854
|
+
handleMenuMousedown: (event: MouseEvent) => void;
|
|
1855
|
+
handleTreeScroll: (event: Event) => void;
|
|
1834
1856
|
mergedTheme: import("vue").ComputedRef<{
|
|
1835
1857
|
common: import("../..").ThemeCommonVars;
|
|
1836
1858
|
self: {
|
|
@@ -1854,6 +1876,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
1854
1876
|
nodeColorPressed: string;
|
|
1855
1877
|
nodeColorActive: string;
|
|
1856
1878
|
arrowColor: string;
|
|
1879
|
+
switcherColor: string;
|
|
1880
|
+
switcherSize: string;
|
|
1857
1881
|
nodeTextColor: string;
|
|
1858
1882
|
nodeTextColorDisabled: string;
|
|
1859
1883
|
loadingColor: string;
|
|
@@ -2228,8 +2252,11 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
2228
2252
|
readonly renderPrefix: PropType<TreeSelectRenderPrefix>;
|
|
2229
2253
|
readonly renderSuffix: PropType<TreeSelectRenderSuffix>;
|
|
2230
2254
|
readonly nodeProps: PropType<TreeSelectNodeProps>;
|
|
2231
|
-
readonly onBlur: PropType<(
|
|
2232
|
-
readonly onFocus: PropType<(
|
|
2255
|
+
readonly onBlur: PropType<(event: FocusEvent) => void>;
|
|
2256
|
+
readonly onFocus: PropType<(event: FocusEvent) => void>;
|
|
2257
|
+
readonly onScroll: PropType<MaybeArray<(event: Event) => void>>;
|
|
2258
|
+
readonly onScrollOptionEnd: PropType<MaybeArray<OnScrollOptionEnd>>;
|
|
2259
|
+
readonly onSearch: PropType<MaybeArray<(value: string) => void>>;
|
|
2233
2260
|
readonly onLoad: PropType<OnLoad>;
|
|
2234
2261
|
readonly onUpdateShow: PropType<MaybeArray<(show: boolean) => void>>;
|
|
2235
2262
|
readonly onUpdateValue: PropType<MaybeArray<OnUpdateValue>>;
|
|
@@ -2302,6 +2329,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
2302
2329
|
readonly loading: BooleanConstructor;
|
|
2303
2330
|
readonly maxTagCount: PropType<number | "responsive">;
|
|
2304
2331
|
readonly multiple: BooleanConstructor;
|
|
2332
|
+
readonly remote: BooleanConstructor;
|
|
2305
2333
|
readonly showPath: BooleanConstructor;
|
|
2306
2334
|
readonly separator: {
|
|
2307
2335
|
readonly type: StringConstructor;
|
|
@@ -2353,6 +2381,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
2353
2381
|
nodeColorPressed: string;
|
|
2354
2382
|
nodeColorActive: string;
|
|
2355
2383
|
arrowColor: string;
|
|
2384
|
+
switcherColor: string;
|
|
2385
|
+
switcherSize: string;
|
|
2356
2386
|
nodeTextColor: string;
|
|
2357
2387
|
nodeTextColorDisabled: string;
|
|
2358
2388
|
loadingColor: string;
|
|
@@ -2605,6 +2635,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
2605
2635
|
nodeColorPressed: string;
|
|
2606
2636
|
nodeColorActive: string;
|
|
2607
2637
|
arrowColor: string;
|
|
2638
|
+
switcherColor: string;
|
|
2639
|
+
switcherSize: string;
|
|
2608
2640
|
nodeTextColor: string;
|
|
2609
2641
|
nodeTextColorDisabled: string;
|
|
2610
2642
|
loadingColor: string;
|
|
@@ -2857,6 +2889,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
2857
2889
|
nodeColorPressed: string;
|
|
2858
2890
|
nodeColorActive: string;
|
|
2859
2891
|
arrowColor: string;
|
|
2892
|
+
switcherColor: string;
|
|
2893
|
+
switcherSize: string;
|
|
2860
2894
|
nodeTextColor: string;
|
|
2861
2895
|
nodeTextColorDisabled: string;
|
|
2862
2896
|
loadingColor: string;
|
|
@@ -3105,6 +3139,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
3105
3139
|
readonly filterable: boolean;
|
|
3106
3140
|
readonly disabledField: string;
|
|
3107
3141
|
readonly clearFilterAfterSelect: boolean;
|
|
3142
|
+
readonly remote: boolean;
|
|
3108
3143
|
readonly cascade: boolean;
|
|
3109
3144
|
readonly leafOnly: boolean;
|
|
3110
3145
|
readonly showPath: boolean;
|
|
@@ -13,6 +13,7 @@ import { createTreeMateOptions, treeSharedProps } from "../../tree/src/Tree.mjs"
|
|
|
13
13
|
import { useMergedCheckStrategy } from "../../tree/src/utils.mjs";
|
|
14
14
|
import { treeSelectLight } from "../styles/index.mjs";
|
|
15
15
|
import { treeSelectInjectionKey } from "./interface.mjs";
|
|
16
|
+
import { scanReachedRootOptions } from "./scroll-option-end.mjs";
|
|
16
17
|
import style from "./styles/index.cssr.mjs";
|
|
17
18
|
import { treeOption2SelectOption, treeOption2SelectOptionWithPath } from "./utils.mjs";
|
|
18
19
|
export const treeSelectProps = Object.assign(Object.assign(Object.assign(Object.assign({}, useTheme.props), {
|
|
@@ -48,6 +49,7 @@ export const treeSelectProps = Object.assign(Object.assign(Object.assign(Object.
|
|
|
48
49
|
loading: Boolean,
|
|
49
50
|
maxTagCount: [String, Number],
|
|
50
51
|
multiple: Boolean,
|
|
52
|
+
remote: Boolean,
|
|
51
53
|
showPath: Boolean,
|
|
52
54
|
separator: {
|
|
53
55
|
type: String,
|
|
@@ -83,6 +85,9 @@ export const treeSelectProps = Object.assign(Object.assign(Object.assign(Object.
|
|
|
83
85
|
nodeProps: Function,
|
|
84
86
|
onBlur: Function,
|
|
85
87
|
onFocus: Function,
|
|
88
|
+
onScroll: [Function, Array],
|
|
89
|
+
onScrollOptionEnd: [Function, Array],
|
|
90
|
+
onSearch: [Function, Array],
|
|
86
91
|
onLoad: Function,
|
|
87
92
|
onUpdateShow: [Function, Array],
|
|
88
93
|
onUpdateValue: [Function, Array],
|
|
@@ -133,20 +138,16 @@ export default defineComponent({
|
|
|
133
138
|
const controlledShowRef = toRef(props, 'show');
|
|
134
139
|
const mergedShowRef = useMergedState(controlledShowRef, uncontrolledShowRef);
|
|
135
140
|
const patternRef = ref('');
|
|
141
|
+
const treePatternRef = computed(() => {
|
|
142
|
+
return props.remote ? '' : patternRef.value;
|
|
143
|
+
});
|
|
136
144
|
const mergedFilterRef = computed(() => {
|
|
137
|
-
|
|
138
|
-
filter
|
|
139
|
-
} = props;
|
|
140
|
-
if (filter) return filter;
|
|
141
|
-
const {
|
|
142
|
-
labelField
|
|
143
|
-
} = props;
|
|
145
|
+
if (props.filter) return props.filter;
|
|
144
146
|
return (pattern, node) => {
|
|
145
147
|
if (!pattern.length) return true;
|
|
146
|
-
return node[labelField].toLowerCase().includes(pattern.toLowerCase());
|
|
148
|
+
return node[props.labelField].toLowerCase().includes(pattern.toLowerCase());
|
|
147
149
|
};
|
|
148
150
|
});
|
|
149
|
-
// used to resolve selected options
|
|
150
151
|
const dataTreeMateRef = computed(() => createTreeMate(props.options, createTreeMateOptions(props.keyField, props.childrenField, props.disabledField, undefined)));
|
|
151
152
|
const {
|
|
152
153
|
value: initMergedValue
|
|
@@ -162,6 +163,7 @@ export default defineComponent({
|
|
|
162
163
|
const controlledExpandedKeysRef = toRef(props, 'expandedKeys');
|
|
163
164
|
const mergedExpandedKeysRef = useMergedState(controlledExpandedKeysRef, uncontrolledExpandedKeysRef);
|
|
164
165
|
const focusedRef = ref(false);
|
|
166
|
+
let visibleRootEndKeys = new Set();
|
|
165
167
|
const mergedPlaceholderRef = computed(() => {
|
|
166
168
|
const {
|
|
167
169
|
placeholder
|
|
@@ -297,19 +299,19 @@ export default defineComponent({
|
|
|
297
299
|
}
|
|
298
300
|
uncontrolledExpandedKeysRef.value = keys;
|
|
299
301
|
}
|
|
300
|
-
function doFocus(
|
|
302
|
+
function doFocus(event) {
|
|
301
303
|
const {
|
|
302
304
|
onFocus
|
|
303
305
|
} = props;
|
|
304
|
-
if (onFocus) onFocus(
|
|
306
|
+
if (onFocus) onFocus(event);
|
|
305
307
|
triggerFormFocus();
|
|
306
308
|
}
|
|
307
|
-
function doBlur(
|
|
309
|
+
function doBlur(event) {
|
|
308
310
|
closeMenu();
|
|
309
311
|
const {
|
|
310
312
|
onBlur
|
|
311
313
|
} = props;
|
|
312
|
-
if (onBlur) onBlur(
|
|
314
|
+
if (onBlur) onBlur(event);
|
|
313
315
|
triggerFormBlur();
|
|
314
316
|
}
|
|
315
317
|
function closeMenu() {
|
|
@@ -326,11 +328,12 @@ export default defineComponent({
|
|
|
326
328
|
}
|
|
327
329
|
function handleMenuLeave() {
|
|
328
330
|
patternRef.value = '';
|
|
331
|
+
visibleRootEndKeys = new Set();
|
|
329
332
|
}
|
|
330
|
-
function handleMenuClickoutside(
|
|
333
|
+
function handleMenuClickoutside(event) {
|
|
331
334
|
var _a;
|
|
332
335
|
if (mergedShowRef.value) {
|
|
333
|
-
if (!((_a = triggerInstRef.value) === null || _a === void 0 ? void 0 : _a.$el.contains(getPreciseEventTarget(
|
|
336
|
+
if (!((_a = triggerInstRef.value) === null || _a === void 0 ? void 0 : _a.$el.contains(getPreciseEventTarget(event)))) {
|
|
334
337
|
// outside select, don't need to return focus
|
|
335
338
|
closeMenu();
|
|
336
339
|
}
|
|
@@ -390,36 +393,36 @@ export default defineComponent({
|
|
|
390
393
|
doUpdateIndeterminateKeys(keys, getOptionsByKeys(keys));
|
|
391
394
|
}
|
|
392
395
|
}
|
|
393
|
-
function handleTriggerFocus(
|
|
396
|
+
function handleTriggerFocus(event) {
|
|
394
397
|
var _a;
|
|
395
|
-
if ((_a = menuElRef.value) === null || _a === void 0 ? void 0 : _a.contains(
|
|
398
|
+
if ((_a = menuElRef.value) === null || _a === void 0 ? void 0 : _a.contains(event.relatedTarget)) return;
|
|
396
399
|
focusedRef.value = true;
|
|
397
|
-
doFocus(
|
|
400
|
+
doFocus(event);
|
|
398
401
|
}
|
|
399
|
-
function handleTriggerBlur(
|
|
402
|
+
function handleTriggerBlur(event) {
|
|
400
403
|
var _a;
|
|
401
|
-
if ((_a = menuElRef.value) === null || _a === void 0 ? void 0 : _a.contains(
|
|
404
|
+
if ((_a = menuElRef.value) === null || _a === void 0 ? void 0 : _a.contains(event.relatedTarget)) return;
|
|
402
405
|
focusedRef.value = false;
|
|
403
|
-
doBlur(
|
|
406
|
+
doBlur(event);
|
|
404
407
|
}
|
|
405
|
-
function handleMenuFocusin(
|
|
408
|
+
function handleMenuFocusin(event) {
|
|
406
409
|
var _a, _b, _c;
|
|
407
|
-
if (((_a = menuElRef.value) === null || _a === void 0 ? void 0 : _a.contains(
|
|
410
|
+
if (((_a = menuElRef.value) === null || _a === void 0 ? void 0 : _a.contains(event.relatedTarget)) || ((_c = (_b = triggerInstRef.value) === null || _b === void 0 ? void 0 : _b.$el) === null || _c === void 0 ? void 0 : _c.contains(event.relatedTarget))) {
|
|
408
411
|
return;
|
|
409
412
|
}
|
|
410
413
|
focusedRef.value = true;
|
|
411
|
-
doFocus(
|
|
414
|
+
doFocus(event);
|
|
412
415
|
}
|
|
413
|
-
function handleMenuFocusout(
|
|
416
|
+
function handleMenuFocusout(event) {
|
|
414
417
|
var _a, _b, _c;
|
|
415
|
-
if (((_a = menuElRef.value) === null || _a === void 0 ? void 0 : _a.contains(
|
|
418
|
+
if (((_a = menuElRef.value) === null || _a === void 0 ? void 0 : _a.contains(event.relatedTarget)) || ((_c = (_b = triggerInstRef.value) === null || _b === void 0 ? void 0 : _b.$el) === null || _c === void 0 ? void 0 : _c.contains(event.relatedTarget))) {
|
|
416
419
|
return;
|
|
417
420
|
}
|
|
418
421
|
focusedRef.value = false;
|
|
419
|
-
doBlur(
|
|
422
|
+
doBlur(event);
|
|
420
423
|
}
|
|
421
|
-
function handleClear(
|
|
422
|
-
|
|
424
|
+
function handleClear(event) {
|
|
425
|
+
event.stopPropagation();
|
|
423
426
|
const {
|
|
424
427
|
multiple
|
|
425
428
|
} = props;
|
|
@@ -481,24 +484,28 @@ export default defineComponent({
|
|
|
481
484
|
}
|
|
482
485
|
}
|
|
483
486
|
}
|
|
484
|
-
function
|
|
487
|
+
function doSearch(value) {
|
|
488
|
+
props.onSearch && call(props.onSearch, value);
|
|
489
|
+
}
|
|
490
|
+
function handlePatternInput(event) {
|
|
485
491
|
const {
|
|
486
492
|
value
|
|
487
|
-
} =
|
|
493
|
+
} = event.target;
|
|
488
494
|
patternRef.value = value;
|
|
495
|
+
doSearch(value);
|
|
489
496
|
}
|
|
490
|
-
function treeHandleKeydown(
|
|
497
|
+
function treeHandleKeydown(event) {
|
|
491
498
|
const {
|
|
492
499
|
value: treeInst
|
|
493
500
|
} = treeInstRef;
|
|
494
501
|
if (treeInst) {
|
|
495
|
-
treeInst.handleKeydown(
|
|
502
|
+
treeInst.handleKeydown(event);
|
|
496
503
|
}
|
|
497
504
|
}
|
|
498
|
-
function handleKeydown(
|
|
499
|
-
if (
|
|
505
|
+
function handleKeydown(event) {
|
|
506
|
+
if (event.key === 'Enter') {
|
|
500
507
|
if (mergedShowRef.value) {
|
|
501
|
-
treeHandleKeydown(
|
|
508
|
+
treeHandleKeydown(event);
|
|
502
509
|
if (!props.multiple) {
|
|
503
510
|
closeMenu();
|
|
504
511
|
focusSelection();
|
|
@@ -506,17 +513,17 @@ export default defineComponent({
|
|
|
506
513
|
} else {
|
|
507
514
|
openMenu();
|
|
508
515
|
}
|
|
509
|
-
|
|
510
|
-
} else if (
|
|
516
|
+
event.preventDefault();
|
|
517
|
+
} else if (event.key === 'Escape') {
|
|
511
518
|
if (mergedShowRef.value) {
|
|
512
|
-
markEventEffectPerformed(
|
|
519
|
+
markEventEffectPerformed(event);
|
|
513
520
|
closeMenu();
|
|
514
521
|
focusSelection();
|
|
515
522
|
}
|
|
516
523
|
} else {
|
|
517
524
|
if (mergedShowRef.value) {
|
|
518
|
-
treeHandleKeydown(
|
|
519
|
-
} else if (
|
|
525
|
+
treeHandleKeydown(event);
|
|
526
|
+
} else if (event.key === 'ArrowDown') {
|
|
520
527
|
openMenu();
|
|
521
528
|
}
|
|
522
529
|
}
|
|
@@ -525,10 +532,33 @@ export default defineComponent({
|
|
|
525
532
|
closeMenu();
|
|
526
533
|
focusSelection();
|
|
527
534
|
}
|
|
528
|
-
function handleMenuMousedown(
|
|
535
|
+
function handleMenuMousedown(event) {
|
|
529
536
|
// If there's an action slot later, we need to check if mousedown happens
|
|
530
537
|
// in action panel
|
|
531
|
-
if (!happensIn(
|
|
538
|
+
if (!happensIn(event, 'action')) event.preventDefault();
|
|
539
|
+
}
|
|
540
|
+
function doScroll(event) {
|
|
541
|
+
const {
|
|
542
|
+
onScroll
|
|
543
|
+
} = props;
|
|
544
|
+
if (onScroll) call(onScroll, event);
|
|
545
|
+
}
|
|
546
|
+
function doScrollOptionEnd(option, event) {
|
|
547
|
+
props.onScrollOptionEnd && call(props.onScrollOptionEnd, option, event);
|
|
548
|
+
}
|
|
549
|
+
function handleTreeScroll(event) {
|
|
550
|
+
doScroll(event);
|
|
551
|
+
if (!props.onScrollOptionEnd) return;
|
|
552
|
+
const scrollElement = event.currentTarget || event.target;
|
|
553
|
+
if (!scrollElement) return;
|
|
554
|
+
const {
|
|
555
|
+
reachedOptions,
|
|
556
|
+
visibleKeys
|
|
557
|
+
} = scanReachedRootOptions(scrollElement, dataTreeMateRef.value.treeNodes, mergedExpandedKeysRef.value, visibleRootEndKeys);
|
|
558
|
+
visibleRootEndKeys = visibleKeys;
|
|
559
|
+
for (const reachedOption of reachedOptions) {
|
|
560
|
+
doScrollOptionEnd(reachedOption, event);
|
|
561
|
+
}
|
|
532
562
|
}
|
|
533
563
|
const selectionRenderTagRef = computed(() => {
|
|
534
564
|
const {
|
|
@@ -681,6 +711,7 @@ export default defineComponent({
|
|
|
681
711
|
selectedOption: selectedOptionRef,
|
|
682
712
|
selectedOptions: selectedOptionsRef,
|
|
683
713
|
pattern: patternRef,
|
|
714
|
+
treePattern: treePatternRef,
|
|
684
715
|
pendingNodeKey: pendingNodeKeyRef,
|
|
685
716
|
mergedCascade: mergedCascadeRef,
|
|
686
717
|
mergedFilter: mergedFilterRef,
|
|
@@ -702,6 +733,7 @@ export default defineComponent({
|
|
|
702
733
|
handleKeydown,
|
|
703
734
|
handleTabOut,
|
|
704
735
|
handleMenuMousedown,
|
|
736
|
+
handleTreeScroll,
|
|
705
737
|
mergedTheme: themeRef,
|
|
706
738
|
cssVars: inlineThemeDisabled ? undefined : cssVarsRef,
|
|
707
739
|
themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass,
|
|
@@ -795,7 +827,7 @@ export default defineComponent({
|
|
|
795
827
|
allowCheckingNotLoaded: this.allowCheckingNotLoaded,
|
|
796
828
|
showIrrelevantNodes: false,
|
|
797
829
|
animated: false,
|
|
798
|
-
pattern: this.
|
|
830
|
+
pattern: this.treePattern,
|
|
799
831
|
filter: this.mergedFilter,
|
|
800
832
|
data: options,
|
|
801
833
|
cancelable: multiple,
|
|
@@ -836,7 +868,8 @@ export default defineComponent({
|
|
|
836
868
|
onLoad: this.onLoad,
|
|
837
869
|
onUpdateCheckedKeys: this.handleUpdateCheckedKeys,
|
|
838
870
|
onUpdateIndeterminateKeys: this.handleUpdateIndeterminateKeys,
|
|
839
|
-
onUpdateExpandedKeys: this.doUpdateExpandedKeys
|
|
871
|
+
onUpdateExpandedKeys: this.doUpdateExpandedKeys,
|
|
872
|
+
onScroll: this.handleTreeScroll
|
|
840
873
|
}), resolveWrappedSlot($slots.action, children => {
|
|
841
874
|
return children ? h("div", {
|
|
842
875
|
class: `${mergedClsPrefix}-tree-select-menu__action`,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TreeMate, TreeNode } from 'treemate';
|
|
1
|
+
import type { Key, TreeMate, TreeNode } from 'treemate';
|
|
2
2
|
import type { HTMLAttributes, Ref, VNodeChild } from 'vue';
|
|
3
3
|
import type { TreeOption, TreeOptionBase } from '../../tree/src/interface';
|
|
4
4
|
export type TreeSelectOption = Omit<TreeOptionBase, 'checkboxDisabled' | 'isLeaf' | 'children'> & {
|
|
@@ -28,6 +28,12 @@ export type OnUpdateValueImpl = (value: string | number | (string | number) | st
|
|
|
28
28
|
}) => void;
|
|
29
29
|
export type OnUpdateIndeterminateKeysImpl = (value: string | number | (string | number) | string[] | number[] | Array<string | number> | null, option: TreeSelectOption | null | Array<TreeSelectOption | null>) => void;
|
|
30
30
|
export type Value = string | number | Array<string | number> | null;
|
|
31
|
+
export type OnScrollOptionEnd = (option: TreeSelectOption, event: Event) => void;
|
|
32
|
+
export type FilterHandler = (pattern: string, node: TreeSelectOption) => boolean;
|
|
33
|
+
export interface ScrollOptionEndScanResult {
|
|
34
|
+
reachedOptions: TreeSelectOption[];
|
|
35
|
+
visibleKeys: Set<Key>;
|
|
36
|
+
}
|
|
31
37
|
export interface TreeSelectInjection {
|
|
32
38
|
pendingNodeKeyRef: Ref<string | number | null>;
|
|
33
39
|
dataTreeMate: Ref<TreeMate<TreeOption>>;
|