lew-ui 2.7.68 → 2.7.70

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 CHANGED
@@ -5347,16 +5347,6 @@ function insertChildByKey(tree, key, newChild) {
5347
5347
  }
5348
5348
  return false;
5349
5349
  }
5350
- function findAllChildrenKeys(node) {
5351
- const keys2 = [];
5352
- const traverse = (item) => {
5353
- if (item.key !== void 0)
5354
- keys2.push(item.key);
5355
- item.children?.forEach(traverse);
5356
- };
5357
- node.children?.forEach(traverse);
5358
- return keys2;
5359
- }
5360
5350
  function findNodeByKey(key, tree) {
5361
5351
  const queue = cloneDeep(tree);
5362
5352
  while (queue.length > 0) {
@@ -8469,8 +8459,8 @@ const SortIcon = /* @__PURE__ */ _export_sfc(_sfc_main$11, [["__scopeId", "data-
8469
8459
  const _hoisted_1$P = { class: "lew-table-header" };
8470
8460
  const _hoisted_2$y = { class: "lew-table-tr" };
8471
8461
  const _hoisted_3$r = { class: "lew-table-main" };
8472
- const _hoisted_4$i = { class: "lew-table-tr" };
8473
- const _hoisted_5$g = { class: "lew-table-tr" };
8462
+ const _hoisted_4$h = { class: "lew-table-tr" };
8463
+ const _hoisted_5$f = { class: "lew-table-tr" };
8474
8464
  const _hoisted_6$b = {
8475
8465
  key: 0,
8476
8466
  class: "lew-table-empty"
@@ -8648,8 +8638,10 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
8648
8638
  }));
8649
8639
  const totalColumnWidth = computed(() => {
8650
8640
  let width = sumBy(leafColumns.value, "width");
8651
- if (props.checkable) width += getCheckableWidth.value;
8652
- if (props.sortable) width += getDragColumnWidth.value;
8641
+ if (props.checkable)
8642
+ width += getCheckableWidth.value;
8643
+ if (props.sortable)
8644
+ width += getDragColumnWidth.value;
8653
8645
  return width;
8654
8646
  });
8655
8647
  const fixedWidths = computed(() => {
@@ -8690,7 +8682,8 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
8690
8682
  });
8691
8683
  const columnLevel = computed(() => {
8692
8684
  const findMaxDepth = (columns, currentDepth = 1) => {
8693
- if (!columns || columns.length === 0) return currentDepth;
8685
+ if (!columns || columns.length === 0)
8686
+ return currentDepth;
8694
8687
  let maxDepth = currentDepth;
8695
8688
  for (const col of columns) {
8696
8689
  if (col.children && col.children.length > 0) {
@@ -8883,8 +8876,8 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
8883
8876
  column?.title,
8884
8877
  column.sortable && h(SortIcon, {
8885
8878
  "sort-value": sortValue.value[column.field],
8886
- size: props.size,
8887
- class: "lew-table-sorter"
8879
+ "size": props.size,
8880
+ "class": "lew-table-sorter"
8888
8881
  })
8889
8882
  ]
8890
8883
  }
@@ -8928,7 +8921,8 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
8928
8921
  }
8929
8922
  }
8930
8923
  function updateScrollState() {
8931
- if (!tableRef.value) return;
8924
+ if (!tableRef.value)
8925
+ return;
8932
8926
  const element = tableRef.value;
8933
8927
  const { clientWidth, scrollWidth, scrollLeft } = element;
8934
8928
  if (scrollWidth === clientWidth) {
@@ -9000,7 +8994,8 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
9000
8994
  }
9001
8995
  const handleTableResize = throttle(() => {
9002
8996
  const table = tableRef.value;
9003
- if (!table) return;
8997
+ if (!table)
8998
+ return;
9004
8999
  const newScrollClientWidth = table.clientWidth;
9005
9000
  const newIsScroll = table.scrollWidth > table.clientWidth + 5;
9006
9001
  if (state.scrollClientWidth !== newScrollClientWidth) {
@@ -9058,7 +9053,8 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
9058
9053
  }
9059
9054
  const throttledTooltipUpdate = throttle(updateTooltipPosition, TOOLTIP_THROTTLE_DELAY);
9060
9055
  function dragStart(event, row, index2) {
9061
- if (!props.sortable) return;
9056
+ if (!props.sortable)
9057
+ return;
9062
9058
  initDragState();
9063
9059
  computeTableRowHeight();
9064
9060
  state.dragIndex = index2;
@@ -9143,7 +9139,8 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
9143
9139
  }
9144
9140
  function updateDragTarget(mouseY) {
9145
9141
  state.lastMouseY = mouseY;
9146
- if (!state.dragRowId || Object.keys(state.trPositionsMap).length === 0) return;
9142
+ if (!state.dragRowId || Object.keys(state.trPositionsMap).length === 0)
9143
+ return;
9147
9144
  const dragDistance = Math.abs(state.initialDragY - mouseY);
9148
9145
  const minDragDistance = 5;
9149
9146
  if (dragDistance < minDragDistance) {
@@ -9157,7 +9154,8 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
9157
9154
  }));
9158
9155
  positionEntries.sort((a, b) => a.top - b.top);
9159
9156
  for (const entry of positionEntries) {
9160
- if (entry.id === state.dragRowId) continue;
9157
+ if (entry.id === state.dragRowId)
9158
+ continue;
9161
9159
  const position = entry;
9162
9160
  if (mouseY >= position.top && mouseY <= position.bottom) {
9163
9161
  targetRowId = position.id;
@@ -9167,8 +9165,10 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
9167
9165
  }
9168
9166
  if (!targetRowId) {
9169
9167
  for (let i = 0; i < positionEntries.length - 1; i++) {
9170
- if (positionEntries[i].id === state.dragRowId) continue;
9171
- if (positionEntries[i + 1].id === state.dragRowId) continue;
9168
+ if (positionEntries[i].id === state.dragRowId)
9169
+ continue;
9170
+ if (positionEntries[i + 1].id === state.dragRowId)
9171
+ continue;
9172
9172
  if (mouseY > positionEntries[i].bottom && mouseY < positionEntries[i + 1].top) {
9173
9173
  if (mouseY - positionEntries[i].bottom < positionEntries[i + 1].top - mouseY) {
9174
9174
  targetRowId = positionEntries[i].id;
@@ -9203,7 +9203,8 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
9203
9203
  `;
9204
9204
  }
9205
9205
  const targetPosition = state.trPositionsMap[state.targetRowId];
9206
- if (!targetPosition) return "display: none;";
9206
+ if (!targetPosition)
9207
+ return "display: none;";
9207
9208
  const top2 = state.isAboveTarget ? targetPosition.top : targetPosition.bottom;
9208
9209
  const tableRect = tableRef.value?.getBoundingClientRect();
9209
9210
  const offsetTop = tableRect ? top2 - tableRect.top : 0;
@@ -9222,7 +9223,8 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
9222
9223
  });
9223
9224
  }
9224
9225
  function getRowHeight(row) {
9225
- if (!row || !row._lew_table_tr_id) return "auto";
9226
+ if (!row || !row._lew_table_tr_id)
9227
+ return "auto";
9226
9228
  const height = state.trHeightMap[row._lew_table_tr_id];
9227
9229
  if (!height) {
9228
9230
  const minHeightMap = {
@@ -9435,7 +9437,7 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
9435
9437
  ])
9436
9438
  ], 512)) : createCommentVNode("", true),
9437
9439
  createElementVNode("div", _hoisted_3$r, [
9438
- createElementVNode("div", _hoisted_4$i, [
9440
+ createElementVNode("div", _hoisted_4$h, [
9439
9441
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(nonFixedHeaderColumns), (column) => {
9440
9442
  return openBlock(), createBlock(readerHeaderTd, {
9441
9443
  key: column.field,
@@ -9454,7 +9456,7 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
9454
9456
  ref: fixedRightRef,
9455
9457
  class: "lew-table-fixed-right"
9456
9458
  }, [
9457
- createElementVNode("div", _hoisted_5$g, [
9459
+ createElementVNode("div", _hoisted_5$f, [
9458
9460
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(getFixedHeaderColumns)("right"), (column) => {
9459
9461
  return openBlock(), createBlock(readerHeaderTd, {
9460
9462
  key: column.field,
@@ -9704,6 +9706,250 @@ const treeEmits = {
9704
9706
  loadStart: () => true,
9705
9707
  loadEnd: (text) => text
9706
9708
  };
9709
+ function useDOMCreate(nodeId) {
9710
+ const node = document.getElementById(nodeId);
9711
+ if (node) ;
9712
+ else {
9713
+ const newNode = document.createElement("div");
9714
+ newNode.id = nodeId;
9715
+ document.body.appendChild(newNode);
9716
+ }
9717
+ }
9718
+ function useEventListener(target, event, callback) {
9719
+ onMounted(() => target.addEventListener(event, callback, true));
9720
+ onUnmounted(() => target.removeEventListener(event, callback, true));
9721
+ }
9722
+ function useTreeSelection() {
9723
+ const tree = ref([]);
9724
+ const parentMap = /* @__PURE__ */ new Map();
9725
+ const childrenMap = /* @__PURE__ */ new Map();
9726
+ const allDescendantsMap = /* @__PURE__ */ new Map();
9727
+ const disabledMap = /* @__PURE__ */ new Map();
9728
+ const selectedSet = /* @__PURE__ */ new Set();
9729
+ const indeterminateSet = /* @__PURE__ */ new Set();
9730
+ const selectedKeys = ref([]);
9731
+ const indeterminateKeys = ref([]);
9732
+ function buildMaps() {
9733
+ parentMap.clear();
9734
+ childrenMap.clear();
9735
+ allDescendantsMap.clear();
9736
+ disabledMap.clear();
9737
+ const dfs = (node, parent) => {
9738
+ parentMap.set(node.key, parent);
9739
+ const directChildren = node.children?.map((c) => c.key) || [];
9740
+ childrenMap.set(node.key, directChildren);
9741
+ disabledMap.set(node.key, !!node.disabled);
9742
+ const allDescendants = [];
9743
+ const collectDescendants = (n) => {
9744
+ n.children?.forEach((child) => {
9745
+ allDescendants.push(child.key);
9746
+ collectDescendants(child);
9747
+ });
9748
+ };
9749
+ collectDescendants(node);
9750
+ allDescendantsMap.set(node.key, allDescendants);
9751
+ node.children?.forEach((child) => dfs(child, node.key));
9752
+ };
9753
+ unref(tree).forEach((root2) => dfs(root2, null));
9754
+ }
9755
+ buildMaps();
9756
+ function flush() {
9757
+ selectedKeys.value = Array.from(selectedSet);
9758
+ indeterminateKeys.value = Array.from(indeterminateSet);
9759
+ }
9760
+ function isLeafNode(key) {
9761
+ const children = childrenMap.get(key) || [];
9762
+ return children.length === 0;
9763
+ }
9764
+ function isNodeDisabled(key) {
9765
+ return disabledMap.get(key) || false;
9766
+ }
9767
+ function updateNodeState(key) {
9768
+ const children = childrenMap.get(key) || [];
9769
+ if (children.length === 0) {
9770
+ indeterminateSet.delete(key);
9771
+ return;
9772
+ }
9773
+ const enabledChildren = children.filter((child) => !isNodeDisabled(child));
9774
+ if (enabledChildren.length === 0) {
9775
+ selectedSet.delete(key);
9776
+ indeterminateSet.delete(key);
9777
+ return;
9778
+ }
9779
+ const selectedChildren = enabledChildren.filter((child) => selectedSet.has(child));
9780
+ const indeterminateChildren = enabledChildren.filter((child) => indeterminateSet.has(child));
9781
+ if (selectedChildren.length === enabledChildren.length) {
9782
+ selectedSet.add(key);
9783
+ indeterminateSet.delete(key);
9784
+ } else if (selectedChildren.length > 0 || indeterminateChildren.length > 0) {
9785
+ selectedSet.delete(key);
9786
+ indeterminateSet.add(key);
9787
+ } else {
9788
+ selectedSet.delete(key);
9789
+ indeterminateSet.delete(key);
9790
+ }
9791
+ }
9792
+ function updateAncestors(key) {
9793
+ let parent = parentMap.get(key);
9794
+ while (parent !== void 0 && parent !== null) {
9795
+ updateNodeState(parent);
9796
+ parent = parentMap.get(parent);
9797
+ }
9798
+ }
9799
+ function selectNodeAndDescendants(key) {
9800
+ if (isNodeDisabled(key)) {
9801
+ return;
9802
+ }
9803
+ selectedSet.add(key);
9804
+ indeterminateSet.delete(key);
9805
+ const descendants = allDescendantsMap.get(key) || [];
9806
+ descendants.forEach((descendant) => {
9807
+ if (!isNodeDisabled(descendant)) {
9808
+ selectedSet.add(descendant);
9809
+ indeterminateSet.delete(descendant);
9810
+ }
9811
+ });
9812
+ }
9813
+ function deselectNodeAndDescendants(key) {
9814
+ selectedSet.delete(key);
9815
+ indeterminateSet.delete(key);
9816
+ const descendants = allDescendantsMap.get(key) || [];
9817
+ descendants.forEach((descendant) => {
9818
+ selectedSet.delete(descendant);
9819
+ indeterminateSet.delete(descendant);
9820
+ });
9821
+ }
9822
+ function init({ tree: _tree, keys: keys2 }) {
9823
+ if ((_tree || []).length > 0) {
9824
+ tree.value = _tree;
9825
+ }
9826
+ buildMaps();
9827
+ for (const key of selectedSet) {
9828
+ if (!parentMap.has(key) && !childrenMap.has(key)) {
9829
+ selectedSet.delete(key);
9830
+ }
9831
+ }
9832
+ for (const key of indeterminateSet) {
9833
+ if (!parentMap.has(key) && !childrenMap.has(key)) {
9834
+ indeterminateSet.delete(key);
9835
+ }
9836
+ }
9837
+ recompute();
9838
+ selectedSet.clear();
9839
+ indeterminateSet.clear();
9840
+ if (Array.isArray(keys2)) {
9841
+ keys2.forEach((key) => {
9842
+ if (parentMap.has(key) || childrenMap.has(key)) {
9843
+ if (isNodeDisabled(key)) {
9844
+ return;
9845
+ }
9846
+ selectNodeAndDescendants(key);
9847
+ }
9848
+ });
9849
+ const processedAncestors = /* @__PURE__ */ new Set();
9850
+ keys2.forEach((key) => {
9851
+ if (parentMap.has(key) || childrenMap.has(key)) {
9852
+ let parent = parentMap.get(key);
9853
+ while (parent !== void 0 && parent !== null && !processedAncestors.has(parent)) {
9854
+ updateNodeState(parent);
9855
+ processedAncestors.add(parent);
9856
+ parent = parentMap.get(parent);
9857
+ }
9858
+ }
9859
+ });
9860
+ }
9861
+ flush();
9862
+ }
9863
+ function recompute() {
9864
+ indeterminateSet.clear();
9865
+ const allKeys = Array.from(parentMap.keys());
9866
+ const sortedKeys = allKeys.sort((a, b) => {
9867
+ const aChildren = childrenMap.get(a) || [];
9868
+ const bChildren = childrenMap.get(b) || [];
9869
+ return aChildren.length - bChildren.length;
9870
+ });
9871
+ sortedKeys.forEach((key) => {
9872
+ updateNodeState(key);
9873
+ });
9874
+ flush();
9875
+ }
9876
+ function addKey(key) {
9877
+ if (!parentMap.has(key) && !childrenMap.has(key)) {
9878
+ return;
9879
+ }
9880
+ if (isNodeDisabled(key)) {
9881
+ return;
9882
+ }
9883
+ selectNodeAndDescendants(key);
9884
+ updateAncestors(key);
9885
+ flush();
9886
+ }
9887
+ function removeKey(key) {
9888
+ if (!selectedSet.has(key) && !indeterminateSet.has(key)) {
9889
+ return;
9890
+ }
9891
+ deselectNodeAndDescendants(key);
9892
+ updateAncestors(key);
9893
+ flush();
9894
+ }
9895
+ function toggleKey(key) {
9896
+ if (isNodeDisabled(key)) {
9897
+ return;
9898
+ }
9899
+ if (selectedSet.has(key)) {
9900
+ removeKey(key);
9901
+ } else {
9902
+ addKey(key);
9903
+ }
9904
+ }
9905
+ const isSelected = computed(() => {
9906
+ return (key) => {
9907
+ return selectedKeys.value.includes(key);
9908
+ };
9909
+ });
9910
+ const isIndeterminate = computed(() => {
9911
+ return (key) => {
9912
+ return indeterminateKeys.value.includes(key);
9913
+ };
9914
+ });
9915
+ function getSelectedLeafKeys() {
9916
+ return Array.from(selectedSet).filter((key) => isLeafNode(key));
9917
+ }
9918
+ function findItemsByValues(values) {
9919
+ const foundItems = [];
9920
+ const findInTree = (nodes, targetValues) => {
9921
+ for (const node of nodes) {
9922
+ if (targetValues.includes(node.key)) {
9923
+ const item = {
9924
+ ...node,
9925
+ isLeaf: !node.children || node.children.length === 0
9926
+ };
9927
+ delete item.children;
9928
+ foundItems.push(item);
9929
+ }
9930
+ if (node.children && node.children.length > 0) {
9931
+ findInTree(node.children, targetValues);
9932
+ }
9933
+ }
9934
+ };
9935
+ findInTree(unref(tree), values);
9936
+ return foundItems;
9937
+ }
9938
+ flush();
9939
+ return {
9940
+ selectedKeys,
9941
+ indeterminateKeys,
9942
+ init,
9943
+ addKey,
9944
+ removeKey,
9945
+ toggleKey,
9946
+ isSelected,
9947
+ isIndeterminate,
9948
+ isNodeDisabled,
9949
+ getSelectedLeafKeys,
9950
+ findItemsByValues
9951
+ };
9952
+ }
9707
9953
  const treeModel = {
9708
9954
  modelValue: {
9709
9955
  type: [Array, String],
@@ -9765,7 +10011,7 @@ const treeProps = {
9765
10011
  },
9766
10012
  free: {
9767
10013
  type: Boolean,
9768
- default: true,
10014
+ default: false,
9769
10015
  validator: validators.boolean({
9770
10016
  componentName: "LewTree",
9771
10017
  propName: "free"
@@ -9887,7 +10133,7 @@ const treeItemProps = {
9887
10133
  function findAllNodes(tree = [], keyField = "key") {
9888
10134
  const nodes = /* @__PURE__ */ new Set();
9889
10135
  const traverse = (node) => {
9890
- nodes.add(node[keyField]);
10136
+ nodes.add(String(node[keyField]));
9891
10137
  if (node.children?.length > 0) {
9892
10138
  node.children.forEach((child) => traverse(child));
9893
10139
  }
@@ -9899,7 +10145,7 @@ function findLeafNodes(tree = [], keyField = "key") {
9899
10145
  const leafNodes = /* @__PURE__ */ new Set();
9900
10146
  const traverse = (node) => {
9901
10147
  if (!node.children?.length) {
9902
- leafNodes.add(node[keyField]);
10148
+ leafNodes.add(String(node[keyField]));
9903
10149
  } else {
9904
10150
  node.children.forEach((child) => traverse(child));
9905
10151
  }
@@ -9918,7 +10164,7 @@ function formatTree$1({
9918
10164
  }) {
9919
10165
  return dataSource.map((node, index2) => {
9920
10166
  const { children, ...rest } = node;
9921
- const key = rest[keyField];
10167
+ const key = String(rest[keyField]);
9922
10168
  const label = rest[labelField];
9923
10169
  const keyPaths = [...parentKeyPaths, key];
9924
10170
  const labelPaths = [...parentLabelPaths, label];
@@ -9930,7 +10176,7 @@ function formatTree$1({
9930
10176
  keyPaths,
9931
10177
  labelPaths,
9932
10178
  isLeaf,
9933
- parentKey: parent?.[keyField] ?? null,
10179
+ parentKey: parent?.[keyField] ? String(parent[keyField]) : null,
9934
10180
  level: parentKeyPaths.length,
9935
10181
  parentKeyPaths,
9936
10182
  parentLabelPaths,
@@ -10047,6 +10293,7 @@ const treeItemEmits = {
10047
10293
  change: () => true,
10048
10294
  expand: () => true
10049
10295
  };
10296
+ const TREE_INJECTION_KEY = Symbol("lew-tree");
10050
10297
  const _hoisted_1$O = {
10051
10298
  key: 0,
10052
10299
  class: "lew-tree-item-main"
@@ -10058,91 +10305,50 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent({
10058
10305
  setup(__props, { emit: __emit }) {
10059
10306
  const props = __props;
10060
10307
  const emit = __emit;
10308
+ const treeContext = inject(TREE_INJECTION_KEY);
10061
10309
  const {
10062
10310
  modelValue,
10063
10311
  expandKeys,
10312
+ dataSource,
10313
+ cacheDataSource,
10064
10314
  multiple,
10065
10315
  checkable,
10066
10316
  expandAll,
10067
- _dataSource,
10068
10317
  loadMethod,
10069
10318
  keyField,
10070
10319
  labelField,
10071
10320
  free,
10072
- cacheDataSource
10073
- } = inject("lew-tree");
10321
+ treeSelection
10322
+ } = treeContext;
10074
10323
  const loading = ref(false);
10075
10324
  const loaded = ref(false);
10076
- function areSomeChildrenSelected(node) {
10077
- if (!node.children || node.children.length === 0)
10078
- return false;
10079
- const childKeys = findAllChildrenKeys(node);
10080
- return childKeys.some((key) => modelValue.value.includes(key)) && !childKeys.every((key) => modelValue.value.includes(key));
10081
- }
10082
10325
  function select() {
10083
- if (props.disabled)
10326
+ if (props.disabled || !props.__key)
10084
10327
  return;
10085
- let newModelValue = cloneDeep(modelValue.value);
10328
+ const nodeKey = props.__key;
10086
10329
  if (multiple) {
10087
- const index2 = newModelValue.indexOf(props.__key);
10088
10330
  if (free) {
10331
+ const currentValue = modelValue.value;
10332
+ const newModelValue = Array.isArray(currentValue) ? [...currentValue] : [];
10333
+ const index2 = newModelValue.indexOf(nodeKey);
10089
10334
  if (index2 > -1) {
10090
10335
  newModelValue.splice(index2, 1);
10091
10336
  } else {
10092
- newModelValue.push(props.__key);
10337
+ newModelValue.push(nodeKey);
10093
10338
  }
10339
+ modelValue.value = newModelValue;
10094
10340
  } else {
10095
- if (index2 > -1) {
10096
- newModelValue.splice(index2, 1);
10097
- if (props.extend && props.extend.children && props.extend.children.length > 0) {
10098
- const childKeys = findAllChildrenKeys(props.extend);
10099
- newModelValue = newModelValue.filter(
10100
- (key) => !childKeys.includes(key)
10101
- );
10102
- }
10103
- if (props.extend && props.extend.parentKeyPaths && props.extend.parentKeyPaths.length > 0) {
10104
- props.extend.parentKeyPaths.forEach((parentKey) => {
10105
- const parentIndex = newModelValue.indexOf(parentKey);
10106
- if (parentIndex > -1) {
10107
- newModelValue.splice(parentIndex, 1);
10108
- }
10109
- });
10110
- }
10111
- } else {
10112
- newModelValue.push(props.__key);
10113
- if (props.extend && props.extend.children && props.extend.children.length > 0) {
10114
- const childKeys = findAllChildrenKeys(props.extend);
10115
- childKeys.forEach((key) => {
10116
- if (!newModelValue.includes(key)) {
10117
- newModelValue.push(key);
10118
- }
10119
- });
10120
- }
10121
- }
10122
- if (props.extend && props.extend.parentKey && props.extend.parentKeyPaths) {
10123
- const parentKey = props.extend.parentKey;
10124
- const parentNode = findNodeByKey(parentKey, _dataSource.value);
10125
- const siblingKeys = (parentNode?.children || []).map((e) => e.key);
10126
- if (siblingKeys.length > 0 && siblingKeys.every((key) => newModelValue.includes(key))) {
10127
- if (!newModelValue.includes(parentKey)) {
10128
- newModelValue.push(parentKey);
10129
- }
10130
- } else {
10131
- newModelValue = newModelValue.filter(
10132
- (key) => key !== parentKey
10133
- );
10134
- }
10135
- }
10341
+ treeSelection?.toggleKey(nodeKey);
10136
10342
  }
10137
10343
  } else {
10138
- newModelValue = props.__key;
10344
+ modelValue.value = nodeKey;
10139
10345
  }
10140
- modelValue.value = newModelValue;
10141
10346
  emit("change");
10142
10347
  }
10143
10348
  async function expand() {
10144
- if (!props.isLeaf) {
10145
- const index2 = expandKeys.value.indexOf(props.__key);
10349
+ if (!props.isLeaf && props.__key) {
10350
+ const nodeKey = props.__key;
10351
+ const index2 = expandKeys.value.indexOf(nodeKey);
10146
10352
  if (index2 > -1) {
10147
10353
  expandKeys.value.splice(index2, 1);
10148
10354
  } else if (loadMethod && !loading.value && !loaded.value) {
@@ -10150,8 +10356,8 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent({
10150
10356
  const _tree = await loadMethod(
10151
10357
  cloneDeep({
10152
10358
  ...props,
10153
- key: props.__key,
10154
- value: props.__key,
10359
+ key: nodeKey,
10360
+ value: nodeKey,
10155
10361
  extend: props.extend
10156
10362
  })
10157
10363
  ) || [];
@@ -10163,45 +10369,51 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent({
10163
10369
  });
10164
10370
  if (status === "success") {
10165
10371
  loaded.value = true;
10166
- insertChildByKey(_dataSource.value, props.__key, result);
10167
- _dataSource.value = formatTree$1({
10168
- dataSource: _dataSource.value,
10372
+ insertChildByKey(dataSource.value, nodeKey, result);
10373
+ dataSource.value = formatTree$1({
10374
+ dataSource: dataSource.value,
10169
10375
  keyField,
10170
10376
  labelField,
10171
10377
  free
10172
10378
  });
10173
- cacheDataSource.value = cloneDeep(_dataSource.value);
10174
- expandKeys.value = [...expandKeys.value, props.__key];
10379
+ cacheDataSource.value = cloneDeep(dataSource.value);
10380
+ expandKeys.value = [...expandKeys.value, nodeKey];
10175
10381
  } else {
10176
10382
  loaded.value = false;
10177
10383
  LewMessage.error(error.message);
10178
10384
  }
10179
10385
  loading.value = false;
10180
10386
  } else {
10181
- expandKeys.value.push(props.__key);
10387
+ expandKeys.value.push(nodeKey);
10182
10388
  }
10183
10389
  }
10184
10390
  expandKeys.value = cloneDeep(expandKeys.value);
10185
10391
  emit("expand");
10186
10392
  }
10187
10393
  const isNodeSelected = computed(() => {
10394
+ if (!props.__key)
10395
+ return false;
10188
10396
  if (multiple) {
10189
- return modelValue.value.includes(props.__key);
10397
+ if (free) {
10398
+ return modelValue.value?.includes(props.__key) || false;
10399
+ } else {
10400
+ return treeSelection?.isSelected(props.__key) || false;
10401
+ }
10190
10402
  } else {
10191
10403
  return modelValue.value === props.__key;
10192
10404
  }
10193
10405
  });
10194
10406
  const isNodePartiallySelected = computed(() => {
10195
- if (!multiple || free)
10407
+ if (!multiple || free || !props.__key)
10196
10408
  return false;
10197
- return props.extend && areSomeChildrenSelected(props.extend);
10409
+ return treeSelection?.isIndeterminate(props.__key) || false;
10198
10410
  });
10199
10411
  return (_ctx, _cache) => {
10200
10412
  return openBlock(), createElementBlock(Fragment, null, [
10201
10413
  createElementVNode("div", {
10202
10414
  class: normalizeClass(["lew-tree-item", {
10203
10415
  "lew-tree-item-expand-all": unref(expandAll),
10204
- "lew-tree-item-expand": (unref(expandKeys) || []).includes(_ctx.__key),
10416
+ "lew-tree-item-expand": _ctx.__key ? (unref(expandKeys) || []).includes(_ctx.__key) : false,
10205
10417
  "lew-tree-item-certain": unref(isNodePartiallySelected),
10206
10418
  "lew-tree-item-selected": unref(isNodeSelected),
10207
10419
  "lew-tree-item-leaf": _ctx.isLeaf,
@@ -10257,7 +10469,7 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent({
10257
10469
  ], 2),
10258
10470
  !_ctx.isLeaf ? (openBlock(), createBlock(unref(_sfc_main$1a), { key: 0 }, {
10259
10471
  default: withCtx(() => [
10260
- (unref(expandKeys) || []).length > 0 && unref(expandKeys).includes(_ctx.__key) || unref(expandAll) ? (openBlock(), createElementBlock("div", _hoisted_1$O, [
10472
+ (unref(expandKeys) || []).length > 0 && _ctx.__key && unref(expandKeys).includes(_ctx.__key) || unref(expandAll) ? (openBlock(), createElementBlock("div", _hoisted_1$O, [
10261
10473
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
10262
10474
  ])) : createCommentVNode("", true)
10263
10475
  ]),
@@ -10267,12 +10479,11 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent({
10267
10479
  };
10268
10480
  }
10269
10481
  });
10270
- const LewTreeItem = /* @__PURE__ */ _export_sfc(_sfc_main$$, [["__scopeId", "data-v-c9c35953"]]);
10482
+ const LewTreeItem = /* @__PURE__ */ _export_sfc(_sfc_main$$, [["__scopeId", "data-v-cd8b4ad5"]]);
10271
10483
  const _hoisted_1$N = {
10272
10484
  key: 0,
10273
10485
  class: "lew-result-count"
10274
10486
  };
10275
- const DEBOUNCE_TIME = 250;
10276
10487
  const _sfc_main$_ = /* @__PURE__ */ defineComponent({
10277
10488
  __name: "LewTree",
10278
10489
  props: /* @__PURE__ */ mergeModels(treeProps, {
@@ -10287,30 +10498,52 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent({
10287
10498
  const emit = __emit;
10288
10499
  const modelValue = useModel(__props, "modelValue");
10289
10500
  const expandKeys = useModel(__props, "expandKeys");
10290
- const _dataSource = ref([]);
10501
+ const dataSource = ref([]);
10291
10502
  const loading = ref(false);
10292
10503
  const keyword = ref("");
10293
10504
  const lastSearchKeyword = ref("");
10294
- const searchTimer = ref(null);
10295
10505
  const cacheDataSource = ref([]);
10296
- provide("lew-tree", {
10297
- modelValue,
10298
- expandKeys,
10506
+ let isInternalUpdate = false;
10507
+ const {
10508
+ selectedKeys,
10509
+ init: initTreeSelection,
10510
+ isSelected,
10511
+ isIndeterminate,
10512
+ toggleKey,
10513
+ addKey,
10514
+ removeKey,
10515
+ findItemsByValues
10516
+ } = useTreeSelection();
10517
+ const treeContext = {
10518
+ // 只读配置
10299
10519
  multiple: props.multiple,
10300
10520
  checkable: props.checkable,
10301
10521
  expandAll: props.expandAll,
10302
10522
  free: props.free,
10303
10523
  showLine: props.showLine,
10304
- loadMethod: props.loadMethod,
10524
+ onlyLeafSelectable: props.onlyLeafSelectable,
10305
10525
  keyField: props.keyField,
10306
10526
  labelField: props.labelField,
10307
- onlyLeafSelectable: props.onlyLeafSelectable,
10527
+ // 状态 refs
10528
+ modelValue,
10529
+ expandKeys,
10530
+ dataSource,
10308
10531
  cacheDataSource,
10309
- _dataSource
10310
- });
10532
+ // 方法
10533
+ loadMethod: props.loadMethod,
10534
+ // Tree Selection - 只在多选且非 free 模式下提供
10535
+ treeSelection: props.multiple && !props.free ? {
10536
+ isSelected: isSelected.value,
10537
+ isIndeterminate: isIndeterminate.value,
10538
+ toggleKey,
10539
+ addKey,
10540
+ removeKey
10541
+ } : void 0
10542
+ };
10543
+ provide(TREE_INJECTION_KEY, treeContext);
10311
10544
  const getResultText = computed(() => {
10312
- return _dataSource.value.length > 0 ? locale.t("tree.resultCount", {
10313
- num: numFormat(_dataSource.value.length)
10545
+ return dataSource.value.length > 0 ? locale.t("tree.resultCount", {
10546
+ num: numFormat(dataSource.value.length)
10314
10547
  }) : "";
10315
10548
  });
10316
10549
  function renderMenuTreeItem(item, level = 0) {
@@ -10325,7 +10558,12 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent({
10325
10558
  isLeaf: isLeaf !== void 0 ? isLeaf : (children || []).length === 0,
10326
10559
  disabled,
10327
10560
  extend: item,
10328
- onChange: () => emit("change", cloneDeep({ extend: item, key, value: key })),
10561
+ onChange: () => {
10562
+ nextTick(() => {
10563
+ const value = props.multiple ? modelValue.value : key;
10564
+ emit("change", cloneDeep({ extend: item, key, value }));
10565
+ });
10566
+ },
10329
10567
  onExpand: () => emit("expand", cloneDeep({ extend: item, key, value: key }))
10330
10568
  },
10331
10569
  () => (item.children || []).map(
@@ -10333,9 +10571,32 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent({
10333
10571
  )
10334
10572
  );
10335
10573
  }
10574
+ function updateModelValue() {
10575
+ isInternalUpdate = true;
10576
+ if (!props.multiple) {
10577
+ modelValue.value = selectedKeys.value[0] || void 0;
10578
+ } else if (props.onlyLeafSelectable) {
10579
+ const items = findItemsByValues(selectedKeys.value).filter(
10580
+ (item) => item.isLeaf
10581
+ );
10582
+ modelValue.value = items.map((item) => item.key);
10583
+ } else {
10584
+ modelValue.value = cloneDeep(selectedKeys.value);
10585
+ }
10586
+ nextTick(() => {
10587
+ isInternalUpdate = false;
10588
+ });
10589
+ }
10590
+ function initTreeStructure() {
10591
+ if (dataSource.value.length > 0 && props.multiple && !props.free) {
10592
+ const currentKeys = modelValue.value && Array.isArray(modelValue.value) ? modelValue.value : [];
10593
+ initTreeSelection({ tree: dataSource.value, keys: currentKeys });
10594
+ }
10595
+ }
10336
10596
  async function init(searchKeyword = "") {
10337
10597
  if (searchKeyword === "" && cacheDataSource.value.length > 0) {
10338
- _dataSource.value = cacheDataSource.value;
10598
+ dataSource.value = cacheDataSource.value;
10599
+ initTreeStructure();
10339
10600
  emit("loadEnd", getResultText.value);
10340
10601
  return;
10341
10602
  }
@@ -10344,10 +10605,10 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent({
10344
10605
  }
10345
10606
  emit("loadStart");
10346
10607
  lastSearchKeyword.value = searchKeyword;
10347
- const { dataSource, initMethod, keyField, labelField, free } = props;
10608
+ const { dataSource: propsDataSource, initMethod, keyField, labelField, free } = props;
10348
10609
  const { status, result, error } = await transformTree({
10349
10610
  initMethod,
10350
- dataSource,
10611
+ dataSource: propsDataSource,
10351
10612
  keyField,
10352
10613
  labelField,
10353
10614
  free,
@@ -10358,35 +10619,62 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent({
10358
10619
  return;
10359
10620
  }
10360
10621
  if (status === "success") {
10361
- _dataSource.value = result;
10622
+ dataSource.value = result;
10362
10623
  if (searchKeyword === "" && cacheDataSource.value.length === 0) {
10363
10624
  cacheDataSource.value = cloneDeep(result);
10364
10625
  }
10626
+ initTreeStructure();
10365
10627
  } else {
10366
10628
  LewMessage.error(error.message);
10367
10629
  }
10368
- expandKeys.value = cloneDeep(expandKeys.value);
10369
- modelValue.value = cloneDeep(modelValue.value);
10370
10630
  loading.value = false;
10371
10631
  emit("loadEnd", getResultText.value);
10372
10632
  }
10373
10633
  function reset() {
10374
- _dataSource.value = cloneDeep(cacheDataSource.value);
10634
+ dataSource.value = cloneDeep(cacheDataSource.value);
10635
+ if (props.multiple && !props.free) {
10636
+ initTreeSelection({ keys: [] });
10637
+ } else {
10638
+ modelValue.value = props.multiple ? [] : void 0;
10639
+ }
10640
+ keyword.value = "";
10641
+ lastSearchKeyword.value = "";
10375
10642
  emit("loadEnd", getResultText.value);
10376
10643
  }
10377
- function search(keyword2) {
10378
- if (searchTimer.value !== null) {
10379
- clearTimeout(searchTimer.value);
10644
+ const search = /* @__PURE__ */ useDebounceFn((keyword2) => {
10645
+ init(keyword2);
10646
+ }, 250);
10647
+ watch(selectedKeys, () => {
10648
+ if (!isInternalUpdate && props.multiple && !props.free) {
10649
+ updateModelValue();
10380
10650
  }
10381
- searchTimer.value = setTimeout(() => {
10382
- init(keyword2);
10383
- searchTimer.value = null;
10384
- }, DEBOUNCE_TIME);
10385
- }
10651
+ });
10652
+ watch(
10653
+ () => modelValue.value,
10654
+ (newValue) => {
10655
+ if (isInternalUpdate) {
10656
+ return;
10657
+ }
10658
+ if (props.multiple && !props.free && dataSource.value.length > 0) {
10659
+ const keys2 = Array.isArray(newValue) ? newValue : [];
10660
+ initTreeSelection({ keys: keys2 });
10661
+ }
10662
+ },
10663
+ { immediate: false, deep: true }
10664
+ );
10665
+ watch(
10666
+ () => props.multiple,
10667
+ (isMultiple) => {
10668
+ if (isMultiple && !Array.isArray(modelValue.value)) {
10669
+ modelValue.value = modelValue.value ? [modelValue.value] : [];
10670
+ }
10671
+ },
10672
+ { immediate: true }
10673
+ );
10386
10674
  __expose({
10387
10675
  search,
10388
10676
  reset,
10389
- getTree: () => _dataSource.value
10677
+ getTree: () => dataSource.value
10390
10678
  });
10391
10679
  onMounted(() => {
10392
10680
  init();
@@ -10414,13 +10702,13 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent({
10414
10702
  width: "100%",
10415
10703
  size: "small",
10416
10704
  placeholder: unref(locale).t("tree.searchPlaceholder"),
10417
- onInput: _cache[1] || (_cache[1] = ($event) => search(unref(keyword)))
10705
+ onInput: _cache[1] || (_cache[1] = ($event) => unref(search)(unref(keyword)))
10418
10706
  }, null, 8, ["modelValue", "placeholder"]),
10419
10707
  _ctx.searchable && unref(getResultText) ? (openBlock(), createElementBlock("div", _hoisted_1$N, toDisplayString$1(unref(getResultText)), 1)) : createCommentVNode("", true)
10420
10708
  ]),
10421
10709
  _: 1
10422
10710
  })) : createCommentVNode("", true),
10423
- unref(_dataSource) && unref(_dataSource).length === 0 ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
10711
+ unref(dataSource) && unref(dataSource).length === 0 ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
10424
10712
  _ctx.$slots.empty ? renderSlot(_ctx.$slots, "empty", { key: 0 }, void 0, true) : (openBlock(), createBlock(unref(LewFlex), {
10425
10713
  key: 1,
10426
10714
  direction: "y",
@@ -10443,7 +10731,7 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent({
10443
10731
  style: normalizeStyle({ height: unref(any2px)(_ctx.height) })
10444
10732
  }, {
10445
10733
  default: withCtx(() => [
10446
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(_dataSource), (item) => {
10734
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(dataSource), (item) => {
10447
10735
  return openBlock(), createBlock(resolveDynamicComponent(renderMenuTreeItem(item)), {
10448
10736
  key: item.key
10449
10737
  });
@@ -10462,7 +10750,7 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent({
10462
10750
  };
10463
10751
  }
10464
10752
  });
10465
- const LewTree = /* @__PURE__ */ _export_sfc(_sfc_main$_, [["__scopeId", "data-v-cad21cb7"]]);
10753
+ const LewTree = /* @__PURE__ */ _export_sfc(_sfc_main$_, [["__scopeId", "data-v-3590b828"]]);
10466
10754
  const alertEmits = {
10467
10755
  close: () => true
10468
10756
  };
@@ -10509,11 +10797,11 @@ const _hoisted_3$q = {
10509
10797
  key: 1,
10510
10798
  class: "lew-alert-title"
10511
10799
  };
10512
- const _hoisted_4$h = {
10800
+ const _hoisted_4$g = {
10513
10801
  key: 2,
10514
10802
  class: "lew-alert-content"
10515
10803
  };
10516
- const _hoisted_5$f = {
10804
+ const _hoisted_5$e = {
10517
10805
  key: 3,
10518
10806
  class: "lew-alert-content"
10519
10807
  };
@@ -10548,9 +10836,9 @@ const _sfc_main$Z = /* @__PURE__ */ defineComponent({
10548
10836
  _ctx.$slots.title ? (openBlock(), createElementBlock("div", _hoisted_2$x, [
10549
10837
  renderSlot(_ctx.$slots, "title", {}, void 0, true)
10550
10838
  ])) : props.title ? (openBlock(), createElementBlock("div", _hoisted_3$q, toDisplayString$1(props.title), 1)) : createCommentVNode("", true),
10551
- _ctx.$slots.content ? (openBlock(), createElementBlock("div", _hoisted_4$h, [
10839
+ _ctx.$slots.content ? (openBlock(), createElementBlock("div", _hoisted_4$g, [
10552
10840
  renderSlot(_ctx.$slots, "content", {}, void 0, true)
10553
- ])) : props.content ? (openBlock(), createElementBlock("div", _hoisted_5$f, toDisplayString$1(props.content), 1)) : createCommentVNode("", true),
10841
+ ])) : props.content ? (openBlock(), createElementBlock("div", _hoisted_5$e, toDisplayString$1(props.content), 1)) : createCommentVNode("", true),
10554
10842
  _ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_6$a, [
10555
10843
  renderSlot(_ctx.$slots, "footer", {}, void 0, true)
10556
10844
  ])) : createCommentVNode("", true)
@@ -10569,250 +10857,6 @@ const LewAlert = /* @__PURE__ */ _export_sfc(_sfc_main$Z, [["__scopeId", "data-v
10569
10857
  const drawerEmits = {
10570
10858
  close: () => true
10571
10859
  };
10572
- function useDOMCreate(nodeId) {
10573
- const node = document.getElementById(nodeId);
10574
- if (node) ;
10575
- else {
10576
- const newNode = document.createElement("div");
10577
- newNode.id = nodeId;
10578
- document.body.appendChild(newNode);
10579
- }
10580
- }
10581
- function useEventListener(target, event, callback) {
10582
- onMounted(() => target.addEventListener(event, callback, true));
10583
- onUnmounted(() => target.removeEventListener(event, callback, true));
10584
- }
10585
- function useTreeSelection() {
10586
- const tree = ref([]);
10587
- const parentMap = /* @__PURE__ */ new Map();
10588
- const childrenMap = /* @__PURE__ */ new Map();
10589
- const allDescendantsMap = /* @__PURE__ */ new Map();
10590
- const disabledMap = /* @__PURE__ */ new Map();
10591
- const selectedSet = /* @__PURE__ */ new Set();
10592
- const indeterminateSet = /* @__PURE__ */ new Set();
10593
- const selectedKeys = ref([]);
10594
- const indeterminateKeys = ref([]);
10595
- function buildMaps() {
10596
- parentMap.clear();
10597
- childrenMap.clear();
10598
- allDescendantsMap.clear();
10599
- disabledMap.clear();
10600
- const dfs = (node, parent) => {
10601
- parentMap.set(node.key, parent);
10602
- const directChildren = node.children?.map((c) => c.key) || [];
10603
- childrenMap.set(node.key, directChildren);
10604
- disabledMap.set(node.key, !!node.disabled);
10605
- const allDescendants = [];
10606
- const collectDescendants = (n) => {
10607
- n.children?.forEach((child) => {
10608
- allDescendants.push(child.key);
10609
- collectDescendants(child);
10610
- });
10611
- };
10612
- collectDescendants(node);
10613
- allDescendantsMap.set(node.key, allDescendants);
10614
- node.children?.forEach((child) => dfs(child, node.key));
10615
- };
10616
- unref(tree).forEach((root2) => dfs(root2, null));
10617
- }
10618
- buildMaps();
10619
- function flush() {
10620
- selectedKeys.value = Array.from(selectedSet);
10621
- indeterminateKeys.value = Array.from(indeterminateSet);
10622
- }
10623
- function isLeafNode(key) {
10624
- const children = childrenMap.get(key) || [];
10625
- return children.length === 0;
10626
- }
10627
- function isNodeDisabled(key) {
10628
- return disabledMap.get(key) || false;
10629
- }
10630
- function updateNodeState(key) {
10631
- const children = childrenMap.get(key) || [];
10632
- if (children.length === 0) {
10633
- indeterminateSet.delete(key);
10634
- return;
10635
- }
10636
- const enabledChildren = children.filter((child) => !isNodeDisabled(child));
10637
- if (enabledChildren.length === 0) {
10638
- selectedSet.delete(key);
10639
- indeterminateSet.delete(key);
10640
- return;
10641
- }
10642
- const selectedChildren = enabledChildren.filter((child) => selectedSet.has(child));
10643
- const indeterminateChildren = enabledChildren.filter((child) => indeterminateSet.has(child));
10644
- if (selectedChildren.length === enabledChildren.length) {
10645
- selectedSet.add(key);
10646
- indeterminateSet.delete(key);
10647
- } else if (selectedChildren.length > 0 || indeterminateChildren.length > 0) {
10648
- selectedSet.delete(key);
10649
- indeterminateSet.add(key);
10650
- } else {
10651
- selectedSet.delete(key);
10652
- indeterminateSet.delete(key);
10653
- }
10654
- }
10655
- function updateAncestors(key) {
10656
- let parent = parentMap.get(key);
10657
- while (parent !== void 0 && parent !== null) {
10658
- updateNodeState(parent);
10659
- parent = parentMap.get(parent);
10660
- }
10661
- }
10662
- function selectNodeAndDescendants(key) {
10663
- if (isNodeDisabled(key)) {
10664
- return;
10665
- }
10666
- selectedSet.add(key);
10667
- indeterminateSet.delete(key);
10668
- const descendants = allDescendantsMap.get(key) || [];
10669
- descendants.forEach((descendant) => {
10670
- if (!isNodeDisabled(descendant)) {
10671
- selectedSet.add(descendant);
10672
- indeterminateSet.delete(descendant);
10673
- }
10674
- });
10675
- }
10676
- function deselectNodeAndDescendants(key) {
10677
- selectedSet.delete(key);
10678
- indeterminateSet.delete(key);
10679
- const descendants = allDescendantsMap.get(key) || [];
10680
- descendants.forEach((descendant) => {
10681
- selectedSet.delete(descendant);
10682
- indeterminateSet.delete(descendant);
10683
- });
10684
- }
10685
- function init({ tree: _tree, keys: keys2 }) {
10686
- if ((_tree || []).length > 0) {
10687
- tree.value = _tree;
10688
- }
10689
- buildMaps();
10690
- for (const key of selectedSet) {
10691
- if (!parentMap.has(key) && !childrenMap.has(key)) {
10692
- selectedSet.delete(key);
10693
- }
10694
- }
10695
- for (const key of indeterminateSet) {
10696
- if (!parentMap.has(key) && !childrenMap.has(key)) {
10697
- indeterminateSet.delete(key);
10698
- }
10699
- }
10700
- recompute();
10701
- selectedSet.clear();
10702
- indeterminateSet.clear();
10703
- if (Array.isArray(keys2)) {
10704
- keys2.forEach((key) => {
10705
- if (parentMap.has(key) || childrenMap.has(key)) {
10706
- if (isNodeDisabled(key)) {
10707
- return;
10708
- }
10709
- selectNodeAndDescendants(key);
10710
- }
10711
- });
10712
- const processedAncestors = /* @__PURE__ */ new Set();
10713
- keys2.forEach((key) => {
10714
- if (parentMap.has(key) || childrenMap.has(key)) {
10715
- let parent = parentMap.get(key);
10716
- while (parent !== void 0 && parent !== null && !processedAncestors.has(parent)) {
10717
- updateNodeState(parent);
10718
- processedAncestors.add(parent);
10719
- parent = parentMap.get(parent);
10720
- }
10721
- }
10722
- });
10723
- }
10724
- flush();
10725
- }
10726
- function recompute() {
10727
- indeterminateSet.clear();
10728
- const allKeys = Array.from(parentMap.keys());
10729
- const sortedKeys = allKeys.sort((a, b) => {
10730
- const aChildren = childrenMap.get(a) || [];
10731
- const bChildren = childrenMap.get(b) || [];
10732
- return aChildren.length - bChildren.length;
10733
- });
10734
- sortedKeys.forEach((key) => {
10735
- updateNodeState(key);
10736
- });
10737
- flush();
10738
- }
10739
- function addKey(key) {
10740
- if (!parentMap.has(key) && !childrenMap.has(key)) {
10741
- return;
10742
- }
10743
- if (isNodeDisabled(key)) {
10744
- return;
10745
- }
10746
- selectNodeAndDescendants(key);
10747
- updateAncestors(key);
10748
- flush();
10749
- }
10750
- function removeKey(key) {
10751
- if (!selectedSet.has(key) && !indeterminateSet.has(key)) {
10752
- return;
10753
- }
10754
- deselectNodeAndDescendants(key);
10755
- updateAncestors(key);
10756
- flush();
10757
- }
10758
- function toggleKey(key) {
10759
- if (isNodeDisabled(key)) {
10760
- return;
10761
- }
10762
- if (selectedSet.has(key)) {
10763
- removeKey(key);
10764
- } else {
10765
- addKey(key);
10766
- }
10767
- }
10768
- const isSelected = computed(() => {
10769
- return (key) => {
10770
- return selectedKeys.value.includes(key);
10771
- };
10772
- });
10773
- const isIndeterminate = computed(() => {
10774
- return (key) => {
10775
- return indeterminateKeys.value.includes(key);
10776
- };
10777
- });
10778
- function getSelectedLeafKeys() {
10779
- return Array.from(selectedSet).filter((key) => isLeafNode(key));
10780
- }
10781
- function findItemsByValues(values) {
10782
- const foundItems = [];
10783
- const findInTree = (nodes, targetValues) => {
10784
- for (const node of nodes) {
10785
- if (targetValues.includes(node.key)) {
10786
- const item = {
10787
- ...node,
10788
- isLeaf: !node.children || node.children.length === 0
10789
- };
10790
- delete item.children;
10791
- foundItems.push(item);
10792
- }
10793
- if (node.children && node.children.length > 0) {
10794
- findInTree(node.children, targetValues);
10795
- }
10796
- }
10797
- };
10798
- findInTree(unref(tree), values);
10799
- return foundItems;
10800
- }
10801
- flush();
10802
- return {
10803
- selectedKeys,
10804
- indeterminateKeys,
10805
- init,
10806
- addKey,
10807
- removeKey,
10808
- toggleKey,
10809
- isSelected,
10810
- isIndeterminate,
10811
- isNodeDisabled,
10812
- getSelectedLeafKeys,
10813
- findItemsByValues
10814
- };
10815
- }
10816
10860
  const drawerModel = {
10817
10861
  visible: {
10818
10862
  type: Boolean,
@@ -10926,7 +10970,7 @@ const _hoisted_1$L = {
10926
10970
  };
10927
10971
  const _hoisted_2$w = { class: "lew-drawer-title" };
10928
10972
  const _hoisted_3$p = { class: "lew-drawer-body-slot" };
10929
- const _hoisted_4$g = {
10973
+ const _hoisted_4$f = {
10930
10974
  key: 2,
10931
10975
  class: "lew-drawer-footer-slot"
10932
10976
  };
@@ -11106,7 +11150,7 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
11106
11150
  createElementVNode("div", _hoisted_3$p, [
11107
11151
  renderSlot(_ctx.$slots, "default")
11108
11152
  ]),
11109
- _ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_4$g, [
11153
+ _ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_4$f, [
11110
11154
  renderSlot(_ctx.$slots, "footer")
11111
11155
  ])) : !props.hideFooter ? (openBlock(), createBlock(unref(LewFlex), {
11112
11156
  key: 3,
@@ -11672,8 +11716,8 @@ const _hoisted_1$I = {
11672
11716
  };
11673
11717
  const _hoisted_2$u = { class: "lew-popok-box-right" };
11674
11718
  const _hoisted_3$o = { class: "lew-popok-box-right-header" };
11675
- const _hoisted_4$f = { class: "lew-popok-box-right-main" };
11676
- const _hoisted_5$e = { class: "lew-popok-box-footer" };
11719
+ const _hoisted_4$e = { class: "lew-popok-box-right-main" };
11720
+ const _hoisted_5$d = { class: "lew-popok-box-footer" };
11677
11721
  const _sfc_main$V = /* @__PURE__ */ defineComponent({
11678
11722
  __name: "LewPopok",
11679
11723
  props: popokButtonProps,
@@ -11749,14 +11793,14 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
11749
11793
  createElementVNode("div", _hoisted_3$o, [
11750
11794
  createVNode(_sfc_main$16, { "render-fn": _ctx.title }, null, 8, ["render-fn"])
11751
11795
  ]),
11752
- createElementVNode("div", _hoisted_4$f, [
11796
+ createElementVNode("div", _hoisted_4$e, [
11753
11797
  createVNode(_sfc_main$16, { "render-fn": _ctx.content }, null, 8, ["render-fn"])
11754
11798
  ])
11755
11799
  ])
11756
11800
  ]),
11757
11801
  _: 1
11758
11802
  }),
11759
- createElementVNode("div", _hoisted_5$e, [
11803
+ createElementVNode("div", _hoisted_5$d, [
11760
11804
  createVNode(unref(LewButton), {
11761
11805
  text: _ctx.cancelText || unref(locale).t("popok.cancelText"),
11762
11806
  color: "gray",
@@ -14806,9 +14850,12 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
14806
14850
  });
14807
14851
  const showClearButton = computed(() => {
14808
14852
  if (props.multiple) {
14809
- return props.clearable && (modelValue.value || []).length > 0 && !props.readonly && !props.loading;
14853
+ return props.clearable && Array.isArray(modelValue.value) && modelValue.value.length > 0 && !props.readonly && !props.loading;
14810
14854
  } else {
14811
- return props.clearable && modelValue.value && !props.readonly && !props.loading;
14855
+ if (Array.isArray(modelValue.value) && modelValue.value.length === 0) {
14856
+ return false;
14857
+ }
14858
+ return props.clearable && !!modelValue.value && !props.readonly && !props.loading;
14812
14859
  }
14813
14860
  });
14814
14861
  const hasSelectedItems = computed(() => {
@@ -14972,7 +15019,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
14972
15019
  };
14973
15020
  }
14974
15021
  });
14975
- const CommonInput = /* @__PURE__ */ _export_sfc(_sfc_main$T, [["__scopeId", "data-v-51b98d83"]]);
15022
+ const CommonInput = /* @__PURE__ */ _export_sfc(_sfc_main$T, [["__scopeId", "data-v-92080308"]]);
14976
15023
  function vue3h(ele, props, children) {
14977
15024
  const { attrs, on, ...rest } = props;
14978
15025
  let event = {};
@@ -16354,7 +16401,8 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
16354
16401
  }
16355
16402
  }
16356
16403
  async function selectItem(item, level) {
16357
- if (item.disabled) return;
16404
+ if (item.disabled)
16405
+ return;
16358
16406
  if (!item.isLeaf && !isEqual(item.valuePaths, state.activeValues)) {
16359
16407
  state.optionsGroup = state.optionsGroup.slice(0, level + 1);
16360
16408
  if (_loadMethod.value && !item.isLeaf) {
@@ -16419,7 +16467,8 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
16419
16467
  }, 100);
16420
16468
  }
16421
16469
  }
16422
- if (item.isLeaf) return;
16470
+ if (item.isLeaf)
16471
+ return;
16423
16472
  if (isEqual(item.valuePaths, state.activeValues)) {
16424
16473
  state.activeValues = item.parentValuePaths || [];
16425
16474
  if (level < state.optionsGroup.length - 1) {
@@ -16651,7 +16700,7 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
16651
16700
  };
16652
16701
  }
16653
16702
  });
16654
- const LewCascader = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["__scopeId", "data-v-dd8d6365"]]);
16703
+ const LewCascader = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["__scopeId", "data-v-2fd52a92"]]);
16655
16704
  const cascaderModel = {
16656
16705
  modelValue: {
16657
16706
  type: String
@@ -17779,8 +17828,8 @@ function getMonthDate(year, month) {
17779
17828
  const _hoisted_1$C = { class: "lew-date" };
17780
17829
  const _hoisted_2$q = { class: "lew-date-control-left" };
17781
17830
  const _hoisted_3$l = { class: "cur-date" };
17782
- const _hoisted_4$e = { class: "lew-date-control-right" };
17783
- const _hoisted_5$d = { class: "lew-date-box" };
17831
+ const _hoisted_4$d = { class: "lew-date-control-right" };
17832
+ const _hoisted_5$c = { class: "lew-date-box" };
17784
17833
  const _hoisted_6$9 = { class: "lew-date-num" };
17785
17834
  const _hoisted_7$7 = ["onClick"];
17786
17835
  const _hoisted_8$6 = { class: "lew-date-label" };
@@ -17937,7 +17986,7 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
17937
17986
  })
17938
17987
  ]),
17939
17988
  createElementVNode("div", _hoisted_3$l, toDisplayString$1(unref(dayjs)(`${unref(dateState).year}-${unref(dateState).month}`).format("YYYY-MM")), 1),
17940
- createElementVNode("div", _hoisted_4$e, [
17989
+ createElementVNode("div", _hoisted_4$d, [
17941
17990
  createVNode(unref(LewButton), {
17942
17991
  type: "light",
17943
17992
  color: "gray",
@@ -17966,7 +18015,7 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
17966
18015
  ]),
17967
18016
  _: 1
17968
18017
  }),
17969
- createElementVNode("div", _hoisted_5$d, [
18018
+ createElementVNode("div", _hoisted_5$c, [
17970
18019
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(headDate), (item, index2) => {
17971
18020
  return openBlock(), createElementBlock("div", {
17972
18021
  key: `h${index2}`,
@@ -17996,8 +18045,8 @@ const LewDate = /* @__PURE__ */ _export_sfc(_sfc_main$O, [["__scopeId", "data-v-
17996
18045
  const _hoisted_1$B = { class: "lew-time-control" };
17997
18046
  const _hoisted_2$p = { class: "cur-time" };
17998
18047
  const _hoisted_3$k = { class: "lew-time-container" };
17999
- const _hoisted_4$d = { class: "lew-time-column" };
18000
- const _hoisted_5$c = ["data-value", "onClick"];
18048
+ const _hoisted_4$c = { class: "lew-time-column" };
18049
+ const _hoisted_5$b = ["data-value", "onClick"];
18001
18050
  const _hoisted_6$8 = ["data-text"];
18002
18051
  const _hoisted_7$6 = { class: "lew-time-column" };
18003
18052
  const _hoisted_8$5 = ["data-value", "onClick"];
@@ -18302,7 +18351,7 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
18302
18351
  _cache[16] || (_cache[16] = createElementVNode("div", { class: "lew-time-center-mask" }, null, -1)),
18303
18352
  _cache[17] || (_cache[17] = createElementVNode("div", { class: "lew-time-gradient-top" }, null, -1)),
18304
18353
  _cache[18] || (_cache[18] = createElementVNode("div", { class: "lew-time-gradient-bottom" }, null, -1)),
18305
- createElementVNode("div", _hoisted_4$d, [
18354
+ createElementVNode("div", _hoisted_4$c, [
18306
18355
  createElementVNode("div", {
18307
18356
  ref_key: "hourRef",
18308
18357
  ref: hourRef,
@@ -18323,7 +18372,7 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
18323
18372
  class: "lew-time-value",
18324
18373
  "data-text": hour.label
18325
18374
  }, toDisplayString$1(hour.label), 9, _hoisted_6$8)
18326
- ], 8, _hoisted_5$c);
18375
+ ], 8, _hoisted_5$b);
18327
18376
  }), 128)),
18328
18377
  _cache[11] || (_cache[11] = createElementVNode("div", { class: "lew-time-padding" }, null, -1))
18329
18378
  ], 544)
@@ -18413,8 +18462,8 @@ const LewTime = /* @__PURE__ */ _export_sfc(_sfc_main$N, [["__scopeId", "data-v-
18413
18462
  const _hoisted_1$A = { class: "lew-datetime" };
18414
18463
  const _hoisted_2$o = { class: "lew-datetime-content" };
18415
18464
  const _hoisted_3$j = { class: "lew-datetime-panel lew-datetime-date-panel" };
18416
- const _hoisted_4$c = { class: "lew-datetime-panel lew-datetime-time-panel" };
18417
- const _hoisted_5$b = { class: "lew-datetime-actions" };
18465
+ const _hoisted_4$b = { class: "lew-datetime-panel lew-datetime-time-panel" };
18466
+ const _hoisted_5$a = { class: "lew-datetime-actions" };
18418
18467
  const _hoisted_6$7 = { class: "lew-datetime-actions-left" };
18419
18468
  const _hoisted_7$5 = { class: "lew-datetime-actions-right" };
18420
18469
  const _sfc_main$M = /* @__PURE__ */ defineComponent({
@@ -18498,7 +18547,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
18498
18547
  "value-format": unref(dateFormat)
18499
18548
  }, null, 8, ["value-format"])
18500
18549
  ]),
18501
- createElementVNode("div", _hoisted_4$c, [
18550
+ createElementVNode("div", _hoisted_4$b, [
18502
18551
  createVNode(LewTime, {
18503
18552
  ref_key: "timeRef",
18504
18553
  ref: timeRef,
@@ -18508,7 +18557,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
18508
18557
  }, null, 8, ["value-format"])
18509
18558
  ])
18510
18559
  ]),
18511
- createElementVNode("div", _hoisted_5$b, [
18560
+ createElementVNode("div", _hoisted_5$a, [
18512
18561
  createElementVNode("div", _hoisted_6$7, [
18513
18562
  createVNode(unref(LewButton), {
18514
18563
  type: "light",
@@ -18556,8 +18605,8 @@ const LewDateTime = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["__scopeId", "dat
18556
18605
  const _hoisted_1$z = { class: "lew-month" };
18557
18606
  const _hoisted_2$n = { class: "lew-month-control-left" };
18558
18607
  const _hoisted_3$i = { class: "cur-year" };
18559
- const _hoisted_4$b = { class: "lew-month-control-right" };
18560
- const _hoisted_5$a = { class: "lew-month-list" };
18608
+ const _hoisted_4$a = { class: "lew-month-control-right" };
18609
+ const _hoisted_5$9 = { class: "lew-month-list" };
18561
18610
  const _hoisted_6$6 = ["onClick"];
18562
18611
  const _hoisted_7$4 = { class: "lew-month-label" };
18563
18612
  const _hoisted_8$4 = {
@@ -18662,7 +18711,7 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
18662
18711
  })
18663
18712
  ]),
18664
18713
  createElementVNode("div", _hoisted_3$i, toDisplayString$1(unref(monthState).year), 1),
18665
- createElementVNode("div", _hoisted_4$b, [
18714
+ createElementVNode("div", _hoisted_4$a, [
18666
18715
  createVNode(unref(LewButton), {
18667
18716
  type: "light",
18668
18717
  color: "gray",
@@ -18679,7 +18728,7 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
18679
18728
  ]),
18680
18729
  _: 1
18681
18730
  }),
18682
- createElementVNode("div", _hoisted_5$a, [
18731
+ createElementVNode("div", _hoisted_5$9, [
18683
18732
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(monthList), (month) => {
18684
18733
  return openBlock(), createElementBlock("div", {
18685
18734
  key: month.value,
@@ -18701,8 +18750,8 @@ const LewMonth = /* @__PURE__ */ _export_sfc(_sfc_main$L, [["__scopeId", "data-v
18701
18750
  const _hoisted_1$y = { class: "lew-quarter" };
18702
18751
  const _hoisted_2$m = { class: "lew-quarter-control-left" };
18703
18752
  const _hoisted_3$h = { class: "cur-year" };
18704
- const _hoisted_4$a = { class: "lew-quarter-control-right" };
18705
- const _hoisted_5$9 = { class: "lew-quarter-list" };
18753
+ const _hoisted_4$9 = { class: "lew-quarter-control-right" };
18754
+ const _hoisted_5$8 = { class: "lew-quarter-list" };
18706
18755
  const _hoisted_6$5 = ["onClick"];
18707
18756
  const _hoisted_7$3 = { class: "lew-quarter-label" };
18708
18757
  const _hoisted_8$3 = {
@@ -18800,7 +18849,7 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
18800
18849
  })
18801
18850
  ]),
18802
18851
  createElementVNode("div", _hoisted_3$h, toDisplayString$1(unref(currentYear)), 1),
18803
- createElementVNode("div", _hoisted_4$a, [
18852
+ createElementVNode("div", _hoisted_4$9, [
18804
18853
  createVNode(unref(LewButton), {
18805
18854
  type: "light",
18806
18855
  color: "gray",
@@ -18817,7 +18866,7 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
18817
18866
  ]),
18818
18867
  _: 1
18819
18868
  }),
18820
- createElementVNode("div", _hoisted_5$9, [
18869
+ createElementVNode("div", _hoisted_5$8, [
18821
18870
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(quarterList), (item) => {
18822
18871
  return openBlock(), createElementBlock("div", {
18823
18872
  key: item.value,
@@ -18842,8 +18891,8 @@ const LewQuarter = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["__scopeId", "data
18842
18891
  const _hoisted_1$x = { class: "lew-year" };
18843
18892
  const _hoisted_2$l = { class: "lew-year-control-left" };
18844
18893
  const _hoisted_3$g = { class: "cur-decade" };
18845
- const _hoisted_4$9 = { class: "lew-year-control-right" };
18846
- const _hoisted_5$8 = { class: "lew-year-list" };
18894
+ const _hoisted_4$8 = { class: "lew-year-control-right" };
18895
+ const _hoisted_5$7 = { class: "lew-year-list" };
18847
18896
  const _hoisted_6$4 = ["onClick"];
18848
18897
  const _hoisted_7$2 = { class: "lew-year-label" };
18849
18898
  const _hoisted_8$2 = {
@@ -18943,7 +18992,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
18943
18992
  })
18944
18993
  ]),
18945
18994
  createElementVNode("div", _hoisted_3$g, toDisplayString$1(unref(yearState).startYear) + " - " + toDisplayString$1(unref(yearState).startYear + 11), 1),
18946
- createElementVNode("div", _hoisted_4$9, [
18995
+ createElementVNode("div", _hoisted_4$8, [
18947
18996
  createVNode(unref(LewButton), {
18948
18997
  type: "light",
18949
18998
  color: "gray",
@@ -18960,7 +19009,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
18960
19009
  ]),
18961
19010
  _: 1
18962
19011
  }),
18963
- createElementVNode("div", _hoisted_5$8, [
19012
+ createElementVNode("div", _hoisted_5$7, [
18964
19013
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(yearList), (year) => {
18965
19014
  return openBlock(), createElementBlock("div", {
18966
19015
  key: year,
@@ -19508,8 +19557,8 @@ const dateRangeProps = {
19508
19557
  const _hoisted_1$u = { class: "lew-date-range" };
19509
19558
  const _hoisted_2$j = { class: "lew-date" };
19510
19559
  const _hoisted_3$e = { class: "lew-date-control-left" };
19511
- const _hoisted_4$8 = { class: "cur-date" };
19512
- const _hoisted_5$7 = { class: "lew-date-control-right" };
19560
+ const _hoisted_4$7 = { class: "cur-date" };
19561
+ const _hoisted_5$6 = { class: "lew-date-control-right" };
19513
19562
  const _hoisted_6$3 = { class: "lew-date-box" };
19514
19563
  const _hoisted_7$1 = { class: "lew-date-num" };
19515
19564
  const _hoisted_8$1 = ["onClick", "onMouseenter"];
@@ -19825,8 +19874,8 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
19825
19874
  _: 1
19826
19875
  })
19827
19876
  ]),
19828
- createElementVNode("div", _hoisted_4$8, toDisplayString$1(unref(dayjs)(`${unref(dateState).year1}-${unref(dateState).month1}`).format("YYYY-MM")), 1),
19829
- createElementVNode("div", _hoisted_5$7, [
19877
+ createElementVNode("div", _hoisted_4$7, toDisplayString$1(unref(dayjs)(`${unref(dateState).year1}-${unref(dateState).month1}`).format("YYYY-MM")), 1),
19878
+ createElementVNode("div", _hoisted_5$6, [
19830
19879
  createVNode(unref(LewButton), {
19831
19880
  type: "light",
19832
19881
  color: "gray",
@@ -19988,8 +20037,8 @@ const _hoisted_3$d = {
19988
20037
  key: 1,
19989
20038
  class: "lew-date-range-picker-dateValue lew-date-range-picker-start"
19990
20039
  };
19991
- const _hoisted_4$7 = { class: "lew-date-range-picker-mid" };
19992
- const _hoisted_5$6 = {
20040
+ const _hoisted_4$6 = { class: "lew-date-range-picker-mid" };
20041
+ const _hoisted_5$5 = {
19993
20042
  key: 2,
19994
20043
  class: "lew-date-range-picker-placeholder"
19995
20044
  };
@@ -20129,13 +20178,13 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
20129
20178
  }, {
20130
20179
  default: withCtx(() => [
20131
20180
  !modelValue.value?.start ? (openBlock(), createElementBlock("div", _hoisted_2$i, toDisplayString$1(_ctx.placeholderStart ? _ctx.placeholderStart : unref(locale).t("dateRangePicker.placeholderStart")), 1)) : (openBlock(), createElementBlock("div", _hoisted_3$d, toDisplayString$1(modelValue.value.start), 1)),
20132
- createElementVNode("div", _hoisted_4$7, [
20181
+ createElementVNode("div", _hoisted_4$6, [
20133
20182
  createVNode(CommonIcon, {
20134
20183
  size: 14,
20135
20184
  type: "minus"
20136
20185
  })
20137
20186
  ]),
20138
- !modelValue.value?.end ? (openBlock(), createElementBlock("div", _hoisted_5$6, toDisplayString$1(_ctx.placeholderEnd ? _ctx.placeholderEnd : unref(locale).t("dateRangePicker.placeholderEnd")), 1)) : (openBlock(), createElementBlock("div", _hoisted_6$2, toDisplayString$1(modelValue.value.end), 1)),
20187
+ !modelValue.value?.end ? (openBlock(), createElementBlock("div", _hoisted_5$5, toDisplayString$1(_ctx.placeholderEnd ? _ctx.placeholderEnd : unref(locale).t("dateRangePicker.placeholderEnd")), 1)) : (openBlock(), createElementBlock("div", _hoisted_6$2, toDisplayString$1(modelValue.value.end), 1)),
20139
20188
  createVNode(CommonIcon, {
20140
20189
  class: normalizeClass(["lew-date-range-picker-icon-calendar", {
20141
20190
  "lew-date-range-picker-icon-calendar-hide": unref(checkClear)
@@ -22362,11 +22411,11 @@ const _hoisted_3$c = {
22362
22411
  key: 1,
22363
22412
  class: "lew-input-prefixes-icon"
22364
22413
  };
22365
- const _hoisted_4$6 = {
22414
+ const _hoisted_4$5 = {
22366
22415
  key: 2,
22367
22416
  class: "lew-input-prefixes-select"
22368
22417
  };
22369
- const _hoisted_5$5 = ["disabled", "placeholder", "type", "readonly", "maxlength"];
22418
+ const _hoisted_5$4 = ["disabled", "placeholder", "type", "readonly", "maxlength"];
22370
22419
  const _hoisted_6$1 = {
22371
22420
  key: 0,
22372
22421
  class: "lew-input-auto-width"
@@ -22562,7 +22611,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
22562
22611
  type: prefixValue.value
22563
22612
  }, null, 8, ["size", "type"])
22564
22613
  ])) : createCommentVNode("", true),
22565
- _ctx.prefixes === "select" ? (openBlock(), createElementBlock("div", _hoisted_4$6, [
22614
+ _ctx.prefixes === "select" ? (openBlock(), createElementBlock("div", _hoisted_4$5, [
22566
22615
  createVNode(unref(_sfc_main$7), {
22567
22616
  placement: "bottom",
22568
22617
  trigger: "click",
@@ -22635,7 +22684,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
22635
22684
  onChange: handleChange,
22636
22685
  onBlur: _blur,
22637
22686
  onFocus: _focus
22638
- }, null, 44, _hoisted_5$5), [
22687
+ }, null, 44, _hoisted_5$4), [
22639
22688
  [vModelDynamic, modelValue.value]
22640
22689
  ]),
22641
22690
  _ctx.autoWidth ? (openBlock(), createElementBlock("label", _hoisted_6$1, toDisplayString$1(modelValue.value), 1)) : createCommentVNode("", true),
@@ -26858,7 +26907,7 @@ const treeSelectEmits = {
26858
26907
  };
26859
26908
  const treeSelectModel = {
26860
26909
  modelValue: {
26861
- type: String,
26910
+ type: [String, Array],
26862
26911
  default: void 0
26863
26912
  }
26864
26913
  };
@@ -26920,6 +26969,14 @@ const treeSelectProps = {
26920
26969
  propName: "clearable"
26921
26970
  })
26922
26971
  },
26972
+ multiple: {
26973
+ type: Boolean,
26974
+ default: false,
26975
+ validator: validators.boolean({
26976
+ componentName: "LewTreeSelect",
26977
+ propName: "multiple"
26978
+ })
26979
+ },
26923
26980
  checkable: {
26924
26981
  type: Boolean,
26925
26982
  default: true,
@@ -26928,6 +26985,14 @@ const treeSelectProps = {
26928
26985
  propName: "checkable"
26929
26986
  })
26930
26987
  },
26988
+ onlyLeafSelectable: {
26989
+ type: Boolean,
26990
+ default: true,
26991
+ validator: validators.boolean({
26992
+ componentName: "LewTreeSelect",
26993
+ propName: "onlyLeafSelectable"
26994
+ })
26995
+ },
26931
26996
  showAllLevels: {
26932
26997
  type: Boolean,
26933
26998
  default: true,
@@ -26978,7 +27043,7 @@ const treeSelectProps = {
26978
27043
  },
26979
27044
  free: {
26980
27045
  type: Boolean,
26981
- default: true,
27046
+ default: false,
26982
27047
  validator: validators.boolean({
26983
27048
  componentName: "LewTreeSelect",
26984
27049
  propName: "free"
@@ -27042,17 +27107,12 @@ const treeSelectProps = {
27042
27107
  })
27043
27108
  }
27044
27109
  };
27045
- const _hoisted_1$g = {
27046
- key: 0,
27047
- class: "lew-icon-loading-box"
27048
- };
27049
- const _hoisted_2$c = ["title", "readonly", "placeholder"];
27050
- const _hoisted_3$a = { class: "lew-select-options-box" };
27051
- const _hoisted_4$5 = {
27110
+ const _hoisted_1$g = { class: "lew-select-options-box" };
27111
+ const _hoisted_2$c = {
27052
27112
  key: 0,
27053
27113
  class: "result-count"
27054
27114
  };
27055
- const _hoisted_5$4 = { class: "tree-select-wrapper lew-scrollbar" };
27115
+ const _hoisted_3$a = { class: "tree-select-wrapper lew-scrollbar" };
27056
27116
  const _sfc_main$o = /* @__PURE__ */ defineComponent({
27057
27117
  __name: "LewTreeSelect",
27058
27118
  props: /* @__PURE__ */ mergeModels(treeSelectProps, {
@@ -27069,7 +27129,6 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
27069
27129
  }
27070
27130
  const treeSelectValue = useModel(__props, "modelValue");
27071
27131
  const lewSelectRef = ref();
27072
- const inputRef = ref();
27073
27132
  const lewPopoverRef = ref();
27074
27133
  const lewTreeRef = ref();
27075
27134
  const formMethods = inject("formMethods", {});
@@ -27079,7 +27138,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
27079
27138
  } else if (props.initMethodId) {
27080
27139
  return formMethods[props.initMethodId];
27081
27140
  }
27082
- return false;
27141
+ return void 0;
27083
27142
  });
27084
27143
  const state = reactive({
27085
27144
  selectWidth: 0,
@@ -27090,16 +27149,14 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
27090
27149
  // 树加载
27091
27150
  initLoading: true,
27092
27151
  // 初始化 loading
27093
- valueIsChange: false,
27094
- // 记录
27095
- keyword: props.defaultValue || treeSelectValue.value,
27096
- // 搜索关键字
27097
- keywordBackup: props.defaultValue,
27098
- // 搜索关键字备份
27099
27152
  resultText: ""
27100
27153
  });
27101
27154
  function getSelectWidth() {
27102
- state.selectWidth = lewSelectRef.value?.clientWidth - 12;
27155
+ if (lewSelectRef.value?.$el) {
27156
+ state.selectWidth = lewSelectRef.value.$el.clientWidth - 12;
27157
+ } else if (lewSelectRef.value?.clientWidth) {
27158
+ state.selectWidth = lewSelectRef.value.clientWidth - 12;
27159
+ }
27103
27160
  }
27104
27161
  function show() {
27105
27162
  lewPopoverRef.value.show();
@@ -27107,105 +27164,101 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
27107
27164
  function hide2() {
27108
27165
  lewPopoverRef.value.hide();
27109
27166
  }
27110
- const searchDebounce = /* @__PURE__ */ useDebounceFn(async (e) => {
27111
- search(e);
27112
- }, props.searchDelay);
27113
- async function search(e) {
27114
- const keyword = e.target.value;
27115
- if (props.searchable) {
27116
- await lewTreeRef.value.search(keyword);
27117
- }
27118
- }
27119
27167
  function change(e) {
27120
- const { value } = e;
27121
- treeSelectValue.value = value;
27122
- state.valueIsChange = true;
27123
- setKeywordLabel(value);
27124
27168
  emit("change", e);
27125
- setTimeout(() => {
27126
- hide2();
27127
- }, 100);
27169
+ if (!props.multiple) {
27170
+ setTimeout(() => {
27171
+ hide2();
27172
+ }, 100);
27173
+ } else {
27174
+ setTimeout(() => {
27175
+ if (lewPopoverRef.value) {
27176
+ lewPopoverRef.value.refresh();
27177
+ }
27178
+ }, 100);
27179
+ }
27128
27180
  }
27129
27181
  function clearHandle() {
27130
- treeSelectValue.value = void 0;
27131
- state.keyword = "";
27132
- state.keywordBackup = "";
27182
+ treeSelectValue.value = props.multiple ? [] : void 0;
27133
27183
  emit("clear");
27134
27184
  emit("change", void 0);
27185
+ if (props.multiple) {
27186
+ setTimeout(() => {
27187
+ if (lewPopoverRef.value) {
27188
+ lewPopoverRef.value.refresh();
27189
+ }
27190
+ }, 100);
27191
+ }
27135
27192
  }
27136
- const getValueStyle = computed(() => {
27137
- return state.visible ? "opacity:0.6" : "";
27138
- });
27139
- const getSelectClassName = computed(() => {
27140
- let { clearable, size, disabled, readonly: readonly2, searchable } = props;
27141
- clearable = clearable ? !!treeSelectValue.value : false;
27142
- const focus = state.visible;
27143
- return object2class("lew-select", {
27144
- clearable,
27145
- size,
27146
- disabled,
27147
- readonly: readonly2,
27148
- searchable,
27149
- focus,
27150
- "init-loading": state.initLoading
27193
+ const formatItems = computed(() => {
27194
+ if (!treeSelectValue.value) {
27195
+ return props.multiple ? [] : "";
27196
+ }
27197
+ const tree = lewTreeRef.value?.getTree();
27198
+ if (!tree) {
27199
+ return props.multiple ? [] : "";
27200
+ }
27201
+ if (!props.multiple && treeSelectValue.value) {
27202
+ const treeItem = findNodeByKey(treeSelectValue.value, tree);
27203
+ if (!treeItem) {
27204
+ return "";
27205
+ }
27206
+ const { labelPaths, label } = treeItem;
27207
+ return props.showAllLevels && labelPaths?.length > 0 ? labelPaths.join(" / ") : label;
27208
+ }
27209
+ if (!Array.isArray(treeSelectValue.value)) {
27210
+ return [];
27211
+ }
27212
+ return treeSelectValue.value.map((value) => {
27213
+ const treeItem = findNodeByKey(value, tree);
27214
+ if (!treeItem) {
27215
+ return {
27216
+ value,
27217
+ label: value
27218
+ };
27219
+ }
27220
+ const { label, labelPaths } = treeItem;
27221
+ return {
27222
+ value,
27223
+ // 多选模式只显示节点名称,不显示完整路径
27224
+ label: props.multiple ? label : props.showAllLevels && labelPaths?.length > 0 ? labelPaths.join(" / ") : label
27225
+ };
27151
27226
  });
27152
27227
  });
27228
+ function deleteTag(value) {
27229
+ if (Array.isArray(treeSelectValue.value)) {
27230
+ treeSelectValue.value = treeSelectValue.value.filter((v) => v !== value);
27231
+ emit("change", treeSelectValue.value);
27232
+ setTimeout(() => {
27233
+ if (lewPopoverRef.value) {
27234
+ lewPopoverRef.value.refresh();
27235
+ }
27236
+ }, 100);
27237
+ }
27238
+ }
27153
27239
  const getBodyClassName = computed(() => {
27154
27240
  const { size, disabled } = props;
27155
27241
  return object2class("lew-select-body", { size, disabled });
27156
27242
  });
27157
- const getIconSize = computed(() => {
27158
- const size = {
27159
- small: 14,
27160
- medium: 15,
27161
- large: 16
27162
- };
27163
- return size[props.size];
27164
- });
27165
- function setKeywordLabel(value) {
27166
- if (lewTreeRef.value && value) {
27167
- const tree = lewTreeRef.value.getTree();
27168
- const treeItem = findNodeByKey(value, tree);
27169
- if (treeItem !== void 0) {
27170
- const { labelPaths, label } = treeItem;
27171
- if (props.showAllLevels && labelPaths && labelPaths.length > 0) {
27172
- state.keyword = labelPaths.join(" / ");
27173
- } else {
27174
- state.keyword = label[0];
27175
- }
27176
- }
27177
- }
27178
- }
27179
- setKeywordLabel(treeSelectValue.value);
27180
27243
  function showHandle() {
27181
27244
  state.visible = true;
27182
- state.keywordBackup = cloneDeep(state.keyword);
27183
- state.valueIsChange = false;
27184
- if (props.searchable) {
27185
- state.keyword = "";
27186
- }
27187
27245
  getSelectWidth();
27188
- if (props.searchable) {
27189
- search({ target: { value: "" } });
27190
- }
27191
27246
  }
27192
27247
  function hideHandle() {
27193
27248
  state.visible = false;
27194
- if (!state.valueIsChange && treeSelectValue.value) {
27195
- state.keywordBackup ? state.keyword = state.keywordBackup : setKeywordLabel(treeSelectValue.value);
27196
- }
27197
- if (!treeSelectValue.value && state.keyword) {
27198
- state.keyword = "";
27199
- state.keywordBackup = "";
27249
+ if (props.searchable) {
27250
+ lewTreeRef.value.search("");
27200
27251
  }
27201
- lewTreeRef.value.reset();
27202
27252
  }
27203
- watch(treeSelectValue, (newVal) => {
27204
- setKeywordLabel(newVal);
27205
- });
27206
- const getPlaceholder = computed(() => {
27207
- return state.keywordBackup || props.placeholder || locale.t("treeSelect.placeholder");
27208
- });
27253
+ watch(
27254
+ () => props.multiple,
27255
+ (isMultiple) => {
27256
+ if (isMultiple && !Array.isArray(treeSelectValue.value)) {
27257
+ treeSelectValue.value = treeSelectValue.value ? [treeSelectValue.value] : [];
27258
+ }
27259
+ },
27260
+ { immediate: true }
27261
+ );
27209
27262
  __expose({ show, hide: hide2 });
27210
27263
  return (_ctx, _cache) => {
27211
27264
  return openBlock(), createBlock(unref(_sfc_main$U), {
@@ -27218,59 +27271,30 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
27218
27271
  "trigger-width": _ctx.width,
27219
27272
  disabled: _ctx.disabled || _ctx.readonly || unref(state).initLoading,
27220
27273
  placement: "bottom-start",
27274
+ "hide-on-click": _ctx.searchable || _ctx.multiple ? false : true,
27221
27275
  loading: unref(state).searchLoading,
27222
27276
  onShow: showHandle,
27223
27277
  onHide: hideHandle
27224
27278
  }, {
27225
27279
  trigger: withCtx(() => [
27226
- createElementVNode("div", {
27280
+ createVNode(CommonInput, {
27227
27281
  ref_key: "lewSelectRef",
27228
27282
  ref: lewSelectRef,
27229
- class: normalizeClass(["lew-select", unref(getSelectClassName)])
27230
- }, [
27231
- unref(state).initLoading ? (openBlock(), createElementBlock("div", _hoisted_1$g, [
27232
- createVNode(CommonIcon, {
27233
- size: unref(getIconSize),
27234
- loading: unref(state).initLoading,
27235
- type: "loading"
27236
- }, null, 8, ["size", "loading"])
27237
- ])) : (openBlock(), createBlock(CommonIcon, {
27238
- key: 1,
27239
- size: unref(getIconSize),
27240
- type: "chevron-down",
27241
- class: normalizeClass(["lew-icon-select", {
27242
- "lew-icon-select-hide": _ctx.clearable && unref(state).keyword
27243
- }])
27244
- }, null, 8, ["size", "class"])),
27245
- createVNode(Transition, { name: "lew-form-icon-ani" }, {
27246
- default: withCtx(() => [
27247
- _ctx.clearable && unref(state).keyword && !_ctx.readonly ? (openBlock(), createBlock(CommonIcon, {
27248
- key: 0,
27249
- size: unref(getIconSize),
27250
- type: "close",
27251
- class: normalizeClass(["lew-form-icon-close", {
27252
- "lew-form-icon-close-focus": unref(state).visible
27253
- }]),
27254
- onClick: withModifiers(clearHandle, ["stop"])
27255
- }, null, 8, ["size", "class"])) : createCommentVNode("", true)
27256
- ]),
27257
- _: 1
27258
- }),
27259
- withDirectives(createElementVNode("input", {
27260
- ref_key: "inputRef",
27261
- ref: inputRef,
27262
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(state).keyword = $event),
27263
- class: "lew-value",
27264
- title: unref(state).keyword,
27265
- style: normalizeStyle(unref(getValueStyle)),
27266
- readonly: !_ctx.searchable,
27267
- placeholder: unref(getPlaceholder),
27268
- onInput: _cache[1] || (_cache[1] = //@ts-ignore
27269
- (...args) => unref(searchDebounce) && unref(searchDebounce)(...args))
27270
- }, null, 44, _hoisted_2$c), [
27271
- [vModelText, unref(state).keyword]
27272
- ])
27273
- ], 2)
27283
+ modelValue: treeSelectValue.value,
27284
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => treeSelectValue.value = $event),
27285
+ multiple: _ctx.multiple,
27286
+ loading: unref(state).initLoading,
27287
+ clearable: _ctx.clearable,
27288
+ readonly: _ctx.readonly,
27289
+ disabled: _ctx.disabled || unref(state).initLoading,
27290
+ size: _ctx.size,
27291
+ placeholder: _ctx.placeholder,
27292
+ width: unref(any2px)(_ctx.width),
27293
+ focus: unref(state).visible,
27294
+ "format-items": unref(formatItems),
27295
+ onClear: clearHandle,
27296
+ onDelete: deleteTag
27297
+ }, null, 8, ["modelValue", "multiple", "loading", "clearable", "readonly", "disabled", "size", "placeholder", "width", "focus", "format-items"])
27274
27298
  ]),
27275
27299
  "popover-body": withCtx(() => [
27276
27300
  createElementVNode("div", {
@@ -27278,14 +27302,14 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
27278
27302
  style: normalizeStyle(`width:${unref(state).selectWidth}px`)
27279
27303
  }, [
27280
27304
  renderSlot(_ctx.$slots, "header", {}, void 0, true),
27281
- createElementVNode("div", _hoisted_3$a, [
27282
- _ctx.searchable && unref(state).resultText ? (openBlock(), createElementBlock("div", _hoisted_4$5, toDisplayString$1(unref(state).resultText), 1)) : createCommentVNode("", true),
27283
- createElementVNode("div", _hoisted_5$4, [
27305
+ createElementVNode("div", _hoisted_1$g, [
27306
+ _ctx.searchable && unref(state).resultText ? (openBlock(), createElementBlock("div", _hoisted_2$c, toDisplayString$1(unref(state).resultText), 1)) : createCommentVNode("", true),
27307
+ createElementVNode("div", _hoisted_3$a, [
27284
27308
  createVNode(unref(LewTree), mergeProps({
27285
27309
  ref_key: "lewTreeRef",
27286
27310
  ref: lewTreeRef,
27287
27311
  modelValue: treeSelectValue.value,
27288
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => treeSelectValue.value = $event)
27312
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => treeSelectValue.value = $event)
27289
27313
  }, {
27290
27314
  keyField: _ctx.keyField,
27291
27315
  labelField: _ctx.labelField,
@@ -27296,11 +27320,14 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
27296
27320
  dataSource: _ctx.dataSource,
27297
27321
  loadMethod: _ctx.loadMethod,
27298
27322
  initMethod: unref(_initMethod),
27299
- expandAll: _ctx.expandAll
27323
+ expandAll: _ctx.expandAll,
27324
+ multiple: _ctx.multiple,
27325
+ onlyLeafSelectable: _ctx.onlyLeafSelectable,
27326
+ free: _ctx.free
27300
27327
  }, {
27301
27328
  "is-select": true,
27302
- onLoadStart: _cache[3] || (_cache[3] = ($event) => unref(state).searchLoading = true),
27303
- onLoadEnd: _cache[4] || (_cache[4] = ($event) => (unref(state).searchLoading = false, unref(state).initLoading = false, unref(state).resultText = $event)),
27329
+ onLoadStart: _cache[2] || (_cache[2] = ($event) => unref(state).searchLoading = true),
27330
+ onLoadEnd: _cache[3] || (_cache[3] = ($event) => (unref(state).searchLoading = false, unref(state).initLoading = false, unref(state).resultText = $event)),
27304
27331
  onChange: change
27305
27332
  }), createSlots({ _: 2 }, [
27306
27333
  _ctx.$slots.empty ? {
@@ -27324,11 +27351,11 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
27324
27351
  ], 6)
27325
27352
  ]),
27326
27353
  _: 3
27327
- }, 8, ["style", "trigger", "trigger-width", "disabled", "loading"]);
27354
+ }, 8, ["style", "trigger", "trigger-width", "disabled", "hide-on-click", "loading"]);
27328
27355
  };
27329
27356
  }
27330
27357
  });
27331
- const LewTreeSelect = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-0f4c61a3"]]);
27358
+ const LewTreeSelect = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-d65fa3b8"]]);
27332
27359
  const uploadEmits = {
27333
27360
  change: (files) => files,
27334
27361
  delete: (file) => file
@@ -29422,11 +29449,6 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
29422
29449
  };
29423
29450
  }
29424
29451
  });
29425
- const textTrimEmits = {
29426
- click: (event) => event,
29427
- mouseenter: () => true,
29428
- mouseleave: () => true
29429
- };
29430
29452
  const textTrimProps = {
29431
29453
  text: {
29432
29454
  type: String,
@@ -29600,10 +29622,8 @@ function clearMeasureCache() {
29600
29622
  const _sfc_main$d = /* @__PURE__ */ defineComponent({
29601
29623
  __name: "LewTextTrim",
29602
29624
  props: textTrimProps,
29603
- emits: ["click", "mouseenter", "mouseleave"],
29604
- setup(__props, { emit: __emit }) {
29625
+ setup(__props) {
29605
29626
  const props = __props;
29606
- const emit = __emit;
29607
29627
  const lewTextTrimRef = ref();
29608
29628
  const lewTextTrimPopRef = ref();
29609
29629
  const displayText = ref("");
@@ -29697,16 +29717,9 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
29697
29717
  requestAnimationFrame(calculateDisplayText);
29698
29718
  }
29699
29719
  const debouncedCalculate = /* @__PURE__ */ useDebounceFn(calculateDisplayText, 250);
29700
- function handleClick(event) {
29701
- emit("click", event);
29702
- }
29703
29720
  function handleMouseEnter() {
29704
- emit("mouseenter");
29705
29721
  initTippy();
29706
29722
  }
29707
- function handleMouseLeave() {
29708
- emit("mouseleave");
29709
- }
29710
29723
  onMounted(() => {
29711
29724
  initCalculateDisplayText();
29712
29725
  useResizeObserver(lewTextTrimRef, debouncedCalculate);
@@ -29722,9 +29735,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
29722
29735
  ref: lewTextTrimRef,
29723
29736
  class: "lew-text-trim-wrapper",
29724
29737
  style: normalizeStyle(textTrimStyle.value),
29725
- onClick: handleClick,
29726
- onMouseenter: handleMouseEnter,
29727
- onMouseleave: handleMouseLeave
29738
+ onMouseenter: handleMouseEnter
29728
29739
  }, [
29729
29740
  _ctx.text ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
29730
29741
  createTextVNode(toDisplayString$1(displayText.value), 1)
@@ -29740,7 +29751,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
29740
29751
  };
29741
29752
  }
29742
29753
  });
29743
- const LewTextTrim = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-4408f6f3"]]);
29754
+ const LewTextTrim = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-b184c886"]]);
29744
29755
  const titleEmits = {
29745
29756
  click: (event) => event
29746
29757
  };
@@ -29853,10 +29864,12 @@ const actionBoxProps = {
29853
29864
  },
29854
29865
  dropdownLabel: {
29855
29866
  type: null,
29867
+ typePopKeys: ["LewComponentSource"],
29856
29868
  default: "More"
29857
29869
  },
29858
29870
  dropdownIcon: {
29859
- type: null
29871
+ type: null,
29872
+ typePopKeys: ["LewComponentSource"]
29860
29873
  },
29861
29874
  iconOnly: {
29862
29875
  type: Boolean,
@@ -31481,7 +31494,6 @@ const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
31481
31494
  tabsProps,
31482
31495
  tagEmits,
31483
31496
  tagProps,
31484
- textTrimEmits,
31485
31497
  textTrimProps,
31486
31498
  textareaEmits,
31487
31499
  textareaModel,
@@ -38955,7 +38967,6 @@ export {
38955
38967
  tabsProps,
38956
38968
  tagEmits,
38957
38969
  tagProps,
38958
- textTrimEmits,
38959
38970
  textTrimProps,
38960
38971
  textareaEmits,
38961
38972
  textareaModel,