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