@wimi/ui 0.4.17 → 0.4.19

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.
@@ -1,4 +1,4 @@
1
- import { g as getDefaultExportFromCjs, c as commonjsGlobal } from "./index-JCi8uj7s.mjs";
1
+ import { g as getDefaultExportFromCjs, c as commonjsGlobal } from "./index-B9_Aevn6.mjs";
2
2
  function _mergeNamespaces(n, m) {
3
3
  for (var i = 0; i < m.length; i++) {
4
4
  const e = m[i];
@@ -10,7 +10,7 @@ var __privateAdd = (obj2, member, value) => member.has(obj2) ? __typeError("Cann
10
10
  var __privateSet = (obj2, member, value, setter) => (__accessCheck(obj2, member, "write to private field"), setter ? setter.call(obj2, value) : member.set(obj2, value), value);
11
11
  var _components, _message;
12
12
  import * as vue$1 from "vue";
13
- import { computed, onMounted, nextTick, onBeforeUnmount, onUnmounted, toRef as toRef$2, readonly, ref, customRef, getCurrentScope, onScopeDispose, isRef, reactive, unref, getCurrentInstance, shallowRef, shallowReadonly, watch, hasInjectionContext, inject as inject$1, toValue as toValue$2, toRefs, watchEffect, h as h$3, defineComponent, mergeModels, useModel, useAttrs, createBlock, openBlock, resolveDynamicComponent, mergeProps, createSlots, renderList, withCtx, renderSlot, normalizeProps, guardReactiveProps, createVNode, Fragment, isVNode, Comment, Text as Text$2, onUpdated, provide, triggerRef, Transition, withDirectives, resolveDirective, cloneVNode, withModifiers, vShow, onBeforeMount, Teleport, createTextVNode, toRaw, render as render$4, onBeforeUpdate, TransitionGroup, createElementBlock, normalizeClass, createElementVNode, toDisplayString, effectScope, withKeys, createCommentVNode, toHandlerKey, camelize as camelize$1, normalizeStyle as normalizeStyle$2, markRaw, watchPostEffect, mergeDefaults, useSlots, toHandlers, warn as warn$6, onActivated, onDeactivated, useId as useId$2, isReactive, createApp, resolveComponent } from "vue";
13
+ import { computed, onMounted, nextTick, onBeforeUnmount, onUnmounted, toRef as toRef$2, readonly, ref, customRef, getCurrentScope, onScopeDispose, isRef, reactive, unref, getCurrentInstance, shallowRef, shallowReadonly, watch, hasInjectionContext, inject as inject$1, toValue as toValue$2, toRefs, watchEffect, h as h$3, defineComponent, mergeModels, useModel, useAttrs, createBlock, openBlock, resolveDynamicComponent, mergeProps, createSlots, renderList, withCtx, renderSlot, normalizeProps, guardReactiveProps, createVNode, Fragment, isVNode, Comment, Text as Text$2, onUpdated, provide, triggerRef, Transition, withDirectives, resolveDirective, cloneVNode, withModifiers, vShow, onBeforeMount, Teleport, createTextVNode, toRaw, render as render$4, onBeforeUpdate, TransitionGroup, createElementBlock, normalizeStyle as normalizeStyle$2, normalizeClass, createElementVNode, toDisplayString, effectScope, withKeys, createCommentVNode, toHandlerKey, camelize as camelize$1, markRaw, watchPostEffect, mergeDefaults, useSlots, toHandlers, warn as warn$6, onActivated, onDeactivated, useId as useId$2, isReactive, createApp, resolveComponent } from "vue";
14
14
  class GlobalShareState {
15
15
  constructor() {
16
16
  __privateAdd(this, _components, {});
@@ -44585,7 +44585,11 @@ const _sfc_main$3n = /* @__PURE__ */ defineComponent({
44585
44585
  };
44586
44586
  });
44587
44587
  return (_ctx, _cache) => {
44588
- return openBlock(), createElementBlock("span", null, [createVNode(unref(ConfigProvider), {
44588
+ var _a2, _b2;
44589
+ return openBlock(), createElementBlock("span", {
44590
+ class: normalizeClass((_a2 = _ctx.$attrs) == null ? void 0 : _a2.class),
44591
+ style: normalizeStyle$2((_b2 = _ctx.$attrs) == null ? void 0 : _b2.style)
44592
+ }, [createVNode(unref(ConfigProvider), {
44589
44593
  theme: {
44590
44594
  token: unref(tokens)
44591
44595
  }
@@ -44600,7 +44604,7 @@ const _sfc_main$3n = /* @__PURE__ */ defineComponent({
44600
44604
  _: 3
44601
44605
  }, 16, ["style", "class"])]),
44602
44606
  _: 3
44603
- }, 8, ["theme"])]);
44607
+ }, 8, ["theme"])], 6);
44604
44608
  };
44605
44609
  }
44606
44610
  });
@@ -44611,7 +44615,7 @@ const _export_sfc$1 = (sfc, props2) => {
44611
44615
  }
44612
44616
  return target;
44613
44617
  };
44614
- const WmButton = /* @__PURE__ */ _export_sfc$1(_sfc_main$3n, [["__scopeId", "data-v-f5bb3ef5"]]);
44618
+ const WmButton = /* @__PURE__ */ _export_sfc$1(_sfc_main$3n, [["__scopeId", "data-v-d07231de"]]);
44615
44619
  const locales = {
44616
44620
  reset: "重 置",
44617
44621
  submit: "提 交",
@@ -44641,31 +44645,31 @@ async function loadDayjsLocale(lang) {
44641
44645
  let locale2;
44642
44646
  switch (lang) {
44643
44647
  case "en-US": {
44644
- locale2 = await import("./en-DUcOGCKS.mjs").then((n10) => n10.e);
44648
+ locale2 = await import("./en-CuEFUWUx.mjs").then((n10) => n10.e);
44645
44649
  break;
44646
44650
  }
44647
44651
  case "zh-CN": {
44648
- locale2 = await import("./zh-cn-CWZ7n2ZT.mjs").then((n10) => n10.z);
44652
+ locale2 = await import("./zh-cn-CPGMCy1A.mjs").then((n10) => n10.z);
44649
44653
  break;
44650
44654
  }
44651
44655
  case "zh-TW": {
44652
- locale2 = await import("./zh-tw-CGVQS3mU.mjs").then((n10) => n10.z);
44656
+ locale2 = await import("./zh-tw-Iws96JKG.mjs").then((n10) => n10.z);
44653
44657
  break;
44654
44658
  }
44655
44659
  case "ko-KR": {
44656
- locale2 = await import("./ko-Dpm_JHv5.mjs").then((n10) => n10.k);
44660
+ locale2 = await import("./ko-COx6ax0z.mjs").then((n10) => n10.k);
44657
44661
  break;
44658
44662
  }
44659
44663
  case "ja-JP": {
44660
- locale2 = await import("./ja-DzmS0NEe.mjs").then((n10) => n10.j);
44664
+ locale2 = await import("./ja-Bc57uazT.mjs").then((n10) => n10.j);
44661
44665
  break;
44662
44666
  }
44663
44667
  case "ru-RU": {
44664
- locale2 = await import("./ru-CY9ncGql.mjs").then((n10) => n10.r);
44668
+ locale2 = await import("./ru-CJWl3ORw.mjs").then((n10) => n10.r);
44665
44669
  break;
44666
44670
  }
44667
44671
  default: {
44668
- locale2 = await import("./zh-cn-CWZ7n2ZT.mjs").then((n10) => n10.z);
44672
+ locale2 = await import("./zh-cn-CPGMCy1A.mjs").then((n10) => n10.z);
44669
44673
  }
44670
44674
  }
44671
44675
  if (locale2) {
@@ -305585,10 +305589,24 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
305585
305589
  loading: {
305586
305590
  type: Boolean
305587
305591
  },
305588
- inputProps: {}
305592
+ inputProps: {},
305593
+ filterCheckedOnly: {
305594
+ type: Boolean,
305595
+ default: true
305596
+ },
305597
+ checkAllOnClear: {
305598
+ type: Boolean,
305599
+ default: false
305600
+ },
305601
+ defaultCheckAll: {
305602
+ type: Boolean,
305603
+ default: false
305604
+ }
305589
305605
  },
305606
+ emits: ["update:checkedKeys"],
305590
305607
  setup(__props, {
305591
- expose: __expose
305608
+ expose: __expose,
305609
+ emit: __emit
305592
305610
  }) {
305593
305611
  const ellipsisCss = vi`
305594
305612
  overflow: hidden;
@@ -305603,17 +305621,161 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
305603
305621
  }
305604
305622
  `;
305605
305623
  const props2 = __props;
305624
+ const emit = __emit;
305606
305625
  const {
305607
305626
  commonTokens
305608
305627
  } = useNaiveDesignTokens();
305609
305628
  const attrs = useAttrs();
305610
305629
  const elRef = ref();
305611
305630
  const searchValue = ref("");
305631
+ const defaultFilter = (pattern, node2) => {
305632
+ const labelField = props2.labelField || "label";
305633
+ const label = node2[labelField];
305634
+ return (label == null ? void 0 : label.toLowerCase().includes(pattern.toLowerCase())) ?? false;
305635
+ };
305636
+ const getVisibleKeys = (data, pattern) => {
305637
+ const visibleKeys = /* @__PURE__ */ new Set();
305638
+ if (!data) return visibleKeys;
305639
+ if (!pattern) {
305640
+ const collectAll = (nodes) => {
305641
+ for (const node2 of nodes) {
305642
+ const keyField2 = props2.keyField || "key";
305643
+ const childrenField2 = props2.childrenField || "children";
305644
+ visibleKeys.add(node2[keyField2]);
305645
+ const children = node2[childrenField2];
305646
+ if (children == null ? void 0 : children.length) collectAll(children);
305647
+ }
305648
+ };
305649
+ collectAll(data);
305650
+ return visibleKeys;
305651
+ }
305652
+ const keyField = props2.keyField || "key";
305653
+ const childrenField = props2.childrenField || "children";
305654
+ const filterFn = props2.filter || defaultFilter;
305655
+ const traverse2 = (nodes) => {
305656
+ let hasVisible = false;
305657
+ for (const node2 of nodes) {
305658
+ const nodeKey = node2[keyField];
305659
+ const children = node2[childrenField];
305660
+ const childrenVisible = (children == null ? void 0 : children.length) ? traverse2(children) : false;
305661
+ const selfMatch = filterFn(pattern, node2);
305662
+ if (selfMatch || childrenVisible) {
305663
+ visibleKeys.add(nodeKey);
305664
+ hasVisible = true;
305665
+ }
305666
+ }
305667
+ return hasVisible;
305668
+ };
305669
+ traverse2(data);
305670
+ return visibleKeys;
305671
+ };
305672
+ const getAllNodesData = (data) => {
305673
+ const keys2 = [];
305674
+ const options = [];
305675
+ if (!data) return {
305676
+ keys: keys2,
305677
+ options
305678
+ };
305679
+ const keyField = props2.keyField || "key";
305680
+ const childrenField = props2.childrenField || "children";
305681
+ const traverse2 = (nodes) => {
305682
+ for (const node2 of nodes) {
305683
+ keys2.push(node2[keyField]);
305684
+ options.push(node2);
305685
+ const children = node2[childrenField];
305686
+ if (children == null ? void 0 : children.length) traverse2(children);
305687
+ }
305688
+ };
305689
+ traverse2(data);
305690
+ return {
305691
+ keys: keys2,
305692
+ options
305693
+ };
305694
+ };
305695
+ const visibleKeysSet = computed(() => getVisibleKeys(props2.data, searchValue.value));
305696
+ onMounted(() => {
305697
+ var _a2;
305698
+ if (props2.checkable && props2.defaultCheckAll && ((_a2 = props2.data) == null ? void 0 : _a2.length)) {
305699
+ const {
305700
+ keys: keys2,
305701
+ options
305702
+ } = getAllNodesData(props2.data);
305703
+ emit("update:checkedKeys", keys2, options, {
305704
+ node: null,
305705
+ action: "check"
305706
+ });
305707
+ const originalHandler = props2["onUpdate:checkedKeys"] || props2.onUpdateCheckedKeys;
305708
+ if (originalHandler) {
305709
+ const handlers2 = Array.isArray(originalHandler) ? originalHandler : [originalHandler];
305710
+ handlers2.forEach((fn2) => fn2(keys2, options, {
305711
+ node: null,
305712
+ action: "check"
305713
+ }));
305714
+ }
305715
+ }
305716
+ });
305717
+ watch(searchValue, (newVal, oldVal) => {
305718
+ var _a2, _b2;
305719
+ if (!props2.filterCheckedOnly) return;
305720
+ const invokeHandler = (k10, o2, action) => {
305721
+ emit("update:checkedKeys", k10, o2, {
305722
+ node: null,
305723
+ action
305724
+ });
305725
+ const originalHandler = props2["onUpdate:checkedKeys"] || props2.onUpdateCheckedKeys;
305726
+ if (originalHandler) {
305727
+ const handlers2 = Array.isArray(originalHandler) ? originalHandler : [originalHandler];
305728
+ handlers2.forEach((fn2) => fn2(k10, o2, {
305729
+ node: null,
305730
+ action
305731
+ }));
305732
+ }
305733
+ };
305734
+ if (!newVal && oldVal && props2.checkAllOnClear) {
305735
+ const {
305736
+ keys: keys2,
305737
+ options
305738
+ } = getAllNodesData(props2.data);
305739
+ invokeHandler(keys2, options, "check");
305740
+ return;
305741
+ }
305742
+ if (!newVal) return;
305743
+ const checkedData = (_a2 = elRef.value) == null ? void 0 : _a2.getCheckedData();
305744
+ if (!((_b2 = checkedData == null ? void 0 : checkedData.keys) == null ? void 0 : _b2.length)) return;
305745
+ const visibleKeys = getVisibleKeys(props2.data, newVal);
305746
+ const filteredKeys = checkedData.keys.filter((key2) => visibleKeys.has(key2));
305747
+ if (filteredKeys.length !== checkedData.keys.length) {
305748
+ const keyField = props2.keyField || "key";
305749
+ const filteredOptions = checkedData.options.filter((opt) => visibleKeys.has(opt[keyField]));
305750
+ invokeHandler(filteredKeys, filteredOptions, "uncheck");
305751
+ }
305752
+ });
305753
+ const handleUpdateCheckedKeys = (keys2, options, meta) => {
305754
+ const invokeHandler = (k10, o2) => {
305755
+ const originalHandler = props2["onUpdate:checkedKeys"] || props2.onUpdateCheckedKeys;
305756
+ if (!originalHandler) return;
305757
+ const handlers2 = Array.isArray(originalHandler) ? originalHandler : [originalHandler];
305758
+ handlers2.forEach((fn2) => fn2(k10, o2, meta));
305759
+ };
305760
+ if (!props2.filterCheckedOnly || !searchValue.value) {
305761
+ emit("update:checkedKeys", keys2, options, meta);
305762
+ invokeHandler(keys2, options);
305763
+ return;
305764
+ }
305765
+ const filteredKeys = keys2.filter((key2) => visibleKeysSet.value.has(key2));
305766
+ const filteredOptions = options.filter((opt) => {
305767
+ const keyField = props2.keyField || "key";
305768
+ return visibleKeysSet.value.has(opt[keyField]);
305769
+ });
305770
+ emit("update:checkedKeys", filteredKeys, filteredOptions, meta);
305771
+ invokeHandler(filteredKeys, filteredOptions);
305772
+ };
305612
305773
  const getBindValue = computed(() => {
305774
+ const omitKeys = ["ellipsis", "loading", "inputProps", "filterCheckedOnly", "checkAllOnClear", "defaultCheckAll", "onUpdate:checkedKeys", "onUpdateCheckedKeys"];
305613
305775
  return omit$4({
305614
305776
  ...props2,
305615
305777
  ...attrs
305616
- }, ["ellipsis", "loading", "inputProps"]);
305778
+ }, omitKeys);
305617
305779
  });
305618
305780
  const extendedNodeProps = computed(() => {
305619
305781
  return (params) => {
@@ -305630,6 +305792,26 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
305630
305792
  };
305631
305793
  };
305632
305794
  });
305795
+ const getFilteredCheckedKeys = () => {
305796
+ var _a2, _b2;
305797
+ const checkedData = (_a2 = elRef.value) == null ? void 0 : _a2.getCheckedData();
305798
+ if (!((_b2 = checkedData == null ? void 0 : checkedData.keys) == null ? void 0 : _b2.length) || !searchValue.value) {
305799
+ return (checkedData == null ? void 0 : checkedData.keys) || [];
305800
+ }
305801
+ return checkedData.keys.filter((key2) => visibleKeysSet.value.has(key2));
305802
+ };
305803
+ const getFilteredCheckedData = () => {
305804
+ var _a2;
305805
+ const checkedData = (_a2 = elRef.value) == null ? void 0 : _a2.getCheckedData();
305806
+ if (!checkedData || !searchValue.value) {
305807
+ return checkedData;
305808
+ }
305809
+ const keyField = props2.keyField || "key";
305810
+ return {
305811
+ keys: checkedData.keys.filter((key2) => visibleKeysSet.value.has(key2)),
305812
+ options: checkedData.options.filter((opt) => visibleKeysSet.value.has(opt[keyField]))
305813
+ };
305814
+ };
305633
305815
  const exposeMthods = {
305634
305816
  scrollTo: (...args) => {
305635
305817
  var _a2;
@@ -305642,7 +305824,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
305642
305824
  getIndeterminateData: () => {
305643
305825
  var _a2;
305644
305826
  return (_a2 = elRef.value) == null ? void 0 : _a2.getIndeterminateData();
305645
- }
305827
+ },
305828
+ getFilteredCheckedKeys,
305829
+ getFilteredCheckedData,
305830
+ getSearchValue: () => searchValue.value,
305831
+ getVisibleKeys: () => visibleKeysSet.value
305646
305832
  };
305647
305833
  __expose({
305648
305834
  ...exposeMthods
@@ -305676,7 +305862,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
305676
305862
  ref: elRef
305677
305863
  }, getBindValue.value, {
305678
305864
  pattern: searchValue.value,
305679
- "node-props": extendedNodeProps.value
305865
+ "node-props": extendedNodeProps.value,
305866
+ "onUpdate:checkedKeys": handleUpdateCheckedKeys
305680
305867
  }), createSlots({
305681
305868
  empty: withCtx(() => [renderSlot(_ctx.$slots, "empty", {}, () => [createVNode(unref(Empty$1), {
305682
305869
  class: "mx-auto"
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { _, ad, a2, a3, a4, aa, a5, a8, a6, a7, a9, ab, e, b, h, ae, ag, ah, ai, aj, ak, af, al, am, an, ao, ap, aq, ar, as, B, $, N, Q, R, S, q, a0, y, W, a, i, f, j, k, l, t, v, T, w, x, z, A, C, F, G, I, H, J, O, P, U, V, X, L, ac, aZ, aR, au, a1, aW, av, aw, aA, aB, aF, az, aC, at, aG, ax, ay, aH, aI, aJ, aK, aL, aM, aN, aO, aP, aQ, aS, Y, aY, aX, aV, aD, s, D, Z, o, K, aT, aU, aE, m, p, r, M, u, E, n } from "./index-JCi8uj7s.mjs";
1
+ import { _, ad, a2, a3, a4, aa, a5, a8, a6, a7, a9, ab, e, b, h, ae, ag, ah, ai, aj, ak, af, al, am, an, ao, ap, aq, ar, as, B, $, N, Q, R, S, q, a0, y, W, a, i, f, j, k, l, t, v, T, w, x, z, A, C, F, G, I, H, J, O, P, U, V, X, L, ac, aZ, aR, au, a1, aW, av, aw, aA, aB, aF, az, aC, at, aG, ax, ay, aH, aI, aJ, aK, aL, aM, aN, aO, aP, aQ, aS, Y, aY, aX, aV, aD, s, D, Z, o, K, aT, aU, aE, m, p, r, M, u, E, n } from "./index-B9_Aevn6.mjs";
2
2
  export {
3
3
  _ as ApiComponent,
4
4
  ad as Badge,