vxe-pc-ui 3.14.20 → 3.14.21

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.
Files changed (26) hide show
  1. package/es/tree/src/tree.js +24 -19
  2. package/es/ui/index.js +1 -1
  3. package/es/ui/src/log.js +1 -1
  4. package/lib/index.umd.js +35 -26
  5. package/lib/index.umd.min.js +1 -1
  6. package/lib/tree/src/tree.js +33 -24
  7. package/lib/tree/src/tree.min.js +1 -1
  8. package/lib/ui/index.js +1 -1
  9. package/lib/ui/index.min.js +1 -1
  10. package/lib/ui/src/log.js +1 -1
  11. package/lib/ui/src/log.min.js +1 -1
  12. package/package.json +1 -1
  13. package/packages/tree/src/tree.ts +25 -19
  14. package/types/components/tree.d.ts +4 -0
  15. /package/es/icon/{iconfont.1779671249035.ttf → iconfont.1779687100417.ttf} +0 -0
  16. /package/es/icon/{iconfont.1779671249035.woff → iconfont.1779687100417.woff} +0 -0
  17. /package/es/icon/{iconfont.1779671249035.woff2 → iconfont.1779687100417.woff2} +0 -0
  18. /package/es/{iconfont.1779671249035.ttf → iconfont.1779687100417.ttf} +0 -0
  19. /package/es/{iconfont.1779671249035.woff → iconfont.1779687100417.woff} +0 -0
  20. /package/es/{iconfont.1779671249035.woff2 → iconfont.1779687100417.woff2} +0 -0
  21. /package/lib/icon/style/{iconfont.1779671249035.ttf → iconfont.1779687100417.ttf} +0 -0
  22. /package/lib/icon/style/{iconfont.1779671249035.woff → iconfont.1779687100417.woff} +0 -0
  23. /package/lib/icon/style/{iconfont.1779671249035.woff2 → iconfont.1779687100417.woff2} +0 -0
  24. /package/lib/{iconfont.1779671249035.ttf → iconfont.1779687100417.ttf} +0 -0
  25. /package/lib/{iconfont.1779671249035.woff → iconfont.1779687100417.woff} +0 -0
  26. /package/lib/{iconfont.1779671249035.woff2 → iconfont.1779687100417.woff2} +0 -0
@@ -450,6 +450,17 @@ function handleNodeDragSwapEvent($xeTree, evnt, dragNode, prevDragNode, prevDrag
450
450
  clearCrossTreeDragStatus($xeTree);
451
451
  return Promise.resolve(errRest);
452
452
  }
453
+ function handleVisibleOrCheckMode(mode, isExistChild, nLevel) {
454
+ if (mode) {
455
+ if (mode === 'first') {
456
+ return !nLevel;
457
+ }
458
+ if (mode === 'last') {
459
+ return !isExistChild;
460
+ }
461
+ }
462
+ return true;
463
+ }
453
464
  function createInternalData() {
454
465
  return {
455
466
  // initialized: false,
@@ -2498,18 +2509,15 @@ export default {
2498
2509
  }
2499
2510
  return renderEmptyElement($xeTree);
2500
2511
  },
2501
- renderRadio(h, node, nodeid, isChecked) {
2512
+ renderRadio(h, node, nodeid, isExistChild, nLevel, isChecked) {
2502
2513
  const $xeTree = this;
2503
2514
  const props = $xeTree;
2504
2515
  const { showRadio } = props;
2505
2516
  const radioOpts = $xeTree.computeRadioOpts;
2506
- const { showIcon, checkMethod, visibleMethod } = radioOpts;
2507
- const isVisible = !visibleMethod || visibleMethod({ $tree: $xeTree, node });
2508
- let isDisabled = !!checkMethod;
2517
+ const { showIcon, checkMode, checkMethod, visibleMode, visibleMethod } = radioOpts;
2518
+ const isVisible = visibleMethod ? visibleMethod({ $tree: $xeTree, node }) : handleVisibleOrCheckMode(visibleMode, isExistChild, nLevel);
2509
2519
  if (showRadio && showIcon && isVisible) {
2510
- if (checkMethod) {
2511
- isDisabled = !checkMethod({ $tree: $xeTree, node });
2512
- }
2520
+ const isDisabled = checkMethod ? !checkMethod({ $tree: $xeTree, node }) : !handleVisibleOrCheckMode(checkMode, isExistChild, nLevel);
2513
2521
  return h('div', {
2514
2522
  class: ['vxe-tree--radio-option', {
2515
2523
  'is--checked': isChecked,
@@ -2530,18 +2538,15 @@ export default {
2530
2538
  }
2531
2539
  return renderEmptyElement($xeTree);
2532
2540
  },
2533
- renderCheckbox(h, node, nodeid, isChecked, isIndeterminate) {
2541
+ renderCheckbox(h, node, nodeid, isExistChild, nLevel, isChecked, isIndeterminate) {
2534
2542
  const $xeTree = this;
2535
2543
  const props = $xeTree;
2536
2544
  const { showCheckbox } = props;
2537
2545
  const checkboxOpts = $xeTree.computeCheckboxOpts;
2538
- const { showIcon, checkMethod, visibleMethod } = checkboxOpts;
2539
- const isVisible = !visibleMethod || visibleMethod({ $tree: $xeTree, node });
2540
- let isDisabled = !!checkMethod;
2546
+ const { showIcon, checkMode, checkMethod, visibleMode, visibleMethod } = checkboxOpts;
2547
+ const isVisible = visibleMethod ? visibleMethod({ $tree: $xeTree, node }) : handleVisibleOrCheckMode(visibleMode, isExistChild, nLevel);
2541
2548
  if (showCheckbox && showIcon && isVisible) {
2542
- if (checkMethod) {
2543
- isDisabled = !checkMethod({ $tree: $xeTree, node });
2544
- }
2549
+ const isDisabled = checkMethod ? !checkMethod({ $tree: $xeTree, node }) : !handleVisibleOrCheckMode(checkMode, isExistChild, nLevel);
2545
2550
  return h('div', {
2546
2551
  class: ['vxe-tree--checkbox-option', {
2547
2552
  'is--checked': isChecked,
@@ -2576,12 +2581,12 @@ export default {
2576
2581
  const titleField = $xeTree.computeTitleField;
2577
2582
  const hasChildField = $xeTree.computeHasChildField;
2578
2583
  const childList = XEUtils.get(node, childrenField);
2579
- const hasChild = childList && childList.length;
2584
+ const isExistChild = childList && childList.length > 0;
2580
2585
  const iconSlot = slots.icon;
2581
2586
  const titleSlot = slots.title;
2582
2587
  const extraSlot = slots.extra;
2583
2588
  const isExpand = updateExpandedFlag && treeExpandedMaps[nodeid];
2584
- const nodeItem = nodeMaps[nodeid];
2589
+ const nodeItem = nodeMaps[nodeid] || {};
2585
2590
  const nodeValue = XEUtils.get(node, titleField);
2586
2591
  const nLevel = nodeItem.level;
2587
2592
  let isRadioChecked = false;
@@ -2655,7 +2660,7 @@ export default {
2655
2660
  : renderEmptyElement($xeTree),
2656
2661
  h('div', {
2657
2662
  class: 'vxe-tree--node-item-switcher'
2658
- }, showIcon && (lazy ? (isLazyLoaded ? hasChild : hasLazyChilds) : hasChild)
2663
+ }, showIcon && (lazy ? (isLazyLoaded ? isExistChild : hasLazyChilds) : isExistChild)
2659
2664
  ? [
2660
2665
  h('div', {
2661
2666
  class: 'vxe-tree--node-item-icon',
@@ -2674,8 +2679,8 @@ export default {
2674
2679
  ]
2675
2680
  : []),
2676
2681
  $xeTree.renderDragIcon(h, node, nodeid),
2677
- $xeTree.renderRadio(h, node, nodeid, isRadioChecked),
2678
- $xeTree.renderCheckbox(h, node, nodeid, isCheckboxChecked, isIndeterminate),
2682
+ $xeTree.renderRadio(h, node, nodeid, isExistChild, nLevel, isRadioChecked),
2683
+ $xeTree.renderCheckbox(h, node, nodeid, isExistChild, nLevel, isCheckboxChecked, isIndeterminate),
2679
2684
  h('div', {
2680
2685
  class: 'vxe-tree--node-item-inner'
2681
2686
  }, [
package/es/ui/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { VxeUI, setConfig, setIcon } from '@vxe-ui/core';
2
2
  import { dynamicApp } from '../dynamics';
3
3
  import { warnLog } from './src/log';
4
- export const version = "3.14.20";
4
+ export const version = "3.14.21";
5
5
  VxeUI.uiVersion = version;
6
6
  VxeUI.dynamicApp = dynamicApp;
7
7
  export function config(options) {
package/es/ui/src/log.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { log } from '@vxe-ui/core';
2
- const version = `ui v${"3.14.20"}`;
2
+ const version = `ui v${"3.14.21"}`;
3
3
  export const warnLog = log.create('warn', version);
4
4
  export const errLog = log.create('error', version);
package/lib/index.umd.js CHANGED
@@ -13214,7 +13214,7 @@ function checkDynamic() {
13214
13214
  }
13215
13215
  ;// ./packages/ui/src/log.ts
13216
13216
 
13217
- var log_version = "ui v".concat("3.14.20");
13217
+ var log_version = "ui v".concat("3.14.21");
13218
13218
  var warnLog = log.create('warn', log_version);
13219
13219
  var errLog = log.create('error', log_version);
13220
13220
  ;// ./packages/ui/index.ts
@@ -13222,7 +13222,7 @@ var errLog = log.create('error', log_version);
13222
13222
 
13223
13223
 
13224
13224
 
13225
- var ui_version = "3.14.20";
13225
+ var ui_version = "3.14.21";
13226
13226
  VxeUI.uiVersion = ui_version;
13227
13227
  VxeUI.dynamicApp = dynamicApp;
13228
13228
  function config(options) {
@@ -56888,6 +56888,17 @@ function handleNodeDragSwapEvent($xeTree, evnt, dragNode, prevDragNode, prevDrag
56888
56888
  clearCrossTreeDragStatus($xeTree);
56889
56889
  return Promise.resolve(errRest);
56890
56890
  }
56891
+ function handleVisibleOrCheckMode(mode, isExistChild, nLevel) {
56892
+ if (mode) {
56893
+ if (mode === 'first') {
56894
+ return !nLevel;
56895
+ }
56896
+ if (mode === 'last') {
56897
+ return !isExistChild;
56898
+ }
56899
+ }
56900
+ return true;
56901
+ }
56891
56902
  function tree_createInternalData() {
56892
56903
  return {
56893
56904
  // initialized: false,
@@ -59112,26 +59123,25 @@ function tree_createReactData() {
59112
59123
  }
59113
59124
  return renderEmptyElement($xeTree);
59114
59125
  },
59115
- renderRadio: function renderRadio(h, node, nodeid, isChecked) {
59126
+ renderRadio: function renderRadio(h, node, nodeid, isExistChild, nLevel, isChecked) {
59116
59127
  var $xeTree = this;
59117
59128
  var props = $xeTree;
59118
59129
  var showRadio = props.showRadio;
59119
59130
  var radioOpts = $xeTree.computeRadioOpts;
59120
59131
  var showIcon = radioOpts.showIcon,
59132
+ checkMode = radioOpts.checkMode,
59121
59133
  checkMethod = radioOpts.checkMethod,
59134
+ visibleMode = radioOpts.visibleMode,
59122
59135
  visibleMethod = radioOpts.visibleMethod;
59123
- var isVisible = !visibleMethod || visibleMethod({
59136
+ var isVisible = visibleMethod ? visibleMethod({
59124
59137
  $tree: $xeTree,
59125
59138
  node: node
59126
- });
59127
- var isDisabled = !!checkMethod;
59139
+ }) : handleVisibleOrCheckMode(visibleMode, isExistChild, nLevel);
59128
59140
  if (showRadio && showIcon && isVisible) {
59129
- if (checkMethod) {
59130
- isDisabled = !checkMethod({
59131
- $tree: $xeTree,
59132
- node: node
59133
- });
59134
- }
59141
+ var isDisabled = checkMethod ? !checkMethod({
59142
+ $tree: $xeTree,
59143
+ node: node
59144
+ }) : !handleVisibleOrCheckMode(checkMode, isExistChild, nLevel);
59135
59145
  return h('div', {
59136
59146
  class: ['vxe-tree--radio-option', {
59137
59147
  'is--checked': isChecked,
@@ -59150,26 +59160,25 @@ function tree_createReactData() {
59150
59160
  }
59151
59161
  return renderEmptyElement($xeTree);
59152
59162
  },
59153
- renderCheckbox: function renderCheckbox(h, node, nodeid, isChecked, isIndeterminate) {
59163
+ renderCheckbox: function renderCheckbox(h, node, nodeid, isExistChild, nLevel, isChecked, isIndeterminate) {
59154
59164
  var $xeTree = this;
59155
59165
  var props = $xeTree;
59156
59166
  var showCheckbox = props.showCheckbox;
59157
59167
  var checkboxOpts = $xeTree.computeCheckboxOpts;
59158
59168
  var showIcon = checkboxOpts.showIcon,
59169
+ checkMode = checkboxOpts.checkMode,
59159
59170
  checkMethod = checkboxOpts.checkMethod,
59171
+ visibleMode = checkboxOpts.visibleMode,
59160
59172
  visibleMethod = checkboxOpts.visibleMethod;
59161
- var isVisible = !visibleMethod || visibleMethod({
59173
+ var isVisible = visibleMethod ? visibleMethod({
59162
59174
  $tree: $xeTree,
59163
59175
  node: node
59164
- });
59165
- var isDisabled = !!checkMethod;
59176
+ }) : handleVisibleOrCheckMode(visibleMode, isExistChild, nLevel);
59166
59177
  if (showCheckbox && showIcon && isVisible) {
59167
- if (checkMethod) {
59168
- isDisabled = !checkMethod({
59169
- $tree: $xeTree,
59170
- node: node
59171
- });
59172
- }
59178
+ var isDisabled = checkMethod ? !checkMethod({
59179
+ $tree: $xeTree,
59180
+ node: node
59181
+ }) : !handleVisibleOrCheckMode(checkMode, isExistChild, nLevel);
59173
59182
  return h('div', {
59174
59183
  class: ['vxe-tree--checkbox-option', {
59175
59184
  'is--checked': isChecked,
@@ -59216,12 +59225,12 @@ function tree_createReactData() {
59216
59225
  var titleField = $xeTree.computeTitleField;
59217
59226
  var hasChildField = $xeTree.computeHasChildField;
59218
59227
  var childList = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(node, childrenField);
59219
- var hasChild = childList && childList.length;
59228
+ var isExistChild = childList && childList.length > 0;
59220
59229
  var iconSlot = slots.icon;
59221
59230
  var titleSlot = slots.title;
59222
59231
  var extraSlot = slots.extra;
59223
59232
  var isExpand = updateExpandedFlag && treeExpandedMaps[nodeid];
59224
- var nodeItem = nodeMaps[nodeid];
59233
+ var nodeItem = nodeMaps[nodeid] || {};
59225
59234
  var nodeValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(node, titleField);
59226
59235
  var nLevel = nodeItem.level;
59227
59236
  var isRadioChecked = false;
@@ -59291,7 +59300,7 @@ function tree_createReactData() {
59291
59300
  }
59292
59301
  })]) : renderEmptyElement($xeTree), h('div', {
59293
59302
  class: 'vxe-tree--node-item-switcher'
59294
- }, showIcon && (lazy ? isLazyLoaded ? hasChild : hasLazyChilds : hasChild) ? [h('div', {
59303
+ }, showIcon && (lazy ? isLazyLoaded ? isExistChild : hasLazyChilds : isExistChild) ? [h('div', {
59295
59304
  class: 'vxe-tree--node-item-icon',
59296
59305
  on: {
59297
59306
  click: function click(evnt) {
@@ -59300,7 +59309,7 @@ function tree_createReactData() {
59300
59309
  }
59301
59310
  }, iconSlot ? vn_getSlotVNs(iconSlot(nParams)) : [h('i', {
59302
59311
  class: isLazyLoading ? iconLoaded || tree_getIcon().TREE_NODE_LOADED : isExpand ? iconOpen || tree_getIcon().TREE_NODE_OPEN : iconClose || tree_getIcon().TREE_NODE_CLOSE
59303
- })])] : []), $xeTree.renderDragIcon(h, node, nodeid), $xeTree.renderRadio(h, node, nodeid, isRadioChecked), $xeTree.renderCheckbox(h, node, nodeid, isCheckboxChecked, isIndeterminate), h('div', {
59312
+ })])] : []), $xeTree.renderDragIcon(h, node, nodeid), $xeTree.renderRadio(h, node, nodeid, isExistChild, nLevel, isRadioChecked), $xeTree.renderCheckbox(h, node, nodeid, isExistChild, nLevel, isCheckboxChecked, isIndeterminate), h('div', {
59304
59313
  class: 'vxe-tree--node-item-inner'
59305
59314
  }, [h('div', {
59306
59315
  class: 'vxe-tree--node-item-title'