@uzum-tech/ui 2.0.6 → 2.0.7
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 +145 -81
- package/dist/index.mjs +145 -81
- 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 +67 -30
- 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 +43 -16
- package/es/tree-select/src/TreeSelect.mjs +65 -35
- package/es/tree-select/src/interface.d.ts +6 -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 +67 -30
- 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 +43 -16
- package/lib/tree-select/src/TreeSelect.js +66 -40
- package/lib/tree-select/src/interface.d.ts +6 -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 +2 -2
- package/web-types.json +21 -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
|
@@ -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,17 @@ 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 { 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>>;
|
|
19
21
|
readonly onLoad: PropType<OnLoad>;
|
|
20
22
|
readonly onUpdateShow: PropType<MaybeArray<(show: boolean) => void>>;
|
|
21
23
|
readonly onUpdateValue: PropType<MaybeArray<OnUpdateValue>>;
|
|
@@ -139,6 +141,8 @@ export declare const treeSelectProps: {
|
|
|
139
141
|
nodeColorPressed: string;
|
|
140
142
|
nodeColorActive: string;
|
|
141
143
|
arrowColor: string;
|
|
144
|
+
switcherColor: string;
|
|
145
|
+
switcherSize: string;
|
|
142
146
|
nodeTextColor: string;
|
|
143
147
|
nodeTextColorDisabled: string;
|
|
144
148
|
loadingColor: string;
|
|
@@ -391,6 +395,8 @@ export declare const treeSelectProps: {
|
|
|
391
395
|
nodeColorPressed: string;
|
|
392
396
|
nodeColorActive: string;
|
|
393
397
|
arrowColor: string;
|
|
398
|
+
switcherColor: string;
|
|
399
|
+
switcherSize: string;
|
|
394
400
|
nodeTextColor: string;
|
|
395
401
|
nodeTextColorDisabled: string;
|
|
396
402
|
loadingColor: string;
|
|
@@ -643,6 +649,8 @@ export declare const treeSelectProps: {
|
|
|
643
649
|
nodeColorPressed: string;
|
|
644
650
|
nodeColorActive: string;
|
|
645
651
|
arrowColor: string;
|
|
652
|
+
switcherColor: string;
|
|
653
|
+
switcherSize: string;
|
|
646
654
|
nodeTextColor: string;
|
|
647
655
|
nodeTextColorDisabled: string;
|
|
648
656
|
loadingColor: string;
|
|
@@ -888,8 +896,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
888
896
|
readonly renderPrefix: PropType<TreeSelectRenderPrefix>;
|
|
889
897
|
readonly renderSuffix: PropType<TreeSelectRenderSuffix>;
|
|
890
898
|
readonly nodeProps: PropType<TreeSelectNodeProps>;
|
|
891
|
-
readonly onBlur: PropType<(
|
|
892
|
-
readonly onFocus: PropType<(
|
|
899
|
+
readonly onBlur: PropType<(event: FocusEvent) => void>;
|
|
900
|
+
readonly onFocus: PropType<(event: FocusEvent) => void>;
|
|
901
|
+
readonly onScroll: PropType<MaybeArray<(event: Event) => void>>;
|
|
902
|
+
readonly onScrollOptionEnd: PropType<MaybeArray<OnScrollOptionEnd>>;
|
|
893
903
|
readonly onLoad: PropType<OnLoad>;
|
|
894
904
|
readonly onUpdateShow: PropType<MaybeArray<(show: boolean) => void>>;
|
|
895
905
|
readonly onUpdateValue: PropType<MaybeArray<OnUpdateValue>>;
|
|
@@ -1013,6 +1023,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
1013
1023
|
nodeColorPressed: string;
|
|
1014
1024
|
nodeColorActive: string;
|
|
1015
1025
|
arrowColor: string;
|
|
1026
|
+
switcherColor: string;
|
|
1027
|
+
switcherSize: string;
|
|
1016
1028
|
nodeTextColor: string;
|
|
1017
1029
|
nodeTextColorDisabled: string;
|
|
1018
1030
|
loadingColor: string;
|
|
@@ -1265,6 +1277,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
1265
1277
|
nodeColorPressed: string;
|
|
1266
1278
|
nodeColorActive: string;
|
|
1267
1279
|
arrowColor: string;
|
|
1280
|
+
switcherColor: string;
|
|
1281
|
+
switcherSize: string;
|
|
1268
1282
|
nodeTextColor: string;
|
|
1269
1283
|
nodeTextColorDisabled: string;
|
|
1270
1284
|
loadingColor: string;
|
|
@@ -1517,6 +1531,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
1517
1531
|
nodeColorPressed: string;
|
|
1518
1532
|
nodeColorActive: string;
|
|
1519
1533
|
arrowColor: string;
|
|
1534
|
+
switcherColor: string;
|
|
1535
|
+
switcherSize: string;
|
|
1520
1536
|
nodeTextColor: string;
|
|
1521
1537
|
nodeTextColorDisabled: string;
|
|
1522
1538
|
loadingColor: string;
|
|
@@ -1815,22 +1831,23 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
1815
1831
|
}) => void;
|
|
1816
1832
|
handleMenuLeave: () => void;
|
|
1817
1833
|
handleTriggerClick: () => void;
|
|
1818
|
-
handleMenuClickoutside: (
|
|
1834
|
+
handleMenuClickoutside: (event: MouseEvent) => void;
|
|
1819
1835
|
handleUpdateCheckedKeys: (keys: Key[], _: unknown, meta: {
|
|
1820
1836
|
node: TreeOption | null;
|
|
1821
1837
|
action: "check" | "uncheck";
|
|
1822
1838
|
}) => void;
|
|
1823
1839
|
handleUpdateIndeterminateKeys: (keys: Key[]) => void;
|
|
1824
|
-
handleTriggerFocus: (
|
|
1825
|
-
handleTriggerBlur: (
|
|
1826
|
-
handleMenuFocusin: (
|
|
1827
|
-
handleMenuFocusout: (
|
|
1828
|
-
handleClear: (
|
|
1840
|
+
handleTriggerFocus: (event: FocusEvent) => void;
|
|
1841
|
+
handleTriggerBlur: (event: FocusEvent) => void;
|
|
1842
|
+
handleMenuFocusin: (event: FocusEvent) => void;
|
|
1843
|
+
handleMenuFocusout: (event: FocusEvent) => void;
|
|
1844
|
+
handleClear: (event: MouseEvent) => void;
|
|
1829
1845
|
handleDeleteOption: (option: SelectBaseOption) => void;
|
|
1830
|
-
handlePatternInput: (
|
|
1831
|
-
handleKeydown: (
|
|
1846
|
+
handlePatternInput: (event: InputEvent) => void;
|
|
1847
|
+
handleKeydown: (event: KeyboardEvent) => void;
|
|
1832
1848
|
handleTabOut: () => void;
|
|
1833
|
-
handleMenuMousedown: (
|
|
1849
|
+
handleMenuMousedown: (event: MouseEvent) => void;
|
|
1850
|
+
handleTreeScroll: (event: Event) => void;
|
|
1834
1851
|
mergedTheme: import("vue").ComputedRef<{
|
|
1835
1852
|
common: import("../..").ThemeCommonVars;
|
|
1836
1853
|
self: {
|
|
@@ -1854,6 +1871,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
1854
1871
|
nodeColorPressed: string;
|
|
1855
1872
|
nodeColorActive: string;
|
|
1856
1873
|
arrowColor: string;
|
|
1874
|
+
switcherColor: string;
|
|
1875
|
+
switcherSize: string;
|
|
1857
1876
|
nodeTextColor: string;
|
|
1858
1877
|
nodeTextColorDisabled: string;
|
|
1859
1878
|
loadingColor: string;
|
|
@@ -2228,8 +2247,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
2228
2247
|
readonly renderPrefix: PropType<TreeSelectRenderPrefix>;
|
|
2229
2248
|
readonly renderSuffix: PropType<TreeSelectRenderSuffix>;
|
|
2230
2249
|
readonly nodeProps: PropType<TreeSelectNodeProps>;
|
|
2231
|
-
readonly onBlur: PropType<(
|
|
2232
|
-
readonly onFocus: PropType<(
|
|
2250
|
+
readonly onBlur: PropType<(event: FocusEvent) => void>;
|
|
2251
|
+
readonly onFocus: PropType<(event: FocusEvent) => void>;
|
|
2252
|
+
readonly onScroll: PropType<MaybeArray<(event: Event) => void>>;
|
|
2253
|
+
readonly onScrollOptionEnd: PropType<MaybeArray<OnScrollOptionEnd>>;
|
|
2233
2254
|
readonly onLoad: PropType<OnLoad>;
|
|
2234
2255
|
readonly onUpdateShow: PropType<MaybeArray<(show: boolean) => void>>;
|
|
2235
2256
|
readonly onUpdateValue: PropType<MaybeArray<OnUpdateValue>>;
|
|
@@ -2353,6 +2374,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
2353
2374
|
nodeColorPressed: string;
|
|
2354
2375
|
nodeColorActive: string;
|
|
2355
2376
|
arrowColor: string;
|
|
2377
|
+
switcherColor: string;
|
|
2378
|
+
switcherSize: string;
|
|
2356
2379
|
nodeTextColor: string;
|
|
2357
2380
|
nodeTextColorDisabled: string;
|
|
2358
2381
|
loadingColor: string;
|
|
@@ -2605,6 +2628,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
2605
2628
|
nodeColorPressed: string;
|
|
2606
2629
|
nodeColorActive: string;
|
|
2607
2630
|
arrowColor: string;
|
|
2631
|
+
switcherColor: string;
|
|
2632
|
+
switcherSize: string;
|
|
2608
2633
|
nodeTextColor: string;
|
|
2609
2634
|
nodeTextColorDisabled: string;
|
|
2610
2635
|
loadingColor: string;
|
|
@@ -2857,6 +2882,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
2857
2882
|
nodeColorPressed: string;
|
|
2858
2883
|
nodeColorActive: string;
|
|
2859
2884
|
arrowColor: string;
|
|
2885
|
+
switcherColor: string;
|
|
2886
|
+
switcherSize: string;
|
|
2860
2887
|
nodeTextColor: string;
|
|
2861
2888
|
nodeTextColorDisabled: string;
|
|
2862
2889
|
loadingColor: string;
|
|
@@ -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), {
|
|
@@ -83,6 +84,8 @@ export const treeSelectProps = Object.assign(Object.assign(Object.assign(Object.
|
|
|
83
84
|
nodeProps: Function,
|
|
84
85
|
onBlur: Function,
|
|
85
86
|
onFocus: Function,
|
|
87
|
+
onScroll: [Function, Array],
|
|
88
|
+
onScrollOptionEnd: [Function, Array],
|
|
86
89
|
onLoad: Function,
|
|
87
90
|
onUpdateShow: [Function, Array],
|
|
88
91
|
onUpdateValue: [Function, Array],
|
|
@@ -162,6 +165,7 @@ export default defineComponent({
|
|
|
162
165
|
const controlledExpandedKeysRef = toRef(props, 'expandedKeys');
|
|
163
166
|
const mergedExpandedKeysRef = useMergedState(controlledExpandedKeysRef, uncontrolledExpandedKeysRef);
|
|
164
167
|
const focusedRef = ref(false);
|
|
168
|
+
let visibleRootEndKeys = new Set();
|
|
165
169
|
const mergedPlaceholderRef = computed(() => {
|
|
166
170
|
const {
|
|
167
171
|
placeholder
|
|
@@ -297,19 +301,19 @@ export default defineComponent({
|
|
|
297
301
|
}
|
|
298
302
|
uncontrolledExpandedKeysRef.value = keys;
|
|
299
303
|
}
|
|
300
|
-
function doFocus(
|
|
304
|
+
function doFocus(event) {
|
|
301
305
|
const {
|
|
302
306
|
onFocus
|
|
303
307
|
} = props;
|
|
304
|
-
if (onFocus) onFocus(
|
|
308
|
+
if (onFocus) onFocus(event);
|
|
305
309
|
triggerFormFocus();
|
|
306
310
|
}
|
|
307
|
-
function doBlur(
|
|
311
|
+
function doBlur(event) {
|
|
308
312
|
closeMenu();
|
|
309
313
|
const {
|
|
310
314
|
onBlur
|
|
311
315
|
} = props;
|
|
312
|
-
if (onBlur) onBlur(
|
|
316
|
+
if (onBlur) onBlur(event);
|
|
313
317
|
triggerFormBlur();
|
|
314
318
|
}
|
|
315
319
|
function closeMenu() {
|
|
@@ -326,11 +330,12 @@ export default defineComponent({
|
|
|
326
330
|
}
|
|
327
331
|
function handleMenuLeave() {
|
|
328
332
|
patternRef.value = '';
|
|
333
|
+
visibleRootEndKeys = new Set();
|
|
329
334
|
}
|
|
330
|
-
function handleMenuClickoutside(
|
|
335
|
+
function handleMenuClickoutside(event) {
|
|
331
336
|
var _a;
|
|
332
337
|
if (mergedShowRef.value) {
|
|
333
|
-
if (!((_a = triggerInstRef.value) === null || _a === void 0 ? void 0 : _a.$el.contains(getPreciseEventTarget(
|
|
338
|
+
if (!((_a = triggerInstRef.value) === null || _a === void 0 ? void 0 : _a.$el.contains(getPreciseEventTarget(event)))) {
|
|
334
339
|
// outside select, don't need to return focus
|
|
335
340
|
closeMenu();
|
|
336
341
|
}
|
|
@@ -390,36 +395,36 @@ export default defineComponent({
|
|
|
390
395
|
doUpdateIndeterminateKeys(keys, getOptionsByKeys(keys));
|
|
391
396
|
}
|
|
392
397
|
}
|
|
393
|
-
function handleTriggerFocus(
|
|
398
|
+
function handleTriggerFocus(event) {
|
|
394
399
|
var _a;
|
|
395
|
-
if ((_a = menuElRef.value) === null || _a === void 0 ? void 0 : _a.contains(
|
|
400
|
+
if ((_a = menuElRef.value) === null || _a === void 0 ? void 0 : _a.contains(event.relatedTarget)) return;
|
|
396
401
|
focusedRef.value = true;
|
|
397
|
-
doFocus(
|
|
402
|
+
doFocus(event);
|
|
398
403
|
}
|
|
399
|
-
function handleTriggerBlur(
|
|
404
|
+
function handleTriggerBlur(event) {
|
|
400
405
|
var _a;
|
|
401
|
-
if ((_a = menuElRef.value) === null || _a === void 0 ? void 0 : _a.contains(
|
|
406
|
+
if ((_a = menuElRef.value) === null || _a === void 0 ? void 0 : _a.contains(event.relatedTarget)) return;
|
|
402
407
|
focusedRef.value = false;
|
|
403
|
-
doBlur(
|
|
408
|
+
doBlur(event);
|
|
404
409
|
}
|
|
405
|
-
function handleMenuFocusin(
|
|
410
|
+
function handleMenuFocusin(event) {
|
|
406
411
|
var _a, _b, _c;
|
|
407
|
-
if (((_a = menuElRef.value) === null || _a === void 0 ? void 0 : _a.contains(
|
|
412
|
+
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
413
|
return;
|
|
409
414
|
}
|
|
410
415
|
focusedRef.value = true;
|
|
411
|
-
doFocus(
|
|
416
|
+
doFocus(event);
|
|
412
417
|
}
|
|
413
|
-
function handleMenuFocusout(
|
|
418
|
+
function handleMenuFocusout(event) {
|
|
414
419
|
var _a, _b, _c;
|
|
415
|
-
if (((_a = menuElRef.value) === null || _a === void 0 ? void 0 : _a.contains(
|
|
420
|
+
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
421
|
return;
|
|
417
422
|
}
|
|
418
423
|
focusedRef.value = false;
|
|
419
|
-
doBlur(
|
|
424
|
+
doBlur(event);
|
|
420
425
|
}
|
|
421
|
-
function handleClear(
|
|
422
|
-
|
|
426
|
+
function handleClear(event) {
|
|
427
|
+
event.stopPropagation();
|
|
423
428
|
const {
|
|
424
429
|
multiple
|
|
425
430
|
} = props;
|
|
@@ -481,24 +486,24 @@ export default defineComponent({
|
|
|
481
486
|
}
|
|
482
487
|
}
|
|
483
488
|
}
|
|
484
|
-
function handlePatternInput(
|
|
489
|
+
function handlePatternInput(event) {
|
|
485
490
|
const {
|
|
486
491
|
value
|
|
487
|
-
} =
|
|
492
|
+
} = event.target;
|
|
488
493
|
patternRef.value = value;
|
|
489
494
|
}
|
|
490
|
-
function treeHandleKeydown(
|
|
495
|
+
function treeHandleKeydown(event) {
|
|
491
496
|
const {
|
|
492
497
|
value: treeInst
|
|
493
498
|
} = treeInstRef;
|
|
494
499
|
if (treeInst) {
|
|
495
|
-
treeInst.handleKeydown(
|
|
500
|
+
treeInst.handleKeydown(event);
|
|
496
501
|
}
|
|
497
502
|
}
|
|
498
|
-
function handleKeydown(
|
|
499
|
-
if (
|
|
503
|
+
function handleKeydown(event) {
|
|
504
|
+
if (event.key === 'Enter') {
|
|
500
505
|
if (mergedShowRef.value) {
|
|
501
|
-
treeHandleKeydown(
|
|
506
|
+
treeHandleKeydown(event);
|
|
502
507
|
if (!props.multiple) {
|
|
503
508
|
closeMenu();
|
|
504
509
|
focusSelection();
|
|
@@ -506,17 +511,17 @@ export default defineComponent({
|
|
|
506
511
|
} else {
|
|
507
512
|
openMenu();
|
|
508
513
|
}
|
|
509
|
-
|
|
510
|
-
} else if (
|
|
514
|
+
event.preventDefault();
|
|
515
|
+
} else if (event.key === 'Escape') {
|
|
511
516
|
if (mergedShowRef.value) {
|
|
512
|
-
markEventEffectPerformed(
|
|
517
|
+
markEventEffectPerformed(event);
|
|
513
518
|
closeMenu();
|
|
514
519
|
focusSelection();
|
|
515
520
|
}
|
|
516
521
|
} else {
|
|
517
522
|
if (mergedShowRef.value) {
|
|
518
|
-
treeHandleKeydown(
|
|
519
|
-
} else if (
|
|
523
|
+
treeHandleKeydown(event);
|
|
524
|
+
} else if (event.key === 'ArrowDown') {
|
|
520
525
|
openMenu();
|
|
521
526
|
}
|
|
522
527
|
}
|
|
@@ -525,10 +530,33 @@ export default defineComponent({
|
|
|
525
530
|
closeMenu();
|
|
526
531
|
focusSelection();
|
|
527
532
|
}
|
|
528
|
-
function handleMenuMousedown(
|
|
533
|
+
function handleMenuMousedown(event) {
|
|
529
534
|
// If there's an action slot later, we need to check if mousedown happens
|
|
530
535
|
// in action panel
|
|
531
|
-
if (!happensIn(
|
|
536
|
+
if (!happensIn(event, 'action')) event.preventDefault();
|
|
537
|
+
}
|
|
538
|
+
function doScroll(event) {
|
|
539
|
+
const {
|
|
540
|
+
onScroll
|
|
541
|
+
} = props;
|
|
542
|
+
if (onScroll) call(onScroll, event);
|
|
543
|
+
}
|
|
544
|
+
function doScrollOptionEnd(option, event) {
|
|
545
|
+
props.onScrollOptionEnd && call(props.onScrollOptionEnd, option, event);
|
|
546
|
+
}
|
|
547
|
+
function handleTreeScroll(event) {
|
|
548
|
+
doScroll(event);
|
|
549
|
+
if (!props.onScrollOptionEnd) return;
|
|
550
|
+
const scrollElement = event.currentTarget || event.target;
|
|
551
|
+
if (!scrollElement) return;
|
|
552
|
+
const {
|
|
553
|
+
reachedOptions,
|
|
554
|
+
visibleKeys
|
|
555
|
+
} = scanReachedRootOptions(scrollElement, dataTreeMateRef.value.treeNodes, mergedExpandedKeysRef.value, visibleRootEndKeys);
|
|
556
|
+
visibleRootEndKeys = visibleKeys;
|
|
557
|
+
for (const reachedOption of reachedOptions) {
|
|
558
|
+
doScrollOptionEnd(reachedOption, event);
|
|
559
|
+
}
|
|
532
560
|
}
|
|
533
561
|
const selectionRenderTagRef = computed(() => {
|
|
534
562
|
const {
|
|
@@ -702,6 +730,7 @@ export default defineComponent({
|
|
|
702
730
|
handleKeydown,
|
|
703
731
|
handleTabOut,
|
|
704
732
|
handleMenuMousedown,
|
|
733
|
+
handleTreeScroll,
|
|
705
734
|
mergedTheme: themeRef,
|
|
706
735
|
cssVars: inlineThemeDisabled ? undefined : cssVarsRef,
|
|
707
736
|
themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass,
|
|
@@ -836,7 +865,8 @@ export default defineComponent({
|
|
|
836
865
|
onLoad: this.onLoad,
|
|
837
866
|
onUpdateCheckedKeys: this.handleUpdateCheckedKeys,
|
|
838
867
|
onUpdateIndeterminateKeys: this.handleUpdateIndeterminateKeys,
|
|
839
|
-
onUpdateExpandedKeys: this.doUpdateExpandedKeys
|
|
868
|
+
onUpdateExpandedKeys: this.doUpdateExpandedKeys,
|
|
869
|
+
onScroll: this.handleTreeScroll
|
|
840
870
|
}), resolveWrappedSlot($slots.action, children => {
|
|
841
871
|
return children ? h("div", {
|
|
842
872
|
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,11 @@ 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 interface ScrollOptionEndScanResult {
|
|
33
|
+
reachedOptions: TreeSelectOption[];
|
|
34
|
+
visibleKeys: Set<Key>;
|
|
35
|
+
}
|
|
31
36
|
export interface TreeSelectInjection {
|
|
32
37
|
pendingNodeKeyRef: Ref<string | number | null>;
|
|
33
38
|
dataTreeMate: Ref<TreeMate<TreeOption>>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Key } from '../../tree/src/interface';
|
|
2
|
+
import type { ScrollOptionEndScanResult, TreeSelectTmNode } from './interface';
|
|
3
|
+
export declare function scanReachedRootOptions(scrollElement: HTMLElement, rootNodes: TreeSelectTmNode[], expandedKeys: Key[] | undefined, previousVisibleKeys: Set<Key>): ScrollOptionEndScanResult;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createDataKey } from "../../_utils/index.mjs";
|
|
2
|
+
function isVerticallyVisibleWithin(element, containerRect) {
|
|
3
|
+
const elementRect = element.getBoundingClientRect();
|
|
4
|
+
return elementRect.top < containerRect.bottom && elementRect.bottom > containerRect.top;
|
|
5
|
+
}
|
|
6
|
+
export function scanReachedRootOptions(scrollElement, rootNodes, expandedKeys, previousVisibleKeys) {
|
|
7
|
+
const containerRect = scrollElement.getBoundingClientRect();
|
|
8
|
+
const visibleKeys = new Set();
|
|
9
|
+
const reachedOptions = [];
|
|
10
|
+
for (const rootNode of rootNodes) {
|
|
11
|
+
const {
|
|
12
|
+
children
|
|
13
|
+
} = rootNode;
|
|
14
|
+
if (!(children === null || children === void 0 ? void 0 : children.length) || !(expandedKeys === null || expandedKeys === void 0 ? void 0 : expandedKeys.includes(rootNode.key))) continue;
|
|
15
|
+
const lastChild = children[children.length - 1];
|
|
16
|
+
const lastChildElement = scrollElement.querySelector(`[data-key="${createDataKey(lastChild.key)}"]`);
|
|
17
|
+
const isHiddenOrMissing = !lastChildElement || !isVerticallyVisibleWithin(lastChildElement, containerRect);
|
|
18
|
+
if (isHiddenOrMissing) continue;
|
|
19
|
+
visibleKeys.add(rootNode.key);
|
|
20
|
+
if (!previousVisibleKeys.has(rootNode.key)) {
|
|
21
|
+
reachedOptions.push(rootNode.rawNode);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
reachedOptions,
|
|
26
|
+
visibleKeys
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -30,6 +30,8 @@ declare const treeSelectLight: import("../../_mixins").Theme<"TreeSelect", {
|
|
|
30
30
|
nodeColorPressed: string;
|
|
31
31
|
nodeColorActive: string;
|
|
32
32
|
arrowColor: string;
|
|
33
|
+
switcherColor: string;
|
|
34
|
+
switcherSize: string;
|
|
33
35
|
nodeTextColor: string;
|
|
34
36
|
nodeTextColorDisabled: string;
|
|
35
37
|
loadingColor: string;
|
package/es/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "2.0.
|
|
1
|
+
declare const _default: "2.0.7";
|
|
2
2
|
export default _default;
|
package/es/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '2.0.
|
|
1
|
+
export default '2.0.7';
|
|
@@ -55,7 +55,6 @@ export { default as SearchIcon } from './Search';
|
|
|
55
55
|
export { default as SendFilled } from './SendFilled';
|
|
56
56
|
export { default as SiderUnionBorder } from './SiderUnionBorder';
|
|
57
57
|
export { default as SuccessIcon } from './Success';
|
|
58
|
-
export { default as SwitcherIcon } from './Switcher';
|
|
59
58
|
export { default as TimeIcon } from './Time';
|
|
60
59
|
export { default as ToIcon } from './To';
|
|
61
60
|
export { default as TrashIcon } from './Trash';
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.RetryIcon = exports.ResizeSmallIcon = exports.RemoveIcon = exports.Refresh = exports.PhotoIcon = exports.PersonOutline = exports.PersonNote = exports.OzbekFlag = exports.MoreIcon = exports.MdTime = exports.LogoutIcon = exports.InfoOutlineIcon = exports.InfoIcon = exports.InactiveIcon = exports.ForwardIcon = exports.FilterIcon = exports.FileHeart = exports.FileIcon = exports.FastForwardIcon = exports.FastBackwardIcon = exports.EyeOffIcon = exports.EyeIcon = exports.ErrorIcon = exports.EmptyIcon = exports.EditIcon = exports.DragHandleRound = exports.DownloadIcon = exports.DismissCircleIcon = exports.DateIcon = exports.ContentCopy = exports.CloseIcon = exports.ClearSmallIcon = exports.ClearIcon = exports.ChevronRightIcon = exports.ChevronLeftIcon = exports.ChevronDownOutline = exports.ChevronDownFilledIcon = exports.ChevronDownIcon = exports.CheckmarkDoneSharp = exports.CheckmarkCircleIcon = exports.CheckmarkIcon = exports.CancelIcon = exports.BurgerMenuIcon = exports.BackwardIcon = exports.AttachIcon = exports.ArrowUpIcon = exports.ArrowHookUpRight = exports.ArrowDownIcon = exports.ArrowBackIcon = exports.AddIcon = void 0;
|
|
7
|
-
exports.ZoomOutIcon = exports.ZoomInIcon = exports.WarningIcon = exports.TrashIcon = exports.ToIcon = exports.TimeIcon = exports.
|
|
7
|
+
exports.ZoomOutIcon = exports.ZoomInIcon = exports.WarningIcon = exports.TrashIcon = exports.ToIcon = exports.TimeIcon = exports.SuccessIcon = exports.SiderUnionBorder = exports.SendFilled = exports.SearchIcon = exports.RussiaFlag = exports.RotateCounterclockwiseIcon = exports.RotateClockwiseIcon = void 0;
|
|
8
8
|
var Add_1 = require("./Add");
|
|
9
9
|
Object.defineProperty(exports, "AddIcon", { enumerable: true, get: function () { return __importDefault(Add_1).default; } });
|
|
10
10
|
var ArrowBack_1 = require("./ArrowBack");
|
|
@@ -119,8 +119,6 @@ var SiderUnionBorder_1 = require("./SiderUnionBorder");
|
|
|
119
119
|
Object.defineProperty(exports, "SiderUnionBorder", { enumerable: true, get: function () { return __importDefault(SiderUnionBorder_1).default; } });
|
|
120
120
|
var Success_1 = require("./Success");
|
|
121
121
|
Object.defineProperty(exports, "SuccessIcon", { enumerable: true, get: function () { return __importDefault(Success_1).default; } });
|
|
122
|
-
var Switcher_1 = require("./Switcher");
|
|
123
|
-
Object.defineProperty(exports, "SwitcherIcon", { enumerable: true, get: function () { return __importDefault(Switcher_1).default; } });
|
|
124
122
|
var Time_1 = require("./Time");
|
|
125
123
|
Object.defineProperty(exports, "TimeIcon", { enumerable: true, get: function () { return __importDefault(Time_1).default; } });
|
|
126
124
|
var To_1 = require("./To");
|