@opentiny/vue-renderless 3.26.0 → 3.28.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 (82) hide show
  1. package/autocomplete/index.js +7 -2
  2. package/autocomplete/vue.js +1 -1
  3. package/base-select/index.js +189 -86
  4. package/base-select/vue.js +82 -20
  5. package/calendar-view/index.js +6 -3
  6. package/calendar-view/vue.js +9 -5
  7. package/color-picker/vue.js +4 -0
  8. package/color-select-panel/alpha-select/index.js +17 -12
  9. package/color-select-panel/alpha-select/vue.js +4 -2
  10. package/color-select-panel/hue-select/index.js +42 -11
  11. package/color-select-panel/hue-select/vue.js +32 -6
  12. package/color-select-panel/index.js +223 -39
  13. package/color-select-panel/linear-gradient/index.js +131 -0
  14. package/color-select-panel/linear-gradient/vue.js +21 -0
  15. package/color-select-panel/sv-select/index.js +12 -9
  16. package/color-select-panel/sv-select/vue.js +4 -2
  17. package/color-select-panel/utils/color-map.js +154 -0
  18. package/color-select-panel/utils/color-points.js +86 -0
  19. package/color-select-panel/utils/color.js +1 -1
  20. package/color-select-panel/utils/context.js +14 -0
  21. package/color-select-panel/vue.js +3 -3
  22. package/common/deps/infinite-scroll.js +1 -1
  23. package/dialog-box/index.js +3 -3
  24. package/dialog-box/vue.js +1 -0
  25. package/drawer/index.js +20 -0
  26. package/drawer/vue.js +9 -1
  27. package/dropdown/index.js +10 -4
  28. package/file-upload/index.js +18 -4
  29. package/form-item/index.js +28 -16
  30. package/form-item/vue.js +50 -11
  31. package/grid/static/array/eachTree.js +1 -0
  32. package/grid/utils/common.js +10 -3
  33. package/grid-select/index.js +418 -32
  34. package/grid-select/vue.js +103 -9
  35. package/guide/index.js +3 -3
  36. package/guide/vue.js +11 -1
  37. package/input/vue.js +2 -1
  38. package/package.json +3 -3
  39. package/picker/index.js +30 -13
  40. package/picker/vue.js +10 -0
  41. package/popover/index.js +1 -1
  42. package/rich-text/index.js +42 -0
  43. package/select/index.js +32 -15
  44. package/select/vue.js +31 -10
  45. package/select-dropdown/vue.js +8 -3
  46. package/select-wrapper/vue.js +134 -0
  47. package/slider/vue.js +7 -0
  48. package/space/index.js +30 -0
  49. package/space/vue.js +39 -0
  50. package/switch/vue.js +19 -0
  51. package/tab-nav/index.js +2 -2
  52. package/tabs-mf/index.js +9 -1
  53. package/tabs-mf/vue-nav.js +70 -22
  54. package/tabs-mf/vue-slider-bar.js +24 -0
  55. package/tabs-mf/vue.js +23 -5
  56. package/tag/index.js +1 -1
  57. package/transfer-panel/index.js +2 -1
  58. package/tree-menu/index.js +4 -0
  59. package/tree-menu/vue.js +3 -0
  60. package/tree-select/index.js +13 -4
  61. package/tree-select/vue.js +19 -3
  62. package/types/autocomplete.type.d.ts +2 -1
  63. package/types/color-select-panel.type.d.ts +197 -1
  64. package/types/date-picker.type.d.ts +38 -2
  65. package/types/file-upload.type.d.ts +1 -1
  66. package/types/form-item.type.d.ts +1 -1
  67. package/types/{form.type-dd403065.d.ts → form.type-a54e1c06.d.ts} +2 -2
  68. package/types/form.type.d.ts +1 -1
  69. package/types/input.type.d.ts +1 -1
  70. package/types/modal.type.d.ts +4 -0
  71. package/types/numeric.type.d.ts +1 -1
  72. package/types/picker.type.d.ts +42 -2
  73. package/types/popeditor.type.d.ts +76 -4
  74. package/types/popover.type.d.ts +1 -1
  75. package/types/space.type.d.ts +31 -0
  76. package/types/switch.type.d.ts +2 -1
  77. package/types/transfer.type.d.ts +3 -3
  78. package/types/tree-menu.type.d.ts +38 -2
  79. package/types/upload-dragger.type.d.ts +1 -1
  80. package/types/{upload-list.type-36a8374a.d.ts → upload-list.type-d5ff675d.d.ts} +1 -1
  81. package/types/upload-list.type.d.ts +1 -1
  82. package/types/upload.type.d.ts +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/vue-renderless",
3
- "version": "3.26.0",
3
+ "version": "3.28.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",
@@ -25,8 +25,8 @@
25
25
  ],
26
26
  "sideEffects": false,
27
27
  "dependencies": {
28
- "@opentiny/utils": "~3.26.0",
29
- "@opentiny/vue-hooks": "~3.26.0",
28
+ "@opentiny/utils": "~3.28.0",
29
+ "@opentiny/vue-hooks": "~3.28.0",
30
30
  "color": "4.2.3"
31
31
  },
32
32
  "devDependencies": {
package/picker/index.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  __spreadProps,
3
3
  __spreadValues
4
4
  } from "../chunk-G2ADBYYC.js";
5
- import { toDate1, getDateWithNewTimezone, getStrTimezone, getLocalTimezone } from "@opentiny/utils";
5
+ import { toDate1, getDateWithNewTimezone, getStrTimezone, getLocalTimezone, parseIso8601 } from "@opentiny/utils";
6
6
  import { isNumber, isDate } from "@opentiny/utils";
7
7
  import { userPopper } from "@opentiny/vue-hooks";
8
8
  import { DATEPICKER } from "@opentiny/utils";
@@ -127,6 +127,24 @@ const parseAsFormatAndType = ({ api }) => (value, customFormat, type, rangeSepar
127
127
  const format = customFormat || DATEPICKER.DateFormats[type];
128
128
  return parser(value, format, rangeSeparator);
129
129
  };
130
+ const ignoreTimezone = (value) => {
131
+ let res = value;
132
+ const ignoreTimezoneFn = (value2) => {
133
+ let date = value2;
134
+ const iso8601 = parseIso8601(value2);
135
+ if (iso8601) {
136
+ const { year, month, day, hours, minutes, seconds } = iso8601;
137
+ date = new Date(year, month, day, hours, minutes, seconds);
138
+ }
139
+ return date;
140
+ };
141
+ if (Array.isArray(res)) {
142
+ res = res.map((item) => ignoreTimezoneFn(item));
143
+ } else {
144
+ res = ignoreTimezoneFn(res);
145
+ }
146
+ return res;
147
+ };
130
148
  const parsedValue = ({ api, props, state, t }) => () => {
131
149
  if (!props.modelValue) {
132
150
  return props.modelValue;
@@ -139,17 +157,16 @@ const parsedValue = ({ api, props, state, t }) => () => {
139
157
  if (valueIsDateObject && !isServiceTimezone) {
140
158
  return props.modelValue;
141
159
  }
160
+ let value = ignoreTimezone(props.modelValue);
142
161
  if (state.valueFormat) {
143
- let date = props.modelValue;
144
- if (isServiceTimezone) {
145
- if (Array.isArray(date)) {
146
- date = [].concat(date).map((item) => {
147
- return isDate(item) ? formatDate(item, state.valueFormat, t) : item;
148
- });
149
- } else {
150
- if (state.valueFormat !== DATEPICKER.TimesTamp) {
151
- date = formatDate(date, state.valueFormat, t);
152
- }
162
+ let date = value;
163
+ if (Array.isArray(date)) {
164
+ date = [].concat(date).map((item) => {
165
+ return isDate(item) ? formatDate(item, state.valueFormat, t) : item;
166
+ });
167
+ } else {
168
+ if (state.valueFormat !== DATEPICKER.TimesTamp && isDate(date)) {
169
+ date = formatDate(date, state.valueFormat, t);
153
170
  }
154
171
  }
155
172
  const result = api.parseAsFormatAndType(date, state.valueFormat, state.type, props.rangeSeparator);
@@ -158,7 +175,7 @@ const parsedValue = ({ api, props, state, t }) => () => {
158
175
  }
159
176
  return getDateWithNewTimezone(result || props.modelValue, from, to, timezoneOffset);
160
177
  }
161
- const trans = (value) => typeof value === "string" || isNumber(value) ? toDate1(value) : value;
178
+ const trans = (value2) => typeof value2 === "string" || isNumber(value2) ? toDate1(value2) : value2;
162
179
  const values = [].concat(props.modelValue).map((val) => getDateWithNewTimezone(trans(val), from, to, timezoneOffset));
163
180
  return values.length > 1 ? values : values[0];
164
181
  };
@@ -1019,7 +1036,7 @@ const emitDbTime = ({ emit, state, t }) => (date) => {
1019
1036
  if (isDate(item)) {
1020
1037
  hasDate = true;
1021
1038
  let currentDate = getDateWithNewTimezone(item, getLocalTimezone(), from);
1022
- if (state.valueFormat) {
1039
+ if (state.valueFormat && state.valueFormat !== DATEPICKER.TimesTamp) {
1023
1040
  currentDate = formatDate(currentDate, state.valueFormat, t);
1024
1041
  }
1025
1042
  return currentDate;
package/picker/vue.js CHANGED
@@ -150,6 +150,10 @@ const initState = ({ api: api2, reactive, vm, computed, props, utils, parent, br
150
150
  ),
151
151
  showSeconds: computed(
152
152
  () => (state.format || props.pickerOptions && props.pickerOptions.format || "ss").includes("ss")
153
+ ),
154
+ innerWidth: 0,
155
+ breakLine: computed(
156
+ () => (state.innerWidth < 230 && state.type === "daterange" || state.innerWidth < 335 && state.type === "datetimerange") && state.displayValue && state.displayValue[1]
153
157
  )
154
158
  });
155
159
  return state;
@@ -271,8 +275,13 @@ const renderless = (props, hooks, vnode, others) => {
271
275
  initApi({ api: api2, props, hooks, state, vnode, others, utils, parent, isPCMode });
272
276
  initWatch({ api: api2, state, props, watch, markRaw });
273
277
  api2.initGlobalTimezone();
278
+ const resizeHandler = () => {
279
+ state.innerWidth = vm.$refs.reference.offsetWidth;
280
+ };
274
281
  onMounted(() => {
275
282
  api2.setInputPaddingLeft();
283
+ state.innerWidth = vm.$refs.reference.offsetWidth;
284
+ window.addEventListener("resize", resizeHandler);
276
285
  });
277
286
  parent.$on("handle-clear", (event) => {
278
287
  state.showClose = true;
@@ -280,6 +289,7 @@ const renderless = (props, hooks, vnode, others) => {
280
289
  });
281
290
  onBeforeUnmount(() => {
282
291
  api2.destroyPopper("remove");
292
+ window.removeEventListener("resize", resizeHandler);
283
293
  state.popperElm = null;
284
294
  state.picker = null;
285
295
  });
package/popover/index.js CHANGED
@@ -123,7 +123,7 @@ const handleDocumentClick = ({ vm, state }) => (event) => {
123
123
  const popperElm = state.popperElm;
124
124
  const $el = vm.$refs.root;
125
125
  let target = event.target;
126
- if ((target == null ? void 0 : target.shadowRoot) && popperElm) {
126
+ if ((target == null ? void 0 : target.shadowRoot) && target.shadowRoot.contains($el) && popperElm) {
127
127
  target = state.webCompEventTarget;
128
128
  }
129
129
  if (!$el || !reference || $el.contains(target) || reference.contains(target) || !popperElm || popperElm.contains(target)) {
@@ -4,6 +4,21 @@ import { xss } from "@opentiny/utils";
4
4
  import { getToolbarTips, defaultOptions } from "./options";
5
5
  import registerTableModule from "./table-module";
6
6
  import registerCustomClipboard from "./clipboard";
7
+ const registerCustomSize = (Quill, sizeConfig) => {
8
+ if (!sizeConfig || !Array.isArray(sizeConfig)) {
9
+ return;
10
+ }
11
+ const hasPixelValues = sizeConfig.some((item) => {
12
+ return item && typeof item === "string" && item.includes("px");
13
+ });
14
+ if (!hasPixelValues) {
15
+ return;
16
+ }
17
+ const SizeStyle = Quill.import("attributors/style/size");
18
+ const whitelist = sizeConfig.filter((item) => item !== false);
19
+ SizeStyle.whitelist = whitelist;
20
+ Quill.register("formats/size", SizeStyle, true);
21
+ };
7
22
  const initContent = ({ state, props, nextTick }) => () => {
8
23
  if (state.quill) {
9
24
  const flag = state.quill.selection.hasFocus();
@@ -24,7 +39,34 @@ const initContent = ({ state, props, nextTick }) => () => {
24
39
  }
25
40
  };
26
41
  const initQuill = ({ api, emit, props, vm, service, state, Quill, ImageDrop, ImageUpload, FileUpload }) => () => {
42
+ var _a, _b;
27
43
  state.innerOptions = extend(true, {}, defaultOptions, props.globalOptions, props.options);
44
+ const toolbarConfig = ((_b = (_a = state.innerOptions.modules) == null ? void 0 : _a.toolbar) == null ? void 0 : _b.container) || [];
45
+ const findSizeConfig = (config) => {
46
+ if (!config)
47
+ return null;
48
+ if (Array.isArray(config)) {
49
+ for (let i = 0; i < config.length; i++) {
50
+ const result = findSizeConfig(config[i]);
51
+ if (result)
52
+ return result;
53
+ }
54
+ } else if (typeof config === "object" && config !== null) {
55
+ if (config.size && Array.isArray(config.size)) {
56
+ return config.size;
57
+ }
58
+ for (const key in config) {
59
+ const result = findSizeConfig(config[key]);
60
+ if (result)
61
+ return result;
62
+ }
63
+ }
64
+ return null;
65
+ };
66
+ const sizeConfig = findSizeConfig(toolbarConfig);
67
+ if (sizeConfig) {
68
+ registerCustomSize(Quill, sizeConfig);
69
+ }
28
70
  if (document.caretRangeFromPoint) {
29
71
  if (props.imageDrop) {
30
72
  Quill.register("modules/imageDrop", ImageDrop, true);
package/select/index.js CHANGED
@@ -53,13 +53,13 @@ const showTip = ({ props, state, vm }) => (show) => {
53
53
  state.showTip = show && overflow && !!state.tips && !state.visible;
54
54
  }
55
55
  };
56
- const gridOnQueryChange = ({ props, vm, constants, state }) => (value) => {
56
+ const gridOnQueryChange = ({ props, vm, constants, state }) => async (value) => {
57
57
  const { multiple, valueField, filterMethod, remote, remoteMethod } = props;
58
58
  if ((props.filterable || props.searchable) && typeof filterMethod === "function") {
59
59
  const table = vm.$refs.selectGrid.$refs.tinyTable;
60
60
  const fullData = table.getTableData().fullData;
61
61
  vm.$refs.selectGrid.scrollTo(null, 0);
62
- table.loadTableData(filterMethod(value, fullData) || []);
62
+ await table.loadData(filterMethod(value, fullData) || []);
63
63
  vm.$refs.selectGrid.handleTableData(!value).then(() => state.selectEmitter.emit(constants.EVENT_NAME.updatePopper));
64
64
  state.previousQuery = value;
65
65
  } else if (remote && typeof remoteMethod === "function") {
@@ -179,8 +179,8 @@ const handleMenuEnter = ({ api, nextTick, state, props }) => () => {
179
179
  nextTick(() => api.scrollToOption(state.selected));
180
180
  }
181
181
  };
182
- const emitChange = ({ emit, props, state, constants }) => (value, changed) => {
183
- if (state.device === "mb" && props.multiple && !changed)
182
+ const emitChange = ({ emit, props, state, constants, isMobileFirstMode }) => (value, changed) => {
183
+ if (isMobileFirstMode && state.device === "mb" && props.multiple && !changed)
184
184
  return;
185
185
  const seekItem = (val, arr, items, flag) => {
186
186
  if (constants.TYPE.Tree === flag) {
@@ -220,8 +220,8 @@ const emitChange = ({ emit, props, state, constants }) => (value, changed) => {
220
220
  }
221
221
  }
222
222
  };
223
- const directEmitChange = ({ emit, props, state }) => (value, key) => {
224
- if (state.device === "mb" && props.multiple)
223
+ const directEmitChange = ({ emit, props, state, isMobileFirstMode }) => (value, key) => {
224
+ if (isMobileFirstMode && state.device === "mb" && props.multiple)
225
225
  return;
226
226
  emit("change", value, key);
227
227
  };
@@ -1101,7 +1101,7 @@ const toHide = ({ constants, state, props, vm, api }) => () => {
1101
1101
  }
1102
1102
  }
1103
1103
  };
1104
- const watchVisible = ({ api, constants, emit, state, vm, props }) => (value) => {
1104
+ const watchVisible = ({ api, constants, emit, state, vm, props, isMobileFirstMode }) => (value) => {
1105
1105
  var _a;
1106
1106
  if ((props.filterable || props.searchable || props.remote) && !value) {
1107
1107
  (_a = vm.$refs.reference) == null ? void 0 : _a.blur();
@@ -1109,7 +1109,7 @@ const watchVisible = ({ api, constants, emit, state, vm, props }) => (value) =>
1109
1109
  if (api.onCopying()) {
1110
1110
  return;
1111
1111
  }
1112
- if (value && props.multiple && state.device === "mb") {
1112
+ if (value && props.multiple && isMobileFirstMode && state.device === "mb") {
1113
1113
  state.selectedCopy = state.selected.slice();
1114
1114
  }
1115
1115
  setTimeout(() => {
@@ -1147,12 +1147,28 @@ const watchOptions = ({ api, constants, nextTick, parent, props, state }) => ()
1147
1147
  api.resetInputHeight();
1148
1148
  }
1149
1149
  nextTick(() => {
1150
- if (parent.$el.querySelector("input") !== document.activeElement) {
1150
+ var _a;
1151
+ if (parent.$el.querySelector("input") !== document.activeElement && // filterable时, 从 input 框离开了
1152
+ !(((_a = document.activeElement) == null ? void 0 : _a.classList.contains("tiny-input__inner")) && // 并且当前不在下拉面板的searchable 的input中时, 才需要更新一下setSelect
1153
+ document.activeElement.closest(".tiny-select-dropdown__search"))) {
1151
1154
  api.setSelected();
1152
1155
  }
1153
1156
  });
1154
1157
  api.getOptionIndexArr();
1155
1158
  };
1159
+ const watchOptionsWhenAutoSelect = ({ nextTick, props, state, api }) => () => {
1160
+ if (props.autoSelect && props.remote) {
1161
+ nextTick(() => {
1162
+ var _a, _b;
1163
+ if (((_a = props.options) == null ? void 0 : _a.length) === 1 || state.options.length === 1) {
1164
+ const { valueField } = props;
1165
+ const option = ((_b = props.options) == null ? void 0 : _b.length) === 1 ? props.options[0] : state.options[0];
1166
+ api.updateModelValue(props.multiple ? [option[props.valueField]] : option[props.valueField]);
1167
+ state.visible = false;
1168
+ }
1169
+ });
1170
+ }
1171
+ };
1156
1172
  const getOptionIndexArr = ({ props, state, api }) => () => {
1157
1173
  setTimeout(() => {
1158
1174
  state.optionIndexArr = api.queryVisibleOptions().map((item) => Number(item.getAttribute("data-index")));
@@ -1586,9 +1602,9 @@ const computeMultipleLimit = ({ props, state }) => () => {
1586
1602
  const { optimizeOpts } = state;
1587
1603
  return optmzApis.natural(multiple && optimization ? multipleLimit || optimizeOpts.limit : multipleLimit);
1588
1604
  };
1589
- const updateModelValue = ({ props, emit, state }) => (value, needUpdate) => {
1605
+ const updateModelValue = ({ props, emit, state, isMobileFirstMode }) => (value, needUpdate) => {
1590
1606
  state.isClickChoose = true;
1591
- if (state.device === "mb" && props.multiple && !needUpdate) {
1607
+ if (isMobileFirstMode && state.device === "mb" && props.multiple && !needUpdate) {
1592
1608
  state.modelValue = value;
1593
1609
  } else {
1594
1610
  emit("update:modelValue", value);
@@ -1626,17 +1642,17 @@ const computedTagsStyle = ({ props, parent, state, vm }) => () => {
1626
1642
  }
1627
1643
  return tagsStyle;
1628
1644
  };
1629
- const computedReadonly = ({ props, state }) => () => {
1645
+ const computedReadonly = ({ props, state, isMobileFirstMode }) => () => {
1630
1646
  if (state.isIOS && props.filterable) {
1631
1647
  return false;
1632
1648
  } else {
1633
- return state.device === "mb" || props.readonly || !(props.filterable || props.searchable) || props.multiple || browserInfo.name !== BROWSER_NAME.IE && browserInfo.name !== BROWSER_NAME.Edge && !state.visible;
1649
+ return isMobileFirstMode && state.device === "mb" || props.readonly || !(props.filterable || props.searchable) || props.multiple || browserInfo.name !== BROWSER_NAME.IE && browserInfo.name !== BROWSER_NAME.Edge && !state.visible;
1634
1650
  }
1635
1651
  };
1636
1652
  const computedShowClose = ({ props, state }) => () => props.clearable && !state.selectDisabled && (state.inputHovering || props.multiple && state.visible) && (props.multiple ? Array.isArray(props.modelValue) && props.modelValue.length > 0 : !isNull(props.modelValue) && props.modelValue !== "");
1637
1653
  const computedCollapseTagSize = (state) => () => state.selectSize;
1638
- const computedShowNewOption = ({ props, state }) => () => {
1639
- const query = state.device === "mb" ? state.queryValue : state.query;
1654
+ const computedShowNewOption = ({ props, state, isMobileFirstMode }) => () => {
1655
+ const query = isMobileFirstMode && state.device === "mb" ? state.queryValue : state.query;
1640
1656
  return (props.filterable || props.searchable) && props.allowCreate && query && !state.options.filter((option) => !option.created).some((option) => option.state.currentLabel === state.query);
1641
1657
  };
1642
1658
  const computedShowCopy = ({ props, state }) => () => props.multiple && props.copyable && state.inputHovering && state.selected.length;
@@ -1845,6 +1861,7 @@ export {
1845
1861
  watchInputHover,
1846
1862
  watchOptimizeOpts,
1847
1863
  watchOptions,
1864
+ watchOptionsWhenAutoSelect,
1848
1865
  watchPropsOption,
1849
1866
  watchShowClose,
1850
1867
  watchValue,
package/select/vue.js CHANGED
@@ -113,7 +113,8 @@ import {
113
113
  computedIsExpand,
114
114
  computedShowTagText,
115
115
  isTagClosable,
116
- computedCurrentSizeMap
116
+ computedCurrentSizeMap,
117
+ watchOptionsWhenAutoSelect
117
118
  } from "./index";
118
119
  import { debounce } from "@opentiny/utils";
119
120
  import { isNumber } from "@opentiny/utils";
@@ -183,7 +184,19 @@ const api = [
183
184
  "computedShowTagText",
184
185
  "isTagClosable"
185
186
  ];
186
- const initState = ({ reactive, computed, props, api: api2, emitter, parent, constants, useBreakpoint, vm, designConfig }) => {
187
+ const initState = ({
188
+ reactive,
189
+ computed,
190
+ props,
191
+ api: api2,
192
+ emitter,
193
+ parent,
194
+ constants,
195
+ isMobileFirstMode,
196
+ useBreakpoint,
197
+ vm,
198
+ designConfig
199
+ }) => {
187
200
  const stateAdd = initStateAdd({ computed, props, api: api2, parent });
188
201
  const state = reactive(__spreadProps(__spreadValues({}, stateAdd), {
189
202
  selectEmitter: emitter(),
@@ -224,10 +237,13 @@ const initState = ({ reactive, computed, props, api: api2, emitter, parent, cons
224
237
  selectedCopy: [],
225
238
  compareValue: null,
226
239
  selectedVal: computed(
227
- () => state.device === "mb" && props.multiple && state.visible ? state.selectedCopy : state.selected
240
+ () => isMobileFirstMode && state.device === "mb" && props.multiple && state.visible ? state.selectedCopy : state.selected
228
241
  ),
229
242
  displayOnlyContent: computed(() => {
230
243
  var _a;
244
+ if (vm.$slots.reference) {
245
+ return "";
246
+ }
231
247
  if (props.multiple) {
232
248
  if (Array.isArray(state.selected)) {
233
249
  if (state.isDisplayOnly && props.options && props.options.length > 0) {
@@ -273,7 +289,8 @@ const initState = ({ reactive, computed, props, api: api2, emitter, parent, cons
273
289
  rootAutoTipConfig: computed(() => __spreadValues({
274
290
  content: state.displayOnlyContent,
275
291
  always: !!state.displayOnlyContent
276
- }, props.tooltipConfig))
292
+ }, props.tooltipConfig)),
293
+ ariaListId: "tiny-select-" + crypto.randomUUID().slice(-8)
277
294
  }));
278
295
  return state;
279
296
  };
@@ -372,8 +389,8 @@ const initApi = ({
372
389
  getChildValue: getChildValue(),
373
390
  getOption: getOption({ props, state, api: api2 }),
374
391
  getSelectedOption: getSelectedOption({ props, state }),
375
- emitChange: emitChange({ emit, props, state, constants }),
376
- directEmitChange: directEmitChange({ emit, props, state, constants }),
392
+ emitChange: emitChange({ emit, props, state, constants, isMobileFirstMode }),
393
+ directEmitChange: directEmitChange({ emit, props, state, constants, isMobileFirstMode }),
377
394
  toggleMenu: toggleMenu({ vm, state, props, api: api2, isMobileFirstMode }),
378
395
  showTip: showTip({ props, state, vm }),
379
396
  onOptionDestroy: onOptionDestroy(state),
@@ -414,12 +431,12 @@ const initApi = ({
414
431
  computeMultipleLimit: computeMultipleLimit({ props, state }),
415
432
  watchInputHover: watchInputHover({ vm }),
416
433
  initQuery: initQuery({ props, state, constants, vm }),
417
- updateModelValue: updateModelValue({ props, emit, state }),
434
+ updateModelValue: updateModelValue({ props, emit, state, isMobileFirstMode }),
418
435
  computedTagsStyle: computedTagsStyle({ props, parent, state, vm }),
419
- computedReadonly: computedReadonly({ props, state }),
436
+ computedReadonly: computedReadonly({ props, state, isMobileFirstMode }),
420
437
  computedShowClose: computedShowClose({ props, state }),
421
438
  computedCollapseTagSize: computedCollapseTagSize(state),
422
- computedShowNewOption: computedShowNewOption({ props, state }),
439
+ computedShowNewOption: computedShowNewOption({ props, state, isMobileFirstMode }),
423
440
  computedShowCopy: computedShowCopy({ props, state }),
424
441
  computedOptionsAllDisabled: computedOptionsAllDisabled(state),
425
442
  computedDisabledTooltipContent: computedDisabledTooltipContent({ props, state }),
@@ -435,7 +452,8 @@ const initApi = ({
435
452
  clearNoMatchValue: clearNoMatchValue({ props, emit }),
436
453
  computedShowTagText: computedShowTagText({ state }),
437
454
  isTagClosable: isTagClosable(),
438
- computedCurrentSizeMap: computedCurrentSizeMap({ state, designConfig })
455
+ computedCurrentSizeMap: computedCurrentSizeMap({ state, designConfig }),
456
+ watchOptionsWhenAutoSelect: watchOptionsWhenAutoSelect({ state, props, nextTick, api: api2 })
439
457
  });
440
458
  addApi({ api: api2, props, state, emit, constants, parent, nextTick, dispatch, vm, isMobileFirstMode, designConfig });
441
459
  };
@@ -571,6 +589,8 @@ const initWatch = ({ watch, props, api: api2, state, nextTick }) => {
571
589
  };
572
590
  const addWatch = ({ watch, props, api: api2, state, nextTick }) => {
573
591
  watch(() => [...state.options], api2.watchOptions);
592
+ watch(() => state.options, api2.watchOptionsWhenAutoSelect);
593
+ props.options && watch(() => props.options, api2.watchOptionsWhenAutoSelect);
574
594
  if (props.renderType === "grid" && !props.optimization) {
575
595
  watch(() => state.gridData, api2.setSelected, { immediate: true });
576
596
  }
@@ -597,6 +617,7 @@ const renderless = (props, { computed, onBeforeUnmount, onMounted, reactive, wat
597
617
  emitter,
598
618
  parent,
599
619
  constants,
620
+ isMobileFirstMode,
600
621
  useBreakpoint,
601
622
  vm,
602
623
  designConfig
@@ -74,12 +74,17 @@ const initApi = ({ api: api2, popper, state, selectEmitter, constants, selectVm,
74
74
  mounted: mounted({ selectEmitter, constants, state, selectVm, updatePopper, destroyPopper, parent })
75
75
  });
76
76
  };
77
- const initWatch = ({ watch, selectVm, state, nextTick }) => {
77
+ const initWatch = ({ watch, selectVm, state, nextTick, props }) => {
78
78
  watch(
79
79
  () => !isServer ? selectVm.state.inputWidth : void 0,
80
80
  (val) => {
81
81
  nextTick(() => {
82
82
  state.minWidth = (selectVm && selectVm.$el && selectVm.$el.getBoundingClientRect().width || val) + "px";
83
+ if (props.isDropInheritWidth) {
84
+ setTimeout(() => {
85
+ state.minWidth = (selectVm && selectVm.$el && selectVm.$el.getBoundingClientRect().width || val) + "px";
86
+ }, 210);
87
+ }
83
88
  });
84
89
  },
85
90
  { immediate: true }
@@ -129,9 +134,9 @@ const renderless = (props, { computed, onBeforeUnmount, onDeactivated, onMounted
129
134
  toRefs,
130
135
  watch
131
136
  });
132
- const state = initState({ reactive, computed, popper, props, selectVm });
137
+ const state = initState({ reactive, computed, popper, selectVm });
133
138
  initApi({ api: api2, popper, state, selectEmitter, constants, selectVm, parent, nextTick, props, isMobileFirstMode });
134
- initWatch({ watch, selectVm, state, nextTick, api: api2 });
139
+ initWatch({ watch, selectVm, state, nextTick, props });
135
140
  onBeforeUnmount(() => {
136
141
  popper.destroyPopper("remove");
137
142
  state.popperElm = null;
@@ -0,0 +1,134 @@
1
+ import {
2
+ __objRest,
3
+ __spreadProps,
4
+ __spreadValues
5
+ } from "../chunk-G2ADBYYC.js";
6
+ const api = [
7
+ "state",
8
+ "resolvedComponent",
9
+ "mergedProps",
10
+ "listeners",
11
+ "slotNames",
12
+ "hasScopedDefault",
13
+ "focus",
14
+ "blur"
15
+ ];
16
+ const renderless = (props, { reactive, computed, useAttrs }, { constants, vm, components }) => {
17
+ const api2 = {};
18
+ const resolvedComponent = computed(() => computedResolvedComponent({ props, constants, vm, components }));
19
+ const mergedProps = computed(() => {
20
+ const runtimeAttrs = typeof useAttrs === "function" ? useAttrs() : null;
21
+ const attrs = runtimeAttrs || vm.$attrs || {};
22
+ const className = attrs.class;
23
+ const classArray = Array.isArray(className) ? ["tiny-select", ...className] : className ? ["tiny-select", className] : ["tiny-select"];
24
+ const _a = attrs, { class: _omitClass } = _a, restAttrs = __objRest(_a, ["class"]);
25
+ return __spreadProps(__spreadValues(__spreadValues({}, props), restAttrs), {
26
+ class: Array.from(new Set(classArray)),
27
+ dataTag: "tiny-select"
28
+ });
29
+ });
30
+ const slotNames = computed(() => Object.keys(vm.$slots || {}).filter((name) => name && name !== "default"));
31
+ const hasScopedDefault = computed(() => {
32
+ var _a, _b;
33
+ const scoped = (_a = vm.$scopedSlots) == null ? void 0 : _a.default;
34
+ if (scoped && scoped.length) {
35
+ return true;
36
+ }
37
+ const slot = (_b = vm.$slots) == null ? void 0 : _b.default;
38
+ return typeof slot === "function" && slot.length > 0;
39
+ });
40
+ const listeners = computed(() => {
41
+ if (vm.$listeners) {
42
+ return vm.$listeners;
43
+ }
44
+ return {};
45
+ });
46
+ const getChildComponent = () => {
47
+ var _a;
48
+ return (_a = vm.$refs) == null ? void 0 : _a.childComponent;
49
+ };
50
+ const state = new Proxy(
51
+ {},
52
+ {
53
+ get(target, prop) {
54
+ var _a;
55
+ const child = getChildComponent();
56
+ return (_a = child == null ? void 0 : child.state) == null ? void 0 : _a[prop];
57
+ },
58
+ set(target, prop, value) {
59
+ const child = getChildComponent();
60
+ if (child == null ? void 0 : child.state) {
61
+ child.state[prop] = value;
62
+ return true;
63
+ }
64
+ return false;
65
+ },
66
+ has(target, prop) {
67
+ const child = getChildComponent();
68
+ return prop in ((child == null ? void 0 : child.state) || {});
69
+ },
70
+ ownKeys(target) {
71
+ const child = getChildComponent();
72
+ return Object.keys((child == null ? void 0 : child.state) || {});
73
+ },
74
+ getOwnPropertyDescriptor(target, prop) {
75
+ const child = getChildComponent();
76
+ const childState = (child == null ? void 0 : child.state) || {};
77
+ if (prop in childState) {
78
+ return {
79
+ enumerable: true,
80
+ configurable: true,
81
+ value: childState[prop]
82
+ };
83
+ }
84
+ return void 0;
85
+ }
86
+ }
87
+ );
88
+ const focus = () => {
89
+ const child = getChildComponent();
90
+ child && typeof child.focus === "function" && child.focus();
91
+ };
92
+ const blur = () => {
93
+ const child = getChildComponent();
94
+ child && typeof child.blur === "function" && child.blur();
95
+ };
96
+ const hasData = (value) => {
97
+ if (!value) {
98
+ return false;
99
+ }
100
+ if (Array.isArray(value)) {
101
+ return value.length > 0;
102
+ }
103
+ if (typeof value === "object") {
104
+ return Object.keys(value).length > 0;
105
+ }
106
+ return true;
107
+ };
108
+ const computedResolvedComponent = ({ props: props2, constants: constants2, vm: vm2, components: components2 }) => {
109
+ var _a;
110
+ const comps = components2 || ((_a = vm2.$options) == null ? void 0 : _a.components) || {};
111
+ if (props2.renderType === constants2.TYPE.Tree || hasData(props2.treeOp)) {
112
+ return comps.TinyTreeSelect || "TinyTreeSelect";
113
+ }
114
+ if (props2.renderType === constants2.TYPE.Grid || hasData(props2.gridOp)) {
115
+ return comps.TinyGridSelect || "TinyGridSelect";
116
+ }
117
+ return comps.TinyBaseSelect || "TinyBaseSelect";
118
+ };
119
+ Object.assign(api2, {
120
+ state,
121
+ resolvedComponent,
122
+ mergedProps,
123
+ listeners,
124
+ slotNames,
125
+ hasScopedDefault,
126
+ focus,
127
+ blur
128
+ });
129
+ return api2;
130
+ };
131
+ export {
132
+ api,
133
+ renderless
134
+ };
package/slider/vue.js CHANGED
@@ -172,6 +172,13 @@ const renderless = (props, { computed, onBeforeUnmount, onMounted, reactive, wat
172
172
  api2.setActiveButtonValue(value);
173
173
  }
174
174
  );
175
+ watch(
176
+ () => props.vertical,
177
+ () => {
178
+ api2.setBarStyle();
179
+ api2.setButtonStyle();
180
+ }
181
+ );
175
182
  watch(
176
183
  () => state.leftBtnValue,
177
184
  (newVal) => {
package/space/index.js ADDED
@@ -0,0 +1,30 @@
1
+ import "../chunk-G2ADBYYC.js";
2
+ const sizeMap = {
3
+ small: "8px",
4
+ medium: "16px",
5
+ large: "24px"
6
+ };
7
+ const parseGap = (gap) => {
8
+ if (typeof gap === "number")
9
+ return `${gap}px`;
10
+ if (gap in sizeMap)
11
+ return sizeMap[gap];
12
+ if (typeof gap === "string")
13
+ return gap;
14
+ return "0px";
15
+ };
16
+ const getGapStyle = (props) => {
17
+ const gapProp = props.size;
18
+ if (Array.isArray(gapProp)) {
19
+ const [horizontal, vertical] = gapProp;
20
+ return {
21
+ gap: `${parseGap(vertical)} ${parseGap(horizontal)}`
22
+ };
23
+ }
24
+ return {
25
+ gap: parseGap(gapProp)
26
+ };
27
+ };
28
+ export {
29
+ getGapStyle
30
+ };