@opentiny/vue-renderless 3.17.6 → 3.18.0-beta.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 (152) hide show
  1. package/README.md +12 -3
  2. package/action-menu/index.js +2 -2
  3. package/action-menu/vue.js +2 -2
  4. package/anchor/index.js +11 -4
  5. package/autocomplete/index.js +20 -14
  6. package/autocomplete/vue.js +36 -9
  7. package/badge/index.js +4 -3
  8. package/base-select/index.js +3 -3
  9. package/breadcrumb-item/vue.js +1 -1
  10. package/button-group/index.js +6 -1
  11. package/carousel-item/index.js +1 -1
  12. package/checkbox/index.js +1 -1
  13. package/collapse-item/index.js +7 -1
  14. package/collapse-item/vue.js +12 -2
  15. package/color-picker/index.js +20 -32
  16. package/color-picker/vue.js +31 -54
  17. package/color-select-panel/index.js +8 -5
  18. package/color-select-panel/vue.js +1 -2
  19. package/common/deps/clickoutside.js +10 -3
  20. package/common/deps/dom.js +9 -1
  21. package/common/deps/tree-model/tree-store.js +13 -2
  22. package/common/deps/useRelation.js +24 -7
  23. package/common/deps/useWindowSize.js +23 -0
  24. package/common/form/const.js +10 -0
  25. package/common/index.js +1 -1
  26. package/common/prop-util.js +43 -0
  27. package/common/runtime.js +1 -1
  28. package/common/xss.js +2 -2
  29. package/crop/index.js +14 -22
  30. package/crop/vue.js +33 -29
  31. package/date-panel/index.js +13 -2
  32. package/date-panel/vue.js +16 -10
  33. package/dialog-box/index.js +1 -1
  34. package/dialog-select/index.js +40 -13
  35. package/dialog-select/vue.js +3 -3
  36. package/drawer/index.js +13 -0
  37. package/drawer/vue.js +4 -3
  38. package/dropdown-item/index.js +2 -2
  39. package/dropdown-item/mf.js +1 -1
  40. package/dropdown-item/vue.js +9 -6
  41. package/dropdown-menu/index.js +3 -0
  42. package/dropdown-menu/vue.js +5 -3
  43. package/fall-menu/index.js +4 -0
  44. package/fall-menu/vue.js +15 -2
  45. package/file-upload/index.js +4 -4
  46. package/filter-box/vue.js +5 -2
  47. package/fluent-editor/index.js +10 -3
  48. package/fluent-editor/options.js +93 -27
  49. package/fluent-editor/vue.js +8 -8
  50. package/form/index.js +7 -4
  51. package/form/vue.js +1 -1
  52. package/form-item/index.js +6 -1
  53. package/form-item/vue.js +3 -1
  54. package/grid/utils/dom.js +3 -1
  55. package/guide/index.js +21 -6
  56. package/input/index.js +17 -1
  57. package/input/vue.js +19 -8
  58. package/ip-address/index.js +0 -10
  59. package/ip-address/vue.js +2 -5
  60. package/load-list/index.js +43 -0
  61. package/load-list/vue.js +69 -0
  62. package/milestone/index.js +55 -8
  63. package/milestone/vue.js +16 -3
  64. package/modal/index.js +6 -6
  65. package/modal/vue.js +4 -3
  66. package/nav-menu/index.js +7 -3
  67. package/option/index.js +0 -15
  68. package/option/vue.js +2 -13
  69. package/package.json +7 -7
  70. package/pager/index.js +25 -0
  71. package/pager/vue.js +18 -4
  72. package/pager-item/index.js +4 -7
  73. package/picker/index.js +27 -7
  74. package/picker/vue.js +2 -1
  75. package/pop-upload/index.js +13 -4
  76. package/pop-upload/vue.js +4 -0
  77. package/popeditor/index.js +14 -2
  78. package/popeditor/vue.js +9 -5
  79. package/rich-text-editor/vue.js +9 -3
  80. package/select/index.js +12 -11
  81. package/select/vue.js +14 -5
  82. package/slider/index.js +2 -2
  83. package/slider-button/index.js +8 -3
  84. package/slider-button/vue.js +6 -2
  85. package/slider-button-group/index.js +46 -9
  86. package/slider-button-group/vue.js +40 -18
  87. package/split/vue.js +4 -2
  88. package/sticky/index.js +89 -0
  89. package/sticky/vue.js +74 -0
  90. package/tab-item-mf/vue.js +6 -1
  91. package/tabs-mf/index.js +58 -3
  92. package/tabs-mf/vue-bar.js +0 -6
  93. package/tabs-mf/vue-swipe.js +20 -0
  94. package/tabs-mf/vue.js +22 -4
  95. package/time/index.js +6 -1
  96. package/time/vue.js +8 -2
  97. package/time-line/index.js +1 -1
  98. package/time-line-new/index.js +53 -0
  99. package/time-line-new/vue.js +41 -0
  100. package/time-range/vue.js +4 -1
  101. package/time-spinner/index.js +4 -1
  102. package/time-spinner/vue.js +2 -2
  103. package/tooltip/vue.js +16 -3
  104. package/transfer-panel/vue.js +7 -6
  105. package/tree/index.js +18 -7
  106. package/tree/vue.js +14 -7
  107. package/tree-node/index.js +2 -2
  108. package/tree-node/vue.js +6 -2
  109. package/tree-select/index.js +6 -6
  110. package/tree-select/vue.js +1 -1
  111. package/types/action-menu.type.d.ts +1 -1
  112. package/types/alert.type.d.ts +2 -0
  113. package/types/autocomplete.type.d.ts +17 -13
  114. package/types/badge.type.d.ts +1 -1
  115. package/types/button-group.type.d.ts +3 -0
  116. package/types/button.type.d.ts +21 -0
  117. package/types/checkbox.type.d.ts +1 -0
  118. package/types/date-picker.type.d.ts +3 -0
  119. package/types/drawer.type.d.ts +5 -1
  120. package/types/{dropdown-item.type-678794c9.d.ts → dropdown-item.type-c9badbc1.d.ts} +6 -2
  121. package/types/dropdown-item.type.d.ts +1 -1
  122. package/types/dropdown-menu.type.d.ts +1 -1
  123. package/types/dropdown.type.d.ts +4 -0
  124. package/types/fall-menu.type.d.ts +1 -0
  125. package/types/file-upload.type.d.ts +1 -1
  126. package/types/form-item.type.d.ts +1 -1
  127. package/types/{form.type-33aa784a.d.ts → form.type-f6fb4c38.d.ts} +5 -0
  128. package/types/form.type.d.ts +1 -1
  129. package/types/input.type.d.ts +12 -2
  130. package/types/link.type.d.ts +6 -1
  131. package/types/load-list.type.d.ts +58 -0
  132. package/types/milestone.type.d.ts +27 -1
  133. package/types/modal.type.d.ts +3 -2
  134. package/types/pager.type.d.ts +5 -1
  135. package/types/picker.type.d.ts +3 -0
  136. package/types/popover.type.d.ts +1 -1
  137. package/types/search.type.d.ts +4 -0
  138. package/types/steps.type.d.ts +1 -0
  139. package/types/tag.type.d.ts +1 -0
  140. package/types/tooltip.type.d.ts +3 -0
  141. package/types/transfer.type.d.ts +3 -3
  142. package/types/tree-menu.type.d.ts +4 -1
  143. package/types/upload-dragger.type.d.ts +1 -1
  144. package/types/{upload-list.type-02a1effb.d.ts → upload-list.type-26173587.d.ts} +17 -3
  145. package/types/upload-list.type.d.ts +1 -1
  146. package/types/upload.type.d.ts +1 -1
  147. package/upload-list/vue.js +7 -7
  148. package/virtual-scroll-box/index.js +294 -0
  149. package/virtual-scroll-box/vue.js +43 -0
  150. package/virtual-tree/index.js +168 -0
  151. package/virtual-tree/vue.js +53 -0
  152. package/LICENSE +0 -22
package/select/index.js CHANGED
@@ -277,7 +277,7 @@ const getOptionOfSetSelected = ({ api, props }) => {
277
277
  } else {
278
278
  option.createdSelected = false;
279
279
  }
280
- if (!option.currentLabel) {
280
+ if (!option.state.currentLabel) {
281
281
  api.clearNoMatchValue("");
282
282
  }
283
283
  return option;
@@ -495,7 +495,7 @@ const resetInputHeight = ({ constants, nextTick, props, vm, state, api, designCo
495
495
  return;
496
496
  }
497
497
  nextTick(() => {
498
- var _a;
498
+ var _a, _b;
499
499
  if (!vm.$refs.reference) {
500
500
  return;
501
501
  }
@@ -508,9 +508,9 @@ const resetInputHeight = ({ constants, nextTick, props, vm, state, api, designCo
508
508
  if (!state.isDisplayOnly && (props.hoverExpand || props.clickExpand) && !props.disabled) {
509
509
  api.calcCollapseTags();
510
510
  }
511
- const sizeInMap = (designConfig == null ? void 0 : designConfig.state.initialInputHeight) || Math.round(state.initialInputHeight) || (state.isSaaSTheme ? 28 : 30);
511
+ const sizeInMap = (designConfig == null ? void 0 : designConfig.state.initialInputHeight) || Math.round(state.initialInputHeight) || 32;
512
512
  const noSelected = state.selected.length === 0;
513
- const spacingHeight = designConfig ? (_a = designConfig.state) == null ? void 0 : _a.spacingHeight : constants.SPACING_HEIGHT;
513
+ const spacingHeight = (_b = (_a = designConfig == null ? void 0 : designConfig.state) == null ? void 0 : _a.spacingHeight) != null ? _b : constants.SPACING_HEIGHT;
514
514
  if (!state.isDisplayOnly) {
515
515
  if (!noSelected && tags) {
516
516
  fastdom.measure(() => {
@@ -640,9 +640,6 @@ const toggleMenu = ({ vm, state, props, api }) => (e) => {
640
640
  const enterCode = 13;
641
641
  const nodeName = event.target && event.target.nodeName;
642
642
  const toggleVisible = props.ignoreEnter ? event.keyCode !== enterCode && nodeName === "INPUT" : true;
643
- if (!props.displayOnly) {
644
- event.stopPropagation();
645
- }
646
643
  if (!state.selectDisabled) {
647
644
  toggleVisible && !state.softFocus && (state.visible = !state.visible);
648
645
  state.softFocus = false;
@@ -1434,7 +1431,7 @@ const mounted = ({ api, parent, state, props, vm, designConfig }) => () => {
1434
1431
  document.activeElement.blur();
1435
1432
  }
1436
1433
  state.completed = true;
1437
- const defaultSizeMap = { default: 28, mini: 24, small: 32, medium: 40 };
1434
+ const defaultSizeMap = { default: 32, mini: 24, small: 36, medium: 40 };
1438
1435
  const sizeMap = ((_a = designConfig == null ? void 0 : designConfig.state) == null ? void 0 : _a.sizeMap) || defaultSizeMap;
1439
1436
  if (props.multiple && Array.isArray(props.modelValue) && props.modelValue.length > 0) {
1440
1437
  state.currentPlaceholder = "";
@@ -1490,7 +1487,7 @@ const optmzApis = {
1490
1487
  vm.$refs.scrollbar.$el.querySelectorAll(
1491
1488
  '.tiny-recycle-scroller__slot, .tiny-recycle-scroller__item-view:not([style*="transform: translateY(-9999px) translateX(0px)"])'
1492
1489
  )
1493
- ).map((item) => item.querySelector(`[data-tag="tiny-select-dropdown-item"]:not(${querySelectKey})`)).filter((v) => v);
1490
+ ).map((item) => item.querySelector(`[data-tag="tiny-option"]:not(${querySelectKey})`)).filter((v) => v);
1494
1491
  },
1495
1492
  setScrollTop: ({ refs, state }) => {
1496
1493
  const { optimizeStore } = state;
@@ -1588,7 +1585,7 @@ const computedDisabledTooltipContent = ({ props, state }) => () => {
1588
1585
  return state.selected.state ? state.selected.state.currentLabel : state.selected.currentLabel;
1589
1586
  }
1590
1587
  };
1591
- const computedSelectDisabled = ({ props, parent }) => () => props.disabled || (parent.form || {}).disabled || props.displayOnly || (parent.form || {}).displayOnly;
1588
+ const computedSelectDisabled = ({ state }) => () => state.isDisabled || state.isDisplayOnly;
1592
1589
  const computedIsExpand = ({ props, state }) => () => {
1593
1590
  const hoverExpanded = (state.selectHover || state.visible) && props.hoverExpand && !props.disabled;
1594
1591
  const clickExpanded = props.clickExpand && state.exceedMaxVisibleRow && state.showCollapseTag;
@@ -1641,9 +1638,11 @@ const watchShowClose = ({ nextTick, state, parent }) => () => {
1641
1638
  }
1642
1639
  });
1643
1640
  };
1641
+ const computedShowTagText = ({ state }) => () => state.isDisplayOnly;
1642
+ const isTagClosable = () => (item) => !item.required;
1644
1643
  const computedGetIcon = ({ designConfig, props }) => () => {
1645
1644
  return props.dropdownIcon ? { icon: props.dropdownIcon } : {
1646
- icon: (designConfig == null ? void 0 : designConfig.icons.dropdownIcon) || "icon-delta-down",
1645
+ icon: (designConfig == null ? void 0 : designConfig.icons.dropdownIcon) || "icon-down-ward",
1647
1646
  isDefault: true
1648
1647
  };
1649
1648
  };
@@ -1701,6 +1700,7 @@ export {
1701
1700
  computedShowClose,
1702
1701
  computedShowCopy,
1703
1702
  computedShowNewOption,
1703
+ computedShowTagText,
1704
1704
  computedTagsStyle,
1705
1705
  debouncRquest,
1706
1706
  defaultOnQueryChange,
@@ -1739,6 +1739,7 @@ export {
1739
1739
  handleResize,
1740
1740
  initQuery,
1741
1741
  initValue,
1742
+ isTagClosable,
1742
1743
  loadTreeData,
1743
1744
  managePlaceholder,
1744
1745
  mounted,
package/select/vue.js CHANGED
@@ -109,7 +109,9 @@ import {
109
109
  clearNoMatchValue,
110
110
  handleDebouncedQueryChange,
111
111
  onClickCollapseTag,
112
- computedIsExpand
112
+ computedIsExpand,
113
+ computedShowTagText,
114
+ isTagClosable
113
115
  } from "./index";
114
116
  import debounce from "../common/deps/debounce";
115
117
  import { isNumber } from "../common/type";
@@ -172,7 +174,9 @@ const api = [
172
174
  "loadTreeData",
173
175
  "updateModelValue",
174
176
  "clearSearchText",
175
- "onClickCollapseTag"
177
+ "onClickCollapseTag",
178
+ "computedShowTagText",
179
+ "isTagClosable"
176
180
  ];
177
181
  const initState = ({ reactive, computed, props, api: api2, emitter, parent, constants, useBreakpoint, vm, designConfig }) => {
178
182
  const stateAdd = initStateAdd({ computed, props, api: api2, parent });
@@ -234,7 +238,8 @@ const initState = ({ reactive, computed, props, api: api2, emitter, parent, cons
234
238
  return designConfig.state.autoHideDownIcon;
235
239
  }
236
240
  return true;
237
- })()
241
+ })(),
242
+ designConfig
238
243
  }));
239
244
  return state;
240
245
  };
@@ -283,6 +288,8 @@ const initStateAdd = ({ computed, props, api: api2, parent }) => {
283
288
  formItemSize: computed(() => (parent.formItem || { state: {} }).state.formItemSize),
284
289
  selectDisabled: computed(() => api2.computedSelectDisabled()),
285
290
  isDisplayOnly: computed(() => props.displayOnly || (parent.form || {}).displayOnly),
291
+ isDisabled: computed(() => props.disabled || (parent.form || {}).disabled),
292
+ isShowTagText: computed(() => api2.computedShowTagText()),
286
293
  gridCheckedData: computed(() => api2.getcheckedData()),
287
294
  isExpandAll: computed(() => api2.computedIsExpandAll()),
288
295
  searchSingleCopy: computed(() => props.allowCopy && !props.multiple && (props.filterable || props.searchable)),
@@ -376,7 +383,7 @@ const initApi = ({
376
383
  computedShowCopy: computedShowCopy({ props, state }),
377
384
  computedOptionsAllDisabled: computedOptionsAllDisabled(state),
378
385
  computedDisabledTooltipContent: computedDisabledTooltipContent({ props, state }),
379
- computedSelectDisabled: computedSelectDisabled({ props, parent }),
386
+ computedSelectDisabled: computedSelectDisabled({ state }),
380
387
  computedIsExpand: computedIsExpand({ props, state }),
381
388
  computedIsExpandAll: computedIsExpandAll(props),
382
389
  watchInitValue: watchInitValue({ props, emit }),
@@ -385,7 +392,9 @@ const initApi = ({
385
392
  computedGetIcon: computedGetIcon({ designConfig, props }),
386
393
  computedGetTagType: computedGetTagType({ designConfig, props }),
387
394
  clearSearchText: clearSearchText({ state, api: api2 }),
388
- clearNoMatchValue: clearNoMatchValue({ props, emit })
395
+ clearNoMatchValue: clearNoMatchValue({ props, emit }),
396
+ computedShowTagText: computedShowTagText({ state }),
397
+ isTagClosable: isTagClosable()
389
398
  });
390
399
  addApi({ api: api2, props, state, emit, constants, parent, nextTick, dispatch, vm, isMobileFirstMode, designConfig });
391
400
  };
package/slider/index.js CHANGED
@@ -478,9 +478,9 @@ const handleSlotInput = ({ state, api }) => (event, isLeftInput = true) => {
478
478
  state.activeValue = Number(inputValue);
479
479
  api.updateSlotValue();
480
480
  };
481
- const inputOnChange = ({ api, emit, props, state }) => (event) => {
481
+ const inputOnChange = ({ api, emit, props, state }) => (currentValue) => {
482
482
  if (!props.changeCompat) {
483
- if (!/^\d+$/.test(event.target.value)) {
483
+ if (!/^\d+$/.test(currentValue)) {
484
484
  state.activeValue = state.leftBtnValue;
485
485
  return;
486
486
  }
@@ -22,13 +22,17 @@ const getGroup = ({ constants, parent: $parent }) => () => {
22
22
  return parent;
23
23
  };
24
24
  const mounted = ({ vm, props, dispatch, constants }) => () => {
25
- dispatch(constants.SLIDER_BUTTON_GROUP, "labelValue", [props.label || props.text]);
26
25
  dispatch(constants.SLIDER_BUTTON_GROUP, "eachBlock", [
27
26
  vm.$refs.sliderButton.offsetLeft,
28
27
  vm.$refs.sliderButton.offsetWidth,
29
- vm.$refs.sliderButton.offsetHeight
28
+ vm.$refs.sliderButton.offsetHeight,
29
+ props.label || props.text,
30
+ vm.$refs.sliderButton
30
31
  ]);
31
32
  };
33
+ const unMounted = ({ props, dispatch, constants }) => () => {
34
+ dispatch(constants.SLIDER_BUTTON_GROUP, "delBlock", [props.label || props.text]);
35
+ };
32
36
  const customEvents = ({ props, vm, type }) => {
33
37
  const sliderInput = vm.$refs.sliderInput;
34
38
  for (let ev in props.events) {
@@ -41,5 +45,6 @@ export {
41
45
  getValue,
42
46
  handleChange,
43
47
  mounted,
44
- setValue
48
+ setValue,
49
+ unMounted
45
50
  };
@@ -1,7 +1,7 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
- import { handleChange, getValue, setValue, getGroup, mounted, customEvents } from "./index";
2
+ import { handleChange, getValue, setValue, getGroup, mounted, unMounted, customEvents } from "./index";
3
3
  const api = ["state", "handleChange"];
4
- const renderless = (props, { computed, reactive, onMounted, inject, onBeforeUnmount }, { emit, parent, dispatch, constants, nextTick, vm }) => {
4
+ const renderless = (props, { computed, reactive, onMounted, inject, onBeforeUnmount, watch }, { emit, parent, dispatch, constants, nextTick, vm }) => {
5
5
  const state = reactive({
6
6
  disabled: inject("disabled", null) || props.disabled,
7
7
  type: inject("sliderType", null),
@@ -9,6 +9,7 @@ const renderless = (props, { computed, reactive, onMounted, inject, onBeforeUnmo
9
9
  get: () => api2.getValue(),
10
10
  set: (val) => api2.setValue(val)
11
11
  }),
12
+ label: computed(() => props.label || props.text),
12
13
  sliderButtonGroup: computed(() => api2.getGroup()),
13
14
  size: inject("sliderSize", null),
14
15
  tabIndex: computed(() => state.sliderButtonGroup && state.value !== (props.label || props.text) ? -1 : 0)
@@ -17,6 +18,7 @@ const renderless = (props, { computed, reactive, onMounted, inject, onBeforeUnmo
17
18
  Object.assign(api2, {
18
19
  state,
19
20
  mounted: mounted({ vm, props, dispatch, constants, state, nextTick }),
21
+ unMounted: unMounted({ props, dispatch, constants }),
20
22
  getValue: getValue(state),
21
23
  setValue: setValue({ emit, state }),
22
24
  getGroup: getGroup({ constants, parent }),
@@ -27,8 +29,10 @@ const renderless = (props, { computed, reactive, onMounted, inject, onBeforeUnmo
27
29
  customEvents({ props, vm, type: "add" });
28
30
  });
29
31
  onBeforeUnmount(() => {
32
+ api2.unMounted();
30
33
  customEvents({ props, vm, type: "remove" });
31
34
  });
35
+ watch(() => state.label, api2.mounted);
32
36
  return api2;
33
37
  };
34
38
  export {
@@ -1,15 +1,52 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
- const getChangePosition = (state) => (value) => {
3
- state.eachBlockIndex.find((e, index) => {
4
- if (e.index === value) {
5
- state.currentIndex = index;
2
+ const getChangePosition = ({ state }) => (value) => {
3
+ const sliderItem = state.sliderInfo.find((item) => item.value === value);
4
+ if (sliderItem) {
5
+ const { buttonVm, width, left, height } = sliderItem;
6
+ if (!width || !height) {
7
+ sliderItem.left = buttonVm.offsetLeft;
8
+ sliderItem.width = buttonVm.offsetWidth;
9
+ sliderItem.height = buttonVm.offsetHeight;
6
10
  }
11
+ state.sliderSpace = sliderItem.left;
12
+ state.sliderWidth = sliderItem.width;
13
+ state.sliderHeight = sliderItem.height;
14
+ }
15
+ };
16
+ const watchSliderButtonChange = ({ vm, state, api, props }) => (value) => {
17
+ var _a;
18
+ const observer = new MutationObserver(() => {
19
+ state.sliderInfo.forEach((sliderItem) => {
20
+ const { buttonVm } = sliderItem;
21
+ sliderItem.left = buttonVm.offsetLeft;
22
+ sliderItem.width = buttonVm.offsetWidth;
23
+ sliderItem.height = buttonVm.offsetHeight;
24
+ });
25
+ api.getChangePosition(props.modelValue);
26
+ });
27
+ state.mutationObserver = observer;
28
+ const buttonBox = (_a = vm.$refs) == null ? void 0 : _a.sliderButtonBox;
29
+ if (buttonBox) {
30
+ observer.observe(vm.$refs.sliderButtonBox, { childList: true, subtree: true, characterData: true });
31
+ }
32
+ };
33
+ const watchVisible = ({ vm, api, props, state }) => () => {
34
+ var _a;
35
+ const group = (_a = vm.$refs) == null ? void 0 : _a.sliderButtonGroup;
36
+ if (!group) {
37
+ return;
38
+ }
39
+ const observer = new IntersectionObserver(() => {
40
+ if (!(group == null ? void 0 : group.offsetParent)) {
41
+ return;
42
+ }
43
+ api.getChangePosition(props.modelValue);
7
44
  });
8
- state.sliderSpace = state.eachBlock[state.currentIndex];
9
- state.sliderWidth = state.sliderWidthData[state.currentIndex];
10
- state.sliderHeight = state.sliderHeightData[state.currentIndex];
11
- state.sliderCount += 1;
45
+ state.intersectionObserver = observer;
46
+ observer.observe(group);
12
47
  };
13
48
  export {
14
- getChangePosition
49
+ getChangePosition,
50
+ watchSliderButtonChange,
51
+ watchVisible
15
52
  };
@@ -1,46 +1,68 @@
1
- import "../chunk-G2ADBYYC.js";
2
- import { getChangePosition } from "./index";
1
+ import {
2
+ __spreadProps,
3
+ __spreadValues
4
+ } from "../chunk-G2ADBYYC.js";
5
+ import { getChangePosition, watchVisible, watchSliderButtonChange } from "./index";
3
6
  const api = ["state"];
4
- const renderless = (props, { reactive, provide, onMounted }, { parent }) => {
7
+ const renderless = (props, { reactive, provide, onMounted, onBeforeUnmount, watch }, { parent, vm }) => {
5
8
  const state = reactive({
6
9
  tag: "div",
7
10
  isActive: false,
8
- eachBlock: [],
9
11
  sliderWidth: 0,
10
12
  sliderHeight: 0,
11
13
  sliderSpace: props.size === "large" ? 4 : 2,
12
- sliderWidthData: [],
13
- sliderHeightData: [],
14
- eachBlockIndex: [],
15
- eachBlockData: {},
14
+ sliderInfo: [],
16
15
  currentIndex: 0,
17
- sliderCount: 0
16
+ mutationObserver: null,
17
+ intersectionObserver: null
18
18
  });
19
19
  parent.$on("handleChange", (value) => {
20
20
  api2.getChangePosition(value);
21
21
  parent.$emit("change", value);
22
22
  });
23
- parent.$on("labelValue", (value) => {
24
- state.eachBlockIndex.push({ index: value });
23
+ parent.$on("eachBlock", (left, width, height, value, buttonVm) => {
24
+ const sliderItem = state.sliderInfo.find((item) => item.buttonVm === buttonVm);
25
25
  if (props.modelValue === value) {
26
26
  state.isActive = true;
27
27
  }
28
+ if (sliderItem) {
29
+ state.sliderInfo[state.sliderInfo.indexOf(sliderItem)] = __spreadProps(__spreadValues({}, sliderItem), { left, width, value, height });
30
+ } else {
31
+ state.sliderInfo.push({ buttonVm, left, width, value, height });
32
+ }
28
33
  });
29
- parent.$on("eachBlock", (left, width, height) => {
30
- state.eachBlock.push(left);
31
- state.sliderWidthData.push(width);
32
- state.sliderHeightData.push(height);
33
- state.sliderWidth = state.sliderWidthData[0];
34
- state.sliderHeight = state.sliderHeightData[0];
34
+ parent.$on("delBlock", (value) => {
35
+ let sliderItem = state.sliderInfo.find((item) => item.value === value);
36
+ if (sliderItem) {
37
+ state.sliderInfo.splice(state.sliderInfo.indexOf(sliderItem), 1);
38
+ }
35
39
  });
36
40
  const api2 = {};
37
- Object.assign(api2, { state, getChangePosition: getChangePosition(state) });
41
+ Object.assign(api2, {
42
+ state,
43
+ getChangePosition: getChangePosition({ state }),
44
+ watchVisible: watchVisible({ vm, api: api2, props, state }),
45
+ watchSliderButtonChange: watchSliderButtonChange({ vm, state, api: api2, props })
46
+ });
38
47
  provide("sliderType", props.type);
39
48
  provide("sliderSize", props.size);
40
49
  provide("disabled", props.disabled);
41
50
  onMounted(() => {
42
51
  api2.getChangePosition(props.modelValue);
52
+ api2.watchVisible();
53
+ api2.watchSliderButtonChange();
43
54
  });
55
+ onBeforeUnmount(() => {
56
+ var _a, _b;
57
+ (_a = state.mutationObserver) == null ? void 0 : _a.disconnect();
58
+ (_b = state.intersectionObserver) == null ? void 0 : _b.disconnect();
59
+ });
60
+ watch(
61
+ () => props.modelValue,
62
+ (value) => {
63
+ api2.getChangePosition(value);
64
+ }
65
+ );
44
66
  return api2;
45
67
  };
46
68
  export {
package/split/vue.js CHANGED
@@ -18,7 +18,8 @@ import {
18
18
  } from "./index";
19
19
  import { on, off } from "../common/deps/dom";
20
20
  const api = ["state", "handleMousedown", "buttonMousedown", "buttonLeftTopClick", "buttonRightBottomClick"];
21
- const renderless = (props, hooks, { vm, nextTick, emit, constants }) => {
21
+ const renderless = (props, hooks, { vm, nextTick, emit, constants, designConfig }) => {
22
+ var _a;
22
23
  const api2 = {};
23
24
  const { computed, reactive } = hooks;
24
25
  const getUseOffset = useOffset({ nextTick, props, vm, constants, hooks });
@@ -39,7 +40,8 @@ const renderless = (props, hooks, { vm, nextTick, emit, constants }) => {
39
40
  paneClasses: computed(() => [
40
41
  `${state.prefix}-pane ${props.scrollable ? "tiny-split-scroll" : ""}`,
41
42
  { [`${state.prefix}-pane-moving`]: state.isMoving }
42
- ])
43
+ ]),
44
+ triggerBarConWithLine: (_a = designConfig == null ? void 0 : designConfig.triggerBarConWithLine) != null ? _a : true
43
45
  }, getUseOffset.state));
44
46
  Object.assign(api2, __spreadProps(__spreadValues({
45
47
  state,
@@ -0,0 +1,89 @@
1
+ import "../chunk-G2ADBYYC.js";
2
+ const computedRootStyle = ({ props, state }) => () => {
3
+ return {
4
+ height: state.isFixed ? `${state.rootHeight}px` : "",
5
+ width: state.isFixed ? `${state.rootWidth}px` : ""
6
+ };
7
+ };
8
+ const computedStickyStyle = ({ props, state }) => () => {
9
+ if (!state.isFixed)
10
+ return {};
11
+ const offset = props.offset ? typeof props.offset === "number" ? props.offset + "px" : props.offset : 0;
12
+ return {
13
+ height: `${state.rootHeight}px`,
14
+ width: `${state.rootWidth}px`,
15
+ top: props.position === "top" ? offset : "",
16
+ bottom: props.position === "bottom" ? offset : "",
17
+ transform: state.transform ? `translateY(${state.transform}px)` : "",
18
+ zIndex: props.zIndex
19
+ };
20
+ };
21
+ const updateRoot = ({ props, state, emit, api }) => () => {
22
+ if (!state.scrollParent || !state.target)
23
+ return;
24
+ api.getRootRect();
25
+ state.scrollTop = state.scrollParent instanceof Window ? document.documentElement.scrollTop : state.scrollParent.scrollTop || 0;
26
+ if (props.target) {
27
+ state.targetRect = api.useRect(state.target);
28
+ }
29
+ if (props.position === "top") {
30
+ if (props.target) {
31
+ const difference = state.targetRect.bottom - state.offset - state.rootHeight;
32
+ state.isFixed = state.offset > state.rootTop && state.targetRect.bottom > 0;
33
+ state.transform = difference < 0 ? difference : 0;
34
+ } else {
35
+ state.isFixed = state.offset > state.rootTop;
36
+ }
37
+ } else if (props.target) {
38
+ const difference = state.windowHeight - state.targetRect.top - state.offset - state.rootHeight;
39
+ state.isFixed = state.windowHeight - state.offset < state.rootBottom && state.windowHeight > state.targetRect.top;
40
+ state.transform = difference < 0 ? -difference : 0;
41
+ } else {
42
+ state.isFixed = state.windowHeight - state.offset < state.rootBottom;
43
+ }
44
+ emit("scroll", { scrollTop: state.scrollTop, isFixed: state.isFixed });
45
+ };
46
+ const getRootRect = ({ state, vm, api }) => () => {
47
+ const rootRect = api.useRect(vm.$refs.root);
48
+ state.rootHeight = rootRect.height;
49
+ state.rootWidth = rootRect.width;
50
+ state.rootTop = rootRect.top;
51
+ state.rootBottom = rootRect.bottom;
52
+ };
53
+ const getTarget = ({ state, props, api }) => () => {
54
+ var _a;
55
+ if (props.target) {
56
+ state.target = (_a = document.querySelector(props.target)) != null ? _a : void 0;
57
+ if (state.target) {
58
+ state.targetRect = api.useRect(state.target);
59
+ } else {
60
+ throw new Error(`[AUI Error][aui-sticky] Target does not exist: ${props.target}`);
61
+ }
62
+ } else {
63
+ state.target = document.documentElement;
64
+ }
65
+ };
66
+ const unitToPx = () => (value) => {
67
+ if (typeof value === "number") {
68
+ return value;
69
+ }
70
+ if (value.endsWith("rem")) {
71
+ const rootFontSize = parseFloat(window.getComputedStyle(document.documentElement).fontSize);
72
+ return parseFloat(value) * rootFontSize;
73
+ }
74
+ if (value.endsWith("vh")) {
75
+ return parseFloat(value) / 100 * window.innerHeight;
76
+ }
77
+ if (value.endsWith("vw")) {
78
+ return parseFloat(value) / 100 * window.innerWidth;
79
+ }
80
+ return parseFloat(value);
81
+ };
82
+ export {
83
+ computedRootStyle,
84
+ computedStickyStyle,
85
+ getRootRect,
86
+ getTarget,
87
+ unitToPx,
88
+ updateRoot
89
+ };
package/sticky/vue.js ADDED
@@ -0,0 +1,74 @@
1
+ import "../chunk-G2ADBYYC.js";
2
+ import { useRect } from "../common/deps/useRect";
3
+ import { useWindowSize } from "../common/deps/useWindowSize";
4
+ import { useEventListener } from "../common/deps/useEventListener";
5
+ import { useScrollParent } from "../common/deps/dom";
6
+ import { computedRootStyle, computedStickyStyle, updateRoot, unitToPx, getRootRect, getTarget } from "./index";
7
+ const api = ["state"];
8
+ const renderless = (props, hooks, { vm, emit }) => {
9
+ const { reactive, computed, unref, ref, toRef, onMounted, watch } = hooks;
10
+ const state = reactive({
11
+ root: null,
12
+ target: null,
13
+ windowHeight: 0,
14
+ windowWidth: 0,
15
+ rootHeight: 0,
16
+ rootWidth: 0,
17
+ rootTop: 0,
18
+ rootBottom: 0,
19
+ isFixed: false,
20
+ scrollTop: 0,
21
+ transform: 0,
22
+ scrollParent: null,
23
+ targetRect: null,
24
+ offset: 0,
25
+ rootStyle: computed(() => api2.computedRootStyle()),
26
+ stickyStyle: computed(() => api2.computedStickyStyle())
27
+ });
28
+ const api2 = {};
29
+ Object.assign(api2, {
30
+ state,
31
+ computedRootStyle: computedRootStyle({ props, state }),
32
+ computedStickyStyle: computedStickyStyle({ props, state }),
33
+ updateRoot: updateRoot({ props, state, emit, api: api2 }),
34
+ getRootRect: getRootRect({ vm, state, api: api2 }),
35
+ getTarget: getTarget({ props, state, api: api2 }),
36
+ useEventListener: useEventListener(hooks),
37
+ useScrollParent: useScrollParent(hooks),
38
+ useWindowSize: useWindowSize(ref),
39
+ useRect: useRect(unref),
40
+ unitToPx: unitToPx()
41
+ });
42
+ watch(
43
+ () => state.isFixed,
44
+ (value) => {
45
+ emit("change", value);
46
+ }
47
+ );
48
+ watch(
49
+ () => props.offset,
50
+ (value) => {
51
+ state.offset = api2.unitToPx(value);
52
+ api2.updateRoot();
53
+ },
54
+ { immediate: true }
55
+ );
56
+ const { width, height } = api2.useWindowSize();
57
+ state.windowHeight = height;
58
+ state.windowWidth = width;
59
+ state.scrollParent = api2.useScrollParent(toRef(state, "root"));
60
+ api2.useEventListener("scroll", api2.updateRoot, { target: toRef(state, "scrollParent"), passive: true });
61
+ onMounted(() => {
62
+ state.root = vm.$refs.root;
63
+ setTimeout(() => {
64
+ api2.getTarget();
65
+ api2.getRootRect();
66
+ api2.updateRoot();
67
+ });
68
+ });
69
+ return api2;
70
+ };
71
+ export {
72
+ api,
73
+ renderless
74
+ };
@@ -1,6 +1,10 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
- const renderless = (props, { inject, onBeforeUnmount, reactive, toRef, markRaw }, { slots, vm }) => {
2
+ import { useRelation as createUseRelation } from "../common/deps/useRelation";
3
+ const renderless = (props, hooks, { slots, vm }) => {
4
+ const { inject, onBeforeUnmount, reactive, toRef, markRaw } = hooks;
3
5
  const tabs = inject("tabs", null);
6
+ const tabsId = inject("tabsId", null);
7
+ const useRelation = createUseRelation(hooks);
4
8
  const { lazy } = props;
5
9
  const item = reactive({
6
10
  title: toRef(props, "title"),
@@ -15,6 +19,7 @@ const renderless = (props, { inject, onBeforeUnmount, reactive, toRef, markRaw }
15
19
  item.selected = (tabs.activeName || tabs.modelValue) === item.name;
16
20
  tabs.addItem(item);
17
21
  onBeforeUnmount(() => tabs.removeItem(item.name, true));
22
+ useRelation({ relationKey: `tabs-${tabsId}` });
18
23
  return {};
19
24
  };
20
25
  export {