lew-ui 2.6.14 → 2.6.16

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.
@@ -4,11 +4,11 @@ declare function __VLS_template(): {
4
4
  checked: any;
5
5
  certain: boolean;
6
6
  label: string;
7
- render: Function;
8
7
  disabled: boolean;
9
8
  level: number;
10
9
  isLeaf: boolean;
11
10
  extend: Record<string, any>;
11
+ icon?: (() => any) | undefined;
12
12
  __key?: string | number | undefined;
13
13
  };
14
14
  }): any;
@@ -26,9 +26,9 @@ declare const __VLS_component: import('vue').DefineComponent<globalThis.ExtractP
26
26
  description: string;
27
27
  validator(value: string | number): boolean;
28
28
  };
29
- render: {
30
- type: FunctionConstructor;
31
- default: () => void;
29
+ icon: {
30
+ type: PropType<() => any>;
31
+ default: undefined;
32
32
  description: string;
33
33
  };
34
34
  disabled: {
@@ -66,9 +66,9 @@ declare const __VLS_component: import('vue').DefineComponent<globalThis.ExtractP
66
66
  description: string;
67
67
  validator(value: string | number): boolean;
68
68
  };
69
- render: {
70
- type: FunctionConstructor;
71
- default: () => void;
69
+ icon: {
70
+ type: PropType<() => any>;
71
+ default: undefined;
72
72
  description: string;
73
73
  };
74
74
  disabled: {
@@ -95,8 +95,8 @@ declare const __VLS_component: import('vue').DefineComponent<globalThis.ExtractP
95
95
  onChange?: ((...args: any[]) => any) | undefined;
96
96
  onExpand?: ((...args: any[]) => any) | undefined;
97
97
  }>, {
98
+ icon: () => any;
98
99
  label: string;
99
- render: Function;
100
100
  disabled: boolean;
101
101
  level: number;
102
102
  isLeaf: boolean;
@@ -116,9 +116,9 @@ export declare const treeItemProps: {
116
116
  description: string;
117
117
  validator(value: string | number): boolean;
118
118
  };
119
- render: {
120
- type: FunctionConstructor;
121
- default: () => void;
119
+ icon: {
120
+ type: PropType<() => any>;
121
+ default: undefined;
122
122
  description: string;
123
123
  };
124
124
  disabled: {
package/dist/index.mjs CHANGED
@@ -3499,9 +3499,7 @@ const isVueComponent = (value) => {
3499
3499
  return false;
3500
3500
  }
3501
3501
  if (typeof value === "function") {
3502
- const str = value.toString();
3503
- if (str.includes("return h(") || str.includes("() => h(") || str.includes("createElement"))
3504
- return true;
3502
+ return true;
3505
3503
  }
3506
3504
  if (value && typeof value === "object") {
3507
3505
  if (value.__file || value.__name || value.setup || value.render || value.template)
@@ -3517,6 +3515,12 @@ const isVueComponent = (value) => {
3517
3515
  return false;
3518
3516
  }
3519
3517
  };
3518
+ const formatComponent = (value) => {
3519
+ if (isFunction$1(value)) {
3520
+ return value();
3521
+ }
3522
+ return value;
3523
+ };
3520
3524
  const imageProps = {
3521
3525
  src: {
3522
3526
  type: String,
@@ -8244,7 +8248,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
8244
8248
  }]),
8245
8249
  onClick: ($event) => select(cItem)
8246
8250
  }, [
8247
- cItem.icon ? (openBlock(), createBlock(resolveDynamicComponent(cItem.icon), {
8251
+ unref(isVueComponent)(cItem.icon) ? (openBlock(), createBlock(resolveDynamicComponent(unref(formatComponent)(cItem.icon)), {
8248
8252
  key: 0,
8249
8253
  class: "lew-menu-icon",
8250
8254
  size: 14
@@ -8272,7 +8276,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
8272
8276
  };
8273
8277
  }
8274
8278
  });
8275
- const LewMenu = /* @__PURE__ */ _export_sfc(_sfc_main$T, [["__scopeId", "data-v-68440613"]]);
8279
+ const LewMenu = /* @__PURE__ */ _export_sfc(_sfc_main$T, [["__scopeId", "data-v-e5879da8"]]);
8276
8280
  const menuTreeModel = {
8277
8281
  modelValue: {
8278
8282
  type: String,
@@ -8399,7 +8403,7 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
8399
8403
  "lew-menu-tree-item-label-collapsed": unref(collapsed)
8400
8404
  }]),
8401
8405
  style: normalizeStyle({
8402
- paddingLeft: unref(collapsed) ? "0px" : _ctx.icon() ? "36px" : "11.5px"
8406
+ paddingLeft: unref(collapsed) ? "0px" : unref(isVueComponent)(_ctx.icon) ? "36px" : "11.5px"
8403
8407
  }),
8404
8408
  onClick: withModifiers(change2, ["stop"])
8405
8409
  }, {
@@ -8408,22 +8412,25 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
8408
8412
  key: 0,
8409
8413
  props: props2
8410
8414
  }, void 0, true) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
8411
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon()), { class: "lew-menu-tree-item-icon" })),
8412
- unref(isVueComponent)(_ctx.label) ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.label), {
8415
+ unref(isVueComponent)(_ctx.icon) ? (openBlock(), createBlock(resolveDynamicComponent(unref(formatComponent)(_ctx.icon)), {
8413
8416
  key: 0,
8417
+ class: "lew-menu-tree-item-icon"
8418
+ })) : createCommentVNode("", true),
8419
+ unref(isVueComponent)(_ctx.label) ? (openBlock(), createBlock(resolveDynamicComponent(unref(formatComponent)(_ctx.label)), {
8420
+ key: 1,
8414
8421
  class: "lew-menu-tree-item-text"
8415
8422
  })) : (openBlock(), createBlock(_component_lew_text_trim, {
8416
- key: 1,
8423
+ key: 2,
8417
8424
  class: "lew-menu-tree-item-text",
8418
8425
  placement: "right",
8419
8426
  style: normalizeStyle({
8420
- maxWidth: `calc(100% - ${_ctx.icon() ? 30 : 0}px)`
8427
+ maxWidth: `calc(100% - ${unref(isVueComponent)(_ctx.icon) ? 30 : 0}px)`
8421
8428
  }),
8422
8429
  text: _ctx.label,
8423
8430
  delay: [250, 250]
8424
8431
  }, null, 8, ["style", "text"])),
8425
8432
  !_ctx.isLeaf ? (openBlock(), createBlock(Icon, {
8426
- key: 2,
8433
+ key: 3,
8427
8434
  class: "lew-menu-tree-item-chevron-right",
8428
8435
  size: 14,
8429
8436
  style: normalizeStyle({
@@ -8454,7 +8461,7 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
8454
8461
  };
8455
8462
  }
8456
8463
  });
8457
- const LewMenuTreeItem = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["__scopeId", "data-v-56731985"]]);
8464
+ const LewMenuTreeItem = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["__scopeId", "data-v-968be483"]]);
8458
8465
  const _sfc_main$R = /* @__PURE__ */ defineComponent({
8459
8466
  __name: "LewMenuTree",
8460
8467
  props: /* @__PURE__ */ mergeModels(menuTreeProps, {
@@ -8851,7 +8858,7 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
8851
8858
  default: withCtx(() => [
8852
8859
  (openBlock(true), createElementBlock(Fragment, null, renderList(visibleOptions.value, (option, index2) => {
8853
8860
  return openBlock(), createElementBlock(Fragment, null, [
8854
- unref(isVueComponent)(option.customRender) ? (openBlock(), createBlock(resolveDynamicComponent(option.customRender), {
8861
+ unref(isVueComponent)(option.customRender) ? (openBlock(), createBlock(resolveDynamicComponent(unref(formatComponent)(option.customRender)), {
8855
8862
  key: 0,
8856
8863
  onClick: ($event) => {
8857
8864
  var _a;
@@ -8865,11 +8872,11 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
8865
8872
  },
8866
8873
  class: "lew-action-box-item"
8867
8874
  }, [
8868
- unref(isVueComponent)(option.icon) ? (openBlock(), createBlock(resolveDynamicComponent(option.icon), {
8875
+ unref(isVueComponent)(option.icon) ? (openBlock(), createBlock(resolveDynamicComponent(unref(formatComponent)(option.icon)), {
8869
8876
  key: 0,
8870
8877
  class: "lew-action-box-icon"
8871
8878
  })) : createCommentVNode("", true),
8872
- unref(isVueComponent)(option.label) ? (openBlock(), createBlock(resolveDynamicComponent(option.label), {
8879
+ unref(isVueComponent)(option.label) ? (openBlock(), createBlock(resolveDynamicComponent(unref(formatComponent)(option.label)), {
8873
8880
  key: 1,
8874
8881
  onClick: ($event) => {
8875
8882
  var _a;
@@ -8888,11 +8895,11 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
8888
8895
  }, {
8889
8896
  default: withCtx(() => [
8890
8897
  createElementVNode("div", _hoisted_3$g, [
8891
- unref(isVueComponent)(_ctx.dropdownIcon) ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.dropdownIcon), {
8898
+ unref(isVueComponent)(_ctx.dropdownIcon) ? (openBlock(), createBlock(resolveDynamicComponent(unref(formatComponent)(_ctx.dropdownIcon)), {
8892
8899
  key: 0,
8893
8900
  class: "lew-action-box-icon"
8894
8901
  })) : createCommentVNode("", true),
8895
- unref(isVueComponent)(_ctx.dropdownLabel) ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.dropdownLabel), { key: 1 })) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
8902
+ unref(isVueComponent)(_ctx.dropdownLabel) ? (openBlock(), createBlock(resolveDynamicComponent(unref(formatComponent)(_ctx.dropdownLabel)), { key: 1 })) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
8896
8903
  createTextVNode(toDisplayString$1(_ctx.dropdownLabel), 1)
8897
8904
  ], 64))
8898
8905
  ])
@@ -8905,7 +8912,7 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
8905
8912
  };
8906
8913
  }
8907
8914
  });
8908
- const LewActionBox = /* @__PURE__ */ _export_sfc(_sfc_main$O, [["__scopeId", "data-v-19fa6d64"]]);
8915
+ const LewActionBox = /* @__PURE__ */ _export_sfc(_sfc_main$O, [["__scopeId", "data-v-0fde1e16"]]);
8909
8916
  const _hoisted_1$C = ["width", "height"];
8910
8917
  const _sfc_main$N = /* @__PURE__ */ defineComponent({
8911
8918
  __name: "RequiredIcon",
@@ -22817,10 +22824,9 @@ const treeItemProps = {
22817
22824
  return true;
22818
22825
  }
22819
22826
  },
22820
- render: {
22827
+ icon: {
22821
22828
  type: Function,
22822
- default: () => {
22823
- },
22829
+ default: void 0,
22824
22830
  description: "菜单树项的图标。"
22825
22831
  },
22826
22832
  disabled: {
@@ -23209,7 +23215,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
23209
23215
  certain: unref(isNodePartiallySelected)
23210
23216
  }
23211
23217
  }, void 0, true) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
23212
- _ctx.render() ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.render()), {
23218
+ unref(isVueComponent)(_ctx.icon) ? (openBlock(), createBlock(resolveDynamicComponent(unref(formatComponent)(_ctx.icon)), {
23213
23219
  key: 0,
23214
23220
  class: "lew-tree-item-text"
23215
23221
  })) : (openBlock(), createBlock(unref(LewTextTrim), {
@@ -23234,7 +23240,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
23234
23240
  };
23235
23241
  }
23236
23242
  });
23237
- const LewTreeItem = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-fe37a6d7"]]);
23243
+ const LewTreeItem = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-71f8c23d"]]);
23238
23244
  const _hoisted_1$a = {
23239
23245
  key: 0,
23240
23246
  class: "lew-result-count"
@@ -25972,7 +25978,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
25972
25978
  })) : createCommentVNode("", true)
25973
25979
  ])) : createCommentVNode("", true),
25974
25980
  createElementVNode("div", _hoisted_3$1, [
25975
- unref(isVueComponent)(item.icon) ? (openBlock(), createBlock(resolveDynamicComponent(item.icon), { key: 0 })) : createCommentVNode("", true),
25981
+ unref(isVueComponent)(item.icon) ? (openBlock(), createBlock(resolveDynamicComponent(unref(formatComponent)(item.icon)), { key: 0 })) : createCommentVNode("", true),
25976
25982
  createElementVNode("div", _hoisted_4$1, toDisplayString$1(item.label), 1)
25977
25983
  ]),
25978
25984
  _ctx.options.filter((e) => e.children).length > 0 ? (openBlock(), createBlock(Icon, {
@@ -26000,7 +26006,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
26000
26006
  };
26001
26007
  }
26002
26008
  });
26003
- const _LewContextMenu = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-ad419d70"]]);
26009
+ const _LewContextMenu = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-fb151e7c"]]);
26004
26010
  const initLewHoverMenu = () => {
26005
26011
  window.LewHoverMenu = {
26006
26012
  menu: {},
@@ -32698,6 +32704,7 @@ export {
32698
32704
  formProps,
32699
32705
  formTypeAsMap,
32700
32706
  formatBytes,
32707
+ formatComponent,
32701
32708
  formatFormByMap,
32702
32709
  fr,
32703
32710
  getAssetsFile,