lew-ui 2.7.57 → 2.7.60

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 (38) hide show
  1. package/LICENSE +21 -21
  2. package/dist/_components/CommonInput.vue.d.ts +499 -0
  3. package/dist/components/data/table/src/LewTable.vue.d.ts +1 -1
  4. package/dist/components/data/tree/src/LewTree.vue.d.ts +12 -1
  5. package/dist/components/data/tree/src/props.d.ts +5 -0
  6. package/dist/components/feedback/drawer/src/LewDrawer.vue.d.ts +22 -0
  7. package/dist/components/feedback/drawer/src/props.d.ts +10 -0
  8. package/dist/components/form/cascader/src/LewCascader.vue.d.ts +46 -31
  9. package/dist/components/form/cascader/src/cascader.d.ts +15 -0
  10. package/dist/components/form/cascader/src/emits.d.ts +8 -1
  11. package/dist/components/form/cascader/src/props.d.ts +15 -10
  12. package/dist/components/form/index.d.ts +0 -1
  13. package/dist/components/form/input/src/LewInput.vue.d.ts +2 -2
  14. package/dist/components/form/input-number/src/LewInputNumber.vue.d.ts +2 -2
  15. package/dist/components/form/input-tag/src/LewInputTag.vue.d.ts +4 -4
  16. package/dist/components/form/select/src/LewSelect.vue.d.ts +1480 -411
  17. package/dist/components/form/select/src/emits.d.ts +5 -1
  18. package/dist/components/form/select/src/props.d.ts +7 -2
  19. package/dist/components/form/textarea/src/LewTextarea.vue.d.ts +4 -2
  20. package/dist/components/form/tree-select/src/LewTreeSelect.vue.d.ts +40 -23
  21. package/dist/components/form/tree-select/src/props.d.ts +0 -5
  22. package/dist/components/form/tree-select-multiple/index.d.ts +3 -0
  23. package/dist/components/form/{select-multiple/src/LewSelectMultiple.vue.d.ts → tree-select-multiple/src/LewTreeSelectMultiple.vue.d.ts} +492 -930
  24. package/dist/components/form/tree-select-multiple/src/emits.d.ts +4 -0
  25. package/dist/components/form/{select-multiple → tree-select-multiple}/src/props.d.ts +63 -55
  26. package/dist/components/navigation/steps/src/LewSteps.vue.d.ts +21 -1
  27. package/dist/components/navigation/steps/src/props.d.ts +8 -0
  28. package/dist/hooks/index.d.ts +4 -2
  29. package/dist/hooks/useDOMCreate.d.ts +1 -0
  30. package/dist/hooks/useEventListener.d.ts +1 -0
  31. package/dist/hooks/useTreeSelection.d.ts +35 -0
  32. package/dist/index.css +1 -1
  33. package/dist/index.js +1623 -1722
  34. package/dist/index.umd.cjs +7 -7
  35. package/dist/types/components.d.ts +3 -1
  36. package/package.json +1 -1
  37. package/dist/components/form/select-multiple/index.d.ts +0 -3
  38. package/dist/components/form/select-multiple/src/emits.d.ts +0 -11
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { h, defineComponent, computed, createBlock, openBlock, resolveDynamicComponent, normalizeStyle, normalizeClass, unref, createApp, mergeModels, useModel, provide, watch, toRaw, createElementBlock, renderSlot, ref, Transition, withCtx, inject, createVNode, Fragment, createCommentVNode, createElementVNode, renderList, createTextVNode, toDisplayString as toDisplayString$1, isVNode as isVNode$1, mergeProps, getCurrentInstance, resolveDirective, withDirectives, onMounted, nextTick, createSlots, reactive, getCurrentScope, onScopeDispose, shallowRef, shallowReadonly, toValue, isRef, readonly, resolveComponent, onUnmounted, withModifiers, normalizeProps, guardReactiveProps, vShow, markRaw, Teleport, onActivated, onDeactivated, onBeforeUnmount, shallowReactive, onBeforeMount, vModelText, useCssVars, vModelDynamic, TransitionGroup, useSlots, vModelCheckbox, watchEffect, render as render$1, effectScope, Text } from "vue";
1
+ import { h, defineComponent, computed, createBlock, openBlock, resolveDynamicComponent, normalizeStyle, normalizeClass, unref, createApp, mergeModels, useModel, provide, watch, toRaw, createElementBlock, renderSlot, ref, Transition, withCtx, inject, createVNode, Fragment, createCommentVNode, createElementVNode, renderList, createTextVNode, toDisplayString as toDisplayString$1, isVNode as isVNode$1, mergeProps, getCurrentInstance, resolveDirective, withDirectives, onMounted, nextTick, createSlots, reactive, getCurrentScope, onScopeDispose, shallowRef, shallowReadonly, toValue, isRef, readonly, resolveComponent, onUnmounted, withModifiers, normalizeProps, guardReactiveProps, vShow, markRaw, Teleport, onActivated, onDeactivated, TransitionGroup, onBeforeUnmount, shallowReactive, onBeforeMount, vModelText, useCssVars, vModelDynamic, vModelCheckbox, watchEffect, render as render$1, effectScope, Text } from "vue";
2
2
  const collapseItemEmits = {
3
3
  change: (expanded, key) => ({ expanded, key })
4
4
  };
@@ -1571,6 +1571,9 @@ function isEmpty(value) {
1571
1571
  }
1572
1572
  return true;
1573
1573
  }
1574
+ function isEqual(value, other) {
1575
+ return baseIsEqual(value, other);
1576
+ }
1574
1577
  var keyBy = createAggregator(function(result, value, key) {
1575
1578
  baseAssignValue(result, key, value);
1576
1579
  });
@@ -5429,9 +5432,8 @@ const validObjectFitList = ["fill", "contain", "cover", "none", "scale-down"];
5429
5432
  const validObjectPositionList = ["center", "top", "bottom", "left", "right", "top left", "top right", "bottom left", "bottom right"];
5430
5433
  const validTagTypeList = ["fill", "light", "ghost"];
5431
5434
  const validBreadcrumbSeparatorList = ["shoulder", "sprit"];
5432
- const validSelectMultipleValueLayout = ["tag", "text"];
5433
5435
  const validStepsStatusList = ["pending", "loading", "done", "error", "warning"];
5434
- const validFormItemAsList = ["input", "textarea", "input-tag", "checkbox-group", "radio-group", "checkbox", "select", "select-multiple", "date-picker", "date-range-picker", "tabs", "cascader", "switch", "button", "upload", "input-number", "slider", "slider-range", "color-picker", "rate", "tree-select"];
5436
+ const validFormItemAsList = ["input", "textarea", "input-tag", "checkbox-group", "radio-group", "checkbox", "select", "date-picker", "date-range-picker", "tabs", "cascader", "switch", "button", "upload", "input-number", "slider", "slider-range", "color-picker", "rate", "tree-select"];
5435
5437
  const validInputTypeList = ["text", "password"];
5436
5438
  const validInputPrefixesTypeList = ["icon", "select", "text"];
5437
5439
  const validInputSuffixTypeList = ["icon", "select", "text"];
@@ -6426,7 +6428,6 @@ const formTypeAsMap = {
6426
6428
  "radio-group": "string",
6427
6429
  "checkbox": "boolean",
6428
6430
  "select": "string",
6429
- "select-multiple": "array",
6430
6431
  "date-picker": "date",
6431
6432
  "date-range-picker": "array",
6432
6433
  "tabs": "string",
@@ -7298,7 +7299,7 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
7298
7299
  emit(
7299
7300
  "change",
7300
7301
  toRaw({
7301
- currentPage: currentPage.value,
7302
+ currentPage: page,
7302
7303
  pageSize: state.pageSize
7303
7304
  })
7304
7305
  );
@@ -7469,7 +7470,7 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
7469
7470
  };
7470
7471
  }
7471
7472
  });
7472
- const LewPagination = /* @__PURE__ */ _export_sfc(_sfc_main$12, [["__scopeId", "data-v-ed4ad664"]]);
7473
+ const LewPagination = /* @__PURE__ */ _export_sfc(_sfc_main$12, [["__scopeId", "data-v-bd2827bf"]]);
7473
7474
  const tableEmits = {
7474
7475
  sortChange: (sortValue) => sortValue || typeof sortValue === "undefined",
7475
7476
  selectChange: (selectedKeys) => selectedKeys || typeof selectedKeys === "undefined",
@@ -8468,8 +8469,8 @@ const SortIcon = /* @__PURE__ */ _export_sfc(_sfc_main$11, [["__scopeId", "data-
8468
8469
  const _hoisted_1$P = { class: "lew-table-header" };
8469
8470
  const _hoisted_2$y = { class: "lew-table-tr" };
8470
8471
  const _hoisted_3$r = { class: "lew-table-main" };
8471
- const _hoisted_4$k = { class: "lew-table-tr" };
8472
- const _hoisted_5$h = { class: "lew-table-tr" };
8472
+ const _hoisted_4$i = { class: "lew-table-tr" };
8473
+ const _hoisted_5$g = { class: "lew-table-tr" };
8473
8474
  const _hoisted_6$b = {
8474
8475
  key: 0,
8475
8476
  class: "lew-table-empty"
@@ -9441,7 +9442,7 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
9441
9442
  ])
9442
9443
  ], 512)) : createCommentVNode("", true),
9443
9444
  createElementVNode("div", _hoisted_3$r, [
9444
- createElementVNode("div", _hoisted_4$k, [
9445
+ createElementVNode("div", _hoisted_4$i, [
9445
9446
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(nonFixedHeaderColumns), (column) => {
9446
9447
  return openBlock(), createBlock(readerHeaderTd, {
9447
9448
  key: column.field,
@@ -9460,7 +9461,7 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
9460
9461
  ref: fixedRightRef,
9461
9462
  class: "lew-table-fixed-right"
9462
9463
  }, [
9463
- createElementVNode("div", _hoisted_5$h, [
9464
+ createElementVNode("div", _hoisted_5$g, [
9464
9465
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(getFixedHeaderColumns)("right"), (column) => {
9465
9466
  return openBlock(), createBlock(readerHeaderTd, {
9466
9467
  key: column.field,
@@ -9831,6 +9832,14 @@ const treeProps = {
9831
9832
  componentName: "LewTree",
9832
9833
  propName: "isSelect"
9833
9834
  })
9835
+ },
9836
+ onlyLeafSelectable: {
9837
+ type: Boolean,
9838
+ default: false,
9839
+ validator: validators.boolean({
9840
+ componentName: "LewTree",
9841
+ propName: "onlyLeafSelectable"
9842
+ })
9834
9843
  }
9835
9844
  };
9836
9845
  const treeItemProps = {
@@ -9905,7 +9914,7 @@ function findLeafNodes(tree = [], keyField = "key") {
9905
9914
  tree.forEach((node) => traverse(node));
9906
9915
  return Array.from(leafNodes);
9907
9916
  }
9908
- function formatTree({
9917
+ function formatTree$1({
9909
9918
  dataSource,
9910
9919
  parent = null,
9911
9920
  parentKeyPaths = [],
@@ -9943,7 +9952,7 @@ function formatTree({
9943
9952
  }
9944
9953
  return {
9945
9954
  ...currentNode,
9946
- children: children?.length > 0 ? formatTree({
9955
+ children: children?.length > 0 ? formatTree$1({
9947
9956
  dataSource: children,
9948
9957
  parent: currentNode,
9949
9958
  parentKeyPaths: keyPaths,
@@ -9970,7 +9979,7 @@ async function transformTree({
9970
9979
  try {
9971
9980
  const _tree = await initMethod();
9972
9981
  if (Array.isArray(_tree)) {
9973
- tree = formatTree({
9982
+ tree = formatTree$1({
9974
9983
  dataSource: _tree,
9975
9984
  parentKeyPaths: [],
9976
9985
  parentLabelPaths: [],
@@ -9995,7 +10004,7 @@ async function transformTree({
9995
10004
  };
9996
10005
  }
9997
10006
  } else if (dataSource?.length > 0) {
9998
- tree = formatTree({
10007
+ tree = formatTree$1({
9999
10008
  dataSource,
10000
10009
  parentKeyPaths: [],
10001
10010
  parentLabelPaths: [],
@@ -10020,7 +10029,7 @@ async function transformTree({
10020
10029
  };
10021
10030
  filterTree(tree);
10022
10031
  if (_tree.length > 0) {
10023
- tree = formatTree({
10032
+ tree = formatTree$1({
10024
10033
  dataSource: _tree,
10025
10034
  parentKeyPaths: [],
10026
10035
  parentLabelPaths: [],
@@ -10162,7 +10171,7 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent({
10162
10171
  if (status === "success") {
10163
10172
  loaded.value = true;
10164
10173
  insertChildByKey(_dataSource.value, props.__key, result);
10165
- _dataSource.value = formatTree({
10174
+ _dataSource.value = formatTree$1({
10166
10175
  dataSource: _dataSource.value,
10167
10176
  keyField,
10168
10177
  labelField,
@@ -10302,6 +10311,7 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent({
10302
10311
  loadMethod: props.loadMethod,
10303
10312
  keyField: props.keyField,
10304
10313
  labelField: props.labelField,
10314
+ onlyLeafSelectable: props.onlyLeafSelectable,
10305
10315
  cacheDataSource,
10306
10316
  _dataSource
10307
10317
  });
@@ -10459,7 +10469,7 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent({
10459
10469
  };
10460
10470
  }
10461
10471
  });
10462
- const LewTree = /* @__PURE__ */ _export_sfc(_sfc_main$_, [["__scopeId", "data-v-050fc853"]]);
10472
+ const LewTree = /* @__PURE__ */ _export_sfc(_sfc_main$_, [["__scopeId", "data-v-cad21cb7"]]);
10463
10473
  const alertEmits = {
10464
10474
  close: () => true
10465
10475
  };
@@ -10506,11 +10516,11 @@ const _hoisted_3$q = {
10506
10516
  key: 1,
10507
10517
  class: "lew-alert-title"
10508
10518
  };
10509
- const _hoisted_4$j = {
10519
+ const _hoisted_4$h = {
10510
10520
  key: 2,
10511
10521
  class: "lew-alert-content"
10512
10522
  };
10513
- const _hoisted_5$g = {
10523
+ const _hoisted_5$f = {
10514
10524
  key: 3,
10515
10525
  class: "lew-alert-content"
10516
10526
  };
@@ -10545,9 +10555,9 @@ const _sfc_main$Z = /* @__PURE__ */ defineComponent({
10545
10555
  _ctx.$slots.title ? (openBlock(), createElementBlock("div", _hoisted_2$x, [
10546
10556
  renderSlot(_ctx.$slots, "title", {}, void 0, true)
10547
10557
  ])) : props.title ? (openBlock(), createElementBlock("div", _hoisted_3$q, toDisplayString$1(props.title), 1)) : createCommentVNode("", true),
10548
- _ctx.$slots.content ? (openBlock(), createElementBlock("div", _hoisted_4$j, [
10558
+ _ctx.$slots.content ? (openBlock(), createElementBlock("div", _hoisted_4$h, [
10549
10559
  renderSlot(_ctx.$slots, "content", {}, void 0, true)
10550
- ])) : props.content ? (openBlock(), createElementBlock("div", _hoisted_5$g, toDisplayString$1(props.content), 1)) : createCommentVNode("", true),
10560
+ ])) : props.content ? (openBlock(), createElementBlock("div", _hoisted_5$f, toDisplayString$1(props.content), 1)) : createCommentVNode("", true),
10551
10561
  _ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_6$a, [
10552
10562
  renderSlot(_ctx.$slots, "footer", {}, void 0, true)
10553
10563
  ])) : createCommentVNode("", true)
@@ -10566,10 +10576,6 @@ const LewAlert = /* @__PURE__ */ _export_sfc(_sfc_main$Z, [["__scopeId", "data-v
10566
10576
  const drawerEmits = {
10567
10577
  close: () => true
10568
10578
  };
10569
- function useEventListener(target, event, callback) {
10570
- onMounted(() => target.addEventListener(event, callback, true));
10571
- onUnmounted(() => target.removeEventListener(event, callback, true));
10572
- }
10573
10579
  function useDOMCreate(nodeId) {
10574
10580
  const node = document.getElementById(nodeId);
10575
10581
  if (node) ;
@@ -10579,6 +10585,241 @@ function useDOMCreate(nodeId) {
10579
10585
  document.body.appendChild(newNode);
10580
10586
  }
10581
10587
  }
10588
+ function useEventListener(target, event, callback) {
10589
+ onMounted(() => target.addEventListener(event, callback, true));
10590
+ onUnmounted(() => target.removeEventListener(event, callback, true));
10591
+ }
10592
+ function useTreeSelection() {
10593
+ const tree = ref([]);
10594
+ const parentMap = /* @__PURE__ */ new Map();
10595
+ const childrenMap = /* @__PURE__ */ new Map();
10596
+ const allDescendantsMap = /* @__PURE__ */ new Map();
10597
+ const disabledMap = /* @__PURE__ */ new Map();
10598
+ const selectedSet = /* @__PURE__ */ new Set();
10599
+ const indeterminateSet = /* @__PURE__ */ new Set();
10600
+ const selectedKeys = ref([]);
10601
+ const indeterminateKeys = ref([]);
10602
+ function buildMaps() {
10603
+ parentMap.clear();
10604
+ childrenMap.clear();
10605
+ allDescendantsMap.clear();
10606
+ disabledMap.clear();
10607
+ const dfs = (node, parent) => {
10608
+ parentMap.set(node.key, parent);
10609
+ const directChildren = node.children?.map((c) => c.key) || [];
10610
+ childrenMap.set(node.key, directChildren);
10611
+ disabledMap.set(node.key, !!node.disabled);
10612
+ const allDescendants = [];
10613
+ const collectDescendants = (n) => {
10614
+ n.children?.forEach((child) => {
10615
+ allDescendants.push(child.key);
10616
+ collectDescendants(child);
10617
+ });
10618
+ };
10619
+ collectDescendants(node);
10620
+ allDescendantsMap.set(node.key, allDescendants);
10621
+ node.children?.forEach((child) => dfs(child, node.key));
10622
+ };
10623
+ unref(tree).forEach((root2) => dfs(root2, null));
10624
+ }
10625
+ buildMaps();
10626
+ function flush() {
10627
+ selectedKeys.value = Array.from(selectedSet);
10628
+ indeterminateKeys.value = Array.from(indeterminateSet);
10629
+ }
10630
+ function isLeafNode(key) {
10631
+ const children = childrenMap.get(key) || [];
10632
+ return children.length === 0;
10633
+ }
10634
+ function isNodeDisabled(key) {
10635
+ return disabledMap.get(key) || false;
10636
+ }
10637
+ function updateNodeState(key) {
10638
+ const children = childrenMap.get(key) || [];
10639
+ if (children.length === 0) {
10640
+ indeterminateSet.delete(key);
10641
+ return;
10642
+ }
10643
+ const enabledChildren = children.filter((child) => !isNodeDisabled(child));
10644
+ if (enabledChildren.length === 0) {
10645
+ selectedSet.delete(key);
10646
+ indeterminateSet.delete(key);
10647
+ return;
10648
+ }
10649
+ const selectedChildren = enabledChildren.filter((child) => selectedSet.has(child));
10650
+ const indeterminateChildren = enabledChildren.filter((child) => indeterminateSet.has(child));
10651
+ if (selectedChildren.length === enabledChildren.length) {
10652
+ selectedSet.add(key);
10653
+ indeterminateSet.delete(key);
10654
+ } else if (selectedChildren.length > 0 || indeterminateChildren.length > 0) {
10655
+ selectedSet.delete(key);
10656
+ indeterminateSet.add(key);
10657
+ } else {
10658
+ selectedSet.delete(key);
10659
+ indeterminateSet.delete(key);
10660
+ }
10661
+ }
10662
+ function updateAncestors(key) {
10663
+ let parent = parentMap.get(key);
10664
+ while (parent !== void 0 && parent !== null) {
10665
+ updateNodeState(parent);
10666
+ parent = parentMap.get(parent);
10667
+ }
10668
+ }
10669
+ function selectNodeAndDescendants(key) {
10670
+ if (isNodeDisabled(key)) {
10671
+ return;
10672
+ }
10673
+ selectedSet.add(key);
10674
+ indeterminateSet.delete(key);
10675
+ const descendants = allDescendantsMap.get(key) || [];
10676
+ descendants.forEach((descendant) => {
10677
+ if (!isNodeDisabled(descendant)) {
10678
+ selectedSet.add(descendant);
10679
+ indeterminateSet.delete(descendant);
10680
+ }
10681
+ });
10682
+ }
10683
+ function deselectNodeAndDescendants(key) {
10684
+ selectedSet.delete(key);
10685
+ indeterminateSet.delete(key);
10686
+ const descendants = allDescendantsMap.get(key) || [];
10687
+ descendants.forEach((descendant) => {
10688
+ selectedSet.delete(descendant);
10689
+ indeterminateSet.delete(descendant);
10690
+ });
10691
+ }
10692
+ function init({ tree: _tree, keys: keys2 }) {
10693
+ if ((_tree || []).length > 0) {
10694
+ tree.value = _tree;
10695
+ }
10696
+ buildMaps();
10697
+ for (const key of selectedSet) {
10698
+ if (!parentMap.has(key) && !childrenMap.has(key)) {
10699
+ selectedSet.delete(key);
10700
+ }
10701
+ }
10702
+ for (const key of indeterminateSet) {
10703
+ if (!parentMap.has(key) && !childrenMap.has(key)) {
10704
+ indeterminateSet.delete(key);
10705
+ }
10706
+ }
10707
+ recompute();
10708
+ selectedSet.clear();
10709
+ indeterminateSet.clear();
10710
+ if (Array.isArray(keys2)) {
10711
+ keys2.forEach((key) => {
10712
+ if (parentMap.has(key) || childrenMap.has(key)) {
10713
+ if (isNodeDisabled(key)) {
10714
+ return;
10715
+ }
10716
+ selectNodeAndDescendants(key);
10717
+ }
10718
+ });
10719
+ const processedAncestors = /* @__PURE__ */ new Set();
10720
+ keys2.forEach((key) => {
10721
+ if (parentMap.has(key) || childrenMap.has(key)) {
10722
+ let parent = parentMap.get(key);
10723
+ while (parent !== void 0 && parent !== null && !processedAncestors.has(parent)) {
10724
+ updateNodeState(parent);
10725
+ processedAncestors.add(parent);
10726
+ parent = parentMap.get(parent);
10727
+ }
10728
+ }
10729
+ });
10730
+ }
10731
+ flush();
10732
+ }
10733
+ function recompute() {
10734
+ indeterminateSet.clear();
10735
+ const allKeys = Array.from(parentMap.keys());
10736
+ const sortedKeys = allKeys.sort((a, b) => {
10737
+ const aChildren = childrenMap.get(a) || [];
10738
+ const bChildren = childrenMap.get(b) || [];
10739
+ return aChildren.length - bChildren.length;
10740
+ });
10741
+ sortedKeys.forEach((key) => {
10742
+ updateNodeState(key);
10743
+ });
10744
+ flush();
10745
+ }
10746
+ function addKey(key) {
10747
+ if (!parentMap.has(key) && !childrenMap.has(key)) {
10748
+ return;
10749
+ }
10750
+ if (isNodeDisabled(key)) {
10751
+ return;
10752
+ }
10753
+ selectNodeAndDescendants(key);
10754
+ updateAncestors(key);
10755
+ flush();
10756
+ }
10757
+ function removeKey(key) {
10758
+ if (!selectedSet.has(key) && !indeterminateSet.has(key)) {
10759
+ return;
10760
+ }
10761
+ deselectNodeAndDescendants(key);
10762
+ updateAncestors(key);
10763
+ flush();
10764
+ }
10765
+ function toggleKey(key) {
10766
+ if (isNodeDisabled(key)) {
10767
+ return;
10768
+ }
10769
+ if (selectedSet.has(key)) {
10770
+ removeKey(key);
10771
+ } else {
10772
+ addKey(key);
10773
+ }
10774
+ }
10775
+ const isSelected = computed(() => {
10776
+ return (key) => {
10777
+ return selectedKeys.value.includes(key);
10778
+ };
10779
+ });
10780
+ const isIndeterminate = computed(() => {
10781
+ return (key) => {
10782
+ return indeterminateKeys.value.includes(key);
10783
+ };
10784
+ });
10785
+ function getSelectedLeafKeys() {
10786
+ return Array.from(selectedSet).filter((key) => isLeafNode(key));
10787
+ }
10788
+ function findItemsByValues(values) {
10789
+ const foundItems = [];
10790
+ const findInTree = (nodes, targetValues) => {
10791
+ for (const node of nodes) {
10792
+ if (targetValues.includes(node.key)) {
10793
+ const item = {
10794
+ ...node,
10795
+ isLeaf: !node.children || node.children.length === 0
10796
+ };
10797
+ delete item.children;
10798
+ foundItems.push(item);
10799
+ }
10800
+ if (node.children && node.children.length > 0) {
10801
+ findInTree(node.children, targetValues);
10802
+ }
10803
+ }
10804
+ };
10805
+ findInTree(unref(tree), values);
10806
+ return foundItems;
10807
+ }
10808
+ flush();
10809
+ return {
10810
+ selectedKeys,
10811
+ indeterminateKeys,
10812
+ init,
10813
+ addKey,
10814
+ removeKey,
10815
+ toggleKey,
10816
+ isSelected,
10817
+ isIndeterminate,
10818
+ isNodeDisabled,
10819
+ getSelectedLeafKeys,
10820
+ findItemsByValues
10821
+ };
10822
+ }
10582
10823
  const drawerModel = {
10583
10824
  visible: {
10584
10825
  type: Boolean,
@@ -10661,6 +10902,22 @@ const drawerProps = {
10661
10902
  propName: "closeButtonProps"
10662
10903
  })
10663
10904
  },
10905
+ hideOkButton: {
10906
+ type: Boolean,
10907
+ default: false,
10908
+ validator: validators.boolean({
10909
+ componentName: "LewModal",
10910
+ propName: "hideOkButton"
10911
+ })
10912
+ },
10913
+ hideCloseButton: {
10914
+ type: Boolean,
10915
+ default: false,
10916
+ validator: validators.boolean({
10917
+ componentName: "LewModal",
10918
+ propName: "hideCloseButton"
10919
+ })
10920
+ },
10664
10921
  zIndex: {
10665
10922
  type: Number,
10666
10923
  default: 1001,
@@ -10676,7 +10933,7 @@ const _hoisted_1$L = {
10676
10933
  };
10677
10934
  const _hoisted_2$w = { class: "lew-drawer-title" };
10678
10935
  const _hoisted_3$p = { class: "lew-drawer-body-slot" };
10679
- const _hoisted_4$i = {
10936
+ const _hoisted_4$g = {
10680
10937
  key: 2,
10681
10938
  class: "lew-drawer-footer-slot"
10682
10939
  };
@@ -10856,7 +11113,7 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
10856
11113
  createElementVNode("div", _hoisted_3$p, [
10857
11114
  renderSlot(_ctx.$slots, "default")
10858
11115
  ]),
10859
- _ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_4$i, [
11116
+ _ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_4$g, [
10860
11117
  renderSlot(_ctx.$slots, "footer")
10861
11118
  ])) : !props.hideFooter ? (openBlock(), createBlock(unref(LewFlex), {
10862
11119
  key: 3,
@@ -10865,20 +11122,20 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
10865
11122
  class: "lew-drawer-footer"
10866
11123
  }, {
10867
11124
  default: withCtx(() => [
10868
- createVNode(unref(LewButton), normalizeProps(guardReactiveProps({
11125
+ !props.hideCloseButton ? (openBlock(), createBlock(unref(LewButton), normalizeProps(mergeProps({ key: 0 }, {
10869
11126
  size: "small",
10870
11127
  text: unref(locale).t("drawer.closeText"),
10871
11128
  type: "light",
10872
11129
  color: "normal",
10873
11130
  request: handleClose,
10874
11131
  ...props.closeButtonProps
10875
- })), null, 16),
10876
- createVNode(unref(LewButton), normalizeProps(guardReactiveProps({
11132
+ })), null, 16)) : createCommentVNode("", true),
11133
+ !props.hideOkButton ? (openBlock(), createBlock(unref(LewButton), normalizeProps(mergeProps({ key: 1 }, {
10877
11134
  size: "small",
10878
11135
  text: unref(locale).t("drawer.okText"),
10879
11136
  color: "primary",
10880
11137
  ...props.okButtonProps
10881
- })), null, 16)
11138
+ })), null, 16)) : createCommentVNode("", true)
10882
11139
  ]),
10883
11140
  _: 1
10884
11141
  })) : createCommentVNode("", true)
@@ -11323,7 +11580,7 @@ const _sfc_main$W = /* @__PURE__ */ defineComponent({
11323
11580
  };
11324
11581
  }
11325
11582
  });
11326
- const LewModal = /* @__PURE__ */ _export_sfc(_sfc_main$W, [["__scopeId", "data-v-9f3da8e0"]]);
11583
+ const LewModal = /* @__PURE__ */ _export_sfc(_sfc_main$W, [["__scopeId", "data-v-6c686b17"]]);
11327
11584
  const popokButtonProps = {
11328
11585
  icon: {
11329
11586
  type: null,
@@ -11422,8 +11679,8 @@ const _hoisted_1$I = {
11422
11679
  };
11423
11680
  const _hoisted_2$u = { class: "lew-popok-box-right" };
11424
11681
  const _hoisted_3$o = { class: "lew-popok-box-right-header" };
11425
- const _hoisted_4$h = { class: "lew-popok-box-right-main" };
11426
- const _hoisted_5$f = { class: "lew-popok-box-footer" };
11682
+ const _hoisted_4$f = { class: "lew-popok-box-right-main" };
11683
+ const _hoisted_5$e = { class: "lew-popok-box-footer" };
11427
11684
  const _sfc_main$V = /* @__PURE__ */ defineComponent({
11428
11685
  __name: "LewPopok",
11429
11686
  props: popokButtonProps,
@@ -11453,7 +11710,7 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
11453
11710
  onMounted(() => {
11454
11711
  nextTick(() => {
11455
11712
  if (okRef.value)
11456
- okRef.value.focus();
11713
+ okRef.value.$el.focus();
11457
11714
  });
11458
11715
  });
11459
11716
  return (_ctx, _cache) => {
@@ -11499,14 +11756,14 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
11499
11756
  createElementVNode("div", _hoisted_3$o, [
11500
11757
  createVNode(_sfc_main$16, { "render-fn": _ctx.title }, null, 8, ["render-fn"])
11501
11758
  ]),
11502
- createElementVNode("div", _hoisted_4$h, [
11759
+ createElementVNode("div", _hoisted_4$f, [
11503
11760
  createVNode(_sfc_main$16, { "render-fn": _ctx.content }, null, 8, ["render-fn"])
11504
11761
  ])
11505
11762
  ])
11506
11763
  ]),
11507
11764
  _: 1
11508
11765
  }),
11509
- createElementVNode("div", _hoisted_5$f, [
11766
+ createElementVNode("div", _hoisted_5$e, [
11510
11767
  createVNode(unref(LewButton), {
11511
11768
  text: _ctx.cancelText || unref(locale).t("popok.cancelText"),
11512
11769
  color: "gray",
@@ -11536,7 +11793,7 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
11536
11793
  };
11537
11794
  }
11538
11795
  });
11539
- const LewPopok = /* @__PURE__ */ _export_sfc(_sfc_main$V, [["__scopeId", "data-v-322e63fb"]]);
11796
+ const LewPopok = /* @__PURE__ */ _export_sfc(_sfc_main$V, [["__scopeId", "data-v-6ea072ca"]]);
11540
11797
  const popoverEmits = {
11541
11798
  show: () => true,
11542
11799
  hide: () => true
@@ -14430,9 +14687,317 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
14430
14687
  }
14431
14688
  });
14432
14689
  const cascaderEmits = {
14433
- change: (value) => value,
14434
- clear: () => true
14690
+ change: (value, items) => ({ value, items }),
14691
+ clear: () => true,
14692
+ delete: (value, deletedItem) => ({ value, deletedItem })
14435
14693
  };
14694
+ const _hoisted_1$G = {
14695
+ key: 0,
14696
+ class: "lew-icon-loading-box"
14697
+ };
14698
+ const _hoisted_2$t = ["value", "title", "readonly", "placeholder"];
14699
+ const _sfc_main$T = /* @__PURE__ */ defineComponent({
14700
+ __name: "CommonInput",
14701
+ props: /* @__PURE__ */ mergeModels({
14702
+ size: {
14703
+ type: String,
14704
+ default: "medium"
14705
+ },
14706
+ readonly: {
14707
+ type: Boolean,
14708
+ default: false
14709
+ },
14710
+ disabled: {
14711
+ type: Boolean,
14712
+ default: false
14713
+ },
14714
+ loading: {
14715
+ type: Boolean,
14716
+ default: false
14717
+ },
14718
+ clearable: {
14719
+ type: Boolean,
14720
+ default: false
14721
+ },
14722
+ placeholder: {
14723
+ type: String,
14724
+ default: ""
14725
+ },
14726
+ width: {
14727
+ type: String,
14728
+ default: "100%"
14729
+ },
14730
+ formatItems: {
14731
+ type: null
14732
+ },
14733
+ focus: {
14734
+ type: Boolean,
14735
+ default: false
14736
+ },
14737
+ popoverVisible: {
14738
+ type: Boolean,
14739
+ default: false
14740
+ },
14741
+ multiple: {
14742
+ type: Boolean,
14743
+ default: false
14744
+ },
14745
+ searchable: {
14746
+ type: Boolean,
14747
+ default: false
14748
+ },
14749
+ selectedLabel: {
14750
+ type: String,
14751
+ default: ""
14752
+ }
14753
+ }, {
14754
+ "modelValue": {},
14755
+ "modelModifiers": {},
14756
+ "keyword": {},
14757
+ "keywordModifiers": {}
14758
+ }),
14759
+ emits: /* @__PURE__ */ mergeModels(["clear", "delete", "input"], ["update:modelValue", "update:keyword"]),
14760
+ setup(__props, { expose: __expose, emit: __emit }) {
14761
+ const props = __props;
14762
+ const emit = __emit;
14763
+ const lewSelectRef = ref();
14764
+ const selectWidth = ref();
14765
+ const inputRef = ref();
14766
+ const searchInputRef = ref();
14767
+ const modelValue = useModel(__props, "modelValue");
14768
+ const keyword = useModel(__props, "keyword");
14769
+ watch(
14770
+ () => props.focus,
14771
+ (v) => {
14772
+ if (!v && props.multiple) {
14773
+ keyword.value = "";
14774
+ }
14775
+ }
14776
+ );
14777
+ function updateWidths() {
14778
+ if (lewSelectRef.value) {
14779
+ selectWidth.value = lewSelectRef.value.clientWidth;
14780
+ }
14781
+ }
14782
+ let resizeObserver = null;
14783
+ function clearHandle() {
14784
+ emit("clear");
14785
+ }
14786
+ function inputHandle(e) {
14787
+ emit("input", e);
14788
+ }
14789
+ function deleteTag(value) {
14790
+ emit("delete", value);
14791
+ }
14792
+ const getSelectClassName = computed(() => {
14793
+ let { clearable, size, disabled, readonly: readonly2, focus: focus2, multiple, searchable } = props;
14794
+ if (multiple) {
14795
+ clearable = clearable && (modelValue.value || []).length > 0;
14796
+ } else {
14797
+ clearable = clearable && !!modelValue.value;
14798
+ }
14799
+ return object2class("lew-select", {
14800
+ clearable,
14801
+ size,
14802
+ disabled,
14803
+ readonly: readonly2,
14804
+ focus: focus2,
14805
+ searchable,
14806
+ multiple
14807
+ });
14808
+ });
14809
+ const getIconSize = computed(() => {
14810
+ const size = {
14811
+ small: 14,
14812
+ medium: 15,
14813
+ large: 16
14814
+ };
14815
+ return size[props.size];
14816
+ });
14817
+ onMounted(() => {
14818
+ updateWidths();
14819
+ if (lewSelectRef.value) {
14820
+ resizeObserver = new ResizeObserver(() => {
14821
+ updateWidths();
14822
+ });
14823
+ resizeObserver.observe(lewSelectRef.value);
14824
+ }
14825
+ });
14826
+ onUnmounted(() => {
14827
+ if (resizeObserver) {
14828
+ resizeObserver.disconnect();
14829
+ resizeObserver = null;
14830
+ }
14831
+ });
14832
+ const showClearButton = computed(() => {
14833
+ if (props.multiple) {
14834
+ return props.clearable && (modelValue.value || []).length > 0 && !props.readonly && !props.loading;
14835
+ } else {
14836
+ return props.clearable && modelValue.value && !props.readonly && !props.loading;
14837
+ }
14838
+ });
14839
+ const hasSelectedItems = computed(() => {
14840
+ if (props.multiple) {
14841
+ return (modelValue.value || []).length > 0;
14842
+ } else {
14843
+ return !!modelValue.value;
14844
+ }
14845
+ });
14846
+ const showPlaceholder = computed(() => {
14847
+ if (props.multiple && !props.searchable) {
14848
+ return (modelValue.value || []).length === 0;
14849
+ } else {
14850
+ return false;
14851
+ }
14852
+ });
14853
+ const selectedItemsText = computed(() => {
14854
+ if (!hasSelectedItems.value)
14855
+ return "";
14856
+ if (props.multiple) {
14857
+ return "";
14858
+ } else {
14859
+ return props.selectedLabel || props.formatItems;
14860
+ }
14861
+ });
14862
+ const clearButtonIconClass = computed(() => {
14863
+ return {
14864
+ "lew-form-icon-close-focus": props.focus
14865
+ };
14866
+ });
14867
+ const placeholderText = computed(() => {
14868
+ if (props.multiple) {
14869
+ return props.placeholder || locale.t("selectMultiple.placeholder");
14870
+ } else {
14871
+ return props.placeholder || locale.t("select.placeholder");
14872
+ }
14873
+ });
14874
+ const getValueStyle = computed(() => {
14875
+ return {
14876
+ opacity: props.focus ? 0.6 : 1,
14877
+ paddingRight: props.clearable ? "24px" : ""
14878
+ };
14879
+ });
14880
+ function getInputRefStyle() {
14881
+ return {
14882
+ fontSize: getComputedStyle(inputRef.value).fontSize,
14883
+ padding: getComputedStyle(inputRef.value).padding,
14884
+ fontFamily: getComputedStyle(inputRef.value).fontFamily,
14885
+ marginLeft: getComputedStyle(inputRef.value).marginLeft
14886
+ };
14887
+ }
14888
+ function focus() {
14889
+ if (props.multiple) {
14890
+ setTimeout(() => {
14891
+ searchInputRef.value?.focus();
14892
+ }, 100);
14893
+ } else {
14894
+ inputRef.value?.focus();
14895
+ }
14896
+ }
14897
+ const selectIconClass = computed(() => {
14898
+ return {
14899
+ "lew-icon-select-hide": showClearButton.value
14900
+ };
14901
+ });
14902
+ __expose({
14903
+ clearHandle,
14904
+ getInputRefStyle
14905
+ });
14906
+ return (_ctx, _cache) => {
14907
+ return openBlock(), createElementBlock("div", {
14908
+ ref_key: "lewSelectRef",
14909
+ ref: lewSelectRef,
14910
+ class: normalizeClass(["lew-select", unref(getSelectClassName)]),
14911
+ style: normalizeStyle({ width: unref(any2px)(__props.width) }),
14912
+ onClick: focus
14913
+ }, [
14914
+ __props.loading ? (openBlock(), createElementBlock("div", _hoisted_1$G, [
14915
+ createVNode(CommonIcon, {
14916
+ size: unref(getIconSize),
14917
+ loading: __props.loading,
14918
+ type: "loading"
14919
+ }, null, 8, ["size", "loading"])
14920
+ ])) : (openBlock(), createBlock(CommonIcon, {
14921
+ key: 1,
14922
+ size: unref(getIconSize),
14923
+ type: "chevron-down",
14924
+ class: normalizeClass(["lew-icon-select", unref(selectIconClass)])
14925
+ }, null, 8, ["size", "class"])),
14926
+ createVNode(Transition, { name: "lew-form-icon-ani" }, {
14927
+ default: withCtx(() => [
14928
+ unref(showClearButton) ? (openBlock(), createBlock(CommonIcon, {
14929
+ key: 0,
14930
+ size: unref(getIconSize),
14931
+ type: "close",
14932
+ class: normalizeClass(["lew-form-icon-close", unref(clearButtonIconClass)]),
14933
+ onClick: withModifiers(clearHandle, ["stop"])
14934
+ }, null, 8, ["size", "class"])) : createCommentVNode("", true)
14935
+ ]),
14936
+ _: 1
14937
+ }),
14938
+ !__props.multiple ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
14939
+ createElementVNode("input", {
14940
+ ref_key: "inputRef",
14941
+ ref: inputRef,
14942
+ value: unref(selectedItemsText),
14943
+ title: unref(selectedItemsText),
14944
+ class: "lew-value lew-single-input",
14945
+ style: normalizeStyle(unref(getValueStyle)),
14946
+ readonly: !__props.searchable,
14947
+ placeholder: unref(placeholderText),
14948
+ onInput: inputHandle
14949
+ }, null, 44, _hoisted_2$t),
14950
+ withDirectives(createElementVNode("div", { class: "lew-placeholder" }, toDisplayString$1(unref(placeholderText)), 513), [
14951
+ [vShow, unref(showPlaceholder)]
14952
+ ])
14953
+ ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 3 }, [
14954
+ withDirectives(createElementVNode("div", { class: "lew-placeholder" }, toDisplayString$1(unref(placeholderText)), 513), [
14955
+ [vShow, unref(showPlaceholder)]
14956
+ ]),
14957
+ withDirectives(createElementVNode("div", {
14958
+ class: "lew-multiple-box",
14959
+ style: normalizeStyle({ padding: unref(hasSelectedItems) ? "4px" : "" })
14960
+ }, [
14961
+ createVNode(TransitionGroup, { name: "tag-list" }, {
14962
+ default: withCtx(() => [
14963
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.formatItems, (item) => {
14964
+ return openBlock(), createBlock(unref(_sfc_main$e), {
14965
+ key: item.value,
14966
+ type: "light",
14967
+ size: props.size,
14968
+ closeable: !__props.disabled && !__props.readonly,
14969
+ onClose: ($event) => deleteTag(item.value)
14970
+ }, {
14971
+ default: withCtx(() => [
14972
+ createTextVNode(toDisplayString$1(item.label), 1)
14973
+ ]),
14974
+ _: 2
14975
+ }, 1032, ["size", "closeable", "onClose"]);
14976
+ }), 128))
14977
+ ]),
14978
+ _: 1
14979
+ }),
14980
+ __props.searchable && (props.focus || (__props.formatItems || []).length === 0) ? (openBlock(), createBlock(unref(LewInput), {
14981
+ ref_key: "searchInputRef",
14982
+ ref: searchInputRef,
14983
+ key: "search-input",
14984
+ modelValue: keyword.value,
14985
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => keyword.value = $event),
14986
+ "auto-width": unref(hasSelectedItems),
14987
+ class: "lew-multiple-search-input",
14988
+ size: __props.size,
14989
+ placeholder: !unref(hasSelectedItems) ? unref(placeholderText) : " ",
14990
+ onInput: _cache[1] || (_cache[1] = (value) => inputHandle({ target: { value } }))
14991
+ }, null, 8, ["modelValue", "auto-width", "size", "placeholder"])) : createCommentVNode("", true)
14992
+ ], 4), [
14993
+ [vShow, !unref(showPlaceholder)]
14994
+ ])
14995
+ ], 64))
14996
+ ], 6);
14997
+ };
14998
+ }
14999
+ });
15000
+ const CommonInput = /* @__PURE__ */ _export_sfc(_sfc_main$T, [["__scopeId", "data-v-51b98d83"]]);
14436
15001
  function vue3h(ele, props, children) {
14437
15002
  const { attrs, on, ...rest } = props;
14438
15003
  let event = {};
@@ -14989,6 +15554,9 @@ function useVirtList(userProps, emitFunction) {
14989
15554
  slotSize.footerSize = 0;
14990
15555
  }
14991
15556
  });
15557
+ onActivated(() => {
15558
+ scrollToOffset(reactiveData.offset);
15559
+ });
14992
15560
  function getVirtualSize2beginInView() {
14993
15561
  return reactiveData.virtualSize + getRangeSize(reactiveData.renderBegin, reactiveData.inViewBegin);
14994
15562
  }
@@ -15356,6 +15924,96 @@ const VirtList = /* @__PURE__ */ defineComponent({
15356
15924
  }, [renderStickyHeaderSlot(), renderHeaderSlot(), renderMainList(), renderFooterSlot(), renderStickyFooterSlot()]);
15357
15925
  }
15358
15926
  });
15927
+ class CascaderNodeCache {
15928
+ nodeCache = /* @__PURE__ */ new Map();
15929
+ get(value) {
15930
+ return this.nodeCache.get(value);
15931
+ }
15932
+ set(value, node) {
15933
+ this.nodeCache.set(value, node);
15934
+ }
15935
+ has(value) {
15936
+ return this.nodeCache.has(value);
15937
+ }
15938
+ clear() {
15939
+ this.nodeCache.clear();
15940
+ }
15941
+ }
15942
+ function formatTree(tree, parentValuePaths = [], parentLabelPaths = []) {
15943
+ return tree.map((node) => {
15944
+ const { value, label, children = [], isLeaf } = node;
15945
+ const valuePaths = [...parentValuePaths, value];
15946
+ const labelPaths = [...parentLabelPaths, label];
15947
+ const level = valuePaths.length - 1;
15948
+ const formattedNode = {
15949
+ ...node,
15950
+ key: value,
15951
+ valuePaths,
15952
+ labelPaths,
15953
+ level,
15954
+ parentValuePaths,
15955
+ parentLabelPaths,
15956
+ isLeaf: isLeaf ?? !children.length
15957
+ };
15958
+ if (children.length > 0) {
15959
+ formattedNode.children = formatTree(children, valuePaths, labelPaths);
15960
+ }
15961
+ return formattedNode;
15962
+ });
15963
+ }
15964
+ function findObjectByValue(treeList, value, cache2) {
15965
+ if (cache2?.has(value)) {
15966
+ return cache2.get(value) || null;
15967
+ }
15968
+ const stack = [...treeList];
15969
+ while (stack.length > 0) {
15970
+ const node = stack.pop();
15971
+ if (node.value === value) {
15972
+ cache2?.set(value, node);
15973
+ return node;
15974
+ }
15975
+ if (node.children?.length) {
15976
+ stack.push(...node.children);
15977
+ }
15978
+ }
15979
+ return null;
15980
+ }
15981
+ function findAndAddChildrenByValue(tree, value, children, cache2) {
15982
+ const stack = tree.map((node) => ({ node }));
15983
+ while (stack.length > 0) {
15984
+ const { node } = stack.pop();
15985
+ if (node.value === value) {
15986
+ node.children = children;
15987
+ cache2?.set(value, node);
15988
+ return tree;
15989
+ }
15990
+ if (node.children?.length) {
15991
+ stack.push(...node.children.map((child) => ({ node: child, parent: node })));
15992
+ }
15993
+ }
15994
+ return tree;
15995
+ }
15996
+ function findChildrenByValue(tree, value, cache2) {
15997
+ const cachedNode = cache2?.get(value);
15998
+ if (cachedNode) {
15999
+ return cachedNode.children || [];
16000
+ }
16001
+ const stack = [...tree];
16002
+ while (stack.length > 0) {
16003
+ const node = stack.pop();
16004
+ if (node.value === value) {
16005
+ cache2?.set(value, node);
16006
+ return node.children || [];
16007
+ }
16008
+ if (node.children?.length) {
16009
+ stack.push(...node.children);
16010
+ }
16011
+ }
16012
+ return [];
16013
+ }
16014
+ function createCascaderCache() {
16015
+ return new CascaderNodeCache();
16016
+ }
15359
16017
  const cascaderProps = {
15360
16018
  options: {
15361
16019
  type: Array,
@@ -15397,22 +16055,6 @@ const cascaderProps = {
15397
16055
  propName: "clearable"
15398
16056
  })
15399
16057
  },
15400
- showAllLevels: {
15401
- type: Boolean,
15402
- default: true,
15403
- validator: validators.boolean({
15404
- componentName: "LewCascader",
15405
- propName: "showAllLevels"
15406
- })
15407
- },
15408
- multiple: {
15409
- type: Boolean,
15410
- default: false,
15411
- validator: validators.boolean({
15412
- componentName: "LewCascader",
15413
- propName: "multiple"
15414
- })
15415
- },
15416
16058
  free: {
15417
16059
  type: Boolean,
15418
16060
  default: false,
@@ -15479,48 +16121,69 @@ const cascaderProps = {
15479
16121
  componentName: "LewCascader",
15480
16122
  propName: "readonly"
15481
16123
  })
16124
+ },
16125
+ onlyLeafSelectable: {
16126
+ type: Boolean,
16127
+ default: true,
16128
+ validator: validators.boolean({
16129
+ componentName: "LewCascader",
16130
+ propName: "onlyLeafSelectable"
16131
+ })
16132
+ },
16133
+ multiple: {
16134
+ type: Boolean,
16135
+ default: false,
16136
+ validator: validators.boolean({
16137
+ componentName: "LewCascader",
16138
+ propName: "multiple"
16139
+ })
16140
+ },
16141
+ showAllLevels: {
16142
+ type: Boolean,
16143
+ default: true,
16144
+ validator: validators.boolean({
16145
+ componentName: "LewCascader",
16146
+ propName: "showAllLevels"
16147
+ })
15482
16148
  }
15483
16149
  };
15484
- const _hoisted_1$G = {
16150
+ const _hoisted_1$F = {
15485
16151
  key: 0,
15486
- class: "lew-icon-loading-box"
16152
+ class: "lew-cascader-options-box"
15487
16153
  };
15488
- const _hoisted_2$t = ["onClick"];
15489
- const _sfc_main$T = /* @__PURE__ */ defineComponent({
16154
+ const _hoisted_2$s = ["onClick"];
16155
+ const _hoisted_3$n = ["title"];
16156
+ const _sfc_main$S = /* @__PURE__ */ defineComponent({
15490
16157
  __name: "LewCascader",
15491
16158
  props: /* @__PURE__ */ mergeModels(cascaderProps, {
15492
- "modelValue": { required: true },
16159
+ "modelValue": {},
15493
16160
  "modelModifiers": {}
15494
16161
  }),
15495
16162
  emits: /* @__PURE__ */ mergeModels(cascaderEmits, ["update:modelValue"]),
15496
16163
  setup(__props, { expose: __expose, emit: __emit }) {
15497
16164
  const props = __props;
15498
16165
  const emit = __emit;
15499
- const cascaderValue = useModel(__props, "modelValue");
16166
+ const modelValue = useModel(__props, "modelValue");
15500
16167
  const app = getCurrentInstance()?.appContext.app;
15501
16168
  if (app && !app.directive("tooltip")) {
15502
16169
  app.use(LewTooltip);
15503
16170
  }
15504
- const lewCascaderRef = ref();
15505
16171
  const lewPopoverRef = ref();
15506
16172
  const state = reactive({
15507
16173
  visible: false,
15508
16174
  loading: false,
15509
16175
  initLoading: true,
15510
16176
  okLoading: false,
16177
+ backupValue: void 0,
15511
16178
  optionsGroup: [],
15512
- // 分组
15513
16179
  optionsTree: [],
15514
- //
15515
- activeLabels: [],
15516
- // 激活
15517
- tobeLabels: [],
15518
- // 待确认
15519
- tobeItem: {},
15520
- keyword: ""
16180
+ activeValues: []
15521
16181
  });
16182
+ const loadedDataCache = /* @__PURE__ */ new Map();
16183
+ const nodeCache = createCascaderCache();
15522
16184
  const loadedData = reactive({});
15523
16185
  const formMethods = inject("formMethods", {});
16186
+ let isInternalUpdate = false;
15524
16187
  const _loadMethod = computed(() => {
15525
16188
  if (isFunction$1(props.loadMethod)) {
15526
16189
  return props.loadMethod;
@@ -15537,327 +16200,352 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
15537
16200
  }
15538
16201
  return false;
15539
16202
  });
15540
- function formatTree2(tree, parentValuePaths = [], parentLabelPaths = []) {
15541
- return tree.map((node) => {
15542
- const { value, label, children = [] } = node;
15543
- const valuePaths = [...parentValuePaths, value];
15544
- const labelPaths = [...parentLabelPaths, label];
15545
- const level = valuePaths.length - 1;
15546
- const _node = {
15547
- ...node,
15548
- valuePaths,
15549
- labelPaths,
15550
- level,
15551
- parentValuePaths,
15552
- parentLabelPaths
15553
- };
15554
- if ((children || []).length > 0) {
16203
+ const getCascaderWidth = computed(() => {
16204
+ const validGroups = state.optionsGroup.filter((group) => group?.length > 0).length;
16205
+ return Math.max(validGroups, 1) * 200;
16206
+ });
16207
+ const getCascaderBodyStyle = computed(() => ({
16208
+ width: `${getCascaderWidth.value}px`
16209
+ }));
16210
+ const getBodyClassName = computed(() => {
16211
+ const { size, disabled } = props;
16212
+ return object2class("lew-cascader-body", { size, disabled });
16213
+ });
16214
+ const formatItems = computed(() => {
16215
+ if (!modelValue.value) {
16216
+ return props.multiple ? [] : "";
16217
+ }
16218
+ if (!props.multiple && modelValue.value) {
16219
+ const result = findObjectByValue(
16220
+ state.optionsTree,
16221
+ modelValue.value,
16222
+ nodeCache
16223
+ );
16224
+ if (!result) {
16225
+ return "";
16226
+ }
16227
+ const { label, labelPaths } = result;
16228
+ return props.showAllLevels ? labelPaths.join(" / ") : label;
16229
+ }
16230
+ if (!modelValue.value || !Array.isArray(modelValue.value)) {
16231
+ return [];
16232
+ }
16233
+ return modelValue.value.map((value) => {
16234
+ const result = findObjectByValue(state.optionsTree, value, nodeCache);
16235
+ if (!result) {
15555
16236
  return {
15556
- ..._node,
15557
- children: formatTree2(children, valuePaths, labelPaths)
16237
+ value,
16238
+ label: value
16239
+ // 如果找不到对应的节点,使用value作为label
15558
16240
  };
15559
16241
  }
15560
- return _node;
16242
+ const { label, labelPaths } = result;
16243
+ return {
16244
+ value,
16245
+ label: props.multiple ? label : labelPaths.join(" / ")
16246
+ };
15561
16247
  });
15562
- }
15563
- function findObjectByValue(treeList, value) {
15564
- for (let i = 0; i < treeList.length; i++) {
15565
- const tree = treeList[i];
15566
- if (tree.value === value) {
15567
- return tree;
15568
- }
15569
- if (tree.children) {
15570
- const foundObject = findObjectByValue(
15571
- tree.children,
15572
- value
15573
- );
15574
- if (foundObject) {
15575
- return foundObject;
15576
- }
15577
- }
16248
+ });
16249
+ const VIRT_LIST_STYLE = {
16250
+ padding: "6px 6px 2px 6px",
16251
+ boxSizing: "border-box"
16252
+ };
16253
+ const ITEM_PADDING_STYLE = {
16254
+ height: "38px"
16255
+ };
16256
+ const {
16257
+ selectedKeys,
16258
+ init: initTreeSelection,
16259
+ isSelected,
16260
+ isIndeterminate,
16261
+ removeKey,
16262
+ toggleKey,
16263
+ findItemsByValues
16264
+ } = useTreeSelection();
16265
+ function updateTreeStructure() {
16266
+ if (state.optionsTree.length > 0 && !props.free) {
16267
+ const currentKeys = modelValue.value && Array.isArray(modelValue.value) ? modelValue.value : [];
16268
+ initTreeSelection({ tree: state.optionsTree, keys: currentKeys });
16269
+ }
16270
+ }
16271
+ function updateModelValue() {
16272
+ isInternalUpdate = true;
16273
+ let _value;
16274
+ let _items;
16275
+ if (props.onlyLeafSelectable) {
16276
+ _items = findItemsByValues(selectedKeys.value).filter((item) => item.isLeaf);
16277
+ _value = _items.map((item) => item.key);
16278
+ } else {
16279
+ _value = cloneDeep(selectedKeys.value);
16280
+ _items = findItemsByValues(selectedKeys.value);
15578
16281
  }
15579
- return null;
16282
+ modelValue.value = _value;
16283
+ emit("change", _value, _items);
16284
+ nextTick(() => {
16285
+ isInternalUpdate = false;
16286
+ });
15580
16287
  }
15581
- function findAndAddChildrenByValue(tree, value, children) {
15582
- for (const node of tree) {
15583
- if (node.value === value) {
15584
- if (!node.children) {
15585
- node.children = [];
15586
- }
15587
- node.children = children;
15588
- return tree;
15589
- }
15590
- if (node.children && node.children.length > 0) {
15591
- const result = findAndAddChildrenByValue(node.children, value, children);
15592
- if (result && result.length > 0) {
15593
- return tree;
15594
- }
15595
- }
15596
- }
15597
- return [];
16288
+ function getItemClass(templateProps) {
16289
+ const isSelected2 = Array.isArray(modelValue.value) && modelValue.value.includes(templateProps.value) || modelValue.value === templateProps.value;
16290
+ return {
16291
+ "lew-cascader-item-disabled": templateProps.disabled,
16292
+ "lew-cascader-item-active": state.activeValues?.includes(templateProps.value) || isSelected2,
16293
+ "lew-cascader-item-selected": isSelected2
16294
+ };
15598
16295
  }
15599
- function findChildrenByValue(tree, value) {
15600
- for (const node of tree) {
15601
- if (node.value === value) {
15602
- return node.children || [];
15603
- }
15604
- if (node.children && node.children.length > 0) {
15605
- const result = findChildrenByValue(node.children, value);
15606
- if (result && result.length > 0) {
15607
- return result;
15608
- }
15609
- }
15610
- }
15611
- return [];
16296
+ function getItemWrapperStyle(oIndex, oItem) {
16297
+ const style = {
16298
+ zIndex: 20 - oIndex,
16299
+ borderRadius: `0 ${oIndex === state.optionsGroup.length - 1 ? "var(--lew-border-radius-small)" : "0"} 0 0`,
16300
+ transform: oItem.length > 0 ? `translateX(${200 * oIndex}px)` : ""
16301
+ };
16302
+ return style;
15612
16303
  }
15613
16304
  async function init() {
15614
16305
  let _tree = [];
15615
- if (_initMethod.value) {
15616
- const newOptions = await _initMethod.value();
15617
- _tree = newOptions || [];
15618
- } else if (_loadMethod.value && !state.loading) {
15619
- state.loading = true;
15620
- _tree = await _loadMethod.value() || [];
15621
- state.loading = false;
15622
- } else if (props.options && props.options.length > 0) {
15623
- _tree = props.options && props.options.map((e) => {
15624
- return {
16306
+ try {
16307
+ if (_initMethod.value) {
16308
+ const newOptions = await _initMethod.value();
16309
+ _tree = newOptions || [];
16310
+ } else if (_loadMethod.value && !state.loading) {
16311
+ state.loading = true;
16312
+ _tree = await _loadMethod.value() || [];
16313
+ state.loading = false;
16314
+ } else if (props.options?.length) {
16315
+ _tree = props.options.map((e) => ({
15625
16316
  ...e,
15626
- isLeaf: !e.children || e.children && e.children.length === 0
15627
- // 没有孩子
15628
- };
15629
- }) || [];
16317
+ isLeaf: !e.children?.length
16318
+ }));
16319
+ }
16320
+ nodeCache.clear();
16321
+ loadedDataCache.clear();
16322
+ const formattedTree = formatTree(_tree);
16323
+ state.optionsGroup = [formattedTree];
16324
+ state.optionsTree = formattedTree;
16325
+ if (formattedTree.length > 0 && !props.free) {
16326
+ initTreeSelection({ tree: formattedTree, keys: modelValue.value });
16327
+ }
16328
+ } catch (error) {
16329
+ console.error("Cascader initialization failed:", error);
16330
+ state.optionsGroup = [];
16331
+ state.optionsTree = [];
16332
+ } finally {
16333
+ state.initLoading = false;
16334
+ state.loading = false;
15630
16335
  }
15631
- const __tree = formatTree2(_tree);
15632
- state.optionsGroup = [__tree];
15633
- state.optionsTree = __tree;
15634
- state.initLoading = false;
15635
16336
  }
15636
- init();
15637
- watch(
15638
- () => props.options,
15639
- (newOptions) => {
15640
- if (!_initMethod.value) {
15641
- const _tree = newOptions && newOptions.map((e) => {
15642
- return {
15643
- ...e,
15644
- isLeaf: !e.children || e.children && e.children.length === 0
15645
- };
15646
- }) || [];
15647
- const __tree = formatTree2(_tree);
15648
- state.optionsGroup = [__tree];
15649
- state.optionsTree = __tree;
16337
+ function changeCheck(item) {
16338
+ if (item.disabled) {
16339
+ return;
16340
+ }
16341
+ const itemValue = item.value;
16342
+ if (props.free) {
16343
+ let _value = modelValue.value;
16344
+ const isSelected2 = modelValue.value?.includes(itemValue);
16345
+ if (isSelected2) {
16346
+ _value = (modelValue.value || []).filter(
16347
+ (value) => value !== itemValue
16348
+ );
16349
+ } else {
16350
+ _value = [...modelValue.value || [], itemValue];
15650
16351
  }
15651
- },
15652
- {
15653
- deep: true
16352
+ const _items = findItemsByValues(_value);
16353
+ modelValue.value = _value;
16354
+ emit("change", _value, _items);
16355
+ } else {
16356
+ toggleKey(itemValue);
16357
+ updateModelValue();
15654
16358
  }
15655
- );
15656
- const virtListRefs = ref([]);
16359
+ setTimeout(() => {
16360
+ lewPopoverRef.value && lewPopoverRef.value.refresh();
16361
+ }, 100);
16362
+ }
16363
+ function getSelected() {
16364
+ if (props.multiple) {
16365
+ return findItemsByValues(modelValue.value);
16366
+ } else {
16367
+ return findObjectByValue(state.optionsTree, modelValue.value, nodeCache);
16368
+ }
16369
+ }
15657
16370
  async function selectItem(item, level) {
15658
- if (!item.isLeaf && item.labelPaths !== state.activeLabels) {
16371
+ if (item.disabled)
16372
+ return;
16373
+ if (!item.isLeaf && !isEqual(item.valuePaths, state.activeValues)) {
15659
16374
  state.optionsGroup = state.optionsGroup.slice(0, level + 1);
15660
16375
  if (_loadMethod.value && !item.isLeaf) {
15661
- if (loadedData[item.value]) {
16376
+ if (loadedDataCache.has(item.value)) {
16377
+ const _options = loadedDataCache.get(item.value);
16378
+ state.optionsGroup.push(_options);
16379
+ } else if (loadedData[item.value]) {
15662
16380
  const _options = loadedData[item.value];
15663
16381
  state.optionsGroup.push(_options);
16382
+ loadedDataCache.set(item.value, _options);
15664
16383
  } else {
15665
16384
  item.loading = true;
15666
16385
  state.okLoading = true;
15667
- const new_options = await _loadMethod.value(cloneDeep({ ...item, level })) || [];
15668
- const _tree = findAndAddChildrenByValue(
15669
- cloneDeep(state.optionsTree),
15670
- cloneDeep(item.value),
15671
- new_options
16386
+ const loadParam = {
16387
+ value: item.value,
16388
+ label: item.label,
16389
+ level
16390
+ };
16391
+ const new_options = await _loadMethod.value(loadParam) || [];
16392
+ const formattedNewOptions = formatTree(
16393
+ new_options,
16394
+ item.valuePaths,
16395
+ item.labelPaths
16396
+ );
16397
+ findAndAddChildrenByValue(
16398
+ state.optionsTree,
16399
+ item.value,
16400
+ formattedNewOptions,
16401
+ nodeCache
15672
16402
  );
15673
- state.optionsTree = formatTree2(_tree);
15674
- const _options = findChildrenByValue(state.optionsTree, item.value);
16403
+ if (!props.free) {
16404
+ updateTreeStructure();
16405
+ nextTick(() => {
16406
+ updateModelValue();
16407
+ });
16408
+ }
16409
+ const _options = findChildrenByValue(state.optionsTree, item.value, nodeCache);
15675
16410
  state.optionsGroup.push(_options);
16411
+ loadedDataCache.set(item.value, _options);
15676
16412
  loadedData[item.value] = _options;
15677
16413
  item.loading = false;
15678
16414
  state.okLoading = false;
15679
16415
  }
15680
- } else if (!item.isLeaf) {
15681
- const _options = item.children && item.children.map((e) => {
15682
- return {
15683
- ...e,
15684
- isLeaf: !e.children || e.children && e.children.length === 0
15685
- // 没有孩子
15686
- };
15687
- }) || [];
16416
+ } else if (!item.isLeaf && item.children) {
16417
+ const _options = item.children.map((e) => ({
16418
+ ...e,
16419
+ isLeaf: !e.children?.length
16420
+ }));
15688
16421
  state.optionsGroup.push(_options);
15689
16422
  }
15690
16423
  }
15691
- if (item.labelPaths === state.activeLabels) {
15692
- state.activeLabels = item.parentLabelPaths;
15693
- if (level < state.optionsGroup.length - 1) {
15694
- state.optionsGroup.pop();
16424
+ if (!props.multiple) {
16425
+ modelValue.value = item.value;
16426
+ if (props.onlyLeafSelectable && item.isLeaf) {
16427
+ setTimeout(() => {
16428
+ hide2();
16429
+ }, 100);
15695
16430
  }
15696
- } else {
15697
- state.activeLabels = item.labelPaths;
15698
- }
15699
- state.tobeItem = { ...item, children: void 0 };
15700
- if (props.free) {
15701
- checkItem(item);
15702
- } else if (item.isLeaf) {
15703
- checkItem(item);
15704
- ok();
15705
16431
  }
15706
- }
15707
- function checkItem(item) {
15708
- if (props.showAllLevels) {
15709
- if (state.tobeLabels === item.labelPaths) {
15710
- state.tobeLabels = item.parentLabelPaths;
15711
- } else {
15712
- state.tobeLabels = item.labelPaths;
16432
+ if (item.isLeaf)
16433
+ return;
16434
+ if (isEqual(item.valuePaths, state.activeValues)) {
16435
+ state.activeValues = item.parentValuePaths || [];
16436
+ if (level < state.optionsGroup.length - 1) {
16437
+ state.optionsGroup.pop();
15713
16438
  }
15714
- } else if (state.tobeLabels[0] === item.label) {
15715
- state.tobeLabels = [];
15716
16439
  } else {
15717
- state.tobeLabels = [item.label];
16440
+ state.activeValues = item.valuePaths || [];
15718
16441
  }
15719
16442
  }
15720
- async function show() {
15721
- lewPopoverRef.value.show();
15722
- }
15723
- function hide2() {
15724
- lewPopoverRef.value.hide();
15725
- }
15726
16443
  function clearHandle() {
15727
- cascaderValue.value = void 0;
15728
- state.tobeLabels = [];
15729
- state.activeLabels = [];
15730
- hide2();
15731
- init();
16444
+ Object.assign(state, {
16445
+ activeValues: [],
16446
+ visible: false
16447
+ });
16448
+ initTreeSelection({ keys: [] });
16449
+ isInternalUpdate = true;
16450
+ modelValue.value = void 0;
16451
+ emit("change", void 0, void 0);
15732
16452
  emit("clear");
15733
- emit("change", void 0);
16453
+ nextTick(() => {
16454
+ isInternalUpdate = false;
16455
+ });
16456
+ }
16457
+ function deleteTag(value) {
16458
+ removeKey(value);
16459
+ updateModelValue();
16460
+ emit("delete", modelValue.value, value);
15734
16461
  }
15735
- const getValueStyle = computed(() => {
15736
- const { size } = props;
15737
- const widthMap = {
15738
- small: "calc(100% - 24px)",
15739
- medium: "calc(100% - 24px)",
15740
- large: "calc(100% - 24px)"
15741
- };
15742
- return {
15743
- width: widthMap[size],
15744
- padding: `var(--lew-form-input-padding-${size})`,
15745
- fontSize: `var(--lew-form-font-size-${size})`,
15746
- lineHeight: `calc(var(--lew-form-item-height-${size}) - (var(--lew-form-border-width) * 2))`,
15747
- opacity: state.visible ? 0.4 : 1
15748
- };
15749
- });
15750
16462
  function showHandle() {
16463
+ state.backupValue = modelValue.value;
15751
16464
  state.visible = true;
15752
16465
  }
15753
16466
  function hideHandle() {
16467
+ if (props.onlyLeafSelectable && modelValue.value && !props.multiple) {
16468
+ const selectedNodes = findObjectByValue(
16469
+ state.optionsTree,
16470
+ modelValue.value,
16471
+ nodeCache
16472
+ );
16473
+ if (!selectedNodes) {
16474
+ modelValue.value = state.backupValue;
16475
+ return;
16476
+ }
16477
+ const isLeaf = selectedNodes.isLeaf;
16478
+ if (!isLeaf) {
16479
+ modelValue.value = state.backupValue;
16480
+ return;
16481
+ }
16482
+ }
15754
16483
  state.visible = false;
15755
16484
  }
15756
- const getLabel = computed(() => {
15757
- const item = findObjectByValue(state.optionsTree, cascaderValue.value);
15758
- return item?.labelPaths || [];
15759
- });
15760
- const getDisplayText2 = computed(() => {
15761
- if (!getLabel.value || getLabel.value.length === 0) {
15762
- return props.placeholder ? props.placeholder : locale.t("cascader.placeholder");
16485
+ async function show() {
16486
+ try {
16487
+ await lewPopoverRef.value?.show();
16488
+ } catch (error) {
16489
+ console.warn("Failed to show cascader popover:", error);
15763
16490
  }
15764
- if (props.showAllLevels) {
15765
- return getLabel.value.join(" / ");
15766
- } else {
15767
- return getLabel.value[getLabel.value.length - 1];
16491
+ }
16492
+ function hide2() {
16493
+ try {
16494
+ lewPopoverRef.value?.hide();
16495
+ } catch (error) {
16496
+ console.warn("Failed to hide cascader popover:", error);
16497
+ }
16498
+ }
16499
+ watch(
16500
+ () => props.options,
16501
+ (newOptions) => {
16502
+ if (!_initMethod.value && newOptions?.length) {
16503
+ const _tree = newOptions.map((e) => ({
16504
+ ...e,
16505
+ isLeaf: !e.children?.length
16506
+ }));
16507
+ nodeCache.clear();
16508
+ loadedDataCache.clear();
16509
+ const formattedTree = formatTree(_tree);
16510
+ state.optionsGroup = [formattedTree];
16511
+ state.optionsTree = formattedTree;
16512
+ if (formattedTree.length > 0) {
16513
+ if (modelValue.value && Array.isArray(modelValue.value) && modelValue.value.length > 0 && !props.free) {
16514
+ initTreeSelection({ tree: formattedTree, keys: modelValue.value });
16515
+ }
16516
+ }
16517
+ }
16518
+ },
16519
+ {
16520
+ deep: true,
16521
+ flush: "post"
15768
16522
  }
15769
- });
15770
- const shouldShowValue = computed(() => getLabel.value && getLabel.value.length > 0);
15771
- const shouldShowPlaceholder = computed(
15772
- () => !getLabel.value || getLabel.value && getLabel.value.length === 0
15773
- );
15774
- const shouldShowClearIcon = computed(
15775
- () => props.clearable && getLabel.value && getLabel.value.length > 0 && !props.readonly
15776
- );
15777
- const shouldShowSelectIcon = computed(
15778
- () => !(props.clearable && getLabel.value && getLabel.value.length > 0)
15779
16523
  );
15780
- const getCascaderWidth = computed(() => {
15781
- const _hasChildOptions = state.optionsGroup.filter((e) => e && e.length > 0).length;
15782
- if (_hasChildOptions > 1) {
15783
- return _hasChildOptions * 200;
16524
+ watch(
16525
+ () => modelValue.value,
16526
+ (newValue) => {
16527
+ if (isInternalUpdate) {
16528
+ return;
16529
+ }
16530
+ if (newValue && Array.isArray(newValue) && !props.free) {
16531
+ initTreeSelection({ keys: newValue });
16532
+ }
16533
+ },
16534
+ {
16535
+ immediate: false,
16536
+ deep: true
15784
16537
  }
15785
- return _hasChildOptions * 200;
15786
- });
15787
- const getCascaderStyle = computed(() => {
15788
- const { size } = props;
15789
- return {
15790
- height: `var(--lew-form-item-height-${size})`
15791
- };
15792
- });
15793
- const getCascaderBodyStyle = computed(() => ({
15794
- width: `${getCascaderWidth.value}px`
15795
- }));
15796
- const getOptionsBoxStyle = computed(() => ({
15797
- height: props.free ? "calc(100% - 48px)" : "100%"
15798
- }));
15799
- const getVirtListStyle = computed(() => ({
15800
- padding: "6px 6px 2px 6px",
15801
- boxSizing: "border-box"
15802
- }));
15803
- const getItemPaddingStyle = computed(() => ({
15804
- height: "38px"
15805
- }));
15806
- const getLabelClass = computed(() => ({
15807
- "lew-cascader-label-free": props.free
15808
- }));
15809
- const getCascaderClassName = computed(() => {
15810
- let { clearable, disabled, readonly: readonly2 } = props;
15811
- clearable = clearable ? !!cascaderValue.value : false;
15812
- const focus = state.visible;
15813
- return object2class("lew-cascader", {
15814
- clearable,
15815
- disabled,
15816
- readonly: readonly2,
15817
- focus,
15818
- "init-loading": state.initLoading
15819
- });
15820
- });
15821
- const getBodyClassName = computed(() => {
15822
- const { size, disabled } = props;
15823
- return object2class("lew-cascader-body", { size, disabled });
16538
+ );
16539
+ onBeforeUnmount(() => {
16540
+ nodeCache.clear();
16541
+ loadedDataCache.clear();
15824
16542
  });
15825
- const getIconSize = computed(() => {
15826
- const size = {
15827
- small: 14,
15828
- medium: 15,
15829
- large: 16
15830
- };
15831
- return size[props.size];
16543
+ init();
16544
+ __expose({
16545
+ show,
16546
+ hide: hide2,
16547
+ getSelected
15832
16548
  });
15833
- function getItemClass(templateProps) {
15834
- return {
15835
- "lew-cascader-item-disabled": templateProps.disabled,
15836
- "lew-cascader-item-hover": state.activeLabels.includes(templateProps.label),
15837
- "lew-cascader-item-active": props.free ? state.activeLabels.includes(templateProps.label) && state.tobeLabels.includes(templateProps.label) : state.activeLabels.includes(templateProps.label),
15838
- "lew-cascader-item-tobe": state.tobeLabels.includes(templateProps.label),
15839
- "lew-cascader-item-selected": getLabel.value && getLabel.value.includes(templateProps.label) && state.tobeLabels.includes(templateProps.label)
15840
- };
15841
- }
15842
- function getItemWrapperStyle(oIndex, oItem) {
15843
- return {
15844
- zIndex: 20 - oIndex,
15845
- borderRadius: `0 ${oIndex === state.optionsGroup.length - 1 ? "var(--lew-border-radius-small)" : "0"} 0 0`,
15846
- transform: oItem.length > 0 ? `translateX(${200 * oIndex}px)` : ""
15847
- };
15848
- }
15849
- function ok() {
15850
- const item = findObjectByValue(state.optionsTree, state.tobeItem.value);
15851
- cascaderValue.value = state.tobeItem.value;
15852
- emit("change", cloneDeep(item));
15853
- setTimeout(() => {
15854
- hide2();
15855
- }, 100);
15856
- }
15857
- function close() {
15858
- hide2();
15859
- }
15860
- __expose({ show, hide: hide2 });
15861
16549
  return (_ctx, _cache) => {
15862
16550
  return openBlock(), createBlock(unref(_sfc_main$U), {
15863
16551
  ref_key: "lewPopoverRef",
@@ -15873,61 +16561,22 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
15873
16561
  onHide: hideHandle
15874
16562
  }, {
15875
16563
  trigger: withCtx(() => [
15876
- createElementVNode("div", {
15877
- ref_key: "lewCascaderRef",
15878
- ref: lewCascaderRef,
15879
- class: normalizeClass(["lew-cascader", unref(getCascaderClassName)]),
15880
- style: normalizeStyle(unref(getCascaderStyle))
15881
- }, [
15882
- unref(state).initLoading ? (openBlock(), createElementBlock("div", _hoisted_1$G, [
15883
- createVNode(CommonIcon, {
15884
- size: unref(getIconSize),
15885
- loading: unref(state).initLoading,
15886
- type: "loading"
15887
- }, null, 8, ["size", "loading"])
15888
- ])) : (openBlock(), createBlock(Transition, {
15889
- key: 1,
15890
- name: "lew-form-icon-ani"
15891
- }, {
15892
- default: withCtx(() => [
15893
- unref(shouldShowSelectIcon) ? (openBlock(), createBlock(CommonIcon, {
15894
- key: 0,
15895
- size: unref(getIconSize),
15896
- type: "chevron-down",
15897
- class: "icon-select"
15898
- }, null, 8, ["size"])) : createCommentVNode("", true)
15899
- ]),
15900
- _: 1
15901
- })),
15902
- createVNode(Transition, { name: "lew-form-icon-ani" }, {
15903
- default: withCtx(() => [
15904
- unref(shouldShowClearIcon) ? (openBlock(), createBlock(CommonIcon, {
15905
- key: 0,
15906
- size: unref(getIconSize),
15907
- type: "close",
15908
- class: normalizeClass(["lew-form-icon-close", {
15909
- "lew-form-icon-close-focus": unref(state).visible
15910
- }]),
15911
- onClick: withModifiers(clearHandle, ["stop"])
15912
- }, null, 8, ["size", "class"])) : createCommentVNode("", true)
15913
- ]),
15914
- _: 1
15915
- }),
15916
- withDirectives(createElementVNode("div", {
15917
- class: "lew-cascader-value",
15918
- style: normalizeStyle(unref(getValueStyle))
15919
- }, [
15920
- createVNode(unref(LewTextTrim), { text: unref(getDisplayText2) }, null, 8, ["text"])
15921
- ], 4), [
15922
- [vShow, unref(shouldShowValue)]
15923
- ]),
15924
- withDirectives(createElementVNode("div", {
15925
- class: "lew-cascader-placeholder",
15926
- style: normalizeStyle(unref(getValueStyle))
15927
- }, toDisplayString$1(unref(getDisplayText2)), 5), [
15928
- [vShow, unref(shouldShowPlaceholder)]
15929
- ])
15930
- ], 6)
16564
+ createVNode(CommonInput, {
16565
+ modelValue: modelValue.value,
16566
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
16567
+ multiple: _ctx.multiple,
16568
+ loading: unref(state).initLoading,
16569
+ clearable: _ctx.clearable,
16570
+ readonly: _ctx.readonly,
16571
+ disabled: _ctx.disabled || unref(state).initLoading,
16572
+ size: _ctx.size,
16573
+ placeholder: _ctx.placeholder,
16574
+ width: unref(any2px)(_ctx.width),
16575
+ focus: unref(state).visible,
16576
+ "format-items": unref(formatItems),
16577
+ onClear: clearHandle,
16578
+ onDelete: deleteTag
16579
+ }, null, 8, ["modelValue", "multiple", "loading", "clearable", "readonly", "disabled", "size", "placeholder", "width", "focus", "format-items"])
15931
16580
  ]),
15932
16581
  "popover-body": withCtx(() => [
15933
16582
  createElementVNode("div", {
@@ -15937,11 +16586,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
15937
16586
  renderSlot(_ctx.$slots, "header", {}, void 0, true),
15938
16587
  createVNode(Transition, { name: "fade" }, {
15939
16588
  default: withCtx(() => [
15940
- unref(state).optionsGroup.length > 0 ? (openBlock(), createElementBlock("div", {
15941
- key: 0,
15942
- class: "lew-cascader-options-box",
15943
- style: normalizeStyle(unref(getOptionsBoxStyle))
15944
- }, [
16589
+ unref(state).optionsGroup.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_1$F, [
15945
16590
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(state).optionsGroup, (oItem, oIndex) => {
15946
16591
  return openBlock(), createElementBlock("div", {
15947
16592
  key: oIndex,
@@ -15949,89 +16594,64 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
15949
16594
  style: normalizeStyle(getItemWrapperStyle(oIndex, oItem))
15950
16595
  }, [
15951
16596
  (openBlock(), createBlock(unref(VirtList), {
15952
- key: oItem[0]?.parentValuePaths?.join("-") || "root",
15953
- ref_for: true,
15954
- ref: (el) => unref(virtListRefs)[oIndex] = el,
16597
+ key: oItem?.[0]?.parentValuePaths?.join("-") || "root",
15955
16598
  class: "lew-scrollbar-hover",
15956
16599
  list: oItem,
15957
16600
  "min-size": 38,
15958
16601
  buffer: 5,
15959
16602
  "item-key": "value",
15960
- style: normalizeStyle(unref(getVirtListStyle))
16603
+ style: VIRT_LIST_STYLE
15961
16604
  }, {
15962
16605
  default: withCtx(({ itemData: templateProps }) => [
15963
16606
  createElementVNode("div", {
15964
16607
  class: "lew-cascader-item-padding",
15965
- style: normalizeStyle(unref(getItemPaddingStyle))
16608
+ style: ITEM_PADDING_STYLE,
16609
+ onClick: ($event) => selectItem(templateProps, oIndex)
15966
16610
  }, [
15967
16611
  createElementVNode("div", {
15968
- class: normalizeClass(["lew-cascader-item", getItemClass(templateProps)]),
15969
- onClick: ($event) => selectItem(templateProps, oIndex)
16612
+ class: normalizeClass(["lew-cascader-item", getItemClass(templateProps)])
15970
16613
  }, [
15971
- _ctx.free ? (openBlock(), createBlock(unref(LewCheckbox), {
15972
- key: 0,
16614
+ props.multiple ? (openBlock(), createBlock(unref(LewCheckbox), {
16615
+ key: templateProps.value,
15973
16616
  class: "lew-cascader-checkbox",
15974
- checked: unref(state).tobeLabels.includes(templateProps.label)
15975
- }, null, 8, ["checked"])) : createCommentVNode("", true),
15976
- createVNode(unref(LewTextTrim), {
15977
- class: normalizeClass(["lew-cascader-label", unref(getLabelClass)]),
15978
- text: templateProps.label,
15979
- delay: [500, 0]
15980
- }, null, 8, ["class", "text"]),
15981
- templateProps.loading ? (openBlock(), createBlock(CommonIcon, {
15982
- key: 1,
16617
+ checked: props.free ? modelValue.value?.includes(templateProps.value) : unref(isSelected)(templateProps.value),
16618
+ certain: !props.free && unref(isIndeterminate)(templateProps.value),
16619
+ disabled: templateProps.disabled,
16620
+ onChange: ($event) => changeCheck(templateProps)
16621
+ }, null, 8, ["checked", "certain", "disabled", "onChange"])) : createCommentVNode("", true),
16622
+ createElementVNode("div", {
16623
+ title: templateProps.label,
16624
+ class: "lew-cascader-label",
16625
+ style: normalizeStyle({
16626
+ width: props.multiple ? "calc(100% - 36px)" : "100%"
16627
+ })
16628
+ }, toDisplayString$1(templateProps.label), 13, _hoisted_3$n),
16629
+ withDirectives(createVNode(CommonIcon, {
15983
16630
  size: 14,
15984
16631
  loading: "",
15985
16632
  class: "lew-cascader-loading-icon",
15986
16633
  type: "loader"
15987
- })) : !templateProps.isLeaf ? (openBlock(), createBlock(CommonIcon, {
15988
- key: 2,
16634
+ }, null, 512), [
16635
+ [vShow, templateProps.loading]
16636
+ ]),
16637
+ withDirectives(createVNode(CommonIcon, {
15989
16638
  size: 16,
15990
16639
  class: "lew-cascader-icon",
15991
16640
  type: "chevron-right"
15992
- })) : createCommentVNode("", true)
15993
- ], 10, _hoisted_2$t)
15994
- ], 4)
16641
+ }, null, 512), [
16642
+ [vShow, !templateProps.loading && !templateProps.isLeaf]
16643
+ ])
16644
+ ], 2)
16645
+ ], 8, _hoisted_2$s)
15995
16646
  ]),
15996
16647
  _: 2
15997
- }, 1032, ["list", "style"]))
16648
+ }, 1032, ["list"]))
15998
16649
  ], 4);
15999
16650
  }), 128))
16000
- ], 4)) : createCommentVNode("", true)
16651
+ ])) : createCommentVNode("", true)
16001
16652
  ]),
16002
16653
  _: 1
16003
- }),
16004
- _ctx.free ? (openBlock(), createBlock(unref(LewFlex), {
16005
- key: 0,
16006
- x: "end",
16007
- gap: "5px",
16008
- class: "lew-cascader-control"
16009
- }, {
16010
- default: withCtx(() => [
16011
- createVNode(unref(LewButton), {
16012
- color: "gray",
16013
- type: "text",
16014
- size: "small",
16015
- onClick: close
16016
- }, {
16017
- default: withCtx(() => [
16018
- createTextVNode(toDisplayString$1(unref(locale).t("cascader.closeText")), 1)
16019
- ]),
16020
- _: 1
16021
- }),
16022
- createVNode(unref(LewButton), {
16023
- disabled: unref(state).okLoading,
16024
- size: "small",
16025
- onClick: _cache[0] || (_cache[0] = ($event) => ok())
16026
- }, {
16027
- default: withCtx(() => [
16028
- createTextVNode(toDisplayString$1(unref(locale).t("cascader.okText")), 1)
16029
- ]),
16030
- _: 1
16031
- }, 8, ["disabled"])
16032
- ]),
16033
- _: 1
16034
- })) : createCommentVNode("", true)
16654
+ })
16035
16655
  ], 6)
16036
16656
  ]),
16037
16657
  _: 3
@@ -16039,7 +16659,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
16039
16659
  };
16040
16660
  }
16041
16661
  });
16042
- const LewCascader = /* @__PURE__ */ _export_sfc(_sfc_main$T, [["__scopeId", "data-v-45a2695b"]]);
16662
+ const LewCascader = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["__scopeId", "data-v-7cea69f7"]]);
16043
16663
  const cascaderModel = {
16044
16664
  modelValue: {
16045
16665
  type: String
@@ -16194,16 +16814,16 @@ const checkboxGroupProps = {
16194
16814
  })
16195
16815
  }
16196
16816
  };
16197
- const _hoisted_1$F = {
16817
+ const _hoisted_1$E = {
16198
16818
  key: 0,
16199
16819
  class: "lew-checkbox-icon-box"
16200
16820
  };
16201
- const _hoisted_2$s = { class: "lew-checkbox-icon-certain" };
16202
- const _hoisted_3$n = {
16821
+ const _hoisted_2$r = { class: "lew-checkbox-icon-certain" };
16822
+ const _hoisted_3$m = {
16203
16823
  key: 1,
16204
16824
  class: "lew-checkbox-label"
16205
16825
  };
16206
- const _sfc_main$S = /* @__PURE__ */ defineComponent({
16826
+ const _sfc_main$R = /* @__PURE__ */ defineComponent({
16207
16827
  __name: "LewCheckbox",
16208
16828
  props: /* @__PURE__ */ mergeModels(checkboxProps, {
16209
16829
  "modelValue": {
@@ -16231,7 +16851,7 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
16231
16851
  });
16232
16852
  const getCheckboxClassName = computed(() => {
16233
16853
  const { block, round: round2, iconable, size, disabled, certain, readonly: readonly2 } = props;
16234
- const checked = modelValue.value || props.checked;
16854
+ const checked = props.checked || modelValue.value;
16235
16855
  const unicon = !iconable && block;
16236
16856
  return object2class("lew-checkbox", {
16237
16857
  block,
@@ -16254,13 +16874,19 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
16254
16874
  modelValue.value = _value;
16255
16875
  emit("change", _value);
16256
16876
  }
16877
+ watch(
16878
+ () => props.checked,
16879
+ () => {
16880
+ modelValue.value = props.checked;
16881
+ }
16882
+ );
16257
16883
  return (_ctx, _cache) => {
16258
16884
  return openBlock(), createElementBlock("div", {
16259
16885
  class: normalizeClass(["lew-checkbox", unref(getCheckboxClassName)]),
16260
16886
  onClick: withModifiers(setChecked, ["stop"])
16261
16887
  }, [
16262
- unref(shouldShowIconBox) ? (openBlock(), createElementBlock("div", _hoisted_1$F, [
16263
- withDirectives(createElementVNode("i", _hoisted_2$s, null, 512), [
16888
+ unref(shouldShowIconBox) ? (openBlock(), createElementBlock("div", _hoisted_1$E, [
16889
+ withDirectives(createElementVNode("i", _hoisted_2$r, null, 512), [
16264
16890
  [vShow, _ctx.certain]
16265
16891
  ]),
16266
16892
  createVNode(CommonIcon, {
@@ -16270,13 +16896,13 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
16270
16896
  size: unref(getIconSize)
16271
16897
  }, null, 8, ["size"])
16272
16898
  ])) : createCommentVNode("", true),
16273
- _ctx.label ? (openBlock(), createElementBlock("span", _hoisted_3$n, toDisplayString$1(_ctx.label), 1)) : createCommentVNode("", true)
16899
+ _ctx.label ? (openBlock(), createElementBlock("span", _hoisted_3$m, toDisplayString$1(_ctx.label), 1)) : createCommentVNode("", true)
16274
16900
  ], 2);
16275
16901
  };
16276
16902
  }
16277
16903
  });
16278
- const LewCheckbox = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["__scopeId", "data-v-c80437bd"]]);
16279
- const _sfc_main$R = /* @__PURE__ */ defineComponent({
16904
+ const LewCheckbox = /* @__PURE__ */ _export_sfc(_sfc_main$R, [["__scopeId", "data-v-624c4156"]]);
16905
+ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
16280
16906
  __name: "LewCheckboxGroup",
16281
16907
  props: /* @__PURE__ */ mergeModels(checkboxGroupProps, {
16282
16908
  "modelValue": {
@@ -16364,7 +16990,7 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
16364
16990
  };
16365
16991
  }
16366
16992
  });
16367
- const LewCheckboxGroup = /* @__PURE__ */ _export_sfc(_sfc_main$R, [["__scopeId", "data-v-af58b094"]]);
16993
+ const LewCheckboxGroup = /* @__PURE__ */ _export_sfc(_sfc_main$Q, [["__scopeId", "data-v-af58b094"]]);
16368
16994
  const checkboxModel = {
16369
16995
  modelValue: {
16370
16996
  type: Boolean,
@@ -16425,8 +17051,8 @@ const colorPickerProps = {
16425
17051
  })
16426
17052
  }
16427
17053
  };
16428
- const _hoisted_1$E = ["placeholder"];
16429
- const _sfc_main$Q = /* @__PURE__ */ defineComponent({
17054
+ const _hoisted_1$D = ["placeholder"];
17055
+ const _sfc_main$P = /* @__PURE__ */ defineComponent({
16430
17056
  __name: "LewColorPicker",
16431
17057
  props: /* @__PURE__ */ mergeModels(colorPickerProps, {
16432
17058
  "modelValue": { required: true },
@@ -16543,7 +17169,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
16543
17169
  placeholder: unref(getDisplayPlaceholder),
16544
17170
  onFocus: focus,
16545
17171
  onBlur: blur
16546
- }, null, 44, _hoisted_1$E), [
17172
+ }, null, 44, _hoisted_1$D), [
16547
17173
  [vModelText, modelValue.value]
16548
17174
  ])
16549
17175
  ], 6)
@@ -16551,7 +17177,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
16551
17177
  };
16552
17178
  }
16553
17179
  });
16554
- const LewColorPicker = /* @__PURE__ */ _export_sfc(_sfc_main$Q, [["__scopeId", "data-v-2dd5922b"]]);
17180
+ const LewColorPicker = /* @__PURE__ */ _export_sfc(_sfc_main$P, [["__scopeId", "data-v-2dd5922b"]]);
16555
17181
  const colorPickerModel = {
16556
17182
  modelValue: {
16557
17183
  type: String
@@ -17158,11 +17784,11 @@ function getMonthDate(year, month) {
17158
17784
  }
17159
17785
  return ret;
17160
17786
  }
17161
- const _hoisted_1$D = { class: "lew-date" };
17162
- const _hoisted_2$r = { class: "lew-date-control-left" };
17163
- const _hoisted_3$m = { class: "cur-date" };
17164
- const _hoisted_4$g = { class: "lew-date-control-right" };
17165
- const _hoisted_5$e = { class: "lew-date-box" };
17787
+ const _hoisted_1$C = { class: "lew-date" };
17788
+ const _hoisted_2$q = { class: "lew-date-control-left" };
17789
+ const _hoisted_3$l = { class: "cur-date" };
17790
+ const _hoisted_4$e = { class: "lew-date-control-right" };
17791
+ const _hoisted_5$d = { class: "lew-date-box" };
17166
17792
  const _hoisted_6$9 = { class: "lew-date-num" };
17167
17793
  const _hoisted_7$7 = ["onClick"];
17168
17794
  const _hoisted_8$6 = { class: "lew-date-label" };
@@ -17171,7 +17797,7 @@ const _hoisted_9$6 = {
17171
17797
  class: "lew-date-item-today"
17172
17798
  };
17173
17799
  const _hoisted_10$4 = { class: "lew-date-value" };
17174
- const _sfc_main$P = /* @__PURE__ */ defineComponent({
17800
+ const _sfc_main$O = /* @__PURE__ */ defineComponent({
17175
17801
  __name: "LewDate",
17176
17802
  props: {
17177
17803
  valueFormat: {
@@ -17285,14 +17911,14 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
17285
17911
  }
17286
17912
  __expose({ init, getValue: getValue2 });
17287
17913
  return (_ctx, _cache) => {
17288
- return openBlock(), createElementBlock("div", _hoisted_1$D, [
17914
+ return openBlock(), createElementBlock("div", _hoisted_1$C, [
17289
17915
  createVNode(unref(LewFlex), {
17290
17916
  x: "start",
17291
17917
  mode: "between",
17292
17918
  class: "lew-date-control"
17293
17919
  }, {
17294
17920
  default: withCtx(() => [
17295
- createElementVNode("div", _hoisted_2$r, [
17921
+ createElementVNode("div", _hoisted_2$q, [
17296
17922
  createVNode(unref(LewButton), {
17297
17923
  type: "light",
17298
17924
  color: "gray",
@@ -17318,8 +17944,8 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
17318
17944
  _: 1
17319
17945
  })
17320
17946
  ]),
17321
- createElementVNode("div", _hoisted_3$m, toDisplayString$1(unref(dayjs)(`${unref(dateState).year}-${unref(dateState).month}`).format("YYYY-MM")), 1),
17322
- createElementVNode("div", _hoisted_4$g, [
17947
+ createElementVNode("div", _hoisted_3$l, toDisplayString$1(unref(dayjs)(`${unref(dateState).year}-${unref(dateState).month}`).format("YYYY-MM")), 1),
17948
+ createElementVNode("div", _hoisted_4$e, [
17323
17949
  createVNode(unref(LewButton), {
17324
17950
  type: "light",
17325
17951
  color: "gray",
@@ -17348,7 +17974,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
17348
17974
  ]),
17349
17975
  _: 1
17350
17976
  }),
17351
- createElementVNode("div", _hoisted_5$e, [
17977
+ createElementVNode("div", _hoisted_5$d, [
17352
17978
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(headDate), (item, index2) => {
17353
17979
  return openBlock(), createElementBlock("div", {
17354
17980
  key: `h${index2}`,
@@ -17374,12 +18000,12 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
17374
18000
  };
17375
18001
  }
17376
18002
  });
17377
- const LewDate = /* @__PURE__ */ _export_sfc(_sfc_main$P, [["__scopeId", "data-v-0e16ffbf"]]);
17378
- const _hoisted_1$C = { class: "lew-time-control" };
17379
- const _hoisted_2$q = { class: "cur-time" };
17380
- const _hoisted_3$l = { class: "lew-time-container" };
17381
- const _hoisted_4$f = { class: "lew-time-column" };
17382
- const _hoisted_5$d = ["data-value", "onClick"];
18003
+ const LewDate = /* @__PURE__ */ _export_sfc(_sfc_main$O, [["__scopeId", "data-v-0e16ffbf"]]);
18004
+ const _hoisted_1$B = { class: "lew-time-control" };
18005
+ const _hoisted_2$p = { class: "cur-time" };
18006
+ const _hoisted_3$k = { class: "lew-time-container" };
18007
+ const _hoisted_4$d = { class: "lew-time-column" };
18008
+ const _hoisted_5$c = ["data-value", "onClick"];
17383
18009
  const _hoisted_6$8 = ["data-text"];
17384
18010
  const _hoisted_7$6 = { class: "lew-time-column" };
17385
18011
  const _hoisted_8$5 = ["data-value", "onClick"];
@@ -17392,7 +18018,7 @@ const _hoisted_11$3 = ["data-value", "onClick"];
17392
18018
  const _hoisted_12$2 = ["data-text"];
17393
18019
  const _hoisted_13$1 = { class: "lew-time-actions" };
17394
18020
  const ITEM_HEIGHT = 28;
17395
- const _sfc_main$O = /* @__PURE__ */ defineComponent({
18021
+ const _sfc_main$N = /* @__PURE__ */ defineComponent({
17396
18022
  __name: "LewTime",
17397
18023
  props: {
17398
18024
  valueFormat: {
@@ -17666,8 +18292,8 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
17666
18292
  width: unref(showSeconds) ? "220px" : "160px"
17667
18293
  })
17668
18294
  }, [
17669
- createElementVNode("div", _hoisted_1$C, [
17670
- createElementVNode("div", _hoisted_2$q, toDisplayString$1(unref(_timeValue) || "00:00:00"), 1),
18295
+ createElementVNode("div", _hoisted_1$B, [
18296
+ createElementVNode("div", _hoisted_2$p, toDisplayString$1(unref(_timeValue) || "00:00:00"), 1),
17671
18297
  createVNode(unref(LewButton), {
17672
18298
  type: "light",
17673
18299
  color: "gray",
@@ -17680,11 +18306,11 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
17680
18306
  _: 1
17681
18307
  })
17682
18308
  ]),
17683
- createElementVNode("div", _hoisted_3$l, [
18309
+ createElementVNode("div", _hoisted_3$k, [
17684
18310
  _cache[16] || (_cache[16] = createElementVNode("div", { class: "lew-time-center-mask" }, null, -1)),
17685
18311
  _cache[17] || (_cache[17] = createElementVNode("div", { class: "lew-time-gradient-top" }, null, -1)),
17686
18312
  _cache[18] || (_cache[18] = createElementVNode("div", { class: "lew-time-gradient-bottom" }, null, -1)),
17687
- createElementVNode("div", _hoisted_4$f, [
18313
+ createElementVNode("div", _hoisted_4$d, [
17688
18314
  createElementVNode("div", {
17689
18315
  ref_key: "hourRef",
17690
18316
  ref: hourRef,
@@ -17705,7 +18331,7 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
17705
18331
  class: "lew-time-value",
17706
18332
  "data-text": hour.label
17707
18333
  }, toDisplayString$1(hour.label), 9, _hoisted_6$8)
17708
- ], 8, _hoisted_5$d);
18334
+ ], 8, _hoisted_5$c);
17709
18335
  }), 128)),
17710
18336
  _cache[11] || (_cache[11] = createElementVNode("div", { class: "lew-time-padding" }, null, -1))
17711
18337
  ], 544)
@@ -17791,15 +18417,15 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
17791
18417
  };
17792
18418
  }
17793
18419
  });
17794
- const LewTime = /* @__PURE__ */ _export_sfc(_sfc_main$O, [["__scopeId", "data-v-ce0dbc81"]]);
17795
- const _hoisted_1$B = { class: "lew-datetime" };
17796
- const _hoisted_2$p = { class: "lew-datetime-content" };
17797
- const _hoisted_3$k = { class: "lew-datetime-panel lew-datetime-date-panel" };
17798
- const _hoisted_4$e = { class: "lew-datetime-panel lew-datetime-time-panel" };
17799
- const _hoisted_5$c = { class: "lew-datetime-actions" };
18420
+ const LewTime = /* @__PURE__ */ _export_sfc(_sfc_main$N, [["__scopeId", "data-v-ce0dbc81"]]);
18421
+ const _hoisted_1$A = { class: "lew-datetime" };
18422
+ const _hoisted_2$o = { class: "lew-datetime-content" };
18423
+ const _hoisted_3$j = { class: "lew-datetime-panel lew-datetime-date-panel" };
18424
+ const _hoisted_4$c = { class: "lew-datetime-panel lew-datetime-time-panel" };
18425
+ const _hoisted_5$b = { class: "lew-datetime-actions" };
17800
18426
  const _hoisted_6$7 = { class: "lew-datetime-actions-left" };
17801
18427
  const _hoisted_7$5 = { class: "lew-datetime-actions-right" };
17802
- const _sfc_main$N = /* @__PURE__ */ defineComponent({
18428
+ const _sfc_main$M = /* @__PURE__ */ defineComponent({
17803
18429
  __name: "LewDateTime",
17804
18430
  props: {
17805
18431
  valueFormat: {
@@ -17871,16 +18497,16 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
17871
18497
  }
17872
18498
  __expose({ init });
17873
18499
  return (_ctx, _cache) => {
17874
- return openBlock(), createElementBlock("div", _hoisted_1$B, [
17875
- createElementVNode("div", _hoisted_2$p, [
17876
- createElementVNode("div", _hoisted_3$k, [
18500
+ return openBlock(), createElementBlock("div", _hoisted_1$A, [
18501
+ createElementVNode("div", _hoisted_2$o, [
18502
+ createElementVNode("div", _hoisted_3$j, [
17877
18503
  createVNode(LewDate, {
17878
18504
  ref_key: "dateRef",
17879
18505
  ref: dateRef,
17880
18506
  "value-format": unref(dateFormat)
17881
18507
  }, null, 8, ["value-format"])
17882
18508
  ]),
17883
- createElementVNode("div", _hoisted_4$e, [
18509
+ createElementVNode("div", _hoisted_4$c, [
17884
18510
  createVNode(LewTime, {
17885
18511
  ref_key: "timeRef",
17886
18512
  ref: timeRef,
@@ -17890,7 +18516,7 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
17890
18516
  }, null, 8, ["value-format"])
17891
18517
  ])
17892
18518
  ]),
17893
- createElementVNode("div", _hoisted_5$c, [
18519
+ createElementVNode("div", _hoisted_5$b, [
17894
18520
  createElementVNode("div", _hoisted_6$7, [
17895
18521
  createVNode(unref(LewButton), {
17896
18522
  type: "light",
@@ -17934,12 +18560,12 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
17934
18560
  };
17935
18561
  }
17936
18562
  });
17937
- const LewDateTime = /* @__PURE__ */ _export_sfc(_sfc_main$N, [["__scopeId", "data-v-de4090a5"]]);
17938
- const _hoisted_1$A = { class: "lew-month" };
17939
- const _hoisted_2$o = { class: "lew-month-control-left" };
17940
- const _hoisted_3$j = { class: "cur-year" };
17941
- const _hoisted_4$d = { class: "lew-month-control-right" };
17942
- const _hoisted_5$b = { class: "lew-month-list" };
18563
+ const LewDateTime = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["__scopeId", "data-v-de4090a5"]]);
18564
+ const _hoisted_1$z = { class: "lew-month" };
18565
+ const _hoisted_2$n = { class: "lew-month-control-left" };
18566
+ const _hoisted_3$i = { class: "cur-year" };
18567
+ const _hoisted_4$b = { class: "lew-month-control-right" };
18568
+ const _hoisted_5$a = { class: "lew-month-list" };
17943
18569
  const _hoisted_6$6 = ["onClick"];
17944
18570
  const _hoisted_7$4 = { class: "lew-month-label" };
17945
18571
  const _hoisted_8$4 = {
@@ -17947,7 +18573,7 @@ const _hoisted_8$4 = {
17947
18573
  class: "lew-month-item-current"
17948
18574
  };
17949
18575
  const _hoisted_9$4 = { class: "lew-month-value" };
17950
- const _sfc_main$M = /* @__PURE__ */ defineComponent({
18576
+ const _sfc_main$L = /* @__PURE__ */ defineComponent({
17951
18577
  __name: "LewMonth",
17952
18578
  props: {
17953
18579
  valueFormat: {
@@ -18022,14 +18648,14 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
18022
18648
  }
18023
18649
  __expose({ init });
18024
18650
  return (_ctx, _cache) => {
18025
- return openBlock(), createElementBlock("div", _hoisted_1$A, [
18651
+ return openBlock(), createElementBlock("div", _hoisted_1$z, [
18026
18652
  createVNode(unref(LewFlex), {
18027
18653
  x: "start",
18028
18654
  mode: "between",
18029
18655
  class: "lew-month-control"
18030
18656
  }, {
18031
18657
  default: withCtx(() => [
18032
- createElementVNode("div", _hoisted_2$o, [
18658
+ createElementVNode("div", _hoisted_2$n, [
18033
18659
  createVNode(unref(LewButton), {
18034
18660
  type: "light",
18035
18661
  color: "gray",
@@ -18043,8 +18669,8 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
18043
18669
  _: 1
18044
18670
  })
18045
18671
  ]),
18046
- createElementVNode("div", _hoisted_3$j, toDisplayString$1(unref(monthState).year), 1),
18047
- createElementVNode("div", _hoisted_4$d, [
18672
+ createElementVNode("div", _hoisted_3$i, toDisplayString$1(unref(monthState).year), 1),
18673
+ createElementVNode("div", _hoisted_4$b, [
18048
18674
  createVNode(unref(LewButton), {
18049
18675
  type: "light",
18050
18676
  color: "gray",
@@ -18061,7 +18687,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
18061
18687
  ]),
18062
18688
  _: 1
18063
18689
  }),
18064
- createElementVNode("div", _hoisted_5$b, [
18690
+ createElementVNode("div", _hoisted_5$a, [
18065
18691
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(monthList), (month) => {
18066
18692
  return openBlock(), createElementBlock("div", {
18067
18693
  key: month.value,
@@ -18079,12 +18705,12 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
18079
18705
  };
18080
18706
  }
18081
18707
  });
18082
- const LewMonth = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["__scopeId", "data-v-0cdc6c13"]]);
18083
- const _hoisted_1$z = { class: "lew-quarter" };
18084
- const _hoisted_2$n = { class: "lew-quarter-control-left" };
18085
- const _hoisted_3$i = { class: "cur-year" };
18086
- const _hoisted_4$c = { class: "lew-quarter-control-right" };
18087
- const _hoisted_5$a = { class: "lew-quarter-list" };
18708
+ const LewMonth = /* @__PURE__ */ _export_sfc(_sfc_main$L, [["__scopeId", "data-v-0cdc6c13"]]);
18709
+ const _hoisted_1$y = { class: "lew-quarter" };
18710
+ const _hoisted_2$m = { class: "lew-quarter-control-left" };
18711
+ const _hoisted_3$h = { class: "cur-year" };
18712
+ const _hoisted_4$a = { class: "lew-quarter-control-right" };
18713
+ const _hoisted_5$9 = { class: "lew-quarter-list" };
18088
18714
  const _hoisted_6$5 = ["onClick"];
18089
18715
  const _hoisted_7$3 = { class: "lew-quarter-label" };
18090
18716
  const _hoisted_8$3 = {
@@ -18094,7 +18720,7 @@ const _hoisted_8$3 = {
18094
18720
  const _hoisted_9$3 = { class: "lew-quarter-value" };
18095
18721
  const _hoisted_10$2 = { class: "lew-quarter-main" };
18096
18722
  const _hoisted_11$2 = { class: "lew-quarter-months" };
18097
- const _sfc_main$L = /* @__PURE__ */ defineComponent({
18723
+ const _sfc_main$K = /* @__PURE__ */ defineComponent({
18098
18724
  __name: "LewQuarter",
18099
18725
  props: {
18100
18726
  valueFormat: {
@@ -18160,14 +18786,14 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
18160
18786
  }
18161
18787
  __expose({ init });
18162
18788
  return (_ctx, _cache) => {
18163
- return openBlock(), createElementBlock("div", _hoisted_1$z, [
18789
+ return openBlock(), createElementBlock("div", _hoisted_1$y, [
18164
18790
  createVNode(unref(LewFlex), {
18165
18791
  x: "start",
18166
18792
  mode: "between",
18167
18793
  class: "lew-quarter-control"
18168
18794
  }, {
18169
18795
  default: withCtx(() => [
18170
- createElementVNode("div", _hoisted_2$n, [
18796
+ createElementVNode("div", _hoisted_2$m, [
18171
18797
  createVNode(unref(LewButton), {
18172
18798
  type: "light",
18173
18799
  color: "gray",
@@ -18181,8 +18807,8 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
18181
18807
  _: 1
18182
18808
  })
18183
18809
  ]),
18184
- createElementVNode("div", _hoisted_3$i, toDisplayString$1(unref(currentYear)), 1),
18185
- createElementVNode("div", _hoisted_4$c, [
18810
+ createElementVNode("div", _hoisted_3$h, toDisplayString$1(unref(currentYear)), 1),
18811
+ createElementVNode("div", _hoisted_4$a, [
18186
18812
  createVNode(unref(LewButton), {
18187
18813
  type: "light",
18188
18814
  color: "gray",
@@ -18199,7 +18825,7 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
18199
18825
  ]),
18200
18826
  _: 1
18201
18827
  }),
18202
- createElementVNode("div", _hoisted_5$a, [
18828
+ createElementVNode("div", _hoisted_5$9, [
18203
18829
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(quarterList), (item) => {
18204
18830
  return openBlock(), createElementBlock("div", {
18205
18831
  key: item.value,
@@ -18220,12 +18846,12 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
18220
18846
  };
18221
18847
  }
18222
18848
  });
18223
- const LewQuarter = /* @__PURE__ */ _export_sfc(_sfc_main$L, [["__scopeId", "data-v-8a82e927"]]);
18224
- const _hoisted_1$y = { class: "lew-year" };
18225
- const _hoisted_2$m = { class: "lew-year-control-left" };
18226
- const _hoisted_3$h = { class: "cur-decade" };
18227
- const _hoisted_4$b = { class: "lew-year-control-right" };
18228
- const _hoisted_5$9 = { class: "lew-year-list" };
18849
+ const LewQuarter = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["__scopeId", "data-v-8a82e927"]]);
18850
+ const _hoisted_1$x = { class: "lew-year" };
18851
+ const _hoisted_2$l = { class: "lew-year-control-left" };
18852
+ const _hoisted_3$g = { class: "cur-decade" };
18853
+ const _hoisted_4$9 = { class: "lew-year-control-right" };
18854
+ const _hoisted_5$8 = { class: "lew-year-list" };
18229
18855
  const _hoisted_6$4 = ["onClick"];
18230
18856
  const _hoisted_7$2 = { class: "lew-year-label" };
18231
18857
  const _hoisted_8$2 = {
@@ -18233,7 +18859,7 @@ const _hoisted_8$2 = {
18233
18859
  class: "lew-year-item-current"
18234
18860
  };
18235
18861
  const _hoisted_9$2 = { class: "lew-year-value" };
18236
- const _sfc_main$K = /* @__PURE__ */ defineComponent({
18862
+ const _sfc_main$J = /* @__PURE__ */ defineComponent({
18237
18863
  __name: "LewYear",
18238
18864
  props: {
18239
18865
  valueFormat: {
@@ -18303,14 +18929,14 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
18303
18929
  }
18304
18930
  __expose({ init });
18305
18931
  return (_ctx, _cache) => {
18306
- return openBlock(), createElementBlock("div", _hoisted_1$y, [
18932
+ return openBlock(), createElementBlock("div", _hoisted_1$x, [
18307
18933
  createVNode(unref(LewFlex), {
18308
18934
  x: "start",
18309
18935
  mode: "between",
18310
18936
  class: "lew-year-control"
18311
18937
  }, {
18312
18938
  default: withCtx(() => [
18313
- createElementVNode("div", _hoisted_2$m, [
18939
+ createElementVNode("div", _hoisted_2$l, [
18314
18940
  createVNode(unref(LewButton), {
18315
18941
  type: "light",
18316
18942
  color: "gray",
@@ -18324,8 +18950,8 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
18324
18950
  _: 1
18325
18951
  })
18326
18952
  ]),
18327
- createElementVNode("div", _hoisted_3$h, toDisplayString$1(unref(yearState).startYear) + " - " + toDisplayString$1(unref(yearState).startYear + 11), 1),
18328
- createElementVNode("div", _hoisted_4$b, [
18953
+ createElementVNode("div", _hoisted_3$g, toDisplayString$1(unref(yearState).startYear) + " - " + toDisplayString$1(unref(yearState).startYear + 11), 1),
18954
+ createElementVNode("div", _hoisted_4$9, [
18329
18955
  createVNode(unref(LewButton), {
18330
18956
  type: "light",
18331
18957
  color: "gray",
@@ -18342,7 +18968,7 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
18342
18968
  ]),
18343
18969
  _: 1
18344
18970
  }),
18345
- createElementVNode("div", _hoisted_5$9, [
18971
+ createElementVNode("div", _hoisted_5$8, [
18346
18972
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(yearList), (year) => {
18347
18973
  return openBlock(), createElementBlock("div", {
18348
18974
  key: year,
@@ -18360,9 +18986,9 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
18360
18986
  };
18361
18987
  }
18362
18988
  });
18363
- const LewYear = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["__scopeId", "data-v-a748ea05"]]);
18364
- const _hoisted_1$x = { class: "lew-panel" };
18365
- const _sfc_main$J = /* @__PURE__ */ defineComponent({
18989
+ const LewYear = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["__scopeId", "data-v-a748ea05"]]);
18990
+ const _hoisted_1$w = { class: "lew-panel" };
18991
+ const _sfc_main$I = /* @__PURE__ */ defineComponent({
18366
18992
  __name: "LewPanel",
18367
18993
  props: {
18368
18994
  type: {
@@ -18399,7 +19025,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
18399
19025
  }
18400
19026
  __expose({ init });
18401
19027
  return (_ctx, _cache) => {
18402
- return openBlock(), createElementBlock("div", _hoisted_1$x, [
19028
+ return openBlock(), createElementBlock("div", _hoisted_1$w, [
18403
19029
  (openBlock(), createBlock(resolveDynamicComponent(unref(currentComponent)), {
18404
19030
  ref_key: "currentComponentRef",
18405
19031
  ref: currentComponentRef,
@@ -18479,10 +19105,10 @@ const datePickerProps = {
18479
19105
  })
18480
19106
  }
18481
19107
  };
18482
- const _hoisted_1$w = { class: "lew-date-picker-view" };
18483
- const _hoisted_2$l = ["placeholder", "readonly", "disabled"];
18484
- const _hoisted_3$g = ["title", "onClick"];
18485
- const _sfc_main$I = /* @__PURE__ */ defineComponent({
19108
+ const _hoisted_1$v = { class: "lew-date-picker-view" };
19109
+ const _hoisted_2$k = ["placeholder", "readonly", "disabled"];
19110
+ const _hoisted_3$f = ["title", "onClick"];
19111
+ const _sfc_main$H = /* @__PURE__ */ defineComponent({
18486
19112
  __name: "LewDatePicker",
18487
19113
  props: /* @__PURE__ */ mergeModels(datePickerProps, {
18488
19114
  "modelValue": { required: true },
@@ -18661,7 +19287,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
18661
19287
  onHide: hideHandle
18662
19288
  }, {
18663
19289
  trigger: withCtx(() => [
18664
- createElementVNode("div", _hoisted_1$w, [
19290
+ createElementVNode("div", _hoisted_1$v, [
18665
19291
  createElementVNode("div", {
18666
19292
  class: normalizeClass(["lew-date-picker", unref(lewDatePickerClassNames)]),
18667
19293
  style: normalizeStyle(unref(getDatePickerInputStyle))
@@ -18679,7 +19305,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
18679
19305
  onBlur: handleInputBlur,
18680
19306
  onInput: handleInput,
18681
19307
  onKeydown: handleKeydown
18682
- }, null, 40, _hoisted_2$l), [
19308
+ }, null, 40, _hoisted_2$k), [
18683
19309
  [vModelText, modelValue.value]
18684
19310
  ]),
18685
19311
  createVNode(CommonIcon, {
@@ -18726,14 +19352,14 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
18726
19352
  unref(dayjs)(modelValue.value).isSame(item.value, "day") ? "lew-date-picker-presets-item-active" : ""
18727
19353
  ]]),
18728
19354
  onClick: ($event) => selectPresets(item)
18729
- }, toDisplayString$1(item.label), 11, _hoisted_3$g);
19355
+ }, toDisplayString$1(item.label), 11, _hoisted_3$f);
18730
19356
  }), 128))
18731
19357
  ]),
18732
19358
  _: 1
18733
19359
  })) : createCommentVNode("", true),
18734
19360
  createVNode(_component_lew_flex, { class: "lew-date-picker-date-panel" }, {
18735
19361
  default: withCtx(() => [
18736
- createVNode(_sfc_main$J, mergeProps({
19362
+ createVNode(_sfc_main$I, mergeProps({
18737
19363
  ref_key: "lewPanelRef",
18738
19364
  ref: lewPanelRef,
18739
19365
  type: unref(getPanelType)
@@ -18753,7 +19379,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
18753
19379
  };
18754
19380
  }
18755
19381
  });
18756
- const LewDatePicker = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["__scopeId", "data-v-1df6eca7"]]);
19382
+ const LewDatePicker = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["__scopeId", "data-v-1df6eca7"]]);
18757
19383
  const datePickerModel = {
18758
19384
  modelValue: {
18759
19385
  type: String
@@ -18887,11 +19513,11 @@ const dateRangeProps = {
18887
19513
  })
18888
19514
  }
18889
19515
  };
18890
- const _hoisted_1$v = { class: "lew-date-range" };
18891
- const _hoisted_2$k = { class: "lew-date" };
18892
- const _hoisted_3$f = { class: "lew-date-control-left" };
18893
- const _hoisted_4$a = { class: "cur-date" };
18894
- const _hoisted_5$8 = { class: "lew-date-control-right" };
19516
+ const _hoisted_1$u = { class: "lew-date-range" };
19517
+ const _hoisted_2$j = { class: "lew-date" };
19518
+ const _hoisted_3$e = { class: "lew-date-control-left" };
19519
+ const _hoisted_4$8 = { class: "cur-date" };
19520
+ const _hoisted_5$7 = { class: "lew-date-control-right" };
18895
19521
  const _hoisted_6$3 = { class: "lew-date-box" };
18896
19522
  const _hoisted_7$1 = { class: "lew-date-num" };
18897
19523
  const _hoisted_8$1 = ["onClick", "onMouseenter"];
@@ -18910,7 +19536,7 @@ const _hoisted_17 = {
18910
19536
  key: 0,
18911
19537
  class: "lew-date-item-today"
18912
19538
  };
18913
- const _sfc_main$H = /* @__PURE__ */ defineComponent({
19539
+ const _sfc_main$G = /* @__PURE__ */ defineComponent({
18914
19540
  __name: "LewDateRange",
18915
19541
  props: /* @__PURE__ */ mergeModels(dateRangeProps, {
18916
19542
  "modelValue": {},
@@ -19173,15 +19799,15 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
19173
19799
  ];
19174
19800
  });
19175
19801
  return (_ctx, _cache) => {
19176
- return openBlock(), createElementBlock("div", _hoisted_1$v, [
19177
- createElementVNode("div", _hoisted_2$k, [
19802
+ return openBlock(), createElementBlock("div", _hoisted_1$u, [
19803
+ createElementVNode("div", _hoisted_2$j, [
19178
19804
  createVNode(unref(LewFlex), {
19179
19805
  x: "start",
19180
19806
  mode: "between",
19181
19807
  class: "lew-date-control"
19182
19808
  }, {
19183
19809
  default: withCtx(() => [
19184
- createElementVNode("div", _hoisted_3$f, [
19810
+ createElementVNode("div", _hoisted_3$e, [
19185
19811
  createVNode(unref(LewButton), {
19186
19812
  type: "light",
19187
19813
  color: "gray",
@@ -19207,8 +19833,8 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
19207
19833
  _: 1
19208
19834
  })
19209
19835
  ]),
19210
- createElementVNode("div", _hoisted_4$a, toDisplayString$1(unref(dayjs)(`${unref(dateState).year1}-${unref(dateState).month1}`).format("YYYY-MM")), 1),
19211
- createElementVNode("div", _hoisted_5$8, [
19836
+ createElementVNode("div", _hoisted_4$8, toDisplayString$1(unref(dayjs)(`${unref(dateState).year1}-${unref(dateState).month1}`).format("YYYY-MM")), 1),
19837
+ createElementVNode("div", _hoisted_5$7, [
19212
19838
  createVNode(unref(LewButton), {
19213
19839
  type: "light",
19214
19840
  color: "gray",
@@ -19360,18 +19986,18 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
19360
19986
  };
19361
19987
  }
19362
19988
  });
19363
- const LewDateRange = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["__scopeId", "data-v-7acc9fdc"]]);
19364
- const _hoisted_1$u = { class: "lew-date-range-picker-view" };
19365
- const _hoisted_2$j = {
19989
+ const LewDateRange = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-7acc9fdc"]]);
19990
+ const _hoisted_1$t = { class: "lew-date-range-picker-view" };
19991
+ const _hoisted_2$i = {
19366
19992
  key: 0,
19367
19993
  class: "lew-date-range-picker-placeholder"
19368
19994
  };
19369
- const _hoisted_3$e = {
19995
+ const _hoisted_3$d = {
19370
19996
  key: 1,
19371
19997
  class: "lew-date-range-picker-dateValue lew-date-range-picker-start"
19372
19998
  };
19373
- const _hoisted_4$9 = { class: "lew-date-range-picker-mid" };
19374
- const _hoisted_5$7 = {
19999
+ const _hoisted_4$7 = { class: "lew-date-range-picker-mid" };
20000
+ const _hoisted_5$6 = {
19375
20001
  key: 2,
19376
20002
  class: "lew-date-range-picker-placeholder"
19377
20003
  };
@@ -19379,7 +20005,7 @@ const _hoisted_6$2 = {
19379
20005
  key: 3,
19380
20006
  class: "lew-date-range-picker-dateValue lew-date-range-picker-end"
19381
20007
  };
19382
- const _sfc_main$G = /* @__PURE__ */ defineComponent({
20008
+ const _sfc_main$F = /* @__PURE__ */ defineComponent({
19383
20009
  __name: "LewDateRangePicker",
19384
20010
  props: /* @__PURE__ */ mergeModels(dateRangePickerProps, {
19385
20011
  "modelValue": { required: true },
@@ -19497,7 +20123,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
19497
20123
  onHide: hideHandle
19498
20124
  }, {
19499
20125
  trigger: withCtx(() => [
19500
- createElementVNode("div", _hoisted_1$u, [
20126
+ createElementVNode("div", _hoisted_1$t, [
19501
20127
  createElementVNode("div", {
19502
20128
  class: normalizeClass(["lew-date-range-picker", unref(lewDateRangeClassNames)]),
19503
20129
  style: normalizeStyle(unref(getDateRangePickerInputStyle))
@@ -19510,14 +20136,14 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
19510
20136
  })
19511
20137
  }, {
19512
20138
  default: withCtx(() => [
19513
- !modelValue.value?.start ? (openBlock(), createElementBlock("div", _hoisted_2$j, toDisplayString$1(_ctx.placeholderStart ? _ctx.placeholderStart : unref(locale).t("dateRangePicker.placeholderStart")), 1)) : (openBlock(), createElementBlock("div", _hoisted_3$e, toDisplayString$1(modelValue.value.start), 1)),
19514
- createElementVNode("div", _hoisted_4$9, [
20139
+ !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)),
20140
+ createElementVNode("div", _hoisted_4$7, [
19515
20141
  createVNode(CommonIcon, {
19516
20142
  size: 14,
19517
20143
  type: "minus"
19518
20144
  })
19519
20145
  ]),
19520
- !modelValue.value?.end ? (openBlock(), createElementBlock("div", _hoisted_5$7, toDisplayString$1(_ctx.placeholderEnd ? _ctx.placeholderEnd : unref(locale).t("dateRangePicker.placeholderEnd")), 1)) : (openBlock(), createElementBlock("div", _hoisted_6$2, toDisplayString$1(modelValue.value.end), 1)),
20146
+ !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)),
19521
20147
  createVNode(CommonIcon, {
19522
20148
  class: normalizeClass(["lew-date-range-picker-icon-calendar", {
19523
20149
  "lew-date-range-picker-icon-calendar-hide": unref(checkClear)
@@ -19560,7 +20186,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
19560
20186
  };
19561
20187
  }
19562
20188
  });
19563
- const LewDateRangePicker = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-38041cdb"]]);
20189
+ const LewDateRangePicker = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["__scopeId", "data-v-38041cdb"]]);
19564
20190
  const formEmits = {
19565
20191
  change: (value) => value,
19566
20192
  mounted: () => true
@@ -21172,11 +21798,11 @@ Parser.prototype.isOperatorEnabled = function(op) {
21172
21798
  var operators = this.options.operators || {};
21173
21799
  return !(optionName in operators) || !!operators[optionName];
21174
21800
  };
21175
- const _hoisted_1$t = {
21801
+ const _hoisted_1$s = {
21176
21802
  key: 0,
21177
21803
  class: "lew-label-box"
21178
21804
  };
21179
- const _sfc_main$F = /* @__PURE__ */ defineComponent({
21805
+ const _sfc_main$E = /* @__PURE__ */ defineComponent({
21180
21806
  __name: "LewFormItem",
21181
21807
  props: /* @__PURE__ */ mergeModels(formItemProps, {
21182
21808
  "modelValue": { default: void 0 },
@@ -21196,7 +21822,6 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
21196
21822
  "radio-group": LewRadioGroup,
21197
21823
  "checkbox": LewCheckbox,
21198
21824
  "select": LewSelect,
21199
- "select-multiple": LewSelectMultiple,
21200
21825
  "date-picker": LewDatePicker,
21201
21826
  "date-range-picker": LewDateRangePicker,
21202
21827
  "tabs": LewTabs,
@@ -21312,7 +21937,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
21312
21937
  style: normalizeStyle(_ctx.direction === "x" ? `width:${unref(any2px)(_ctx.labelWidth)}` : ""),
21313
21938
  class: "lew-label-box-wrapper"
21314
21939
  }, [
21315
- _ctx.as ? (openBlock(), createElementBlock("div", _hoisted_1$t, [
21940
+ _ctx.as ? (openBlock(), createElementBlock("div", _hoisted_1$s, [
21316
21941
  _ctx.required && _ctx.label ? (openBlock(), createBlock(_sfc_main$18, {
21317
21942
  key: 0,
21318
21943
  size: unref(requiredIconSizeMap)[_ctx.size]
@@ -21361,8 +21986,8 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
21361
21986
  };
21362
21987
  }
21363
21988
  });
21364
- const LewFormItem = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["__scopeId", "data-v-df6f6e1c"]]);
21365
- const _sfc_main$E = /* @__PURE__ */ defineComponent({
21989
+ const LewFormItem = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__scopeId", "data-v-0c8c6aeb"]]);
21990
+ const _sfc_main$D = /* @__PURE__ */ defineComponent({
21366
21991
  __name: "LewForm",
21367
21992
  props: formProps,
21368
21993
  emits: formEmits,
@@ -21525,7 +22150,7 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
21525
22150
  };
21526
22151
  }
21527
22152
  });
21528
- const LewForm = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__scopeId", "data-v-d62eca7f"]]);
22153
+ const LewForm = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-d62eca7f"]]);
21529
22154
  const inputEmits = {
21530
22155
  change: (value) => value,
21531
22156
  input: (value) => value,
@@ -21736,20 +22361,20 @@ const inputProps = {
21736
22361
  })
21737
22362
  }
21738
22363
  };
21739
- const _hoisted_1$s = {
22364
+ const _hoisted_1$r = {
21740
22365
  key: 0,
21741
22366
  class: "lew-input-prefixes"
21742
22367
  };
21743
- const _hoisted_2$i = { key: 0 };
21744
- const _hoisted_3$d = {
22368
+ const _hoisted_2$h = { key: 0 };
22369
+ const _hoisted_3$c = {
21745
22370
  key: 1,
21746
22371
  class: "lew-input-prefixes-icon"
21747
22372
  };
21748
- const _hoisted_4$8 = {
22373
+ const _hoisted_4$6 = {
21749
22374
  key: 2,
21750
22375
  class: "lew-input-prefixes-select"
21751
22376
  };
21752
- const _hoisted_5$6 = ["disabled", "placeholder", "type", "readonly", "maxlength"];
22377
+ const _hoisted_5$5 = ["disabled", "placeholder", "type", "readonly", "maxlength"];
21753
22378
  const _hoisted_6$1 = {
21754
22379
  key: 0,
21755
22380
  class: "lew-input-auto-width"
@@ -21775,7 +22400,7 @@ const _hoisted_12 = {
21775
22400
  key: 2,
21776
22401
  class: "lew-input-suffix-select"
21777
22402
  };
21778
- const _sfc_main$D = /* @__PURE__ */ defineComponent({
22403
+ const _sfc_main$C = /* @__PURE__ */ defineComponent({
21779
22404
  __name: "LewInput",
21780
22405
  props: /* @__PURE__ */ mergeModels(inputProps, {
21781
22406
  "modelValue": { required: true },
@@ -21820,19 +22445,19 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
21820
22445
  emit("clear");
21821
22446
  emit("change", void 0);
21822
22447
  }
21823
- const toFocus = () => lewInputRef.value?.focus();
21824
- const toBlur = () => lewInputRef.value?.blur();
22448
+ const focus = () => lewInputRef.value?.focus();
22449
+ const blur = () => lewInputRef.value?.blur();
21825
22450
  function showPasswordFn() {
21826
22451
  _type.value = _type.value === "text" ? "password" : "text";
21827
22452
  }
21828
- function focus(e) {
22453
+ function _focus(e) {
21829
22454
  if (props.selectByFocus) {
21830
22455
  e.currentTarget?.select();
21831
22456
  }
21832
22457
  emit("focus", e);
21833
22458
  isFocus.value = true;
21834
22459
  }
21835
- function blur(e) {
22460
+ function _blur(e) {
21836
22461
  emit("blur", e);
21837
22462
  isFocus.value = false;
21838
22463
  }
@@ -21930,22 +22555,22 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
21930
22555
  if (timer)
21931
22556
  clearTimeout(timer);
21932
22557
  });
21933
- __expose({ toFocus, toBlur });
22558
+ __expose({ focus, blur });
21934
22559
  return (_ctx, _cache) => {
21935
22560
  const _directive_tooltip = resolveDirective("tooltip");
21936
22561
  return openBlock(), createElementBlock("div", {
21937
22562
  class: normalizeClass(["lew-input-view", unref(getInputClassNames)]),
21938
22563
  style: normalizeStyle({ width: _ctx.autoWidth ? "auto" : unref(any2px)(_ctx.width) })
21939
22564
  }, [
21940
- _ctx.prefixes ? withDirectives((openBlock(), createElementBlock("div", _hoisted_1$s, [
21941
- _ctx.prefixes === "text" ? (openBlock(), createElementBlock("div", _hoisted_2$i, toDisplayString$1(prefixValue.value), 1)) : createCommentVNode("", true),
21942
- _ctx.prefixes === "icon" ? (openBlock(), createElementBlock("div", _hoisted_3$d, [
22565
+ _ctx.prefixes ? withDirectives((openBlock(), createElementBlock("div", _hoisted_1$r, [
22566
+ _ctx.prefixes === "text" ? (openBlock(), createElementBlock("div", _hoisted_2$h, toDisplayString$1(prefixValue.value), 1)) : createCommentVNode("", true),
22567
+ _ctx.prefixes === "icon" ? (openBlock(), createElementBlock("div", _hoisted_3$c, [
21943
22568
  createVNode(CommonIcon, {
21944
22569
  size: unref(getIconSize),
21945
22570
  type: prefixValue.value
21946
22571
  }, null, 8, ["size", "type"])
21947
22572
  ])) : createCommentVNode("", true),
21948
- _ctx.prefixes === "select" ? (openBlock(), createElementBlock("div", _hoisted_4$8, [
22573
+ _ctx.prefixes === "select" ? (openBlock(), createElementBlock("div", _hoisted_4$6, [
21949
22574
  createVNode(unref(_sfc_main$7), {
21950
22575
  placement: "bottom",
21951
22576
  trigger: "click",
@@ -22016,9 +22641,9 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
22016
22641
  maxlength: _ctx.maxLength,
22017
22642
  onInput: handleInput,
22018
22643
  onChange: handleChange,
22019
- onBlur: blur,
22020
- onFocus: focus
22021
- }, null, 44, _hoisted_5$6), [
22644
+ onBlur: _blur,
22645
+ onFocus: _focus
22646
+ }, null, 44, _hoisted_5$5), [
22022
22647
  [vModelDynamic, modelValue.value]
22023
22648
  ]),
22024
22649
  _ctx.autoWidth ? (openBlock(), createElementBlock("label", _hoisted_6$1, toDisplayString$1(modelValue.value), 1)) : createCommentVNode("", true),
@@ -22127,7 +22752,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
22127
22752
  };
22128
22753
  }
22129
22754
  });
22130
- const LewInput = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-8127795f"]]);
22755
+ const LewInput = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-59f05e76"]]);
22131
22756
  const inputNumberEmits = {
22132
22757
  change: (value) => value,
22133
22758
  input: (value) => value
@@ -22223,8 +22848,8 @@ const inputNumberProps = {
22223
22848
  })
22224
22849
  }
22225
22850
  };
22226
- const _hoisted_1$r = ["placeholder", "min", "max", "step"];
22227
- const _sfc_main$C = /* @__PURE__ */ defineComponent({
22851
+ const _hoisted_1$q = ["placeholder", "min", "max", "step"];
22852
+ const _sfc_main$B = /* @__PURE__ */ defineComponent({
22228
22853
  __name: "LewInputNumber",
22229
22854
  props: /* @__PURE__ */ mergeModels(inputNumberProps, {
22230
22855
  "modelValue": { required: true },
@@ -22242,7 +22867,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
22242
22867
  const lewInputRef = ref();
22243
22868
  const isFocus = ref(false);
22244
22869
  const validationMessage = ref("");
22245
- function toFocus() {
22870
+ function focus() {
22246
22871
  lewInputRef.value?.focus();
22247
22872
  }
22248
22873
  function focusFn(e) {
@@ -22338,7 +22963,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
22338
22963
  function validCheck() {
22339
22964
  return (lewInputRef.value && lewInputRef.value.validationMessage || "").length === 0;
22340
22965
  }
22341
- __expose({ toFocus, validCheck });
22966
+ __expose({ focus, validCheck });
22342
22967
  return (_ctx, _cache) => {
22343
22968
  const _directive_tooltip = resolveDirective("tooltip");
22344
22969
  return openBlock(), createElementBlock("div", {
@@ -22363,7 +22988,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
22363
22988
  onInput: inputFn,
22364
22989
  onChange: changeFn,
22365
22990
  onFocus: focusFn
22366
- }, null, 44, _hoisted_1$r), [
22991
+ }, null, 44, _hoisted_1$q), [
22367
22992
  [vModelText, modelValue.value],
22368
22993
  [_directive_tooltip, {
22369
22994
  content: unref(validationMessage),
@@ -22403,7 +23028,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
22403
23028
  };
22404
23029
  }
22405
23030
  });
22406
- const LewInputNumber = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-3760ac9e"]]);
23031
+ const LewInputNumber = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["__scopeId", "data-v-4c6a9fe2"]]);
22407
23032
  const inputTableEmits = {
22408
23033
  change: (value) => value
22409
23034
  };
@@ -22574,8 +23199,8 @@ const formModalProps = {
22574
23199
  default: () => true
22575
23200
  }
22576
23201
  };
22577
- const _hoisted_1$q = { class: "lew-form-modal lew-scrollbar" };
22578
- const _sfc_main$B = /* @__PURE__ */ defineComponent({
23202
+ const _hoisted_1$p = { class: "lew-form-modal lew-scrollbar" };
23203
+ const _sfc_main$A = /* @__PURE__ */ defineComponent({
22579
23204
  __name: "FormModal",
22580
23205
  props: formModalProps,
22581
23206
  emits: ["addSuccess", "editSuccess"],
@@ -22641,7 +23266,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
22641
23266
  title: `${unref(isEditing) ? unref(locale).t("inputTable.editTitle") : unref(locale).t("inputTable.modelTitle")}`
22642
23267
  }, {
22643
23268
  default: withCtx(() => [
22644
- createElementVNode("div", _hoisted_1$q, [
23269
+ createElementVNode("div", _hoisted_1$p, [
22645
23270
  createVNode(unref(LewForm), {
22646
23271
  ref_key: "formRef",
22647
23272
  ref: formRef,
@@ -22657,8 +23282,8 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
22657
23282
  };
22658
23283
  }
22659
23284
  });
22660
- const FormModal = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["__scopeId", "data-v-c7f7aaf1"]]);
22661
- const _sfc_main$A = /* @__PURE__ */ defineComponent({
23285
+ const FormModal = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["__scopeId", "data-v-c7f7aaf1"]]);
23286
+ const _sfc_main$z = /* @__PURE__ */ defineComponent({
22662
23287
  __name: "LewInputTable",
22663
23288
  props: /* @__PURE__ */ mergeModels(inputTableProps, {
22664
23289
  "modelValue": { required: true },
@@ -22952,7 +23577,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
22952
23577
  };
22953
23578
  }
22954
23579
  });
22955
- const LewInputTable = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["__scopeId", "data-v-c4622421"]]);
23580
+ const LewInputTable = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__scopeId", "data-v-c4622421"]]);
22956
23581
  const inputTagEmits = {
22957
23582
  remove: (tag, index2) => ({ tag, index: index2 }),
22958
23583
  change: (value) => value,
@@ -23033,7 +23658,7 @@ const inputTagProps = {
23033
23658
  })
23034
23659
  }
23035
23660
  };
23036
- const _sfc_main$z = /* @__PURE__ */ defineComponent({
23661
+ const _sfc_main$y = /* @__PURE__ */ defineComponent({
23037
23662
  __name: "LewInputTag",
23038
23663
  props: /* @__PURE__ */ mergeModels(inputTagProps, {
23039
23664
  "modelValue": {},
@@ -23059,8 +23684,8 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
23059
23684
  }
23060
23685
  isInputActive.value = true;
23061
23686
  nextTick(() => {
23062
- if (lewInputRef.value && typeof lewInputRef.value.toFocus === "function") {
23063
- lewInputRef.value.toFocus();
23687
+ if (lewInputRef.value && typeof lewInputRef.value?.focus === "function") {
23688
+ lewInputRef.value?.focus();
23064
23689
  }
23065
23690
  });
23066
23691
  originalKeydownHandler = document.onkeydown;
@@ -23097,8 +23722,8 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
23097
23722
  }
23098
23723
  }
23099
23724
  if (keyCode === "Enter" || keyCode === "NumpadEnter") {
23100
- if (lewInputRef.value && typeof lewInputRef.value.toBlur === "function") {
23101
- lewInputRef.value.toBlur();
23725
+ if (lewInputRef.value && typeof lewInputRef.value.blur === "function") {
23726
+ lewInputRef.value.blur();
23102
23727
  }
23103
23728
  }
23104
23729
  }
@@ -23260,7 +23885,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
23260
23885
  };
23261
23886
  }
23262
23887
  });
23263
- const LewInputTag = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__scopeId", "data-v-b91654f1"]]);
23888
+ const LewInputTag = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["__scopeId", "data-v-2353f614"]]);
23264
23889
  const radioEmits = {
23265
23890
  change: () => true
23266
23891
  };
@@ -23413,15 +24038,15 @@ const radioGroupProps = {
23413
24038
  })
23414
24039
  }
23415
24040
  };
23416
- const _hoisted_1$p = {
24041
+ const _hoisted_1$o = {
23417
24042
  key: 0,
23418
24043
  class: "lew-radio-icon-box"
23419
24044
  };
23420
- const _hoisted_2$h = {
24045
+ const _hoisted_2$g = {
23421
24046
  key: 1,
23422
24047
  class: "lew-radio-label"
23423
24048
  };
23424
- const _sfc_main$y = /* @__PURE__ */ defineComponent({
24049
+ const _sfc_main$x = /* @__PURE__ */ defineComponent({
23425
24050
  __name: "LewRadio",
23426
24051
  props: radioProps,
23427
24052
  emits: radioEmits,
@@ -23462,7 +24087,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
23462
24087
  class: normalizeClass(["lew-radio", unref(getRadioClassName)]),
23463
24088
  onClick: withModifiers(setChecked, ["stop"])
23464
24089
  }, [
23465
- _ctx.iconable || !_ctx.iconable && !_ctx.block ? (openBlock(), createElementBlock("div", _hoisted_1$p, [
24090
+ _ctx.iconable || !_ctx.iconable && !_ctx.block ? (openBlock(), createElementBlock("div", _hoisted_1$o, [
23466
24091
  createVNode(CommonIcon, {
23467
24092
  "stroke-width": 4,
23468
24093
  class: "lew-radio-icon",
@@ -23470,13 +24095,13 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
23470
24095
  size: unref(getIconSize)
23471
24096
  }, null, 8, ["size"])
23472
24097
  ])) : createCommentVNode("", true),
23473
- _ctx.label ? (openBlock(), createElementBlock("span", _hoisted_2$h, toDisplayString$1(_ctx.label), 1)) : createCommentVNode("", true)
24098
+ _ctx.label ? (openBlock(), createElementBlock("span", _hoisted_2$g, toDisplayString$1(_ctx.label), 1)) : createCommentVNode("", true)
23474
24099
  ], 2);
23475
24100
  };
23476
24101
  }
23477
24102
  });
23478
- const LewRadio = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["__scopeId", "data-v-aaf2d10e"]]);
23479
- const _sfc_main$x = /* @__PURE__ */ defineComponent({
24103
+ const LewRadio = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["__scopeId", "data-v-aaf2d10e"]]);
24104
+ const _sfc_main$w = /* @__PURE__ */ defineComponent({
23480
24105
  __name: "LewRadioGroup",
23481
24106
  props: /* @__PURE__ */ mergeModels(radioGroupProps, {
23482
24107
  "modelValue": {},
@@ -23527,7 +24152,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
23527
24152
  };
23528
24153
  }
23529
24154
  });
23530
- const LewRadioGroup = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["__scopeId", "data-v-b9846701"]]);
24155
+ const LewRadioGroup = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["__scopeId", "data-v-b9846701"]]);
23531
24156
  const rateEmits = {
23532
24157
  change: (value) => value
23533
24158
  };
@@ -23581,8 +24206,8 @@ const rateProps = {
23581
24206
  })
23582
24207
  }
23583
24208
  };
23584
- const _hoisted_1$o = ["onMousemove", "onClick"];
23585
- const _sfc_main$w = /* @__PURE__ */ defineComponent({
24209
+ const _hoisted_1$n = ["onMousemove", "onClick"];
24210
+ const _sfc_main$v = /* @__PURE__ */ defineComponent({
23586
24211
  __name: "LewRate",
23587
24212
  props: /* @__PURE__ */ mergeModels(rateProps, {
23588
24213
  "modelValue": { required: true },
@@ -23706,7 +24331,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
23706
24331
  trigger: "hover"
23707
24332
  }]
23708
24333
  ])
23709
- ], 44, _hoisted_1$o);
24334
+ ], 44, _hoisted_1$n);
23710
24335
  }), 128))
23711
24336
  ]),
23712
24337
  _: 1
@@ -23714,22 +24339,25 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
23714
24339
  };
23715
24340
  }
23716
24341
  });
23717
- const LewRate = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["__scopeId", "data-v-4f04bcc0"]]);
24342
+ const LewRate = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__scopeId", "data-v-4f04bcc0"]]);
23718
24343
  const selectEmits = {
23719
24344
  change: (value) => value || typeof value === "undefined",
23720
24345
  blur: () => true,
23721
24346
  clear: () => true,
23722
- focus: () => true
24347
+ focus: () => true,
24348
+ delete: (value, item) => {
24349
+ return { value, item };
24350
+ }
23723
24351
  };
23724
24352
  const selectModel = {
23725
24353
  modelValue: {
23726
- type: [String, Number, void 0],
24354
+ type: [String, Number, Array, void 0],
23727
24355
  default: ""
23728
24356
  }
23729
24357
  };
23730
24358
  const selectProps = {
23731
24359
  defaultValue: {
23732
- type: String,
24360
+ type: [String, Array],
23733
24361
  default: "",
23734
24362
  validator: validators.string({
23735
24363
  componentName: "LewSelect",
@@ -23796,6 +24424,14 @@ const selectProps = {
23796
24424
  values: validSizeList
23797
24425
  })
23798
24426
  },
24427
+ multiple: {
24428
+ type: Boolean,
24429
+ default: false,
24430
+ validator: validators.boolean({
24431
+ componentName: "LewSelect",
24432
+ propName: "multiple"
24433
+ })
24434
+ },
23799
24435
  itemHeight: {
23800
24436
  type: Number,
23801
24437
  default: 38,
@@ -23893,19 +24529,14 @@ const selectProps = {
23893
24529
  })
23894
24530
  }
23895
24531
  };
23896
- const _hoisted_1$n = {
23897
- key: 0,
23898
- class: "lew-icon-loading-box"
23899
- };
23900
- const _hoisted_2$g = ["title", "readonly", "placeholder"];
23901
- const _hoisted_3$c = { class: "lew-select-options-box" };
23902
- const _hoisted_4$7 = {
24532
+ const _hoisted_1$m = { class: "lew-select-options-box" };
24533
+ const _hoisted_2$f = {
23903
24534
  key: 0,
23904
24535
  class: "lew-result-count"
23905
24536
  };
23906
- const _hoisted_5$5 = ["onClick"];
23907
- const SELECT_WIDTH_TOLERANCE = 30;
23908
- const _sfc_main$v = /* @__PURE__ */ defineComponent({
24537
+ const _hoisted_3$b = ["onClick"];
24538
+ const SELECT_WIDTH_TOLERANCE = 40;
24539
+ const _sfc_main$u = /* @__PURE__ */ defineComponent({
23909
24540
  __name: "LewSelect",
23910
24541
  props: /* @__PURE__ */ mergeModels(selectProps, {
23911
24542
  "modelValue": {},
@@ -23916,8 +24547,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
23916
24547
  const props = __props;
23917
24548
  const emit = __emit;
23918
24549
  const selectValue = useModel(__props, "modelValue");
23919
- const lewSelectRef = ref();
23920
- const inputRef = ref();
24550
+ const lewSelectInputRef = ref();
23921
24551
  const lewPopoverRef = ref();
23922
24552
  const formMethods = inject("formMethods", {});
23923
24553
  const virtListRef = ref();
@@ -23926,12 +24556,14 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
23926
24556
  loading: false,
23927
24557
  initLoading: true,
23928
24558
  sourceOptions: props.options,
24559
+ sourceFlattenOptions: flattenSelectOptions(props.options),
23929
24560
  options: flattenSelectOptions(props.options),
23930
24561
  hideBySelect: false,
23931
- keyword: props.defaultValue || selectValue.value,
23932
- keywordBackup: props.defaultValue,
24562
+ keyword: props.multiple ? "" : props.defaultValue || selectValue.value,
24563
+ keywordBackup: props.multiple ? "" : props.defaultValue,
23933
24564
  autoWidth: 0,
23934
- searchCache: /* @__PURE__ */ new Map()
24565
+ searchCache: /* @__PURE__ */ new Map(),
24566
+ popoverWidth: 0
23935
24567
  });
23936
24568
  const _searchMethod = computed(() => {
23937
24569
  if (isFunction$1(props.searchMethod)) {
@@ -23950,15 +24582,6 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
23950
24582
  }
23951
24583
  return false;
23952
24584
  });
23953
- const shouldShowClearButton = computed(() => {
23954
- return props.clearable && state.keyword && !props.readonly;
23955
- });
23956
- const shouldShowLoading = computed(() => {
23957
- return state.initLoading;
23958
- });
23959
- const shouldHideDropdownIcon = computed(() => {
23960
- return props.clearable && state.keyword;
23961
- });
23962
24585
  const shouldShowEmptyState = computed(() => {
23963
24586
  return state.options && state.options.length === 0;
23964
24587
  });
@@ -23966,11 +24589,20 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
23966
24589
  return props.searchable && !shouldShowEmptyState.value;
23967
24590
  });
23968
24591
  const inputPlaceholder = computed(() => {
24592
+ if (props.multiple) {
24593
+ return props.placeholder || locale.t("selectMultiple.placeholder");
24594
+ }
23969
24595
  if (state.keywordBackup || props.placeholder) {
23970
24596
  return props.placeholder;
23971
24597
  }
23972
24598
  return locale.t("select.placeholder");
23973
24599
  });
24600
+ function updateWidths() {
24601
+ if (props.multiple && lewSelectInputRef.value) {
24602
+ const selectWidth = lewSelectInputRef.value.$el ? lewSelectInputRef.value.$el.clientWidth : 0;
24603
+ state.popoverWidth = selectWidth - 12;
24604
+ }
24605
+ }
23974
24606
  const getOptionText = computed(() => {
23975
24607
  return (templateProps) => {
23976
24608
  if (templateProps.isGroup) {
@@ -23984,6 +24616,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
23984
24616
  const newOptions = await _initMethod.value();
23985
24617
  state.sourceOptions = newOptions;
23986
24618
  state.options = flattenSelectOptions(newOptions);
24619
+ state.sourceFlattenOptions = state.options;
23987
24620
  findKeyword();
23988
24621
  }
23989
24622
  if (props.enableSearchCache) {
@@ -24019,11 +24652,28 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
24019
24652
  }
24020
24653
  return props.width;
24021
24654
  });
24655
+ let resizeObserver = null;
24022
24656
  onMounted(() => {
24023
- if (props.autoWidth) {
24657
+ if (props.autoWidth && !props.multiple) {
24024
24658
  calculateAutoWidth();
24025
24659
  }
24026
24660
  init();
24661
+ if (props.multiple) {
24662
+ nextTick(() => {
24663
+ if (lewSelectInputRef.value && lewSelectInputRef.value.$el) {
24664
+ resizeObserver = new ResizeObserver(() => {
24665
+ updateWidths();
24666
+ });
24667
+ resizeObserver.observe(lewSelectInputRef.value.$el);
24668
+ }
24669
+ });
24670
+ }
24671
+ });
24672
+ onUnmounted(() => {
24673
+ if (resizeObserver) {
24674
+ resizeObserver.disconnect();
24675
+ resizeObserver = null;
24676
+ }
24027
24677
  });
24028
24678
  function calculateAutoWidth() {
24029
24679
  if (!props.autoWidth)
@@ -24033,21 +24683,27 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
24033
24683
  tempDiv.style.visibility = "hidden";
24034
24684
  tempDiv.style.whiteSpace = "nowrap";
24035
24685
  tempDiv.style.fontSize = getComputedStyle(document.body).fontSize;
24036
- if (inputRef.value) {
24037
- tempDiv.style.fontSize = getComputedStyle(inputRef.value).fontSize;
24038
- tempDiv.style.padding = getComputedStyle(inputRef.value).padding;
24039
- tempDiv.style.fontFamily = getComputedStyle(inputRef.value).fontFamily;
24040
- tempDiv.style.fontWeight = getComputedStyle(inputRef.value).fontWeight;
24041
- }
24042
- let textContent = state.keyword;
24043
- if (!textContent || textContent.trim() === "") {
24044
- textContent = props.placeholder || locale.t("select.placeholder");
24045
- }
24046
- tempDiv.textContent = textContent;
24047
- document.body.appendChild(tempDiv);
24048
- const textWidth = tempDiv.clientWidth;
24049
- state.autoWidth = textWidth + SELECT_WIDTH_TOLERANCE;
24050
- document.body.removeChild(tempDiv);
24686
+ if (lewSelectInputRef.value) {
24687
+ const {
24688
+ fontSize,
24689
+ fontFamily,
24690
+ padding,
24691
+ marginLeft
24692
+ } = lewSelectInputRef.value.getInputRefStyle();
24693
+ tempDiv.style.fontSize = fontSize;
24694
+ tempDiv.style.fontFamily = fontFamily;
24695
+ tempDiv.style.padding = padding;
24696
+ let textContent = state.keyword;
24697
+ if (!textContent || textContent.trim() === "") {
24698
+ textContent = props.placeholder || locale.t("select.placeholder");
24699
+ }
24700
+ tempDiv.textContent = textContent;
24701
+ document.body.appendChild(tempDiv);
24702
+ const textWidth = tempDiv.clientWidth;
24703
+ console.log(marginLeft);
24704
+ state.autoWidth = textWidth + SELECT_WIDTH_TOLERANCE + Number.parseInt(marginLeft);
24705
+ document.body.removeChild(tempDiv);
24706
+ }
24051
24707
  }
24052
24708
  watch(
24053
24709
  () => state.keyword,
@@ -24092,707 +24748,135 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
24092
24748
  state.loading = false;
24093
24749
  }
24094
24750
  function clearHandle() {
24095
- selectValue.value = void 0;
24096
- state.keywordBackup = void 0;
24097
- state.keyword = "";
24098
- emit("clear");
24099
- emit("change", void 0);
24100
- }
24101
- function selectHandle(item) {
24102
- if (item.disabled || item.isGroup) {
24103
- return;
24104
- }
24105
- state.hideBySelect = true;
24106
- state.keyword = item.label;
24107
- selectValue.value = item.value;
24108
- emit("change", item.value);
24109
- setTimeout(() => {
24110
- hide2();
24111
- }, 100);
24112
- }
24113
- const getChecked = computed(() => (value) => {
24114
- return selectValue.value === value;
24115
- });
24116
- const getValueStyle = computed(() => {
24117
- return state.visible ? "opacity:0.6" : "";
24118
- });
24119
- function findKeyword() {
24120
- if (state.options) {
24121
- const option = state.options.find((e) => {
24122
- if (e) {
24123
- return e.value === selectValue.value;
24124
- }
24125
- return false;
24126
- });
24127
- if (option && JSON.stringify(option) !== "{}") {
24128
- return state.keyword = option.label;
24129
- }
24130
- }
24131
- return state.keyword = props.defaultValue;
24132
- }
24133
- findKeyword();
24134
- const getSelectClassName = computed(() => {
24135
- let { clearable, size, disabled, readonly: readonly2, searchable } = props;
24136
- clearable = clearable ? !!selectValue.value : false;
24137
- const focus = state.visible;
24138
- return object2class("lew-select", {
24139
- clearable,
24140
- size,
24141
- disabled,
24142
- readonly: readonly2,
24143
- searchable,
24144
- focus,
24145
- "init-loading": state.initLoading
24146
- });
24147
- });
24148
- const getBodyClassName = computed(() => {
24149
- const { size, disabled } = props;
24150
- return object2class("lew-select-body", { size, disabled });
24151
- });
24152
- function getSelectItemClassName(e) {
24153
- const { disabled, isGroup } = e;
24154
- const active = getChecked.value(e.value);
24155
- return object2class("lew-select-item", {
24156
- disabled,
24157
- active,
24158
- "is-group": isGroup
24159
- });
24160
- }
24161
- const getIconSize = computed(() => {
24162
- const size = {
24163
- small: 14,
24164
- medium: 15,
24165
- large: 16
24166
- };
24167
- return size[props.size];
24168
- });
24169
- const getVirtualHeight = computed(() => {
24170
- let height = state.options.length * props.itemHeight;
24171
- height = height >= 280 ? 280 : height;
24172
- return height;
24173
- });
24174
- async function showHandle() {
24175
- state.visible = true;
24176
- state.keywordBackup = cloneDeep(state.keyword);
24177
- if (props.searchable) {
24178
- inputRef.value.focus();
24179
- }
24180
- emit("focus");
24181
- if (props.searchable) {
24182
- state.keyword = "";
24183
- }
24184
- state.hideBySelect = false;
24185
- if (props.searchable) {
24186
- await search({ target: { value: "" } });
24187
- }
24188
- const index2 = state.options.findIndex((e) => e.value === selectValue.value);
24189
- poll({
24190
- callback: () => {
24191
- const i = index2 > -1 ? index2 : 0;
24192
- if (i > 0 && i !== Infinity) {
24193
- virtListRef.value.scrollToIndex(i);
24194
- } else {
24195
- virtListRef.value.reset();
24196
- }
24197
- },
24198
- vail: () => {
24199
- return !!virtListRef.value;
24200
- }
24201
- });
24202
- }
24203
- function hideHandle() {
24204
- state.visible = false;
24205
- if (!state.hideBySelect) {
24206
- findKeyword();
24207
- }
24208
- inputRef.value.blur();
24209
- emit("blur");
24210
- }
24211
- const isShowScrollBar = computed(() => {
24212
- return getVirtualHeight.value >= 280;
24213
- });
24214
- const getPopoverBodyWidth = computed(() => {
24215
- const { popoverWidth } = props;
24216
- if (!lewSelectRef.value)
24217
- return popoverWidth;
24218
- return popoverWidth && popoverWidth !== "100%" ? parseDimension(popoverWidth) - 14 : lewSelectRef.value.offsetWidth - 14;
24219
- });
24220
- watch(
24221
- () => selectValue.value,
24222
- () => {
24223
- findKeyword();
24224
- if (props.autoWidth) {
24225
- calculateAutoWidth();
24226
- }
24227
- }
24228
- );
24229
- const getResultText = computed(() => {
24230
- return state.options.length > 0 ? locale.t("select.resultCount", {
24231
- num: numFormat(state.options.filter((e) => !e.isGroup).length)
24232
- }) : "";
24233
- });
24234
- __expose({
24235
- show,
24236
- hide: hide2,
24237
- clearSearchCache: () => {
24238
- if (props.enableSearchCache) {
24239
- state.searchCache.clear();
24240
- }
24241
- }
24242
- });
24243
- return (_ctx, _cache) => {
24244
- return openBlock(), createBlock(unref(_sfc_main$U), {
24245
- ref_key: "lewPopoverRef",
24246
- ref: lewPopoverRef,
24247
- "popover-body-class-name": "lew-select-popover-body",
24248
- class: "lew-select-view",
24249
- style: normalizeStyle({ width: _ctx.autoWidth ? "auto" : unref(any2px)(_ctx.width) }),
24250
- trigger: _ctx.trigger,
24251
- "trigger-width": unref(any2px)(unref(computedWidth)),
24252
- disabled: _ctx.disabled || _ctx.readonly || unref(state).initLoading,
24253
- placement: "bottom-start",
24254
- loading: unref(state).loading,
24255
- onShow: showHandle,
24256
- onHide: hideHandle
24257
- }, {
24258
- trigger: withCtx(() => [
24259
- createElementVNode("div", {
24260
- ref_key: "lewSelectRef",
24261
- ref: lewSelectRef,
24262
- class: normalizeClass(["lew-select", unref(getSelectClassName)]),
24263
- style: normalizeStyle({ width: unref(any2px)(unref(computedWidth)) })
24264
- }, [
24265
- unref(shouldShowLoading) ? (openBlock(), createElementBlock("div", _hoisted_1$n, [
24266
- createVNode(CommonIcon, {
24267
- size: unref(getIconSize),
24268
- loading: unref(state).initLoading,
24269
- type: "loading"
24270
- }, null, 8, ["size", "loading"])
24271
- ])) : (openBlock(), createBlock(CommonIcon, {
24272
- key: 1,
24273
- size: unref(getIconSize),
24274
- type: "chevron-down",
24275
- class: normalizeClass(["lew-icon-select", {
24276
- "lew-icon-select-hide": unref(shouldHideDropdownIcon)
24277
- }])
24278
- }, null, 8, ["size", "class"])),
24279
- createVNode(Transition, { name: "lew-form-icon-ani" }, {
24280
- default: withCtx(() => [
24281
- unref(shouldShowClearButton) ? (openBlock(), createBlock(CommonIcon, {
24282
- key: 0,
24283
- size: unref(getIconSize),
24284
- type: "close",
24285
- class: normalizeClass(["lew-form-icon-close", {
24286
- "lew-form-icon-close-focus": unref(state).visible
24287
- }]),
24288
- onClick: withModifiers(clearHandle, ["stop"])
24289
- }, null, 8, ["size", "class"])) : createCommentVNode("", true)
24290
- ]),
24291
- _: 1
24292
- }),
24293
- withDirectives(createElementVNode("input", {
24294
- ref_key: "inputRef",
24295
- ref: inputRef,
24296
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(state).keyword = $event),
24297
- title: unref(state).keyword,
24298
- class: "lew-value",
24299
- style: normalizeStyle(unref(getValueStyle)),
24300
- readonly: !_ctx.searchable,
24301
- placeholder: unref(inputPlaceholder),
24302
- onInput: _cache[1] || (_cache[1] = //@ts-ignore
24303
- (...args) => unref(searchDebounce) && unref(searchDebounce)(...args))
24304
- }, null, 44, _hoisted_2$g), [
24305
- [vModelText, unref(state).keyword]
24306
- ])
24307
- ], 6)
24308
- ]),
24309
- "popover-body": withCtx(() => [
24310
- createElementVNode("div", {
24311
- class: normalizeClass(["lew-select-body", unref(getBodyClassName)]),
24312
- style: normalizeStyle({ width: unref(any2px)(unref(getPopoverBodyWidth)) })
24313
- }, [
24314
- renderSlot(_ctx.$slots, "header", {}, void 0, true),
24315
- createElementVNode("div", _hoisted_3$c, [
24316
- unref(shouldShowEmptyState) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
24317
- _ctx.$slots.empty ? renderSlot(_ctx.$slots, "empty", { key: 0 }, void 0, true) : (openBlock(), createBlock(unref(LewFlex), {
24318
- key: 1,
24319
- direction: "y",
24320
- x: "center",
24321
- class: "lew-not-found"
24322
- }, {
24323
- default: withCtx(() => [
24324
- createVNode(unref(LewEmpty), {
24325
- title: unref(locale).t("select.noResult")
24326
- }, null, 8, ["title"])
24327
- ]),
24328
- _: 1
24329
- }))
24330
- ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
24331
- unref(shouldShowResultCount) ? (openBlock(), createElementBlock("div", _hoisted_4$7, toDisplayString$1(unref(getResultText)), 1)) : createCommentVNode("", true),
24332
- createVNode(unref(VirtList), {
24333
- ref_key: "virtListRef",
24334
- ref: virtListRef,
24335
- list: unref(state).options,
24336
- "min-size": _ctx.itemHeight,
24337
- buffer: 5,
24338
- "item-key": "value",
24339
- class: "lew-select-options-list lew-scrollbar",
24340
- style: normalizeStyle({
24341
- height: `${unref(getVirtualHeight)}px`,
24342
- paddingRight: unref(isShowScrollBar) ? "5px" : "0px"
24343
- })
24344
- }, {
24345
- default: withCtx(({ itemData: templateProps }) => [
24346
- createElementVNode("div", {
24347
- style: normalizeStyle({ height: `${_ctx.itemHeight}px` }),
24348
- onClick: ($event) => selectHandle(templateProps)
24349
- }, [
24350
- _ctx.$slots.item ? renderSlot(_ctx.$slots, "item", {
24351
- key: 0,
24352
- props: {
24353
- ...templateProps,
24354
- checked: unref(getChecked)(templateProps.value)
24355
- }
24356
- }, void 0, true) : (openBlock(), createElementBlock("div", {
24357
- key: 1,
24358
- class: normalizeClass(["lew-select-item", getSelectItemClassName(templateProps)])
24359
- }, [
24360
- createVNode(unref(LewTextTrim), {
24361
- text: unref(getOptionText)(templateProps),
24362
- delay: [500, 0],
24363
- class: "lew-select-label"
24364
- }, null, 8, ["text"]),
24365
- unref(getChecked)(templateProps.value) && _ctx.showCheckIcon ? (openBlock(), createBlock(CommonIcon, {
24366
- key: 0,
24367
- class: "lew-icon-check",
24368
- size: 16,
24369
- "stroke-width": 3,
24370
- type: "check"
24371
- })) : createCommentVNode("", true)
24372
- ], 2))
24373
- ], 12, _hoisted_5$5)
24374
- ]),
24375
- _: 3
24376
- }, 8, ["list", "min-size", "style"])
24377
- ], 64))
24378
- ]),
24379
- renderSlot(_ctx.$slots, "footer", {}, void 0, true)
24380
- ], 6)
24381
- ]),
24382
- _: 3
24383
- }, 8, ["style", "trigger", "trigger-width", "disabled", "loading"]);
24384
- };
24385
- }
24386
- });
24387
- const LewSelect = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__scopeId", "data-v-cd2e8d44"]]);
24388
- const selectMultipleEmits = {
24389
- change: (value) => value,
24390
- select: (item) => item,
24391
- delete: (item, value) => {
24392
- return { item, value };
24393
- },
24394
- clear: () => true,
24395
- blur: () => true
24396
- };
24397
- const selectMultipleModel = {
24398
- modelValue: {
24399
- type: Array,
24400
- default: () => []
24401
- }
24402
- };
24403
- const selectMultipleProps = {
24404
- options: {
24405
- type: Array,
24406
- typePopKeys: ["LewSelectMultipleOption"],
24407
- validator: validators.array({
24408
- componentName: "LewSelectMultiple",
24409
- propName: "options"
24410
- })
24411
- },
24412
- trigger: {
24413
- type: String,
24414
- default: "click",
24415
- typeValues: validTriggerList,
24416
- validator: validators.enum({
24417
- componentName: "LewSelectMultiple",
24418
- propName: "trigger",
24419
- values: validTriggerList
24420
- })
24421
- },
24422
- width: {
24423
- type: String,
24424
- default: "100%",
24425
- validator: validators.widthHeight({
24426
- componentName: "LewSelectMultiple",
24427
- propName: "width"
24428
- })
24429
- },
24430
- valueLayout: {
24431
- type: String,
24432
- default: "text",
24433
- typeValues: validSelectMultipleValueLayout,
24434
- validator: validators.enum({
24435
- componentName: "LewSelectMultiple",
24436
- propName: "valueLayout",
24437
- values: validSelectMultipleValueLayout
24438
- })
24439
- },
24440
- valueTextSplit: {
24441
- type: String,
24442
- default: ",",
24443
- validator: validators.string({
24444
- componentName: "LewSelectMultiple",
24445
- propName: "valueTextSplit"
24446
- })
24447
- },
24448
- placeholder: {
24449
- type: String,
24450
- defaultLocale: true,
24451
- validator: validators.string({
24452
- componentName: "LewSelectMultiple",
24453
- propName: "placeholder"
24454
- })
24455
- },
24456
- size: {
24457
- type: String,
24458
- default: "medium",
24459
- typeValues: validSizeList,
24460
- validator: validators.enum({
24461
- componentName: "LewSelectMultiple",
24462
- propName: "size",
24463
- values: validSizeList
24464
- })
24465
- },
24466
- itemHeight: {
24467
- type: Number,
24468
- default: 38,
24469
- validator: validators.number({
24470
- componentName: "LewSelectMultiple",
24471
- propName: "itemHeight"
24472
- })
24473
- },
24474
- searchable: {
24475
- type: Boolean,
24476
- default: false,
24477
- validator: validators.boolean({
24478
- componentName: "LewSelectMultiple",
24479
- propName: "searchable"
24480
- })
24481
- },
24482
- searchPlaceholder: {
24483
- type: String,
24484
- default: "",
24485
- validator: validators.string({
24486
- componentName: "LewSelectMultiple",
24487
- propName: "searchPlaceholder"
24488
- })
24489
- },
24490
- searchMethod: {
24491
- type: Function,
24492
- default: void 0,
24493
- validator: validators.function({
24494
- componentName: "LewSelectMultiple",
24495
- propName: "searchMethod"
24496
- })
24497
- },
24498
- initMethod: {
24499
- type: Function,
24500
- default: void 0,
24501
- validator: validators.function({
24502
- componentName: "LewSelectMultiple",
24503
- propName: "initMethod"
24504
- })
24505
- },
24506
- initMethodId: {
24507
- type: String,
24508
- validator: validators.string({
24509
- componentName: "LewSelectMultiple",
24510
- propName: "initMethodId"
24511
- })
24512
- },
24513
- searchMethodId: {
24514
- type: String,
24515
- hidden: true,
24516
- validator: validators.string({
24517
- componentName: "LewSelectMultiple",
24518
- propName: "searchMethodId"
24519
- })
24520
- },
24521
- searchDelay: {
24522
- type: Number,
24523
- default: 250,
24524
- validator: validators.number({
24525
- componentName: "LewSelectMultiple",
24526
- propName: "searchDelay"
24527
- })
24528
- },
24529
- clearable: {
24530
- type: Boolean,
24531
- default: false,
24532
- validator: validators.boolean({
24533
- componentName: "LewSelectMultiple",
24534
- propName: "clearable"
24535
- })
24536
- },
24537
- enableSearchCache: {
24538
- type: Boolean,
24539
- default: false,
24540
- validator: validators.boolean({
24541
- componentName: "LewSelectMultiple",
24542
- propName: "enableSearchCache"
24543
- })
24544
- },
24545
- readonly: {
24546
- type: Boolean,
24547
- default: false,
24548
- validator: validators.boolean({
24549
- componentName: "LewSelectMultiple",
24550
- propName: "readonly"
24551
- })
24552
- },
24553
- disabled: {
24554
- type: Boolean,
24555
- default: false,
24556
- validator: validators.boolean({
24557
- componentName: "LewSelectMultiple",
24558
- propName: "disabled"
24559
- })
24560
- },
24561
- showCheckIcon: {
24562
- type: Boolean,
24563
- default: true,
24564
- validator: validators.boolean({
24565
- componentName: "LewSelectMultiple",
24566
- propName: "showCheckIcon"
24567
- })
24568
- },
24569
- defaultValue: {
24570
- type: Array,
24571
- default: () => [],
24572
- validator: validators.array({
24573
- componentName: "LewSelectMultiple",
24574
- propName: "defaultValue"
24575
- })
24576
- }
24577
- };
24578
- const _hoisted_1$m = {
24579
- key: 0,
24580
- class: "lew-icon-loading-box"
24581
- };
24582
- const _hoisted_2$f = {
24583
- key: 1,
24584
- class: "lew-search-input"
24585
- };
24586
- const _hoisted_3$b = ["placeholder"];
24587
- const _hoisted_4$6 = { class: "lew-select-options-box" };
24588
- const _hoisted_5$4 = ["onClick"];
24589
- const _sfc_main$u = /* @__PURE__ */ defineComponent({
24590
- __name: "LewSelectMultiple",
24591
- props: /* @__PURE__ */ mergeModels(selectMultipleProps, {
24592
- "modelValue": {},
24593
- "modelModifiers": {}
24594
- }),
24595
- emits: /* @__PURE__ */ mergeModels(selectMultipleEmits, ["update:modelValue"]),
24596
- setup(__props, { expose: __expose, emit: __emit }) {
24597
- const props = __props;
24598
- const emit = __emit;
24599
- const modelValue = useModel(__props, "modelValue");
24600
- const slots = useSlots();
24601
- const lewSelectRef = ref();
24602
- const lewPopoverRef = ref();
24603
- const lewPopoverValueRef = ref();
24604
- const searchInputRef = ref();
24605
- const virtListRef = ref();
24606
- const state = reactive({
24607
- selectWidth: 0,
24608
- popoverWidth: 0,
24609
- visible: false,
24610
- loading: false,
24611
- initLoading: true,
24612
- sourceOptions: props.options || [],
24613
- options: flattenSelectOptions(props.options || []),
24614
- keyword: "",
24615
- searchCache: /* @__PURE__ */ new Map()
24616
- });
24617
- const formMethods = inject("formMethods", {});
24618
- const _searchMethod = computed(() => {
24619
- if (isFunction$1(props.searchMethod)) {
24620
- return props.searchMethod;
24621
- } else if (props.searchMethodId) {
24622
- return formMethods[props.searchMethodId];
24623
- } else {
24624
- return filterSelectOptionsByKeyword;
24625
- }
24626
- });
24627
- const _initMethod = computed(() => {
24628
- if (isFunction$1(props.initMethod)) {
24629
- return props.initMethod;
24630
- } else if (props.initMethodId) {
24631
- return formMethods[props.initMethodId];
24632
- }
24633
- return false;
24634
- });
24635
- function updateWidths() {
24636
- if (lewSelectRef.value) {
24637
- state.selectWidth = lewSelectRef.value.clientWidth;
24638
- state.popoverWidth = state.selectWidth - 12;
24639
- }
24640
- }
24641
- let resizeObserver = null;
24642
- function show() {
24643
- lewPopoverRef.value && lewPopoverRef.value.show();
24644
- }
24645
- function hide2() {
24646
- lewPopoverRef.value && lewPopoverRef.value.hide();
24647
- }
24648
- const searchDebounce = /* @__PURE__ */ useDebounceFn(async (e) => {
24649
- search(e);
24650
- }, props.searchDelay);
24651
- async function search(e) {
24652
- state.loading = true;
24653
- const keyword = e?.target.value;
24654
- if (props.searchable) {
24655
- let result = [];
24656
- if (props.enableSearchCache && state.searchCache.has(keyword)) {
24657
- result = state.searchCache.get(keyword);
24658
- } else {
24659
- const optionsToSearch = flattenSelectOptions(state.sourceOptions);
24660
- if (!keyword && optionsToSearch.length > 0) {
24661
- result = optionsToSearch;
24662
- } else {
24663
- result = await _searchMethod.value({
24664
- options: optionsToSearch,
24665
- keyword
24666
- });
24667
- }
24668
- if (props.enableSearchCache) {
24669
- state.searchCache.set(keyword, result);
24670
- }
24671
- }
24672
- state.options = result;
24673
- }
24674
- state.loading = false;
24675
- }
24676
- function clearHandle() {
24677
- modelValue.value = [];
24678
- emit("clear");
24679
- setTimeout(() => {
24680
- lewPopoverRef.value && lewPopoverRef.value.refresh();
24681
- }, 100);
24682
- emit("change", modelValue.value);
24683
- state.visible = false;
24684
- emit("blur");
24685
- }
24686
- function deleteTag({ value }) {
24687
- const valueIndex = modelValue.value.findIndex((_value) => value === _value);
24688
- if (valueIndex > -1) {
24689
- const item = modelValue.value[valueIndex];
24690
- modelValue.value.splice(valueIndex, 1);
24691
- emit("delete", cloneDeep(modelValue.value), item);
24692
- if (modelValue.value.length === 0) {
24693
- lewPopoverValueRef.value && lewPopoverValueRef.value.hide();
24694
- }
24751
+ if (props.multiple) {
24752
+ selectValue.value = [];
24753
+ emit("clear");
24754
+ emit("change", selectValue.value);
24695
24755
  setTimeout(() => {
24696
24756
  lewPopoverRef.value && lewPopoverRef.value.refresh();
24697
24757
  }, 100);
24698
- emit("change", modelValue.value);
24758
+ } else {
24759
+ selectValue.value = void 0;
24760
+ state.keywordBackup = void 0;
24761
+ emit("clear");
24762
+ emit("change", void 0);
24699
24763
  }
24700
24764
  }
24701
24765
  function selectHandle(item) {
24702
24766
  if (item.disabled || item.isGroup) {
24703
24767
  return;
24704
24768
  }
24705
- const _value = modelValue.value || [];
24706
- const index2 = _value.findIndex((e) => e === item.value);
24707
- if (index2 >= 0) {
24708
- _value.splice(index2, 1);
24769
+ if (props.multiple) {
24770
+ const currentValues = selectValue.value || [];
24771
+ const index2 = currentValues.findIndex((v) => v === item.value);
24772
+ if (index2 >= 0) {
24773
+ currentValues.splice(index2, 1);
24774
+ } else {
24775
+ currentValues.push(item.value);
24776
+ }
24777
+ selectValue.value = [...currentValues];
24778
+ emit("change", selectValue.value);
24779
+ updateWidths();
24780
+ setTimeout(() => {
24781
+ lewPopoverRef.value && lewPopoverRef.value.refresh();
24782
+ }, 100);
24709
24783
  } else {
24710
- _value.push(item.value);
24784
+ state.hideBySelect = true;
24785
+ state.keyword = item.label;
24786
+ selectValue.value = item.value;
24787
+ emit("change", item.value);
24788
+ setTimeout(() => {
24789
+ hide2();
24790
+ }, 100);
24711
24791
  }
24712
- modelValue.value = _value;
24713
- emit("select", _value);
24714
- setTimeout(() => {
24715
- lewPopoverRef.value && lewPopoverRef.value.refresh();
24716
- }, 100);
24717
- emit("change", modelValue.value);
24718
- updateWidths();
24719
24792
  }
24720
24793
  const getChecked = computed(() => (value) => {
24721
- if (modelValue.value) {
24722
- return JSON.parse(JSON.stringify(modelValue.value.includes(value)));
24794
+ if (props.multiple) {
24795
+ const currentValues = selectValue.value || [];
24796
+ return currentValues.includes(value);
24723
24797
  }
24724
- return false;
24798
+ return selectValue.value === value;
24725
24799
  });
24726
- const getSelectedRows = computed(() => {
24727
- const _defaultValue = (props.defaultValue || []).map((e) => {
24728
- return {
24729
- label: e,
24730
- value: e
24731
- };
24800
+ function deleteTag(value) {
24801
+ if (!props.multiple)
24802
+ return;
24803
+ const currentValues = selectValue.value || [];
24804
+ const valueIndex = currentValues.findIndex((v) => v === value);
24805
+ if (valueIndex > -1) {
24806
+ const item = currentValues[valueIndex];
24807
+ currentValues.splice(valueIndex, 1);
24808
+ selectValue.value = [...currentValues];
24809
+ emit("delete", selectValue.value, item);
24810
+ emit("change", selectValue.value);
24811
+ setTimeout(() => {
24812
+ lewPopoverRef.value && lewPopoverRef.value.refresh();
24813
+ }, 100);
24814
+ updateWidths();
24815
+ }
24816
+ }
24817
+ const formatItems = computed(() => {
24818
+ if (!props.multiple)
24819
+ return [];
24820
+ const currentValues = selectValue.value || [];
24821
+ return (state.sourceFlattenOptions || []).filter((e) => {
24822
+ return currentValues.includes(e.value);
24732
24823
  });
24733
- if (state.options.length > 0) {
24734
- const selectedRows = modelValue.value && modelValue.value.map((v) => {
24735
- return state.options.find((e) => v === e.value);
24824
+ });
24825
+ function findKeyword() {
24826
+ if (props.multiple) {
24827
+ return;
24828
+ }
24829
+ if (state.options) {
24830
+ const option = state.options.find((e) => {
24831
+ if (e) {
24832
+ return e.value === selectValue.value;
24833
+ }
24834
+ return false;
24736
24835
  });
24737
- if (!selectedRows || selectedRows.length === 0) {
24738
- return _defaultValue;
24836
+ if (option && JSON.stringify(option) !== "{}") {
24837
+ return state.keyword = option.label;
24739
24838
  }
24740
- return selectedRows;
24741
24839
  }
24742
- return _defaultValue;
24743
- });
24840
+ return state.keyword = props.defaultValue;
24841
+ }
24842
+ findKeyword();
24744
24843
  const getBodyClassName = computed(() => {
24745
24844
  const { size, disabled } = props;
24746
24845
  return object2class("lew-select-body", { size, disabled });
24747
24846
  });
24748
- const getSelectClassName = computed(() => {
24749
- let { clearable, size, disabled, readonly: readonly2 } = props;
24750
- clearable = clearable ? !!modelValue.value : false;
24751
- const focus = state.visible;
24752
- return object2class("lew-select", {
24753
- clearable,
24754
- size,
24755
- disabled,
24756
- readonly: readonly2,
24757
- focus,
24758
- "init-loading": state.initLoading
24759
- });
24760
- });
24761
- function getSelectItemClassName(e) {
24762
- const { disabled, isGroup } = e;
24763
- const active = getChecked.value(e.value);
24764
- return object2class("lew-select-item", {
24765
- disabled,
24766
- active,
24767
- "is-group": isGroup
24768
- });
24769
- }
24770
- const getIconSize = computed(() => {
24771
- const size = {
24772
- small: 14,
24773
- medium: 15,
24774
- large: 16
24775
- };
24776
- return size[props.size];
24847
+ const getVirtualHeight = computed(() => {
24848
+ let height = state.options.length * props.itemHeight;
24849
+ height = height >= 280 ? 280 : height;
24850
+ return height;
24777
24851
  });
24778
- const focusSearchInput = /* @__PURE__ */ useDebounceFn(() => {
24852
+ async function showHandle() {
24853
+ state.visible = true;
24854
+ if (props.multiple) {
24855
+ updateWidths();
24856
+ } else {
24857
+ state.keywordBackup = cloneDeep(state.keyword);
24858
+ state.hideBySelect = false;
24859
+ }
24779
24860
  if (props.searchable) {
24780
- searchInputRef.value && searchInputRef.value.focus();
24861
+ if (props.multiple) {
24862
+ state.keyword = "";
24863
+ } else {
24864
+ state.keyword = "";
24865
+ }
24866
+ await search({ target: { value: "" } });
24781
24867
  }
24782
- }, 100);
24783
- function showHandle() {
24784
- state.visible = true;
24785
- updateWidths();
24786
- focusSearchInput();
24787
- if (state.options && state.options.length === 0 && props.searchable) {
24788
- search({ target: { value: "" } });
24868
+ let targetIndex = -1;
24869
+ if (props.multiple) {
24870
+ const currentValues = selectValue.value || [];
24871
+ const indexes = currentValues.map((value) => state.options.findIndex((e) => e.value === value)).filter((index2) => index2 > -1);
24872
+ targetIndex = indexes.length > 0 ? Math.min(...indexes) : -1;
24873
+ } else {
24874
+ targetIndex = state.options.findIndex((e) => e.value === selectValue.value);
24789
24875
  }
24790
- const indexes = (modelValue.value || []).map((value) => state.options.findIndex((e) => e.value === value)).filter((index2) => index2 > -1);
24791
- const minIndex = Math.min(...indexes);
24792
24876
  poll({
24793
24877
  callback: () => {
24794
- if (minIndex > 0 && minIndex !== Infinity) {
24795
- virtListRef.value.scrollToIndex(minIndex);
24878
+ if (targetIndex > 0 && targetIndex !== Infinity) {
24879
+ virtListRef.value.scrollToIndex(targetIndex);
24796
24880
  } else {
24797
24881
  virtListRef.value.reset();
24798
24882
  }
@@ -24801,334 +24885,119 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
24801
24885
  return !!virtListRef.value;
24802
24886
  }
24803
24887
  });
24888
+ emit("focus");
24804
24889
  }
24805
- const getVirtualHeight = computed(() => {
24806
- let height = state.options.length * props.itemHeight;
24807
- height = height >= 280 ? 280 : height;
24808
- return height;
24809
- });
24810
- const isShowScrollBar = computed(() => {
24811
- return getVirtualHeight.value >= 280;
24812
- });
24813
24890
  function hideHandle() {
24814
24891
  state.visible = false;
24815
- emit("blur");
24816
- }
24817
- async function init() {
24818
- if (_initMethod.value) {
24819
- const newOptions = await _initMethod.value();
24820
- state.sourceOptions = newOptions;
24821
- state.options = flattenSelectOptions(newOptions);
24822
- }
24823
- if (props.enableSearchCache) {
24824
- state.searchCache.set("", state.options);
24892
+ if (!state.hideBySelect) {
24893
+ findKeyword();
24825
24894
  }
24826
- state.initLoading = false;
24895
+ emit("blur");
24827
24896
  }
24828
- onMounted(() => {
24829
- updateWidths();
24830
- focusSearchInput();
24831
- init();
24832
- if (lewSelectRef.value) {
24833
- resizeObserver = new ResizeObserver(() => {
24834
- updateWidths();
24835
- });
24836
- resizeObserver.observe(lewSelectRef.value);
24837
- }
24838
- });
24839
- onUnmounted(() => {
24840
- if (resizeObserver) {
24841
- resizeObserver.disconnect();
24842
- resizeObserver = null;
24843
- }
24897
+ const isShowScrollBar = computed(() => {
24898
+ return getVirtualHeight.value >= 280;
24844
24899
  });
24845
- __expose({
24846
- show,
24847
- hide: hide2,
24848
- clearSearchCache: () => {
24849
- if (props.enableSearchCache) {
24850
- state.searchCache.clear();
24851
- }
24852
- }
24900
+ const getPopoverBodyWidth = computed(() => {
24901
+ const { popoverWidth } = props;
24902
+ if (!lewSelectInputRef.value)
24903
+ return popoverWidth;
24904
+ return popoverWidth && popoverWidth !== "100%" ? parseDimension(popoverWidth) - 14 : lewSelectInputRef.value.$el.offsetWidth - 14;
24853
24905
  });
24854
24906
  watch(
24855
- () => props.options,
24856
- (newOptions) => {
24857
- if (!_initMethod.value) {
24858
- state.sourceOptions = newOptions || [];
24859
- state.options = flattenSelectOptions(newOptions || []);
24860
- if (props.enableSearchCache) {
24861
- state.searchCache.clear();
24862
- }
24863
- }
24864
- },
24865
- {
24866
- deep: true
24867
- }
24868
- );
24869
- watch(
24870
- () => modelValue.value,
24907
+ () => selectValue.value,
24871
24908
  () => {
24872
- updateWidths();
24909
+ findKeyword();
24910
+ if (props.autoWidth) {
24911
+ calculateAutoWidth();
24912
+ }
24913
+ if (props.multiple) {
24914
+ updateWidths();
24915
+ }
24873
24916
  },
24874
24917
  {
24875
24918
  deep: true
24876
24919
  }
24877
24920
  );
24878
24921
  const getResultText = computed(() => {
24879
- return state.options.length > 0 ? locale.t("selectMultiple.resultCount", {
24922
+ const localeKey = props.multiple ? "selectMultiple.resultCount" : "select.resultCount";
24923
+ return state.options.length > 0 ? locale.t(localeKey, {
24880
24924
  num: numFormat(state.options.filter((e) => !e.isGroup).length)
24881
24925
  }) : "";
24882
24926
  });
24883
- const showClearButton = computed(() => {
24884
- return props.clearable && getSelectedRows.value && getSelectedRows.value.length > 0 && !props.readonly;
24885
- });
24886
- const hasSelectedItems = computed(() => {
24887
- return getSelectedRows.value && getSelectedRows.value.length > 0;
24888
- });
24889
- const showPlaceholder = computed(() => {
24890
- return getSelectedRows.value && getSelectedRows.value.length === 0;
24891
- });
24892
- const selectedItemsText = computed(() => {
24893
- if (!hasSelectedItems.value)
24894
- return "";
24895
- return getSelectedRows.value.map((item) => item.label).join(props.valueTextSplit);
24896
- });
24897
- const showResultCount = computed(() => {
24898
- return props.searchable && state.options && state.options.length > 0;
24899
- });
24900
- const showEmptyState = computed(() => {
24901
- return state.options && state.options.length === 0;
24902
- });
24903
- const clearButtonIconClass = computed(() => {
24904
- return {
24905
- "lew-form-icon-close-focus": state.visible
24906
- };
24907
- });
24908
- const selectIconClass = computed(() => {
24909
- return {
24910
- "lew-icon-select-hide": showClearButton.value
24911
- };
24912
- });
24913
- const placeholderText = computed(() => {
24914
- return props.placeholder || locale.t("selectMultiple.placeholder");
24915
- });
24916
- const textValueStyle = computed(() => {
24917
- return {
24918
- opacity: state.visible ? 0.6 : 1,
24919
- width: `calc(${state.selectWidth - 24}px)`
24920
- };
24921
- });
24922
- const placeholderStyle = computed(() => {
24923
- return {
24924
- opacity: state.visible ? 0.6 : 1
24925
- };
24926
- });
24927
- const virtualListStyle = computed(() => {
24928
- return {
24929
- height: `${getVirtualHeight.value}px`,
24930
- paddingRight: isShowScrollBar.value ? "5px" : "0px"
24931
- };
24932
- });
24933
- const optionItemStyle = computed(() => {
24934
- return (itemHeight) => ({
24935
- height: `${itemHeight}px`
24936
- });
24937
- });
24938
- const groupLabelText = computed(() => {
24939
- return (templateProps) => {
24940
- return templateProps.isGroup ? `${templateProps.label} (${templateProps.total})` : templateProps.label;
24941
- };
24942
- });
24943
- const groupLabelClass = computed(() => {
24944
- return (templateProps) => {
24945
- return {
24946
- "is-group": templateProps.isGroup
24947
- };
24948
- };
24949
- });
24950
- const showSearchInput = computed(() => {
24951
- return props.searchable;
24952
- });
24953
- const showTagLayout = computed(() => {
24954
- return props.valueLayout === "tag";
24955
- });
24956
- const showCustomEmptySlot = computed(() => {
24957
- return !!slots.empty;
24958
- });
24959
- const showCustomItemSlot = computed(() => {
24960
- return !!slots.item;
24961
- });
24962
- const itemSlotProps = computed(() => {
24963
- return (templateProps) => ({
24964
- ...templateProps,
24965
- checked: getChecked.value(templateProps.value)
24927
+ const getSelectItemClassName = computed(() => (e) => {
24928
+ const { disabled, isGroup } = e;
24929
+ const active = getChecked.value(e.value);
24930
+ return object2class("lew-select-item", {
24931
+ disabled,
24932
+ active,
24933
+ "is-group": isGroup,
24934
+ "mul": props.multiple
24966
24935
  });
24967
24936
  });
24968
- const showHeaderSlot = computed(() => {
24969
- return !!slots.header;
24937
+ const shouldShowCheckIcon = computed(() => (value) => {
24938
+ return !props.multiple && getChecked.value(value) && props.showCheckIcon;
24970
24939
  });
24971
- const showFooterSlot = computed(() => {
24972
- return !!slots.footer;
24940
+ __expose({
24941
+ show,
24942
+ hide: hide2,
24943
+ clearSearchCache: () => {
24944
+ if (props.enableSearchCache) {
24945
+ state.searchCache.clear();
24946
+ }
24947
+ }
24973
24948
  });
24974
24949
  return (_ctx, _cache) => {
24975
24950
  return openBlock(), createBlock(unref(_sfc_main$U), {
24976
24951
  ref_key: "lewPopoverRef",
24977
24952
  ref: lewPopoverRef,
24978
- "popover-body-class-name": "lew-select-multiple-popover-body",
24953
+ "popover-body-class-name": "lew-select-popover-body",
24979
24954
  class: "lew-select-view",
24955
+ style: normalizeStyle({ width: _ctx.autoWidth ? "auto" : unref(any2px)(_ctx.width) }),
24980
24956
  trigger: _ctx.trigger,
24981
- "trigger-width": _ctx.width,
24957
+ "trigger-width": unref(any2px)(unref(computedWidth)),
24958
+ "hide-on-click": _ctx.searchable ? false : true,
24982
24959
  disabled: _ctx.disabled || _ctx.readonly || unref(state).initLoading,
24983
24960
  placement: "bottom-start",
24984
- style: normalizeStyle({ width: unref(any2px)(_ctx.width) }),
24985
24961
  loading: unref(state).loading,
24986
24962
  onShow: showHandle,
24987
24963
  onHide: hideHandle
24988
24964
  }, {
24989
24965
  trigger: withCtx(() => [
24990
- createElementVNode("div", {
24991
- ref_key: "lewSelectRef",
24992
- ref: lewSelectRef,
24993
- class: normalizeClass(["lew-select", unref(getSelectClassName)])
24994
- }, [
24995
- unref(state).initLoading ? (openBlock(), createElementBlock("div", _hoisted_1$m, [
24996
- createVNode(CommonIcon, {
24997
- size: unref(getIconSize),
24998
- loading: unref(state).initLoading,
24999
- type: "loading"
25000
- }, null, 8, ["size", "loading"])
25001
- ])) : (openBlock(), createBlock(CommonIcon, {
25002
- key: 1,
25003
- size: unref(getIconSize),
25004
- type: "chevron-down",
25005
- class: normalizeClass(["lew-icon-select", unref(selectIconClass)])
25006
- }, null, 8, ["size", "class"])),
25007
- createVNode(Transition, { name: "lew-form-icon-ani" }, {
25008
- default: withCtx(() => [
25009
- unref(showClearButton) ? (openBlock(), createBlock(CommonIcon, {
25010
- key: 0,
25011
- size: unref(getIconSize),
25012
- type: "close",
25013
- class: normalizeClass(["lew-form-icon-close", unref(clearButtonIconClass)]),
25014
- onClick: withModifiers(clearHandle, ["stop"])
25015
- }, null, 8, ["size", "class"])) : createCommentVNode("", true)
25016
- ]),
25017
- _: 1
25018
- }),
25019
- unref(hasSelectedItems) ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
25020
- unref(showTagLayout) ? (openBlock(), createBlock(unref(LewFlex), {
25021
- key: 0,
25022
- x: "start",
25023
- y: "center",
25024
- style: { "padding": "4.5px" },
25025
- gap: "4px",
25026
- wrap: "",
25027
- class: "lew-value"
25028
- }, {
25029
- default: withCtx(() => [
25030
- createVNode(TransitionGroup, { name: "list" }, {
25031
- default: withCtx(() => [
25032
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(getSelectedRows), (item) => {
25033
- return openBlock(), createBlock(unref(_sfc_main$e), {
25034
- key: item.value,
25035
- type: "light",
25036
- size: _ctx.size,
25037
- closeable: !_ctx.disabled && !_ctx.readonly,
25038
- onClose: ($event) => deleteTag(item)
25039
- }, {
25040
- default: withCtx(() => [
25041
- createTextVNode(toDisplayString$1(item.label), 1)
25042
- ]),
25043
- _: 2
25044
- }, 1032, ["size", "closeable", "onClose"]);
25045
- }), 128))
25046
- ]),
25047
- _: 1
25048
- })
25049
- ]),
25050
- _: 1
25051
- })) : (openBlock(), createBlock(unref(_sfc_main$U), {
25052
- key: 1,
25053
- ref_key: "lewPopoverValueRef",
25054
- ref: lewPopoverValueRef,
25055
- trigger: "hover",
25056
- "popover-body-class-name": "lew-select-multiple-popover-tag",
25057
- placement: "top-start",
25058
- delay: [250, 250],
25059
- style: { "width": "100%" },
25060
- "trigger-width": _ctx.width
25061
- }, {
25062
- trigger: withCtx(() => [
25063
- createElementVNode("div", {
25064
- style: normalizeStyle(unref(textValueStyle)),
25065
- class: "lew-select-multiple-text-value"
25066
- }, toDisplayString$1(unref(selectedItemsText)), 5)
25067
- ]),
25068
- "popover-body": withCtx(() => [
25069
- createVNode(unref(LewFlex), {
25070
- x: "start",
25071
- y: "center",
25072
- gap: "5px",
25073
- wrap: "",
25074
- style: normalizeStyle({
25075
- maxWidth: unref(any2px)(unref(state).selectWidth)
25076
- }),
25077
- class: "lew-select-multiple-tag-value"
25078
- }, {
25079
- default: withCtx(() => [
25080
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(getSelectedRows), (item) => {
25081
- return openBlock(), createBlock(unref(_sfc_main$e), {
25082
- key: item.value,
25083
- type: "light",
25084
- size: _ctx.size,
25085
- closeable: !_ctx.disabled && !_ctx.readonly,
25086
- onClose: ($event) => deleteTag(item)
25087
- }, {
25088
- default: withCtx(() => [
25089
- createTextVNode(toDisplayString$1(item.label), 1)
25090
- ]),
25091
- _: 2
25092
- }, 1032, ["size", "closeable", "onClose"]);
25093
- }), 128))
25094
- ]),
25095
- _: 1
25096
- }, 8, ["style"])
25097
- ]),
25098
- _: 1
25099
- }, 8, ["trigger-width"]))
25100
- ], 64)) : createCommentVNode("", true),
25101
- withDirectives(createElementVNode("div", {
25102
- style: normalizeStyle(unref(placeholderStyle)),
25103
- class: "lew-placeholder"
25104
- }, toDisplayString$1(unref(placeholderText)), 5), [
25105
- [vShow, unref(showPlaceholder)]
25106
- ])
25107
- ], 2)
24966
+ createVNode(CommonInput, {
24967
+ ref_key: "lewSelectInputRef",
24968
+ ref: lewSelectInputRef,
24969
+ modelValue: selectValue.value,
24970
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => selectValue.value = $event),
24971
+ keyword: unref(state).keyword,
24972
+ "onUpdate:keyword": _cache[1] || (_cache[1] = ($event) => unref(state).keyword = $event),
24973
+ loading: unref(state).initLoading,
24974
+ clearable: _ctx.clearable,
24975
+ readonly: _ctx.readonly,
24976
+ disabled: _ctx.disabled || unref(state).initLoading,
24977
+ size: _ctx.size,
24978
+ placeholder: unref(inputPlaceholder),
24979
+ width: unref(any2px)(unref(computedWidth)),
24980
+ focus: unref(state).visible,
24981
+ "format-items": unref(formatItems),
24982
+ multiple: _ctx.multiple,
24983
+ searchable: _ctx.searchable,
24984
+ "selected-label": unref(state).keyword,
24985
+ onClear: clearHandle,
24986
+ onDelete: deleteTag,
24987
+ onInput: unref(searchDebounce)
24988
+ }, null, 8, ["modelValue", "keyword", "loading", "clearable", "readonly", "disabled", "size", "placeholder", "width", "focus", "format-items", "multiple", "searchable", "selected-label", "onInput"])
25108
24989
  ]),
25109
24990
  "popover-body": withCtx(() => [
25110
24991
  createElementVNode("div", {
25111
24992
  class: normalizeClass(["lew-select-body", unref(getBodyClassName)]),
25112
24993
  style: normalizeStyle({
25113
- width: unref(any2px)(unref(state).popoverWidth)
24994
+ width: _ctx.multiple ? unref(any2px)(unref(state).popoverWidth) : unref(any2px)(unref(getPopoverBodyWidth))
25114
24995
  })
25115
24996
  }, [
25116
- unref(showHeaderSlot) ? renderSlot(_ctx.$slots, "header", { key: 0 }, void 0, true) : createCommentVNode("", true),
25117
- unref(showSearchInput) ? (openBlock(), createElementBlock("div", _hoisted_2$f, [
25118
- withDirectives(createElementVNode("input", {
25119
- ref_key: "searchInputRef",
25120
- ref: searchInputRef,
25121
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(state).keyword = $event),
25122
- placeholder: unref(locale).t("selectMultiple.searchPlaceholder"),
25123
- onInput: _cache[1] || (_cache[1] = //@ts-ignore
25124
- (...args) => unref(searchDebounce) && unref(searchDebounce)(...args))
25125
- }, null, 40, _hoisted_3$b), [
25126
- [vModelText, unref(state).keyword]
25127
- ])
25128
- ])) : createCommentVNode("", true),
25129
- createElementVNode("div", _hoisted_4$6, [
25130
- unref(showEmptyState) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
25131
- unref(showCustomEmptySlot) ? renderSlot(_ctx.$slots, "empty", { key: 0 }, void 0, true) : (openBlock(), createBlock(unref(LewFlex), {
24997
+ renderSlot(_ctx.$slots, "header", {}, void 0, true),
24998
+ createElementVNode("div", _hoisted_1$m, [
24999
+ unref(shouldShowEmptyState) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
25000
+ _ctx.$slots.empty ? renderSlot(_ctx.$slots, "empty", { key: 0 }, void 0, true) : (openBlock(), createBlock(unref(LewFlex), {
25132
25001
  key: 1,
25133
25002
  direction: "y",
25134
25003
  x: "center",
@@ -25136,15 +25005,13 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
25136
25005
  }, {
25137
25006
  default: withCtx(() => [
25138
25007
  createVNode(unref(LewEmpty), {
25139
- title: unref(locale).t("selectMultiple.noResult")
25008
+ title: unref(locale).t("select.noResult")
25140
25009
  }, null, 8, ["title"])
25141
25010
  ]),
25142
25011
  _: 1
25143
25012
  }))
25144
25013
  ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
25145
- withDirectives(createElementVNode("div", { class: "lew-result-count" }, toDisplayString$1(unref(getResultText)), 513), [
25146
- [vShow, unref(showResultCount)]
25147
- ]),
25014
+ unref(shouldShowResultCount) ? (openBlock(), createElementBlock("div", _hoisted_2$f, toDisplayString$1(unref(getResultText)), 1)) : createCommentVNode("", true),
25148
25015
  createVNode(unref(VirtList), {
25149
25016
  ref_key: "virtListRef",
25150
25017
  ref: virtListRef,
@@ -25152,47 +25019,60 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
25152
25019
  "min-size": _ctx.itemHeight,
25153
25020
  buffer: 5,
25154
25021
  "item-key": "value",
25155
- style: normalizeStyle(unref(virtualListStyle)),
25156
- class: "lew-select-options-list lew-scrollbar"
25022
+ class: "lew-select-options-list lew-scrollbar",
25023
+ style: normalizeStyle({
25024
+ height: `${unref(getVirtualHeight)}px`,
25025
+ paddingRight: unref(isShowScrollBar) ? "5px" : "0px"
25026
+ })
25157
25027
  }, {
25158
25028
  default: withCtx(({ itemData: templateProps }) => [
25159
25029
  createElementVNode("div", {
25160
- style: normalizeStyle(unref(optionItemStyle)(_ctx.itemHeight)),
25030
+ style: normalizeStyle({ height: `${_ctx.itemHeight}px` }),
25161
25031
  onClick: ($event) => selectHandle(templateProps)
25162
25032
  }, [
25163
- unref(showCustomItemSlot) ? renderSlot(_ctx.$slots, "item", {
25033
+ _ctx.$slots.item ? renderSlot(_ctx.$slots, "item", {
25164
25034
  key: 0,
25165
- props: unref(itemSlotProps)(templateProps)
25035
+ props: {
25036
+ ...templateProps,
25037
+ checked: unref(getChecked)(templateProps.value)
25038
+ }
25166
25039
  }, void 0, true) : (openBlock(), createElementBlock("div", {
25167
25040
  key: 1,
25168
- class: normalizeClass(["lew-select-item lew-select-item-mul", getSelectItemClassName(templateProps)])
25041
+ class: normalizeClass(["lew-select-item", unref(getSelectItemClassName)(templateProps)])
25169
25042
  }, [
25170
- !templateProps.isGroup ? (openBlock(), createBlock(unref(LewCheckbox), {
25043
+ _ctx.multiple && !templateProps.isGroup ? (openBlock(), createBlock(unref(LewCheckbox), {
25171
25044
  key: templateProps.value,
25172
25045
  class: "lew-select-checkbox",
25173
25046
  checked: unref(getChecked)(templateProps.value)
25174
25047
  }, null, 8, ["checked"])) : createCommentVNode("", true),
25175
25048
  createVNode(unref(LewTextTrim), {
25176
- text: unref(groupLabelText)(templateProps),
25049
+ text: unref(getOptionText)(templateProps),
25177
25050
  delay: [500, 0],
25178
- class: normalizeClass(["lew-select-label", unref(groupLabelClass)(templateProps)])
25179
- }, null, 8, ["text", "class"])
25051
+ class: normalizeClass(["lew-select-label", { "is-group": templateProps.isGroup }])
25052
+ }, null, 8, ["text", "class"]),
25053
+ unref(shouldShowCheckIcon)(templateProps.value) ? (openBlock(), createBlock(CommonIcon, {
25054
+ key: 1,
25055
+ class: "lew-icon-check",
25056
+ size: 16,
25057
+ "stroke-width": 3,
25058
+ type: "check"
25059
+ })) : createCommentVNode("", true)
25180
25060
  ], 2))
25181
- ], 12, _hoisted_5$4)
25061
+ ], 12, _hoisted_3$b)
25182
25062
  ]),
25183
25063
  _: 3
25184
25064
  }, 8, ["list", "min-size", "style"])
25185
25065
  ], 64))
25186
25066
  ]),
25187
- unref(showFooterSlot) ? renderSlot(_ctx.$slots, "footer", { key: 2 }, void 0, true) : createCommentVNode("", true)
25067
+ renderSlot(_ctx.$slots, "footer", {}, void 0, true)
25188
25068
  ], 6)
25189
25069
  ]),
25190
25070
  _: 3
25191
- }, 8, ["trigger", "trigger-width", "disabled", "style", "loading"]);
25071
+ }, 8, ["style", "trigger", "trigger-width", "hide-on-click", "disabled", "loading"]);
25192
25072
  };
25193
25073
  }
25194
25074
  });
25195
- const LewSelectMultiple = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__scopeId", "data-v-bb9b06f8"]]);
25075
+ const LewSelect = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__scopeId", "data-v-56b4bf28"]]);
25196
25076
  const sliderEmits = {
25197
25077
  change: (value) => value
25198
25078
  };
@@ -26847,9 +26727,12 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
26847
26727
  emit("clear");
26848
26728
  emit("change", void 0);
26849
26729
  }
26850
- function toFocus() {
26730
+ function focus() {
26851
26731
  lewTextareaRef.value?.focus();
26852
26732
  }
26733
+ function blur() {
26734
+ lewTextareaRef.value?.blur();
26735
+ }
26853
26736
  const getTextareaClassNames = computed(() => {
26854
26737
  const { size, readonly: readonly2, disabled } = props;
26855
26738
  return object2class("lew-textarea-view", {
@@ -26858,13 +26741,13 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
26858
26741
  disabled
26859
26742
  });
26860
26743
  });
26861
- function focus(e) {
26744
+ function _focus(e) {
26862
26745
  if (props.selectByFocus) {
26863
26746
  e?.currentTarget?.select();
26864
26747
  }
26865
26748
  state.isFocus = true;
26866
26749
  }
26867
- function blur() {
26750
+ function _blur() {
26868
26751
  state.isFocus = false;
26869
26752
  }
26870
26753
  function handleInput(event) {
@@ -26884,16 +26767,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
26884
26767
  return size[props.size];
26885
26768
  });
26886
26769
  const getTextareaStyle = computed(() => {
26887
- const {
26888
- width,
26889
- height,
26890
- size,
26891
- resize,
26892
- maxHeight,
26893
- minHeight,
26894
- maxWidth,
26895
- minWidth
26896
- } = props;
26770
+ const { width, height, size, resize, maxHeight, minHeight, maxWidth, minWidth } = props;
26897
26771
  const heightMap = {
26898
26772
  small: 60,
26899
26773
  medium: 75,
@@ -26926,7 +26800,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
26926
26800
  }
26927
26801
  });
26928
26802
  }
26929
- __expose({ toFocus });
26803
+ __expose({ focus, blur });
26930
26804
  return (_ctx, _cache) => {
26931
26805
  return openBlock(), createElementBlock("div", {
26932
26806
  ref_key: "lewTextareaViewRef",
@@ -26943,8 +26817,8 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
26943
26817
  maxlength: _ctx.maxLength,
26944
26818
  disabled: _ctx.disabled,
26945
26819
  readonly: _ctx.readonly,
26946
- onFocus: focus,
26947
- onBlur: blur,
26820
+ onFocus: _focus,
26821
+ onBlur: _blur,
26948
26822
  onInput: handleInput,
26949
26823
  onChange: handleChange
26950
26824
  }, null, 40, _hoisted_1$h), [
@@ -26972,7 +26846,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
26972
26846
  };
26973
26847
  }
26974
26848
  });
26975
- const LewTextarea = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-1cb07f72"]]);
26849
+ const LewTextarea = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-45937168"]]);
26976
26850
  const treeSelectEmits = {
26977
26851
  change: (value) => value,
26978
26852
  clear: () => {
@@ -27044,7 +26918,7 @@ const treeSelectProps = {
27044
26918
  },
27045
26919
  checkable: {
27046
26920
  type: Boolean,
27047
- default: false,
26921
+ default: true,
27048
26922
  validator: validators.boolean({
27049
26923
  componentName: "LewTreeSelect",
27050
26924
  propName: "checkable"
@@ -27058,14 +26932,6 @@ const treeSelectProps = {
27058
26932
  propName: "showAllLevels"
27059
26933
  })
27060
26934
  },
27061
- showCheckIcon: {
27062
- type: Boolean,
27063
- default: true,
27064
- validator: validators.boolean({
27065
- componentName: "LewTreeSelect",
27066
- propName: "showCheckIcon"
27067
- })
27068
- },
27069
26935
  showLine: {
27070
26936
  type: Boolean,
27071
26937
  default: false,
@@ -27182,7 +27048,7 @@ const _hoisted_4$5 = {
27182
27048
  key: 0,
27183
27049
  class: "result-count"
27184
27050
  };
27185
- const _hoisted_5$3 = { class: "tree-select-wrapper lew-scrollbar" };
27051
+ const _hoisted_5$4 = { class: "tree-select-wrapper lew-scrollbar" };
27186
27052
  const _sfc_main$o = /* @__PURE__ */ defineComponent({
27187
27053
  __name: "LewTreeSelect",
27188
27054
  props: /* @__PURE__ */ mergeModels(treeSelectProps, {
@@ -27410,7 +27276,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
27410
27276
  renderSlot(_ctx.$slots, "header", {}, void 0, true),
27411
27277
  createElementVNode("div", _hoisted_3$a, [
27412
27278
  _ctx.searchable && unref(state).resultText ? (openBlock(), createElementBlock("div", _hoisted_4$5, toDisplayString$1(unref(state).resultText), 1)) : createCommentVNode("", true),
27413
- createElementVNode("div", _hoisted_5$3, [
27279
+ createElementVNode("div", _hoisted_5$4, [
27414
27280
  createVNode(unref(LewTree), mergeProps({
27415
27281
  ref_key: "lewTreeRef",
27416
27282
  ref: lewTreeRef,
@@ -29482,8 +29348,16 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
29482
29348
  return;
29483
29349
  if (props.close) {
29484
29350
  isClosing.value = true;
29485
- await props.close();
29486
- emit("close");
29351
+ let result = false;
29352
+ try {
29353
+ result = await props.close();
29354
+ } catch {
29355
+ isClosing.value = false;
29356
+ return;
29357
+ }
29358
+ if (result === true) {
29359
+ emit("close");
29360
+ }
29487
29361
  isClosing.value = false;
29488
29362
  } else {
29489
29363
  emit("close");
@@ -29505,7 +29379,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
29505
29379
  _ctx.$slots.right ? (openBlock(), createElementBlock("div", _hoisted_3$7, [
29506
29380
  renderSlot(_ctx.$slots, "right")
29507
29381
  ])) : createCommentVNode("", true),
29508
- _ctx.closeable ? (openBlock(), createElementBlock("div", {
29382
+ _ctx.closeable || unref(isFunction$1)(_ctx.close) ? (openBlock(), createElementBlock("div", {
29509
29383
  key: 2,
29510
29384
  class: "lew-tag-close",
29511
29385
  onClick: withModifiers(handleClose, ["stop"])
@@ -30228,7 +30102,7 @@ const _hoisted_4$3 = {
30228
30102
  "stroke-linecap": "butt",
30229
30103
  "stroke-linejoin": "miter"
30230
30104
  };
30231
- const _hoisted_5$2 = {
30105
+ const _hoisted_5$3 = {
30232
30106
  key: 1,
30233
30107
  viewBox: "0 0 48 48",
30234
30108
  fill: "none",
@@ -30265,7 +30139,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
30265
30139
  props.separator === "sprit" ? (openBlock(), createElementBlock("svg", _hoisted_4$3, [..._cache[0] || (_cache[0] = [
30266
30140
  createElementVNode("path", { d: "M29.506 6.502 18.493 41.498" }, null, -1)
30267
30141
  ])])) : createCommentVNode("", true),
30268
- props.separator === "shoulder" ? (openBlock(), createElementBlock("svg", _hoisted_5$2, [..._cache[1] || (_cache[1] = [
30142
+ props.separator === "shoulder" ? (openBlock(), createElementBlock("svg", _hoisted_5$3, [..._cache[1] || (_cache[1] = [
30269
30143
  createElementVNode("path", { d: "m16 39.513 15.556-15.557L16 8.4" }, null, -1)
30270
30144
  ])])) : createCommentVNode("", true)
30271
30145
  ])) : createCommentVNode("", true)
@@ -30583,8 +30457,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
30583
30457
  return proxy;
30584
30458
  }
30585
30459
  function clickItem(item) {
30586
- if (item.disabled)
30587
- return;
30460
+ if (item.disabled) return;
30588
30461
  const instance = props.dropdownInstance || window.LewContextMenu?.instance || null;
30589
30462
  if (isFunction$1(item.onClick)) {
30590
30463
  const proxyItem = createItemProxy(item);
@@ -30594,7 +30467,8 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
30594
30467
  }
30595
30468
  });
30596
30469
  item.onClick?.(proxyItem, proxyOptions, instance);
30597
- } else {
30470
+ }
30471
+ if (item.hideMenuOnClick || item.hideMenuOnClick === void 0) {
30598
30472
  instance?.hide();
30599
30473
  }
30600
30474
  emit("change", item);
@@ -30742,7 +30616,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
30742
30616
  };
30743
30617
  }
30744
30618
  });
30745
- const LewContextMenu = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-10d9d549"]]);
30619
+ const LewContextMenu = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-7dfed0eb"]]);
30746
30620
  const dropdownModel = {
30747
30621
  selectedKeys: {
30748
30622
  type: Array,
@@ -31116,7 +30990,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
31116
30990
  };
31117
30991
  }
31118
30992
  });
31119
- const LewMenuTreeItem = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-c53bcfe6"]]);
30993
+ const LewMenuTreeItem = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-98e31987"]]);
31120
30994
  const _sfc_main$4 = /* @__PURE__ */ defineComponent({
31121
30995
  __name: "LewMenuTree",
31122
30996
  props: /* @__PURE__ */ mergeModels(menuTreeProps, {
@@ -31282,66 +31156,101 @@ const stepsProps = {
31282
31156
  componentName: "LewSteps",
31283
31157
  propName: "minWidth"
31284
31158
  })
31159
+ },
31160
+ // 允许点击Item切换步骤
31161
+ canClickItem: {
31162
+ type: Boolean,
31163
+ default: true
31164
+ },
31165
+ // 允许跨步骤
31166
+ canCrossSteps: {
31167
+ type: Boolean,
31168
+ default: true
31285
31169
  }
31286
31170
  };
31287
31171
  const _hoisted_1$2 = { class: "lew-steps lew-scrollbar" };
31288
- const _hoisted_2$2 = { class: "lew-steps-item-index" };
31289
- const _hoisted_3$2 = {
31172
+ const _hoisted_2$2 = ["onClick"];
31173
+ const _hoisted_3$2 = { class: "lew-steps-item-index" };
31174
+ const _hoisted_4$2 = {
31290
31175
  key: 4,
31291
31176
  class: "index"
31292
31177
  };
31293
- const _hoisted_4$2 = { class: "lew-steps-item-info" };
31178
+ const _hoisted_5$2 = { class: "lew-steps-item-info" };
31294
31179
  const _sfc_main$3 = /* @__PURE__ */ defineComponent({
31295
31180
  __name: "LewSteps",
31296
31181
  props: /* @__PURE__ */ mergeModels(stepsProps, {
31297
31182
  "modelValue": {},
31298
31183
  "modelModifiers": {}
31299
31184
  }),
31300
- emits: ["update:modelValue"],
31301
- setup(__props) {
31185
+ emits: /* @__PURE__ */ mergeModels(["change"], ["update:modelValue"]),
31186
+ setup(__props, { emit: __emit }) {
31187
+ const props = __props;
31188
+ const emit = __emit;
31302
31189
  const stepsValue = useModel(__props, "modelValue");
31190
+ watch(stepsValue, (val, oldVal) => {
31191
+ if (val !== oldVal) {
31192
+ emit("change", val);
31193
+ }
31194
+ });
31195
+ const itemStyle = computed(() => {
31196
+ return {
31197
+ cursor: props.canClickItem ? "pointer" : "default",
31198
+ minWidth: any2px(props.minWidth)
31199
+ };
31200
+ });
31201
+ function handleClick(index2) {
31202
+ if (!props.canClickItem)
31203
+ return;
31204
+ if (!props.canCrossSteps && Math.abs((stepsValue.value || 1) - 1 - index2) > 1)
31205
+ return;
31206
+ if (stepsValue.value !== index2 + 1) {
31207
+ stepsValue.value = index2 + 1;
31208
+ emit("change", stepsValue.value);
31209
+ }
31210
+ }
31303
31211
  return (_ctx, _cache) => {
31304
31212
  return openBlock(), createElementBlock("div", _hoisted_1$2, [
31305
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (item, index2) => {
31213
+ (openBlock(true), createElementBlock(Fragment, null, renderList(props.options, (item, index2) => {
31306
31214
  return openBlock(), createElementBlock("div", {
31307
31215
  key: index2,
31308
31216
  class: normalizeClass(["lew-steps-item", {
31309
31217
  "lew-steps-item-active": index2 === (stepsValue.value || 1) - 1,
31310
31218
  "lew-steps-item-succeeded": index2 < (stepsValue.value || 1) - 1,
31311
- "lew-steps-item-error": index2 === (stepsValue.value || 1) - 1 && _ctx.status === "error",
31312
- "lew-steps-item-warning": index2 === (stepsValue.value || 1) - 1 && _ctx.status === "warning",
31313
- "lew-steps-item-done": index2 === (stepsValue.value || 1) - 1 && _ctx.status === "done"
31219
+ "lew-steps-item-error": index2 === (stepsValue.value || 1) - 1 && props.status === "error",
31220
+ "lew-steps-item-warning": index2 === (stepsValue.value || 1) - 1 && props.status === "warning",
31221
+ "lew-steps-item-done": index2 === (stepsValue.value || 1) - 1 && props.status === "done"
31314
31222
  }]),
31315
- style: normalizeStyle({ minWidth: unref(any2px)(_ctx.minWidth) })
31223
+ style: normalizeStyle(unref(itemStyle)),
31224
+ onClick: ($event) => handleClick(index2)
31316
31225
  }, [
31317
- createElementVNode("div", _hoisted_2$2, [
31318
- index2 === (stepsValue.value || 1) - 1 && _ctx.status === "loading" ? (openBlock(), createBlock(CommonIcon, {
31226
+ createElementVNode("div", _hoisted_3$2, [
31227
+ index2 === (stepsValue.value || 1) - 1 && props.status === "loading" ? (openBlock(), createBlock(CommonIcon, {
31319
31228
  key: 0,
31320
31229
  size: 16,
31321
31230
  "stroke-width": 3,
31322
31231
  loading: "",
31323
31232
  type: "loader"
31324
- })) : index2 === (stepsValue.value || 1) - 1 && _ctx.status === "warning" ? (openBlock(), createBlock(CommonIcon, {
31233
+ })) : index2 === (stepsValue.value || 1) - 1 && props.status === "warning" ? (openBlock(), createBlock(CommonIcon, {
31325
31234
  key: 1,
31326
31235
  size: 16,
31327
31236
  "stroke-width": 3,
31328
31237
  type: "alert-circle"
31329
- })) : index2 === (stepsValue.value || 1) - 1 && _ctx.status === "error" ? (openBlock(), createBlock(CommonIcon, {
31238
+ })) : index2 === (stepsValue.value || 1) - 1 && props.status === "error" ? (openBlock(), createBlock(CommonIcon, {
31330
31239
  key: 2,
31331
31240
  size: 16,
31332
31241
  "stroke-width": 3,
31333
31242
  type: "close"
31334
- })) : index2 < (stepsValue.value || 1) - 1 || index2 === (stepsValue.value || 1) - 1 && _ctx.status === "done" ? (openBlock(), createBlock(CommonIcon, {
31243
+ })) : index2 < (stepsValue.value || 1) - 1 || index2 === (stepsValue.value || 1) - 1 && props.status === "done" ? (openBlock(), createBlock(CommonIcon, {
31335
31244
  key: 3,
31336
31245
  style: { color: "var(--lew-color-primary)" },
31337
31246
  size: 16,
31338
31247
  "stroke-width": 3,
31339
31248
  type: "check"
31340
- })) : (openBlock(), createElementBlock("span", _hoisted_3$2, toDisplayString$1(index2 + 1), 1))
31249
+ })) : (openBlock(), createElementBlock("span", _hoisted_4$2, toDisplayString$1(index2 + 1), 1))
31341
31250
  ]),
31342
- createElementVNode("div", _hoisted_4$2, [
31251
+ createElementVNode("div", _hoisted_5$2, [
31343
31252
  createElementVNode("div", {
31344
- style: normalizeStyle({ maxWidth: unref(any2px)(_ctx.minWidth) }),
31253
+ style: normalizeStyle({ maxWidth: unref(any2px)(props.minWidth) }),
31345
31254
  class: "lew-steps-item-title"
31346
31255
  }, [
31347
31256
  createVNode(_sfc_main$16, {
@@ -31353,7 +31262,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
31353
31262
  }, null, 8, ["render-fn"])
31354
31263
  ], 4),
31355
31264
  createElementVNode("div", {
31356
- style: normalizeStyle({ maxWidth: unref(any2px)(_ctx.minWidth) }),
31265
+ style: normalizeStyle({ maxWidth: unref(any2px)(props.minWidth) }),
31357
31266
  class: "lew-steps-item-description"
31358
31267
  }, [
31359
31268
  createVNode(_sfc_main$16, {
@@ -31367,7 +31276,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
31367
31276
  }, null, 8, ["render-fn"])
31368
31277
  ], 4)
31369
31278
  ])
31370
- ], 6);
31279
+ ], 14, _hoisted_2$2);
31371
31280
  }), 128))
31372
31281
  ]);
31373
31282
  };
@@ -31417,7 +31326,6 @@ const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
31417
31326
  LewRadioGroup,
31418
31327
  LewRate,
31419
31328
  LewSelect,
31420
- LewSelectMultiple,
31421
31329
  LewSlider,
31422
31330
  LewSliderRange,
31423
31331
  LewSteps: _sfc_main$3,
@@ -31528,9 +31436,6 @@ const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
31528
31436
  requiredIconSizeMap,
31529
31437
  selectEmits,
31530
31438
  selectModel,
31531
- selectMultipleEmits,
31532
- selectMultipleModel,
31533
- selectMultipleProps,
31534
31439
  selectProps,
31535
31440
  sliderEmits,
31536
31441
  sliderModel,
@@ -31859,7 +31764,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
31859
31764
  visible.value = true;
31860
31765
  nextTick(() => {
31861
31766
  if (okRef.value)
31862
- okRef.value.focus();
31767
+ okRef.value.$el.focus();
31863
31768
  });
31864
31769
  });
31865
31770
  watch(visible, (newVal) => {
@@ -31972,7 +31877,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
31972
31877
  };
31973
31878
  }
31974
31879
  });
31975
- const _LewDialog = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-fef66d43"]]);
31880
+ const _LewDialog = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-f609a415"]]);
31976
31881
  const { x, y } = useMouse();
31977
31882
  function createDialog(type) {
31978
31883
  return (options) => dialog(type, options);
@@ -38876,7 +38781,6 @@ export {
38876
38781
  LewRadioGroup,
38877
38782
  LewRate,
38878
38783
  LewSelect,
38879
- LewSelectMultiple,
38880
38784
  LewSlider,
38881
38785
  LewSliderRange,
38882
38786
  _sfc_main$3 as LewSteps,
@@ -39005,9 +38909,6 @@ export {
39005
38909
  requiredIconSizeMap,
39006
38910
  selectEmits,
39007
38911
  selectModel,
39008
- selectMultipleEmits,
39009
- selectMultipleModel,
39010
- selectMultipleProps,
39011
38912
  selectProps,
39012
38913
  setLocale,
39013
38914
  sliderEmits,