@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.
@@ -7894,7 +7894,7 @@ var VcComponents = (function (exports, vue) {
7894
7894
  el: "body",
7895
7895
  alive: false,
7896
7896
  multiple: false,
7897
- aliveRegExp: { className: /(vc-hack-alive|vc-hack-cp)/ },
7897
+ aliveRegExp: { className: /(vc-portal-alive)/ },
7898
7898
  aliveVisibleKey: "isVisible",
7899
7899
  aliveUpdateKey: "update",
7900
7900
  leaveDelay: 300,
@@ -8121,7 +8121,8 @@ var VcComponents = (function (exports, vue) {
8121
8121
  leaf = Portal.leafs.get(name);
8122
8122
  leaf.target = target;
8123
8123
  leaf.propsData.value = propsData$;
8124
- leaf.wrapper?.[aliveUpdateKey]?.(options);
8124
+ const next = leaf.wrapper?.[aliveUpdateKey];
8125
+ next && vue.nextTick(() => next(options));
8125
8126
  } else {
8126
8127
  const wrapper = this.wrapper;
8127
8128
  const app = vue.createApp({
@@ -8136,7 +8137,7 @@ var VcComponents = (function (exports, vue) {
8136
8137
  if (container && e.target && !container.contains(e.target) && !path?.some((item) => utils.eleInRegExp(item, aliveRegExp))) {
8137
8138
  /* istanbul ignore else -- @preserve */
8138
8139
  if (leaf.wrapper && leaf.wrapper?.[aliveVisibleKey]) {
8139
- leaf.wrapper[aliveVisibleKey] = false;
8140
+ typeof leaf.wrapper[aliveVisibleKey] === "function" ? leaf.wrapper[aliveVisibleKey](false) : leaf.wrapper[aliveVisibleKey] = false;
8140
8141
  }
8141
8142
  leaveDelay ? setTimeout($onDestroyed, leaveDelay) : $onDestroyed();
8142
8143
  }
@@ -8792,6 +8793,8 @@ var VcComponents = (function (exports, vue) {
8792
8793
  const props$19 = {
8793
8794
  ...pick(props$1c, popoverKeys$1),
8794
8795
  ...pick(props$1g, inputKeys$2),
8796
+ renderOption: [Function],
8797
+ renderOptionGroup: [Function],
8795
8798
  data: {
8796
8799
  type: Array,
8797
8800
  default: () => []
@@ -10219,7 +10222,7 @@ var VcComponents = (function (exports, vue) {
10219
10222
 
10220
10223
  /** @jsxImportSource vue */
10221
10224
 
10222
- function _isSlot$3(s) {
10225
+ function _isSlot$2(s) {
10223
10226
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
10224
10227
  }
10225
10228
  const COMPONENT_NAME$1w = 'vc-expand';
@@ -10243,7 +10246,7 @@ var VcComponents = (function (exports, vue) {
10243
10246
  enter: 200,
10244
10247
  leave: 200
10245
10248
  }
10246
- }, _isSlot$3(_slot = vue.withDirectives(vue.createVNode(Content, null, {
10249
+ }, _isSlot$2(_slot = vue.withDirectives(vue.createVNode(Content, null, {
10247
10250
  default: () => [(props.alive || !props.alive && isActive.value) && slots.default?.()]
10248
10251
  }), [[vue.vShow, isActive.value]])) ? _slot : {
10249
10252
  default: () => [_slot]
@@ -10393,7 +10396,7 @@ var VcComponents = (function (exports, vue) {
10393
10396
 
10394
10397
  /** @jsxImportSource vue */
10395
10398
 
10396
- function _isSlot$2(s) {
10399
+ function _isSlot$1(s) {
10397
10400
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
10398
10401
  }
10399
10402
  const COMPONENT_NAME$1t = 'vc-countdown';
@@ -10528,7 +10531,7 @@ var VcComponents = (function (exports, vue) {
10528
10531
  return (// @ts-ignore
10529
10532
  vue.createVNode(Content, {
10530
10533
  "class": "vc-countdown"
10531
- }, _isSlot$2(_slot = slots.default(binds.value)) ? _slot : {
10534
+ }, _isSlot$1(_slot = slots.default(binds.value)) ? _slot : {
10532
10535
  default: () => [_slot]
10533
10536
  })
10534
10537
  );
@@ -21231,7 +21234,9 @@ var VcComponents = (function (exports, vue) {
21231
21234
  filterable: {
21232
21235
  type: Boolean,
21233
21236
  default: true
21234
- }
21237
+ },
21238
+ render: [Function],
21239
+ row: Object
21235
21240
  };
21236
21241
 
21237
21242
  /** @jsxImportSource vue */
@@ -21248,7 +21253,7 @@ var VcComponents = (function (exports, vue) {
21248
21253
  const v = String(props.label || props.value);
21249
21254
  return v.trim();
21250
21255
  });
21251
- const isSelect = vue.computed(() => {
21256
+ const isChecked = vue.computed(() => {
21252
21257
  const {
21253
21258
  current
21254
21259
  } = owner.exposed;
@@ -21265,15 +21270,24 @@ var VcComponents = (function (exports, vue) {
21265
21270
  const regex = owner.exposed.searchRegex.value;
21266
21271
  return regex.test(formatterLabel.value) || !props.filterable;
21267
21272
  });
21268
- const handleSelect = e => {
21269
- e.stopPropagation();
21273
+ const customOptions = vue.computed(() => {
21274
+ return {
21275
+ store: {
21276
+ last: isLast.value,
21277
+ checked: isChecked.value,
21278
+ click: handleClick
21279
+ },
21280
+ row: props.row
21281
+ };
21282
+ });
21283
+ const handleClick = () => {
21270
21284
  // 禁止操作
21271
21285
  if (props.disabled) return;
21272
21286
  // 已选中,弹层关闭
21273
- if (!owner.exposed.multiple.value && isSelect.value) {
21287
+ if (!owner.exposed.multiple.value && isChecked.value) {
21274
21288
  owner.exposed.close();
21275
21289
  return;
21276
- } else if (isSelect.value) {
21290
+ } else if (isChecked.value) {
21277
21291
  owner.exposed.remove(props.value, formatterLabel.value);
21278
21292
  return;
21279
21293
  }
@@ -21284,15 +21298,17 @@ var VcComponents = (function (exports, vue) {
21284
21298
  };
21285
21299
  return () => {
21286
21300
  if (!isActive.value) return;
21287
- return vue.createVNode("div", {
21301
+ return typeof props.render === 'function' ? vue.createVNode(Customer, vue.mergeProps({
21302
+ "render": props.render
21303
+ }, customOptions.value), null) : slots.default ? slots.default(customOptions.value) : vue.createVNode("div", {
21288
21304
  "disabled": props.disabled && 'disabled',
21289
21305
  "class": [{
21290
- 'is-select': isSelect.value,
21306
+ 'is-select': isChecked.value,
21291
21307
  'is-last': isLast.value
21292
21308
  }, 'vc-select-option'],
21293
- "onClick": handleSelect,
21309
+ "onClick": vue.withModifiers(handleClick, ['stop']),
21294
21310
  "onMousedown": handlePrevent
21295
- }, [slots.default ? slots.default() : formatterLabel.value, isSelect.value && vue.createVNode(Icon, {
21311
+ }, [formatterLabel.value, isChecked.value && vue.createVNode(Icon, {
21296
21312
  "type": "correct"
21297
21313
  }, null)]);
21298
21314
  };
@@ -21306,7 +21322,9 @@ var VcComponents = (function (exports, vue) {
21306
21322
  },
21307
21323
  label: {
21308
21324
  type: [String, Number]
21309
- }
21325
+ },
21326
+ row: Object,
21327
+ render: [Function]
21310
21328
  };
21311
21329
 
21312
21330
  /** @jsxImportSource vue */
@@ -21322,10 +21340,19 @@ var VcComponents = (function (exports, vue) {
21322
21340
  const v = String(props.label || props.value);
21323
21341
  return v.trim();
21324
21342
  });
21343
+ const customOptions = vue.computed(() => {
21344
+ return {
21345
+ row: props.row
21346
+ };
21347
+ });
21325
21348
  return () => {
21326
21349
  return vue.createVNode("div", {
21327
21350
  "class": "vc-select-option-group"
21328
- }, [vue.createVNode("div", {
21351
+ }, [typeof props.render === 'function' ? vue.createVNode(Customer, vue.mergeProps({
21352
+ "render": props.render
21353
+ }, customOptions.value), null) : slots.title ? slots.title({
21354
+ row: props.row
21355
+ }) : vue.createVNode("div", {
21329
21356
  "class": "vc-select-option-group__title"
21330
21357
  }, [formatterLabel.value]), vue.createVNode("div", null, [slots?.default?.()])]);
21331
21358
  };
@@ -21334,9 +21361,6 @@ var VcComponents = (function (exports, vue) {
21334
21361
 
21335
21362
  /** @jsxImportSource vue */
21336
21363
 
21337
- function _isSlot$1(s) {
21338
- return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
21339
- }
21340
21364
  const COMPONENT_NAME$H = 'vc-select';
21341
21365
  const Select = /* @__PURE__ */ vue.defineComponent({
21342
21366
  name: COMPONENT_NAME$H,
@@ -21562,29 +21586,41 @@ var VcComponents = (function (exports, vue) {
21562
21586
  "max-height": "200px"
21563
21587
  }, {
21564
21588
  default: () => [props.data ? vue.createVNode("div", null, [props.data.map(item => {
21565
- let _slot;
21566
- return Array.isArray(item.children) ? vue.createVNode(OptionGroup, {
21589
+ return Array.isArray(item.children) && item.children.length ? vue.createVNode(OptionGroup, {
21590
+ "row": item,
21567
21591
  "value": item.value,
21568
21592
  "label": item.label,
21569
- "key": item.value
21570
- }, _isSlot$1(_slot = item.children.map($item => {
21571
- return vue.createVNode(Option, {
21572
- "key": $item.value,
21573
- "value": $item.value,
21574
- "label": $item.label,
21575
- "disabled": $item.disabled,
21576
- "filterable": $item.filterable
21577
- }, null);
21578
- })) ? _slot : {
21579
- default: () => [_slot]
21593
+ "key": item.value,
21594
+ "render": props.renderOptionGroup
21595
+ }, {
21596
+ title: slots?.optionGroup,
21597
+ default: () => {
21598
+ return item.children.map($item => {
21599
+ return vue.createVNode(Option, {
21600
+ "key": $item.value,
21601
+ "row": $item,
21602
+ "value": $item.value,
21603
+ "label": $item.label,
21604
+ "disabled": $item.disabled,
21605
+ "filterable": $item.filterable,
21606
+ "render": props.renderOption
21607
+ }, {
21608
+ default: slots?.option
21609
+ });
21610
+ });
21611
+ }
21580
21612
  }) : vue.createVNode(Option, {
21581
21613
  "key": item.value,
21614
+ "row": item,
21582
21615
  "value": item.value,
21583
21616
  "label": item.label,
21584
21617
  "disabled": item.disabled,
21585
- "filterable": item.filterable
21586
- }, null);
21587
- })]) : slots.default?.()]
21618
+ "filterable": item.filterable,
21619
+ "render": props.renderOption
21620
+ }, {
21621
+ default: slots?.option
21622
+ });
21623
+ })]) : slots?.default?.()]
21588
21624
  })]);
21589
21625
  }
21590
21626
  });
@@ -29349,116 +29385,36 @@ var VcComponents = (function (exports, vue) {
29349
29385
  };
29350
29386
  };
29351
29387
 
29352
- const selectKeys = [
29353
- "separator",
29354
- "numerable",
29355
- "nullValue"
29356
- ];
29357
29388
  const props$4 = {
29358
- ...pick(props$19, selectKeys),
29359
- // 暂不支持,仅作为默认值
29360
- max: {
29361
- type: Number,
29362
- default: Infinity,
29363
- validator: (v) => v >= 1
29364
- },
29365
- // 确保所有value是唯一的; 否则会出现问题
29366
- data: {
29367
- type: Array,
29368
- default: () => []
29369
- },
29370
- emptyText: {
29371
- type: String,
29372
- default: "暂无数据"
29373
- },
29374
- renderAfterExpand: {
29375
- type: Boolean,
29376
- default: true
29377
- },
29378
- checkStrictly: {
29379
- type: Boolean,
29380
- default: false
29381
- },
29382
- defaultExpandAll: Boolean,
29383
- expandOnClickNode: {
29384
- type: Boolean,
29385
- default: true
29386
- },
29387
- checkOnClickNode: Boolean,
29388
- checkDescendants: {
29389
- type: Boolean,
29390
- default: false
29389
+ node: {
29390
+ type: Object,
29391
+ default: () => ({})
29391
29392
  },
29392
- autoExpandParent: {
29393
+ renderNodeLabel: Function,
29394
+ renderNodeAfterExpand: {
29393
29395
  type: Boolean,
29394
29396
  default: true
29395
29397
  },
29396
- // checkedValues -> modelValue
29397
- modelValue: [String, Number, Array],
29398
- // Value[]
29399
- expandedValues: {
29400
- type: Array,
29401
- default: () => []
29402
- },
29403
- currentNodeValue: [String, Number],
29404
- render: Function,
29405
29398
  showCheckbox: {
29406
29399
  type: Boolean,
29407
29400
  default: false
29408
29401
  },
29409
- draggable: {
29410
- type: Boolean,
29411
- default: false
29412
- },
29413
- allowDrag: Function,
29414
- allowDrop: Function,
29415
- lazy: {
29416
- type: Boolean,
29417
- default: false
29418
- },
29419
- highlightCurrent: Boolean,
29420
- loadData: Function,
29421
- filterNode: Function,
29422
29402
  accordion: {
29423
29403
  type: Boolean,
29424
29404
  default: false
29425
29405
  },
29426
- indent: {
29427
- type: Number,
29428
- default: 18
29429
- },
29430
- iconClass: String,
29431
- keyValue: {
29432
- type: Object,
29433
- default: () => KEY_VALUE
29434
- },
29435
29406
  allowDispatch: {
29436
29407
  type: Boolean,
29437
29408
  default: true
29438
29409
  }
29439
29410
  };
29440
29411
 
29441
- const treeKeys$1 = [
29442
- "render",
29443
- "renderAfterExpand",
29444
- "showCheckbox",
29445
- "accordion",
29446
- "allowDispatch"
29447
- ];
29448
- const props$3 = {
29449
- ...pick(props$4, treeKeys$1),
29450
- node: {
29451
- type: Object,
29452
- default: () => ({})
29453
- }
29454
- };
29455
-
29456
29412
  /** @jsxImportSource vue */
29457
29413
 
29458
29414
  const COMPONENT_NAME$5 = 'vc-tree-node';
29459
29415
  const TreeNodeContent = /* @__PURE__ */ vue.defineComponent({
29460
29416
  name: COMPONENT_NAME$5,
29461
- props: props$3,
29417
+ props: props$4,
29462
29418
  emits: ['node-expand'],
29463
29419
  setup(props, {
29464
29420
  emit
@@ -29632,20 +29588,20 @@ var VcComponents = (function (exports, vue) {
29632
29588
  }, null), node.states.loading && vue.createVNode(Spin, {
29633
29589
  "size": 12,
29634
29590
  "class": "vc-tree-node__loading-icon"
29635
- }, null), props.render ? vue.createVNode(Customer, {
29636
- "render": props.render,
29591
+ }, null), props.renderNodeLabel ? vue.createVNode(Customer, {
29592
+ "render": props.renderNodeLabel,
29637
29593
  "store": node,
29638
29594
  "row": node.states.data
29639
29595
  }, null) : vue.createVNode("span", null, [node.getter.label])]), vue.createVNode(TransitionCollapse, null, {
29640
- default: () => [(!props.renderAfterExpand || childNodeRendered.value) && vue.withDirectives(vue.createVNode("div", {
29596
+ default: () => [(!props.renderNodeAfterExpand || childNodeRendered.value) && vue.withDirectives(vue.createVNode("div", {
29641
29597
  "aria-expanded": expanded.value,
29642
29598
  "class": "vc-tree-node__children",
29643
29599
  "role": "group"
29644
29600
  }, [node.childNodes.map(child => {
29645
29601
  return vue.createVNode(TreeNodeContent, {
29646
29602
  "key": getNodeKey(child),
29647
- "render": props.render,
29648
- "renderAfterExpand": props.renderAfterExpand,
29603
+ "renderNodeLabel": props.renderNodeLabel,
29604
+ "renderNodeAfterExpand": props.renderNodeAfterExpand,
29649
29605
  "showCheckbox": props.showCheckbox,
29650
29606
  "allowDispatch": props.allowDispatch,
29651
29607
  "accordion": props.accordion,
@@ -29874,12 +29830,92 @@ var VcComponents = (function (exports, vue) {
29874
29830
  };
29875
29831
  };
29876
29832
 
29833
+ const selectKeys = [
29834
+ "separator",
29835
+ "numerable",
29836
+ "nullValue"
29837
+ ];
29838
+ const treeNodeContentKeys = [
29839
+ "renderNodeLabel",
29840
+ "renderNodeAfterExpand",
29841
+ "showCheckbox",
29842
+ "accordion",
29843
+ "allowDispatch"
29844
+ ];
29845
+ const props$3 = {
29846
+ ...pick(props$19, selectKeys),
29847
+ ...pick(props$4, treeNodeContentKeys),
29848
+ // 暂不支持,仅作为默认值
29849
+ max: {
29850
+ type: Number,
29851
+ default: Infinity,
29852
+ validator: (v) => v >= 1
29853
+ },
29854
+ // 确保所有value是唯一的; 否则会出现问题
29855
+ data: {
29856
+ type: Array,
29857
+ default: () => []
29858
+ },
29859
+ emptyText: {
29860
+ type: String,
29861
+ default: "暂无数据"
29862
+ },
29863
+ checkStrictly: {
29864
+ type: Boolean,
29865
+ default: false
29866
+ },
29867
+ defaultExpandAll: Boolean,
29868
+ expandOnClickNode: {
29869
+ type: Boolean,
29870
+ default: true
29871
+ },
29872
+ checkOnClickNode: Boolean,
29873
+ checkDescendants: {
29874
+ type: Boolean,
29875
+ default: false
29876
+ },
29877
+ autoExpandParent: {
29878
+ type: Boolean,
29879
+ default: true
29880
+ },
29881
+ // checkedValues -> modelValue
29882
+ modelValue: [String, Number, Array],
29883
+ // Value[]
29884
+ expandedValues: {
29885
+ type: Array,
29886
+ default: () => []
29887
+ },
29888
+ currentNodeValue: [String, Number],
29889
+ draggable: {
29890
+ type: Boolean,
29891
+ default: false
29892
+ },
29893
+ allowDrag: Function,
29894
+ allowDrop: Function,
29895
+ lazy: {
29896
+ type: Boolean,
29897
+ default: false
29898
+ },
29899
+ highlightCurrent: Boolean,
29900
+ loadData: Function,
29901
+ filterNode: Function,
29902
+ indent: {
29903
+ type: Number,
29904
+ default: 18
29905
+ },
29906
+ iconClass: String,
29907
+ keyValue: {
29908
+ type: Object,
29909
+ default: () => KEY_VALUE
29910
+ }
29911
+ };
29912
+
29877
29913
  /** @jsxImportSource vue */
29878
29914
 
29879
29915
  const COMPONENT_NAME$4 = 'vc-tree';
29880
29916
  const Tree$1 = /* @__PURE__ */ vue.defineComponent({
29881
29917
  name: COMPONENT_NAME$4,
29882
- props: props$4,
29918
+ props: props$3,
29883
29919
  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'],
29884
29920
  setup(props, {
29885
29921
  expose,
@@ -30053,8 +30089,8 @@ var VcComponents = (function (exports, vue) {
30053
30089
  }, [root.childNodes.map(child => {
30054
30090
  return vue.createVNode(TreeNodeContent, {
30055
30091
  "key": getNodeKey(child),
30056
- "render": props.render,
30057
- "renderAfterExpand": props.renderAfterExpand,
30092
+ "renderNodeLabel": props.renderNodeLabel,
30093
+ "renderNodeAfterExpand": props.renderNodeAfterExpand,
30058
30094
  "showCheckbox": props.showCheckbox,
30059
30095
  "allowDispatch": props.allowDispatch,
30060
30096
  "accordion": props.accordion,
@@ -30076,11 +30112,12 @@ var VcComponents = (function (exports, vue) {
30076
30112
  const treeKeys = [
30077
30113
  "checkStrictly",
30078
30114
  "data",
30079
- "max"
30115
+ "max",
30116
+ "renderNodeLabel"
30080
30117
  ];
30081
30118
  const props$2 = {
30082
30119
  ...props$19,
30083
- ...pick(props$4, treeKeys)
30120
+ ...pick(props$3, treeKeys)
30084
30121
  };
30085
30122
 
30086
30123
  /** @jsxImportSource vue */
@@ -30304,6 +30341,7 @@ var VcComponents = (function (exports, vue) {
30304
30341
  "checkStrictly": props.checkStrictly,
30305
30342
  "allowDispatch": false,
30306
30343
  "showCheckbox": true,
30344
+ "renderNodeLabel": props.renderNodeLabel,
30307
30345
  "onChange": handleChange
30308
30346
  }, null)]
30309
30347
  })]);