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