vxe-pc-ui 4.14.20 → 4.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.1779671264855.ttf → iconfont.1779687105351.ttf} +0 -0
  16. /package/es/icon/{iconfont.1779671264855.woff → iconfont.1779687105351.woff} +0 -0
  17. /package/es/icon/{iconfont.1779671264855.woff2 → iconfont.1779687105351.woff2} +0 -0
  18. /package/es/{iconfont.1779671264855.ttf → iconfont.1779687105351.ttf} +0 -0
  19. /package/es/{iconfont.1779671264855.woff → iconfont.1779687105351.woff} +0 -0
  20. /package/es/{iconfont.1779671264855.woff2 → iconfont.1779687105351.woff2} +0 -0
  21. /package/lib/icon/style/{iconfont.1779671264855.ttf → iconfont.1779687105351.ttf} +0 -0
  22. /package/lib/icon/style/{iconfont.1779671264855.woff → iconfont.1779687105351.woff} +0 -0
  23. /package/lib/icon/style/{iconfont.1779671264855.woff2 → iconfont.1779687105351.woff2} +0 -0
  24. /package/lib/{iconfont.1779671264855.ttf → iconfont.1779687105351.ttf} +0 -0
  25. /package/lib/{iconfont.1779671264855.woff → iconfont.1779687105351.woff} +0 -0
  26. /package/lib/{iconfont.1779671264855.woff2 → iconfont.1779687105351.woff2} +0 -0
@@ -2276,16 +2276,24 @@ export default defineVxeComponent({
2276
2276
  }
2277
2277
  return renderEmptyElement($xeTree);
2278
2278
  };
2279
- const renderRadio = (node, nodeid, isChecked) => {
2279
+ const handleVisibleOrCheckMode = (mode, isExistChild, nLevel) => {
2280
+ if (mode) {
2281
+ if (mode === 'first') {
2282
+ return !nLevel;
2283
+ }
2284
+ if (mode === 'last') {
2285
+ return !isExistChild;
2286
+ }
2287
+ }
2288
+ return true;
2289
+ };
2290
+ const renderRadio = (node, nodeid, isExistChild, nLevel, isChecked) => {
2280
2291
  const { showRadio } = props;
2281
2292
  const radioOpts = computeRadioOpts.value;
2282
- const { showIcon, checkMethod, visibleMethod } = radioOpts;
2283
- const isVisible = !visibleMethod || visibleMethod({ $tree: $xeTree, node });
2284
- let isDisabled = !!checkMethod;
2293
+ const { showIcon, checkMode, checkMethod, visibleMode, visibleMethod } = radioOpts;
2294
+ const isVisible = visibleMethod ? visibleMethod({ $tree: $xeTree, node }) : handleVisibleOrCheckMode(visibleMode, isExistChild, nLevel);
2285
2295
  if (showRadio && showIcon && isVisible) {
2286
- if (checkMethod) {
2287
- isDisabled = !checkMethod({ $tree: $xeTree, node });
2288
- }
2296
+ const isDisabled = checkMethod ? !checkMethod({ $tree: $xeTree, node }) : !handleVisibleOrCheckMode(checkMode, isExistChild, nLevel);
2289
2297
  return h('div', {
2290
2298
  class: ['vxe-tree--radio-option', {
2291
2299
  'is--checked': isChecked,
@@ -2304,16 +2312,13 @@ export default defineVxeComponent({
2304
2312
  }
2305
2313
  return renderEmptyElement($xeTree);
2306
2314
  };
2307
- const renderCheckbox = (node, nodeid, isChecked, isIndeterminate) => {
2315
+ const renderCheckbox = (node, nodeid, isExistChild, nLevel, isChecked, isIndeterminate) => {
2308
2316
  const { showCheckbox } = props;
2309
2317
  const checkboxOpts = computeCheckboxOpts.value;
2310
- const { showIcon, checkMethod, visibleMethod } = checkboxOpts;
2311
- const isVisible = !visibleMethod || visibleMethod({ $tree: $xeTree, node });
2312
- let isDisabled = !!checkMethod;
2318
+ const { showIcon, checkMode, checkMethod, visibleMode, visibleMethod } = checkboxOpts;
2319
+ const isVisible = visibleMethod ? visibleMethod({ $tree: $xeTree, node }) : handleVisibleOrCheckMode(visibleMode, isExistChild, nLevel);
2313
2320
  if (showCheckbox && showIcon && isVisible) {
2314
- if (checkMethod) {
2315
- isDisabled = !checkMethod({ $tree: $xeTree, node });
2316
- }
2321
+ const isDisabled = checkMethod ? !checkMethod({ $tree: $xeTree, node }) : !handleVisibleOrCheckMode(checkMode, isExistChild, nLevel);
2317
2322
  return h('div', {
2318
2323
  class: ['vxe-tree--checkbox-option', {
2319
2324
  'is--checked': isChecked,
@@ -2341,12 +2346,12 @@ export default defineVxeComponent({
2341
2346
  const titleField = computeTitleField.value;
2342
2347
  const hasChildField = computeHasChildField.value;
2343
2348
  const childList = XEUtils.get(node, childrenField);
2344
- const hasChild = childList && childList.length;
2349
+ const isExistChild = childList && childList.length > 0;
2345
2350
  const iconSlot = slots.icon;
2346
2351
  const titleSlot = slots.title;
2347
2352
  const extraSlot = slots.extra;
2348
2353
  const isExpand = updateExpandedFlag && treeExpandedMaps[nodeid];
2349
- const nodeItem = nodeMaps[nodeid];
2354
+ const nodeItem = nodeMaps[nodeid] || {};
2350
2355
  const nodeValue = XEUtils.get(node, titleField);
2351
2356
  const nLevel = nodeItem.level;
2352
2357
  let isRadioChecked = false;
@@ -2413,7 +2418,7 @@ export default defineVxeComponent({
2413
2418
  : renderEmptyElement($xeTree),
2414
2419
  h('div', {
2415
2420
  class: 'vxe-tree--node-item-switcher'
2416
- }, showIcon && (lazy ? (isLazyLoaded ? hasChild : hasLazyChilds) : hasChild)
2421
+ }, showIcon && (lazy ? (isLazyLoaded ? isExistChild : hasLazyChilds) : isExistChild)
2417
2422
  ? [
2418
2423
  h('div', {
2419
2424
  class: 'vxe-tree--node-item-icon',
@@ -2430,8 +2435,8 @@ export default defineVxeComponent({
2430
2435
  ]
2431
2436
  : []),
2432
2437
  renderDragIcon(node, nodeid),
2433
- renderRadio(node, nodeid, isRadioChecked),
2434
- renderCheckbox(node, nodeid, isCheckboxChecked, isIndeterminate),
2438
+ renderRadio(node, nodeid, isExistChild, nLevel, isRadioChecked),
2439
+ renderCheckbox(node, nodeid, isExistChild, nLevel, isCheckboxChecked, isIndeterminate),
2435
2440
  h('div', {
2436
2441
  class: 'vxe-tree--node-item-inner'
2437
2442
  }, [
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 = "4.14.20";
4
+ export const version = "4.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${"4.14.20"}`;
2
+ const version = `ui v${"4.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
@@ -4646,7 +4646,7 @@ function checkDynamic() {
4646
4646
  }
4647
4647
  ;// ./packages/ui/src/log.ts
4648
4648
 
4649
- const log_version = `ui v${"4.14.20"}`;
4649
+ const log_version = `ui v${"4.14.21"}`;
4650
4650
  const warnLog = log.create('warn', log_version);
4651
4651
  const errLog = log.create('error', log_version);
4652
4652
  ;// ./packages/ui/index.ts
@@ -4654,7 +4654,7 @@ const errLog = log.create('error', log_version);
4654
4654
 
4655
4655
 
4656
4656
 
4657
- const ui_version = "4.14.20";
4657
+ const ui_version = "4.14.21";
4658
4658
  VxeUI.uiVersion = ui_version;
4659
4659
  VxeUI.dynamicApp = dynamicApp;
4660
4660
  function config(options) {
@@ -46821,28 +46821,38 @@ function tree_createReactData() {
46821
46821
  }
46822
46822
  return renderEmptyElement($xeTree);
46823
46823
  };
46824
- const renderRadio = (node, nodeid, isChecked) => {
46824
+ const handleVisibleOrCheckMode = (mode, isExistChild, nLevel) => {
46825
+ if (mode) {
46826
+ if (mode === 'first') {
46827
+ return !nLevel;
46828
+ }
46829
+ if (mode === 'last') {
46830
+ return !isExistChild;
46831
+ }
46832
+ }
46833
+ return true;
46834
+ };
46835
+ const renderRadio = (node, nodeid, isExistChild, nLevel, isChecked) => {
46825
46836
  const {
46826
46837
  showRadio
46827
46838
  } = props;
46828
46839
  const radioOpts = computeRadioOpts.value;
46829
46840
  const {
46830
46841
  showIcon,
46842
+ checkMode,
46831
46843
  checkMethod,
46844
+ visibleMode,
46832
46845
  visibleMethod
46833
46846
  } = radioOpts;
46834
- const isVisible = !visibleMethod || visibleMethod({
46847
+ const isVisible = visibleMethod ? visibleMethod({
46835
46848
  $tree: $xeTree,
46836
46849
  node
46837
- });
46838
- let isDisabled = !!checkMethod;
46850
+ }) : handleVisibleOrCheckMode(visibleMode, isExistChild, nLevel);
46839
46851
  if (showRadio && showIcon && isVisible) {
46840
- if (checkMethod) {
46841
- isDisabled = !checkMethod({
46842
- $tree: $xeTree,
46843
- node
46844
- });
46845
- }
46852
+ const isDisabled = checkMethod ? !checkMethod({
46853
+ $tree: $xeTree,
46854
+ node
46855
+ }) : !handleVisibleOrCheckMode(checkMode, isExistChild, nLevel);
46846
46856
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
46847
46857
  class: ['vxe-tree--radio-option', {
46848
46858
  'is--checked': isChecked,
@@ -46859,28 +46869,27 @@ function tree_createReactData() {
46859
46869
  }
46860
46870
  return renderEmptyElement($xeTree);
46861
46871
  };
46862
- const renderCheckbox = (node, nodeid, isChecked, isIndeterminate) => {
46872
+ const renderCheckbox = (node, nodeid, isExistChild, nLevel, isChecked, isIndeterminate) => {
46863
46873
  const {
46864
46874
  showCheckbox
46865
46875
  } = props;
46866
46876
  const checkboxOpts = computeCheckboxOpts.value;
46867
46877
  const {
46868
46878
  showIcon,
46879
+ checkMode,
46869
46880
  checkMethod,
46881
+ visibleMode,
46870
46882
  visibleMethod
46871
46883
  } = checkboxOpts;
46872
- const isVisible = !visibleMethod || visibleMethod({
46884
+ const isVisible = visibleMethod ? visibleMethod({
46873
46885
  $tree: $xeTree,
46874
46886
  node
46875
- });
46876
- let isDisabled = !!checkMethod;
46887
+ }) : handleVisibleOrCheckMode(visibleMode, isExistChild, nLevel);
46877
46888
  if (showCheckbox && showIcon && isVisible) {
46878
- if (checkMethod) {
46879
- isDisabled = !checkMethod({
46880
- $tree: $xeTree,
46881
- node
46882
- });
46883
- }
46889
+ const isDisabled = checkMethod ? !checkMethod({
46890
+ $tree: $xeTree,
46891
+ node
46892
+ }) : !handleVisibleOrCheckMode(checkMode, isExistChild, nLevel);
46884
46893
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
46885
46894
  class: ['vxe-tree--checkbox-option', {
46886
46895
  'is--checked': isChecked,
@@ -46926,12 +46935,12 @@ function tree_createReactData() {
46926
46935
  const titleField = computeTitleField.value;
46927
46936
  const hasChildField = computeHasChildField.value;
46928
46937
  const childList = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(node, childrenField);
46929
- const hasChild = childList && childList.length;
46938
+ const isExistChild = childList && childList.length > 0;
46930
46939
  const iconSlot = slots.icon;
46931
46940
  const titleSlot = slots.title;
46932
46941
  const extraSlot = slots.extra;
46933
46942
  const isExpand = updateExpandedFlag && treeExpandedMaps[nodeid];
46934
- const nodeItem = nodeMaps[nodeid];
46943
+ const nodeItem = nodeMaps[nodeid] || {};
46935
46944
  const nodeValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(node, titleField);
46936
46945
  const nLevel = nodeItem.level;
46937
46946
  let isRadioChecked = false;
@@ -46999,14 +47008,14 @@ function tree_createReactData() {
46999
47008
  }
47000
47009
  })]) : renderEmptyElement($xeTree), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
47001
47010
  class: 'vxe-tree--node-item-switcher'
47002
- }, showIcon && (lazy ? isLazyLoaded ? hasChild : hasLazyChilds : hasChild) ? [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
47011
+ }, showIcon && (lazy ? isLazyLoaded ? isExistChild : hasLazyChilds : isExistChild) ? [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
47003
47012
  class: 'vxe-tree--node-item-icon',
47004
47013
  onClick(evnt) {
47005
47014
  toggleExpandEvent(evnt, node);
47006
47015
  }
47007
47016
  }, iconSlot ? vn_getSlotVNs(iconSlot(nParams)) : [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('i', {
47008
47017
  class: isLazyLoading ? iconLoaded || tree_getIcon().TREE_NODE_LOADED : isExpand ? iconOpen || tree_getIcon().TREE_NODE_OPEN : iconClose || tree_getIcon().TREE_NODE_CLOSE
47009
- })])] : []), renderDragIcon(node, nodeid), renderRadio(node, nodeid, isRadioChecked), renderCheckbox(node, nodeid, isCheckboxChecked, isIndeterminate), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
47018
+ })])] : []), renderDragIcon(node, nodeid), renderRadio(node, nodeid, isExistChild, nLevel, isRadioChecked), renderCheckbox(node, nodeid, isExistChild, nLevel, isCheckboxChecked, isIndeterminate), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
47010
47019
  class: 'vxe-tree--node-item-inner'
47011
47020
  }, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
47012
47021
  class: 'vxe-tree--node-item-title'