@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
package/dist/index.js CHANGED
@@ -11174,7 +11174,7 @@
11174
11174
  * @name has
11175
11175
  * @memberOf SetCache
11176
11176
  * @param {*} value The value to search for.
11177
- * @returns {number} Returns `true` if `value` is found, else `false`.
11177
+ * @returns {boolean} Returns `true` if `value` is found, else `false`.
11178
11178
  */
11179
11179
  function setCacheHas(value) {
11180
11180
  return this.__data__.has(value);
@@ -14810,13 +14810,6 @@
14810
14810
  ))
14811
14811
  );
14812
14812
 
14813
- var SwitcherIcon = vue.defineComponent({
14814
- name: "Switcher",
14815
- render() {
14816
- return /* @__PURE__ */ vue.h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 32 32" }, /* @__PURE__ */ vue.h("path", { d: "M12 8l10 8l-10 8z" }));
14817
- }
14818
- });
14819
-
14820
14813
  var TimeIcon = replaceable(
14821
14814
  "time",
14822
14815
  /* @__PURE__ */ vue.h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512" }, /* @__PURE__ */ vue.h(
@@ -49221,6 +49214,8 @@
49221
49214
  nodeColorPressed: elementsQuaternary,
49222
49215
  nodeColorActive: brandPrimary100,
49223
49216
  arrowColor: elementsPrimary,
49217
+ switcherColor: elementsTertiary,
49218
+ switcherSize: "22px",
49224
49219
  nodeTextColor: textPrimary,
49225
49220
  nodeTextColorDisabled: textSecondary,
49226
49221
  loadingColor: elementsPrimary,
@@ -108203,6 +108198,16 @@
108203
108198
  treeInjectionKey,
108204
108199
  null
108205
108200
  );
108201
+ const renderSwitchIcon = () => {
108202
+ const { value: renderSwitcherIcon } = renderSwitcherIconRef;
108203
+ return /* @__PURE__ */ vue.h(UIconSwitchTransition, null, {
108204
+ default: () => renderSwitcherIcon ? renderSwitcherIcon({
108205
+ expanded: props.expanded,
108206
+ selected: props.selected,
108207
+ option: props.tmNode.rawNode
108208
+ }) : /* @__PURE__ */ vue.h(UBaseIcon, { clsPrefix: props.clsPrefix, key: "switcher" }, { default: () => /* @__PURE__ */ vue.h(ChevronRightIcon, null) })
108209
+ });
108210
+ };
108206
108211
  return () => {
108207
108212
  const { clsPrefix, expanded, hide, indent, onClick } = props;
108208
108213
  return /* @__PURE__ */ vue.h(
@@ -108217,28 +108222,16 @@
108217
108222
  style: { width: `${indent}px` },
108218
108223
  onClick
108219
108224
  },
108220
- /* @__PURE__ */ vue.h("div", { class: `${clsPrefix}-tree-node-switcher__icon` }, /* @__PURE__ */ vue.h(UIconSwitchTransition, null, {
108221
- default: () => {
108222
- if (props.loading) {
108223
- return /* @__PURE__ */ vue.h(
108224
- UBaseLoading,
108225
- {
108226
- clsPrefix,
108227
- key: "loading",
108228
- radius: 85,
108229
- strokeWidth: 20,
108230
- ...spinPropsRef?.value
108231
- }
108232
- );
108233
- }
108234
- const { value: renderSwitcherIcon } = renderSwitcherIconRef;
108235
- return renderSwitcherIcon ? renderSwitcherIcon({
108236
- expanded: props.expanded,
108237
- selected: props.selected,
108238
- option: props.tmNode.rawNode
108239
- }) : /* @__PURE__ */ vue.h(UBaseIcon, { clsPrefix, key: "switcher" }, { default: () => /* @__PURE__ */ vue.h(SwitcherIcon, null) });
108225
+ /* @__PURE__ */ vue.h("div", { class: `${clsPrefix}-tree-node-switcher__icon` }, props.loading ? /* @__PURE__ */ vue.h(
108226
+ UBaseLoading,
108227
+ {
108228
+ clsPrefix,
108229
+ key: "loading",
108230
+ radius: 85,
108231
+ strokeWidth: 20,
108232
+ ...spinPropsRef?.value
108240
108233
  }
108241
- }))
108234
+ ) : renderSwitchIcon())
108242
108235
  );
108243
108236
  };
108244
108237
  }
@@ -108926,19 +108919,20 @@
108926
108919
  vertical-align: bottom;
108927
108920
  `, [cE("icon", `
108928
108921
  position: relative;
108929
- height: 14px;
108930
- width: 14px;
108922
+ height: var(--u-switcher-size);
108923
+ width: var(--u-switcher-size);
108931
108924
  display: flex;
108925
+ align-items: center;
108926
+ justify-content: center;
108927
+ border-radius: 50%;
108932
108928
  color: var(--u-arrow-color);
108933
- transition: color .3s var(--u-bezier);
108929
+ background-color: var(--u-switcher-color);
108930
+ transition:
108931
+ color .3s var(--u-bezier),
108932
+ background-color .3s var(--u-bezier);
108934
108933
  font-size: 14px;
108935
108934
  `, [cB("icon", [iconSwitchTransitionNode]), cB("base-loading", `
108936
108935
  color: var(--u-loading-color);
108937
- position: absolute;
108938
- left: 0;
108939
- top: 0;
108940
- right: 0;
108941
- bottom: 0;
108942
108936
  `, [iconSwitchTransitionNode]), cB("base-icon", [iconSwitchTransitionNode])]), cM("hide", "visibility: hidden;"), cM("expanded", "transform: rotate(90deg);")]), cB("tree-node-checkbox", `
108943
108937
  display: inline-flex;
108944
108938
  height: var(--u-node-content-height);
@@ -109075,7 +109069,7 @@
109075
109069
  scrollbarProps: Object,
109076
109070
  indent: {
109077
109071
  type: Number,
109078
- default: 24
109072
+ default: 36
109079
109073
  },
109080
109074
  allowDrop: {
109081
109075
  type: Function,
@@ -109111,6 +109105,7 @@
109111
109105
  "onUpdate:checkedKeys": [Function, Array],
109112
109106
  onUpdateSelectedKeys: [Function, Array],
109113
109107
  "onUpdate:selectedKeys": [Function, Array],
109108
+ onScroll: [Function, Array],
109114
109109
  ...treeSharedProps,
109115
109110
  // internal props for tree-select
109116
109111
  internalTreeSelect: Boolean,
@@ -109850,8 +109845,8 @@
109850
109845
  }
109851
109846
  doDragLeave({ event, node: node.rawNode });
109852
109847
  }
109853
- function handleDragLeaveTree(e) {
109854
- if (e.target !== e.currentTarget)
109848
+ function handleDragLeaveTree(event) {
109849
+ if (event.target !== event.currentTarget)
109855
109850
  return;
109856
109851
  resetDropState();
109857
109852
  }
@@ -110048,22 +110043,26 @@
110048
110043
  });
110049
110044
  resetDndState();
110050
110045
  }
110051
- function handleScroll() {
110046
+ function doScroll(event) {
110047
+ props.onScroll && call(props.onScroll, event);
110048
+ }
110049
+ function handleScroll(event) {
110052
110050
  syncScrollbar();
110051
+ doScroll(event);
110053
110052
  }
110054
110053
  function handleResize() {
110055
110054
  syncScrollbar();
110056
110055
  }
110057
- function handleFocusout(e) {
110056
+ function handleFocusout(event) {
110058
110057
  if (props.virtualScroll || props.internalScrollable) {
110059
110058
  const { value: scrollbarInst } = scrollbarInstRef;
110060
- if (scrollbarInst?.containerRef?.contains(e.relatedTarget)) {
110059
+ if (scrollbarInst?.containerRef?.contains(event.relatedTarget)) {
110061
110060
  return;
110062
110061
  }
110063
110062
  pendingNodeKeyRef.value = null;
110064
110063
  } else {
110065
110064
  const { value: selfEl } = selfElRef;
110066
- if (selfEl?.contains(e.relatedTarget))
110065
+ if (selfEl?.contains(event.relatedTarget))
110067
110066
  return;
110068
110067
  pendingNodeKeyRef.value = null;
110069
110068
  }
@@ -110176,6 +110175,8 @@
110176
110175
  nodeColorPressed,
110177
110176
  nodeColorActive,
110178
110177
  arrowColor,
110178
+ switcherColor,
110179
+ switcherSize,
110179
110180
  loadingColor,
110180
110181
  nodeTextColor,
110181
110182
  nodeTextColorDisabled,
@@ -110192,6 +110193,8 @@
110192
110193
  );
110193
110194
  return {
110194
110195
  "--u-arrow-color": arrowColor,
110196
+ "--u-switcher-color": switcherColor,
110197
+ "--u-switcher-size": switcherSize,
110195
110198
  "--u-loading-color": loadingColor,
110196
110199
  "--u-bezier": cubicBezierEaseInOut,
110197
110200
  "--u-font-size": fontSize,
@@ -110340,6 +110343,7 @@
110340
110343
  ...scrollbarProps,
110341
110344
  class: treeClass,
110342
110345
  tabindex,
110346
+ onScroll: this.handleScroll,
110343
110347
  onKeydown: mergedFocusable ? handleKeydown : void 0,
110344
110348
  onFocusout: mergedFocusable ? handleFocusout : void 0,
110345
110349
  style: this.cssVars,
@@ -110383,6 +110387,34 @@
110383
110387
  }
110384
110388
  });
110385
110389
 
110390
+ function isVerticallyVisibleWithin(element, containerRect) {
110391
+ const elementRect = element.getBoundingClientRect();
110392
+ return elementRect.top < containerRect.bottom && elementRect.bottom > containerRect.top;
110393
+ }
110394
+ function scanReachedRootOptions(scrollElement, rootNodes, expandedKeys, previousVisibleKeys) {
110395
+ const containerRect = scrollElement.getBoundingClientRect();
110396
+ const visibleKeys = /* @__PURE__ */new Set();
110397
+ const reachedOptions = [];
110398
+ for (const rootNode of rootNodes) {
110399
+ const {
110400
+ children
110401
+ } = rootNode;
110402
+ if (!children?.length || !expandedKeys?.includes(rootNode.key)) continue;
110403
+ const lastChild = children[children.length - 1];
110404
+ const lastChildElement = scrollElement.querySelector(`[data-key="${createDataKey(lastChild.key)}"]`);
110405
+ const isHiddenOrMissing = !lastChildElement || !isVerticallyVisibleWithin(lastChildElement, containerRect);
110406
+ if (isHiddenOrMissing) continue;
110407
+ visibleKeys.add(rootNode.key);
110408
+ if (!previousVisibleKeys.has(rootNode.key)) {
110409
+ reachedOptions.push(rootNode.rawNode);
110410
+ }
110411
+ }
110412
+ return {
110413
+ reachedOptions,
110414
+ visibleKeys
110415
+ };
110416
+ }
110417
+
110386
110418
  var style$2 = c$1([cB("tree-select", `
110387
110419
  z-index: auto;
110388
110420
  outline: none;
@@ -110501,6 +110533,8 @@
110501
110533
  nodeProps: Function,
110502
110534
  onBlur: Function,
110503
110535
  onFocus: Function,
110536
+ onScroll: [Function, Array],
110537
+ onScrollOptionEnd: [Function, Array],
110504
110538
  onLoad: Function,
110505
110539
  onUpdateShow: [Function, Array],
110506
110540
  onUpdateValue: [Function, Array],
@@ -110589,6 +110623,7 @@
110589
110623
  uncontrolledExpandedKeysRef
110590
110624
  );
110591
110625
  const focusedRef = vue.ref(false);
110626
+ let visibleRootEndKeys = /* @__PURE__ */ new Set();
110592
110627
  const mergedPlaceholderRef = vue.computed(() => {
110593
110628
  const { placeholder } = props;
110594
110629
  if (placeholder !== void 0)
@@ -110731,17 +110766,17 @@
110731
110766
  }
110732
110767
  uncontrolledExpandedKeysRef.value = keys;
110733
110768
  }
110734
- function doFocus(e) {
110769
+ function doFocus(event) {
110735
110770
  const { onFocus } = props;
110736
110771
  if (onFocus)
110737
- onFocus(e);
110772
+ onFocus(event);
110738
110773
  triggerFormFocus();
110739
110774
  }
110740
- function doBlur(e) {
110775
+ function doBlur(event) {
110741
110776
  closeMenu();
110742
110777
  const { onBlur } = props;
110743
110778
  if (onBlur)
110744
- onBlur(e);
110779
+ onBlur(event);
110745
110780
  triggerFormBlur();
110746
110781
  }
110747
110782
  function closeMenu() {
@@ -110758,11 +110793,12 @@
110758
110793
  }
110759
110794
  function handleMenuLeave() {
110760
110795
  patternRef.value = "";
110796
+ visibleRootEndKeys = /* @__PURE__ */ new Set();
110761
110797
  }
110762
- function handleMenuClickoutside(e) {
110798
+ function handleMenuClickoutside(event) {
110763
110799
  if (mergedShowRef.value) {
110764
110800
  if (!triggerInstRef.value?.$el.contains(
110765
- getPreciseEventTarget(e)
110801
+ getPreciseEventTarget(event)
110766
110802
  )) {
110767
110803
  closeMenu();
110768
110804
  }
@@ -110810,34 +110846,34 @@
110810
110846
  doUpdateIndeterminateKeys(keys, getOptionsByKeys(keys));
110811
110847
  }
110812
110848
  }
110813
- function handleTriggerFocus(e) {
110814
- if (menuElRef.value?.contains(e.relatedTarget))
110849
+ function handleTriggerFocus(event) {
110850
+ if (menuElRef.value?.contains(event.relatedTarget))
110815
110851
  return;
110816
110852
  focusedRef.value = true;
110817
- doFocus(e);
110853
+ doFocus(event);
110818
110854
  }
110819
- function handleTriggerBlur(e) {
110820
- if (menuElRef.value?.contains(e.relatedTarget))
110855
+ function handleTriggerBlur(event) {
110856
+ if (menuElRef.value?.contains(event.relatedTarget))
110821
110857
  return;
110822
110858
  focusedRef.value = false;
110823
- doBlur(e);
110859
+ doBlur(event);
110824
110860
  }
110825
- function handleMenuFocusin(e) {
110826
- if (menuElRef.value?.contains(e.relatedTarget) || triggerInstRef.value?.$el?.contains(e.relatedTarget)) {
110861
+ function handleMenuFocusin(event) {
110862
+ if (menuElRef.value?.contains(event.relatedTarget) || triggerInstRef.value?.$el?.contains(event.relatedTarget)) {
110827
110863
  return;
110828
110864
  }
110829
110865
  focusedRef.value = true;
110830
- doFocus(e);
110866
+ doFocus(event);
110831
110867
  }
110832
- function handleMenuFocusout(e) {
110833
- if (menuElRef.value?.contains(e.relatedTarget) || triggerInstRef.value?.$el?.contains(e.relatedTarget)) {
110868
+ function handleMenuFocusout(event) {
110869
+ if (menuElRef.value?.contains(event.relatedTarget) || triggerInstRef.value?.$el?.contains(event.relatedTarget)) {
110834
110870
  return;
110835
110871
  }
110836
110872
  focusedRef.value = false;
110837
- doBlur(e);
110873
+ doBlur(event);
110838
110874
  }
110839
- function handleClear(e) {
110840
- e.stopPropagation();
110875
+ function handleClear(event) {
110876
+ event.stopPropagation();
110841
110877
  const { multiple } = props;
110842
110878
  if (!multiple && props.filterable) {
110843
110879
  closeMenu();
@@ -110890,20 +110926,20 @@
110890
110926
  }
110891
110927
  }
110892
110928
  }
110893
- function handlePatternInput(e) {
110894
- const { value } = e.target;
110929
+ function handlePatternInput(event) {
110930
+ const { value } = event.target;
110895
110931
  patternRef.value = value;
110896
110932
  }
110897
- function treeHandleKeydown(e) {
110933
+ function treeHandleKeydown(event) {
110898
110934
  const { value: treeInst } = treeInstRef;
110899
110935
  if (treeInst) {
110900
- treeInst.handleKeydown(e);
110936
+ treeInst.handleKeydown(event);
110901
110937
  }
110902
110938
  }
110903
- function handleKeydown(e) {
110904
- if (e.key === "Enter") {
110939
+ function handleKeydown(event) {
110940
+ if (event.key === "Enter") {
110905
110941
  if (mergedShowRef.value) {
110906
- treeHandleKeydown(e);
110942
+ treeHandleKeydown(event);
110907
110943
  if (!props.multiple) {
110908
110944
  closeMenu();
110909
110945
  focusSelection();
@@ -110911,17 +110947,17 @@
110911
110947
  } else {
110912
110948
  openMenu();
110913
110949
  }
110914
- e.preventDefault();
110915
- } else if (e.key === "Escape") {
110950
+ event.preventDefault();
110951
+ } else if (event.key === "Escape") {
110916
110952
  if (mergedShowRef.value) {
110917
- markEventEffectPerformed(e);
110953
+ markEventEffectPerformed(event);
110918
110954
  closeMenu();
110919
110955
  focusSelection();
110920
110956
  }
110921
110957
  } else {
110922
110958
  if (mergedShowRef.value) {
110923
- treeHandleKeydown(e);
110924
- } else if (e.key === "ArrowDown") {
110959
+ treeHandleKeydown(event);
110960
+ } else if (event.key === "ArrowDown") {
110925
110961
  openMenu();
110926
110962
  }
110927
110963
  }
@@ -110930,9 +110966,35 @@
110930
110966
  closeMenu();
110931
110967
  focusSelection();
110932
110968
  }
110933
- function handleMenuMousedown(e) {
110934
- if (!happensIn(e, "action"))
110935
- e.preventDefault();
110969
+ function handleMenuMousedown(event) {
110970
+ if (!happensIn(event, "action"))
110971
+ event.preventDefault();
110972
+ }
110973
+ function doScroll(event) {
110974
+ const { onScroll } = props;
110975
+ if (onScroll)
110976
+ call(onScroll, event);
110977
+ }
110978
+ function doScrollOptionEnd(option, event) {
110979
+ props.onScrollOptionEnd && call(props.onScrollOptionEnd, option, event);
110980
+ }
110981
+ function handleTreeScroll(event) {
110982
+ doScroll(event);
110983
+ if (!props.onScrollOptionEnd)
110984
+ return;
110985
+ const scrollElement = event.currentTarget || event.target;
110986
+ if (!scrollElement)
110987
+ return;
110988
+ const { reachedOptions, visibleKeys } = scanReachedRootOptions(
110989
+ scrollElement,
110990
+ dataTreeMateRef.value.treeNodes,
110991
+ mergedExpandedKeysRef.value,
110992
+ visibleRootEndKeys
110993
+ );
110994
+ visibleRootEndKeys = visibleKeys;
110995
+ for (const reachedOption of reachedOptions) {
110996
+ doScrollOptionEnd(reachedOption, event);
110997
+ }
110936
110998
  }
110937
110999
  const selectionRenderTagRef = vue.computed(() => {
110938
111000
  const { renderTag } = props;
@@ -111085,6 +111147,7 @@
111085
111147
  handleKeydown,
111086
111148
  handleTabOut,
111087
111149
  handleMenuMousedown,
111150
+ handleTreeScroll,
111088
111151
  mergedTheme: themeRef,
111089
111152
  cssVars: inlineThemeDisabled ? void 0 : cssVarsRef,
111090
111153
  themeClass: themeClassHandle?.themeClass,
@@ -111245,7 +111308,8 @@
111245
111308
  onLoad: this.onLoad,
111246
111309
  onUpdateCheckedKeys: this.handleUpdateCheckedKeys,
111247
111310
  onUpdateIndeterminateKeys: this.handleUpdateIndeterminateKeys,
111248
- onUpdateExpandedKeys: this.doUpdateExpandedKeys
111311
+ onUpdateExpandedKeys: this.doUpdateExpandedKeys,
111312
+ onScroll: this.handleTreeScroll
111249
111313
  }
111250
111314
  ),
111251
111315
  resolveWrappedSlot($slots.action, (children) => {
@@ -113173,7 +113237,7 @@
113173
113237
  });
113174
113238
  }
113175
113239
 
113176
- var version = "2.0.6";
113240
+ var version = "2.0.7";
113177
113241
 
113178
113242
  function create({
113179
113243
  componentPrefix = "U",