@deot/vc-components 1.0.39 → 1.0.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -2386,7 +2386,7 @@ const defaults = {
2386
2386
  el: "body",
2387
2387
  alive: false,
2388
2388
  multiple: false,
2389
- aliveRegExp: { className: /(vc-hack-alive|vc-hack-cp)/ },
2389
+ aliveRegExp: { className: /(vc-portal-alive)/ },
2390
2390
  aliveVisibleKey: "isVisible",
2391
2391
  aliveUpdateKey: "update",
2392
2392
  leaveDelay: 300,
@@ -2613,7 +2613,8 @@ class Portal {
2613
2613
  leaf = Portal.leafs.get(name);
2614
2614
  leaf.target = target;
2615
2615
  leaf.propsData.value = propsData$;
2616
- leaf.wrapper?.[aliveUpdateKey]?.(options);
2616
+ const next = leaf.wrapper?.[aliveUpdateKey];
2617
+ next && vue.nextTick(() => next(options));
2617
2618
  } else {
2618
2619
  const wrapper = this.wrapper;
2619
2620
  const app = vue.createApp({
@@ -2628,7 +2629,7 @@ class Portal {
2628
2629
  if (container && e.target && !container.contains(e.target) && !path?.some((item) => vcShared.Utils.eleInRegExp(item, aliveRegExp))) {
2629
2630
  /* istanbul ignore else -- @preserve */
2630
2631
  if (leaf.wrapper && leaf.wrapper?.[aliveVisibleKey]) {
2631
- leaf.wrapper[aliveVisibleKey] = false;
2632
+ typeof leaf.wrapper[aliveVisibleKey] === "function" ? leaf.wrapper[aliveVisibleKey](false) : leaf.wrapper[aliveVisibleKey] = false;
2632
2633
  }
2633
2634
  leaveDelay ? setTimeout($onDestroyed, leaveDelay) : $onDestroyed();
2634
2635
  }
@@ -3284,6 +3285,8 @@ const popoverKeys$1 = [
3284
3285
  const props$19 = {
3285
3286
  ...lodashEs.pick(props$1c, popoverKeys$1),
3286
3287
  ...lodashEs.pick(props$1g, inputKeys$2),
3288
+ renderOption: [Function],
3289
+ renderOptionGroup: [Function],
3287
3290
  data: {
3288
3291
  type: Array,
3289
3292
  default: () => []
@@ -4711,7 +4714,7 @@ const props$$ = {
4711
4714
 
4712
4715
  /** @jsxImportSource vue */
4713
4716
 
4714
- function _isSlot$3(s) {
4717
+ function _isSlot$2(s) {
4715
4718
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
4716
4719
  }
4717
4720
  const COMPONENT_NAME$1w = 'vc-expand';
@@ -4735,7 +4738,7 @@ const Expand$1 = /* @__PURE__ */ vue.defineComponent({
4735
4738
  enter: 200,
4736
4739
  leave: 200
4737
4740
  }
4738
- }, _isSlot$3(_slot = vue.withDirectives(vue.createVNode(Content, null, {
4741
+ }, _isSlot$2(_slot = vue.withDirectives(vue.createVNode(Content, null, {
4739
4742
  default: () => [(props.alive || !props.alive && isActive.value) && slots.default?.()]
4740
4743
  }), [[vue.vShow, isActive.value]])) ? _slot : {
4741
4744
  default: () => [_slot]
@@ -4885,7 +4888,7 @@ const formatter = (format, arr) => {
4885
4888
 
4886
4889
  /** @jsxImportSource vue */
4887
4890
 
4888
- function _isSlot$2(s) {
4891
+ function _isSlot$1(s) {
4889
4892
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
4890
4893
  }
4891
4894
  const COMPONENT_NAME$1t = 'vc-countdown';
@@ -5020,7 +5023,7 @@ const Countdown = /* @__PURE__ */ vue.defineComponent({
5020
5023
  return (// @ts-ignore
5021
5024
  vue.createVNode(Content, {
5022
5025
  "class": "vc-countdown"
5023
- }, _isSlot$2(_slot = slots.default(binds.value)) ? _slot : {
5026
+ }, _isSlot$1(_slot = slots.default(binds.value)) ? _slot : {
5024
5027
  default: () => [_slot]
5025
5028
  })
5026
5029
  );
@@ -12336,7 +12339,9 @@ const props$u = {
12336
12339
  filterable: {
12337
12340
  type: Boolean,
12338
12341
  default: true
12339
- }
12342
+ },
12343
+ render: [Function],
12344
+ row: Object
12340
12345
  };
12341
12346
 
12342
12347
  /** @jsxImportSource vue */
@@ -12353,7 +12358,7 @@ const Option = /* @__PURE__ */ vue.defineComponent({
12353
12358
  const v = String(props.label || props.value);
12354
12359
  return v.trim();
12355
12360
  });
12356
- const isSelect = vue.computed(() => {
12361
+ const isChecked = vue.computed(() => {
12357
12362
  const {
12358
12363
  current
12359
12364
  } = owner.exposed;
@@ -12370,15 +12375,24 @@ const Option = /* @__PURE__ */ vue.defineComponent({
12370
12375
  const regex = owner.exposed.searchRegex.value;
12371
12376
  return regex.test(formatterLabel.value) || !props.filterable;
12372
12377
  });
12373
- const handleSelect = e => {
12374
- e.stopPropagation();
12378
+ const customOptions = vue.computed(() => {
12379
+ return {
12380
+ store: {
12381
+ last: isLast.value,
12382
+ checked: isChecked.value,
12383
+ click: handleClick
12384
+ },
12385
+ row: props.row
12386
+ };
12387
+ });
12388
+ const handleClick = () => {
12375
12389
  // 禁止操作
12376
12390
  if (props.disabled) return;
12377
12391
  // 已选中,弹层关闭
12378
- if (!owner.exposed.multiple.value && isSelect.value) {
12392
+ if (!owner.exposed.multiple.value && isChecked.value) {
12379
12393
  owner.exposed.close();
12380
12394
  return;
12381
- } else if (isSelect.value) {
12395
+ } else if (isChecked.value) {
12382
12396
  owner.exposed.remove(props.value, formatterLabel.value);
12383
12397
  return;
12384
12398
  }
@@ -12389,15 +12403,17 @@ const Option = /* @__PURE__ */ vue.defineComponent({
12389
12403
  };
12390
12404
  return () => {
12391
12405
  if (!isActive.value) return;
12392
- return vue.createVNode("div", {
12406
+ return typeof props.render === 'function' ? vue.createVNode(Customer, vue.mergeProps({
12407
+ "render": props.render
12408
+ }, customOptions.value), null) : slots.default ? slots.default(customOptions.value) : vue.createVNode("div", {
12393
12409
  "disabled": props.disabled && 'disabled',
12394
12410
  "class": [{
12395
- 'is-select': isSelect.value,
12411
+ 'is-select': isChecked.value,
12396
12412
  'is-last': isLast.value
12397
12413
  }, 'vc-select-option'],
12398
- "onClick": handleSelect,
12414
+ "onClick": vue.withModifiers(handleClick, ['stop']),
12399
12415
  "onMousedown": handlePrevent
12400
- }, [slots.default ? slots.default() : formatterLabel.value, isSelect.value && vue.createVNode(Icon, {
12416
+ }, [formatterLabel.value, isChecked.value && vue.createVNode(Icon, {
12401
12417
  "type": "correct"
12402
12418
  }, null)]);
12403
12419
  };
@@ -12411,7 +12427,9 @@ const props$t = {
12411
12427
  },
12412
12428
  label: {
12413
12429
  type: [String, Number]
12414
- }
12430
+ },
12431
+ row: Object,
12432
+ render: [Function]
12415
12433
  };
12416
12434
 
12417
12435
  /** @jsxImportSource vue */
@@ -12427,10 +12445,19 @@ const OptionGroup = /* @__PURE__ */ vue.defineComponent({
12427
12445
  const v = String(props.label || props.value);
12428
12446
  return v.trim();
12429
12447
  });
12448
+ const customOptions = vue.computed(() => {
12449
+ return {
12450
+ row: props.row
12451
+ };
12452
+ });
12430
12453
  return () => {
12431
12454
  return vue.createVNode("div", {
12432
12455
  "class": "vc-select-option-group"
12433
- }, [vue.createVNode("div", {
12456
+ }, [typeof props.render === 'function' ? vue.createVNode(Customer, vue.mergeProps({
12457
+ "render": props.render
12458
+ }, customOptions.value), null) : slots.title ? slots.title({
12459
+ row: props.row
12460
+ }) : vue.createVNode("div", {
12434
12461
  "class": "vc-select-option-group__title"
12435
12462
  }, [formatterLabel.value]), vue.createVNode("div", null, [slots?.default?.()])]);
12436
12463
  };
@@ -12439,9 +12466,6 @@ const OptionGroup = /* @__PURE__ */ vue.defineComponent({
12439
12466
 
12440
12467
  /** @jsxImportSource vue */
12441
12468
 
12442
- function _isSlot$1(s) {
12443
- return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
12444
- }
12445
12469
  const COMPONENT_NAME$H = 'vc-select';
12446
12470
  const Select = /* @__PURE__ */ vue.defineComponent({
12447
12471
  name: COMPONENT_NAME$H,
@@ -12667,29 +12691,41 @@ const Select = /* @__PURE__ */ vue.defineComponent({
12667
12691
  "max-height": "200px"
12668
12692
  }, {
12669
12693
  default: () => [props.data ? vue.createVNode("div", null, [props.data.map(item => {
12670
- let _slot;
12671
- return Array.isArray(item.children) ? vue.createVNode(OptionGroup, {
12694
+ return Array.isArray(item.children) && item.children.length ? vue.createVNode(OptionGroup, {
12695
+ "row": item,
12672
12696
  "value": item.value,
12673
12697
  "label": item.label,
12674
- "key": item.value
12675
- }, _isSlot$1(_slot = item.children.map($item => {
12676
- return vue.createVNode(Option, {
12677
- "key": $item.value,
12678
- "value": $item.value,
12679
- "label": $item.label,
12680
- "disabled": $item.disabled,
12681
- "filterable": $item.filterable
12682
- }, null);
12683
- })) ? _slot : {
12684
- default: () => [_slot]
12698
+ "key": item.value,
12699
+ "render": props.renderOptionGroup
12700
+ }, {
12701
+ title: slots?.optionGroup,
12702
+ default: () => {
12703
+ return item.children.map($item => {
12704
+ return vue.createVNode(Option, {
12705
+ "key": $item.value,
12706
+ "row": $item,
12707
+ "value": $item.value,
12708
+ "label": $item.label,
12709
+ "disabled": $item.disabled,
12710
+ "filterable": $item.filterable,
12711
+ "render": props.renderOption
12712
+ }, {
12713
+ default: slots?.option
12714
+ });
12715
+ });
12716
+ }
12685
12717
  }) : vue.createVNode(Option, {
12686
12718
  "key": item.value,
12719
+ "row": item,
12687
12720
  "value": item.value,
12688
12721
  "label": item.label,
12689
12722
  "disabled": item.disabled,
12690
- "filterable": item.filterable
12691
- }, null);
12692
- })]) : slots.default?.()]
12723
+ "filterable": item.filterable,
12724
+ "render": props.renderOption
12725
+ }, {
12726
+ default: slots?.option
12727
+ });
12728
+ })]) : slots?.default?.()]
12693
12729
  })]);
12694
12730
  }
12695
12731
  });
@@ -20340,116 +20376,36 @@ const useCollectNode = () => {
20340
20376
  };
20341
20377
  };
20342
20378
 
20343
- const selectKeys = [
20344
- "separator",
20345
- "numerable",
20346
- "nullValue"
20347
- ];
20348
20379
  const props$4 = {
20349
- ...lodashEs.pick(props$19, selectKeys),
20350
- // 暂不支持,仅作为默认值
20351
- max: {
20352
- type: Number,
20353
- default: Infinity,
20354
- validator: (v) => v >= 1
20355
- },
20356
- // 确保所有value是唯一的; 否则会出现问题
20357
- data: {
20358
- type: Array,
20359
- default: () => []
20360
- },
20361
- emptyText: {
20362
- type: String,
20363
- default: "暂无数据"
20364
- },
20365
- renderAfterExpand: {
20366
- type: Boolean,
20367
- default: true
20368
- },
20369
- checkStrictly: {
20370
- type: Boolean,
20371
- default: false
20372
- },
20373
- defaultExpandAll: Boolean,
20374
- expandOnClickNode: {
20375
- type: Boolean,
20376
- default: true
20377
- },
20378
- checkOnClickNode: Boolean,
20379
- checkDescendants: {
20380
- type: Boolean,
20381
- default: false
20380
+ node: {
20381
+ type: Object,
20382
+ default: () => ({})
20382
20383
  },
20383
- autoExpandParent: {
20384
+ renderNodeLabel: Function,
20385
+ renderNodeAfterExpand: {
20384
20386
  type: Boolean,
20385
20387
  default: true
20386
20388
  },
20387
- // checkedValues -> modelValue
20388
- modelValue: [String, Number, Array],
20389
- // Value[]
20390
- expandedValues: {
20391
- type: Array,
20392
- default: () => []
20393
- },
20394
- currentNodeValue: [String, Number],
20395
- render: Function,
20396
20389
  showCheckbox: {
20397
20390
  type: Boolean,
20398
20391
  default: false
20399
20392
  },
20400
- draggable: {
20401
- type: Boolean,
20402
- default: false
20403
- },
20404
- allowDrag: Function,
20405
- allowDrop: Function,
20406
- lazy: {
20407
- type: Boolean,
20408
- default: false
20409
- },
20410
- highlightCurrent: Boolean,
20411
- loadData: Function,
20412
- filterNode: Function,
20413
20393
  accordion: {
20414
20394
  type: Boolean,
20415
20395
  default: false
20416
20396
  },
20417
- indent: {
20418
- type: Number,
20419
- default: 18
20420
- },
20421
- iconClass: String,
20422
- keyValue: {
20423
- type: Object,
20424
- default: () => KEY_VALUE
20425
- },
20426
20397
  allowDispatch: {
20427
20398
  type: Boolean,
20428
20399
  default: true
20429
20400
  }
20430
20401
  };
20431
20402
 
20432
- const treeKeys$1 = [
20433
- "render",
20434
- "renderAfterExpand",
20435
- "showCheckbox",
20436
- "accordion",
20437
- "allowDispatch"
20438
- ];
20439
- const props$3 = {
20440
- ...lodashEs.pick(props$4, treeKeys$1),
20441
- node: {
20442
- type: Object,
20443
- default: () => ({})
20444
- }
20445
- };
20446
-
20447
20403
  /** @jsxImportSource vue */
20448
20404
 
20449
20405
  const COMPONENT_NAME$5 = 'vc-tree-node';
20450
20406
  const TreeNodeContent = /* @__PURE__ */ vue.defineComponent({
20451
20407
  name: COMPONENT_NAME$5,
20452
- props: props$3,
20408
+ props: props$4,
20453
20409
  emits: ['node-expand'],
20454
20410
  setup(props, {
20455
20411
  emit
@@ -20623,20 +20579,20 @@ const TreeNodeContent = /* @__PURE__ */ vue.defineComponent({
20623
20579
  }, null), node.states.loading && vue.createVNode(Spin, {
20624
20580
  "size": 12,
20625
20581
  "class": "vc-tree-node__loading-icon"
20626
- }, null), props.render ? vue.createVNode(Customer, {
20627
- "render": props.render,
20582
+ }, null), props.renderNodeLabel ? vue.createVNode(Customer, {
20583
+ "render": props.renderNodeLabel,
20628
20584
  "store": node,
20629
20585
  "row": node.states.data
20630
20586
  }, null) : vue.createVNode("span", null, [node.getter.label])]), vue.createVNode(TransitionCollapse, null, {
20631
- default: () => [(!props.renderAfterExpand || childNodeRendered.value) && vue.withDirectives(vue.createVNode("div", {
20587
+ default: () => [(!props.renderNodeAfterExpand || childNodeRendered.value) && vue.withDirectives(vue.createVNode("div", {
20632
20588
  "aria-expanded": expanded.value,
20633
20589
  "class": "vc-tree-node__children",
20634
20590
  "role": "group"
20635
20591
  }, [node.childNodes.map(child => {
20636
20592
  return vue.createVNode(TreeNodeContent, {
20637
20593
  "key": getNodeKey(child),
20638
- "render": props.render,
20639
- "renderAfterExpand": props.renderAfterExpand,
20594
+ "renderNodeLabel": props.renderNodeLabel,
20595
+ "renderNodeAfterExpand": props.renderNodeAfterExpand,
20640
20596
  "showCheckbox": props.showCheckbox,
20641
20597
  "allowDispatch": props.allowDispatch,
20642
20598
  "accordion": props.accordion,
@@ -20865,12 +20821,92 @@ const useKeydown = () => {
20865
20821
  };
20866
20822
  };
20867
20823
 
20824
+ const selectKeys = [
20825
+ "separator",
20826
+ "numerable",
20827
+ "nullValue"
20828
+ ];
20829
+ const treeNodeContentKeys = [
20830
+ "renderNodeLabel",
20831
+ "renderNodeAfterExpand",
20832
+ "showCheckbox",
20833
+ "accordion",
20834
+ "allowDispatch"
20835
+ ];
20836
+ const props$3 = {
20837
+ ...lodashEs.pick(props$19, selectKeys),
20838
+ ...lodashEs.pick(props$4, treeNodeContentKeys),
20839
+ // 暂不支持,仅作为默认值
20840
+ max: {
20841
+ type: Number,
20842
+ default: Infinity,
20843
+ validator: (v) => v >= 1
20844
+ },
20845
+ // 确保所有value是唯一的; 否则会出现问题
20846
+ data: {
20847
+ type: Array,
20848
+ default: () => []
20849
+ },
20850
+ emptyText: {
20851
+ type: String,
20852
+ default: "暂无数据"
20853
+ },
20854
+ checkStrictly: {
20855
+ type: Boolean,
20856
+ default: false
20857
+ },
20858
+ defaultExpandAll: Boolean,
20859
+ expandOnClickNode: {
20860
+ type: Boolean,
20861
+ default: true
20862
+ },
20863
+ checkOnClickNode: Boolean,
20864
+ checkDescendants: {
20865
+ type: Boolean,
20866
+ default: false
20867
+ },
20868
+ autoExpandParent: {
20869
+ type: Boolean,
20870
+ default: true
20871
+ },
20872
+ // checkedValues -> modelValue
20873
+ modelValue: [String, Number, Array],
20874
+ // Value[]
20875
+ expandedValues: {
20876
+ type: Array,
20877
+ default: () => []
20878
+ },
20879
+ currentNodeValue: [String, Number],
20880
+ draggable: {
20881
+ type: Boolean,
20882
+ default: false
20883
+ },
20884
+ allowDrag: Function,
20885
+ allowDrop: Function,
20886
+ lazy: {
20887
+ type: Boolean,
20888
+ default: false
20889
+ },
20890
+ highlightCurrent: Boolean,
20891
+ loadData: Function,
20892
+ filterNode: Function,
20893
+ indent: {
20894
+ type: Number,
20895
+ default: 18
20896
+ },
20897
+ iconClass: String,
20898
+ keyValue: {
20899
+ type: Object,
20900
+ default: () => KEY_VALUE
20901
+ }
20902
+ };
20903
+
20868
20904
  /** @jsxImportSource vue */
20869
20905
 
20870
20906
  const COMPONENT_NAME$4 = 'vc-tree';
20871
20907
  const Tree = /* @__PURE__ */ vue.defineComponent({
20872
20908
  name: COMPONENT_NAME$4,
20873
- props: props$4,
20909
+ props: props$3,
20874
20910
  emits: ['update:modelValue', 'change', 'check-change', 'current-change', 'node-click', 'node-contextmenu', 'node-collapse', 'node-expand', 'check', 'node-drag-start', 'node-drag-end', 'node-drop', 'node-drag-leave', 'node-drag-enter', 'node-drag-over'],
20875
20911
  setup(props, {
20876
20912
  expose,
@@ -21044,8 +21080,8 @@ const Tree = /* @__PURE__ */ vue.defineComponent({
21044
21080
  }, [root.childNodes.map(child => {
21045
21081
  return vue.createVNode(TreeNodeContent, {
21046
21082
  "key": getNodeKey(child),
21047
- "render": props.render,
21048
- "renderAfterExpand": props.renderAfterExpand,
21083
+ "renderNodeLabel": props.renderNodeLabel,
21084
+ "renderNodeAfterExpand": props.renderNodeAfterExpand,
21049
21085
  "showCheckbox": props.showCheckbox,
21050
21086
  "allowDispatch": props.allowDispatch,
21051
21087
  "accordion": props.accordion,
@@ -21067,11 +21103,12 @@ const Tree = /* @__PURE__ */ vue.defineComponent({
21067
21103
  const treeKeys = [
21068
21104
  "checkStrictly",
21069
21105
  "data",
21070
- "max"
21106
+ "max",
21107
+ "renderNodeLabel"
21071
21108
  ];
21072
21109
  const props$2 = {
21073
21110
  ...props$19,
21074
- ...lodashEs.pick(props$4, treeKeys)
21111
+ ...lodashEs.pick(props$3, treeKeys)
21075
21112
  };
21076
21113
 
21077
21114
  /** @jsxImportSource vue */
@@ -21295,6 +21332,7 @@ const TreeSelect = /* @__PURE__ */ vue.defineComponent({
21295
21332
  "checkStrictly": props.checkStrictly,
21296
21333
  "allowDispatch": false,
21297
21334
  "showCheckbox": true,
21335
+ "renderNodeLabel": props.renderNodeLabel,
21298
21336
  "onChange": handleChange
21299
21337
  }, null)]
21300
21338
  })]);