vxe-pc-ui 4.16.7 → 4.16.8

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 (53) hide show
  1. package/dist/all.esm.js +97 -40
  2. package/dist/style.css +1 -1
  3. package/dist/style.min.css +1 -1
  4. package/es/cascader/src/cascader.js +66 -26
  5. package/es/cascader/style.css +9 -9
  6. package/es/cascader/style.min.css +1 -1
  7. package/es/date-range-picker/src/date-range-picker.js +25 -9
  8. package/es/icon/style.css +1 -1
  9. package/es/menu/src/menu.js +4 -3
  10. package/es/style.css +1 -1
  11. package/es/style.min.css +1 -1
  12. package/es/ui/index.js +1 -1
  13. package/es/ui/src/log.js +1 -1
  14. package/es/vxe-cascader/style.css +9 -9
  15. package/es/vxe-cascader/style.min.css +1 -1
  16. package/lib/cascader/src/cascader.js +73 -27
  17. package/lib/cascader/src/cascader.min.js +1 -1
  18. package/lib/cascader/style/style.css +9 -9
  19. package/lib/cascader/style/style.min.css +1 -1
  20. package/lib/date-range-picker/src/date-range-picker.js +27 -9
  21. package/lib/date-range-picker/src/date-range-picker.min.js +1 -1
  22. package/lib/icon/style/style.css +1 -1
  23. package/lib/icon/style/style.min.css +1 -1
  24. package/lib/index.umd.js +107 -41
  25. package/lib/index.umd.min.js +1 -1
  26. package/lib/menu/src/menu.js +4 -3
  27. package/lib/menu/src/menu.min.js +1 -1
  28. package/lib/style.css +1 -1
  29. package/lib/style.min.css +1 -1
  30. package/lib/ui/index.js +1 -1
  31. package/lib/ui/index.min.js +1 -1
  32. package/lib/ui/src/log.js +1 -1
  33. package/lib/ui/src/log.min.js +1 -1
  34. package/lib/vxe-cascader/style/style.css +9 -9
  35. package/lib/vxe-cascader/style/style.min.css +1 -1
  36. package/package.json +1 -1
  37. package/packages/cascader/src/cascader.ts +66 -25
  38. package/packages/date-range-picker/src/date-range-picker.ts +23 -9
  39. package/packages/menu/src/menu.ts +4 -3
  40. package/styles/components/cascader.scss +9 -9
  41. package/types/components/cascader.d.ts +1 -0
  42. /package/es/icon/{iconfont.1783873713408.ttf → iconfont.1783923662673.ttf} +0 -0
  43. /package/es/icon/{iconfont.1783873713408.woff → iconfont.1783923662673.woff} +0 -0
  44. /package/es/icon/{iconfont.1783873713408.woff2 → iconfont.1783923662673.woff2} +0 -0
  45. /package/es/{iconfont.1783873713408.ttf → iconfont.1783923662673.ttf} +0 -0
  46. /package/es/{iconfont.1783873713408.woff → iconfont.1783923662673.woff} +0 -0
  47. /package/es/{iconfont.1783873713408.woff2 → iconfont.1783923662673.woff2} +0 -0
  48. /package/lib/icon/style/{iconfont.1783873713408.ttf → iconfont.1783923662673.ttf} +0 -0
  49. /package/lib/icon/style/{iconfont.1783873713408.woff → iconfont.1783923662673.woff} +0 -0
  50. /package/lib/icon/style/{iconfont.1783873713408.woff2 → iconfont.1783923662673.woff2} +0 -0
  51. /package/lib/{iconfont.1783873713408.ttf → iconfont.1783923662673.ttf} +0 -0
  52. /package/lib/{iconfont.1783873713408.woff → iconfont.1783923662673.woff} +0 -0
  53. /package/lib/{iconfont.1783873713408.woff2 → iconfont.1783923662673.woff2} +0 -0
package/lib/index.umd.js CHANGED
@@ -4657,7 +4657,7 @@ function checkDynamic() {
4657
4657
  const {
4658
4658
  log: log_log
4659
4659
  } = VxeUI;
4660
- const uiVersion = `ui v${"4.16.7"}`;
4660
+ const uiVersion = `ui v${"4.16.8"}`;
4661
4661
  function createComponentLog(name) {
4662
4662
  const tableVersion = VxeUI.tableVersion ? `table v${VxeUI.tableVersion}` : '';
4663
4663
  const ganttVersion = VxeUI.ganttVersion ? `gantt v${VxeUI.ganttVersion}` : '';
@@ -4675,7 +4675,7 @@ const errLog = log_log.create('error', uiVersion);
4675
4675
 
4676
4676
 
4677
4677
 
4678
- const ui_version = "4.16.7";
4678
+ const ui_version = "4.16.8";
4679
4679
  VxeUI.uiVersion = ui_version;
4680
4680
  VxeUI.dynamicApp = dynamicApp;
4681
4681
  function config(options) {
@@ -17403,6 +17403,7 @@ const Input = VxeInput;
17403
17403
 
17404
17404
 
17405
17405
 
17406
+
17406
17407
  /**
17407
17408
  * 生成节点的唯一主键
17408
17409
  */
@@ -17449,6 +17450,7 @@ function cascader_createInternalData() {
17449
17450
  selectCheckboxMaps: {},
17450
17451
  treeExpandedMaps: {},
17451
17452
  treeExpandLazyLoadedMaps: {}
17453
+ // isUpdateMode: false
17452
17454
  };
17453
17455
  }
17454
17456
  /* harmony default export */ var cascader = (defineVxeComponent({
@@ -17728,6 +17730,20 @@ function cascader_createInternalData() {
17728
17730
  const nodeKey = node[valueField];
17729
17731
  return enNodeValue(nodeKey);
17730
17732
  };
17733
+ const isPathInTree = (treeData, pathIds) => {
17734
+ if (!pathIds || !pathIds.length) {
17735
+ return false;
17736
+ }
17737
+ let currentNodes = treeData;
17738
+ for (const nodeid of pathIds) {
17739
+ const found = currentNodes.find(node => getNodeId(node) === nodeid);
17740
+ if (!found) {
17741
+ return false;
17742
+ }
17743
+ currentNodes = found.children || [];
17744
+ }
17745
+ return true;
17746
+ };
17731
17747
  const isCheckedByCheckboxNodeId = nodeid => {
17732
17748
  const {
17733
17749
  updateCheckboxFlag
@@ -17969,7 +17985,7 @@ function cascader_createInternalData() {
17969
17985
  if (transform) {
17970
17986
  treeList = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(treeFullData, handleSearch, {
17971
17987
  original: true,
17972
- isEvery: true,
17988
+ isEvery: false,
17973
17989
  children: childrenField,
17974
17990
  mapChildren: mapChildrenField
17975
17991
  });
@@ -17987,7 +18003,7 @@ function cascader_createInternalData() {
17987
18003
  if (transform) {
17988
18004
  treeList = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(treeFullData, () => true, {
17989
18005
  original: true,
17990
- isEvery: true,
18006
+ isEvery: false,
17991
18007
  children: childrenField,
17992
18008
  mapChildren: mapChildrenField
17993
18009
  });
@@ -18091,20 +18107,31 @@ function cascader_createInternalData() {
18091
18107
  }
18092
18108
  const triggerSearchEvent = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().debounce(() => {
18093
18109
  handleData(true);
18094
- updateModelChecked();
18095
- const filterOpts = computeFilterOpts.value;
18110
+ updateCheckboxStatus();
18096
18111
  const {
18097
- autoExpandMode
18098
- } = filterOpts;
18112
+ currentItems
18113
+ } = reactData;
18099
18114
  const {
18100
18115
  afterTreeList
18101
18116
  } = internalData;
18102
- // 默认展开第
18103
- if (autoExpandMode === 'first' || autoExpandMode === 'last') {
18104
- const stItems = handleHasChildNodeIds(afterTreeList, autoExpandMode);
18105
- reactData.currentItems = stItems;
18106
- } else {
18107
- handleCurrentItems();
18117
+ const filterOpts = computeFilterOpts.value;
18118
+ const {
18119
+ autoExpandMode
18120
+ } = filterOpts;
18121
+ // 如果当前不在列表情况下,触发默认行为
18122
+ if (!isPathInTree(afterTreeList, currentItems)) {
18123
+ // 默认展开
18124
+ if (autoExpandMode === 'first' || autoExpandMode === 'last') {
18125
+ const stItems = handleHasChildNodeIds(afterTreeList, autoExpandMode);
18126
+ const expandedMaps = {};
18127
+ stItems.forEach(nodeid => {
18128
+ expandedMaps[nodeid] = true;
18129
+ });
18130
+ internalData.treeExpandedMaps = expandedMaps;
18131
+ reactData.currentItems = stItems;
18132
+ } else {
18133
+ handleCurrentItems();
18134
+ }
18108
18135
  }
18109
18136
  updateCurrentChunk();
18110
18137
  }, 350, {
@@ -18282,6 +18309,7 @@ function cascader_createInternalData() {
18282
18309
  };
18283
18310
  const setCurrentNode = node => {
18284
18311
  reactData.currentNode = node;
18312
+ updateCurrentChunk();
18285
18313
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
18286
18314
  };
18287
18315
  const setAllCheckboxNode = checked => {
@@ -18330,6 +18358,7 @@ function cascader_createInternalData() {
18330
18358
  };
18331
18359
  const changeEvent = (evnt, selectValue, node) => {
18332
18360
  const value = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(selectValue) ? selectValue.map(deNodeValue) : deNodeValue(selectValue);
18361
+ internalData.isUpdateMode = true;
18333
18362
  emitModel(value);
18334
18363
  if (value !== props.modelValue) {
18335
18364
  dispatchEvent('change', {
@@ -18476,9 +18505,12 @@ function cascader_createInternalData() {
18476
18505
  checked: isChecked
18477
18506
  }, evnt);
18478
18507
  };
18479
- const changeRadioEvent = (evnt, node) => {
18508
+ const changeRadioEvent = (evnt, node, chunks, chunkIndex) => {
18480
18509
  evnt.preventDefault();
18481
18510
  evnt.stopPropagation();
18511
+ const {
18512
+ currentItems
18513
+ } = reactData;
18482
18514
  const {
18483
18515
  nodeMaps
18484
18516
  } = internalData;
@@ -18508,6 +18540,10 @@ function cascader_createInternalData() {
18508
18540
  const value = nodeid;
18509
18541
  reactData.selectRadioKey = value;
18510
18542
  changeEvent(evnt, value, node);
18543
+ if (!currentItems.includes(nodeid)) {
18544
+ changeCurrentEvent(evnt, node);
18545
+ toggleExpandEvent(evnt, node, chunks, chunkIndex);
18546
+ }
18511
18547
  hideOptionPanel(evnt);
18512
18548
  };
18513
18549
  const handleAsyncTreeExpandChilds = node => {
@@ -18679,7 +18715,6 @@ function cascader_createInternalData() {
18679
18715
  handleBaseTreeExpand([node], expanded);
18680
18716
  }
18681
18717
  setCurrentNode(node);
18682
- updateCurrentChunk();
18683
18718
  dispatchEvent('node-expand', {
18684
18719
  node,
18685
18720
  expanded
@@ -18793,9 +18828,13 @@ function cascader_createInternalData() {
18793
18828
  reactData.updateCheckboxFlag++;
18794
18829
  }
18795
18830
  };
18796
- const changeCheckboxEvent = (evnt, node) => {
18831
+ const changeCheckboxEvent = (evnt, node, chunks, chunkIndex) => {
18797
18832
  evnt.preventDefault();
18798
18833
  evnt.stopPropagation();
18834
+ // const { filterable } = props
18835
+ const {
18836
+ currentItems
18837
+ } = reactData;
18799
18838
  const {
18800
18839
  selectCheckboxMaps,
18801
18840
  nodeMaps
@@ -18832,11 +18871,11 @@ function cascader_createInternalData() {
18832
18871
  selectCheckboxMaps[nodeid] = node;
18833
18872
  }
18834
18873
  if (!checkStrictly) {
18835
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(node, transform ? mapChildrenField : childrenField), childNode => {
18874
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(childList, childNode => {
18836
18875
  const childNodeid = getNodeId(childNode);
18837
18876
  if (isChecked) {
18838
18877
  if (!selectCheckboxMaps[childNodeid]) {
18839
- selectCheckboxMaps[childNodeid] = true;
18878
+ selectCheckboxMaps[childNodeid] = childNode;
18840
18879
  }
18841
18880
  } else {
18842
18881
  if (selectCheckboxMaps[childNodeid]) {
@@ -18847,11 +18886,16 @@ function cascader_createInternalData() {
18847
18886
  children: transform ? mapChildrenField : childrenField
18848
18887
  });
18849
18888
  }
18889
+ selectCheckboxMaps[nodeid] = node;
18850
18890
  reactData.updateCheckboxFlag++;
18851
18891
  updateCheckboxStatus();
18852
18892
  const nodeids = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().keys(selectCheckboxMaps);
18853
18893
  const value = nodeids;
18854
18894
  changeEvent(evnt, value, node);
18895
+ if (!currentItems.includes(nodeid)) {
18896
+ changeCurrentEvent(evnt, node);
18897
+ toggleExpandEvent(evnt, node, chunks, chunkIndex);
18898
+ }
18855
18899
  };
18856
18900
  const handleNodeClickEvent = (evnt, node, chunks, chunkIndex) => {
18857
18901
  const {
@@ -18882,12 +18926,12 @@ function cascader_createInternalData() {
18882
18926
  if (multiple) {
18883
18927
  if (checkboxOpts.trigger === 'node' || !showCheckbox && (!childList || !childList.length)) {
18884
18928
  triggerCheckbox = true;
18885
- changeCheckboxEvent(evnt, node);
18929
+ changeCheckboxEvent(evnt, node, chunks, chunkIndex);
18886
18930
  }
18887
18931
  } else {
18888
18932
  if (radioOpts.trigger === 'node' || !showRadio && (!childList || !childList.length)) {
18889
18933
  triggerRadio = true;
18890
- changeRadioEvent(evnt, node);
18934
+ changeRadioEvent(evnt, node, chunks, chunkIndex);
18891
18935
  }
18892
18936
  }
18893
18937
  dispatchEvent('node-click', {
@@ -19033,7 +19077,7 @@ function cascader_createInternalData() {
19033
19077
  }
19034
19078
  return true;
19035
19079
  };
19036
- const renderRadio = (node, isExistChild, nLevel, isChecked) => {
19080
+ const renderRadio = (node, isExistChild, nLevel, isChecked, chunks, chunkIndex) => {
19037
19081
  const {
19038
19082
  showRadio
19039
19083
  } = props;
@@ -19060,7 +19104,7 @@ function cascader_createInternalData() {
19060
19104
  }],
19061
19105
  onClick: evnt => {
19062
19106
  if (!isDisabled) {
19063
- changeRadioEvent(evnt, node);
19107
+ changeRadioEvent(evnt, node, chunks, chunkIndex);
19064
19108
  }
19065
19109
  }
19066
19110
  }, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('span', {
@@ -19069,7 +19113,7 @@ function cascader_createInternalData() {
19069
19113
  }
19070
19114
  return renderEmptyElement($xeCascader);
19071
19115
  };
19072
- const renderCheckbox = (node, isExistChild, nLevel, isChecked, isIndeterminate) => {
19116
+ const renderCheckbox = (node, isExistChild, nLevel, isChecked, isIndeterminate, chunks, chunkIndex) => {
19073
19117
  const {
19074
19118
  showCheckbox
19075
19119
  } = props;
@@ -19097,7 +19141,7 @@ function cascader_createInternalData() {
19097
19141
  }],
19098
19142
  onClick: evnt => {
19099
19143
  if (!isDisabled) {
19100
- changeCheckboxEvent(evnt, node);
19144
+ changeCheckboxEvent(evnt, node, chunks, chunkIndex);
19101
19145
  }
19102
19146
  }
19103
19147
  }, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('span', {
@@ -19183,7 +19227,7 @@ function cascader_createInternalData() {
19183
19227
  onClick(evnt) {
19184
19228
  handleNodeClickEvent(evnt, node, chunks, chunkIndex);
19185
19229
  }
19186
- }, [multiple ? renderCheckbox(node, isExistChild, nLevel, isCheckboxChecked, isIndeterminate) : renderRadio(node, isExistChild, nLevel, isRadioChecked), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
19230
+ }, [multiple ? renderCheckbox(node, isExistChild, nLevel, isCheckboxChecked, isIndeterminate, chunks, chunkIndex) : renderRadio(node, isExistChild, nLevel, isRadioChecked, chunks, chunkIndex), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
19187
19231
  class: 'vxe-cascader-chunk--node-item-inner'
19188
19232
  }, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
19189
19233
  class: 'vxe-cascader-chunk--node-item-title'
@@ -19354,9 +19398,12 @@ function cascader_createInternalData() {
19354
19398
  })]) : renderEmptyElement($xeCascader)])]) : renderEmptyElement($xeCascader)])] : [])])]);
19355
19399
  };
19356
19400
  (0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => props.modelValue, () => {
19357
- updateModelChecked();
19358
- handleCurrentItems();
19359
- updateCurrentChunk();
19401
+ if (!internalData.isUpdateMode) {
19402
+ updateModelChecked();
19403
+ handleCurrentItems();
19404
+ updateCurrentChunk();
19405
+ }
19406
+ internalData.isUpdateMode = false;
19360
19407
  });
19361
19408
  (0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => props.options, () => {
19362
19409
  cacheNodeMap();
@@ -28877,6 +28924,9 @@ function date_range_picker_createInternalData() {
28877
28924
  hidePanel();
28878
28925
  };
28879
28926
  const startPanelChangeEvent = params => {
28927
+ const {
28928
+ paneStartVal
28929
+ } = reactData;
28880
28930
  const {
28881
28931
  selectStatus
28882
28932
  } = internalData;
@@ -28889,11 +28939,17 @@ function date_range_picker_createInternalData() {
28889
28939
  let startValue = '';
28890
28940
  let endValue = '';
28891
28941
  if (selectStatus) {
28892
- startValue = paneVals[0];
28893
- if (paneVals[1]) {
28894
- endValue = paneVals[1];
28942
+ // 如果选择同一天
28943
+ if (!value && currValue === paneStartVal[0]) {
28944
+ startValue = currValue;
28945
+ endValue = currValue;
28895
28946
  } else {
28896
- endValue = reactData.selectEdValue;
28947
+ startValue = paneVals[0];
28948
+ if (paneVals[1]) {
28949
+ endValue = paneVals[1];
28950
+ } else {
28951
+ endValue = reactData.selectEdValue;
28952
+ }
28897
28953
  }
28898
28954
  } else {
28899
28955
  startValue = currValue || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().last(paneVals);
@@ -28914,6 +28970,9 @@ function date_range_picker_createInternalData() {
28914
28970
  });
28915
28971
  };
28916
28972
  const endPanelChangeEvent = params => {
28973
+ const {
28974
+ paneEndVal
28975
+ } = reactData;
28917
28976
  const {
28918
28977
  selectStatus
28919
28978
  } = internalData;
@@ -28926,12 +28985,18 @@ function date_range_picker_createInternalData() {
28926
28985
  let startValue = '';
28927
28986
  let endValue = '';
28928
28987
  if (selectStatus) {
28929
- endValue = paneVals[0];
28930
- if (paneVals[1]) {
28931
- startValue = paneVals[0];
28932
- endValue = paneVals[1];
28988
+ // 如果选择同一天
28989
+ if (!value && currValue === paneEndVal[1]) {
28990
+ startValue = currValue;
28991
+ endValue = currValue;
28933
28992
  } else {
28934
- startValue = reactData.selectStValue;
28993
+ endValue = paneVals[0];
28994
+ if (paneVals[1]) {
28995
+ startValue = paneVals[0];
28996
+ endValue = paneVals[1];
28997
+ } else {
28998
+ startValue = reactData.selectStValue;
28999
+ }
28935
29000
  }
28936
29001
  } else {
28937
29002
  endValue = currValue || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().last(paneVals);
@@ -36355,6 +36420,7 @@ let nemuUniqueKey = 100000000;
36355
36420
  hasChild,
36356
36421
  isExpand
36357
36422
  } = item;
36423
+ const isCollapsed = computeIsCollapsed.value;
36358
36424
  const expanded = !isExpand;
36359
36425
  if (hasChild) {
36360
36426
  evnt.stopPropagation();
@@ -36370,9 +36436,9 @@ let nemuUniqueKey = 100000000;
36370
36436
  });
36371
36437
  }
36372
36438
  item.isExpand = expanded;
36373
- const el = refElem.value;
36374
- if (el) {
36375
- const nemuEl = el.querySelector(`.vxe-menu--item-wrapper[data-menu-id="${itemId}"]`);
36439
+ const wrapperEl = isCollapsed ? refCollapseElem.value : refElem.value;
36440
+ if (wrapperEl) {
36441
+ const nemuEl = wrapperEl.querySelector(`.vxe-menu--item-wrapper[data-menu-id="${itemId}"]`);
36376
36442
  const groupEl = nemuEl ? nemuEl.querySelector('.vxe-menu--item-group') : null;
36377
36443
  if (groupEl) {
36378
36444
  if (expanded) {