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