@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.
Files changed (48) hide show
  1. package/dist/index.js +145 -81
  2. package/dist/index.mjs +145 -81
  3. package/dist/index.prod.js +2 -2
  4. package/dist/index.prod.mjs +2 -2
  5. package/es/_internal/icons/index.d.ts +0 -1
  6. package/es/_internal/icons/index.mjs +0 -1
  7. package/es/components.d.ts +67 -30
  8. package/es/tree/src/Tree.d.ts +49 -24
  9. package/es/tree/src/Tree.mjs +18 -13
  10. package/es/tree/src/TreeNodeCheckbox.d.ts +4 -0
  11. package/es/tree/src/TreeNodeSwitcher.mjs +24 -26
  12. package/es/tree/src/styles/index.cssr.mjs +11 -8
  13. package/es/tree/styles/light.d.ts +4 -0
  14. package/es/tree/styles/light.mjs +2 -0
  15. package/es/tree-select/index.d.ts +1 -1
  16. package/es/tree-select/src/TreeSelect.d.ts +43 -16
  17. package/es/tree-select/src/TreeSelect.mjs +65 -35
  18. package/es/tree-select/src/interface.d.ts +6 -1
  19. package/es/tree-select/src/scroll-option-end.d.ts +3 -0
  20. package/es/tree-select/src/scroll-option-end.mjs +28 -0
  21. package/es/tree-select/styles/light.d.ts +2 -0
  22. package/es/version.d.ts +1 -1
  23. package/es/version.mjs +1 -1
  24. package/lib/_internal/icons/index.d.ts +0 -1
  25. package/lib/_internal/icons/index.js +1 -3
  26. package/lib/components.d.ts +67 -30
  27. package/lib/tree/src/Tree.d.ts +49 -24
  28. package/lib/tree/src/Tree.js +16 -15
  29. package/lib/tree/src/TreeNodeCheckbox.d.ts +4 -0
  30. package/lib/tree/src/TreeNodeSwitcher.js +11 -14
  31. package/lib/tree/src/styles/index.cssr.js +11 -8
  32. package/lib/tree/styles/light.d.ts +4 -0
  33. package/lib/tree/styles/light.js +2 -0
  34. package/lib/tree-select/index.d.ts +1 -1
  35. package/lib/tree-select/src/TreeSelect.d.ts +43 -16
  36. package/lib/tree-select/src/TreeSelect.js +66 -40
  37. package/lib/tree-select/src/interface.d.ts +6 -1
  38. package/lib/tree-select/src/scroll-option-end.d.ts +3 -0
  39. package/lib/tree-select/src/scroll-option-end.js +30 -0
  40. package/lib/tree-select/styles/light.d.ts +2 -0
  41. package/lib/version.d.ts +1 -1
  42. package/lib/version.js +1 -1
  43. package/package.json +2 -2
  44. package/web-types.json +21 -1
  45. package/es/_internal/icons/Switcher.d.ts +0 -2
  46. package/es/_internal/icons/Switcher.mjs +0 -12
  47. package/lib/_internal/icons/Switcher.d.ts +0 -2
  48. package/lib/_internal/icons/Switcher.js +0 -10
@@ -24,6 +24,16 @@ exports.default = (0, vue_1.defineComponent)({
24
24
  },
25
25
  setup(props) {
26
26
  const { renderSwitcherIconRef, spinPropsRef } = (0, vue_1.inject)(interface_1.treeInjectionKey, null);
27
+ const renderSwitchIcon = () => {
28
+ const { value: renderSwitcherIcon } = renderSwitcherIconRef;
29
+ return ((0, vue_1.h)(_internal_1.UIconSwitchTransition, null, {
30
+ default: () => renderSwitcherIcon ? (renderSwitcherIcon({
31
+ expanded: props.expanded,
32
+ selected: props.selected,
33
+ option: props.tmNode.rawNode
34
+ })) : ((0, vue_1.h)(_internal_1.UBaseIcon, { clsPrefix: props.clsPrefix, key: "switcher" }, { default: () => (0, vue_1.h)(icons_1.ChevronRightIcon, null) }))
35
+ }));
36
+ };
27
37
  return () => {
28
38
  const { clsPrefix, expanded, hide, indent, onClick } = props;
29
39
  return ((0, vue_1.h)("span", { "data-switcher": true, class: [
@@ -31,20 +41,7 @@ exports.default = (0, vue_1.defineComponent)({
31
41
  expanded && `${clsPrefix}-tree-node-switcher--expanded`,
32
42
  hide && `${clsPrefix}-tree-node-switcher--hide`
33
43
  ], style: { width: `${indent}px` }, onClick: onClick },
34
- (0, vue_1.h)("div", { class: `${clsPrefix}-tree-node-switcher__icon` },
35
- (0, vue_1.h)(_internal_1.UIconSwitchTransition, null, {
36
- default: () => {
37
- if (props.loading) {
38
- return ((0, vue_1.h)(_internal_1.UBaseLoading, Object.assign({ clsPrefix: clsPrefix, key: "loading", radius: 85, strokeWidth: 20 }, spinPropsRef === null || spinPropsRef === void 0 ? void 0 : spinPropsRef.value)));
39
- }
40
- const { value: renderSwitcherIcon } = renderSwitcherIconRef;
41
- return renderSwitcherIcon ? (renderSwitcherIcon({
42
- expanded: props.expanded,
43
- selected: props.selected,
44
- option: props.tmNode.rawNode
45
- })) : ((0, vue_1.h)(_internal_1.UBaseIcon, { clsPrefix: clsPrefix, key: "switcher" }, { default: () => (0, vue_1.h)(icons_1.SwitcherIcon, null) }));
46
- }
47
- }))));
44
+ (0, vue_1.h)("div", { class: `${clsPrefix}-tree-node-switcher__icon` }, props.loading ? ((0, vue_1.h)(_internal_1.UBaseLoading, Object.assign({ clsPrefix: clsPrefix, key: "loading", radius: 85, strokeWidth: 20 }, spinPropsRef === null || spinPropsRef === void 0 ? void 0 : spinPropsRef.value))) : (renderSwitchIcon()))));
48
45
  };
49
46
  }
50
47
  });
@@ -9,6 +9,8 @@ const cssr_1 = require("../../../_utils/cssr");
9
9
  const iconSwitchTransitionNode = (0, icon_switch_cssr_1.iconSwitchTransition)();
10
10
  // vars:
11
11
  // --u-arrow-color
12
+ // --u-switcher-color
13
+ // --u-switcher-size
12
14
  // --u-bezier
13
15
  // --u-font-size
14
16
  // --u-node-border-radius
@@ -100,19 +102,20 @@ exports.default = (0, cssr_1.cB)('tree', `
100
102
  vertical-align: bottom;
101
103
  `, [(0, cssr_1.cE)('icon', `
102
104
  position: relative;
103
- height: 14px;
104
- width: 14px;
105
+ height: var(--u-switcher-size);
106
+ width: var(--u-switcher-size);
105
107
  display: flex;
108
+ align-items: center;
109
+ justify-content: center;
110
+ border-radius: 50%;
106
111
  color: var(--u-arrow-color);
107
- transition: color .3s var(--u-bezier);
112
+ background-color: var(--u-switcher-color);
113
+ transition:
114
+ color .3s var(--u-bezier),
115
+ background-color .3s var(--u-bezier);
108
116
  font-size: 14px;
109
117
  `, [(0, cssr_1.cB)('icon', [iconSwitchTransitionNode]), (0, cssr_1.cB)('base-loading', `
110
118
  color: var(--u-loading-color);
111
- position: absolute;
112
- left: 0;
113
- top: 0;
114
- right: 0;
115
- bottom: 0;
116
119
  `, [iconSwitchTransitionNode]), (0, cssr_1.cB)('base-icon', [iconSwitchTransitionNode])]), (0, cssr_1.cM)('hide', 'visibility: hidden;'), (0, cssr_1.cM)('expanded', 'transform: rotate(90deg);')]), (0, cssr_1.cB)('tree-node-checkbox', `
117
120
  display: inline-flex;
118
121
  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/use-theme").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;
@@ -18,6 +18,8 @@ function self(vars) {
18
18
  nodeColorPressed: elementsQuaternary,
19
19
  nodeColorActive: brandPrimary100,
20
20
  arrowColor: elementsPrimary,
21
+ switcherColor: elementsTertiary,
22
+ switcherSize: '22px',
21
23
  nodeTextColor: textPrimary,
22
24
  nodeTextColorDisabled: textSecondary,
23
25
  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<(e: FocusEvent) => void>;
18
- readonly onFocus: PropType<(e: FocusEvent) => void>;
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<(e: FocusEvent) => void>;
892
- readonly onFocus: PropType<(e: FocusEvent) => void>;
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: (e: MouseEvent) => void;
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: (e: FocusEvent) => void;
1825
- handleTriggerBlur: (e: FocusEvent) => void;
1826
- handleMenuFocusin: (e: FocusEvent) => void;
1827
- handleMenuFocusout: (e: FocusEvent) => void;
1828
- handleClear: (e: MouseEvent) => void;
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: (e: InputEvent) => void;
1831
- handleKeydown: (e: KeyboardEvent) => void;
1846
+ handlePatternInput: (event: InputEvent) => void;
1847
+ handleKeydown: (event: KeyboardEvent) => void;
1832
1848
  handleTabOut: () => void;
1833
- handleMenuMousedown: (e: MouseEvent) => void;
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<(e: FocusEvent) => void>;
2232
- readonly onFocus: PropType<(e: FocusEvent) => void>;
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;
@@ -19,6 +19,7 @@ const Tree_1 = require("../../tree/src/Tree");
19
19
  const utils_1 = require("../../tree/src/utils");
20
20
  const styles_1 = require("../styles");
21
21
  const interface_1 = require("./interface");
22
+ const scroll_option_end_1 = require("./scroll-option-end");
22
23
  const index_cssr_1 = __importDefault(require("./styles/index.cssr"));
23
24
  const utils_2 = require("./utils");
24
25
  exports.treeSelectProps = Object.assign(Object.assign(Object.assign(Object.assign({}, _mixins_1.useTheme.props), { bordered: {
@@ -54,7 +55,7 @@ exports.treeSelectProps = Object.assign(Object.assign(Object.assign(Object.assig
54
55
  }, size: String, value: [String, Number, Array], to: _utils_1.useAdjustedTo.propTo, menuProps: Object, virtualScroll: {
55
56
  type: Boolean,
56
57
  default: true
57
- }, status: String, renderTag: Function }), Tree_1.treeSharedProps), { renderLabel: Function, renderPrefix: Function, renderSuffix: Function, nodeProps: Function, onBlur: Function, onFocus: Function, onLoad: Function, onUpdateShow: [Function, Array], onUpdateValue: [Function, Array], 'onUpdate:value': [Function, Array], 'onUpdate:show': [Function, Array],
58
+ }, status: String, renderTag: Function }), Tree_1.treeSharedProps), { renderLabel: Function, renderPrefix: Function, renderSuffix: Function, nodeProps: Function, onBlur: Function, onFocus: Function, onScroll: [Function, Array], onScrollOptionEnd: [Function, Array], onLoad: Function, onUpdateShow: [Function, Array], onUpdateValue: [Function, Array], 'onUpdate:value': [Function, Array], 'onUpdate:show': [Function, Array],
58
59
  /**
59
60
  * @deprecated
60
61
  */
@@ -117,6 +118,7 @@ exports.default = (0, vue_1.defineComponent)({
117
118
  const controlledExpandedKeysRef = (0, vue_1.toRef)(props, 'expandedKeys');
118
119
  const mergedExpandedKeysRef = (0, vooks_1.useMergedState)(controlledExpandedKeysRef, uncontrolledExpandedKeysRef);
119
120
  const focusedRef = (0, vue_1.ref)(false);
121
+ let visibleRootEndKeys = new Set();
120
122
  const mergedPlaceholderRef = (0, vue_1.computed)(() => {
121
123
  const { placeholder } = props;
122
124
  if (placeholder !== undefined)
@@ -232,17 +234,17 @@ exports.default = (0, vue_1.defineComponent)({
232
234
  }
233
235
  uncontrolledExpandedKeysRef.value = keys;
234
236
  }
235
- function doFocus(e) {
237
+ function doFocus(event) {
236
238
  const { onFocus } = props;
237
239
  if (onFocus)
238
- onFocus(e);
240
+ onFocus(event);
239
241
  triggerFormFocus();
240
242
  }
241
- function doBlur(e) {
243
+ function doBlur(event) {
242
244
  closeMenu();
243
245
  const { onBlur } = props;
244
246
  if (onBlur)
245
- onBlur(e);
247
+ onBlur(event);
246
248
  triggerFormBlur();
247
249
  }
248
250
  function closeMenu() {
@@ -259,11 +261,12 @@ exports.default = (0, vue_1.defineComponent)({
259
261
  }
260
262
  function handleMenuLeave() {
261
263
  patternRef.value = '';
264
+ visibleRootEndKeys = new Set();
262
265
  }
263
- function handleMenuClickoutside(e) {
266
+ function handleMenuClickoutside(event) {
264
267
  var _a;
265
268
  if (mergedShowRef.value) {
266
- if (!((_a = triggerInstRef.value) === null || _a === void 0 ? void 0 : _a.$el.contains((0, seemly_1.getPreciseEventTarget)(e)))) {
269
+ if (!((_a = triggerInstRef.value) === null || _a === void 0 ? void 0 : _a.$el.contains((0, seemly_1.getPreciseEventTarget)(event)))) {
267
270
  // outside select, don't need to return focus
268
271
  closeMenu();
269
272
  }
@@ -316,40 +319,40 @@ exports.default = (0, vue_1.defineComponent)({
316
319
  doUpdateIndeterminateKeys(keys, getOptionsByKeys(keys));
317
320
  }
318
321
  }
319
- function handleTriggerFocus(e) {
322
+ function handleTriggerFocus(event) {
320
323
  var _a;
321
- if ((_a = menuElRef.value) === null || _a === void 0 ? void 0 : _a.contains(e.relatedTarget))
324
+ if ((_a = menuElRef.value) === null || _a === void 0 ? void 0 : _a.contains(event.relatedTarget))
322
325
  return;
323
326
  focusedRef.value = true;
324
- doFocus(e);
327
+ doFocus(event);
325
328
  }
326
- function handleTriggerBlur(e) {
329
+ function handleTriggerBlur(event) {
327
330
  var _a;
328
- if ((_a = menuElRef.value) === null || _a === void 0 ? void 0 : _a.contains(e.relatedTarget))
331
+ if ((_a = menuElRef.value) === null || _a === void 0 ? void 0 : _a.contains(event.relatedTarget))
329
332
  return;
330
333
  focusedRef.value = false;
331
- doBlur(e);
334
+ doBlur(event);
332
335
  }
333
- function handleMenuFocusin(e) {
336
+ function handleMenuFocusin(event) {
334
337
  var _a, _b, _c;
335
- if (((_a = menuElRef.value) === null || _a === void 0 ? void 0 : _a.contains(e.relatedTarget))
336
- || ((_c = (_b = triggerInstRef.value) === null || _b === void 0 ? void 0 : _b.$el) === null || _c === void 0 ? void 0 : _c.contains(e.relatedTarget))) {
338
+ if (((_a = menuElRef.value) === null || _a === void 0 ? void 0 : _a.contains(event.relatedTarget))
339
+ || ((_c = (_b = triggerInstRef.value) === null || _b === void 0 ? void 0 : _b.$el) === null || _c === void 0 ? void 0 : _c.contains(event.relatedTarget))) {
337
340
  return;
338
341
  }
339
342
  focusedRef.value = true;
340
- doFocus(e);
343
+ doFocus(event);
341
344
  }
342
- function handleMenuFocusout(e) {
345
+ function handleMenuFocusout(event) {
343
346
  var _a, _b, _c;
344
- if (((_a = menuElRef.value) === null || _a === void 0 ? void 0 : _a.contains(e.relatedTarget))
345
- || ((_c = (_b = triggerInstRef.value) === null || _b === void 0 ? void 0 : _b.$el) === null || _c === void 0 ? void 0 : _c.contains(e.relatedTarget))) {
347
+ if (((_a = menuElRef.value) === null || _a === void 0 ? void 0 : _a.contains(event.relatedTarget))
348
+ || ((_c = (_b = triggerInstRef.value) === null || _b === void 0 ? void 0 : _b.$el) === null || _c === void 0 ? void 0 : _c.contains(event.relatedTarget))) {
346
349
  return;
347
350
  }
348
351
  focusedRef.value = false;
349
- doBlur(e);
352
+ doBlur(event);
350
353
  }
351
- function handleClear(e) {
352
- e.stopPropagation();
354
+ function handleClear(event) {
355
+ event.stopPropagation();
353
356
  const { multiple } = props;
354
357
  if (!multiple && props.filterable) {
355
358
  closeMenu();
@@ -399,20 +402,20 @@ exports.default = (0, vue_1.defineComponent)({
399
402
  }
400
403
  }
401
404
  }
402
- function handlePatternInput(e) {
403
- const { value } = e.target;
405
+ function handlePatternInput(event) {
406
+ const { value } = event.target;
404
407
  patternRef.value = value;
405
408
  }
406
- function treeHandleKeydown(e) {
409
+ function treeHandleKeydown(event) {
407
410
  const { value: treeInst } = treeInstRef;
408
411
  if (treeInst) {
409
- treeInst.handleKeydown(e);
412
+ treeInst.handleKeydown(event);
410
413
  }
411
414
  }
412
- function handleKeydown(e) {
413
- if (e.key === 'Enter') {
415
+ function handleKeydown(event) {
416
+ if (event.key === 'Enter') {
414
417
  if (mergedShowRef.value) {
415
- treeHandleKeydown(e);
418
+ treeHandleKeydown(event);
416
419
  if (!props.multiple) {
417
420
  closeMenu();
418
421
  focusSelection();
@@ -421,20 +424,20 @@ exports.default = (0, vue_1.defineComponent)({
421
424
  else {
422
425
  openMenu();
423
426
  }
424
- e.preventDefault();
427
+ event.preventDefault();
425
428
  }
426
- else if (e.key === 'Escape') {
429
+ else if (event.key === 'Escape') {
427
430
  if (mergedShowRef.value) {
428
- (0, _utils_1.markEventEffectPerformed)(e);
431
+ (0, _utils_1.markEventEffectPerformed)(event);
429
432
  closeMenu();
430
433
  focusSelection();
431
434
  }
432
435
  }
433
436
  else {
434
437
  if (mergedShowRef.value) {
435
- treeHandleKeydown(e);
438
+ treeHandleKeydown(event);
436
439
  }
437
- else if (e.key === 'ArrowDown') {
440
+ else if (event.key === 'ArrowDown') {
438
441
  openMenu();
439
442
  }
440
443
  }
@@ -443,11 +446,33 @@ exports.default = (0, vue_1.defineComponent)({
443
446
  closeMenu();
444
447
  focusSelection();
445
448
  }
446
- function handleMenuMousedown(e) {
449
+ function handleMenuMousedown(event) {
447
450
  // If there's an action slot later, we need to check if mousedown happens
448
451
  // in action panel
449
- if (!(0, seemly_1.happensIn)(e, 'action'))
450
- e.preventDefault();
452
+ if (!(0, seemly_1.happensIn)(event, 'action'))
453
+ event.preventDefault();
454
+ }
455
+ function doScroll(event) {
456
+ const { onScroll } = props;
457
+ if (onScroll)
458
+ (0, _utils_1.call)(onScroll, event);
459
+ }
460
+ function doScrollOptionEnd(option, event) {
461
+ props.onScrollOptionEnd && (0, _utils_1.call)(props.onScrollOptionEnd, option, event);
462
+ }
463
+ function handleTreeScroll(event) {
464
+ doScroll(event);
465
+ if (!props.onScrollOptionEnd)
466
+ return;
467
+ const scrollElement = (event.currentTarget
468
+ || event.target);
469
+ if (!scrollElement)
470
+ return;
471
+ const { reachedOptions, visibleKeys } = (0, scroll_option_end_1.scanReachedRootOptions)(scrollElement, dataTreeMateRef.value.treeNodes, mergedExpandedKeysRef.value, visibleRootEndKeys);
472
+ visibleRootEndKeys = visibleKeys;
473
+ for (const reachedOption of reachedOptions) {
474
+ doScrollOptionEnd(reachedOption, event);
475
+ }
451
476
  }
452
477
  const selectionRenderTagRef = (0, vue_1.computed)(() => {
453
478
  const { renderTag } = props;
@@ -556,7 +581,8 @@ exports.default = (0, vue_1.defineComponent)({
556
581
  handlePatternInput,
557
582
  handleKeydown,
558
583
  handleTabOut,
559
- handleMenuMousedown, mergedTheme: themeRef, cssVars: inlineThemeDisabled ? undefined : cssVarsRef, themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass, onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender });
584
+ handleMenuMousedown,
585
+ handleTreeScroll, mergedTheme: themeRef, cssVars: inlineThemeDisabled ? undefined : cssVarsRef, themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass, onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender });
560
586
  },
561
587
  render() {
562
588
  const { mergedTheme, mergedClsPrefix, $slots } = this;
@@ -586,7 +612,7 @@ exports.default = (0, vue_1.defineComponent)({
586
612
  ], tabindex: 0, onMousedown: this.handleMenuMousedown, onKeydown: this.handleKeydown, onFocusin: this.handleMenuFocusin, onFocusout: this.handleMenuFocusout }),
587
613
  (0, vue_1.h)(tree_1.UTree, { ref: "treeInstRef", blockLine: true, allowCheckingNotLoaded: this.allowCheckingNotLoaded, showIrrelevantNodes: false, animated: false, pattern: this.pattern, filter: this.mergedFilter, data: options, cancelable: multiple, labelField: this.labelField, keyField: this.keyField, disabledField: this.disabledField, childrenField: this.childrenField, theme: mergedTheme.peers.Tree, themeOverrides: mergedTheme.peerOverrides.Tree, defaultExpandAll: this.defaultExpandAll, defaultExpandedKeys: this.defaultExpandedKeys, expandedKeys: this.mergedExpandedKeys, checkedKeys: this.treeCheckedKeys, selectedKeys: this.treeSelectedKeys, checkable: checkable, checkStrategy: this.checkStrategy, cascade: this.mergedCascade, leafOnly: this.leafOnly, multiple: this.multiple, renderLabel: this.renderLabel, renderPrefix: this.renderPrefix, renderSuffix: this.renderSuffix, renderSwitcherIcon: this.renderSwitcherIcon, nodeProps: this.nodeProps, virtualScroll: this.consistentMenuWidth && this.virtualScroll, internalTreeSelect: true, internalUnifySelectCheck: true, internalScrollable: true, internalScrollablePadding: this.menuPadding, internalFocusable: false, internalCheckboxFocusable: false, internalRenderEmpty: () => ((0, vue_1.h)("div", { class: `${mergedClsPrefix}-tree-select-menu__empty` }, (0, _utils_1.resolveSlot)($slots.empty, () => [
588
614
  (0, vue_1.h)(empty_1.UEmpty, { theme: mergedTheme.peers.Empty, themeOverrides: mergedTheme.peerOverrides.Empty })
589
- ]))), onLoad: this.onLoad, onUpdateCheckedKeys: this.handleUpdateCheckedKeys, onUpdateIndeterminateKeys: this.handleUpdateIndeterminateKeys, onUpdateExpandedKeys: this.doUpdateExpandedKeys }),
615
+ ]))), onLoad: this.onLoad, onUpdateCheckedKeys: this.handleUpdateCheckedKeys, onUpdateIndeterminateKeys: this.handleUpdateIndeterminateKeys, onUpdateExpandedKeys: this.doUpdateExpandedKeys, onScroll: this.handleTreeScroll }),
590
616
  (0, _utils_1.resolveWrappedSlot)($slots.action, (children) => {
591
617
  return children ? ((0, vue_1.h)("div", { class: `${mergedClsPrefix}-tree-select-menu__action`, "data-action": true }, children)) : null;
592
618
  }),
@@ -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,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.scanReachedRootOptions = scanReachedRootOptions;
4
+ const _utils_1 = require("../../_utils");
5
+ function isVerticallyVisibleWithin(element, containerRect) {
6
+ const elementRect = element.getBoundingClientRect();
7
+ return (elementRect.top < containerRect.bottom
8
+ && elementRect.bottom > containerRect.top);
9
+ }
10
+ function scanReachedRootOptions(scrollElement, rootNodes, expandedKeys, previousVisibleKeys) {
11
+ const containerRect = scrollElement.getBoundingClientRect();
12
+ const visibleKeys = new Set();
13
+ const reachedOptions = [];
14
+ for (const rootNode of rootNodes) {
15
+ const { children } = rootNode;
16
+ if (!(children === null || children === void 0 ? void 0 : children.length) || !(expandedKeys === null || expandedKeys === void 0 ? void 0 : expandedKeys.includes(rootNode.key)))
17
+ continue;
18
+ const lastChild = children[children.length - 1];
19
+ const lastChildElement = scrollElement.querySelector(`[data-key="${(0, _utils_1.createDataKey)(lastChild.key)}"]`);
20
+ const isHiddenOrMissing = !lastChildElement
21
+ || !isVerticallyVisibleWithin(lastChildElement, containerRect);
22
+ if (isHiddenOrMissing)
23
+ continue;
24
+ visibleKeys.add(rootNode.key);
25
+ if (!previousVisibleKeys.has(rootNode.key)) {
26
+ reachedOptions.push(rootNode.rawNode);
27
+ }
28
+ }
29
+ return { reachedOptions, visibleKeys };
30
+ }
@@ -30,6 +30,8 @@ declare const treeSelectLight: import("../../_mixins/use-theme").Theme<"TreeSele
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/lib/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "2.0.6";
1
+ declare const _default: "2.0.7";
2
2
  export default _default;
package/lib/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = '2.0.6';
3
+ exports.default = '2.0.7';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uzum-tech/ui",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
4
4
  "description": "A Vue 3 Component Library. Fairly Complete, Theme Customizable, Uses TypeScript, Fast",
5
5
  "author": {
6
6
  "name": "KapitalLab",
@@ -59,7 +59,7 @@
59
59
  "build:themes": "tsc -b --force themes/tusimple/tsconfig.esm.json && tsc -b --force themes/tusimple/tsconfig.cjs.json",
60
60
  "build:site": "bash ./scripts/pre-build-site/pre-build-site.sh && NODE_ENV=production NODE_OPTIONS=--max-old-space-size=4096 vite build && bash ./scripts/post-build-site/post-build-site.sh",
61
61
  "clean": "rimraf site lib es dist node_modules/@uzum-tech/ui themes/tusimple/es themes/tusimple/lib",
62
- "release:package": "pnpm run test && pnpm run build:package && npm publish --no-git-checks",
62
+ "release:package": "npm login && pnpm install && pnpm run test && pnpm run build:package && npm publish --no-git-checks",
63
63
  "release:changelog": "tsx scripts/release-changelog.ts",
64
64
  "lint": "pnpm run lint:code && pnpm run lint:type",
65
65
  "lint:type": "pnpm run lint:src-type && pnpm run lint:demo-type",
package/web-types.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "framework": "vue",
4
4
  "name": "@uzum-tech/ui",
5
- "version": "2.0.6",
5
+ "version": "2.0.7",
6
6
  "js-types-syntax": "typescript",
7
7
  "contributions": {
8
8
  "html": {
@@ -15890,6 +15890,26 @@
15890
15890
  "since": "2.27.0"
15891
15891
  }
15892
15892
  },
15893
+ {
15894
+ "name": "scroll",
15895
+ "doc-url": "https://uzum-ui.kapitalbank.uz/en-US/os-theme/components/tree-select",
15896
+ "type": "(e: Event) => void",
15897
+ "description": "Callback fired on every scroll of the options menu. Useful for loading options asynchronously.",
15898
+ "default": "undefined",
15899
+ "description-sections": {
15900
+ "since": "2.0.7"
15901
+ }
15902
+ },
15903
+ {
15904
+ "name": "scroll-option-end",
15905
+ "doc-url": "https://uzum-ui.kapitalbank.uz/en-US/os-theme/components/tree-select",
15906
+ "type": "(option: TreeSelectOption, e: Event) => void",
15907
+ "description": "Callback fired when the last child of a top-level (root) expanded branch becomes visible in the menu. Called per root branch with that root's option.",
15908
+ "default": "undefined",
15909
+ "description-sections": {
15910
+ "since": "2.0.7"
15911
+ }
15912
+ },
15893
15913
  {
15894
15914
  "name": "update:expanded-keys",
15895
15915
  "doc-url": "https://uzum-ui.kapitalbank.uz/en-US/os-theme/components/tree-select",
@@ -1,2 +0,0 @@
1
- declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
- export default _default;