@opentiny/vue-renderless 3.14.1 → 3.15.1

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 (88) hide show
  1. package/LICENSE +22 -0
  2. package/action-menu/index.js +44 -0
  3. package/action-menu/vue.js +25 -8
  4. package/calendar-view/index.js +21 -13
  5. package/calendar-view/vue.js +6 -3
  6. package/cascader/index.js +1 -1
  7. package/cascader-select/index.js +5 -0
  8. package/cascader-select/vue.js +3 -1
  9. package/common/deps/vue-popper.js +22 -2
  10. package/common/index.js +15 -2
  11. package/common/runtime.js +1 -1
  12. package/dept/index.js +8 -1
  13. package/dept/vue.js +10 -1
  14. package/dialog-box/index.js +12 -6
  15. package/dialog-box/vue.js +1 -1
  16. package/dropdown-item/mf.js +2 -2
  17. package/file-upload/index.js +0 -1
  18. package/grid/utils/dom.js +30 -10
  19. package/image/index.js +4 -0
  20. package/image/vue.js +6 -3
  21. package/image-viewer/vue.js +3 -1
  22. package/input/index.js +6 -1
  23. package/input/vue.js +9 -5
  24. package/modal/index.js +1 -1
  25. package/numeric/index.js +5 -18
  26. package/numeric/vue.js +3 -12
  27. package/option-group/index.js +13 -0
  28. package/option-group/vue.js +19 -6
  29. package/package.json +7 -7
  30. package/picker/index.js +27 -6
  31. package/picker/vue.js +2 -2
  32. package/popconfirm/index.js +6 -0
  33. package/popconfirm/vue.js +11 -3
  34. package/popover/index.js +4 -1
  35. package/popover/vue.js +2 -1
  36. package/quarter-panel/index.js +61 -0
  37. package/quarter-panel/vue.js +46 -0
  38. package/select/index.js +99 -30
  39. package/select/vue.js +26 -12
  40. package/skeleton/vue.js +2 -2
  41. package/skeleton-item/vue.js +1 -1
  42. package/statistic/index.js +22 -0
  43. package/statistic/vue.js +20 -0
  44. package/tabs/index.js +55 -14
  45. package/tall-storage/index.js +1 -1
  46. package/time-picker-mobile/index.js +10 -1
  47. package/time-picker-mobile/vue.js +5 -3
  48. package/time-spinner/index.js +52 -1
  49. package/time-spinner/vue.js +4 -2
  50. package/timeline-item/index.js +14 -1
  51. package/timeline-item/vue.js +7 -4
  52. package/tree/index.js +8 -4
  53. package/tree/vue.js +3 -3
  54. package/tree-node/index.js +2 -2
  55. package/types/action-menu.type.d.ts +49 -13
  56. package/types/date-table.type.d.ts +13 -0
  57. package/types/dialog-box.type.d.ts +1 -1
  58. package/types/{dropdown-item.type-8475a549.d.ts → dropdown-item.type-678794c9.d.ts} +4 -0
  59. package/types/dropdown-item.type.d.ts +1 -1
  60. package/types/dropdown-menu.type.d.ts +1 -1
  61. package/types/file-upload.type.d.ts +1 -1
  62. package/types/form-item.type.d.ts +1 -1
  63. package/types/{form.type-a2dc0099.d.ts → form.type-8e30b25c.d.ts} +1 -0
  64. package/types/form.type.d.ts +1 -1
  65. package/types/image.type.d.ts +4 -0
  66. package/types/input.type.d.ts +3 -1
  67. package/types/numeric.type.d.ts +4 -5
  68. package/types/popconfirm.type.d.ts +8 -0
  69. package/types/popover.type.d.ts +2 -2
  70. package/types/skeleton.type.d.ts +1 -1
  71. package/types/statistic.type.d.ts +56 -0
  72. package/types/tag.type.d.ts +4 -1
  73. package/types/{time-line.type-b155cb4f.d.ts → time-line.type-1b501c41.d.ts} +7 -0
  74. package/types/time-line.type.d.ts +1 -1
  75. package/types/timeline-item.type.d.ts +1 -1
  76. package/types/transfer.type.d.ts +3 -3
  77. package/types/upload-dragger.type.d.ts +1 -1
  78. package/types/{upload-list.type-6d6e3d0e.d.ts → upload-list.type-f34997c8.d.ts} +3 -3
  79. package/types/upload-list.type.d.ts +1 -1
  80. package/types/upload.type.d.ts +1 -1
  81. package/credit-card/index.js +0 -93
  82. package/credit-card/vue.js +0 -62
  83. package/credit-card-form/index.js +0 -112
  84. package/credit-card-form/vue.js +0 -119
  85. package/detail-page/index.js +0 -79
  86. package/detail-page/vue.js +0 -78
  87. package/slide-bar/index.js +0 -67
  88. package/slide-bar/vue.js +0 -32
package/select/index.js CHANGED
@@ -180,7 +180,7 @@ const emitChange = ({ emit, props, state, constants }) => (value, changed) => {
180
180
  if (constants.TYPE.Tree === flag) {
181
181
  const recurNode = (node) => {
182
182
  val === node[props.valueField] && items.push(node);
183
- val !== node[props.valueField] && Array.isArray(node.children) && node.children.forEach(recurNode);
183
+ val !== node[props.valueField] && Array.isArray(node[state.childrenName]) && node[state.childrenName].forEach(recurNode);
184
184
  };
185
185
  arr.forEach(recurNode);
186
186
  } else if (constants.TYPE.Grid === flag) {
@@ -409,23 +409,33 @@ const blur = ({ vm, state }) => () => {
409
409
  state.visible = false;
410
410
  vm.$refs.reference.blur();
411
411
  };
412
- const handleBlur = ({ constants, dispatch, emit, state }) => (event) => {
412
+ const handleBlur = ({ constants, dispatch, emit, state, designConfig }) => (event) => {
413
+ var _a;
413
414
  clearTimeout(state.timer);
414
415
  state.timer = setTimeout(() => {
416
+ var _a2;
415
417
  if (state.isSilentBlur) {
416
418
  state.isSilentBlur = false;
417
419
  } else {
418
420
  emit("blur", event);
419
421
  }
422
+ if ((_a2 = designConfig == null ? void 0 : designConfig.state) == null ? void 0 : _a2.delayBlur) {
423
+ dispatch(constants.COMPONENT_NAME.FormItem, constants.EVENT_NAME.formBlur, event.target.value);
424
+ }
420
425
  }, 200);
421
- dispatch(constants.COMPONENT_NAME.FormItem, constants.EVENT_NAME.formBlur, event.target.value);
426
+ if (!((_a = designConfig == null ? void 0 : designConfig.state) == null ? void 0 : _a.delayBlur)) {
427
+ dispatch(constants.COMPONENT_NAME.FormItem, constants.EVENT_NAME.formBlur, event.target.value);
428
+ }
422
429
  state.softFocus = false;
423
430
  };
424
431
  const handleClearClick = (api) => (event) => {
425
432
  api.deleteSelected(event);
426
433
  };
427
434
  const doDestroy = (vm) => () => {
428
- vm.$refs.popper && vm.$refs.popper.doDestroy();
435
+ var _a;
436
+ if ((_a = vm == null ? void 0 : vm.$refs) == null ? void 0 : _a.popper) {
437
+ vm.$refs.popper.doDestroy();
438
+ }
429
439
  };
430
440
  const handleClose = (state) => () => {
431
441
  state.visible = false;
@@ -486,15 +496,16 @@ const resetInputHeight = ({ constants, nextTick, props, vm, state, api, designCo
486
496
  }
487
497
  let input = vm.$refs.reference.type === "text" && vm.$refs.reference.$el.querySelector("input");
488
498
  const tags = vm.$refs.tags;
499
+ const limitText = vm.$refs.reference.$el.querySelector("span.tiny-select__limit-txt");
489
500
  if (!input) {
490
501
  return;
491
502
  }
492
- if (!state.isDisplayOnly && props.hoverExpand && !props.disabled) {
503
+ if (!state.isDisplayOnly && (props.hoverExpand || props.clickExpand) && !props.disabled) {
493
504
  api.calcCollapseTags();
494
505
  }
495
- const sizeInMap = state.initialInputHeight || (state.isSaaSTheme ? 28 : 30);
506
+ const sizeInMap = (designConfig == null ? void 0 : designConfig.state.initialInputHeight) || state.initialInputHeight || (state.isSaaSTheme ? 28 : 30);
496
507
  const noSelected = state.selected.length === 0;
497
- const spacingHeight = designConfig ? (_a = designConfig.state) == null ? void 0 : _a.spacingHeight : 2;
508
+ const spacingHeight = designConfig ? (_a = designConfig.state) == null ? void 0 : _a.spacingHeight : constants.SPACING_HEIGHT;
498
509
  if (!state.isDisplayOnly) {
499
510
  if (!noSelected && tags) {
500
511
  fastdom.measure(() => {
@@ -509,6 +520,12 @@ const resetInputHeight = ({ constants, nextTick, props, vm, state, api, designCo
509
520
  } else {
510
521
  input.style.height = "auto";
511
522
  }
523
+ if (limitText && props.multipleLimit) {
524
+ const { width, marginLeft, marginRight } = getComputedStyle(limitText);
525
+ vm.$refs.tags.style.paddingRight = `${Math.ceil(
526
+ parseFloat(width) + parseFloat(marginLeft) + parseFloat(marginRight)
527
+ )}px`;
528
+ }
512
529
  if (state.visible && state.emptyText !== false) {
513
530
  state.selectEmitter.emit(constants.EVENT_NAME.updatePopper, true);
514
531
  }
@@ -1092,11 +1109,10 @@ const getOptionIndexArr = ({ props, state, api }) => () => {
1092
1109
  });
1093
1110
  };
1094
1111
  const queryVisibleOptions = ({ props, vm, isMobileFirstMode }) => () => {
1095
- var _a;
1096
1112
  if (props.optimization) {
1097
1113
  return optmzApis.queryVisibleOptions(vm, isMobileFirstMode);
1098
1114
  } else {
1099
- return Array.from(((_a = vm.$refs.scrollbar) == null ? void 0 : _a.$el.querySelectorAll('[data-index]:not([style*="display: none"])')) || []);
1115
+ return vm.$refs.scrollbar ? Array.from(vm.$refs.scrollbar.$el.querySelectorAll('[data-index]:not([style*="display: none"])')) : [];
1100
1116
  }
1101
1117
  };
1102
1118
  const handleCopyClick = ({ parent, props, state }) => () => {
@@ -1149,14 +1165,14 @@ const radioChange = ({ props, state, api, vm }) => ({ row }) => {
1149
1165
  api.updateModelValue(row.value);
1150
1166
  api.directEmitChange(row);
1151
1167
  };
1152
- const getTreeData = (props) => (data) => {
1168
+ const getTreeData = (props, state) => (data) => {
1153
1169
  const nodes = [];
1154
1170
  const getChild = (data2, pId) => {
1155
1171
  data2.forEach((node) => {
1156
1172
  node.pId = pId;
1157
1173
  nodes.push(node);
1158
- if (node.children && node.children.length > 0) {
1159
- getChild(node.children, node[props.valueField]);
1174
+ if (node[state.childrenName] && node[state.childrenName].length > 0) {
1175
+ getChild(node[state.childrenName], node[props.valueField]);
1160
1176
  }
1161
1177
  });
1162
1178
  };
@@ -1306,13 +1322,13 @@ const handleEnterTag = ({ state }) => ($event, key) => {
1306
1322
  state.tooltipContent = __spreadProps(__spreadValues({}, state.tooltipContent), { [key]: target.innerText });
1307
1323
  }
1308
1324
  };
1309
- const calcCollapseTags = ({ state, vm }) => () => {
1310
- if (state.inputHovering) {
1325
+ const calcCollapseTags = ({ state, vm, props }) => () => {
1326
+ if (state.inputHovering && !props.clickExpand) {
1311
1327
  return state.isHidden = true;
1312
1328
  }
1313
1329
  const tags = vm.$refs.tags;
1314
1330
  const collapseTag = tags && tags.querySelector('[data-tag="tags-collapse"]');
1315
- if (!tags || !collapseTag) {
1331
+ if (!collapseTag || !tags) {
1316
1332
  return;
1317
1333
  }
1318
1334
  const { width: tagsContentWidth, paddingLeft, paddingRight } = window.getComputedStyle(tags);
@@ -1320,19 +1336,37 @@ const calcCollapseTags = ({ state, vm }) => () => {
1320
1336
  const { width: collapseTagContentWidth, marginRight } = collapseTag && window.getComputedStyle(collapseTag);
1321
1337
  const collapseTagWidth = collapseTag && parseFloat(collapseTagContentWidth) + parseFloat(marginRight);
1322
1338
  const tagList = Array.from(tags.querySelectorAll('[data-tag="tiny-tag"]'));
1323
- let { total, dom, idx } = { total: collapseTagWidth, dom: null, idx: 0 };
1324
- tagList.forEach((tag, index) => {
1325
- if (tag !== collapseTag) {
1326
- const { width: tagContentWidth, marginRight: marginRight2 } = tag && window.getComputedStyle(tag);
1327
- total += parseFloat(tagContentWidth) + parseFloat(marginRight2);
1339
+ let [dom, idx, currentRowWidth, currentTagIndex] = [null, 0, 0, 0];
1340
+ for (let rowNum = 0; rowNum < props.maxVisibleRows; rowNum++) {
1341
+ currentRowWidth = 0;
1342
+ let currentTagWidth = 0;
1343
+ for (currentTagIndex; currentTagIndex < tagList.length; currentTagIndex++) {
1344
+ const tag = tagList[currentTagIndex];
1345
+ if (tag !== collapseTag) {
1346
+ const { width: tagContentWidth, marginRight: marginRight2, marginLeft } = tag && window.getComputedStyle(tag);
1347
+ currentTagWidth = parseFloat(tagContentWidth) + parseFloat(marginRight2) + parseFloat(marginLeft);
1348
+ currentRowWidth += currentTagWidth;
1349
+ }
1350
+ if (tag !== collapseTag && currentRowWidth > tagsWidth) {
1351
+ if (!dom && rowNum === props.maxVisibleRows - 1) {
1352
+ if (currentRowWidth - currentTagWidth + collapseTagWidth < tagsWidth) {
1353
+ dom = tag;
1354
+ idx = currentTagIndex;
1355
+ } else {
1356
+ dom = tagList[currentTagIndex - 1];
1357
+ idx = currentTagIndex - 1;
1358
+ }
1359
+ }
1360
+ break;
1361
+ }
1328
1362
  }
1329
- if (tag !== collapseTag && total > tagsWidth && !dom) {
1330
- dom = tag;
1331
- idx = index;
1363
+ if (currentTagIndex === tagList.length - 1) {
1364
+ break;
1332
1365
  }
1333
- });
1334
- let isOneLine = total - collapseTagWidth <= tagsWidth;
1335
- if (isOneLine) {
1366
+ }
1367
+ if (idx === 0) {
1368
+ state.exceedMaxVisibleRow = false;
1369
+ state.showCollapseTag = false;
1336
1370
  return state.isHidden = true;
1337
1371
  }
1338
1372
  if (dom) {
@@ -1342,6 +1376,8 @@ const calcCollapseTags = ({ state, vm }) => () => {
1342
1376
  state.isHidden = true;
1343
1377
  }
1344
1378
  state.collapseTagsLength = tagList.length - idx;
1379
+ state.exceedMaxVisibleRow = true;
1380
+ state.toHideIndex = idx;
1345
1381
  };
1346
1382
  const watchInputHover = ({ vm }) => (newVal) => {
1347
1383
  const [inputHovering, visible] = newVal;
@@ -1493,12 +1529,27 @@ const getLabelSlotValue = ({ props, state }) => (item) => {
1493
1529
  });
1494
1530
  return ["grid", "tree"].includes(props.renderType) ? item : obj;
1495
1531
  };
1496
- const computedTagsStyle = ({ props, parent, state }) => () => {
1532
+ const computedTagsStyle = ({ props, parent, state, vm }) => () => {
1497
1533
  const isReadonly = props.disabled || (parent.form || {}).disabled || props.displayOnly;
1498
- return {
1534
+ let tagsStyle = {
1499
1535
  "max-width": isReadonly ? "" : state.inputWidth - state.inputPaddingRight + "px",
1500
1536
  width: "100%"
1501
1537
  };
1538
+ if (props.clickExpand && !state.exceedMaxVisibleRow || state.visible) {
1539
+ Object.assign(tagsStyle, { height: "auto" });
1540
+ }
1541
+ if (props.clickExpand && state.exceedMaxVisibleRow && !state.showCollapseTag) {
1542
+ const tags = vm.$refs.tags;
1543
+ const { paddingTop: tagsPaddingTop, paddingBottom: tagsPaddingBottom } = window.getComputedStyle(tags);
1544
+ const tagsPaddingVertical = parseFloat(tagsPaddingTop) + parseFloat(tagsPaddingBottom);
1545
+ const tag = tags == null ? void 0 : tags.querySelector('[data-tag="tiny-tag"]');
1546
+ if (tag) {
1547
+ const { height: tagHeight, marginTop, marginBottom } = window.getComputedStyle(tag);
1548
+ const rowHeight = (parseFloat(tagHeight) + parseFloat(marginTop) + parseFloat(marginBottom)) * props.maxVisibleRows;
1549
+ Object.assign(tagsStyle, { "height": `${rowHeight + tagsPaddingVertical}px` });
1550
+ }
1551
+ }
1552
+ return tagsStyle;
1502
1553
  };
1503
1554
  const computedReadonly = ({ props, state }) => () => state.device === "mb" || props.readonly || !props.filterable || props.multiple || browserInfo.name !== BROWSER_NAME.IE && browserInfo.name !== BROWSER_NAME.Edge && !state.visible;
1504
1555
  const computedShowClose = ({ props, state }) => () => props.clearable && !state.selectDisabled && (state.inputHovering || props.multiple && state.visible) && (props.multiple ? Array.isArray(props.modelValue) && props.modelValue.length > 0 : !isNull(props.modelValue) && props.modelValue !== "");
@@ -1511,6 +1562,11 @@ const computedShowCopy = ({ props, state }) => () => props.multiple && props.cop
1511
1562
  const computedOptionsAllDisabled = (state) => () => state.options.filter((option) => option.visible).every((option) => option.disabled);
1512
1563
  const computedDisabledTooltipContent = (state) => () => state.selected.map((item) => item.state ? item.state.currentLabel : item.currentLabel).join("\uFF1B");
1513
1564
  const computedSelectDisabled = ({ props, parent }) => () => props.disabled || (parent.form || {}).disabled || props.displayOnly || (parent.form || {}).displayOnly;
1565
+ const computedIsExpand = ({ props, state }) => () => {
1566
+ const hoverExpanded = (state.selectHover || state.visible) && props.hoverExpand && !props.disabled;
1567
+ const clickExpanded = props.clickExpand && state.exceedMaxVisibleRow && state.showCollapseTag;
1568
+ return hoverExpanded || clickExpanded;
1569
+ };
1514
1570
  const computedIsExpandAll = (props) => () => {
1515
1571
  const { defaultExpandAll, lazy } = props.treeOp;
1516
1572
  return !lazy && defaultExpandAll !== false;
@@ -1518,9 +1574,9 @@ const computedIsExpandAll = (props) => () => {
1518
1574
  const loadTreeData = ({ state, vm, props, api }) => ({ data = [], init = false }) => {
1519
1575
  const getTreeDatas = (datas, newDatas = []) => {
1520
1576
  datas.forEach(({ data: data2, childNodes }) => {
1521
- let temData = __spreadProps(__spreadValues({}, data2), { children: [] });
1577
+ let temData = __spreadProps(__spreadValues({}, data2), { [state.childrenName]: [] });
1522
1578
  if (childNodes && childNodes.length) {
1523
- getTreeDatas(childNodes, temData.children);
1579
+ getTreeDatas(childNodes, temData[state.childrenName]);
1524
1580
  }
1525
1581
  newDatas.push(temData);
1526
1582
  });
@@ -1584,6 +1640,16 @@ const clearNoMatchValue = ({ props, emit }) => (newModelValue) => {
1584
1640
  emit("update:modelValue", newModelValue);
1585
1641
  }
1586
1642
  };
1643
+ const handleDebouncedQueryChange = ({ state, api }) => debounce(state.debounce, (value) => {
1644
+ api.handleQueryChange(value);
1645
+ });
1646
+ const onClickCollapseTag = ({ state, props, nextTick, api }) => (event) => {
1647
+ event.stopPropagation();
1648
+ if (props.clickExpand && !props.disabled && !state.isDisplayOnly) {
1649
+ state.showCollapseTag = !state.showCollapseTag;
1650
+ nextTick(api.resetInputHeight);
1651
+ }
1652
+ };
1587
1653
  export {
1588
1654
  blur,
1589
1655
  buildRadioConfig,
@@ -1600,6 +1666,7 @@ export {
1600
1666
  computedDisabledTooltipContent,
1601
1667
  computedGetIcon,
1602
1668
  computedGetTagType,
1669
+ computedIsExpand,
1603
1670
  computedIsExpandAll,
1604
1671
  computedOptionsAllDisabled,
1605
1672
  computedReadonly,
@@ -1635,6 +1702,7 @@ export {
1635
1702
  handleClose,
1636
1703
  handleComposition,
1637
1704
  handleCopyClick,
1705
+ handleDebouncedQueryChange,
1638
1706
  handleDropdownClick,
1639
1707
  handleEnterTag,
1640
1708
  handleFocus,
@@ -1651,6 +1719,7 @@ export {
1651
1719
  nodeCheckClick,
1652
1720
  nodeCollapse,
1653
1721
  nodeExpand,
1722
+ onClickCollapseTag,
1654
1723
  onCopying,
1655
1724
  onInputChange,
1656
1725
  onMouseenterNative,
package/select/vue.js CHANGED
@@ -106,7 +106,10 @@ import {
106
106
  computedGetIcon,
107
107
  computedGetTagType,
108
108
  clearSearchText,
109
- clearNoMatchValue
109
+ clearNoMatchValue,
110
+ handleDebouncedQueryChange,
111
+ onClickCollapseTag,
112
+ computedIsExpand
110
113
  } from "./index";
111
114
  import debounce from "../common/deps/debounce";
112
115
  import { isNumber } from "../common/type";
@@ -168,7 +171,8 @@ const api = [
168
171
  "getLabelSlotValue",
169
172
  "loadTreeData",
170
173
  "updateModelValue",
171
- "clearSearchText"
174
+ "clearSearchText",
175
+ "onClickCollapseTag"
172
176
  ];
173
177
  const initState = ({ reactive, computed, props, api: api2, emitter, parent, constants, useBreakpoint, vm, designConfig }) => {
174
178
  const stateAdd = initStateAdd({ computed, props, api: api2, parent });
@@ -201,7 +205,7 @@ const initState = ({ reactive, computed, props, api: api2, emitter, parent, cons
201
205
  collapseTags: computed(() => api2.computeCollapseTags()),
202
206
  multipleLimit: computed(() => api2.computeMultipleLimit()),
203
207
  disabledTooltipContent: computed(() => api2.computedDisabledTooltipContent()),
204
- isExpand: computed(() => (state.selectHover || state.visible) && props.hoverExpand && !props.disabled),
208
+ isExpand: computed(() => api2.computedIsExpand()),
205
209
  collapseTagsLength: 0,
206
210
  initValue: [],
207
211
  key: 0,
@@ -282,10 +286,16 @@ const initStateAdd = ({ computed, props, api: api2, parent }) => {
282
286
  gridCheckedData: computed(() => api2.getcheckedData()),
283
287
  isExpandAll: computed(() => api2.computedIsExpandAll()),
284
288
  searchSingleCopy: computed(() => props.allowCopy && !props.multiple && props.filterable),
289
+ childrenName: computed(() => props.treeOp.props && props.treeOp.props.children || "children"),
285
290
  tooltipContent: {},
286
291
  isHidden: false,
287
292
  defaultCheckedKeys: [],
288
- optionIndexArr: []
293
+ optionIndexArr: [],
294
+ showCollapseTag: false,
295
+ exceedMaxVisibleRow: false,
296
+ // 是否超出默认最大显示行数
297
+ toHideIndex: Infinity
298
+ // 第一个超出被隐藏的索引
289
299
  };
290
300
  };
291
301
  const initApi = ({
@@ -307,7 +317,7 @@ const initApi = ({
307
317
  state,
308
318
  maskState,
309
319
  doDestroy: doDestroy(vm),
310
- getTreeData: getTreeData(props),
320
+ getTreeData: getTreeData(props, state),
311
321
  blur: blur({ vm, state }),
312
322
  focus: focus({ vm, state }),
313
323
  getValueKey: getValueKey(props),
@@ -337,7 +347,7 @@ const initApi = ({
337
347
  setOptionHighlight: setOptionHighlight(state),
338
348
  nodeExpand: nodeExpand({ state, constants, nextTick }),
339
349
  nodeCollapse: nodeCollapse({ state, constants, nextTick }),
340
- handleBlur: handleBlur({ constants, dispatch, emit, state }),
350
+ handleBlur: handleBlur({ constants, dispatch, emit, state, designConfig }),
341
351
  toggleLastOptionHitState: toggleLastOptionHitState({ state }),
342
352
  emptyText: emptyText({ I18N: constants.I18N, props, state, t, isMobileFirstMode }),
343
353
  emptyFlag: emptyFlag({ props, state }),
@@ -358,7 +368,7 @@ const initApi = ({
358
368
  watchInputHover: watchInputHover({ vm }),
359
369
  initQuery: initQuery({ props, state, constants, vm }),
360
370
  updateModelValue: updateModelValue({ props, emit, state }),
361
- computedTagsStyle: computedTagsStyle({ props, parent, state }),
371
+ computedTagsStyle: computedTagsStyle({ props, parent, state, vm }),
362
372
  computedReadonly: computedReadonly({ props, state }),
363
373
  computedShowClose: computedShowClose({ props, state }),
364
374
  computedCollapseTagSize: computedCollapseTagSize(state),
@@ -367,6 +377,7 @@ const initApi = ({
367
377
  computedOptionsAllDisabled: computedOptionsAllDisabled(state),
368
378
  computedDisabledTooltipContent: computedDisabledTooltipContent(state),
369
379
  computedSelectDisabled: computedSelectDisabled({ props, parent }),
380
+ computedIsExpand: computedIsExpand({ props, state }),
370
381
  computedIsExpandAll: computedIsExpandAll(props),
371
382
  watchInitValue: watchInitValue({ props, emit }),
372
383
  watchShowClose: watchShowClose({ nextTick, state, parent }),
@@ -416,9 +427,11 @@ const addApi = ({
416
427
  handleOptionSelect: handleOptionSelect({ api: api2, nextTick, props, vm, state }),
417
428
  getPluginOption: getPluginOption({ api: api2, props, state }),
418
429
  toggleCheckAll: toggleCheckAll({ api: api2, emit, state, props }),
419
- debouncedQueryChange: debounce(state.debounce, (event) => {
420
- api2.handleQueryChange(props.shape ? event : event.target.value, false, true);
421
- }),
430
+ handleDebouncedQueryChange: handleDebouncedQueryChange({ state, api: api2 }),
431
+ debouncedQueryChange: (event) => {
432
+ const value = props.shape ? event : event.target.value;
433
+ api2.handleDebouncedQueryChange(value);
434
+ },
422
435
  debouncedOnInputChange: debounce(state.debounce, () => {
423
436
  api2.onInputChange();
424
437
  }),
@@ -430,10 +443,11 @@ const addApi = ({
430
443
  watchOptimizeOpts: watchOptimizeOpts({ props, state }),
431
444
  handleDropdownClick: handleDropdownClick({ props, vm, state, emit }),
432
445
  handleEnterTag: handleEnterTag({ state }),
433
- calcCollapseTags: calcCollapseTags({ state, vm }),
446
+ calcCollapseTags: calcCollapseTags({ state, vm, props }),
434
447
  initValue: initValue({ state }),
435
448
  getLabelSlotValue: getLabelSlotValue({ props, state }),
436
- loadTreeData: loadTreeData({ state, vm, props, api: api2 })
449
+ loadTreeData: loadTreeData({ state, vm, props, api: api2 }),
450
+ onClickCollapseTag: onClickCollapseTag({ state, props, nextTick, api: api2 })
437
451
  });
438
452
  };
439
453
  const initWatch = ({ watch, props, api: api2, state, nextTick }) => {
package/skeleton/vue.js CHANGED
@@ -2,8 +2,8 @@ import "../chunk-G2ADBYYC.js";
2
2
  import { toPxStyle } from "./index";
3
3
  const api = ["toPxStyle"];
4
4
  const renderless = (props, { toRefs, provide }) => {
5
- const { active } = toRefs(props);
6
- provide("active", active);
5
+ const { animated } = toRefs(props);
6
+ provide("animated", animated);
7
7
  const api2 = {
8
8
  toPxStyle
9
9
  };
@@ -2,7 +2,7 @@ import "../chunk-G2ADBYYC.js";
2
2
  const api = ["state"];
3
3
  const renderless = (props, { reactive, inject }) => {
4
4
  const state = reactive({
5
- isActive: inject("active", false)
5
+ isActive: inject("animated", false)
6
6
  });
7
7
  const api2 = {
8
8
  state
@@ -0,0 +1,22 @@
1
+ import "../chunk-G2ADBYYC.js";
2
+ import { isFunction } from "../common/type";
3
+ const isNumber = ({ props }) => () => {
4
+ return typeof props.value === "number";
5
+ };
6
+ const getIntegerAndDecimal = ({ props }) => () => {
7
+ var _a, _b;
8
+ if (isFunction(props.formatter)) {
9
+ return props.formatter(props.value);
10
+ }
11
+ if (!isNumber(props.value)) {
12
+ return props.value;
13
+ }
14
+ let displayValue = props.value ? String(props.value).split(".") : "";
15
+ let integer = (_a = displayValue[0]) == null ? void 0 : _a.replace(/\B(?=(\d{3})+(?!\d))/g, props.groupSeparator);
16
+ let decimal = (_b = displayValue[1]) == null ? void 0 : _b.padEnd(props.precision, "0").slice(0, props.precision > 0 ? props.precision : 0);
17
+ return [integer, decimal].join(decimal ? "." : "");
18
+ };
19
+ export {
20
+ getIntegerAndDecimal,
21
+ isNumber
22
+ };
@@ -0,0 +1,20 @@
1
+ import "../chunk-G2ADBYYC.js";
2
+ import { getIntegerAndDecimal } from "./index";
3
+ const api = ["state", "getIntegerAndDecimal"];
4
+ const renderless = (props, hooks) => {
5
+ const api2 = {
6
+ getIntegerAndDecimal: getIntegerAndDecimal({ props })
7
+ };
8
+ const { reactive, computed } = hooks;
9
+ const state = reactive({
10
+ value: computed(() => api2.getIntegerAndDecimal(props))
11
+ });
12
+ Object.assign(api2, {
13
+ state
14
+ });
15
+ return api2;
16
+ };
17
+ export {
18
+ api,
19
+ renderless
20
+ };
package/tabs/index.js CHANGED
@@ -1,4 +1,40 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
+ const getOrderedPanes = (parent, panes) => {
3
+ const slotDefault = parent.$slots.default;
4
+ let orders;
5
+ if (typeof slotDefault === "function") {
6
+ orders = [];
7
+ const tabVnodes = slotDefault();
8
+ const handler = ({ type, componentOptions, props }) => {
9
+ let componentName = type && type.componentName;
10
+ if (!componentName)
11
+ componentName = componentOptions && componentOptions.Ctor.extendOptions.componentName;
12
+ if (componentName === "TabItem") {
13
+ const paneName = props && props.name || componentOptions && componentOptions.propsData.name;
14
+ orders.push(paneName);
15
+ }
16
+ };
17
+ tabVnodes.forEach(({ type, componentOptions, props, children }) => {
18
+ if (type && (type.toString() === "Symbol(Fragment)" || // vue@3.3之前的开发模式
19
+ type.toString() === "Symbol(v-fgt)" || // vue@3.3.1 的变更
20
+ type.toString() === "Symbol()")) {
21
+ Array.isArray(children) && children.forEach(({ type: type2, componentOptions: componentOptions2, props: props2 }) => handler({ type: type2, componentOptions: componentOptions2, props: props2 }));
22
+ } else {
23
+ handler({ type, componentOptions, props });
24
+ }
25
+ });
26
+ }
27
+ if (orders.length > 0) {
28
+ let tmpPanes = [];
29
+ orders.forEach((paneName) => {
30
+ let pane = panes.find((pane2) => pane2.name === paneName);
31
+ if (pane)
32
+ tmpPanes.push(pane);
33
+ });
34
+ panes = tmpPanes;
35
+ }
36
+ return panes;
37
+ };
2
38
  const calcPaneInstances = ({
3
39
  constants,
4
40
  parent,
@@ -7,23 +43,28 @@ const calcPaneInstances = ({
7
43
  }) => (isForceUpdate = false) => {
8
44
  const tabItemVNodes = parent.$slots.default;
9
45
  if (tabItemVNodes) {
46
+ const orderPanes = [];
47
+ tabItemVNodes().forEach((vnode) => {
48
+ var _a;
49
+ if (Array.isArray(vnode.children)) {
50
+ vnode.children.forEach((child) => {
51
+ var _a2;
52
+ const name = (_a2 = child.props) == null ? void 0 : _a2.name;
53
+ name && orderPanes.push(name);
54
+ });
55
+ } else {
56
+ const name = (_a = vnode.props) == null ? void 0 : _a.name;
57
+ name && orderPanes.push(name);
58
+ }
59
+ });
10
60
  const currentPanes = [];
11
61
  childrenHandler(({ vm, isLevel1 }) => {
12
- isLevel1 && vm.$options.componentName === constants.TAB_ITEM && currentPanes.push(vm);
13
- });
14
- const currentPaneStates = currentPanes.map((pane) => pane.state);
15
- const paneStates = state.panes.map((pane) => pane.state);
16
- let newPanes = [];
17
- for (let i = 0; i < paneStates.length; i++) {
18
- const paneState = paneStates[i];
19
- const index = currentPaneStates.indexOf(paneState);
20
- if (index > -1) {
21
- newPanes.push(state.panes[i]);
22
- currentPanes.splice(index, 1);
23
- currentPaneStates.splice(index, 1);
62
+ if (isLevel1 && vm.$options.componentName === constants.TAB_ITEM) {
63
+ const index = orderPanes.findIndex((name) => name === vm.name);
64
+ index > -1 ? currentPanes[index] = vm : currentPanes.push(vm);
24
65
  }
25
- }
26
- newPanes = newPanes.concat(currentPanes);
66
+ });
67
+ const newPanes = getOrderedPanes(parent, currentPanes);
27
68
  const panesChanged = !(newPanes.length === state.panes.length && newPanes.every((pane, index) => pane.state === state.panes[index].state));
28
69
  if (isForceUpdate || panesChanged) {
29
70
  state.panes = newPanes;
@@ -84,7 +84,7 @@ const setLocalStorageage = (name, value, memorySpace = 5) => {
84
84
  oldArray = sortDeduplication(oldArray, memorySpace);
85
85
  newValue = JSON.stringify(oldArray);
86
86
  } else if (oldValue === null || oldValue === value) {
87
- newValue = value;
87
+ newValue = JSON.stringify([value]);
88
88
  } else {
89
89
  newValue = JSON.stringify([value, oldValue]);
90
90
  }
@@ -9,7 +9,7 @@ const watchModelValue = ({ props, state }) => () => {
9
9
  if (!showSeconds && modelValue.length === 3) {
10
10
  state.seconds = modelValue[2];
11
11
  }
12
- state.dateArr = modelValue ? modelValue.slice(0, num) : [];
12
+ state.dateArr = modelValue && state.dateArr.toString() !== "NaN,NaN,NaN" ? modelValue.slice(0, num) : [];
13
13
  };
14
14
  const watchVisible = ({ api, state }) => (value) => {
15
15
  state.visible = value;
@@ -25,6 +25,14 @@ const confirm = ({ emit, state }) => (value) => {
25
25
  emit("update:modelValue", state.value);
26
26
  emit("confirm", state.value);
27
27
  };
28
+ const clear = ({ state, emit, api, vm, dispatch }) => ($event) => {
29
+ state.dateArr = [];
30
+ vm.$refs.cascaderSelect.clear(state.dateArr);
31
+ emit("update:modelValue", state.dateArr);
32
+ emit("clear", state.dateArr);
33
+ dispatch("Picker", "handle-clear", $event);
34
+ api.updateVisible(false);
35
+ };
28
36
  const getTimePeriod = ({ state, props }) => (unit, length) => {
29
37
  const step = props.step || {};
30
38
  const value = step[unit] || 1;
@@ -39,6 +47,7 @@ const computedOptions = ({ state, api, props }) => () => {
39
47
  return options;
40
48
  };
41
49
  export {
50
+ clear,
42
51
  computedOptions,
43
52
  confirm,
44
53
  getTimePeriod,
@@ -6,10 +6,11 @@ import {
6
6
  confirm,
7
7
  updateVisible,
8
8
  getTimePeriod,
9
- computedOptions
9
+ computedOptions,
10
+ clear
10
11
  } from "./index";
11
- const api = ["state", "confirm", "updateVisible"];
12
- const renderless = (props, { reactive, watch, computed }, { emit }) => {
12
+ const api = ["state", "confirm", "updateVisible", "clear"];
13
+ const renderless = (props, { reactive, watch, computed }, { emit, vm, dispatch }) => {
13
14
  const api2 = {};
14
15
  const state = reactive({
15
16
  visible: false,
@@ -25,6 +26,7 @@ const renderless = (props, { reactive, watch, computed }, { emit }) => {
25
26
  watchModelValue: watchModelValue({ props, state }),
26
27
  watchVisible: watchVisible({ api: api2, state }),
27
28
  confirm: confirm({ emit, state }),
29
+ clear: clear({ state, emit, api: api2, vm, dispatch }),
28
30
  updateVisible: updateVisible({ emit, state }),
29
31
  getTimePeriod: getTimePeriod({ state, props }),
30
32
  computedOptions: computedOptions({ state, api: api2, props }),
@@ -70,9 +70,59 @@ const handleScroll = ({ api, vm, state }) => (type) => {
70
70
  const step = state.step[type];
71
71
  const limitVal = { hours: 23, minutes: 59, seconds: 59 };
72
72
  Object.keys(limitVal).forEach((key) => limitVal[key] = Math.floor(limitVal[key] / step) * step);
73
- value = Math.min(value * step, limitVal[type]);
73
+ value = api.selectDateScroll(type, Math.min(value * step, limitVal[type]));
74
74
  api.modifyDateField(type, value);
75
75
  };
76
+ const selectDateScroll = ({ state, props }) => (type, value) => {
77
+ if (Object.keys(props.endDate).length !== 0) {
78
+ const endHours = props.endDate.getHours();
79
+ const endMinutes = props.endDate.getMinutes();
80
+ const endSeconds = props.endDate.getSeconds();
81
+ if (type === "hours") {
82
+ value = value > endHours ? state.hours : value;
83
+ } else if (type === "minutes") {
84
+ value = state.hours === endHours && value > endMinutes ? state.minutes : value;
85
+ } else {
86
+ value = state.hours === endHours && state.minutes === endMinutes && value > endSeconds ? state.seconds : value;
87
+ }
88
+ } else if (Object.keys(props.startDate).length !== 0) {
89
+ const startHours = props.startDate.getHours();
90
+ const startMinutes = props.startDate.getMinutes();
91
+ const startSeconds = props.startDate.getSeconds();
92
+ if (type === "hours") {
93
+ value = value < startHours ? state.hours : value;
94
+ } else if (type === "minutes") {
95
+ value = state.hours === startHours && value < startMinutes ? state.minutes : value;
96
+ } else {
97
+ value = state.hours === startHours && state.minutes === startMinutes && value < startSeconds ? state.seconds : value;
98
+ }
99
+ } else if (state.selectableRange.length > 0) {
100
+ const [startRange, endRange] = state.selectableRange[0];
101
+ const startRangeHours = startRange.getHours();
102
+ const endRangeHours = endRange.getHours();
103
+ const startRangeMinutes = startRange.getMinutes();
104
+ const endRangeMinutes = endRange.getMinutes();
105
+ const startRangeSeconds = startRange.getSeconds();
106
+ const endRangeSeconds = endRange.getSeconds();
107
+ if (type === "hours") {
108
+ value = value < startRangeHours || value > endRangeHours ? state.hours : value;
109
+ } else if (type === "minutes") {
110
+ if (state.hours === startRangeHours) {
111
+ value = value < startRangeMinutes ? startRangeMinutes : value;
112
+ } else if (state.hours === endRangeHours) {
113
+ value = value > endRangeMinutes ? endRangeMinutes : value;
114
+ }
115
+ } else {
116
+ if (state.hours === startRangeHours && state.minutes === startRangeMinutes) {
117
+ value = value < startRangeSeconds ? startRangeSeconds : value;
118
+ } else if (state.hours === endRangeHours && state.minutes === endRangeMinutes) {
119
+ value = value > endRangeSeconds ? endRangeSeconds : value;
120
+ }
121
+ value = startRangeSeconds === 0 && value < 1 ? 0 : value;
122
+ }
123
+ }
124
+ return value;
125
+ };
76
126
  const adjustSpinners = ({ api, state }) => () => {
77
127
  api.adjustSpinner("hours", state.hours);
78
128
  api.adjustSpinner("minutes", state.minutes);
@@ -152,5 +202,6 @@ export {
152
202
  modifyDateField,
153
203
  scrollBarHeight,
154
204
  scrollDown,
205
+ selectDateScroll,
155
206
  typeItemHeight
156
207
  };