@opentiny/vue-renderless 3.9.2 → 3.10.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 (198) hide show
  1. package/action-sheet/vue.js +25 -2
  2. package/anchor/index.js +3 -3
  3. package/anchor/vue.js +7 -1
  4. package/area/index.js +4 -4
  5. package/button/vue.js +4 -2
  6. package/button-group/index.js +8 -1
  7. package/button-group/vue.js +5 -10
  8. package/calendar/index.js +14 -14
  9. package/calendar-bar/index.js +3 -3
  10. package/carousel-item/index.js +1 -1
  11. package/cascader/vue.js +1 -1
  12. package/cascader-mobile/index.js +299 -0
  13. package/cascader-mobile/vue.js +102 -0
  14. package/cascader-panel/store.js +3 -1
  15. package/chart-boxplot/index.js +0 -1
  16. package/chart-core/deps/constants.js +20 -2
  17. package/chart-core/index.js +9 -1
  18. package/chart-core/modules/extend.js +14 -1
  19. package/chart-gauge/index.js +3 -1
  20. package/chart-graph/index.js +3 -1
  21. package/chart-map/index.js +11 -1
  22. package/chart-scatter/index.js +10 -2
  23. package/chart-waterfall/index.js +4 -1
  24. package/checkbox/index.js +16 -14
  25. package/checkbox/vue.js +14 -10
  26. package/checkbox-button/vue.js +7 -3
  27. package/column-list-item/vue.js +10 -1
  28. package/common/bigInt.js +4 -11
  29. package/common/date.js +2 -2
  30. package/common/deps/ResizeObserver.js +3 -1
  31. package/common/deps/date-util.js +9 -1
  32. package/common/deps/date.js +18 -5
  33. package/common/deps/fastdom/async.js +41 -0
  34. package/common/deps/fastdom/index.js +9 -0
  35. package/common/deps/fastdom/sandbox.js +53 -0
  36. package/common/deps/fastdom/singleton.js +80 -0
  37. package/common/deps/fullscreen/screenfull.js +16 -2
  38. package/common/deps/memorize.js +3 -3
  39. package/common/deps/popup-manager.js +0 -1
  40. package/common/deps/requestAnimationFrame.js +1 -1
  41. package/common/deps/throttle.js +2 -2
  42. package/common/deps/tree-model/node.js +23 -11
  43. package/common/deps/tree-model/tree-store.js +28 -7
  44. package/common/deps/vue-popper.js +14 -2
  45. package/common/deps/vue-popup.js +16 -23
  46. package/common/index.js +7 -35
  47. package/common/runtime.js +1 -1
  48. package/common/validate/rules/type.js +3 -1
  49. package/credit-card-form/vue.js +2 -2
  50. package/date-panel/index.js +35 -31
  51. package/date-panel/vue.js +12 -12
  52. package/date-picker/index.js +9 -5
  53. package/date-picker/vue.js +20 -8
  54. package/date-picker-mobile/index.js +3 -3
  55. package/date-range/index.js +91 -19
  56. package/date-range/vue.js +19 -11
  57. package/date-table/index.js +39 -6
  58. package/date-table/vue.js +2 -2
  59. package/dept/index.js +1 -1
  60. package/detail-page/vue.js +9 -1
  61. package/dialog-box/index.js +11 -2
  62. package/dialog-box/vue.js +30 -6
  63. package/dialog-select/index.js +27 -5
  64. package/dialog-select/vue.js +11 -4
  65. package/drop-roles/index.js +3 -1
  66. package/dropdown/index.js +28 -7
  67. package/dropdown/vue.js +12 -7
  68. package/dropdown-item/index.js +9 -1
  69. package/dropdown-item/mf.js +3 -3
  70. package/dropdown-item/vue.js +12 -10
  71. package/dropdown-menu/index.js +13 -14
  72. package/dropdown-menu/vue.js +8 -7
  73. package/espace/vue.js +9 -1
  74. package/fall-menu/vue.js +12 -1
  75. package/file-upload/index.js +137 -89
  76. package/file-upload/vue.js +24 -14
  77. package/filter/index.js +1 -1
  78. package/filter/vue.js +1 -3
  79. package/floating-button/index.js +73 -0
  80. package/floating-button/vue.js +35 -0
  81. package/form/index.js +13 -4
  82. package/form/vue.js +7 -2
  83. package/form-item/index.js +4 -1
  84. package/form-item/vue.js +6 -3
  85. package/fullscreen/vue.js +24 -3
  86. package/grid/plugins/exportExcel.js +54 -8
  87. package/grid/static/base/helperGetHGSKeys.js +1 -4
  88. package/grid/utils/common.js +15 -11
  89. package/grid/utils/dom.js +5 -1
  90. package/guide/index.js +2 -3
  91. package/hrapprover/index.js +3 -1
  92. package/index-bar/vue.js +8 -1
  93. package/input/index.js +1 -11
  94. package/input/vue.js +6 -12
  95. package/ip-address/index.js +66 -33
  96. package/ip-address/vue.js +8 -1
  97. package/link-menu/vue.js +22 -2
  98. package/locales/index.js +4 -2
  99. package/logon-user/index.js +3 -1
  100. package/logout/index.js +6 -2
  101. package/milestone/vue.js +1 -1
  102. package/mini-picker/index.js +12 -10
  103. package/mini-picker/vue.js +10 -10
  104. package/modal/index.js +5 -3
  105. package/modal/vue.js +4 -2
  106. package/month-range/index.js +18 -18
  107. package/month-range/vue.js +16 -4
  108. package/month-table/index.js +7 -3
  109. package/multi-select/vue.js +1 -9
  110. package/nav-menu/index.js +33 -4
  111. package/nav-menu/vue.js +9 -1
  112. package/notify/vue.js +12 -1
  113. package/numeric/vue.js +6 -2
  114. package/option/index.js +10 -2
  115. package/option/vue.js +20 -9
  116. package/option-group/index.js +3 -1
  117. package/package.json +2 -1
  118. package/picker/index.js +88 -17
  119. package/picker/vue.js +42 -17
  120. package/picker-column/index.js +6 -6
  121. package/picker-column/vue.js +5 -5
  122. package/popconfirm/vue.js +3 -1
  123. package/popeditor/index.js +55 -13
  124. package/popeditor/vue.js +23 -7
  125. package/popover/vue.js +1 -2
  126. package/popup/vue.js +15 -2
  127. package/progress/index.js +9 -7
  128. package/progress/vue.js +12 -4
  129. package/pull-refresh/vue.js +10 -1
  130. package/query-builder/index.js +9 -0
  131. package/query-builder/vue.js +18 -0
  132. package/radio/vue.js +3 -1
  133. package/radio-button/vue.js +1 -1
  134. package/rate/index.js +8 -2
  135. package/rate/vue.js +27 -4
  136. package/recycle-scroller/index.js +0 -1
  137. package/scrollbar/vue-bar.js +18 -2
  138. package/search/index.js +12 -5
  139. package/search/vue.js +7 -5
  140. package/select/index.js +596 -304
  141. package/select/vue.js +167 -101
  142. package/select-dropdown/vue.js +8 -6
  143. package/select-mobile/index.js +26 -13
  144. package/select-mobile/vue.js +14 -5
  145. package/select-view/index.js +5 -21
  146. package/select-view/vue.js +0 -3
  147. package/selected-box/index.js +3 -1
  148. package/slider/index.js +5 -5
  149. package/slider/vue.js +16 -0
  150. package/slider-button/index.js +41 -0
  151. package/slider-button/vue.js +36 -0
  152. package/slider-button-group/slide-button.js +142 -0
  153. package/slider-button-group/vue.js +52 -0
  154. package/steps/slide-bar.js +0 -1
  155. package/switch/index.js +1 -1
  156. package/switch/vue.js +1 -1
  157. package/tab-bar/index.js +8 -6
  158. package/tab-nav/index.js +19 -13
  159. package/tab-nav/vue.js +10 -9
  160. package/tabs/index.js +21 -17
  161. package/tabs/vue.js +1 -4
  162. package/tag/vue.js +2 -1
  163. package/tag-group/index.js +23 -10
  164. package/tag-group/vue.js +5 -4
  165. package/time/index.js +8 -8
  166. package/time/vue.js +9 -9
  167. package/time-line/index.js +24 -2
  168. package/time-line/vue.js +30 -4
  169. package/time-panel/index.js +2 -2
  170. package/time-panel/vue.js +2 -2
  171. package/time-range/index.js +24 -21
  172. package/time-range/vue.js +26 -16
  173. package/time-spinner/index.js +32 -21
  174. package/time-spinner/vue.js +37 -12
  175. package/timeline-item/index.js +77 -0
  176. package/timeline-item/vue.js +44 -0
  177. package/toggle-menu/vue.js +0 -1
  178. package/tooltip/index.js +11 -12
  179. package/tooltip/vue.js +11 -1
  180. package/top-box/vue.js +13 -1
  181. package/tree/index.js +228 -15
  182. package/tree/vue.js +119 -15
  183. package/tree-menu/index.js +35 -0
  184. package/tree-menu/vue.js +27 -5
  185. package/tree-node/index.js +75 -10
  186. package/tree-node/vue.js +45 -23
  187. package/upload/index.js +90 -49
  188. package/upload/vue.js +22 -10
  189. package/upload-dragger/index.js +4 -3
  190. package/upload-list/index.js +67 -16
  191. package/upload-list/vue.js +26 -9
  192. package/user/index.js +7 -4
  193. package/user-link/index.js +2 -1
  194. package/wizard/index.js +4 -1
  195. package/wizard/vue.js +19 -2
  196. package/year-range/index.js +1 -1
  197. package/year-range/vue.js +3 -3
  198. package/year-table/index.js +2 -2
package/nav-menu/index.js CHANGED
@@ -148,6 +148,10 @@ const getSelectedIndex = (state) => (path) => {
148
148
  let length = state.data.length;
149
149
  let index = -1;
150
150
  if (path !== "/") {
151
+ const queryIndex = path.indexOf("?");
152
+ if (queryIndex !== -1) {
153
+ path = path.slice(0, queryIndex);
154
+ }
151
155
  path = path.replace(/^#?\//, "");
152
156
  let exp = new RegExp('("url":"#/?' + path + '"|"url":"/?' + path + '"|"route":"/?' + path + '")', "i");
153
157
  for (let i = 0; i < length; i++) {
@@ -171,6 +175,10 @@ const showSubMenu = ({ api, nextTick, parent, state }) => (list, { more, index }
171
175
  state.showMore = !!more;
172
176
  state.subMenu = list;
173
177
  state.showPopmenu = true;
178
+ state.enterMenu = true;
179
+ state.subItemSelectedIndex = -1;
180
+ state.subIndex = -1;
181
+ state.moreItemSelectedIndex = -1;
174
182
  nextTick(() => {
175
183
  const popmenu = parent.$el.querySelector(".popmenu");
176
184
  if (popmenu) {
@@ -206,6 +214,7 @@ const hideSubMenu = ({ api, parent, state }) => () => {
206
214
  };
207
215
  const willHideSubMenu = ({ api, state }) => () => {
208
216
  api.stopHideSubMenu();
217
+ state.enterMenu = false;
209
218
  state.timer = setTimeout(() => {
210
219
  api.hideSubMenu();
211
220
  }, 20);
@@ -216,6 +225,10 @@ const stopHideSubMenu = (state) => () => {
216
225
  const setSubMenu = (state) => (value, index) => {
217
226
  state.subActiveIndex = index;
218
227
  state.subMenu = value;
228
+ state.enterMoreMenu = true;
229
+ };
230
+ const leaveMoreMune = (state) => () => {
231
+ state.enterMoreMenu = false;
219
232
  };
220
233
  const isHide = ({ parent, state }) => (event) => !state.width || event.offsetTop >= parent.$el.offsetHeight;
221
234
  const hidePopmenu = (api) => (item) => {
@@ -224,7 +237,21 @@ const hidePopmenu = (api) => (item) => {
224
237
  api.hideSubMenu();
225
238
  }
226
239
  };
227
- const clickMenu = ({ api, props }) => (item, index) => {
240
+ const clickMenu = ({ api, props, state }) => (item, index, parentIndex) => {
241
+ if (index === void 0) {
242
+ return;
243
+ }
244
+ if (state.enterMenu) {
245
+ state.subIndex = -1;
246
+ state.subItemSelectedIndex = -1;
247
+ api.setActiveMenu(index);
248
+ }
249
+ if (state.enterMoreMenu) {
250
+ state.moreItemSelectedIndex = index;
251
+ } else {
252
+ state.subItemSelectedIndex = index;
253
+ state.subIndex = parentIndex;
254
+ }
228
255
  if (item.url || item.route) {
229
256
  if (props.beforeSkip) {
230
257
  props.beforeSkip(item) && api.skip(item, true);
@@ -232,7 +259,6 @@ const clickMenu = ({ api, props }) => (item, index) => {
232
259
  api.skip(item);
233
260
  }
234
261
  }
235
- index !== void 0 && api.setActiveMenu(index);
236
262
  api.hidePopmenu(item);
237
263
  };
238
264
  const skip = ({ api, router, fields }) => (item, flag = false) => {
@@ -241,7 +267,7 @@ const skip = ({ api, router, fields }) => (item, flag = false) => {
241
267
  const router2 = item[urlField] || item.route;
242
268
  return window.open(xss.filterUrl(router2)).opener = null;
243
269
  }
244
- const address = !item.route || !flag ? api.getUrl(item).replace(/^#/, "") : item.route.replace(/^\/+/, "/").replace("#/", "");
270
+ const address = !item.route || !flag ? api.getUrl(item).replace(/^#/, "") : `/${item.route || ""}`.replace(/^\/+/, "/").replace("#/", "");
245
271
  if (address) {
246
272
  return router.push(address);
247
273
  } else {
@@ -282,7 +308,9 @@ const getUrl = () => (item) => item.url || "";
282
308
  const getRoute = (props) => (item) => !props.beforeSkip ? `/${item.route || ""}`.replace(/^\/+/, "/").replace("#/", "") : "";
283
309
  const setActiveMenu = (state) => (index) => state.selectedIndex = typeof index !== "undefined" ? index : -1;
284
310
  const initService = ({ props, service }) => {
285
- const fetchMenuData = () => Promise.reject(new Error("[TINY Error][NavMenu] Prop fetchMenuData is not configured"));
311
+ const fetchMenuData = () => Promise.reject(
312
+ new Error("[TINY Error][NavMenu] Prop fetchMenuData is mandatory when the framework service is not used")
313
+ );
286
314
  const { base = {}, setting = {} } = service || {};
287
315
  const { options = {} } = setting;
288
316
  return {
@@ -309,6 +337,7 @@ export {
309
337
  initData,
310
338
  initService,
311
339
  isHide,
340
+ leaveMoreMune,
312
341
  mounted,
313
342
  setActiveMenu,
314
343
  setSubMenu,
package/nav-menu/vue.js CHANGED
@@ -17,6 +17,7 @@ import {
17
17
  willHideSubMenu,
18
18
  stopHideSubMenu,
19
19
  setSubMenu,
20
+ leaveMoreMune,
20
21
  isHide,
21
22
  hidePopmenu,
22
23
  clickMenu,
@@ -40,6 +41,7 @@ const api = [
40
41
  "willHideSubMenu",
41
42
  "stopHideSubMenu",
42
43
  "setSubMenu",
44
+ "leaveMoreMune",
43
45
  "isHide",
44
46
  "hidePopmenu",
45
47
  "clickMenu",
@@ -56,14 +58,19 @@ const initState = ({ reactive, api: api2, computed }) => reactive({
56
58
  data: [],
57
59
  more: [],
58
60
  width: -1,
61
+ enterMenu: false,
59
62
  popMenuTop: 0,
60
63
  subMenu: [],
61
64
  showMore: false,
62
65
  showPopmenu: false,
66
+ enterMoreMenu: false,
63
67
  timer: null,
64
68
  activeIndex: -1,
65
69
  subActiveIndex: -1,
66
70
  selectedIndex: -1,
71
+ subItemSelectedIndex: -1,
72
+ moreItemSelectedIndex: -1,
73
+ subIndex: -1,
67
74
  isShowSetting: false,
68
75
  marginLeft: 0,
69
76
  isShowMore: computed(() => api2.computedIsShowMore()),
@@ -79,6 +86,7 @@ const initApi = ({ api: api2, state, props, parent, fetchMenuData, fields, route
79
86
  getTag: getTag(props),
80
87
  getRoute: getRoute(props),
81
88
  setSubMenu: setSubMenu(state),
89
+ leaveMoreMune: leaveMoreMune(state),
82
90
  isHide: isHide({ parent, state }),
83
91
  setActiveMenu: setActiveMenu(state),
84
92
  willHideSetting: willHideSetting(state),
@@ -95,7 +103,7 @@ const initApi = ({ api: api2, state, props, parent, fetchMenuData, fields, route
95
103
  skip: skip({ api: api2, router, fields }),
96
104
  hidePopmenu: hidePopmenu(api2),
97
105
  getPoint: getPoint({ api: api2, parent }),
98
- clickMenu: clickMenu({ api: api2, props }),
106
+ clickMenu: clickMenu({ api: api2, props, state }),
99
107
  unMounted: unMounted({ api: api2, state, router }),
100
108
  mounted: mounted({ api: api2, props, router, route, state }),
101
109
  classify: classify({ api: api2, props, state }),
package/notify/vue.js CHANGED
@@ -1,5 +1,16 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
- import { clearTimer, startTimer, close, bindEvent, unBindEvent, click, watchClosed, getOffsetStyle, getPositionSide, getZindex } from "./index";
2
+ import {
3
+ clearTimer,
4
+ startTimer,
5
+ close,
6
+ bindEvent,
7
+ unBindEvent,
8
+ click,
9
+ watchClosed,
10
+ getOffsetStyle,
11
+ getPositionSide,
12
+ getZindex
13
+ } from "./index";
3
14
  const api = [
4
15
  "state",
5
16
  "clearTimer",
package/numeric/vue.js CHANGED
@@ -52,8 +52,12 @@ const initState = ({ reactive, computed, props, api: api2, $service, parent }) =
52
52
  inputDisabled: computed(() => props.disabled || state.formDisabled),
53
53
  displayValue: computed(() => api2.displayValue()),
54
54
  numPrecision: computed(() => api2.getNumPecision()),
55
- minDisabled: computed(() => !props.circulate && state.currentValue <= props.min || state.formDisabled),
56
- maxDisabled: computed(() => !props.circulate && state.currentValue >= props.max || state.formDisabled),
55
+ minDisabled: computed(
56
+ () => !props.circulate && state.currentValue <= props.min || state.formDisabled
57
+ ),
58
+ maxDisabled: computed(
59
+ () => !props.circulate && state.currentValue >= props.max || state.formDisabled
60
+ ),
57
61
  controlsAtRight: computed(() => props.controls && props.controlsPosition === "right"),
58
62
  format: computed(() => getUnitPrecision({ service: $service, props })),
59
63
  isDisplayOnly: computed(() => props.displayOnly || (parent.tinyForm || {}).displayOnly)
package/option/index.js CHANGED
@@ -27,6 +27,8 @@ const hoverItem = ({ select, props, state, vm }) => () => {
27
27
  };
28
28
  const selectOptionClick = ({ props, state, select, constants, vm }) => () => {
29
29
  if (props.disabled !== true && state.groupDisabled !== true) {
30
+ if (select.multiple && props.required === true)
31
+ return;
30
32
  select.state.selectEmitter.emit(constants.EVENT_NAME.handleOptionClick, vm, true);
31
33
  }
32
34
  };
@@ -34,16 +36,22 @@ const queryChange = ({ select, props, state }) => (query) => {
34
36
  state.visible = new RegExp(escapeRegexpString(query), "i").test(state.currentLabel) || props.created;
35
37
  select.state.filteredOptionsCount += state.visible ? 1 : -1;
36
38
  };
37
- const toggleEvent = ({ props, refs, type }) => {
38
- const optionEl = refs.option;
39
+ const toggleEvent = ({ props, vm, type }) => {
40
+ const optionEl = vm.$refs.option;
39
41
  Object.keys(props.events).forEach((ev) => {
40
42
  optionEl[type + "EventListener"](ev, props.events[ev]);
41
43
  });
42
44
  };
45
+ const initValue = ({ select, props, constants, vm }) => () => {
46
+ if (select.multiple && props.required) {
47
+ select.state.selectEmitter.emit(constants.EVENT_NAME.initValue, vm);
48
+ }
49
+ };
43
50
  export {
44
51
  contains,
45
52
  handleGroupDisabled,
46
53
  hoverItem,
54
+ initValue,
47
55
  isEqual,
48
56
  queryChange,
49
57
  selectOptionClick,
package/option/vue.js CHANGED
@@ -1,5 +1,14 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
- import { isEqual, contains, handleGroupDisabled, hoverItem, selectOptionClick, queryChange, toggleEvent } from "./index";
2
+ import {
3
+ isEqual,
4
+ contains,
5
+ handleGroupDisabled,
6
+ hoverItem,
7
+ selectOptionClick,
8
+ queryChange,
9
+ toggleEvent,
10
+ initValue
11
+ } from "./index";
3
12
  const api = ["state", "visible", "hoverItem", "selectOptionClick"];
4
13
  const initState = ({ reactive, computed, props, api: api2, markRaw, select, parent }) => {
5
14
  const state = reactive({
@@ -42,7 +51,8 @@ const initApi = ({ api: api2, props, state, select, constants, vm }) => {
42
51
  hoverItem: hoverItem({ select, vm, props, state }),
43
52
  queryChange: queryChange({ select, props, state }),
44
53
  selectOptionClick: selectOptionClick({ constants, vm, props, state, select }),
45
- handleGroupDisabled: handleGroupDisabled(state)
54
+ handleGroupDisabled: handleGroupDisabled(state),
55
+ initValue: initValue({ select, props, constants, vm })
46
56
  });
47
57
  };
48
58
  const initWatch = ({ watch, props, state, select, constants }) => {
@@ -67,32 +77,33 @@ const initWatch = ({ watch, props, state, select, constants }) => {
67
77
  }
68
78
  );
69
79
  };
70
- const initOnMounted = ({ onMounted, props, api: api2, vm, state, refs, constants, select }) => {
80
+ const initOnMounted = ({ onMounted, props, api: api2, vm, state, constants, select }) => {
71
81
  onMounted(() => {
72
82
  state.el = vm.$el;
73
- toggleEvent({ props, refs, type: "add" });
83
+ toggleEvent({ props, vm, type: "add" });
74
84
  select.state.selectEmitter.on(constants.EVENT_NAME.queryChange, api2.queryChange);
85
+ api2.initValue();
75
86
  });
76
87
  };
77
- const initOnBeforeUnmount = ({ onBeforeUnmount, props, select, refs, vm }) => {
88
+ const initOnBeforeUnmount = ({ onBeforeUnmount, props, select, vm }) => {
78
89
  onBeforeUnmount(() => {
79
90
  const index = select.state.cachedOptions.indexOf(vm);
80
- toggleEvent({ props, refs, type: "remove" });
91
+ toggleEvent({ props, vm, type: "remove" });
81
92
  if (index === -1) {
82
93
  select.state.cachedOptions.splice(index, 1);
83
94
  }
84
95
  select.onOptionDestroy(select.state.options.indexOf(vm));
85
96
  });
86
97
  };
87
- const renderless = (props, { computed, onMounted, onBeforeUnmount, reactive, watch, inject, markRaw }, { vm, refs, parent }) => {
98
+ const renderless = (props, { computed, onMounted, onBeforeUnmount, reactive, watch, inject, markRaw }, { vm, parent }) => {
88
99
  const api2 = {};
89
100
  const select = inject("select");
90
101
  const constants = select._constants;
91
102
  const state = initState({ reactive, computed, props, api: api2, markRaw, select, parent });
92
103
  initApi({ api: api2, props, state, select, constants, vm });
93
104
  initWatch({ watch, props, state, select, constants });
94
- initOnMounted({ onMounted, props, api: api2, vm, state, refs, constants, select });
95
- initOnBeforeUnmount({ onBeforeUnmount, props, select, refs, vm });
105
+ initOnMounted({ onMounted, props, api: api2, vm, state, constants, select });
106
+ initOnBeforeUnmount({ onBeforeUnmount, props, select, vm });
96
107
  select.state.options.push(markRaw(vm));
97
108
  select.state.cachedOptions.push(markRaw(vm));
98
109
  select.state.optionsCount++;
@@ -2,7 +2,9 @@ import "../chunk-PKUHTIDK.js";
2
2
  const queryChange = ({ select, state, vm }) => () => {
3
3
  state.visible = true;
4
4
  if (Array.isArray(select.state.options)) {
5
- const groupOptions = select.state.options.filter((option) => option.state.parent && vm && option.state.parent.label === vm.label);
5
+ const groupOptions = select.state.options.filter(
6
+ (option) => option.state.parent && vm && option.state.parent.label === vm.label
7
+ );
6
8
  if (Array.isArray(groupOptions)) {
7
9
  state.visible = groupOptions.some((option) => option.visible === true);
8
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/vue-renderless",
3
- "version": "3.9.2",
3
+ "version": "3.10.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
  "homepage": "https://opentiny.design/tiny-vue",
6
6
  "keywords": [
@@ -24,6 +24,7 @@
24
24
  "url": "https://github.com/opentiny/tiny-vue/issues"
25
25
  },
26
26
  "sideEffects": false,
27
+ "type": "module",
27
28
  "scripts": {
28
29
  "build": "tsup",
29
30
  "build:fast": "npm run build && npm run release",
package/picker/index.js CHANGED
@@ -10,11 +10,21 @@ import { formatDate, parseDate, isDateObject, getWeekNumber } from "../common/de
10
10
  import { extend } from "../common/object";
11
11
  import globalTimezone from "../picker/timezone";
12
12
  const iso8601Reg = /^\d{4}-\d{2}-\d{2}(.)\d{2}:\d{2}:\d{2}(.+)$/;
13
- const getPanel = ({ DatePanel, DateRangePanel, MonthRangePanel, TimePanel, TimeRangePanel, TimeSelect }) => (type) => {
13
+ const getPanel = ({
14
+ DatePanel,
15
+ DateRangePanel,
16
+ MonthRangePanel,
17
+ YearRangePanel,
18
+ TimePanel,
19
+ TimeRangePanel,
20
+ TimeSelect
21
+ }) => (type) => {
14
22
  if (type === DATEPICKER.DateRange || type === DATEPICKER.DateTimeRange) {
15
23
  return DateRangePanel;
16
24
  } else if (type === DATEPICKER.MonthRange) {
17
25
  return MonthRangePanel;
26
+ } else if (type === DATEPICKER.YearRange) {
27
+ return YearRangePanel;
18
28
  } else if (type === DATEPICKER.TimeRange) {
19
29
  return TimeRangePanel;
20
30
  } else if (type === DATEPICKER.Time) {
@@ -62,8 +72,8 @@ const getMode = ({ state }) => () => {
62
72
  return DATEPICKER.Week;
63
73
  } else if (state.type === DATEPICKER.Month) {
64
74
  return DATEPICKER.Month;
65
- } else if (state.type === DATEPICKER.Year) {
66
- return DATEPICKER.Year;
75
+ } else if ([DATEPICKER.Year, DATEPICKER.Years, DATEPICKER.YearRange].includes(state.type)) {
76
+ return state.type;
67
77
  } else if (state.type === DATEPICKER.Dates) {
68
78
  return DATEPICKER.Dates;
69
79
  }
@@ -80,11 +90,14 @@ const formatAsFormatAndType = ({ api }) => (value, customFormat, type) => {
80
90
  const displayValue = ({ api, props, state }) => () => {
81
91
  const formattedValue = api.formatAsFormatAndType(state.parsedValue, state.format, state.type, props.rangeSeparator);
82
92
  if (Array.isArray(state.userInput)) {
83
- return [state.userInput[0] || formattedValue && formattedValue[0] || "", state.userInput[1] || formattedValue && formattedValue[1] || ""];
93
+ return [
94
+ state.userInput[0] || formattedValue && formattedValue[0] || "",
95
+ state.userInput[1] || formattedValue && formattedValue[1] || ""
96
+ ];
84
97
  } else if (state.userInput !== null) {
85
98
  return state.userInput;
86
99
  } else if (formattedValue) {
87
- return state.type === DATEPICKER.Dates ? formattedValue.join(", ") : formattedValue;
100
+ return [DATEPICKER.Dates, DATEPICKER.Years].includes(state.type) ? formattedValue.join(", ") : formattedValue;
88
101
  }
89
102
  return "";
90
103
  };
@@ -253,7 +266,9 @@ const getDatesOfTypeValueResolveMap = (api) => ({
253
266
  return value.map((date) => api.dateFormatter(date, format));
254
267
  },
255
268
  parser(value, format) {
256
- return (typeof value === "string" ? value.split(", ") : value).map((date) => date instanceof Date ? date : api.dateParser(date, format));
269
+ return (typeof value === "string" ? value.split(", ") : value).map(
270
+ (date) => date instanceof Date ? date : api.dateParser(date, format)
271
+ );
257
272
  }
258
273
  });
259
274
  const typeValueResolveMap = ({ api, t }) => () => ({
@@ -268,6 +283,8 @@ const typeValueResolveMap = ({ api, t }) => () => ({
268
283
  time: { formatter: api.dateFormatter, parser: api.dateParser },
269
284
  month: { formatter: api.dateFormatter, parser: api.dateParser },
270
285
  year: { formatter: api.dateFormatter, parser: api.dateParser },
286
+ years: getDatesOfTypeValueResolveMap(api),
287
+ yearrange: getDatesOfTypeValueResolveMap(api),
271
288
  number: getNumberOfTypeValueResolveMap(),
272
289
  dates: getDatesOfTypeValueResolveMap(api)
273
290
  });
@@ -295,7 +312,7 @@ const secondInputId = ({ props, state }) => () => {
295
312
  }
296
313
  return obj;
297
314
  };
298
- const focus = ({ api, props, refs }) => () => !props.ranged ? refs.reference.focus() : api.handleFocus();
315
+ const focus = ({ api, props, vm }) => () => !props.ranged ? vm.$refs.reference.focus() : api.handleFocus();
299
316
  const blur = (state) => () => state.refInput.forEach((input) => input.blur());
300
317
  const parseValue = ({ api, props, state }) => (value) => {
301
318
  const isParsed = isDateObject(value) || Array.isArray(value) && value.every(isDateObject);
@@ -365,20 +382,31 @@ const handleStartChange = ({ api, state }) => () => {
365
382
  if (state.displayValue[1]) {
366
383
  state.userInput = [api.formatToString(value), state.displayValue[1]];
367
384
  newValue = [value, state.picker.state.value && state.picker.state.value[1]];
385
+ state.startStatus = true;
368
386
  } else {
369
- let now = /* @__PURE__ */ new Date();
387
+ let now = new Date();
370
388
  if (now.getTime() < value.getTime()) {
371
389
  state.userInput = [api.formatToString(value), api.formatToString(value)];
372
390
  newValue = [value, value];
373
391
  } else {
374
- state.userInput = [api.formatToString(value), api.formatToString(now)];
375
- newValue = [value, now];
392
+ state.userInput = [api.formatToString(value), ""];
393
+ newValue = [value, ""];
376
394
  }
377
395
  }
378
- state.picker.state.value = newValue;
379
396
  if (api.isValidValue(newValue)) {
397
+ state.picker.state.value = newValue;
398
+ state.historyUserInput = [value, state.picker.state.value && state.picker.state.value[1]];
399
+ state.historyUserValue = newValue;
380
400
  api.emitInput(newValue);
381
401
  state.userInput = null;
402
+ } else {
403
+ if (state.startStatus) {
404
+ state.picker.state.value = state.historyUserValue ? state.historyUserValue : state.historyValue;
405
+ api.emitInput(state.historyUserValue ? state.historyUserValue : state.historyValue);
406
+ state.userInput = state.historyUserInput ? state.historyUserInput : state.historyInput;
407
+ } else {
408
+ state.picker.state.value = newValue;
409
+ }
382
410
  }
383
411
  }
384
412
  };
@@ -389,8 +417,9 @@ const handleEndChange = ({ api, state }) => () => {
389
417
  if (state.displayValue[0]) {
390
418
  state.userInput = [state.displayValue[0], api.formatToString(value)];
391
419
  newValue = [state.picker.state.value && state.picker.state.value[0], value];
420
+ state.endStatus = true;
392
421
  } else {
393
- let now = /* @__PURE__ */ new Date();
422
+ let now = new Date();
394
423
  if (now.getTime() < value.getTime()) {
395
424
  state.userInput = [api.formatToString(now), api.formatToString(value)];
396
425
  newValue = [now, value];
@@ -399,10 +428,21 @@ const handleEndChange = ({ api, state }) => () => {
399
428
  newValue = [value, value];
400
429
  }
401
430
  }
402
- state.picker.state.value = newValue;
403
431
  if (api.isValidValue(newValue)) {
432
+ state.historyValue = newValue;
433
+ state.historyInput = [state.displayValue[0], api.formatToString(value)];
434
+ state.picker.state.value = newValue;
404
435
  api.emitInput(newValue);
405
436
  state.userInput = null;
437
+ } else {
438
+ if (state.endStatus) {
439
+ state.picker.state.value = state.historyValue;
440
+ api.emitInput(state.historyValue);
441
+ state.userInput = state.historyInput;
442
+ } else {
443
+ state.picker.state.value = state.historyValue;
444
+ state.userInput = state.historyInput;
445
+ }
406
446
  }
407
447
  }
408
448
  };
@@ -433,12 +473,12 @@ const handleClose = ({ api, props, state }) => () => {
433
473
  api.emitInput(oldValue);
434
474
  }
435
475
  };
436
- const handleFocus = ({ emit, refs, state }) => () => {
476
+ const handleFocus = ({ emit, vm, state }) => () => {
437
477
  const type = state.type;
438
478
  if (DATEPICKER.TriggerTypes.includes(type) && !state.pickerVisible) {
439
479
  state.pickerVisible = true;
440
480
  }
441
- emit("focus", refs.reference);
481
+ emit("focus", vm.$refs.reference);
442
482
  };
443
483
  const handleKeydown = ({ api, state }) => (event) => {
444
484
  const keyCode = event.keyCode;
@@ -662,6 +702,13 @@ const getType = ({ props }) => () => {
662
702
  return DATEPICKER.TimeSelect;
663
703
  };
664
704
  const watchModelValue = ({ api, props, state, dispatch }) => (value, oldValue) => {
705
+ state.historyInput = state.displayValue;
706
+ if (state.picker) {
707
+ state.historyValue = [
708
+ state.picker.state.value && state.picker.state.value[0],
709
+ api.parseString(state.historyInput && state.historyInput[1])
710
+ ];
711
+ }
665
712
  api.emitChange(props.modelValue);
666
713
  if (!valueEquals(value, oldValue) && !state.pickerVisible && props.validateEvent) {
667
714
  dispatch("FormItem", "form.change", value);
@@ -682,7 +729,7 @@ const computedFormat = ({ props, utils }) => () => {
682
729
  };
683
730
  const computedTriggerClass = ({ props, state }) => () => props.suffixIcon || props.prefixIcon || (state.type.includes(DATEPICKER.Time) ? DATEPICKER.IconTime : DATEPICKER.IconDate);
684
731
  const computedHaveTrigger = ({ props }) => () => typeof props.showTrigger !== "undefined" ? props.showTrigger : DATEPICKER.TriggerTypes.includes(props.type);
685
- const intiPopper = ({ props, hooks, vnode }) => {
732
+ const initPopper = ({ props, hooks, vnode }) => {
686
733
  const { reactive, watch, toRefs, onBeforeUnmount, onDeactivated } = hooks;
687
734
  const { emit, refs, slots, nextTick } = vnode;
688
735
  const placementMap = DATEPICKER.PlacementMap;
@@ -734,6 +781,27 @@ const initGlobalTimezone = ({ api, state, props }) => () => {
734
781
  }
735
782
  api.emitDbTime(props.value);
736
783
  };
784
+ const handleEnterDisplayOnlyContent = ({ state, t }) => ($event) => {
785
+ const target = $event.target;
786
+ if (target && target.scrollWidth > target.offsetWidth) {
787
+ state.displayOnlyTooltip = state.displayValue.join(` ${t("ui.datepicker.to")} `);
788
+ }
789
+ };
790
+ const handleEnterPickerlabel = ({ state, props }) => ($event) => {
791
+ const target = $event.target;
792
+ if (target && target.scrollWidth > target.offsetWidth) {
793
+ state.labelTooltip = props.label;
794
+ }
795
+ };
796
+ const setInputPaddingLeft = ({ props, state, vm, nextTick }) => () => {
797
+ const ml = 12;
798
+ const mr = 8;
799
+ if (props.label && !state.ranged && vm.$refs.label && vm.$refs.reference) {
800
+ nextTick(() => {
801
+ vm.$refs.reference.querySelector("input").style.paddingLeft = vm.$refs.label.offsetWidth + ml + mr + "px";
802
+ });
803
+ }
804
+ };
737
805
  export {
738
806
  blur,
739
807
  computedFormat,
@@ -762,6 +830,8 @@ export {
762
830
  handleClose,
763
831
  handleEndChange,
764
832
  handleEndInput,
833
+ handleEnterDisplayOnlyContent,
834
+ handleEnterPickerlabel,
765
835
  handleFocus,
766
836
  handleKeydown,
767
837
  handleMouseEnter,
@@ -771,7 +841,7 @@ export {
771
841
  handleStartInput,
772
842
  hidePicker,
773
843
  initGlobalTimezone,
774
- intiPopper,
844
+ initPopper,
775
845
  isValidValue,
776
846
  mountPicker,
777
847
  parseAsFormatAndType,
@@ -781,6 +851,7 @@ export {
781
851
  rangeFormatter,
782
852
  rangeParser,
783
853
  secondInputId,
854
+ setInputPaddingLeft,
784
855
  showPicker,
785
856
  typeValueResolveMap,
786
857
  updateOptions,