lew-ui 2.7.57 → 2.7.59

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 +1615 -1720
  34. package/dist/index.umd.cjs +7 -7
  35. package/dist/types/components.d.ts +2 -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,316 @@ 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 })
14693
+ };
14694
+ const _hoisted_1$G = {
14695
+ key: 0,
14696
+ class: "lew-icon-loading-box"
14435
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) return "";
14855
+ if (props.multiple) {
14856
+ return "";
14857
+ } else {
14858
+ return props.selectedLabel || props.formatItems;
14859
+ }
14860
+ });
14861
+ const clearButtonIconClass = computed(() => {
14862
+ return {
14863
+ "lew-form-icon-close-focus": props.focus
14864
+ };
14865
+ });
14866
+ const placeholderText = computed(() => {
14867
+ if (props.multiple) {
14868
+ return props.placeholder || locale.t("selectMultiple.placeholder");
14869
+ } else {
14870
+ return props.placeholder || locale.t("select.placeholder");
14871
+ }
14872
+ });
14873
+ const getValueStyle = computed(() => {
14874
+ return {
14875
+ opacity: props.focus ? 0.6 : 1,
14876
+ paddingRight: props.clearable ? "24px" : ""
14877
+ };
14878
+ });
14879
+ function getInputRefStyle() {
14880
+ return {
14881
+ fontSize: getComputedStyle(inputRef.value).fontSize,
14882
+ padding: getComputedStyle(inputRef.value).padding,
14883
+ fontFamily: getComputedStyle(inputRef.value).fontFamily,
14884
+ marginLeft: getComputedStyle(inputRef.value).marginLeft
14885
+ };
14886
+ }
14887
+ function focus() {
14888
+ if (props.multiple) {
14889
+ setTimeout(() => {
14890
+ searchInputRef.value?.focus();
14891
+ }, 100);
14892
+ } else {
14893
+ inputRef.value?.focus();
14894
+ }
14895
+ }
14896
+ const selectIconClass = computed(() => {
14897
+ return {
14898
+ "lew-icon-select-hide": showClearButton.value
14899
+ };
14900
+ });
14901
+ __expose({
14902
+ clearHandle,
14903
+ getInputRefStyle
14904
+ });
14905
+ return (_ctx, _cache) => {
14906
+ return openBlock(), createElementBlock("div", {
14907
+ ref_key: "lewSelectRef",
14908
+ ref: lewSelectRef,
14909
+ class: normalizeClass(["lew-select", unref(getSelectClassName)]),
14910
+ style: normalizeStyle({ width: unref(any2px)(__props.width) }),
14911
+ onClick: focus
14912
+ }, [
14913
+ __props.loading ? (openBlock(), createElementBlock("div", _hoisted_1$G, [
14914
+ createVNode(CommonIcon, {
14915
+ size: unref(getIconSize),
14916
+ loading: __props.loading,
14917
+ type: "loading"
14918
+ }, null, 8, ["size", "loading"])
14919
+ ])) : (openBlock(), createBlock(CommonIcon, {
14920
+ key: 1,
14921
+ size: unref(getIconSize),
14922
+ type: "chevron-down",
14923
+ class: normalizeClass(["lew-icon-select", unref(selectIconClass)])
14924
+ }, null, 8, ["size", "class"])),
14925
+ createVNode(Transition, { name: "lew-form-icon-ani" }, {
14926
+ default: withCtx(() => [
14927
+ unref(showClearButton) ? (openBlock(), createBlock(CommonIcon, {
14928
+ key: 0,
14929
+ size: unref(getIconSize),
14930
+ type: "close",
14931
+ class: normalizeClass(["lew-form-icon-close", unref(clearButtonIconClass)]),
14932
+ onClick: withModifiers(clearHandle, ["stop"])
14933
+ }, null, 8, ["size", "class"])) : createCommentVNode("", true)
14934
+ ]),
14935
+ _: 1
14936
+ }),
14937
+ !__props.multiple ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
14938
+ createElementVNode("input", {
14939
+ ref_key: "inputRef",
14940
+ ref: inputRef,
14941
+ value: unref(selectedItemsText),
14942
+ title: unref(selectedItemsText),
14943
+ class: "lew-value lew-single-input",
14944
+ style: normalizeStyle(unref(getValueStyle)),
14945
+ readonly: !__props.searchable,
14946
+ placeholder: unref(placeholderText),
14947
+ onInput: inputHandle
14948
+ }, null, 44, _hoisted_2$t),
14949
+ withDirectives(createElementVNode("div", { class: "lew-placeholder" }, toDisplayString$1(unref(placeholderText)), 513), [
14950
+ [vShow, unref(showPlaceholder)]
14951
+ ])
14952
+ ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 3 }, [
14953
+ withDirectives(createElementVNode("div", { class: "lew-placeholder" }, toDisplayString$1(unref(placeholderText)), 513), [
14954
+ [vShow, unref(showPlaceholder)]
14955
+ ]),
14956
+ withDirectives(createElementVNode("div", {
14957
+ class: "lew-multiple-box",
14958
+ style: normalizeStyle({ padding: unref(hasSelectedItems) ? "4px" : "" })
14959
+ }, [
14960
+ createVNode(TransitionGroup, { name: "tag-list" }, {
14961
+ default: withCtx(() => [
14962
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.formatItems, (item) => {
14963
+ return openBlock(), createBlock(unref(_sfc_main$e), {
14964
+ key: item.value,
14965
+ type: "light",
14966
+ size: props.size,
14967
+ closeable: !__props.disabled && !__props.readonly,
14968
+ onClose: ($event) => deleteTag(item.value)
14969
+ }, {
14970
+ default: withCtx(() => [
14971
+ createTextVNode(toDisplayString$1(item.label), 1)
14972
+ ]),
14973
+ _: 2
14974
+ }, 1032, ["size", "closeable", "onClose"]);
14975
+ }), 128))
14976
+ ]),
14977
+ _: 1
14978
+ }),
14979
+ __props.searchable && (props.focus || (__props.formatItems || []).length === 0) ? (openBlock(), createBlock(unref(LewInput), {
14980
+ ref_key: "searchInputRef",
14981
+ ref: searchInputRef,
14982
+ key: "search-input",
14983
+ modelValue: keyword.value,
14984
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => keyword.value = $event),
14985
+ "auto-width": unref(hasSelectedItems),
14986
+ class: "lew-multiple-search-input",
14987
+ size: __props.size,
14988
+ placeholder: !unref(hasSelectedItems) ? unref(placeholderText) : " ",
14989
+ onInput: _cache[1] || (_cache[1] = (value) => inputHandle({ target: { value } }))
14990
+ }, null, 8, ["modelValue", "auto-width", "size", "placeholder"])) : createCommentVNode("", true)
14991
+ ], 4), [
14992
+ [vShow, !unref(showPlaceholder)]
14993
+ ])
14994
+ ], 64))
14995
+ ], 6);
14996
+ };
14997
+ }
14998
+ });
14999
+ const CommonInput = /* @__PURE__ */ _export_sfc(_sfc_main$T, [["__scopeId", "data-v-f8a0c098"]]);
14436
15000
  function vue3h(ele, props, children) {
14437
15001
  const { attrs, on, ...rest } = props;
14438
15002
  let event = {};
@@ -14989,6 +15553,9 @@ function useVirtList(userProps, emitFunction) {
14989
15553
  slotSize.footerSize = 0;
14990
15554
  }
14991
15555
  });
15556
+ onActivated(() => {
15557
+ scrollToOffset(reactiveData.offset);
15558
+ });
14992
15559
  function getVirtualSize2beginInView() {
14993
15560
  return reactiveData.virtualSize + getRangeSize(reactiveData.renderBegin, reactiveData.inViewBegin);
14994
15561
  }
@@ -15356,6 +15923,96 @@ const VirtList = /* @__PURE__ */ defineComponent({
15356
15923
  }, [renderStickyHeaderSlot(), renderHeaderSlot(), renderMainList(), renderFooterSlot(), renderStickyFooterSlot()]);
15357
15924
  }
15358
15925
  });
15926
+ class CascaderNodeCache {
15927
+ nodeCache = /* @__PURE__ */ new Map();
15928
+ get(value) {
15929
+ return this.nodeCache.get(value);
15930
+ }
15931
+ set(value, node) {
15932
+ this.nodeCache.set(value, node);
15933
+ }
15934
+ has(value) {
15935
+ return this.nodeCache.has(value);
15936
+ }
15937
+ clear() {
15938
+ this.nodeCache.clear();
15939
+ }
15940
+ }
15941
+ function formatTree(tree, parentValuePaths = [], parentLabelPaths = []) {
15942
+ return tree.map((node) => {
15943
+ const { value, label, children = [], isLeaf } = node;
15944
+ const valuePaths = [...parentValuePaths, value];
15945
+ const labelPaths = [...parentLabelPaths, label];
15946
+ const level = valuePaths.length - 1;
15947
+ const formattedNode = {
15948
+ ...node,
15949
+ key: value,
15950
+ valuePaths,
15951
+ labelPaths,
15952
+ level,
15953
+ parentValuePaths,
15954
+ parentLabelPaths,
15955
+ isLeaf: isLeaf ?? !children.length
15956
+ };
15957
+ if (children.length > 0) {
15958
+ formattedNode.children = formatTree(children, valuePaths, labelPaths);
15959
+ }
15960
+ return formattedNode;
15961
+ });
15962
+ }
15963
+ function findObjectByValue(treeList, value, cache2) {
15964
+ if (cache2?.has(value)) {
15965
+ return cache2.get(value) || null;
15966
+ }
15967
+ const stack = [...treeList];
15968
+ while (stack.length > 0) {
15969
+ const node = stack.pop();
15970
+ if (node.value === value) {
15971
+ cache2?.set(value, node);
15972
+ return node;
15973
+ }
15974
+ if (node.children?.length) {
15975
+ stack.push(...node.children);
15976
+ }
15977
+ }
15978
+ return null;
15979
+ }
15980
+ function findAndAddChildrenByValue(tree, value, children, cache2) {
15981
+ const stack = tree.map((node) => ({ node }));
15982
+ while (stack.length > 0) {
15983
+ const { node } = stack.pop();
15984
+ if (node.value === value) {
15985
+ node.children = children;
15986
+ cache2?.set(value, node);
15987
+ return tree;
15988
+ }
15989
+ if (node.children?.length) {
15990
+ stack.push(...node.children.map((child) => ({ node: child, parent: node })));
15991
+ }
15992
+ }
15993
+ return tree;
15994
+ }
15995
+ function findChildrenByValue(tree, value, cache2) {
15996
+ const cachedNode = cache2?.get(value);
15997
+ if (cachedNode) {
15998
+ return cachedNode.children || [];
15999
+ }
16000
+ const stack = [...tree];
16001
+ while (stack.length > 0) {
16002
+ const node = stack.pop();
16003
+ if (node.value === value) {
16004
+ cache2?.set(value, node);
16005
+ return node.children || [];
16006
+ }
16007
+ if (node.children?.length) {
16008
+ stack.push(...node.children);
16009
+ }
16010
+ }
16011
+ return [];
16012
+ }
16013
+ function createCascaderCache() {
16014
+ return new CascaderNodeCache();
16015
+ }
15359
16016
  const cascaderProps = {
15360
16017
  options: {
15361
16018
  type: Array,
@@ -15397,22 +16054,6 @@ const cascaderProps = {
15397
16054
  propName: "clearable"
15398
16055
  })
15399
16056
  },
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
16057
  free: {
15417
16058
  type: Boolean,
15418
16059
  default: false,
@@ -15479,48 +16120,69 @@ const cascaderProps = {
15479
16120
  componentName: "LewCascader",
15480
16121
  propName: "readonly"
15481
16122
  })
16123
+ },
16124
+ onlyLeafSelectable: {
16125
+ type: Boolean,
16126
+ default: true,
16127
+ validator: validators.boolean({
16128
+ componentName: "LewCascader",
16129
+ propName: "onlyLeafSelectable"
16130
+ })
16131
+ },
16132
+ multiple: {
16133
+ type: Boolean,
16134
+ default: false,
16135
+ validator: validators.boolean({
16136
+ componentName: "LewCascader",
16137
+ propName: "multiple"
16138
+ })
16139
+ },
16140
+ showAllLevels: {
16141
+ type: Boolean,
16142
+ default: true,
16143
+ validator: validators.boolean({
16144
+ componentName: "LewCascader",
16145
+ propName: "showAllLevels"
16146
+ })
15482
16147
  }
15483
16148
  };
15484
- const _hoisted_1$G = {
16149
+ const _hoisted_1$F = {
15485
16150
  key: 0,
15486
- class: "lew-icon-loading-box"
16151
+ class: "lew-cascader-options-box"
15487
16152
  };
15488
- const _hoisted_2$t = ["onClick"];
15489
- const _sfc_main$T = /* @__PURE__ */ defineComponent({
16153
+ const _hoisted_2$s = ["onClick"];
16154
+ const _hoisted_3$n = ["title"];
16155
+ const _sfc_main$S = /* @__PURE__ */ defineComponent({
15490
16156
  __name: "LewCascader",
15491
16157
  props: /* @__PURE__ */ mergeModels(cascaderProps, {
15492
- "modelValue": { required: true },
16158
+ "modelValue": {},
15493
16159
  "modelModifiers": {}
15494
16160
  }),
15495
16161
  emits: /* @__PURE__ */ mergeModels(cascaderEmits, ["update:modelValue"]),
15496
16162
  setup(__props, { expose: __expose, emit: __emit }) {
15497
16163
  const props = __props;
15498
16164
  const emit = __emit;
15499
- const cascaderValue = useModel(__props, "modelValue");
16165
+ const modelValue = useModel(__props, "modelValue");
15500
16166
  const app = getCurrentInstance()?.appContext.app;
15501
16167
  if (app && !app.directive("tooltip")) {
15502
16168
  app.use(LewTooltip);
15503
16169
  }
15504
- const lewCascaderRef = ref();
15505
16170
  const lewPopoverRef = ref();
15506
16171
  const state = reactive({
15507
16172
  visible: false,
15508
16173
  loading: false,
15509
16174
  initLoading: true,
15510
16175
  okLoading: false,
16176
+ backupValue: void 0,
15511
16177
  optionsGroup: [],
15512
- // 分组
15513
16178
  optionsTree: [],
15514
- //
15515
- activeLabels: [],
15516
- // 激活
15517
- tobeLabels: [],
15518
- // 待确认
15519
- tobeItem: {},
15520
- keyword: ""
16179
+ activeValues: []
15521
16180
  });
16181
+ const loadedDataCache = /* @__PURE__ */ new Map();
16182
+ const nodeCache = createCascaderCache();
15522
16183
  const loadedData = reactive({});
15523
16184
  const formMethods = inject("formMethods", {});
16185
+ let isInternalUpdate = false;
15524
16186
  const _loadMethod = computed(() => {
15525
16187
  if (isFunction$1(props.loadMethod)) {
15526
16188
  return props.loadMethod;
@@ -15537,327 +16199,350 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
15537
16199
  }
15538
16200
  return false;
15539
16201
  });
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) {
16202
+ const getCascaderWidth = computed(() => {
16203
+ const validGroups = state.optionsGroup.filter((group) => group?.length > 0).length;
16204
+ return Math.max(validGroups, 1) * 200;
16205
+ });
16206
+ const getCascaderBodyStyle = computed(() => ({
16207
+ width: `${getCascaderWidth.value}px`
16208
+ }));
16209
+ const getBodyClassName = computed(() => {
16210
+ const { size, disabled } = props;
16211
+ return object2class("lew-cascader-body", { size, disabled });
16212
+ });
16213
+ const formatItems = computed(() => {
16214
+ if (!modelValue.value) {
16215
+ return props.multiple ? [] : "";
16216
+ }
16217
+ if (!props.multiple && modelValue.value) {
16218
+ const result = findObjectByValue(
16219
+ state.optionsTree,
16220
+ modelValue.value,
16221
+ nodeCache
16222
+ );
16223
+ if (!result) {
16224
+ return "";
16225
+ }
16226
+ const { label, labelPaths } = result;
16227
+ return props.showAllLevels ? labelPaths.join(" / ") : label;
16228
+ }
16229
+ if (!modelValue.value || !Array.isArray(modelValue.value)) {
16230
+ return [];
16231
+ }
16232
+ return modelValue.value.map((value) => {
16233
+ const result = findObjectByValue(state.optionsTree, value, nodeCache);
16234
+ if (!result) {
15555
16235
  return {
15556
- ..._node,
15557
- children: formatTree2(children, valuePaths, labelPaths)
16236
+ value,
16237
+ label: value
16238
+ // 如果找不到对应的节点,使用value作为label
15558
16239
  };
15559
16240
  }
15560
- return _node;
16241
+ const { label, labelPaths } = result;
16242
+ return {
16243
+ value,
16244
+ label: props.multiple ? label : labelPaths.join(" / ")
16245
+ };
15561
16246
  });
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
- }
16247
+ });
16248
+ const VIRT_LIST_STYLE = {
16249
+ padding: "6px 6px 2px 6px",
16250
+ boxSizing: "border-box"
16251
+ };
16252
+ const ITEM_PADDING_STYLE = {
16253
+ height: "38px"
16254
+ };
16255
+ const {
16256
+ selectedKeys,
16257
+ init: initTreeSelection,
16258
+ isSelected,
16259
+ isIndeterminate,
16260
+ removeKey,
16261
+ toggleKey,
16262
+ findItemsByValues
16263
+ } = useTreeSelection();
16264
+ function updateTreeStructure() {
16265
+ if (state.optionsTree.length > 0 && !props.free) {
16266
+ const currentKeys = modelValue.value && Array.isArray(modelValue.value) ? modelValue.value : [];
16267
+ initTreeSelection({ tree: state.optionsTree, keys: currentKeys });
16268
+ }
16269
+ }
16270
+ function updateModelValue() {
16271
+ isInternalUpdate = true;
16272
+ let _value;
16273
+ let _items;
16274
+ if (props.onlyLeafSelectable) {
16275
+ _items = findItemsByValues(selectedKeys.value).filter((item) => item.isLeaf);
16276
+ _value = _items.map((item) => item.key);
16277
+ } else {
16278
+ _value = cloneDeep(selectedKeys.value);
16279
+ _items = findItemsByValues(selectedKeys.value);
15578
16280
  }
15579
- return null;
16281
+ modelValue.value = _value;
16282
+ emit("change", _value, _items);
16283
+ nextTick(() => {
16284
+ isInternalUpdate = false;
16285
+ });
15580
16286
  }
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 [];
16287
+ function getItemClass(templateProps) {
16288
+ const isSelected2 = Array.isArray(modelValue.value) && modelValue.value.includes(templateProps.value) || modelValue.value === templateProps.value;
16289
+ return {
16290
+ "lew-cascader-item-disabled": templateProps.disabled,
16291
+ "lew-cascader-item-active": state.activeValues?.includes(templateProps.value) || isSelected2,
16292
+ "lew-cascader-item-selected": isSelected2
16293
+ };
15598
16294
  }
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 [];
16295
+ function getItemWrapperStyle(oIndex, oItem) {
16296
+ const style = {
16297
+ zIndex: 20 - oIndex,
16298
+ borderRadius: `0 ${oIndex === state.optionsGroup.length - 1 ? "var(--lew-border-radius-small)" : "0"} 0 0`,
16299
+ transform: oItem.length > 0 ? `translateX(${200 * oIndex}px)` : ""
16300
+ };
16301
+ return style;
15612
16302
  }
15613
16303
  async function init() {
15614
16304
  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 {
16305
+ try {
16306
+ if (_initMethod.value) {
16307
+ const newOptions = await _initMethod.value();
16308
+ _tree = newOptions || [];
16309
+ } else if (_loadMethod.value && !state.loading) {
16310
+ state.loading = true;
16311
+ _tree = await _loadMethod.value() || [];
16312
+ state.loading = false;
16313
+ } else if (props.options?.length) {
16314
+ _tree = props.options.map((e) => ({
15625
16315
  ...e,
15626
- isLeaf: !e.children || e.children && e.children.length === 0
15627
- // 没有孩子
15628
- };
15629
- }) || [];
16316
+ isLeaf: !e.children?.length
16317
+ }));
16318
+ }
16319
+ nodeCache.clear();
16320
+ loadedDataCache.clear();
16321
+ const formattedTree = formatTree(_tree);
16322
+ state.optionsGroup = [formattedTree];
16323
+ state.optionsTree = formattedTree;
16324
+ if (formattedTree.length > 0 && !props.free) {
16325
+ initTreeSelection({ tree: formattedTree, keys: modelValue.value });
16326
+ }
16327
+ } catch (error) {
16328
+ console.error("Cascader initialization failed:", error);
16329
+ state.optionsGroup = [];
16330
+ state.optionsTree = [];
16331
+ } finally {
16332
+ state.initLoading = false;
16333
+ state.loading = false;
15630
16334
  }
15631
- const __tree = formatTree2(_tree);
15632
- state.optionsGroup = [__tree];
15633
- state.optionsTree = __tree;
15634
- state.initLoading = false;
15635
16335
  }
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;
16336
+ function changeCheck(item) {
16337
+ if (item.disabled) {
16338
+ return;
16339
+ }
16340
+ const itemValue = item.value;
16341
+ if (props.free) {
16342
+ let _value = modelValue.value;
16343
+ const isSelected2 = modelValue.value?.includes(itemValue);
16344
+ if (isSelected2) {
16345
+ _value = (modelValue.value || []).filter(
16346
+ (value) => value !== itemValue
16347
+ );
16348
+ } else {
16349
+ _value = [...modelValue.value || [], itemValue];
15650
16350
  }
15651
- },
15652
- {
15653
- deep: true
16351
+ const _items = findItemsByValues(_value);
16352
+ modelValue.value = _value;
16353
+ emit("change", _value, _items);
16354
+ } else {
16355
+ toggleKey(itemValue);
16356
+ updateModelValue();
15654
16357
  }
15655
- );
15656
- const virtListRefs = ref([]);
16358
+ setTimeout(() => {
16359
+ lewPopoverRef.value && lewPopoverRef.value.refresh();
16360
+ }, 100);
16361
+ }
16362
+ function getSelected() {
16363
+ if (props.multiple) {
16364
+ return findItemsByValues(modelValue.value);
16365
+ } else {
16366
+ return findObjectByValue(state.optionsTree, modelValue.value, nodeCache);
16367
+ }
16368
+ }
15657
16369
  async function selectItem(item, level) {
15658
- if (!item.isLeaf && item.labelPaths !== state.activeLabels) {
16370
+ if (item.disabled) return;
16371
+ if (!item.isLeaf && !isEqual(item.valuePaths, state.activeValues)) {
15659
16372
  state.optionsGroup = state.optionsGroup.slice(0, level + 1);
15660
16373
  if (_loadMethod.value && !item.isLeaf) {
15661
- if (loadedData[item.value]) {
16374
+ if (loadedDataCache.has(item.value)) {
16375
+ const _options = loadedDataCache.get(item.value);
16376
+ state.optionsGroup.push(_options);
16377
+ } else if (loadedData[item.value]) {
15662
16378
  const _options = loadedData[item.value];
15663
16379
  state.optionsGroup.push(_options);
16380
+ loadedDataCache.set(item.value, _options);
15664
16381
  } else {
15665
16382
  item.loading = true;
15666
16383
  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
16384
+ const loadParam = {
16385
+ value: item.value,
16386
+ label: item.label,
16387
+ level
16388
+ };
16389
+ const new_options = await _loadMethod.value(loadParam) || [];
16390
+ const formattedNewOptions = formatTree(
16391
+ new_options,
16392
+ item.valuePaths,
16393
+ item.labelPaths
16394
+ );
16395
+ findAndAddChildrenByValue(
16396
+ state.optionsTree,
16397
+ item.value,
16398
+ formattedNewOptions,
16399
+ nodeCache
15672
16400
  );
15673
- state.optionsTree = formatTree2(_tree);
15674
- const _options = findChildrenByValue(state.optionsTree, item.value);
16401
+ if (!props.free) {
16402
+ updateTreeStructure();
16403
+ nextTick(() => {
16404
+ updateModelValue();
16405
+ });
16406
+ }
16407
+ const _options = findChildrenByValue(state.optionsTree, item.value, nodeCache);
15675
16408
  state.optionsGroup.push(_options);
16409
+ loadedDataCache.set(item.value, _options);
15676
16410
  loadedData[item.value] = _options;
15677
16411
  item.loading = false;
15678
16412
  state.okLoading = false;
15679
16413
  }
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
- }) || [];
16414
+ } else if (!item.isLeaf && item.children) {
16415
+ const _options = item.children.map((e) => ({
16416
+ ...e,
16417
+ isLeaf: !e.children?.length
16418
+ }));
15688
16419
  state.optionsGroup.push(_options);
15689
16420
  }
15690
16421
  }
15691
- if (item.labelPaths === state.activeLabels) {
15692
- state.activeLabels = item.parentLabelPaths;
15693
- if (level < state.optionsGroup.length - 1) {
15694
- state.optionsGroup.pop();
16422
+ if (!props.multiple) {
16423
+ modelValue.value = item.value;
16424
+ if (props.onlyLeafSelectable && item.isLeaf) {
16425
+ setTimeout(() => {
16426
+ hide2();
16427
+ }, 100);
15695
16428
  }
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
16429
  }
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;
16430
+ if (item.isLeaf) return;
16431
+ if (isEqual(item.valuePaths, state.activeValues)) {
16432
+ state.activeValues = item.parentValuePaths || [];
16433
+ if (level < state.optionsGroup.length - 1) {
16434
+ state.optionsGroup.pop();
15713
16435
  }
15714
- } else if (state.tobeLabels[0] === item.label) {
15715
- state.tobeLabels = [];
15716
16436
  } else {
15717
- state.tobeLabels = [item.label];
16437
+ state.activeValues = item.valuePaths || [];
15718
16438
  }
15719
16439
  }
15720
- async function show() {
15721
- lewPopoverRef.value.show();
15722
- }
15723
- function hide2() {
15724
- lewPopoverRef.value.hide();
15725
- }
15726
16440
  function clearHandle() {
15727
- cascaderValue.value = void 0;
15728
- state.tobeLabels = [];
15729
- state.activeLabels = [];
15730
- hide2();
15731
- init();
16441
+ Object.assign(state, {
16442
+ activeValues: [],
16443
+ visible: false
16444
+ });
16445
+ initTreeSelection({ keys: [] });
16446
+ isInternalUpdate = true;
16447
+ modelValue.value = void 0;
16448
+ emit("change", void 0, void 0);
15732
16449
  emit("clear");
15733
- emit("change", void 0);
16450
+ nextTick(() => {
16451
+ isInternalUpdate = false;
16452
+ });
16453
+ }
16454
+ function deleteTag(value) {
16455
+ removeKey(value);
16456
+ updateModelValue();
16457
+ emit("delete", modelValue.value, value);
15734
16458
  }
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
16459
  function showHandle() {
16460
+ state.backupValue = modelValue.value;
15751
16461
  state.visible = true;
15752
16462
  }
15753
16463
  function hideHandle() {
16464
+ if (props.onlyLeafSelectable && modelValue.value && !props.multiple) {
16465
+ const selectedNodes = findObjectByValue(
16466
+ state.optionsTree,
16467
+ modelValue.value,
16468
+ nodeCache
16469
+ );
16470
+ if (!selectedNodes) {
16471
+ modelValue.value = state.backupValue;
16472
+ return;
16473
+ }
16474
+ const isLeaf = selectedNodes.isLeaf;
16475
+ if (!isLeaf) {
16476
+ modelValue.value = state.backupValue;
16477
+ return;
16478
+ }
16479
+ }
15754
16480
  state.visible = false;
15755
16481
  }
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");
16482
+ async function show() {
16483
+ try {
16484
+ await lewPopoverRef.value?.show();
16485
+ } catch (error) {
16486
+ console.warn("Failed to show cascader popover:", error);
15763
16487
  }
15764
- if (props.showAllLevels) {
15765
- return getLabel.value.join(" / ");
15766
- } else {
15767
- return getLabel.value[getLabel.value.length - 1];
16488
+ }
16489
+ function hide2() {
16490
+ try {
16491
+ lewPopoverRef.value?.hide();
16492
+ } catch (error) {
16493
+ console.warn("Failed to hide cascader popover:", error);
16494
+ }
16495
+ }
16496
+ watch(
16497
+ () => props.options,
16498
+ (newOptions) => {
16499
+ if (!_initMethod.value && newOptions?.length) {
16500
+ const _tree = newOptions.map((e) => ({
16501
+ ...e,
16502
+ isLeaf: !e.children?.length
16503
+ }));
16504
+ nodeCache.clear();
16505
+ loadedDataCache.clear();
16506
+ const formattedTree = formatTree(_tree);
16507
+ state.optionsGroup = [formattedTree];
16508
+ state.optionsTree = formattedTree;
16509
+ if (formattedTree.length > 0) {
16510
+ if (modelValue.value && Array.isArray(modelValue.value) && modelValue.value.length > 0 && !props.free) {
16511
+ initTreeSelection({ tree: formattedTree, keys: modelValue.value });
16512
+ }
16513
+ }
16514
+ }
16515
+ },
16516
+ {
16517
+ deep: true,
16518
+ flush: "post"
15768
16519
  }
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
16520
  );
15780
- const getCascaderWidth = computed(() => {
15781
- const _hasChildOptions = state.optionsGroup.filter((e) => e && e.length > 0).length;
15782
- if (_hasChildOptions > 1) {
15783
- return _hasChildOptions * 200;
16521
+ watch(
16522
+ () => modelValue.value,
16523
+ (newValue) => {
16524
+ if (isInternalUpdate) {
16525
+ return;
16526
+ }
16527
+ if (newValue && Array.isArray(newValue) && !props.free) {
16528
+ initTreeSelection({ keys: newValue });
16529
+ }
16530
+ },
16531
+ {
16532
+ immediate: false,
16533
+ deep: true
15784
16534
  }
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 });
16535
+ );
16536
+ onBeforeUnmount(() => {
16537
+ nodeCache.clear();
16538
+ loadedDataCache.clear();
15824
16539
  });
15825
- const getIconSize = computed(() => {
15826
- const size = {
15827
- small: 14,
15828
- medium: 15,
15829
- large: 16
15830
- };
15831
- return size[props.size];
16540
+ init();
16541
+ __expose({
16542
+ show,
16543
+ hide: hide2,
16544
+ getSelected
15832
16545
  });
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
16546
  return (_ctx, _cache) => {
15862
16547
  return openBlock(), createBlock(unref(_sfc_main$U), {
15863
16548
  ref_key: "lewPopoverRef",
@@ -15873,61 +16558,22 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
15873
16558
  onHide: hideHandle
15874
16559
  }, {
15875
16560
  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)
16561
+ createVNode(CommonInput, {
16562
+ modelValue: modelValue.value,
16563
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
16564
+ multiple: _ctx.multiple,
16565
+ loading: unref(state).initLoading,
16566
+ clearable: _ctx.clearable,
16567
+ readonly: _ctx.readonly,
16568
+ disabled: _ctx.disabled || unref(state).initLoading,
16569
+ size: _ctx.size,
16570
+ placeholder: _ctx.placeholder,
16571
+ width: unref(any2px)(_ctx.width),
16572
+ focus: unref(state).visible,
16573
+ "format-items": unref(formatItems),
16574
+ onClear: clearHandle,
16575
+ onDelete: deleteTag
16576
+ }, null, 8, ["modelValue", "multiple", "loading", "clearable", "readonly", "disabled", "size", "placeholder", "width", "focus", "format-items"])
15931
16577
  ]),
15932
16578
  "popover-body": withCtx(() => [
15933
16579
  createElementVNode("div", {
@@ -15937,11 +16583,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
15937
16583
  renderSlot(_ctx.$slots, "header", {}, void 0, true),
15938
16584
  createVNode(Transition, { name: "fade" }, {
15939
16585
  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
- }, [
16586
+ unref(state).optionsGroup.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_1$F, [
15945
16587
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(state).optionsGroup, (oItem, oIndex) => {
15946
16588
  return openBlock(), createElementBlock("div", {
15947
16589
  key: oIndex,
@@ -15949,89 +16591,64 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
15949
16591
  style: normalizeStyle(getItemWrapperStyle(oIndex, oItem))
15950
16592
  }, [
15951
16593
  (openBlock(), createBlock(unref(VirtList), {
15952
- key: oItem[0]?.parentValuePaths?.join("-") || "root",
15953
- ref_for: true,
15954
- ref: (el) => unref(virtListRefs)[oIndex] = el,
16594
+ key: oItem?.[0]?.parentValuePaths?.join("-") || "root",
15955
16595
  class: "lew-scrollbar-hover",
15956
16596
  list: oItem,
15957
16597
  "min-size": 38,
15958
16598
  buffer: 5,
15959
16599
  "item-key": "value",
15960
- style: normalizeStyle(unref(getVirtListStyle))
16600
+ style: VIRT_LIST_STYLE
15961
16601
  }, {
15962
16602
  default: withCtx(({ itemData: templateProps }) => [
15963
16603
  createElementVNode("div", {
15964
16604
  class: "lew-cascader-item-padding",
15965
- style: normalizeStyle(unref(getItemPaddingStyle))
16605
+ style: ITEM_PADDING_STYLE,
16606
+ onClick: ($event) => selectItem(templateProps, oIndex)
15966
16607
  }, [
15967
16608
  createElementVNode("div", {
15968
- class: normalizeClass(["lew-cascader-item", getItemClass(templateProps)]),
15969
- onClick: ($event) => selectItem(templateProps, oIndex)
16609
+ class: normalizeClass(["lew-cascader-item", getItemClass(templateProps)])
15970
16610
  }, [
15971
- _ctx.free ? (openBlock(), createBlock(unref(LewCheckbox), {
15972
- key: 0,
16611
+ props.multiple ? (openBlock(), createBlock(unref(LewCheckbox), {
16612
+ key: templateProps.value,
15973
16613
  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,
16614
+ checked: props.free ? modelValue.value?.includes(templateProps.value) : unref(isSelected)(templateProps.value),
16615
+ certain: !props.free && unref(isIndeterminate)(templateProps.value),
16616
+ disabled: templateProps.disabled,
16617
+ onChange: ($event) => changeCheck(templateProps)
16618
+ }, null, 8, ["checked", "certain", "disabled", "onChange"])) : createCommentVNode("", true),
16619
+ createElementVNode("div", {
16620
+ title: templateProps.label,
16621
+ class: "lew-cascader-label",
16622
+ style: normalizeStyle({
16623
+ width: props.multiple ? "calc(100% - 36px)" : "100%"
16624
+ })
16625
+ }, toDisplayString$1(templateProps.label), 13, _hoisted_3$n),
16626
+ withDirectives(createVNode(CommonIcon, {
15983
16627
  size: 14,
15984
16628
  loading: "",
15985
16629
  class: "lew-cascader-loading-icon",
15986
16630
  type: "loader"
15987
- })) : !templateProps.isLeaf ? (openBlock(), createBlock(CommonIcon, {
15988
- key: 2,
16631
+ }, null, 512), [
16632
+ [vShow, templateProps.loading]
16633
+ ]),
16634
+ withDirectives(createVNode(CommonIcon, {
15989
16635
  size: 16,
15990
16636
  class: "lew-cascader-icon",
15991
16637
  type: "chevron-right"
15992
- })) : createCommentVNode("", true)
15993
- ], 10, _hoisted_2$t)
15994
- ], 4)
16638
+ }, null, 512), [
16639
+ [vShow, !templateProps.loading && !templateProps.isLeaf]
16640
+ ])
16641
+ ], 2)
16642
+ ], 8, _hoisted_2$s)
15995
16643
  ]),
15996
16644
  _: 2
15997
- }, 1032, ["list", "style"]))
16645
+ }, 1032, ["list"]))
15998
16646
  ], 4);
15999
16647
  }), 128))
16000
- ], 4)) : createCommentVNode("", true)
16648
+ ])) : createCommentVNode("", true)
16001
16649
  ]),
16002
16650
  _: 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)
16651
+ })
16035
16652
  ], 6)
16036
16653
  ]),
16037
16654
  _: 3
@@ -16039,7 +16656,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
16039
16656
  };
16040
16657
  }
16041
16658
  });
16042
- const LewCascader = /* @__PURE__ */ _export_sfc(_sfc_main$T, [["__scopeId", "data-v-45a2695b"]]);
16659
+ const LewCascader = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["__scopeId", "data-v-7f2ab0af"]]);
16043
16660
  const cascaderModel = {
16044
16661
  modelValue: {
16045
16662
  type: String
@@ -16194,16 +16811,16 @@ const checkboxGroupProps = {
16194
16811
  })
16195
16812
  }
16196
16813
  };
16197
- const _hoisted_1$F = {
16814
+ const _hoisted_1$E = {
16198
16815
  key: 0,
16199
16816
  class: "lew-checkbox-icon-box"
16200
16817
  };
16201
- const _hoisted_2$s = { class: "lew-checkbox-icon-certain" };
16202
- const _hoisted_3$n = {
16818
+ const _hoisted_2$r = { class: "lew-checkbox-icon-certain" };
16819
+ const _hoisted_3$m = {
16203
16820
  key: 1,
16204
16821
  class: "lew-checkbox-label"
16205
16822
  };
16206
- const _sfc_main$S = /* @__PURE__ */ defineComponent({
16823
+ const _sfc_main$R = /* @__PURE__ */ defineComponent({
16207
16824
  __name: "LewCheckbox",
16208
16825
  props: /* @__PURE__ */ mergeModels(checkboxProps, {
16209
16826
  "modelValue": {
@@ -16231,7 +16848,7 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
16231
16848
  });
16232
16849
  const getCheckboxClassName = computed(() => {
16233
16850
  const { block, round: round2, iconable, size, disabled, certain, readonly: readonly2 } = props;
16234
- const checked = modelValue.value || props.checked;
16851
+ const checked = props.checked || modelValue.value;
16235
16852
  const unicon = !iconable && block;
16236
16853
  return object2class("lew-checkbox", {
16237
16854
  block,
@@ -16254,13 +16871,19 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
16254
16871
  modelValue.value = _value;
16255
16872
  emit("change", _value);
16256
16873
  }
16874
+ watch(
16875
+ () => props.checked,
16876
+ () => {
16877
+ modelValue.value = props.checked;
16878
+ }
16879
+ );
16257
16880
  return (_ctx, _cache) => {
16258
16881
  return openBlock(), createElementBlock("div", {
16259
16882
  class: normalizeClass(["lew-checkbox", unref(getCheckboxClassName)]),
16260
16883
  onClick: withModifiers(setChecked, ["stop"])
16261
16884
  }, [
16262
- unref(shouldShowIconBox) ? (openBlock(), createElementBlock("div", _hoisted_1$F, [
16263
- withDirectives(createElementVNode("i", _hoisted_2$s, null, 512), [
16885
+ unref(shouldShowIconBox) ? (openBlock(), createElementBlock("div", _hoisted_1$E, [
16886
+ withDirectives(createElementVNode("i", _hoisted_2$r, null, 512), [
16264
16887
  [vShow, _ctx.certain]
16265
16888
  ]),
16266
16889
  createVNode(CommonIcon, {
@@ -16270,13 +16893,13 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
16270
16893
  size: unref(getIconSize)
16271
16894
  }, null, 8, ["size"])
16272
16895
  ])) : createCommentVNode("", true),
16273
- _ctx.label ? (openBlock(), createElementBlock("span", _hoisted_3$n, toDisplayString$1(_ctx.label), 1)) : createCommentVNode("", true)
16896
+ _ctx.label ? (openBlock(), createElementBlock("span", _hoisted_3$m, toDisplayString$1(_ctx.label), 1)) : createCommentVNode("", true)
16274
16897
  ], 2);
16275
16898
  };
16276
16899
  }
16277
16900
  });
16278
- const LewCheckbox = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["__scopeId", "data-v-c80437bd"]]);
16279
- const _sfc_main$R = /* @__PURE__ */ defineComponent({
16901
+ const LewCheckbox = /* @__PURE__ */ _export_sfc(_sfc_main$R, [["__scopeId", "data-v-624c4156"]]);
16902
+ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
16280
16903
  __name: "LewCheckboxGroup",
16281
16904
  props: /* @__PURE__ */ mergeModels(checkboxGroupProps, {
16282
16905
  "modelValue": {
@@ -16364,7 +16987,7 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
16364
16987
  };
16365
16988
  }
16366
16989
  });
16367
- const LewCheckboxGroup = /* @__PURE__ */ _export_sfc(_sfc_main$R, [["__scopeId", "data-v-af58b094"]]);
16990
+ const LewCheckboxGroup = /* @__PURE__ */ _export_sfc(_sfc_main$Q, [["__scopeId", "data-v-af58b094"]]);
16368
16991
  const checkboxModel = {
16369
16992
  modelValue: {
16370
16993
  type: Boolean,
@@ -16425,8 +17048,8 @@ const colorPickerProps = {
16425
17048
  })
16426
17049
  }
16427
17050
  };
16428
- const _hoisted_1$E = ["placeholder"];
16429
- const _sfc_main$Q = /* @__PURE__ */ defineComponent({
17051
+ const _hoisted_1$D = ["placeholder"];
17052
+ const _sfc_main$P = /* @__PURE__ */ defineComponent({
16430
17053
  __name: "LewColorPicker",
16431
17054
  props: /* @__PURE__ */ mergeModels(colorPickerProps, {
16432
17055
  "modelValue": { required: true },
@@ -16543,7 +17166,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
16543
17166
  placeholder: unref(getDisplayPlaceholder),
16544
17167
  onFocus: focus,
16545
17168
  onBlur: blur
16546
- }, null, 44, _hoisted_1$E), [
17169
+ }, null, 44, _hoisted_1$D), [
16547
17170
  [vModelText, modelValue.value]
16548
17171
  ])
16549
17172
  ], 6)
@@ -16551,7 +17174,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
16551
17174
  };
16552
17175
  }
16553
17176
  });
16554
- const LewColorPicker = /* @__PURE__ */ _export_sfc(_sfc_main$Q, [["__scopeId", "data-v-2dd5922b"]]);
17177
+ const LewColorPicker = /* @__PURE__ */ _export_sfc(_sfc_main$P, [["__scopeId", "data-v-2dd5922b"]]);
16555
17178
  const colorPickerModel = {
16556
17179
  modelValue: {
16557
17180
  type: String
@@ -17158,11 +17781,11 @@ function getMonthDate(year, month) {
17158
17781
  }
17159
17782
  return ret;
17160
17783
  }
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" };
17784
+ const _hoisted_1$C = { class: "lew-date" };
17785
+ const _hoisted_2$q = { class: "lew-date-control-left" };
17786
+ const _hoisted_3$l = { class: "cur-date" };
17787
+ const _hoisted_4$e = { class: "lew-date-control-right" };
17788
+ const _hoisted_5$d = { class: "lew-date-box" };
17166
17789
  const _hoisted_6$9 = { class: "lew-date-num" };
17167
17790
  const _hoisted_7$7 = ["onClick"];
17168
17791
  const _hoisted_8$6 = { class: "lew-date-label" };
@@ -17171,7 +17794,7 @@ const _hoisted_9$6 = {
17171
17794
  class: "lew-date-item-today"
17172
17795
  };
17173
17796
  const _hoisted_10$4 = { class: "lew-date-value" };
17174
- const _sfc_main$P = /* @__PURE__ */ defineComponent({
17797
+ const _sfc_main$O = /* @__PURE__ */ defineComponent({
17175
17798
  __name: "LewDate",
17176
17799
  props: {
17177
17800
  valueFormat: {
@@ -17285,14 +17908,14 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
17285
17908
  }
17286
17909
  __expose({ init, getValue: getValue2 });
17287
17910
  return (_ctx, _cache) => {
17288
- return openBlock(), createElementBlock("div", _hoisted_1$D, [
17911
+ return openBlock(), createElementBlock("div", _hoisted_1$C, [
17289
17912
  createVNode(unref(LewFlex), {
17290
17913
  x: "start",
17291
17914
  mode: "between",
17292
17915
  class: "lew-date-control"
17293
17916
  }, {
17294
17917
  default: withCtx(() => [
17295
- createElementVNode("div", _hoisted_2$r, [
17918
+ createElementVNode("div", _hoisted_2$q, [
17296
17919
  createVNode(unref(LewButton), {
17297
17920
  type: "light",
17298
17921
  color: "gray",
@@ -17318,8 +17941,8 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
17318
17941
  _: 1
17319
17942
  })
17320
17943
  ]),
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, [
17944
+ createElementVNode("div", _hoisted_3$l, toDisplayString$1(unref(dayjs)(`${unref(dateState).year}-${unref(dateState).month}`).format("YYYY-MM")), 1),
17945
+ createElementVNode("div", _hoisted_4$e, [
17323
17946
  createVNode(unref(LewButton), {
17324
17947
  type: "light",
17325
17948
  color: "gray",
@@ -17348,7 +17971,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
17348
17971
  ]),
17349
17972
  _: 1
17350
17973
  }),
17351
- createElementVNode("div", _hoisted_5$e, [
17974
+ createElementVNode("div", _hoisted_5$d, [
17352
17975
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(headDate), (item, index2) => {
17353
17976
  return openBlock(), createElementBlock("div", {
17354
17977
  key: `h${index2}`,
@@ -17374,12 +17997,12 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
17374
17997
  };
17375
17998
  }
17376
17999
  });
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"];
18000
+ const LewDate = /* @__PURE__ */ _export_sfc(_sfc_main$O, [["__scopeId", "data-v-0e16ffbf"]]);
18001
+ const _hoisted_1$B = { class: "lew-time-control" };
18002
+ const _hoisted_2$p = { class: "cur-time" };
18003
+ const _hoisted_3$k = { class: "lew-time-container" };
18004
+ const _hoisted_4$d = { class: "lew-time-column" };
18005
+ const _hoisted_5$c = ["data-value", "onClick"];
17383
18006
  const _hoisted_6$8 = ["data-text"];
17384
18007
  const _hoisted_7$6 = { class: "lew-time-column" };
17385
18008
  const _hoisted_8$5 = ["data-value", "onClick"];
@@ -17392,7 +18015,7 @@ const _hoisted_11$3 = ["data-value", "onClick"];
17392
18015
  const _hoisted_12$2 = ["data-text"];
17393
18016
  const _hoisted_13$1 = { class: "lew-time-actions" };
17394
18017
  const ITEM_HEIGHT = 28;
17395
- const _sfc_main$O = /* @__PURE__ */ defineComponent({
18018
+ const _sfc_main$N = /* @__PURE__ */ defineComponent({
17396
18019
  __name: "LewTime",
17397
18020
  props: {
17398
18021
  valueFormat: {
@@ -17666,8 +18289,8 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
17666
18289
  width: unref(showSeconds) ? "220px" : "160px"
17667
18290
  })
17668
18291
  }, [
17669
- createElementVNode("div", _hoisted_1$C, [
17670
- createElementVNode("div", _hoisted_2$q, toDisplayString$1(unref(_timeValue) || "00:00:00"), 1),
18292
+ createElementVNode("div", _hoisted_1$B, [
18293
+ createElementVNode("div", _hoisted_2$p, toDisplayString$1(unref(_timeValue) || "00:00:00"), 1),
17671
18294
  createVNode(unref(LewButton), {
17672
18295
  type: "light",
17673
18296
  color: "gray",
@@ -17680,11 +18303,11 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
17680
18303
  _: 1
17681
18304
  })
17682
18305
  ]),
17683
- createElementVNode("div", _hoisted_3$l, [
18306
+ createElementVNode("div", _hoisted_3$k, [
17684
18307
  _cache[16] || (_cache[16] = createElementVNode("div", { class: "lew-time-center-mask" }, null, -1)),
17685
18308
  _cache[17] || (_cache[17] = createElementVNode("div", { class: "lew-time-gradient-top" }, null, -1)),
17686
18309
  _cache[18] || (_cache[18] = createElementVNode("div", { class: "lew-time-gradient-bottom" }, null, -1)),
17687
- createElementVNode("div", _hoisted_4$f, [
18310
+ createElementVNode("div", _hoisted_4$d, [
17688
18311
  createElementVNode("div", {
17689
18312
  ref_key: "hourRef",
17690
18313
  ref: hourRef,
@@ -17705,7 +18328,7 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
17705
18328
  class: "lew-time-value",
17706
18329
  "data-text": hour.label
17707
18330
  }, toDisplayString$1(hour.label), 9, _hoisted_6$8)
17708
- ], 8, _hoisted_5$d);
18331
+ ], 8, _hoisted_5$c);
17709
18332
  }), 128)),
17710
18333
  _cache[11] || (_cache[11] = createElementVNode("div", { class: "lew-time-padding" }, null, -1))
17711
18334
  ], 544)
@@ -17791,15 +18414,15 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
17791
18414
  };
17792
18415
  }
17793
18416
  });
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" };
18417
+ const LewTime = /* @__PURE__ */ _export_sfc(_sfc_main$N, [["__scopeId", "data-v-ce0dbc81"]]);
18418
+ const _hoisted_1$A = { class: "lew-datetime" };
18419
+ const _hoisted_2$o = { class: "lew-datetime-content" };
18420
+ const _hoisted_3$j = { class: "lew-datetime-panel lew-datetime-date-panel" };
18421
+ const _hoisted_4$c = { class: "lew-datetime-panel lew-datetime-time-panel" };
18422
+ const _hoisted_5$b = { class: "lew-datetime-actions" };
17800
18423
  const _hoisted_6$7 = { class: "lew-datetime-actions-left" };
17801
18424
  const _hoisted_7$5 = { class: "lew-datetime-actions-right" };
17802
- const _sfc_main$N = /* @__PURE__ */ defineComponent({
18425
+ const _sfc_main$M = /* @__PURE__ */ defineComponent({
17803
18426
  __name: "LewDateTime",
17804
18427
  props: {
17805
18428
  valueFormat: {
@@ -17871,16 +18494,16 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
17871
18494
  }
17872
18495
  __expose({ init });
17873
18496
  return (_ctx, _cache) => {
17874
- return openBlock(), createElementBlock("div", _hoisted_1$B, [
17875
- createElementVNode("div", _hoisted_2$p, [
17876
- createElementVNode("div", _hoisted_3$k, [
18497
+ return openBlock(), createElementBlock("div", _hoisted_1$A, [
18498
+ createElementVNode("div", _hoisted_2$o, [
18499
+ createElementVNode("div", _hoisted_3$j, [
17877
18500
  createVNode(LewDate, {
17878
18501
  ref_key: "dateRef",
17879
18502
  ref: dateRef,
17880
18503
  "value-format": unref(dateFormat)
17881
18504
  }, null, 8, ["value-format"])
17882
18505
  ]),
17883
- createElementVNode("div", _hoisted_4$e, [
18506
+ createElementVNode("div", _hoisted_4$c, [
17884
18507
  createVNode(LewTime, {
17885
18508
  ref_key: "timeRef",
17886
18509
  ref: timeRef,
@@ -17890,7 +18513,7 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
17890
18513
  }, null, 8, ["value-format"])
17891
18514
  ])
17892
18515
  ]),
17893
- createElementVNode("div", _hoisted_5$c, [
18516
+ createElementVNode("div", _hoisted_5$b, [
17894
18517
  createElementVNode("div", _hoisted_6$7, [
17895
18518
  createVNode(unref(LewButton), {
17896
18519
  type: "light",
@@ -17934,12 +18557,12 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
17934
18557
  };
17935
18558
  }
17936
18559
  });
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" };
18560
+ const LewDateTime = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["__scopeId", "data-v-de4090a5"]]);
18561
+ const _hoisted_1$z = { class: "lew-month" };
18562
+ const _hoisted_2$n = { class: "lew-month-control-left" };
18563
+ const _hoisted_3$i = { class: "cur-year" };
18564
+ const _hoisted_4$b = { class: "lew-month-control-right" };
18565
+ const _hoisted_5$a = { class: "lew-month-list" };
17943
18566
  const _hoisted_6$6 = ["onClick"];
17944
18567
  const _hoisted_7$4 = { class: "lew-month-label" };
17945
18568
  const _hoisted_8$4 = {
@@ -17947,7 +18570,7 @@ const _hoisted_8$4 = {
17947
18570
  class: "lew-month-item-current"
17948
18571
  };
17949
18572
  const _hoisted_9$4 = { class: "lew-month-value" };
17950
- const _sfc_main$M = /* @__PURE__ */ defineComponent({
18573
+ const _sfc_main$L = /* @__PURE__ */ defineComponent({
17951
18574
  __name: "LewMonth",
17952
18575
  props: {
17953
18576
  valueFormat: {
@@ -18022,14 +18645,14 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
18022
18645
  }
18023
18646
  __expose({ init });
18024
18647
  return (_ctx, _cache) => {
18025
- return openBlock(), createElementBlock("div", _hoisted_1$A, [
18648
+ return openBlock(), createElementBlock("div", _hoisted_1$z, [
18026
18649
  createVNode(unref(LewFlex), {
18027
18650
  x: "start",
18028
18651
  mode: "between",
18029
18652
  class: "lew-month-control"
18030
18653
  }, {
18031
18654
  default: withCtx(() => [
18032
- createElementVNode("div", _hoisted_2$o, [
18655
+ createElementVNode("div", _hoisted_2$n, [
18033
18656
  createVNode(unref(LewButton), {
18034
18657
  type: "light",
18035
18658
  color: "gray",
@@ -18043,8 +18666,8 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
18043
18666
  _: 1
18044
18667
  })
18045
18668
  ]),
18046
- createElementVNode("div", _hoisted_3$j, toDisplayString$1(unref(monthState).year), 1),
18047
- createElementVNode("div", _hoisted_4$d, [
18669
+ createElementVNode("div", _hoisted_3$i, toDisplayString$1(unref(monthState).year), 1),
18670
+ createElementVNode("div", _hoisted_4$b, [
18048
18671
  createVNode(unref(LewButton), {
18049
18672
  type: "light",
18050
18673
  color: "gray",
@@ -18061,7 +18684,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
18061
18684
  ]),
18062
18685
  _: 1
18063
18686
  }),
18064
- createElementVNode("div", _hoisted_5$b, [
18687
+ createElementVNode("div", _hoisted_5$a, [
18065
18688
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(monthList), (month) => {
18066
18689
  return openBlock(), createElementBlock("div", {
18067
18690
  key: month.value,
@@ -18079,12 +18702,12 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
18079
18702
  };
18080
18703
  }
18081
18704
  });
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" };
18705
+ const LewMonth = /* @__PURE__ */ _export_sfc(_sfc_main$L, [["__scopeId", "data-v-0cdc6c13"]]);
18706
+ const _hoisted_1$y = { class: "lew-quarter" };
18707
+ const _hoisted_2$m = { class: "lew-quarter-control-left" };
18708
+ const _hoisted_3$h = { class: "cur-year" };
18709
+ const _hoisted_4$a = { class: "lew-quarter-control-right" };
18710
+ const _hoisted_5$9 = { class: "lew-quarter-list" };
18088
18711
  const _hoisted_6$5 = ["onClick"];
18089
18712
  const _hoisted_7$3 = { class: "lew-quarter-label" };
18090
18713
  const _hoisted_8$3 = {
@@ -18094,7 +18717,7 @@ const _hoisted_8$3 = {
18094
18717
  const _hoisted_9$3 = { class: "lew-quarter-value" };
18095
18718
  const _hoisted_10$2 = { class: "lew-quarter-main" };
18096
18719
  const _hoisted_11$2 = { class: "lew-quarter-months" };
18097
- const _sfc_main$L = /* @__PURE__ */ defineComponent({
18720
+ const _sfc_main$K = /* @__PURE__ */ defineComponent({
18098
18721
  __name: "LewQuarter",
18099
18722
  props: {
18100
18723
  valueFormat: {
@@ -18160,14 +18783,14 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
18160
18783
  }
18161
18784
  __expose({ init });
18162
18785
  return (_ctx, _cache) => {
18163
- return openBlock(), createElementBlock("div", _hoisted_1$z, [
18786
+ return openBlock(), createElementBlock("div", _hoisted_1$y, [
18164
18787
  createVNode(unref(LewFlex), {
18165
18788
  x: "start",
18166
18789
  mode: "between",
18167
18790
  class: "lew-quarter-control"
18168
18791
  }, {
18169
18792
  default: withCtx(() => [
18170
- createElementVNode("div", _hoisted_2$n, [
18793
+ createElementVNode("div", _hoisted_2$m, [
18171
18794
  createVNode(unref(LewButton), {
18172
18795
  type: "light",
18173
18796
  color: "gray",
@@ -18181,8 +18804,8 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
18181
18804
  _: 1
18182
18805
  })
18183
18806
  ]),
18184
- createElementVNode("div", _hoisted_3$i, toDisplayString$1(unref(currentYear)), 1),
18185
- createElementVNode("div", _hoisted_4$c, [
18807
+ createElementVNode("div", _hoisted_3$h, toDisplayString$1(unref(currentYear)), 1),
18808
+ createElementVNode("div", _hoisted_4$a, [
18186
18809
  createVNode(unref(LewButton), {
18187
18810
  type: "light",
18188
18811
  color: "gray",
@@ -18199,7 +18822,7 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
18199
18822
  ]),
18200
18823
  _: 1
18201
18824
  }),
18202
- createElementVNode("div", _hoisted_5$a, [
18825
+ createElementVNode("div", _hoisted_5$9, [
18203
18826
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(quarterList), (item) => {
18204
18827
  return openBlock(), createElementBlock("div", {
18205
18828
  key: item.value,
@@ -18220,12 +18843,12 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
18220
18843
  };
18221
18844
  }
18222
18845
  });
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" };
18846
+ const LewQuarter = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["__scopeId", "data-v-8a82e927"]]);
18847
+ const _hoisted_1$x = { class: "lew-year" };
18848
+ const _hoisted_2$l = { class: "lew-year-control-left" };
18849
+ const _hoisted_3$g = { class: "cur-decade" };
18850
+ const _hoisted_4$9 = { class: "lew-year-control-right" };
18851
+ const _hoisted_5$8 = { class: "lew-year-list" };
18229
18852
  const _hoisted_6$4 = ["onClick"];
18230
18853
  const _hoisted_7$2 = { class: "lew-year-label" };
18231
18854
  const _hoisted_8$2 = {
@@ -18233,7 +18856,7 @@ const _hoisted_8$2 = {
18233
18856
  class: "lew-year-item-current"
18234
18857
  };
18235
18858
  const _hoisted_9$2 = { class: "lew-year-value" };
18236
- const _sfc_main$K = /* @__PURE__ */ defineComponent({
18859
+ const _sfc_main$J = /* @__PURE__ */ defineComponent({
18237
18860
  __name: "LewYear",
18238
18861
  props: {
18239
18862
  valueFormat: {
@@ -18303,14 +18926,14 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
18303
18926
  }
18304
18927
  __expose({ init });
18305
18928
  return (_ctx, _cache) => {
18306
- return openBlock(), createElementBlock("div", _hoisted_1$y, [
18929
+ return openBlock(), createElementBlock("div", _hoisted_1$x, [
18307
18930
  createVNode(unref(LewFlex), {
18308
18931
  x: "start",
18309
18932
  mode: "between",
18310
18933
  class: "lew-year-control"
18311
18934
  }, {
18312
18935
  default: withCtx(() => [
18313
- createElementVNode("div", _hoisted_2$m, [
18936
+ createElementVNode("div", _hoisted_2$l, [
18314
18937
  createVNode(unref(LewButton), {
18315
18938
  type: "light",
18316
18939
  color: "gray",
@@ -18324,8 +18947,8 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
18324
18947
  _: 1
18325
18948
  })
18326
18949
  ]),
18327
- createElementVNode("div", _hoisted_3$h, toDisplayString$1(unref(yearState).startYear) + " - " + toDisplayString$1(unref(yearState).startYear + 11), 1),
18328
- createElementVNode("div", _hoisted_4$b, [
18950
+ createElementVNode("div", _hoisted_3$g, toDisplayString$1(unref(yearState).startYear) + " - " + toDisplayString$1(unref(yearState).startYear + 11), 1),
18951
+ createElementVNode("div", _hoisted_4$9, [
18329
18952
  createVNode(unref(LewButton), {
18330
18953
  type: "light",
18331
18954
  color: "gray",
@@ -18342,7 +18965,7 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
18342
18965
  ]),
18343
18966
  _: 1
18344
18967
  }),
18345
- createElementVNode("div", _hoisted_5$9, [
18968
+ createElementVNode("div", _hoisted_5$8, [
18346
18969
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(yearList), (year) => {
18347
18970
  return openBlock(), createElementBlock("div", {
18348
18971
  key: year,
@@ -18360,9 +18983,9 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
18360
18983
  };
18361
18984
  }
18362
18985
  });
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({
18986
+ const LewYear = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["__scopeId", "data-v-a748ea05"]]);
18987
+ const _hoisted_1$w = { class: "lew-panel" };
18988
+ const _sfc_main$I = /* @__PURE__ */ defineComponent({
18366
18989
  __name: "LewPanel",
18367
18990
  props: {
18368
18991
  type: {
@@ -18399,7 +19022,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
18399
19022
  }
18400
19023
  __expose({ init });
18401
19024
  return (_ctx, _cache) => {
18402
- return openBlock(), createElementBlock("div", _hoisted_1$x, [
19025
+ return openBlock(), createElementBlock("div", _hoisted_1$w, [
18403
19026
  (openBlock(), createBlock(resolveDynamicComponent(unref(currentComponent)), {
18404
19027
  ref_key: "currentComponentRef",
18405
19028
  ref: currentComponentRef,
@@ -18479,10 +19102,10 @@ const datePickerProps = {
18479
19102
  })
18480
19103
  }
18481
19104
  };
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({
19105
+ const _hoisted_1$v = { class: "lew-date-picker-view" };
19106
+ const _hoisted_2$k = ["placeholder", "readonly", "disabled"];
19107
+ const _hoisted_3$f = ["title", "onClick"];
19108
+ const _sfc_main$H = /* @__PURE__ */ defineComponent({
18486
19109
  __name: "LewDatePicker",
18487
19110
  props: /* @__PURE__ */ mergeModels(datePickerProps, {
18488
19111
  "modelValue": { required: true },
@@ -18661,7 +19284,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
18661
19284
  onHide: hideHandle
18662
19285
  }, {
18663
19286
  trigger: withCtx(() => [
18664
- createElementVNode("div", _hoisted_1$w, [
19287
+ createElementVNode("div", _hoisted_1$v, [
18665
19288
  createElementVNode("div", {
18666
19289
  class: normalizeClass(["lew-date-picker", unref(lewDatePickerClassNames)]),
18667
19290
  style: normalizeStyle(unref(getDatePickerInputStyle))
@@ -18679,7 +19302,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
18679
19302
  onBlur: handleInputBlur,
18680
19303
  onInput: handleInput,
18681
19304
  onKeydown: handleKeydown
18682
- }, null, 40, _hoisted_2$l), [
19305
+ }, null, 40, _hoisted_2$k), [
18683
19306
  [vModelText, modelValue.value]
18684
19307
  ]),
18685
19308
  createVNode(CommonIcon, {
@@ -18726,14 +19349,14 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
18726
19349
  unref(dayjs)(modelValue.value).isSame(item.value, "day") ? "lew-date-picker-presets-item-active" : ""
18727
19350
  ]]),
18728
19351
  onClick: ($event) => selectPresets(item)
18729
- }, toDisplayString$1(item.label), 11, _hoisted_3$g);
19352
+ }, toDisplayString$1(item.label), 11, _hoisted_3$f);
18730
19353
  }), 128))
18731
19354
  ]),
18732
19355
  _: 1
18733
19356
  })) : createCommentVNode("", true),
18734
19357
  createVNode(_component_lew_flex, { class: "lew-date-picker-date-panel" }, {
18735
19358
  default: withCtx(() => [
18736
- createVNode(_sfc_main$J, mergeProps({
19359
+ createVNode(_sfc_main$I, mergeProps({
18737
19360
  ref_key: "lewPanelRef",
18738
19361
  ref: lewPanelRef,
18739
19362
  type: unref(getPanelType)
@@ -18753,7 +19376,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
18753
19376
  };
18754
19377
  }
18755
19378
  });
18756
- const LewDatePicker = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["__scopeId", "data-v-1df6eca7"]]);
19379
+ const LewDatePicker = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["__scopeId", "data-v-1df6eca7"]]);
18757
19380
  const datePickerModel = {
18758
19381
  modelValue: {
18759
19382
  type: String
@@ -18887,11 +19510,11 @@ const dateRangeProps = {
18887
19510
  })
18888
19511
  }
18889
19512
  };
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" };
19513
+ const _hoisted_1$u = { class: "lew-date-range" };
19514
+ const _hoisted_2$j = { class: "lew-date" };
19515
+ const _hoisted_3$e = { class: "lew-date-control-left" };
19516
+ const _hoisted_4$8 = { class: "cur-date" };
19517
+ const _hoisted_5$7 = { class: "lew-date-control-right" };
18895
19518
  const _hoisted_6$3 = { class: "lew-date-box" };
18896
19519
  const _hoisted_7$1 = { class: "lew-date-num" };
18897
19520
  const _hoisted_8$1 = ["onClick", "onMouseenter"];
@@ -18910,7 +19533,7 @@ const _hoisted_17 = {
18910
19533
  key: 0,
18911
19534
  class: "lew-date-item-today"
18912
19535
  };
18913
- const _sfc_main$H = /* @__PURE__ */ defineComponent({
19536
+ const _sfc_main$G = /* @__PURE__ */ defineComponent({
18914
19537
  __name: "LewDateRange",
18915
19538
  props: /* @__PURE__ */ mergeModels(dateRangeProps, {
18916
19539
  "modelValue": {},
@@ -19173,15 +19796,15 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
19173
19796
  ];
19174
19797
  });
19175
19798
  return (_ctx, _cache) => {
19176
- return openBlock(), createElementBlock("div", _hoisted_1$v, [
19177
- createElementVNode("div", _hoisted_2$k, [
19799
+ return openBlock(), createElementBlock("div", _hoisted_1$u, [
19800
+ createElementVNode("div", _hoisted_2$j, [
19178
19801
  createVNode(unref(LewFlex), {
19179
19802
  x: "start",
19180
19803
  mode: "between",
19181
19804
  class: "lew-date-control"
19182
19805
  }, {
19183
19806
  default: withCtx(() => [
19184
- createElementVNode("div", _hoisted_3$f, [
19807
+ createElementVNode("div", _hoisted_3$e, [
19185
19808
  createVNode(unref(LewButton), {
19186
19809
  type: "light",
19187
19810
  color: "gray",
@@ -19207,8 +19830,8 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
19207
19830
  _: 1
19208
19831
  })
19209
19832
  ]),
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, [
19833
+ createElementVNode("div", _hoisted_4$8, toDisplayString$1(unref(dayjs)(`${unref(dateState).year1}-${unref(dateState).month1}`).format("YYYY-MM")), 1),
19834
+ createElementVNode("div", _hoisted_5$7, [
19212
19835
  createVNode(unref(LewButton), {
19213
19836
  type: "light",
19214
19837
  color: "gray",
@@ -19360,18 +19983,18 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
19360
19983
  };
19361
19984
  }
19362
19985
  });
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 = {
19986
+ const LewDateRange = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-7acc9fdc"]]);
19987
+ const _hoisted_1$t = { class: "lew-date-range-picker-view" };
19988
+ const _hoisted_2$i = {
19366
19989
  key: 0,
19367
19990
  class: "lew-date-range-picker-placeholder"
19368
19991
  };
19369
- const _hoisted_3$e = {
19992
+ const _hoisted_3$d = {
19370
19993
  key: 1,
19371
19994
  class: "lew-date-range-picker-dateValue lew-date-range-picker-start"
19372
19995
  };
19373
- const _hoisted_4$9 = { class: "lew-date-range-picker-mid" };
19374
- const _hoisted_5$7 = {
19996
+ const _hoisted_4$7 = { class: "lew-date-range-picker-mid" };
19997
+ const _hoisted_5$6 = {
19375
19998
  key: 2,
19376
19999
  class: "lew-date-range-picker-placeholder"
19377
20000
  };
@@ -19379,7 +20002,7 @@ const _hoisted_6$2 = {
19379
20002
  key: 3,
19380
20003
  class: "lew-date-range-picker-dateValue lew-date-range-picker-end"
19381
20004
  };
19382
- const _sfc_main$G = /* @__PURE__ */ defineComponent({
20005
+ const _sfc_main$F = /* @__PURE__ */ defineComponent({
19383
20006
  __name: "LewDateRangePicker",
19384
20007
  props: /* @__PURE__ */ mergeModels(dateRangePickerProps, {
19385
20008
  "modelValue": { required: true },
@@ -19497,7 +20120,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
19497
20120
  onHide: hideHandle
19498
20121
  }, {
19499
20122
  trigger: withCtx(() => [
19500
- createElementVNode("div", _hoisted_1$u, [
20123
+ createElementVNode("div", _hoisted_1$t, [
19501
20124
  createElementVNode("div", {
19502
20125
  class: normalizeClass(["lew-date-range-picker", unref(lewDateRangeClassNames)]),
19503
20126
  style: normalizeStyle(unref(getDateRangePickerInputStyle))
@@ -19510,14 +20133,14 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
19510
20133
  })
19511
20134
  }, {
19512
20135
  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, [
20136
+ !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)),
20137
+ createElementVNode("div", _hoisted_4$7, [
19515
20138
  createVNode(CommonIcon, {
19516
20139
  size: 14,
19517
20140
  type: "minus"
19518
20141
  })
19519
20142
  ]),
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)),
20143
+ !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
20144
  createVNode(CommonIcon, {
19522
20145
  class: normalizeClass(["lew-date-range-picker-icon-calendar", {
19523
20146
  "lew-date-range-picker-icon-calendar-hide": unref(checkClear)
@@ -19560,7 +20183,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
19560
20183
  };
19561
20184
  }
19562
20185
  });
19563
- const LewDateRangePicker = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-38041cdb"]]);
20186
+ const LewDateRangePicker = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["__scopeId", "data-v-38041cdb"]]);
19564
20187
  const formEmits = {
19565
20188
  change: (value) => value,
19566
20189
  mounted: () => true
@@ -21172,11 +21795,11 @@ Parser.prototype.isOperatorEnabled = function(op) {
21172
21795
  var operators = this.options.operators || {};
21173
21796
  return !(optionName in operators) || !!operators[optionName];
21174
21797
  };
21175
- const _hoisted_1$t = {
21798
+ const _hoisted_1$s = {
21176
21799
  key: 0,
21177
21800
  class: "lew-label-box"
21178
21801
  };
21179
- const _sfc_main$F = /* @__PURE__ */ defineComponent({
21802
+ const _sfc_main$E = /* @__PURE__ */ defineComponent({
21180
21803
  __name: "LewFormItem",
21181
21804
  props: /* @__PURE__ */ mergeModels(formItemProps, {
21182
21805
  "modelValue": { default: void 0 },
@@ -21196,7 +21819,6 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
21196
21819
  "radio-group": LewRadioGroup,
21197
21820
  "checkbox": LewCheckbox,
21198
21821
  "select": LewSelect,
21199
- "select-multiple": LewSelectMultiple,
21200
21822
  "date-picker": LewDatePicker,
21201
21823
  "date-range-picker": LewDateRangePicker,
21202
21824
  "tabs": LewTabs,
@@ -21312,7 +21934,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
21312
21934
  style: normalizeStyle(_ctx.direction === "x" ? `width:${unref(any2px)(_ctx.labelWidth)}` : ""),
21313
21935
  class: "lew-label-box-wrapper"
21314
21936
  }, [
21315
- _ctx.as ? (openBlock(), createElementBlock("div", _hoisted_1$t, [
21937
+ _ctx.as ? (openBlock(), createElementBlock("div", _hoisted_1$s, [
21316
21938
  _ctx.required && _ctx.label ? (openBlock(), createBlock(_sfc_main$18, {
21317
21939
  key: 0,
21318
21940
  size: unref(requiredIconSizeMap)[_ctx.size]
@@ -21361,8 +21983,8 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
21361
21983
  };
21362
21984
  }
21363
21985
  });
21364
- const LewFormItem = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["__scopeId", "data-v-df6f6e1c"]]);
21365
- const _sfc_main$E = /* @__PURE__ */ defineComponent({
21986
+ const LewFormItem = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__scopeId", "data-v-0c8c6aeb"]]);
21987
+ const _sfc_main$D = /* @__PURE__ */ defineComponent({
21366
21988
  __name: "LewForm",
21367
21989
  props: formProps,
21368
21990
  emits: formEmits,
@@ -21525,7 +22147,7 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
21525
22147
  };
21526
22148
  }
21527
22149
  });
21528
- const LewForm = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__scopeId", "data-v-d62eca7f"]]);
22150
+ const LewForm = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-d62eca7f"]]);
21529
22151
  const inputEmits = {
21530
22152
  change: (value) => value,
21531
22153
  input: (value) => value,
@@ -21736,20 +22358,20 @@ const inputProps = {
21736
22358
  })
21737
22359
  }
21738
22360
  };
21739
- const _hoisted_1$s = {
22361
+ const _hoisted_1$r = {
21740
22362
  key: 0,
21741
22363
  class: "lew-input-prefixes"
21742
22364
  };
21743
- const _hoisted_2$i = { key: 0 };
21744
- const _hoisted_3$d = {
22365
+ const _hoisted_2$h = { key: 0 };
22366
+ const _hoisted_3$c = {
21745
22367
  key: 1,
21746
22368
  class: "lew-input-prefixes-icon"
21747
22369
  };
21748
- const _hoisted_4$8 = {
22370
+ const _hoisted_4$6 = {
21749
22371
  key: 2,
21750
22372
  class: "lew-input-prefixes-select"
21751
22373
  };
21752
- const _hoisted_5$6 = ["disabled", "placeholder", "type", "readonly", "maxlength"];
22374
+ const _hoisted_5$5 = ["disabled", "placeholder", "type", "readonly", "maxlength"];
21753
22375
  const _hoisted_6$1 = {
21754
22376
  key: 0,
21755
22377
  class: "lew-input-auto-width"
@@ -21775,7 +22397,7 @@ const _hoisted_12 = {
21775
22397
  key: 2,
21776
22398
  class: "lew-input-suffix-select"
21777
22399
  };
21778
- const _sfc_main$D = /* @__PURE__ */ defineComponent({
22400
+ const _sfc_main$C = /* @__PURE__ */ defineComponent({
21779
22401
  __name: "LewInput",
21780
22402
  props: /* @__PURE__ */ mergeModels(inputProps, {
21781
22403
  "modelValue": { required: true },
@@ -21820,19 +22442,19 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
21820
22442
  emit("clear");
21821
22443
  emit("change", void 0);
21822
22444
  }
21823
- const toFocus = () => lewInputRef.value?.focus();
21824
- const toBlur = () => lewInputRef.value?.blur();
22445
+ const focus = () => lewInputRef.value?.focus();
22446
+ const blur = () => lewInputRef.value?.blur();
21825
22447
  function showPasswordFn() {
21826
22448
  _type.value = _type.value === "text" ? "password" : "text";
21827
22449
  }
21828
- function focus(e) {
22450
+ function _focus(e) {
21829
22451
  if (props.selectByFocus) {
21830
22452
  e.currentTarget?.select();
21831
22453
  }
21832
22454
  emit("focus", e);
21833
22455
  isFocus.value = true;
21834
22456
  }
21835
- function blur(e) {
22457
+ function _blur(e) {
21836
22458
  emit("blur", e);
21837
22459
  isFocus.value = false;
21838
22460
  }
@@ -21930,22 +22552,22 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
21930
22552
  if (timer)
21931
22553
  clearTimeout(timer);
21932
22554
  });
21933
- __expose({ toFocus, toBlur });
22555
+ __expose({ focus, blur });
21934
22556
  return (_ctx, _cache) => {
21935
22557
  const _directive_tooltip = resolveDirective("tooltip");
21936
22558
  return openBlock(), createElementBlock("div", {
21937
22559
  class: normalizeClass(["lew-input-view", unref(getInputClassNames)]),
21938
22560
  style: normalizeStyle({ width: _ctx.autoWidth ? "auto" : unref(any2px)(_ctx.width) })
21939
22561
  }, [
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, [
22562
+ _ctx.prefixes ? withDirectives((openBlock(), createElementBlock("div", _hoisted_1$r, [
22563
+ _ctx.prefixes === "text" ? (openBlock(), createElementBlock("div", _hoisted_2$h, toDisplayString$1(prefixValue.value), 1)) : createCommentVNode("", true),
22564
+ _ctx.prefixes === "icon" ? (openBlock(), createElementBlock("div", _hoisted_3$c, [
21943
22565
  createVNode(CommonIcon, {
21944
22566
  size: unref(getIconSize),
21945
22567
  type: prefixValue.value
21946
22568
  }, null, 8, ["size", "type"])
21947
22569
  ])) : createCommentVNode("", true),
21948
- _ctx.prefixes === "select" ? (openBlock(), createElementBlock("div", _hoisted_4$8, [
22570
+ _ctx.prefixes === "select" ? (openBlock(), createElementBlock("div", _hoisted_4$6, [
21949
22571
  createVNode(unref(_sfc_main$7), {
21950
22572
  placement: "bottom",
21951
22573
  trigger: "click",
@@ -22016,9 +22638,9 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
22016
22638
  maxlength: _ctx.maxLength,
22017
22639
  onInput: handleInput,
22018
22640
  onChange: handleChange,
22019
- onBlur: blur,
22020
- onFocus: focus
22021
- }, null, 44, _hoisted_5$6), [
22641
+ onBlur: _blur,
22642
+ onFocus: _focus
22643
+ }, null, 44, _hoisted_5$5), [
22022
22644
  [vModelDynamic, modelValue.value]
22023
22645
  ]),
22024
22646
  _ctx.autoWidth ? (openBlock(), createElementBlock("label", _hoisted_6$1, toDisplayString$1(modelValue.value), 1)) : createCommentVNode("", true),
@@ -22127,7 +22749,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
22127
22749
  };
22128
22750
  }
22129
22751
  });
22130
- const LewInput = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-8127795f"]]);
22752
+ const LewInput = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-59f05e76"]]);
22131
22753
  const inputNumberEmits = {
22132
22754
  change: (value) => value,
22133
22755
  input: (value) => value
@@ -22223,8 +22845,8 @@ const inputNumberProps = {
22223
22845
  })
22224
22846
  }
22225
22847
  };
22226
- const _hoisted_1$r = ["placeholder", "min", "max", "step"];
22227
- const _sfc_main$C = /* @__PURE__ */ defineComponent({
22848
+ const _hoisted_1$q = ["placeholder", "min", "max", "step"];
22849
+ const _sfc_main$B = /* @__PURE__ */ defineComponent({
22228
22850
  __name: "LewInputNumber",
22229
22851
  props: /* @__PURE__ */ mergeModels(inputNumberProps, {
22230
22852
  "modelValue": { required: true },
@@ -22242,7 +22864,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
22242
22864
  const lewInputRef = ref();
22243
22865
  const isFocus = ref(false);
22244
22866
  const validationMessage = ref("");
22245
- function toFocus() {
22867
+ function focus() {
22246
22868
  lewInputRef.value?.focus();
22247
22869
  }
22248
22870
  function focusFn(e) {
@@ -22338,7 +22960,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
22338
22960
  function validCheck() {
22339
22961
  return (lewInputRef.value && lewInputRef.value.validationMessage || "").length === 0;
22340
22962
  }
22341
- __expose({ toFocus, validCheck });
22963
+ __expose({ focus, validCheck });
22342
22964
  return (_ctx, _cache) => {
22343
22965
  const _directive_tooltip = resolveDirective("tooltip");
22344
22966
  return openBlock(), createElementBlock("div", {
@@ -22363,7 +22985,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
22363
22985
  onInput: inputFn,
22364
22986
  onChange: changeFn,
22365
22987
  onFocus: focusFn
22366
- }, null, 44, _hoisted_1$r), [
22988
+ }, null, 44, _hoisted_1$q), [
22367
22989
  [vModelText, modelValue.value],
22368
22990
  [_directive_tooltip, {
22369
22991
  content: unref(validationMessage),
@@ -22403,7 +23025,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
22403
23025
  };
22404
23026
  }
22405
23027
  });
22406
- const LewInputNumber = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-3760ac9e"]]);
23028
+ const LewInputNumber = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["__scopeId", "data-v-4c6a9fe2"]]);
22407
23029
  const inputTableEmits = {
22408
23030
  change: (value) => value
22409
23031
  };
@@ -22574,8 +23196,8 @@ const formModalProps = {
22574
23196
  default: () => true
22575
23197
  }
22576
23198
  };
22577
- const _hoisted_1$q = { class: "lew-form-modal lew-scrollbar" };
22578
- const _sfc_main$B = /* @__PURE__ */ defineComponent({
23199
+ const _hoisted_1$p = { class: "lew-form-modal lew-scrollbar" };
23200
+ const _sfc_main$A = /* @__PURE__ */ defineComponent({
22579
23201
  __name: "FormModal",
22580
23202
  props: formModalProps,
22581
23203
  emits: ["addSuccess", "editSuccess"],
@@ -22641,7 +23263,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
22641
23263
  title: `${unref(isEditing) ? unref(locale).t("inputTable.editTitle") : unref(locale).t("inputTable.modelTitle")}`
22642
23264
  }, {
22643
23265
  default: withCtx(() => [
22644
- createElementVNode("div", _hoisted_1$q, [
23266
+ createElementVNode("div", _hoisted_1$p, [
22645
23267
  createVNode(unref(LewForm), {
22646
23268
  ref_key: "formRef",
22647
23269
  ref: formRef,
@@ -22657,8 +23279,8 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
22657
23279
  };
22658
23280
  }
22659
23281
  });
22660
- const FormModal = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["__scopeId", "data-v-c7f7aaf1"]]);
22661
- const _sfc_main$A = /* @__PURE__ */ defineComponent({
23282
+ const FormModal = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["__scopeId", "data-v-c7f7aaf1"]]);
23283
+ const _sfc_main$z = /* @__PURE__ */ defineComponent({
22662
23284
  __name: "LewInputTable",
22663
23285
  props: /* @__PURE__ */ mergeModels(inputTableProps, {
22664
23286
  "modelValue": { required: true },
@@ -22952,7 +23574,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
22952
23574
  };
22953
23575
  }
22954
23576
  });
22955
- const LewInputTable = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["__scopeId", "data-v-c4622421"]]);
23577
+ const LewInputTable = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__scopeId", "data-v-c4622421"]]);
22956
23578
  const inputTagEmits = {
22957
23579
  remove: (tag, index2) => ({ tag, index: index2 }),
22958
23580
  change: (value) => value,
@@ -23033,7 +23655,7 @@ const inputTagProps = {
23033
23655
  })
23034
23656
  }
23035
23657
  };
23036
- const _sfc_main$z = /* @__PURE__ */ defineComponent({
23658
+ const _sfc_main$y = /* @__PURE__ */ defineComponent({
23037
23659
  __name: "LewInputTag",
23038
23660
  props: /* @__PURE__ */ mergeModels(inputTagProps, {
23039
23661
  "modelValue": {},
@@ -23059,8 +23681,8 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
23059
23681
  }
23060
23682
  isInputActive.value = true;
23061
23683
  nextTick(() => {
23062
- if (lewInputRef.value && typeof lewInputRef.value.toFocus === "function") {
23063
- lewInputRef.value.toFocus();
23684
+ if (lewInputRef.value && typeof lewInputRef.value?.focus === "function") {
23685
+ lewInputRef.value?.focus();
23064
23686
  }
23065
23687
  });
23066
23688
  originalKeydownHandler = document.onkeydown;
@@ -23097,8 +23719,8 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
23097
23719
  }
23098
23720
  }
23099
23721
  if (keyCode === "Enter" || keyCode === "NumpadEnter") {
23100
- if (lewInputRef.value && typeof lewInputRef.value.toBlur === "function") {
23101
- lewInputRef.value.toBlur();
23722
+ if (lewInputRef.value && typeof lewInputRef.value.blur === "function") {
23723
+ lewInputRef.value.blur();
23102
23724
  }
23103
23725
  }
23104
23726
  }
@@ -23260,7 +23882,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
23260
23882
  };
23261
23883
  }
23262
23884
  });
23263
- const LewInputTag = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__scopeId", "data-v-b91654f1"]]);
23885
+ const LewInputTag = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["__scopeId", "data-v-2353f614"]]);
23264
23886
  const radioEmits = {
23265
23887
  change: () => true
23266
23888
  };
@@ -23413,15 +24035,15 @@ const radioGroupProps = {
23413
24035
  })
23414
24036
  }
23415
24037
  };
23416
- const _hoisted_1$p = {
24038
+ const _hoisted_1$o = {
23417
24039
  key: 0,
23418
24040
  class: "lew-radio-icon-box"
23419
24041
  };
23420
- const _hoisted_2$h = {
24042
+ const _hoisted_2$g = {
23421
24043
  key: 1,
23422
24044
  class: "lew-radio-label"
23423
24045
  };
23424
- const _sfc_main$y = /* @__PURE__ */ defineComponent({
24046
+ const _sfc_main$x = /* @__PURE__ */ defineComponent({
23425
24047
  __name: "LewRadio",
23426
24048
  props: radioProps,
23427
24049
  emits: radioEmits,
@@ -23462,7 +24084,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
23462
24084
  class: normalizeClass(["lew-radio", unref(getRadioClassName)]),
23463
24085
  onClick: withModifiers(setChecked, ["stop"])
23464
24086
  }, [
23465
- _ctx.iconable || !_ctx.iconable && !_ctx.block ? (openBlock(), createElementBlock("div", _hoisted_1$p, [
24087
+ _ctx.iconable || !_ctx.iconable && !_ctx.block ? (openBlock(), createElementBlock("div", _hoisted_1$o, [
23466
24088
  createVNode(CommonIcon, {
23467
24089
  "stroke-width": 4,
23468
24090
  class: "lew-radio-icon",
@@ -23470,13 +24092,13 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
23470
24092
  size: unref(getIconSize)
23471
24093
  }, null, 8, ["size"])
23472
24094
  ])) : createCommentVNode("", true),
23473
- _ctx.label ? (openBlock(), createElementBlock("span", _hoisted_2$h, toDisplayString$1(_ctx.label), 1)) : createCommentVNode("", true)
24095
+ _ctx.label ? (openBlock(), createElementBlock("span", _hoisted_2$g, toDisplayString$1(_ctx.label), 1)) : createCommentVNode("", true)
23474
24096
  ], 2);
23475
24097
  };
23476
24098
  }
23477
24099
  });
23478
- const LewRadio = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["__scopeId", "data-v-aaf2d10e"]]);
23479
- const _sfc_main$x = /* @__PURE__ */ defineComponent({
24100
+ const LewRadio = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["__scopeId", "data-v-aaf2d10e"]]);
24101
+ const _sfc_main$w = /* @__PURE__ */ defineComponent({
23480
24102
  __name: "LewRadioGroup",
23481
24103
  props: /* @__PURE__ */ mergeModels(radioGroupProps, {
23482
24104
  "modelValue": {},
@@ -23527,7 +24149,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
23527
24149
  };
23528
24150
  }
23529
24151
  });
23530
- const LewRadioGroup = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["__scopeId", "data-v-b9846701"]]);
24152
+ const LewRadioGroup = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["__scopeId", "data-v-b9846701"]]);
23531
24153
  const rateEmits = {
23532
24154
  change: (value) => value
23533
24155
  };
@@ -23581,8 +24203,8 @@ const rateProps = {
23581
24203
  })
23582
24204
  }
23583
24205
  };
23584
- const _hoisted_1$o = ["onMousemove", "onClick"];
23585
- const _sfc_main$w = /* @__PURE__ */ defineComponent({
24206
+ const _hoisted_1$n = ["onMousemove", "onClick"];
24207
+ const _sfc_main$v = /* @__PURE__ */ defineComponent({
23586
24208
  __name: "LewRate",
23587
24209
  props: /* @__PURE__ */ mergeModels(rateProps, {
23588
24210
  "modelValue": { required: true },
@@ -23706,7 +24328,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
23706
24328
  trigger: "hover"
23707
24329
  }]
23708
24330
  ])
23709
- ], 44, _hoisted_1$o);
24331
+ ], 44, _hoisted_1$n);
23710
24332
  }), 128))
23711
24333
  ]),
23712
24334
  _: 1
@@ -23714,22 +24336,25 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
23714
24336
  };
23715
24337
  }
23716
24338
  });
23717
- const LewRate = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["__scopeId", "data-v-4f04bcc0"]]);
24339
+ const LewRate = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__scopeId", "data-v-4f04bcc0"]]);
23718
24340
  const selectEmits = {
23719
24341
  change: (value) => value || typeof value === "undefined",
23720
24342
  blur: () => true,
23721
24343
  clear: () => true,
23722
- focus: () => true
24344
+ focus: () => true,
24345
+ delete: (value, item) => {
24346
+ return { value, item };
24347
+ }
23723
24348
  };
23724
24349
  const selectModel = {
23725
24350
  modelValue: {
23726
- type: [String, Number, void 0],
24351
+ type: [String, Number, Array, void 0],
23727
24352
  default: ""
23728
24353
  }
23729
24354
  };
23730
24355
  const selectProps = {
23731
24356
  defaultValue: {
23732
- type: String,
24357
+ type: [String, Array],
23733
24358
  default: "",
23734
24359
  validator: validators.string({
23735
24360
  componentName: "LewSelect",
@@ -23796,6 +24421,14 @@ const selectProps = {
23796
24421
  values: validSizeList
23797
24422
  })
23798
24423
  },
24424
+ multiple: {
24425
+ type: Boolean,
24426
+ default: false,
24427
+ validator: validators.boolean({
24428
+ componentName: "LewSelect",
24429
+ propName: "multiple"
24430
+ })
24431
+ },
23799
24432
  itemHeight: {
23800
24433
  type: Number,
23801
24434
  default: 38,
@@ -23893,19 +24526,14 @@ const selectProps = {
23893
24526
  })
23894
24527
  }
23895
24528
  };
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 = {
24529
+ const _hoisted_1$m = { class: "lew-select-options-box" };
24530
+ const _hoisted_2$f = {
23903
24531
  key: 0,
23904
24532
  class: "lew-result-count"
23905
24533
  };
23906
- const _hoisted_5$5 = ["onClick"];
23907
- const SELECT_WIDTH_TOLERANCE = 30;
23908
- const _sfc_main$v = /* @__PURE__ */ defineComponent({
24534
+ const _hoisted_3$b = ["onClick"];
24535
+ const SELECT_WIDTH_TOLERANCE = 40;
24536
+ const _sfc_main$u = /* @__PURE__ */ defineComponent({
23909
24537
  __name: "LewSelect",
23910
24538
  props: /* @__PURE__ */ mergeModels(selectProps, {
23911
24539
  "modelValue": {},
@@ -23916,8 +24544,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
23916
24544
  const props = __props;
23917
24545
  const emit = __emit;
23918
24546
  const selectValue = useModel(__props, "modelValue");
23919
- const lewSelectRef = ref();
23920
- const inputRef = ref();
24547
+ const lewSelectInputRef = ref();
23921
24548
  const lewPopoverRef = ref();
23922
24549
  const formMethods = inject("formMethods", {});
23923
24550
  const virtListRef = ref();
@@ -23926,12 +24553,14 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
23926
24553
  loading: false,
23927
24554
  initLoading: true,
23928
24555
  sourceOptions: props.options,
24556
+ sourceFlattenOptions: flattenSelectOptions(props.options),
23929
24557
  options: flattenSelectOptions(props.options),
23930
24558
  hideBySelect: false,
23931
- keyword: props.defaultValue || selectValue.value,
23932
- keywordBackup: props.defaultValue,
24559
+ keyword: props.multiple ? "" : props.defaultValue || selectValue.value,
24560
+ keywordBackup: props.multiple ? "" : props.defaultValue,
23933
24561
  autoWidth: 0,
23934
- searchCache: /* @__PURE__ */ new Map()
24562
+ searchCache: /* @__PURE__ */ new Map(),
24563
+ popoverWidth: 0
23935
24564
  });
23936
24565
  const _searchMethod = computed(() => {
23937
24566
  if (isFunction$1(props.searchMethod)) {
@@ -23950,15 +24579,6 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
23950
24579
  }
23951
24580
  return false;
23952
24581
  });
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
24582
  const shouldShowEmptyState = computed(() => {
23963
24583
  return state.options && state.options.length === 0;
23964
24584
  });
@@ -23966,11 +24586,20 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
23966
24586
  return props.searchable && !shouldShowEmptyState.value;
23967
24587
  });
23968
24588
  const inputPlaceholder = computed(() => {
24589
+ if (props.multiple) {
24590
+ return props.placeholder || locale.t("selectMultiple.placeholder");
24591
+ }
23969
24592
  if (state.keywordBackup || props.placeholder) {
23970
24593
  return props.placeholder;
23971
24594
  }
23972
24595
  return locale.t("select.placeholder");
23973
24596
  });
24597
+ function updateWidths() {
24598
+ if (props.multiple && lewSelectInputRef.value) {
24599
+ const selectWidth = lewSelectInputRef.value.$el ? lewSelectInputRef.value.$el.clientWidth : 0;
24600
+ state.popoverWidth = selectWidth - 12;
24601
+ }
24602
+ }
23974
24603
  const getOptionText = computed(() => {
23975
24604
  return (templateProps) => {
23976
24605
  if (templateProps.isGroup) {
@@ -23984,6 +24613,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
23984
24613
  const newOptions = await _initMethod.value();
23985
24614
  state.sourceOptions = newOptions;
23986
24615
  state.options = flattenSelectOptions(newOptions);
24616
+ state.sourceFlattenOptions = state.options;
23987
24617
  findKeyword();
23988
24618
  }
23989
24619
  if (props.enableSearchCache) {
@@ -24019,11 +24649,28 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
24019
24649
  }
24020
24650
  return props.width;
24021
24651
  });
24652
+ let resizeObserver = null;
24022
24653
  onMounted(() => {
24023
- if (props.autoWidth) {
24654
+ if (props.autoWidth && !props.multiple) {
24024
24655
  calculateAutoWidth();
24025
24656
  }
24026
24657
  init();
24658
+ if (props.multiple) {
24659
+ nextTick(() => {
24660
+ if (lewSelectInputRef.value && lewSelectInputRef.value.$el) {
24661
+ resizeObserver = new ResizeObserver(() => {
24662
+ updateWidths();
24663
+ });
24664
+ resizeObserver.observe(lewSelectInputRef.value.$el);
24665
+ }
24666
+ });
24667
+ }
24668
+ });
24669
+ onUnmounted(() => {
24670
+ if (resizeObserver) {
24671
+ resizeObserver.disconnect();
24672
+ resizeObserver = null;
24673
+ }
24027
24674
  });
24028
24675
  function calculateAutoWidth() {
24029
24676
  if (!props.autoWidth)
@@ -24033,21 +24680,27 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
24033
24680
  tempDiv.style.visibility = "hidden";
24034
24681
  tempDiv.style.whiteSpace = "nowrap";
24035
24682
  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);
24683
+ if (lewSelectInputRef.value) {
24684
+ const {
24685
+ fontSize,
24686
+ fontFamily,
24687
+ padding,
24688
+ marginLeft
24689
+ } = lewSelectInputRef.value.getInputRefStyle();
24690
+ tempDiv.style.fontSize = fontSize;
24691
+ tempDiv.style.fontFamily = fontFamily;
24692
+ tempDiv.style.padding = padding;
24693
+ let textContent = state.keyword;
24694
+ if (!textContent || textContent.trim() === "") {
24695
+ textContent = props.placeholder || locale.t("select.placeholder");
24696
+ }
24697
+ tempDiv.textContent = textContent;
24698
+ document.body.appendChild(tempDiv);
24699
+ const textWidth = tempDiv.clientWidth;
24700
+ console.log(marginLeft);
24701
+ state.autoWidth = textWidth + SELECT_WIDTH_TOLERANCE + Number.parseInt(marginLeft);
24702
+ document.body.removeChild(tempDiv);
24703
+ }
24051
24704
  }
24052
24705
  watch(
24053
24706
  () => state.keyword,
@@ -24092,707 +24745,135 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
24092
24745
  state.loading = false;
24093
24746
  }
24094
24747
  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
- }
24748
+ if (props.multiple) {
24749
+ selectValue.value = [];
24750
+ emit("clear");
24751
+ emit("change", selectValue.value);
24695
24752
  setTimeout(() => {
24696
24753
  lewPopoverRef.value && lewPopoverRef.value.refresh();
24697
24754
  }, 100);
24698
- emit("change", modelValue.value);
24755
+ } else {
24756
+ selectValue.value = void 0;
24757
+ state.keywordBackup = void 0;
24758
+ emit("clear");
24759
+ emit("change", void 0);
24699
24760
  }
24700
24761
  }
24701
24762
  function selectHandle(item) {
24702
24763
  if (item.disabled || item.isGroup) {
24703
24764
  return;
24704
24765
  }
24705
- const _value = modelValue.value || [];
24706
- const index2 = _value.findIndex((e) => e === item.value);
24707
- if (index2 >= 0) {
24708
- _value.splice(index2, 1);
24766
+ if (props.multiple) {
24767
+ const currentValues = selectValue.value || [];
24768
+ const index2 = currentValues.findIndex((v) => v === item.value);
24769
+ if (index2 >= 0) {
24770
+ currentValues.splice(index2, 1);
24771
+ } else {
24772
+ currentValues.push(item.value);
24773
+ }
24774
+ selectValue.value = [...currentValues];
24775
+ emit("change", selectValue.value);
24776
+ updateWidths();
24777
+ setTimeout(() => {
24778
+ lewPopoverRef.value && lewPopoverRef.value.refresh();
24779
+ }, 100);
24709
24780
  } else {
24710
- _value.push(item.value);
24781
+ state.hideBySelect = true;
24782
+ state.keyword = item.label;
24783
+ selectValue.value = item.value;
24784
+ emit("change", item.value);
24785
+ setTimeout(() => {
24786
+ hide2();
24787
+ }, 100);
24711
24788
  }
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
24789
  }
24720
24790
  const getChecked = computed(() => (value) => {
24721
- if (modelValue.value) {
24722
- return JSON.parse(JSON.stringify(modelValue.value.includes(value)));
24791
+ if (props.multiple) {
24792
+ const currentValues = selectValue.value || [];
24793
+ return currentValues.includes(value);
24723
24794
  }
24724
- return false;
24795
+ return selectValue.value === value;
24725
24796
  });
24726
- const getSelectedRows = computed(() => {
24727
- const _defaultValue = (props.defaultValue || []).map((e) => {
24728
- return {
24729
- label: e,
24730
- value: e
24731
- };
24797
+ function deleteTag(value) {
24798
+ if (!props.multiple)
24799
+ return;
24800
+ const currentValues = selectValue.value || [];
24801
+ const valueIndex = currentValues.findIndex((v) => v === value);
24802
+ if (valueIndex > -1) {
24803
+ const item = currentValues[valueIndex];
24804
+ currentValues.splice(valueIndex, 1);
24805
+ selectValue.value = [...currentValues];
24806
+ emit("delete", selectValue.value, item);
24807
+ emit("change", selectValue.value);
24808
+ setTimeout(() => {
24809
+ lewPopoverRef.value && lewPopoverRef.value.refresh();
24810
+ }, 100);
24811
+ updateWidths();
24812
+ }
24813
+ }
24814
+ const formatItems = computed(() => {
24815
+ if (!props.multiple)
24816
+ return [];
24817
+ const currentValues = selectValue.value || [];
24818
+ return (state.sourceFlattenOptions || []).filter((e) => {
24819
+ return currentValues.includes(e.value);
24732
24820
  });
24733
- if (state.options.length > 0) {
24734
- const selectedRows = modelValue.value && modelValue.value.map((v) => {
24735
- return state.options.find((e) => v === e.value);
24821
+ });
24822
+ function findKeyword() {
24823
+ if (props.multiple) {
24824
+ return;
24825
+ }
24826
+ if (state.options) {
24827
+ const option = state.options.find((e) => {
24828
+ if (e) {
24829
+ return e.value === selectValue.value;
24830
+ }
24831
+ return false;
24736
24832
  });
24737
- if (!selectedRows || selectedRows.length === 0) {
24738
- return _defaultValue;
24833
+ if (option && JSON.stringify(option) !== "{}") {
24834
+ return state.keyword = option.label;
24739
24835
  }
24740
- return selectedRows;
24741
24836
  }
24742
- return _defaultValue;
24743
- });
24837
+ return state.keyword = props.defaultValue;
24838
+ }
24839
+ findKeyword();
24744
24840
  const getBodyClassName = computed(() => {
24745
24841
  const { size, disabled } = props;
24746
24842
  return object2class("lew-select-body", { size, disabled });
24747
24843
  });
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];
24844
+ const getVirtualHeight = computed(() => {
24845
+ let height = state.options.length * props.itemHeight;
24846
+ height = height >= 280 ? 280 : height;
24847
+ return height;
24777
24848
  });
24778
- const focusSearchInput = /* @__PURE__ */ useDebounceFn(() => {
24849
+ async function showHandle() {
24850
+ state.visible = true;
24851
+ if (props.multiple) {
24852
+ updateWidths();
24853
+ } else {
24854
+ state.keywordBackup = cloneDeep(state.keyword);
24855
+ state.hideBySelect = false;
24856
+ }
24779
24857
  if (props.searchable) {
24780
- searchInputRef.value && searchInputRef.value.focus();
24858
+ if (props.multiple) {
24859
+ state.keyword = "";
24860
+ } else {
24861
+ state.keyword = "";
24862
+ }
24863
+ await search({ target: { value: "" } });
24781
24864
  }
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: "" } });
24865
+ let targetIndex = -1;
24866
+ if (props.multiple) {
24867
+ const currentValues = selectValue.value || [];
24868
+ const indexes = currentValues.map((value) => state.options.findIndex((e) => e.value === value)).filter((index2) => index2 > -1);
24869
+ targetIndex = indexes.length > 0 ? Math.min(...indexes) : -1;
24870
+ } else {
24871
+ targetIndex = state.options.findIndex((e) => e.value === selectValue.value);
24789
24872
  }
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
24873
  poll({
24793
24874
  callback: () => {
24794
- if (minIndex > 0 && minIndex !== Infinity) {
24795
- virtListRef.value.scrollToIndex(minIndex);
24875
+ if (targetIndex > 0 && targetIndex !== Infinity) {
24876
+ virtListRef.value.scrollToIndex(targetIndex);
24796
24877
  } else {
24797
24878
  virtListRef.value.reset();
24798
24879
  }
@@ -24801,334 +24882,119 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
24801
24882
  return !!virtListRef.value;
24802
24883
  }
24803
24884
  });
24885
+ emit("focus");
24804
24886
  }
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
24887
  function hideHandle() {
24814
24888
  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);
24889
+ if (!state.hideBySelect) {
24890
+ findKeyword();
24825
24891
  }
24826
- state.initLoading = false;
24892
+ emit("blur");
24827
24893
  }
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
- }
24894
+ const isShowScrollBar = computed(() => {
24895
+ return getVirtualHeight.value >= 280;
24844
24896
  });
24845
- __expose({
24846
- show,
24847
- hide: hide2,
24848
- clearSearchCache: () => {
24849
- if (props.enableSearchCache) {
24850
- state.searchCache.clear();
24851
- }
24852
- }
24897
+ const getPopoverBodyWidth = computed(() => {
24898
+ const { popoverWidth } = props;
24899
+ if (!lewSelectInputRef.value)
24900
+ return popoverWidth;
24901
+ return popoverWidth && popoverWidth !== "100%" ? parseDimension(popoverWidth) - 14 : lewSelectInputRef.value.$el.offsetWidth - 14;
24853
24902
  });
24854
24903
  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,
24904
+ () => selectValue.value,
24871
24905
  () => {
24872
- updateWidths();
24906
+ findKeyword();
24907
+ if (props.autoWidth) {
24908
+ calculateAutoWidth();
24909
+ }
24910
+ if (props.multiple) {
24911
+ updateWidths();
24912
+ }
24873
24913
  },
24874
24914
  {
24875
24915
  deep: true
24876
24916
  }
24877
24917
  );
24878
24918
  const getResultText = computed(() => {
24879
- return state.options.length > 0 ? locale.t("selectMultiple.resultCount", {
24919
+ const localeKey = props.multiple ? "selectMultiple.resultCount" : "select.resultCount";
24920
+ return state.options.length > 0 ? locale.t(localeKey, {
24880
24921
  num: numFormat(state.options.filter((e) => !e.isGroup).length)
24881
24922
  }) : "";
24882
24923
  });
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)
24924
+ const getSelectItemClassName = computed(() => (e) => {
24925
+ const { disabled, isGroup } = e;
24926
+ const active = getChecked.value(e.value);
24927
+ return object2class("lew-select-item", {
24928
+ disabled,
24929
+ active,
24930
+ "is-group": isGroup,
24931
+ "mul": props.multiple
24966
24932
  });
24967
24933
  });
24968
- const showHeaderSlot = computed(() => {
24969
- return !!slots.header;
24934
+ const shouldShowCheckIcon = computed(() => (value) => {
24935
+ return !props.multiple && getChecked.value(value) && props.showCheckIcon;
24970
24936
  });
24971
- const showFooterSlot = computed(() => {
24972
- return !!slots.footer;
24937
+ __expose({
24938
+ show,
24939
+ hide: hide2,
24940
+ clearSearchCache: () => {
24941
+ if (props.enableSearchCache) {
24942
+ state.searchCache.clear();
24943
+ }
24944
+ }
24973
24945
  });
24974
24946
  return (_ctx, _cache) => {
24975
24947
  return openBlock(), createBlock(unref(_sfc_main$U), {
24976
24948
  ref_key: "lewPopoverRef",
24977
24949
  ref: lewPopoverRef,
24978
- "popover-body-class-name": "lew-select-multiple-popover-body",
24950
+ "popover-body-class-name": "lew-select-popover-body",
24979
24951
  class: "lew-select-view",
24952
+ style: normalizeStyle({ width: _ctx.autoWidth ? "auto" : unref(any2px)(_ctx.width) }),
24980
24953
  trigger: _ctx.trigger,
24981
- "trigger-width": _ctx.width,
24954
+ "trigger-width": unref(any2px)(unref(computedWidth)),
24955
+ "hide-on-click": _ctx.searchable ? false : true,
24982
24956
  disabled: _ctx.disabled || _ctx.readonly || unref(state).initLoading,
24983
24957
  placement: "bottom-start",
24984
- style: normalizeStyle({ width: unref(any2px)(_ctx.width) }),
24985
24958
  loading: unref(state).loading,
24986
24959
  onShow: showHandle,
24987
24960
  onHide: hideHandle
24988
24961
  }, {
24989
24962
  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)
24963
+ createVNode(CommonInput, {
24964
+ ref_key: "lewSelectInputRef",
24965
+ ref: lewSelectInputRef,
24966
+ modelValue: selectValue.value,
24967
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => selectValue.value = $event),
24968
+ keyword: unref(state).keyword,
24969
+ "onUpdate:keyword": _cache[1] || (_cache[1] = ($event) => unref(state).keyword = $event),
24970
+ loading: unref(state).initLoading,
24971
+ clearable: _ctx.clearable,
24972
+ readonly: _ctx.readonly,
24973
+ disabled: _ctx.disabled || unref(state).initLoading,
24974
+ size: _ctx.size,
24975
+ placeholder: unref(inputPlaceholder),
24976
+ width: unref(any2px)(unref(computedWidth)),
24977
+ focus: unref(state).visible,
24978
+ "format-items": unref(formatItems),
24979
+ multiple: _ctx.multiple,
24980
+ searchable: _ctx.searchable,
24981
+ "selected-label": unref(state).keyword,
24982
+ onClear: clearHandle,
24983
+ onDelete: deleteTag,
24984
+ onInput: unref(searchDebounce)
24985
+ }, null, 8, ["modelValue", "keyword", "loading", "clearable", "readonly", "disabled", "size", "placeholder", "width", "focus", "format-items", "multiple", "searchable", "selected-label", "onInput"])
25108
24986
  ]),
25109
24987
  "popover-body": withCtx(() => [
25110
24988
  createElementVNode("div", {
25111
24989
  class: normalizeClass(["lew-select-body", unref(getBodyClassName)]),
25112
24990
  style: normalizeStyle({
25113
- width: unref(any2px)(unref(state).popoverWidth)
24991
+ width: _ctx.multiple ? unref(any2px)(unref(state).popoverWidth) : unref(any2px)(unref(getPopoverBodyWidth))
25114
24992
  })
25115
24993
  }, [
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), {
24994
+ renderSlot(_ctx.$slots, "header", {}, void 0, true),
24995
+ createElementVNode("div", _hoisted_1$m, [
24996
+ unref(shouldShowEmptyState) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
24997
+ _ctx.$slots.empty ? renderSlot(_ctx.$slots, "empty", { key: 0 }, void 0, true) : (openBlock(), createBlock(unref(LewFlex), {
25132
24998
  key: 1,
25133
24999
  direction: "y",
25134
25000
  x: "center",
@@ -25136,15 +25002,13 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
25136
25002
  }, {
25137
25003
  default: withCtx(() => [
25138
25004
  createVNode(unref(LewEmpty), {
25139
- title: unref(locale).t("selectMultiple.noResult")
25005
+ title: unref(locale).t("select.noResult")
25140
25006
  }, null, 8, ["title"])
25141
25007
  ]),
25142
25008
  _: 1
25143
25009
  }))
25144
25010
  ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
25145
- withDirectives(createElementVNode("div", { class: "lew-result-count" }, toDisplayString$1(unref(getResultText)), 513), [
25146
- [vShow, unref(showResultCount)]
25147
- ]),
25011
+ unref(shouldShowResultCount) ? (openBlock(), createElementBlock("div", _hoisted_2$f, toDisplayString$1(unref(getResultText)), 1)) : createCommentVNode("", true),
25148
25012
  createVNode(unref(VirtList), {
25149
25013
  ref_key: "virtListRef",
25150
25014
  ref: virtListRef,
@@ -25152,47 +25016,60 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
25152
25016
  "min-size": _ctx.itemHeight,
25153
25017
  buffer: 5,
25154
25018
  "item-key": "value",
25155
- style: normalizeStyle(unref(virtualListStyle)),
25156
- class: "lew-select-options-list lew-scrollbar"
25019
+ class: "lew-select-options-list lew-scrollbar",
25020
+ style: normalizeStyle({
25021
+ height: `${unref(getVirtualHeight)}px`,
25022
+ paddingRight: unref(isShowScrollBar) ? "5px" : "0px"
25023
+ })
25157
25024
  }, {
25158
25025
  default: withCtx(({ itemData: templateProps }) => [
25159
25026
  createElementVNode("div", {
25160
- style: normalizeStyle(unref(optionItemStyle)(_ctx.itemHeight)),
25027
+ style: normalizeStyle({ height: `${_ctx.itemHeight}px` }),
25161
25028
  onClick: ($event) => selectHandle(templateProps)
25162
25029
  }, [
25163
- unref(showCustomItemSlot) ? renderSlot(_ctx.$slots, "item", {
25030
+ _ctx.$slots.item ? renderSlot(_ctx.$slots, "item", {
25164
25031
  key: 0,
25165
- props: unref(itemSlotProps)(templateProps)
25032
+ props: {
25033
+ ...templateProps,
25034
+ checked: unref(getChecked)(templateProps.value)
25035
+ }
25166
25036
  }, void 0, true) : (openBlock(), createElementBlock("div", {
25167
25037
  key: 1,
25168
- class: normalizeClass(["lew-select-item lew-select-item-mul", getSelectItemClassName(templateProps)])
25038
+ class: normalizeClass(["lew-select-item", unref(getSelectItemClassName)(templateProps)])
25169
25039
  }, [
25170
- !templateProps.isGroup ? (openBlock(), createBlock(unref(LewCheckbox), {
25040
+ _ctx.multiple && !templateProps.isGroup ? (openBlock(), createBlock(unref(LewCheckbox), {
25171
25041
  key: templateProps.value,
25172
25042
  class: "lew-select-checkbox",
25173
25043
  checked: unref(getChecked)(templateProps.value)
25174
25044
  }, null, 8, ["checked"])) : createCommentVNode("", true),
25175
25045
  createVNode(unref(LewTextTrim), {
25176
- text: unref(groupLabelText)(templateProps),
25046
+ text: unref(getOptionText)(templateProps),
25177
25047
  delay: [500, 0],
25178
- class: normalizeClass(["lew-select-label", unref(groupLabelClass)(templateProps)])
25179
- }, null, 8, ["text", "class"])
25048
+ class: normalizeClass(["lew-select-label", { "is-group": templateProps.isGroup }])
25049
+ }, null, 8, ["text", "class"]),
25050
+ unref(shouldShowCheckIcon)(templateProps.value) ? (openBlock(), createBlock(CommonIcon, {
25051
+ key: 1,
25052
+ class: "lew-icon-check",
25053
+ size: 16,
25054
+ "stroke-width": 3,
25055
+ type: "check"
25056
+ })) : createCommentVNode("", true)
25180
25057
  ], 2))
25181
- ], 12, _hoisted_5$4)
25058
+ ], 12, _hoisted_3$b)
25182
25059
  ]),
25183
25060
  _: 3
25184
25061
  }, 8, ["list", "min-size", "style"])
25185
25062
  ], 64))
25186
25063
  ]),
25187
- unref(showFooterSlot) ? renderSlot(_ctx.$slots, "footer", { key: 2 }, void 0, true) : createCommentVNode("", true)
25064
+ renderSlot(_ctx.$slots, "footer", {}, void 0, true)
25188
25065
  ], 6)
25189
25066
  ]),
25190
25067
  _: 3
25191
- }, 8, ["trigger", "trigger-width", "disabled", "style", "loading"]);
25068
+ }, 8, ["style", "trigger", "trigger-width", "hide-on-click", "disabled", "loading"]);
25192
25069
  };
25193
25070
  }
25194
25071
  });
25195
- const LewSelectMultiple = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__scopeId", "data-v-bb9b06f8"]]);
25072
+ const LewSelect = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__scopeId", "data-v-56b4bf28"]]);
25196
25073
  const sliderEmits = {
25197
25074
  change: (value) => value
25198
25075
  };
@@ -26847,9 +26724,12 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
26847
26724
  emit("clear");
26848
26725
  emit("change", void 0);
26849
26726
  }
26850
- function toFocus() {
26727
+ function focus() {
26851
26728
  lewTextareaRef.value?.focus();
26852
26729
  }
26730
+ function blur() {
26731
+ lewTextareaRef.value?.blur();
26732
+ }
26853
26733
  const getTextareaClassNames = computed(() => {
26854
26734
  const { size, readonly: readonly2, disabled } = props;
26855
26735
  return object2class("lew-textarea-view", {
@@ -26858,13 +26738,13 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
26858
26738
  disabled
26859
26739
  });
26860
26740
  });
26861
- function focus(e) {
26741
+ function _focus(e) {
26862
26742
  if (props.selectByFocus) {
26863
26743
  e?.currentTarget?.select();
26864
26744
  }
26865
26745
  state.isFocus = true;
26866
26746
  }
26867
- function blur() {
26747
+ function _blur() {
26868
26748
  state.isFocus = false;
26869
26749
  }
26870
26750
  function handleInput(event) {
@@ -26884,16 +26764,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
26884
26764
  return size[props.size];
26885
26765
  });
26886
26766
  const getTextareaStyle = computed(() => {
26887
- const {
26888
- width,
26889
- height,
26890
- size,
26891
- resize,
26892
- maxHeight,
26893
- minHeight,
26894
- maxWidth,
26895
- minWidth
26896
- } = props;
26767
+ const { width, height, size, resize, maxHeight, minHeight, maxWidth, minWidth } = props;
26897
26768
  const heightMap = {
26898
26769
  small: 60,
26899
26770
  medium: 75,
@@ -26926,7 +26797,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
26926
26797
  }
26927
26798
  });
26928
26799
  }
26929
- __expose({ toFocus });
26800
+ __expose({ focus, blur });
26930
26801
  return (_ctx, _cache) => {
26931
26802
  return openBlock(), createElementBlock("div", {
26932
26803
  ref_key: "lewTextareaViewRef",
@@ -26943,8 +26814,8 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
26943
26814
  maxlength: _ctx.maxLength,
26944
26815
  disabled: _ctx.disabled,
26945
26816
  readonly: _ctx.readonly,
26946
- onFocus: focus,
26947
- onBlur: blur,
26817
+ onFocus: _focus,
26818
+ onBlur: _blur,
26948
26819
  onInput: handleInput,
26949
26820
  onChange: handleChange
26950
26821
  }, null, 40, _hoisted_1$h), [
@@ -26972,7 +26843,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
26972
26843
  };
26973
26844
  }
26974
26845
  });
26975
- const LewTextarea = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-1cb07f72"]]);
26846
+ const LewTextarea = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-45937168"]]);
26976
26847
  const treeSelectEmits = {
26977
26848
  change: (value) => value,
26978
26849
  clear: () => {
@@ -27044,7 +26915,7 @@ const treeSelectProps = {
27044
26915
  },
27045
26916
  checkable: {
27046
26917
  type: Boolean,
27047
- default: false,
26918
+ default: true,
27048
26919
  validator: validators.boolean({
27049
26920
  componentName: "LewTreeSelect",
27050
26921
  propName: "checkable"
@@ -27058,14 +26929,6 @@ const treeSelectProps = {
27058
26929
  propName: "showAllLevels"
27059
26930
  })
27060
26931
  },
27061
- showCheckIcon: {
27062
- type: Boolean,
27063
- default: true,
27064
- validator: validators.boolean({
27065
- componentName: "LewTreeSelect",
27066
- propName: "showCheckIcon"
27067
- })
27068
- },
27069
26932
  showLine: {
27070
26933
  type: Boolean,
27071
26934
  default: false,
@@ -27182,7 +27045,7 @@ const _hoisted_4$5 = {
27182
27045
  key: 0,
27183
27046
  class: "result-count"
27184
27047
  };
27185
- const _hoisted_5$3 = { class: "tree-select-wrapper lew-scrollbar" };
27048
+ const _hoisted_5$4 = { class: "tree-select-wrapper lew-scrollbar" };
27186
27049
  const _sfc_main$o = /* @__PURE__ */ defineComponent({
27187
27050
  __name: "LewTreeSelect",
27188
27051
  props: /* @__PURE__ */ mergeModels(treeSelectProps, {
@@ -27410,7 +27273,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
27410
27273
  renderSlot(_ctx.$slots, "header", {}, void 0, true),
27411
27274
  createElementVNode("div", _hoisted_3$a, [
27412
27275
  _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, [
27276
+ createElementVNode("div", _hoisted_5$4, [
27414
27277
  createVNode(unref(LewTree), mergeProps({
27415
27278
  ref_key: "lewTreeRef",
27416
27279
  ref: lewTreeRef,
@@ -29478,12 +29341,19 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
29478
29341
  }
29479
29342
  );
29480
29343
  async function handleClose() {
29481
- if (props.disabled || isClosing.value)
29482
- return;
29344
+ if (props.disabled || isClosing.value) return;
29483
29345
  if (props.close) {
29484
29346
  isClosing.value = true;
29485
- await props.close();
29486
- emit("close");
29347
+ let result = false;
29348
+ try {
29349
+ result = await props.close();
29350
+ } catch {
29351
+ isClosing.value = false;
29352
+ return;
29353
+ }
29354
+ if (result === true) {
29355
+ emit("close");
29356
+ }
29487
29357
  isClosing.value = false;
29488
29358
  } else {
29489
29359
  emit("close");
@@ -29505,7 +29375,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
29505
29375
  _ctx.$slots.right ? (openBlock(), createElementBlock("div", _hoisted_3$7, [
29506
29376
  renderSlot(_ctx.$slots, "right")
29507
29377
  ])) : createCommentVNode("", true),
29508
- _ctx.closeable ? (openBlock(), createElementBlock("div", {
29378
+ _ctx.closeable || unref(isFunction$1)(_ctx.close) ? (openBlock(), createElementBlock("div", {
29509
29379
  key: 2,
29510
29380
  class: "lew-tag-close",
29511
29381
  onClick: withModifiers(handleClose, ["stop"])
@@ -30228,7 +30098,7 @@ const _hoisted_4$3 = {
30228
30098
  "stroke-linecap": "butt",
30229
30099
  "stroke-linejoin": "miter"
30230
30100
  };
30231
- const _hoisted_5$2 = {
30101
+ const _hoisted_5$3 = {
30232
30102
  key: 1,
30233
30103
  viewBox: "0 0 48 48",
30234
30104
  fill: "none",
@@ -30265,7 +30135,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
30265
30135
  props.separator === "sprit" ? (openBlock(), createElementBlock("svg", _hoisted_4$3, [..._cache[0] || (_cache[0] = [
30266
30136
  createElementVNode("path", { d: "M29.506 6.502 18.493 41.498" }, null, -1)
30267
30137
  ])])) : createCommentVNode("", true),
30268
- props.separator === "shoulder" ? (openBlock(), createElementBlock("svg", _hoisted_5$2, [..._cache[1] || (_cache[1] = [
30138
+ props.separator === "shoulder" ? (openBlock(), createElementBlock("svg", _hoisted_5$3, [..._cache[1] || (_cache[1] = [
30269
30139
  createElementVNode("path", { d: "m16 39.513 15.556-15.557L16 8.4" }, null, -1)
30270
30140
  ])])) : createCommentVNode("", true)
30271
30141
  ])) : createCommentVNode("", true)
@@ -31116,7 +30986,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
31116
30986
  };
31117
30987
  }
31118
30988
  });
31119
- const LewMenuTreeItem = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-c53bcfe6"]]);
30989
+ const LewMenuTreeItem = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-98e31987"]]);
31120
30990
  const _sfc_main$4 = /* @__PURE__ */ defineComponent({
31121
30991
  __name: "LewMenuTree",
31122
30992
  props: /* @__PURE__ */ mergeModels(menuTreeProps, {
@@ -31282,66 +31152,99 @@ const stepsProps = {
31282
31152
  componentName: "LewSteps",
31283
31153
  propName: "minWidth"
31284
31154
  })
31155
+ },
31156
+ // 允许点击Item切换步骤
31157
+ canClickItem: {
31158
+ type: Boolean,
31159
+ default: true
31160
+ },
31161
+ // 允许跨步骤
31162
+ canCrossSteps: {
31163
+ type: Boolean,
31164
+ default: true
31285
31165
  }
31286
31166
  };
31287
31167
  const _hoisted_1$2 = { class: "lew-steps lew-scrollbar" };
31288
- const _hoisted_2$2 = { class: "lew-steps-item-index" };
31289
- const _hoisted_3$2 = {
31168
+ const _hoisted_2$2 = ["onClick"];
31169
+ const _hoisted_3$2 = { class: "lew-steps-item-index" };
31170
+ const _hoisted_4$2 = {
31290
31171
  key: 4,
31291
31172
  class: "index"
31292
31173
  };
31293
- const _hoisted_4$2 = { class: "lew-steps-item-info" };
31174
+ const _hoisted_5$2 = { class: "lew-steps-item-info" };
31294
31175
  const _sfc_main$3 = /* @__PURE__ */ defineComponent({
31295
31176
  __name: "LewSteps",
31296
31177
  props: /* @__PURE__ */ mergeModels(stepsProps, {
31297
31178
  "modelValue": {},
31298
31179
  "modelModifiers": {}
31299
31180
  }),
31300
- emits: ["update:modelValue"],
31301
- setup(__props) {
31181
+ emits: /* @__PURE__ */ mergeModels(["change"], ["update:modelValue"]),
31182
+ setup(__props, { emit: __emit }) {
31183
+ const props = __props;
31184
+ const emit = __emit;
31302
31185
  const stepsValue = useModel(__props, "modelValue");
31186
+ watch(stepsValue, (val, oldVal) => {
31187
+ if (val !== oldVal) {
31188
+ emit("change", val);
31189
+ }
31190
+ });
31191
+ const itemStyle = computed(() => {
31192
+ return {
31193
+ cursor: props.canClickItem ? "pointer" : "default",
31194
+ minWidth: any2px(props.minWidth)
31195
+ };
31196
+ });
31197
+ function handleClick(index2) {
31198
+ if (!props.canClickItem) return;
31199
+ if (!props.canCrossSteps && Math.abs((stepsValue.value || 1) - 1 - index2) > 1) return;
31200
+ if (stepsValue.value !== index2 + 1) {
31201
+ stepsValue.value = index2 + 1;
31202
+ emit("change", stepsValue.value);
31203
+ }
31204
+ }
31303
31205
  return (_ctx, _cache) => {
31304
31206
  return openBlock(), createElementBlock("div", _hoisted_1$2, [
31305
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (item, index2) => {
31207
+ (openBlock(true), createElementBlock(Fragment, null, renderList(props.options, (item, index2) => {
31306
31208
  return openBlock(), createElementBlock("div", {
31307
31209
  key: index2,
31308
31210
  class: normalizeClass(["lew-steps-item", {
31309
31211
  "lew-steps-item-active": index2 === (stepsValue.value || 1) - 1,
31310
31212
  "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"
31213
+ "lew-steps-item-error": index2 === (stepsValue.value || 1) - 1 && props.status === "error",
31214
+ "lew-steps-item-warning": index2 === (stepsValue.value || 1) - 1 && props.status === "warning",
31215
+ "lew-steps-item-done": index2 === (stepsValue.value || 1) - 1 && props.status === "done"
31314
31216
  }]),
31315
- style: normalizeStyle({ minWidth: unref(any2px)(_ctx.minWidth) })
31217
+ style: normalizeStyle(unref(itemStyle)),
31218
+ onClick: ($event) => handleClick(index2)
31316
31219
  }, [
31317
- createElementVNode("div", _hoisted_2$2, [
31318
- index2 === (stepsValue.value || 1) - 1 && _ctx.status === "loading" ? (openBlock(), createBlock(CommonIcon, {
31220
+ createElementVNode("div", _hoisted_3$2, [
31221
+ index2 === (stepsValue.value || 1) - 1 && props.status === "loading" ? (openBlock(), createBlock(CommonIcon, {
31319
31222
  key: 0,
31320
31223
  size: 16,
31321
31224
  "stroke-width": 3,
31322
31225
  loading: "",
31323
31226
  type: "loader"
31324
- })) : index2 === (stepsValue.value || 1) - 1 && _ctx.status === "warning" ? (openBlock(), createBlock(CommonIcon, {
31227
+ })) : index2 === (stepsValue.value || 1) - 1 && props.status === "warning" ? (openBlock(), createBlock(CommonIcon, {
31325
31228
  key: 1,
31326
31229
  size: 16,
31327
31230
  "stroke-width": 3,
31328
31231
  type: "alert-circle"
31329
- })) : index2 === (stepsValue.value || 1) - 1 && _ctx.status === "error" ? (openBlock(), createBlock(CommonIcon, {
31232
+ })) : index2 === (stepsValue.value || 1) - 1 && props.status === "error" ? (openBlock(), createBlock(CommonIcon, {
31330
31233
  key: 2,
31331
31234
  size: 16,
31332
31235
  "stroke-width": 3,
31333
31236
  type: "close"
31334
- })) : index2 < (stepsValue.value || 1) - 1 || index2 === (stepsValue.value || 1) - 1 && _ctx.status === "done" ? (openBlock(), createBlock(CommonIcon, {
31237
+ })) : index2 < (stepsValue.value || 1) - 1 || index2 === (stepsValue.value || 1) - 1 && props.status === "done" ? (openBlock(), createBlock(CommonIcon, {
31335
31238
  key: 3,
31336
31239
  style: { color: "var(--lew-color-primary)" },
31337
31240
  size: 16,
31338
31241
  "stroke-width": 3,
31339
31242
  type: "check"
31340
- })) : (openBlock(), createElementBlock("span", _hoisted_3$2, toDisplayString$1(index2 + 1), 1))
31243
+ })) : (openBlock(), createElementBlock("span", _hoisted_4$2, toDisplayString$1(index2 + 1), 1))
31341
31244
  ]),
31342
- createElementVNode("div", _hoisted_4$2, [
31245
+ createElementVNode("div", _hoisted_5$2, [
31343
31246
  createElementVNode("div", {
31344
- style: normalizeStyle({ maxWidth: unref(any2px)(_ctx.minWidth) }),
31247
+ style: normalizeStyle({ maxWidth: unref(any2px)(props.minWidth) }),
31345
31248
  class: "lew-steps-item-title"
31346
31249
  }, [
31347
31250
  createVNode(_sfc_main$16, {
@@ -31353,7 +31256,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
31353
31256
  }, null, 8, ["render-fn"])
31354
31257
  ], 4),
31355
31258
  createElementVNode("div", {
31356
- style: normalizeStyle({ maxWidth: unref(any2px)(_ctx.minWidth) }),
31259
+ style: normalizeStyle({ maxWidth: unref(any2px)(props.minWidth) }),
31357
31260
  class: "lew-steps-item-description"
31358
31261
  }, [
31359
31262
  createVNode(_sfc_main$16, {
@@ -31367,7 +31270,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
31367
31270
  }, null, 8, ["render-fn"])
31368
31271
  ], 4)
31369
31272
  ])
31370
- ], 6);
31273
+ ], 14, _hoisted_2$2);
31371
31274
  }), 128))
31372
31275
  ]);
31373
31276
  };
@@ -31417,7 +31320,6 @@ const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
31417
31320
  LewRadioGroup,
31418
31321
  LewRate,
31419
31322
  LewSelect,
31420
- LewSelectMultiple,
31421
31323
  LewSlider,
31422
31324
  LewSliderRange,
31423
31325
  LewSteps: _sfc_main$3,
@@ -31528,9 +31430,6 @@ const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
31528
31430
  requiredIconSizeMap,
31529
31431
  selectEmits,
31530
31432
  selectModel,
31531
- selectMultipleEmits,
31532
- selectMultipleModel,
31533
- selectMultipleProps,
31534
31433
  selectProps,
31535
31434
  sliderEmits,
31536
31435
  sliderModel,
@@ -31859,7 +31758,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
31859
31758
  visible.value = true;
31860
31759
  nextTick(() => {
31861
31760
  if (okRef.value)
31862
- okRef.value.focus();
31761
+ okRef.value.$el.focus();
31863
31762
  });
31864
31763
  });
31865
31764
  watch(visible, (newVal) => {
@@ -31972,7 +31871,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
31972
31871
  };
31973
31872
  }
31974
31873
  });
31975
- const _LewDialog = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-fef66d43"]]);
31874
+ const _LewDialog = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-f609a415"]]);
31976
31875
  const { x, y } = useMouse();
31977
31876
  function createDialog(type) {
31978
31877
  return (options) => dialog(type, options);
@@ -38876,7 +38775,6 @@ export {
38876
38775
  LewRadioGroup,
38877
38776
  LewRate,
38878
38777
  LewSelect,
38879
- LewSelectMultiple,
38880
38778
  LewSlider,
38881
38779
  LewSliderRange,
38882
38780
  _sfc_main$3 as LewSteps,
@@ -39005,9 +38903,6 @@ export {
39005
38903
  requiredIconSizeMap,
39006
38904
  selectEmits,
39007
38905
  selectModel,
39008
- selectMultipleEmits,
39009
- selectMultipleModel,
39010
- selectMultipleProps,
39011
38906
  selectProps,
39012
38907
  setLocale,
39013
38908
  sliderEmits,