@opentiny/vue-renderless 3.17.5 → 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 (151) 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 +2 -3
  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/tree-menu.type.d.ts +4 -1
  142. package/types/upload-dragger.type.d.ts +1 -1
  143. package/types/{upload-list.type-023fd6e9.d.ts → upload-list.type-26173587.d.ts} +14 -0
  144. package/types/upload-list.type.d.ts +1 -1
  145. package/types/upload.type.d.ts +1 -1
  146. package/upload-list/vue.js +7 -7
  147. package/virtual-scroll-box/index.js +294 -0
  148. package/virtual-scroll-box/vue.js +43 -0
  149. package/virtual-tree/index.js +168 -0
  150. package/virtual-tree/vue.js +53 -0
  151. package/LICENSE +0 -22
package/README.md CHANGED
@@ -1,7 +1,16 @@
1
1
  # @opentiny/vue-renderless
2
2
 
3
- This is for TINY's own internal use only, currently as a dependency for @opentiny/vue.
3
+ Provides a rendering-free logic layer for the `TinyVue` component.
4
4
 
5
- It can also be used as a renderless functions for implementing a custom UI component.
5
+ ## You can customize the global configuration of some components
6
6
 
7
- For all instructions, please check out the home page: [https://open.codehub.huawei.com/innersource/originjs/tiny/opentiny-vue/home](https://open.codehub.huawei.com/innersource/originjs/tiny/opentiny-vue/home)
7
+ ### Modify the popup window starting level (z-index)
8
+
9
+ Add the following code to the entry file `main.js`:
10
+
11
+ ```js
12
+ import PopupManager from '@opentiny/vue-renderless/common/deps/popup-manager'
13
+
14
+ // Set the starting level to 3000
15
+ PopupManager.zIndex = 3000
16
+ ```
@@ -9,14 +9,14 @@ const computedMaxShowNum = ({ props, state }) => () => {
9
9
  return 2;
10
10
  }
11
11
  };
12
- const computedSpacing = ({ props, state }) => () => {
12
+ const computedSpacing = ({ props, state, designConfig }) => () => {
13
13
  if (props.spacing !== void 0) {
14
14
  return String(props.spacing).includes("px") ? props.spacing : props.spacing + "px";
15
15
  }
16
16
  if (state.isCardMode) {
17
17
  return "10px";
18
18
  } else {
19
- return "5px";
19
+ return (designConfig == null ? void 0 : designConfig.props.spacing) || "8px";
20
20
  }
21
21
  };
22
22
  const computedMoreText = ({ props, state, t }) => () => {
@@ -9,7 +9,7 @@ import {
9
9
  computedSuffixIcon
10
10
  } from "./index";
11
11
  const api = ["state", "handleMoreClick", "handleItemClick", "visibleChange"];
12
- const renderless = (props, { computed, reactive }, { emit, t }) => {
12
+ const renderless = (props, { computed, reactive }, { emit, t, designConfig }) => {
13
13
  const api2 = {};
14
14
  const state = reactive({
15
15
  visibleOptions: computed(() => props.options.slice(0, state.maxShowNum)),
@@ -26,7 +26,7 @@ const renderless = (props, { computed, reactive }, { emit, t }) => {
26
26
  handleItemClick: handleItemClick(emit),
27
27
  visibleChange: visibleChange(emit),
28
28
  computedMaxShowNum: computedMaxShowNum({ props, state }),
29
- computedSpacing: computedSpacing({ props, state }),
29
+ computedSpacing: computedSpacing({ props, state, designConfig }),
30
30
  computedMoreText: computedMoreText({ props, state, t }),
31
31
  computedSuffixIcon: computedSuffixIcon({ props, state })
32
32
  });
package/anchor/index.js CHANGED
@@ -87,11 +87,14 @@ const handleScroll = (state) => () => {
87
87
  state.scrollTimer = window.setTimeout(() => {
88
88
  state.isScroll = false;
89
89
  clearTimeout(state.scrollTimer);
90
- }, 2e3);
90
+ }, 200);
91
91
  };
92
92
  const setChildOffsetTop = ({ state, props }) => {
93
- var _a;
94
- state.offsetTop = ((_a = document.querySelector(props.links[0].link)) == null ? void 0 : _a.offsetTop) || 0;
93
+ var _a, _b;
94
+ if (!((_a = props.links) == null ? void 0 : _a.length)) {
95
+ return;
96
+ }
97
+ state.offsetTop = ((_b = document.querySelector(props.links[0].link)) == null ? void 0 : _b.offsetTop) || 0;
95
98
  };
96
99
  const getContainer = ({ props }) => () => props.containerId && document.querySelector(props.containerId) || document.body;
97
100
  const mounted = ({ state, api, props, nextTick }) => () => {
@@ -131,6 +134,10 @@ const onItersectionObserver = ({ state, props, api, vm, emit }) => () => {
131
134
  updateSkidPosition({ vm, state, emit });
132
135
  return;
133
136
  }
137
+ if (state.isScroll) {
138
+ api.handleScroll();
139
+ return;
140
+ }
134
141
  for (let key in state.observerLinks) {
135
142
  if (Object.prototype.hasOwnProperty.call(state.observerLinks, key)) {
136
143
  const item = state.observerLinks[key];
@@ -146,7 +153,7 @@ const onItersectionObserver = ({ state, props, api, vm, emit }) => () => {
146
153
  }
147
154
  }
148
155
  },
149
- { root: scrollContainer, threshold: [0] }
156
+ { root: scrollContainer, threshold: [0, 0.25, 0.5, 1] }
150
157
  );
151
158
  addObserver({ props, state });
152
159
  };
@@ -1,4 +1,5 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
+ import { FORM_ITEM, FORM_EVENT } from "../common/form/const";
2
3
  const getData = ({
3
4
  props,
4
5
  state,
@@ -28,11 +29,15 @@ const handleChange = ({
28
29
  api,
29
30
  emit,
30
31
  state,
31
- props
32
+ props,
33
+ dispatch
32
34
  }) => (value) => {
33
35
  state.activated = true;
34
36
  emit("update:modelValue", value);
35
37
  state.suggestionDisabled = false;
38
+ if (state.validateEvent) {
39
+ dispatch(FORM_ITEM, FORM_EVENT.change, [value]);
40
+ }
36
41
  if (!props.triggerOnFocus && !value) {
37
42
  state.suggestionDisabled = true;
38
43
  state.suggestions = [];
@@ -55,9 +60,12 @@ const handleFocus = ({
55
60
  api.debouncedGetData(props.modelValue);
56
61
  }
57
62
  };
58
- const handleBlur = ({ emit, state }) => (event) => {
63
+ const handleBlur = ({ emit, state, dispatch, props }) => () => {
59
64
  state.suggestionDisabled = true;
60
- emit("blur", event);
65
+ emit("blur");
66
+ if (state.validateEvent) {
67
+ dispatch(FORM_ITEM, FORM_EVENT.blur, [props.modelValue]);
68
+ }
61
69
  };
62
70
  const handleClear = ({ emit, state }) => () => {
63
71
  state.activated = false;
@@ -91,21 +99,22 @@ const select = ({
91
99
  emit,
92
100
  nextTick,
93
101
  props,
94
- state
102
+ state,
103
+ dispatch
95
104
  }) => (item) => {
96
- emit("update:modelValue", item[props.valueKey]);
105
+ const value = item[props.valueKey];
106
+ emit("update:modelValue", value);
97
107
  emit("select", item);
108
+ if (state.validateEvent) {
109
+ dispatch(FORM_ITEM, FORM_EVENT.change, [value]);
110
+ }
98
111
  nextTick(() => {
99
112
  state.activated = false;
100
113
  state.suggestions = [];
101
114
  state.highlightedIndex = -1;
102
115
  });
103
116
  };
104
- const highlight = ({
105
- constants,
106
- vm,
107
- state
108
- }) => (index) => {
117
+ const highlight = ({ constants, vm, state }) => (index) => {
109
118
  if (!state.suggestionVisible || state.loading) {
110
119
  return;
111
120
  }
@@ -136,10 +145,7 @@ const computedVisible = (state) => {
136
145
  let isValidData = Array.isArray(suggestions) && suggestions.length > 0;
137
146
  return (isValidData || state.loading) && state.activated;
138
147
  };
139
- const watchVisible = ({
140
- suggestionState,
141
- vm
142
- }) => (val) => {
148
+ const watchVisible = ({ suggestionState, vm }) => (val) => {
143
149
  let $input = vm.$refs.input.getInput();
144
150
  if ($input) {
145
151
  suggestionState.dropdownWidth = $input.offsetWidth + "px";
@@ -19,7 +19,6 @@ import {
19
19
  } from "./index";
20
20
  const api = [
21
21
  "state",
22
- "select",
23
22
  "suggestionState",
24
23
  "getInput",
25
24
  "handleChange",
@@ -37,8 +36,10 @@ const initState = ({
37
36
  reactive,
38
37
  $prefix,
39
38
  computed,
39
+ props,
40
40
  inject
41
41
  }) => {
42
+ var _a;
42
43
  const state = reactive({
43
44
  showAutoWidth: inject("showAutoWidth", null),
44
45
  popperElm: null,
@@ -48,7 +49,9 @@ const initState = ({
48
49
  highlightedIndex: -1,
49
50
  suggestionDisabled: false,
50
51
  id: $prefix + "-" + guid(),
51
- suggestionVisible: computed(() => computedVisible(state))
52
+ suggestionVisible: computed(() => computedVisible(state)),
53
+ // props.validateEvent优先级大于inject,都没有配置默认为true
54
+ validateEvent: (_a = props.validateEvent) != null ? _a : inject("validateEvent", true)
52
55
  });
53
56
  return state;
54
57
  };
@@ -67,7 +70,19 @@ const initSuggestionState = ({
67
70
  referenceElm
68
71
  });
69
72
  };
70
- const initApi = ({ api: api2, state, doDestroy, suggestionState, emit, vm, props, updatePopper, nextTick, constants }) => {
73
+ const initApi = ({
74
+ api: api2,
75
+ state,
76
+ doDestroy,
77
+ suggestionState,
78
+ emit,
79
+ vm,
80
+ props,
81
+ updatePopper,
82
+ nextTick,
83
+ constants,
84
+ dispatch
85
+ }) => {
71
86
  api2.getData = getData({ props, state, updatePopper, nextTick });
72
87
  Object.assign(api2, {
73
88
  state,
@@ -75,13 +90,13 @@ const initApi = ({ api: api2, state, doDestroy, suggestionState, emit, vm, props
75
90
  suggestionState,
76
91
  close: close(state),
77
92
  open: open(api2),
78
- handleBlur: handleBlur({ emit, state }),
93
+ handleBlur: handleBlur({ emit, state, dispatch, props }),
79
94
  mounted: mounted({ vm, state, suggestionState }),
80
95
  highlight: highlight({ constants, vm, state }),
81
96
  handleClear: handleClear({ emit, state }),
82
- select: select({ emit, nextTick, props, state }),
97
+ select: select({ emit, nextTick, props, state, dispatch }),
83
98
  watchVisible: watchVisible({ suggestionState, vm }),
84
- handleChange: handleChange({ api: api2, emit, state, props }),
99
+ handleChange: handleChange({ api: api2, emit, state, props, dispatch }),
85
100
  handleFocus: handleFocus({ api: api2, emit, props, state }),
86
101
  handleKeyEnter: handleKeyEnter({ api: api2, emit, nextTick, props, state }),
87
102
  debouncedGetData: debounce(props.debounce, api2.getData)
@@ -96,9 +111,9 @@ const renderless = (props, {
96
111
  toRefs,
97
112
  onDeactivated,
98
113
  inject
99
- }, { $prefix, vm, parent, emit, constants, nextTick, slots }) => {
114
+ }, { $prefix, vm, parent, emit, constants, nextTick, slots, dispatch }) => {
100
115
  const api2 = {};
101
- const state = initState({ reactive, $prefix, computed, inject });
116
+ const state = initState({ reactive, $prefix, computed, props, inject });
102
117
  const { showPopper, popperElm, referenceElm, doDestroy, updatePopper } = userPopper({
103
118
  reactive,
104
119
  watch,
@@ -112,7 +127,19 @@ const renderless = (props, {
112
127
  onDeactivated
113
128
  });
114
129
  const suggestionState = initSuggestionState({ reactive, parent, showPopper, popperElm, referenceElm });
115
- initApi({ api: api2, state, doDestroy, suggestionState, emit, vm, props, updatePopper, nextTick, constants });
130
+ initApi({
131
+ api: api2,
132
+ state,
133
+ doDestroy,
134
+ suggestionState,
135
+ emit,
136
+ vm,
137
+ props,
138
+ updatePopper,
139
+ nextTick,
140
+ constants,
141
+ dispatch
142
+ });
116
143
  watch(() => state.suggestionVisible, api2.watchVisible);
117
144
  onMounted(api2.mounted);
118
145
  return api2;
package/badge/index.js CHANGED
@@ -1,10 +1,11 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
- const computedContent = ({ props, state }) => () => typeof state.valueRef === "number" && typeof props.max === "number" ? props.max < state.valueRef ? `${props.max}+` : state.valueRef : state.valueRef;
2
+ const computedContent = ({ props, state }) => () => (typeof props.value === "number" || typeof props.value === "string") && typeof props.max === "number" ? props.max < Number(state.valueRef) ? `${props.max}+` : state.valueRef : state.valueRef;
3
3
  const computedValueRef = ({ props }) => () => {
4
- if (typeof props.value === "number") {
4
+ if (typeof props.value === "number" || typeof props.value === "string") {
5
5
  return props.value;
6
+ } else {
7
+ return void 0;
6
8
  }
7
- return typeof props.modelValue === "number" ? props.modelValue : void 0;
8
9
  };
9
10
  const computedTransform = ({ designConfig, props }) => () => {
10
11
  if ((designConfig == null ? void 0 : designConfig.transform) === "unset") {
@@ -420,7 +420,7 @@ const resetInputHeight = ({ constants, nextTick, props, vm, state, api, designCo
420
420
  if (!state.isDisplayOnly && (props.hoverExpand || props.clickExpand) && !props.disabled) {
421
421
  api.calcCollapseTags();
422
422
  }
423
- const sizeInMap = (designConfig == null ? void 0 : designConfig.state.initialInputHeight) || state.initialInputHeight || (state.isSaaSTheme ? 28 : 30);
423
+ const sizeInMap = (designConfig == null ? void 0 : designConfig.state.initialInputHeight) || state.initialInputHeight || 32;
424
424
  const noSelected = state.selected.length === 0;
425
425
  const spacingHeight = designConfig ? (_a = designConfig.state) == null ? void 0 : _a.spacingHeight : constants.SPACING_HEIGHT;
426
426
  if (!state.isDisplayOnly) {
@@ -1198,7 +1198,7 @@ const mounted = ({ api, parent, state, props, vm, designConfig }) => () => {
1198
1198
  document.activeElement.blur();
1199
1199
  }
1200
1200
  state.completed = true;
1201
- const defaultSizeMap = { default: 28, mini: 24, small: 32, medium: 40 };
1201
+ const defaultSizeMap = { default: 32, mini: 24, small: 36, medium: 40 };
1202
1202
  const sizeMap = ((_a = designConfig == null ? void 0 : designConfig.state) == null ? void 0 : _a.sizeMap) || defaultSizeMap;
1203
1203
  if (props.multiple && Array.isArray(props.modelValue) && props.modelValue.length > 0) {
1204
1204
  state.currentPlaceholder = "";
@@ -1249,7 +1249,7 @@ const optmzApis = {
1249
1249
  vm.$refs.scrollbar.$el.querySelectorAll(
1250
1250
  '.tiny-recycle-scroller__slot, .tiny-recycle-scroller__item-view:not([style*="transform: translateY(-9999px) translateX(0px)"])'
1251
1251
  )
1252
- ).map((item) => item.querySelector(`[data-tag="tiny-select-dropdown-item"]:not(${querySelectKey})`)).filter((v) => v);
1252
+ ).map((item) => item.querySelector(`[data-tag="tiny-option"]:not(${querySelectKey})`)).filter((v) => v);
1253
1253
  },
1254
1254
  setScrollTop: ({ refs, state }) => {
1255
1255
  const { optimizeStore } = state;
@@ -1,14 +1,13 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
2
  import { linkClick } from "./index";
3
3
  const api = ["linkClick", "state"];
4
- const renderless = (props, { reactive, inject }, { designConfig }, { refs, router, emit }) => {
4
+ const renderless = (props, { reactive, inject, computed }, { refs, router, emit, designConfig }) => {
5
5
  const breadcrumbEmitter = inject("breadcrumbEmitter");
6
6
  const breadcrumb = inject("breadcrumb");
7
7
  const constants = breadcrumb._constants;
8
- const separator = breadcrumb.separator || (designConfig == null ? void 0 : designConfig.separator) || ">";
9
8
  const state = reactive({
10
9
  size: inject("size", null),
11
- separator
10
+ separator: computed(() => breadcrumb.separator || (designConfig == null ? void 0 : designConfig.separator) || "/")
12
11
  });
13
12
  const api2 = {
14
13
  state,
@@ -23,7 +23,12 @@ const getItemClass = ({ props, state }) => (node) => {
23
23
  if (state.disabled || node.disabled) {
24
24
  return { disabled: true };
25
25
  }
26
- return props.plain ? { plain: props.plain } : {};
26
+ return props.plain ? {
27
+ plain: props.plain,
28
+ medium: props.size === "medium",
29
+ small: props.size === "small",
30
+ mini: props.size === "mini"
31
+ } : {};
27
32
  };
28
33
  export {
29
34
  getItemClass,
@@ -46,7 +46,7 @@ const translateItem = ({ api, CARD_SCALE, parent, state, carouselParent }) => ({
46
46
  } else {
47
47
  state.active = index === activeIndex;
48
48
  if (length === 2 && !state.active) {
49
- state.translate = vnode.type === TYPE_VERTICAL ? -parentHeight : -parentWidth;
49
+ state.translate = vnode.type === TYPE_VERTICAL ? parentHeight : parentWidth;
50
50
  } else {
51
51
  state.translate = vnode.type === TYPE_VERTICAL ? parentHeight * (index - activeIndex) : parentWidth * (index - activeIndex);
52
52
  }
package/checkbox/index.js CHANGED
@@ -111,7 +111,7 @@ const computedIsGroupDisplayOnly = ({ state }) => () => state.isGroup && (state.
111
111
  const computedDisplayLabel = ({ state, props, t }) => () => {
112
112
  state.showLabel = true;
113
113
  if (props.trueLabel !== void 0 && props.falseLabel !== void 0) {
114
- return props.modelValue ? String(props.trueLabel) : String(props.falseLabel);
114
+ return props.modelValue;
115
115
  } else {
116
116
  return props.modelValue ? t("yes") : t("no");
117
117
  }
@@ -23,6 +23,11 @@ const handleHeaderClick = ({
23
23
  state.focusing = false;
24
24
  state.isClick = true;
25
25
  };
26
+ const handleHeaderContainerClick = ({ api }) => (e) => {
27
+ if (e.target === e.currentTarget) {
28
+ api.handleHeaderClick();
29
+ }
30
+ };
26
31
  const handleEnterClick = ({
27
32
  componentName,
28
33
  dispatch,
@@ -32,5 +37,6 @@ const handleEnterClick = ({
32
37
  export {
33
38
  handleEnterClick,
34
39
  handleFocus,
35
- handleHeaderClick
40
+ handleHeaderClick,
41
+ handleHeaderContainerClick
36
42
  };
@@ -1,7 +1,14 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
- import { handleFocus, handleEnterClick, handleHeaderClick } from "./index";
2
+ import { handleFocus, handleEnterClick, handleHeaderClick, handleHeaderContainerClick } from "./index";
3
3
  import { guid } from "../common/string";
4
- const api = ["state", "isActive", "handleFocus", "handleEnterClick", "handleHeaderClick"];
4
+ const api = [
5
+ "state",
6
+ "isActive",
7
+ "handleFocus",
8
+ "handleEnterClick",
9
+ "handleHeaderClick",
10
+ "handleHeaderContainerClick"
11
+ ];
5
12
  const renderless = (props, { computed, reactive }, { parent, constants, dispatch, designConfig }) => {
6
13
  var _a;
7
14
  const _constants = parent.collapse._constants;
@@ -22,6 +29,9 @@ const renderless = (props, { computed, reactive }, { parent, constants, dispatch
22
29
  handleEnterClick: handleEnterClick({ componentName, dispatch, eventName, parent }),
23
30
  handleHeaderClick: handleHeaderClick({ componentName, dispatch, eventName, props, parent, state })
24
31
  };
32
+ Object.assign(api2, {
33
+ handleHeaderContainerClick: handleHeaderContainerClick({ api: api2 })
34
+ });
25
35
  return api2;
26
36
  };
27
37
  export {
@@ -1,42 +1,30 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
- const onCancel = (tmpColor, triggerBg, isShow, pre, emit) => {
3
- return (color) => {
4
- tmpColor.reset(color.value.getHex());
5
- triggerBg.value = pre.value;
6
- isShow.value = false;
7
- emit("cancel");
8
- };
2
+ const updateModelValue = (val, emit) => {
3
+ emit("update:modelValue", val);
9
4
  };
10
- const onConfirm = (triggerBg, pre, hex, isShow, emit) => {
11
- return (color) => {
12
- pre.value = triggerBg.value;
13
- triggerBg.value = color;
14
- hex.value = color;
15
- isShow.value = false;
16
- emit("confirm", color);
5
+ const toggleVisible = (isShow) => {
6
+ return (val) => {
7
+ isShow.value = val;
17
8
  };
18
9
  };
19
- const onHueUpdate = (tmpColor, triggerBg) => {
20
- return (h) => {
21
- triggerBg.value = tmpColor.getHex();
22
- tmpColor.set({ h });
10
+ const useEvent = (hex, emit, changeVisible) => {
11
+ const onConfirm = (val) => {
12
+ hex.value = val;
13
+ updateModelValue(val, emit);
14
+ emit("confirm", val);
15
+ changeVisible(false);
23
16
  };
24
- };
25
- const onSVUpdate = (tmpColor, triggerBg) => {
26
- return ({ s, v }) => {
27
- triggerBg.value = tmpColor.getHex();
28
- tmpColor.set({ s, v });
17
+ const onCancel = (color) => {
18
+ hex.value = color.value.hex;
19
+ changeVisible(false);
20
+ emit("cancel");
29
21
  };
30
- };
31
- const onColorUpdate = (triggerBg) => {
32
- return (color) => {
33
- triggerBg.value = color.value.getHex();
22
+ return {
23
+ onConfirm,
24
+ onCancel
34
25
  };
35
26
  };
36
27
  export {
37
- onCancel,
38
- onColorUpdate,
39
- onConfirm,
40
- onHueUpdate,
41
- onSVUpdate
28
+ toggleVisible,
29
+ useEvent
42
30
  };
@@ -1,72 +1,49 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
- import Color from "./utils/color";
3
- import { onConfirm, onCancel, onHueUpdate, onSVUpdate, onColorUpdate } from "./index";
4
- const api = [
5
- "state",
6
- "changeVisible",
7
- "cursor",
8
- "onColorUpdate",
9
- "onHueUpdate",
10
- "onSVUpdate",
11
- "onConfirm",
12
- "onCancel",
13
- "onAlphaUpdate",
14
- "alpha"
15
- ];
16
- const renderless = (props, context, { emit }) => {
17
- var _a, _b, _c, _d, _e, _f, _g;
18
- const { modelValue, visible, predefine, size, history } = context.toRefs(props);
19
- const pre = context.ref((_a = modelValue.value) != null ? _a : "transparent");
20
- const triggerBg = context.ref((_b = pre.value) != null ? _b : "transparent");
21
- const tmpColor = new Color((_c = triggerBg.value) != null ? _c : "transparent");
22
- const hex = context.ref((_d = modelValue.value) != null ? _d : "transparent");
23
- const isShow = context.ref((_e = visible == null ? void 0 : visible.value) != null ? _e : false);
24
- const changeVisible = (state2) => {
25
- isShow.value = state2;
26
- };
27
- const stack = context.ref([...(_f = history == null ? void 0 : history.value) != null ? _f : []]);
28
- const predefineStack = context.ref([...(_g = predefine == null ? void 0 : predefine.value) != null ? _g : []]);
29
- const state = context.reactive({
30
- isShow,
31
- hex,
32
- triggerBg,
33
- defaultValue: modelValue,
34
- stack,
35
- predefineStack,
36
- size: size != null ? size : ""
37
- });
38
- const api2 = {
39
- state,
40
- changeVisible,
41
- onCancel: onCancel(tmpColor, triggerBg, isShow, pre, emit),
42
- onConfirm: onConfirm(triggerBg, pre, hex, isShow, emit),
43
- onHueUpdate: onHueUpdate(tmpColor, triggerBg),
44
- onSVUpdate: onSVUpdate(tmpColor, triggerBg),
45
- onColorUpdate: onColorUpdate(triggerBg)
46
- };
47
- context.watch(
2
+ import { toggleVisible, useEvent } from "./index";
3
+ const api = ["state", "changeVisible", "onConfirm", "onCancel", "onHueUpdate", "onSVUpdate", "onColorUpdate"];
4
+ const renderless = (props, ctx, { emit }) => {
5
+ var _a, _b, _c;
6
+ const { modelValue, visible, predefine, size, history } = ctx.toRefs(props);
7
+ const isShow = ctx.ref(visible.value);
8
+ const hex = ctx.ref((_a = modelValue.value) != null ? _a : "transparent");
9
+ const stack = ctx.ref([...(_b = history == null ? void 0 : history.value) != null ? _b : []]);
10
+ const predefineStack = ctx.ref([...(_c = predefine == null ? void 0 : predefine.value) != null ? _c : []]);
11
+ ctx.watch(
48
12
  predefine,
49
13
  (newPredefine) => {
50
14
  predefineStack.value = [...newPredefine];
51
15
  },
52
16
  { deep: true }
53
17
  );
54
- context.watch(
18
+ ctx.watch(
55
19
  history,
56
20
  (newHistory) => {
57
21
  stack.value = [...newHistory];
58
22
  },
59
23
  { deep: true }
60
24
  );
61
- context.watch(modelValue, (newValue) => {
62
- pre.value = newValue;
63
- hex.value = newValue;
64
- state.hex = newValue;
65
- state.triggerBg = newValue;
25
+ const state = ctx.reactive({
26
+ isShow,
27
+ hex,
28
+ triggerBg: ctx.ref(modelValue.value),
29
+ size,
30
+ stack,
31
+ predefineStack
32
+ });
33
+ ctx.watch(props, () => {
34
+ hex.value = props.modelValue;
66
35
  });
67
- context.watch(visible, (visible2) => {
68
- isShow.value = visible2;
36
+ ctx.watch(hex, () => {
37
+ emit("update:modelValue", hex.value);
69
38
  });
39
+ const changeVisible = toggleVisible(isShow);
40
+ const { onConfirm, onCancel } = useEvent(hex, emit, changeVisible);
41
+ const api2 = {
42
+ state,
43
+ changeVisible,
44
+ onConfirm,
45
+ onCancel
46
+ };
70
47
  return api2;
71
48
  };
72
49
  export {
@@ -20,6 +20,7 @@ const onConfirm = (hex, pre, res, emit, stack, enableHistory, color) => {
20
20
  }
21
21
  color.value.setPrevH(color.value.get("h"));
22
22
  emit("confirm", res.value);
23
+ emit("update:modelValue", res.value);
23
24
  };
24
25
  };
25
26
  const onCancel = (res, pre, emit, isShow, hex, color) => {
@@ -33,31 +34,33 @@ const onCancel = (res, pre, emit, isShow, hex, color) => {
33
34
  }));
34
35
  emit("cancel", color);
35
36
  }
37
+ emit("update:modelValue", hex.value);
36
38
  };
37
39
  };
38
- const onColorUpdate = (color, res) => {
40
+ const onColorUpdate = (color, res, emit) => {
39
41
  res.value = color.value.getHex();
42
+ emit("update:modelValue", res.value);
40
43
  };
41
44
  const onHSVUpdate = (color, res, hex, emit) => {
42
45
  return {
43
46
  onHueUpdate: (hue) => {
44
47
  color.value.set({ h: hue });
45
- onColorUpdate(color, res);
48
+ onColorUpdate(color, res, emit);
46
49
  hex.value = color.value.getHex();
47
50
  emit("hue-update", hue);
48
51
  },
49
52
  onSVUpdate: ({ s, v }) => {
50
53
  hex.value = color.value.getHex();
51
- onColorUpdate(color, res);
54
+ onColorUpdate(color, res, emit);
52
55
  emit("sv-update", { s, v });
53
56
  }
54
57
  };
55
58
  };
56
- const onAlphaUpdate = (color, res) => {
59
+ const onAlphaUpdate = (color, res, emit) => {
57
60
  return {
58
61
  update: (alpha) => {
59
62
  color.value.set({ a: alpha });
60
- onColorUpdate(color, res);
63
+ onColorUpdate(color, res, emit);
61
64
  }
62
65
  };
63
66
  };
@@ -58,7 +58,6 @@ const renderless = (props, context, { emit }) => {
58
58
  { deep: true }
59
59
  );
60
60
  context.watch(modelValue, (newValue) => {
61
- pre.value = res.value;
62
61
  hex.value = newValue;
63
62
  res.value = newValue;
64
63
  color.value.reset(newValue);
@@ -68,7 +67,7 @@ const renderless = (props, context, { emit }) => {
68
67
  isShow.value = visible2;
69
68
  });
70
69
  const { onHueUpdate, onSVUpdate } = onHSVUpdate(color, res, hex, emit);
71
- const { update } = onAlphaUpdate(color, res);
70
+ const { update } = onAlphaUpdate(color, res, emit);
72
71
  const api2 = {
73
72
  state,
74
73
  changeVisible,