@deot/vc-components 1.0.39 → 1.0.40

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