@opentiny/vue-renderless 3.19.4 → 3.20.0

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 (79) hide show
  1. package/base-select/index.js +11 -74
  2. package/base-select/vue.js +10 -10
  3. package/bulletin-board/index.js +5 -1
  4. package/bulletin-board/vue.js +5 -4
  5. package/button/index.js +11 -3
  6. package/button/vue.js +6 -2
  7. package/button-group/index.js +1 -1
  8. package/color-picker/index.js +4 -4
  9. package/color-picker/utils/color.js +358 -83
  10. package/color-picker/utils/hsv-to-rgb.js +59 -0
  11. package/color-picker/vue.js +27 -8
  12. package/color-select-panel/alpha-select/index.js +65 -14
  13. package/color-select-panel/alpha-select/vue.js +29 -44
  14. package/color-select-panel/hue-select/index.js +47 -61
  15. package/color-select-panel/hue-select/vue.js +29 -47
  16. package/color-select-panel/index.js +230 -80
  17. package/color-select-panel/sv-select/index.js +68 -0
  18. package/color-select-panel/sv-select/vue.js +32 -0
  19. package/color-select-panel/utils/color.js +345 -82
  20. package/color-select-panel/utils/getClientXY.js +54 -0
  21. package/color-select-panel/vue.js +48 -72
  22. package/common/deps/popper.js +1 -1
  23. package/common/deps/useUserAgent.js +16 -0
  24. package/common/event.js +21 -0
  25. package/common/index.js +1 -1
  26. package/common/runtime.js +1 -1
  27. package/date-picker-mobile/index.js +4 -4
  28. package/dialog-box/index.js +1 -1
  29. package/dropdown/index.js +5 -1
  30. package/dropdown/vue.js +2 -2
  31. package/file-upload/vue.js +1 -0
  32. package/flowchart/index.js +3 -2
  33. package/form/index.js +2 -2
  34. package/form-item/index.js +4 -1
  35. package/grid-select/index.js +82 -0
  36. package/grid-select/vue.js +30 -0
  37. package/input/index.js +2 -2
  38. package/menu/vue.js +5 -1
  39. package/modal/index.js +2 -0
  40. package/numeric/index.js +29 -9
  41. package/option/index.js +6 -0
  42. package/option/vue.js +12 -2
  43. package/package.json +1 -1
  44. package/picker/index.js +1 -1
  45. package/recycle-scroller/index.js +43 -27
  46. package/recycle-scroller/vue.js +9 -4
  47. package/rich-text/index.js +13 -0
  48. package/rich-text/vue.js +4 -2
  49. package/select/index.js +71 -23
  50. package/select/vue.js +12 -4
  51. package/select-dropdown/vue.js +1 -1
  52. package/tabbar/index.js +4 -1
  53. package/tabbar/vue.js +1 -1
  54. package/tabs/index.js +8 -5
  55. package/tabs/vue.js +4 -1
  56. package/time-panel/vue.js +1 -1
  57. package/tooltip/vue.js +1 -0
  58. package/transfer/index.js +4 -2
  59. package/transfer/vue.js +2 -2
  60. package/tree-menu/index.js +5 -1
  61. package/tree-node/index.js +5 -4
  62. package/tree-select/index.js +77 -1
  63. package/tree-select/vue.js +21 -7
  64. package/types/button.type.d.ts +7 -3
  65. package/types/color-select-panel.type.d.ts +23 -1
  66. package/types/file-upload.type.d.ts +1 -1
  67. package/types/input.type.d.ts +1 -1
  68. package/types/numeric.type.d.ts +5 -5
  69. package/types/popover.type.d.ts +1 -1
  70. package/types/transfer.type.d.ts +4 -4
  71. package/types/tree-menu.type.d.ts +1 -1
  72. package/types/upload-dragger.type.d.ts +1 -1
  73. package/types/{upload-list.type-8d9e2600.d.ts → upload-list.type-1257e07a.d.ts} +7 -3
  74. package/types/upload-list.type.d.ts +1 -1
  75. package/types/upload.type.d.ts +1 -1
  76. package/types/user-head.type.d.ts +4 -0
  77. package/user-head/index.js +1 -1
  78. package/year-table/index.js +14 -29
  79. package/year-table/vue.js +17 -5
package/common/event.js CHANGED
@@ -19,7 +19,28 @@ const getActualTarget = (e) => {
19
19
  }
20
20
  return e.target.shadowRoot && e.composed ? e.composedPath()[0] || e.target : e.target;
21
21
  };
22
+ const correctTarget = (event, target) => {
23
+ let newTarget;
24
+ if (event.target === null && target) {
25
+ newTarget = target;
26
+ } else {
27
+ const nodeList = event.composedPath();
28
+ if (event.target !== nodeList[0]) {
29
+ newTarget = nodeList[0];
30
+ }
31
+ }
32
+ if (newTarget) {
33
+ Object.defineProperty(event, "target", {
34
+ get() {
35
+ return newTarget;
36
+ },
37
+ enumerable: true,
38
+ configurable: true
39
+ });
40
+ }
41
+ };
22
42
  export {
43
+ correctTarget,
23
44
  emitEvent,
24
45
  getActualTarget
25
46
  };
package/common/index.js CHANGED
@@ -237,7 +237,7 @@ const CASCADER = {
237
237
  PropsHover: "hoverThreshold",
238
238
  MenuConnector: "cascader-menu-"
239
239
  };
240
- const version = "3.19.4";
240
+ const version = "3.20.0";
241
241
  const log = (data, type = "log") => {
242
242
  uLog.logger[type](data);
243
243
  };
package/common/runtime.js CHANGED
@@ -22,7 +22,7 @@ import vuePopup from "./deps/vue-popup";
22
22
  import validate from "./validate";
23
23
  import memorize from "./deps/memorize";
24
24
  import * as common from ".";
25
- const version = "3.19.4";
25
+ const version = "3.20.0";
26
26
  const Renderless = {
27
27
  browser,
28
28
  array,
@@ -46,7 +46,7 @@ const formatDate = ({ props, constants }) => (date, dateFormat) => {
46
46
  const getDateFromStr = (dateStr, direction = "top") => {
47
47
  const arr = dateStr.split("/").map((item) => +item);
48
48
  const yarr = arr[0];
49
- const month = direction == "top" ? arr[1] - 1 : arr[1];
49
+ const month = direction === "top" ? arr[1] - 1 : arr[1];
50
50
  return new Date(yarr, month, 1);
51
51
  };
52
52
  const loadingDate = ({ state, api }) => (direction) => {
@@ -67,11 +67,11 @@ const initPanel = ({ state, api }) => ({ dateValue, direction, isInit }) => {
67
67
  }
68
68
  let date = new Date(year, month - 1, 1);
69
69
  const dateList = {};
70
- Array.from({ length: 12 * state.yearNum }).map(() => {
70
+ Array.from({ length: 12 * state.yearNum }).forEach(() => {
71
71
  const startWeek = date.getDay();
72
72
  dateList[getDateStr(year, month)] = Array.from({ length: startWeek }).map(() => ({}));
73
73
  const days = getDaysByMonth(year, month);
74
- Array.from({ length: days }).map((v, index) => {
74
+ Array.from({ length: days }).forEach((v, index) => {
75
75
  const day = index + 1;
76
76
  const dayInfo = api.getCurrentDate(new Date(year, month - 1, day));
77
77
  dateList[getDateStr(year, month)].push(dayInfo);
@@ -194,8 +194,8 @@ const selectOption = ({ emit, state, props, constants }) => ({ value, index }) =
194
194
  }
195
195
  } else {
196
196
  state.date = new Date(current.value);
197
- emit("click", current);
198
197
  }
198
+ emit("click", current);
199
199
  };
200
200
  const confirm = ({ emit, state, props, api, constants }) => () => {
201
201
  const { DATE_TIME, DATE_RANGE, DATE_TIME_RANGE, YEAR_MONTH_RANGE } = constants.TYPE;
@@ -193,7 +193,7 @@ const handleDrag = ({
193
193
  emit,
194
194
  vm
195
195
  }) => (event) => {
196
- if (!props.draggable) {
196
+ if (!props.draggable || state.isFull) {
197
197
  return;
198
198
  }
199
199
  let modalBoxElem = vm.$refs.dialog;
package/dropdown/index.js CHANGED
@@ -178,7 +178,7 @@ const mounted = ({ api, vm, state, broadcast }) => () => {
178
178
  });
179
179
  vm.$on("is-disabled", api.clickOutside);
180
180
  };
181
- const beforeDistory = ({ api, state }) => () => {
181
+ const beforeDistory = ({ vm, api, state }) => () => {
182
182
  if (state.triggerElm) {
183
183
  off(state.triggerElm, "keydown", api.handleTriggerKeyDown);
184
184
  off(state.triggerElm, "focus", toggleFocus({ state, value: true }));
@@ -195,6 +195,10 @@ const beforeDistory = ({ api, state }) => () => {
195
195
  off(state.dropdownElm, "mouseleave", api.hide);
196
196
  state.dropdownElm = null;
197
197
  }
198
+ vm.$off("menu-item-click");
199
+ vm.$off("current-item-click");
200
+ vm.$off("selected-index");
201
+ vm.$off("is-disabled");
198
202
  };
199
203
  const clickOutside = ({ props, api }) => (disabled) => {
200
204
  if (props.hideOnClick) {
package/dropdown/vue.js CHANGED
@@ -59,8 +59,8 @@ const renderless = (props, { reactive, watch, provide, onMounted, computed }, {
59
59
  handleMainButtonClick: handleMainButtonClick({ api: api2, emit }),
60
60
  triggerElmFocus: triggerElmFocus(state),
61
61
  initDomOperation: initDomOperation({ api: api2, state, vm }),
62
- beforeDistory: beforeDistory({ api: api2, state }),
63
- clickOutside: clickOutside({ state, props, api: api2 })
62
+ beforeDistory: beforeDistory({ vm, api: api2, state }),
63
+ clickOutside: clickOutside({ props, api: api2 })
64
64
  });
65
65
  watch(() => state.visible, api2.watchVisible);
66
66
  watch(() => state.focusing, api2.watchFocusing);
@@ -327,6 +327,7 @@ const renderless = (props, { computed, inject, onBeforeUnmount, provide, reactiv
327
327
  onBeforeUnmount(() => {
328
328
  api2.onBeforeDestroy();
329
329
  api2 = {};
330
+ vm.$off("drag-over");
330
331
  });
331
332
  initWatch({ watch, state, api: api2, props, $service });
332
333
  return api2;
@@ -237,8 +237,9 @@ const drawAfterLink = ({ api, props, state, vm }) => () => {
237
237
  };
238
238
  const refresh = ({ api, nextTick, state }) => ({ graphWidth = 0, adjustX = 0 } = {}) => {
239
239
  api.removeListeners();
240
- if (graphWidth && graphWidth !== state.temporary.graphWidth) {
241
- state.temporary.graphWidth = graphWidth;
240
+ const graphWidthAdapt = graphWidth - 1 >= 0 ? graphWidth - 1 : 0;
241
+ if (graphWidth && graphWidthAdapt !== state.temporary.graphWidth) {
242
+ state.temporary.graphWidth = graphWidthAdapt;
242
243
  state.temporary.adjustX = adjustX;
243
244
  }
244
245
  if (api.isMf()) {
package/form/index.js CHANGED
@@ -21,8 +21,8 @@ const computedAutoLabelWidth = ({ state }) => () => {
21
21
  return max ? `${max}px` : "";
22
22
  };
23
23
  const computedHideRequiredAsterisk = ({ props, designConfig }) => () => {
24
- var _a, _b;
25
- return (_b = (_a = props.hideRequiredAsterisk) != null ? _a : designConfig == null ? void 0 : designConfig.hideRequiredAsterisk) != null ? _b : true;
24
+ var _a, _b, _c;
25
+ return (_c = (_b = props.hideRequiredAsterisk) != null ? _b : (_a = designConfig == null ? void 0 : designConfig.props) == null ? void 0 : _a.hideRequiredAsterisk) != null ? _c : false;
26
26
  };
27
27
  const computedValidateIcon = ({ props, designConfig }) => () => {
28
28
  var _a, _b, _c;
@@ -173,6 +173,7 @@ const mounted = ({ api, vm, props, state }) => () => {
173
173
  const unmounted = ({ api, vm, state }) => () => {
174
174
  state.canShowTip = false;
175
175
  api.dispatch("Form", "form:removeField", vm);
176
+ api.removeValidateEvents();
176
177
  };
177
178
  const validate = ({ api, props, state, t }) => (trigger, callback = () => void 0) => {
178
179
  state.validateDisabled = false;
@@ -281,7 +282,9 @@ const addValidateEvents = ({ api, vm, props, state }) => () => {
281
282
  }
282
283
  };
283
284
  const removeValidateEvents = (vm) => () => {
284
- vm.$off();
285
+ vm.$off("form.blur");
286
+ vm.$off("form.change");
287
+ vm.$off("displayed-value-changed");
285
288
  };
286
289
  const updateTip = ({ vm, state }) => () => {
287
290
  if (state.getValidateType !== "tip" && !state.canShowTip) {
@@ -0,0 +1,82 @@
1
+ import {
2
+ __spreadProps,
3
+ __spreadValues
4
+ } from "../chunk-G2ADBYYC.js";
5
+ const buildSelectConfig = ({ props, state }) => () => {
6
+ const checkRowKeys = state.gridCheckedData;
7
+ const selectConfig = props.selectConfig;
8
+ return Object.assign({}, selectConfig, { checkRowKeys });
9
+ };
10
+ const buildRadioConfig = ({ props, state }) => () => {
11
+ const checkRowKey = state.currentKey;
12
+ const highlight = true;
13
+ const radioConfig = props.radioConfig;
14
+ return Object.assign({}, radioConfig, { checkRowKey, highlight });
15
+ };
16
+ const filter = ({ props, state, vm }) => (value) => {
17
+ const { multiple, valueField, filterMethod, remote, remoteMethod } = props;
18
+ if ((props.filterable || props.searchable) && typeof filterMethod === "function") {
19
+ const table = vm.$refs.gridRef.$refs.tinyTable;
20
+ const fullData = table.afterFullData;
21
+ vm.$refs.gridRef.scrollTo(null, 0);
22
+ table.afterFullData = filterMethod(value, fullData) || [];
23
+ vm.$refs.gridRef.handleTableData(!value);
24
+ state.previousQuery = value;
25
+ } else if (remote && typeof remoteMethod === "function") {
26
+ state.previousQuery = value;
27
+ remoteMethod(value, props.extraQueryParams).then((data) => {
28
+ if (multiple) {
29
+ const selectedIds = state.selected.map((sel) => sel[valueField]);
30
+ vm.$refs.gridRef.clearSelection();
31
+ vm.$refs.gridRef.setSelection(
32
+ data.filter((row) => ~selectedIds.indexOf(row[valueField])),
33
+ true
34
+ );
35
+ state.remoteData = data.filter((row) => !~selectedIds.indexOf(row[valueField])).concat(state.selected);
36
+ } else {
37
+ vm.$refs.gridRef.clearRadioRow();
38
+ vm.$refs.gridRef.setRadioRow(find(data, (item) => props.modelValue === item[props.valueField]));
39
+ state.remoteData = data;
40
+ }
41
+ vm.$refs.gridRef.$refs.tinyTable.lastScrollTop = 0;
42
+ vm.$refs.gridRef.loadData(data);
43
+ vm.$refs.gridRef.handleTableData(!value);
44
+ });
45
+ }
46
+ };
47
+ const radioChange = ({ props, vm, emit }) => ({ row }) => {
48
+ if (!props.multiple) {
49
+ vm.$refs.baseSelectRef.updateSelectedData(__spreadProps(__spreadValues({}, row), {
50
+ currentLabel: row[props.textField],
51
+ value: row[props.valueField],
52
+ state: {
53
+ currentLabel: row[props.textField]
54
+ }
55
+ }));
56
+ vm.$refs.baseSelectRef.hidePanel();
57
+ emit("update:modelValue", row);
58
+ emit("change", row);
59
+ }
60
+ };
61
+ const selectChange = ({ props, vm, emit }) => ({ $table, selection, checked, row }) => {
62
+ if (props.multiple) {
63
+ vm.$refs.baseSelectRef.updateSelectedData(
64
+ selection.map((node) => {
65
+ return __spreadProps(__spreadValues({}, node), {
66
+ currentLabel: node[props.textField],
67
+ value: node[props.valueField],
68
+ isGrid: true
69
+ });
70
+ })
71
+ );
72
+ emit("update:modelValue", selection);
73
+ emit("change", selection);
74
+ }
75
+ };
76
+ export {
77
+ buildRadioConfig,
78
+ buildSelectConfig,
79
+ filter,
80
+ radioChange,
81
+ selectChange
82
+ };
@@ -0,0 +1,30 @@
1
+ import "../chunk-G2ADBYYC.js";
2
+ import { buildRadioConfig, buildSelectConfig, filter, radioChange, selectChange } from "./index";
3
+ const api = ["state", "buildRadioConfig", "buildSelectConfig", "filter", "radioChange", "selectChange"];
4
+ const renderless = (props, { reactive, watch }, { vm, emit }) => {
5
+ const api2 = {};
6
+ const state = reactive({
7
+ value: props.modelValue,
8
+ gridData: props.gridOp.data,
9
+ remoteData: [],
10
+ selected: props.multiple ? [] : {}
11
+ });
12
+ Object.assign(api2, {
13
+ state,
14
+ buildRadioConfig: buildRadioConfig({ props, state }),
15
+ buildSelectConfig: buildSelectConfig({ props, state }),
16
+ filter: filter({ props, state, vm }),
17
+ radioChange: radioChange({ props, vm, emit }),
18
+ selectChange: selectChange({ props, vm, emit })
19
+ });
20
+ watch(
21
+ () => props.gridOp.data,
22
+ (data) => data && (state.gridData = data),
23
+ { immediate: true, deep: true }
24
+ );
25
+ return api2;
26
+ };
27
+ export {
28
+ api,
29
+ renderless
30
+ };
package/input/index.js CHANGED
@@ -160,7 +160,7 @@ const resizeTextarea = ({ api, parent, vm, state, props }) => () => {
160
160
  return;
161
161
  }
162
162
  const { autosize, type } = parent;
163
- if (type !== "textarea") {
163
+ if (type !== "textarea" || !vm.$refs.textarea) {
164
164
  return;
165
165
  }
166
166
  if (props.hoverExpand && !state.enteredTextarea) {
@@ -170,7 +170,7 @@ const resizeTextarea = ({ api, parent, vm, state, props }) => () => {
170
170
  };
171
171
  return;
172
172
  }
173
- if (!autosize) {
173
+ if (!autosize || state.isDisplayOnly) {
174
174
  state.textareaCalcStyle = {
175
175
  minHeight: api.calcTextareaHeight(vm.$refs.textarea).minHeight
176
176
  };
package/menu/vue.js CHANGED
@@ -22,7 +22,7 @@ const initState = ({ reactive, computed, props, api: api2 }) => {
22
22
  });
23
23
  return state;
24
24
  };
25
- const renderless = (props, { reactive, watch, onMounted, computed }, { vm, emit, nextTick }) => {
25
+ const renderless = (props, { reactive, watch, onMounted, computed, onUnmounted }, { vm, emit, nextTick }) => {
26
26
  const api2 = {};
27
27
  const state = initState({ reactive, computed, props, api: api2 });
28
28
  Object.assign(api2, {
@@ -87,6 +87,10 @@ const renderless = (props, { reactive, watch, onMounted, computed }, { vm, emit,
87
87
  api2.setIsCurrent(state.data, param);
88
88
  });
89
89
  });
90
+ onUnmounted(() => {
91
+ vm.$off("node-clicked");
92
+ vm.$off("node-changed");
93
+ });
90
94
  return api2;
91
95
  };
92
96
  export {
package/modal/index.js CHANGED
@@ -183,6 +183,8 @@ const open = ({
183
183
  }
184
184
  if (props.fullscreen) {
185
185
  nextTick(api.maximize);
186
+ } else {
187
+ api.revert();
186
188
  }
187
189
  });
188
190
  }
package/numeric/index.js CHANGED
@@ -45,16 +45,19 @@ const internalIncrease = ({ api, state }) => ({ val, step }) => {
45
45
  if (decimal.isNaN() && val !== void 0) {
46
46
  return state.currentValue;
47
47
  }
48
- return decimal.add(step).toString();
48
+ const addValue = decimal.add(step).toString();
49
+ return addValue;
49
50
  };
50
51
  const internalDecrease = ({ api, state }) => ({ val, step }) => {
51
52
  const decimal = api.getDecimal(val);
52
53
  if (decimal.isNaN() && val !== void 0) {
53
54
  return state.currentValue;
54
55
  }
55
- return decimal.add(`-${step}`).toString();
56
+ const decreaseValue = decimal.add(`-${step}`).toString();
57
+ return decreaseValue;
56
58
  };
57
59
  const increase = ({ api, props, state }) => () => {
60
+ var _a, _b;
58
61
  if (state.inputDisabled || state.maxDisabled) {
59
62
  return;
60
63
  }
@@ -63,7 +66,10 @@ const increase = ({ api, props, state }) => () => {
63
66
  if (value.toString().includes("e")) {
64
67
  return;
65
68
  }
66
- let newVal = api.internalIncrease({ val: value, step: props.step });
69
+ let newVal = api.internalIncrease({
70
+ val: value,
71
+ step: (_b = (_a = props.step) == null ? void 0 : _a.value) != null ? _b : props.step
72
+ });
67
73
  if (!props.circulate || !isFinite(props.max) || !isFinite(props.min)) {
68
74
  api.setCurrentValue(newVal);
69
75
  return;
@@ -74,6 +80,7 @@ const increase = ({ api, props, state }) => () => {
74
80
  api.setCurrentValue(newVal);
75
81
  };
76
82
  const decrease = ({ api, props, state }) => () => {
83
+ var _a, _b;
77
84
  if (state.inputDisabled || state.minDisabled) {
78
85
  return;
79
86
  }
@@ -82,7 +89,10 @@ const decrease = ({ api, props, state }) => () => {
82
89
  if (value.toString().includes("e")) {
83
90
  return;
84
91
  }
85
- let newVal = api.internalDecrease({ val: value, step: props.step });
92
+ let newVal = api.internalDecrease({
93
+ val: value,
94
+ step: (_b = (_a = props.step) == null ? void 0 : _a.value) != null ? _b : props.step
95
+ });
86
96
  if (!props.circulate || !isFinite(props.max) || !isFinite(props.min)) {
87
97
  api.setCurrentValue(newVal);
88
98
  return;
@@ -163,6 +173,7 @@ const setCurrentValue = ({
163
173
  props,
164
174
  state
165
175
  }) => (newVal, emitChangeFlag = true) => {
176
+ var _a, _b;
166
177
  const { max, min, allowEmpty, validateEvent, stringMode, plugin, emptyValue } = props;
167
178
  const { format } = state;
168
179
  const oldVal = state.currentValue;
@@ -193,6 +204,13 @@ const setCurrentValue = ({
193
204
  if (validateEvent) {
194
205
  dispatch(constants.COMPONENT_NAME, constants.EVENT_NAME.change, [state.currentValue]);
195
206
  }
207
+ if (props.step instanceof Object && ((_a = props.step) == null ? void 0 : _a.mode) === "restore" && ((_b = props.step) == null ? void 0 : _b.value)) {
208
+ const stepValue = Number(props.step.value);
209
+ if (stepValue > 1 && newVal % stepValue !== 0) {
210
+ state.currentValue = oldVal;
211
+ state.userInput = oldVal;
212
+ }
213
+ }
196
214
  }
197
215
  };
198
216
  const handleInput = ({ state, api, emit, props }) => (event) => {
@@ -224,13 +242,13 @@ const handleInput = ({ state, api, emit, props }) => (event) => {
224
242
  state.userInput = value;
225
243
  };
226
244
  const handleInputChange = ({ api, state, props }) => (event) => {
227
- var _a, _b;
245
+ var _a, _b, _c;
228
246
  const value = ((_a = event.target) == null ? void 0 : _a.value) === "-" ? 0 : (_b = event.target) == null ? void 0 : _b.value;
229
- if (props.stepStrictly) {
247
+ if (props.stepStrictly || typeof props.step === "object" && ((_c = props.step) == null ? void 0 : _c.mode) === "strictly") {
230
248
  const previousValue = Number((props.mouseWheel ? state.displayValue : props.modelValue) || 0);
231
- if (Math.abs(previousValue - value) % Number(props.step) === 0)
249
+ if (Math.abs(previousValue - value) % Number(props.step) === 0 || Math.abs(previousValue - value) % Number(props.step.value) === 0)
232
250
  return api.setCurrentValue(value);
233
- const step = Number(props.step);
251
+ const step = Number(props.step) || Number(props.step.value);
234
252
  const difference = value - previousValue;
235
253
  const sign = difference >= 0 ? 1 : -1;
236
254
  return api.setCurrentValue(sign * Math.round(Math.abs(difference) / step) * step + previousValue);
@@ -286,7 +304,9 @@ const displayValue = ({ props, state, api }) => () => {
286
304
  return formatNumber(currentValue, state.format);
287
305
  };
288
306
  const getNumPecision = ({ api, props }) => () => {
289
- const stepPrecision = api.getPrecision(props.step);
307
+ var _a, _b;
308
+ const stepValue = (_b = (_a = props.step) == null ? void 0 : _a.value) != null ? _b : props.step;
309
+ const stepPrecision = api.getPrecision(stepValue);
290
310
  if (props.precision !== void 0) {
291
311
  return props.precision;
292
312
  } else {
package/option/index.js CHANGED
@@ -23,6 +23,11 @@ const handleGroupDisabled = ({ state, vm }) => (val) => {
23
23
  state.groupDisabled = val;
24
24
  vm.groupDisabled = val;
25
25
  };
26
+ const hoverItem = ({ select, props, state }) => () => {
27
+ if (!props.disabled && !state.groupDisabled && !select.state.disabledOptionHover) {
28
+ select.state.hoverIndex = select.state.optionIndexArr.indexOf(state.index);
29
+ }
30
+ };
26
31
  const selectOptionClick = ({ props, state, select, constants, vm }) => () => {
27
32
  if (props.disabled !== true && state.groupDisabled !== true) {
28
33
  if (select.multiple && props.required === true)
@@ -53,6 +58,7 @@ export {
53
58
  contains,
54
59
  escapeRegexpString,
55
60
  handleGroupDisabled,
61
+ hoverItem,
56
62
  initValue,
57
63
  isEqual,
58
64
  queryChange,
package/option/vue.js CHANGED
@@ -2,8 +2,17 @@ import {
2
2
  __spreadProps,
3
3
  __spreadValues
4
4
  } from "../chunk-G2ADBYYC.js";
5
- import { isEqual, contains, handleGroupDisabled, selectOptionClick, queryChange, toggleEvent, initValue } from "./index";
6
- const api = ["state", "visible", "selectOptionClick"];
5
+ import {
6
+ isEqual,
7
+ contains,
8
+ handleGroupDisabled,
9
+ hoverItem,
10
+ selectOptionClick,
11
+ queryChange,
12
+ toggleEvent,
13
+ initValue
14
+ } from "./index";
15
+ const api = ["state", "visible", "hoverItem", "selectOptionClick"];
7
16
  const initState = ({ reactive, computed, props, api: api2, markRaw, select, parent }) => {
8
17
  const state = reactive({
9
18
  parent: markRaw(parent),
@@ -44,6 +53,7 @@ const initApi = ({ api: api2, props, state, select, constants, vm }) => {
44
53
  state,
45
54
  isEqual: isEqual({ select, state }),
46
55
  contains: contains({ select, state }),
56
+ hoverItem: hoverItem({ select, props, state }),
47
57
  queryChange: queryChange({ select, props, state }),
48
58
  selectOptionClick: selectOptionClick({ constants, vm, props, state, select }),
49
59
  handleGroupDisabled: handleGroupDisabled({ state, vm }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/vue-renderless",
3
- "version": "3.19.4",
3
+ "version": "3.20.0",
4
4
  "description": "An enterprise-class UI component library, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.",
5
5
  "author": "OpenTiny Team",
6
6
  "license": "MIT",
package/picker/index.js CHANGED
@@ -982,7 +982,7 @@ const initPopper = ({ props, hooks, vnode }) => {
982
982
  emit,
983
983
  props: __spreadProps(__spreadValues({}, props), {
984
984
  popperOptions: Object.assign({ boundariesPadding: 0, gpuAcceleration: false }, props.popperOptions),
985
- visibleArrow: true,
985
+ visibleArrow: false,
986
986
  offset: 0,
987
987
  boundariesPadding: 5,
988
988
  arrowOffset: 35,
@@ -6,7 +6,6 @@ if (typeof window !== "undefined") {
6
6
  supportsPassive = false;
7
7
  try {
8
8
  const opts = Object.defineProperty({}, "passive", {
9
- // eslint-disable-next-line getter-return
10
9
  get() {
11
10
  supportsPassive = true;
12
11
  }
@@ -27,6 +26,10 @@ const handleVisibilityChange = ({ api, emit, state }) => (isVisible, entry) => {
27
26
  }
28
27
  }
29
28
  };
29
+ const init = ({ api }) => () => {
30
+ api.resetTemporary();
31
+ api.updateVisibleItems(true);
32
+ };
30
33
  const updateVisibleItems = ({ api, emit, props, state, vm }) => (checkItem, checkPositionDiff = false) => {
31
34
  const itemSize = props.itemSize;
32
35
  const gridItems = props.gridItems || 1;
@@ -87,18 +90,18 @@ const computedSizes = ({ props, state }) => () => {
87
90
  const items = props.items;
88
91
  const field = props.sizeField;
89
92
  const minItemSize = props.minItemSize;
90
- let computedMinSize = 1e4;
93
+ let computedMinItemSize = 1e4;
91
94
  let accumulator = 0;
92
95
  let current;
93
- for (let i = 0, l = items.length; i < l; i++) {
96
+ for (let i = 0, len = items.length; i < len; i++) {
94
97
  current = items[i][field] || minItemSize;
95
- if (current < computedMinSize) {
96
- computedMinSize = current;
98
+ if (current < computedMinItemSize) {
99
+ computedMinItemSize = current;
97
100
  }
98
101
  accumulator += current;
99
102
  sizes[i] = { accumulator, size: current };
100
103
  }
101
- state.temporary.computedMinItemSize = computedMinSize;
104
+ state.temporary.computedMinItemSize = computedMinItemSize;
102
105
  return sizes;
103
106
  }
104
107
  return [];
@@ -117,10 +120,10 @@ const getScroll = ({ props, vm }) => () => {
117
120
  const isVertical = direction === "vertical";
118
121
  let scrollRange;
119
122
  if (props.pageMode) {
120
- const bounds = el.getBoundingClientRect();
121
- const boundsSize = isVertical ? bounds.height : bounds.width;
123
+ const boundRect = el.getBoundingClientRect();
124
+ const boundsSize = isVertical ? boundRect.height : boundRect.width;
122
125
  let size = isVertical ? window.innerHeight : window.innerWidth;
123
- let start = -(isVertical ? bounds.top : bounds.left);
126
+ let start = -(isVertical ? boundRect.top : boundRect.left);
124
127
  if (start < 0) {
125
128
  size += start;
126
129
  start = 0;
@@ -138,11 +141,11 @@ const getScroll = ({ props, vm }) => () => {
138
141
  };
139
142
  const unuseView = (state) => (view, fake = false) => {
140
143
  const unusedViews = state.temporary.unusedViews;
141
- const type = view.nr.type;
142
- let unusedPool = unusedViews.get(type);
144
+ const { type: nrType } = view.nr;
145
+ let unusedPool = unusedViews.get(nrType);
143
146
  if (!unusedPool) {
144
147
  unusedPool = [];
145
- unusedViews.set(type, unusedPool);
148
+ unusedViews.set(nrType, unusedPool);
146
149
  }
147
150
  unusedPool.push(view);
148
151
  if (!fake) {
@@ -297,24 +300,24 @@ const computeRange = (args) => {
297
300
  const computeRangeVariableSizeMode = (args) => {
298
301
  let { count, sizes, scroll, startIndex, totalSize, endIndex } = args;
299
302
  let { items, visibleStartIndex, beforeSize, visibleEndIndex } = args;
300
- let h, a, b, i, oldI;
301
- a = 0;
302
- b = count - 1;
303
- i = ~~(count / 2);
303
+ let height, lower, upper, cursor, oldCursor;
304
+ lower = 0;
305
+ upper = count - 1;
306
+ cursor = ~~(count / 2);
304
307
  do {
305
- oldI = i;
306
- h = sizes[i].accumulator;
307
- if (h < scroll.start) {
308
- a = i;
309
- } else if (i < count - 1 && sizes[i + 1].accumulator > scroll.start) {
310
- b = i;
308
+ oldCursor = cursor;
309
+ height = sizes[cursor].accumulator;
310
+ if (height < scroll.start) {
311
+ lower = cursor;
312
+ } else if (cursor < count - 1 && sizes[cursor + 1].accumulator > scroll.start) {
313
+ upper = cursor;
311
314
  }
312
- i = ~~((a + b) / 2);
313
- } while (i !== oldI);
314
- i < 0 && (i = 0);
315
- startIndex = i;
315
+ cursor = ~~((lower + upper) / 2);
316
+ } while (cursor !== oldCursor);
317
+ cursor < 0 && (cursor = 0);
318
+ startIndex = cursor;
316
319
  totalSize = sizes[count - 1].accumulator;
317
- for (endIndex = i; endIndex < count && sizes[endIndex].accumulator < scroll.end; endIndex++) {
320
+ for (endIndex = cursor; endIndex < count && sizes[endIndex].accumulator < scroll.end; endIndex++) {
318
321
  }
319
322
  if (endIndex === -1) {
320
323
  endIndex = items.length - 1;
@@ -448,6 +451,17 @@ const computeViewEvent = ({ props, state }) => (view) => {
448
451
  };
449
452
  }
450
453
  };
454
+ const resetTemporary = ({ state }) => () => {
455
+ state.temporary = {
456
+ startIndex: 0,
457
+ endIndex: 0,
458
+ views: /* @__PURE__ */ new Map(),
459
+ unusedViews: /* @__PURE__ */ new Map(),
460
+ scrollDirty: false,
461
+ lastUpdateScrollPosition: 0
462
+ };
463
+ state.pool = [];
464
+ };
451
465
  export {
452
466
  addListeners,
453
467
  addView,
@@ -461,7 +475,9 @@ export {
461
475
  handleResize,
462
476
  handleScroll,
463
477
  handleVisibilityChange,
478
+ init,
464
479
  removeListeners,
480
+ resetTemporary,
465
481
  scrollToItem,
466
482
  scrollToPosition,
467
483
  sortViews,