@opentiny/vue-renderless 3.13.2 → 3.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (320) hide show
  1. package/action-sheet/index.js +20 -13
  2. package/action-sheet/vue.js +8 -7
  3. package/amount/index.js +100 -25
  4. package/amount/vue.js +102 -26
  5. package/anchor/index.js +1 -0
  6. package/area/index.js +8 -8
  7. package/area/vue.js +5 -5
  8. package/async-flowchart/index.js +16 -3
  9. package/autocomplete/index.js +58 -14
  10. package/autocomplete/vue.js +40 -12
  11. package/badge/index.js +12 -0
  12. package/badge/vue.js +6 -4
  13. package/breadcrumb/vue.js +3 -1
  14. package/breadcrumb-item/vue.js +6 -2
  15. package/button/index.js +5 -1
  16. package/calendar/index.js +2 -86
  17. package/calendar-bar/index.js +18 -4
  18. package/calendar-view/index.js +5 -1
  19. package/calendar-view/vue.js +16 -3
  20. package/card-group/vue.js +4 -2
  21. package/cascader/index.js +86 -34
  22. package/cascader/vue.js +61 -20
  23. package/cascader-menu/index.js +7 -7
  24. package/cascader-menu/vue.js +2 -3
  25. package/cascader-mobile/index.js +36 -23
  26. package/cascader-mobile/vue.js +6 -0
  27. package/cascader-node/index.js +13 -1
  28. package/cascader-node/vue.js +15 -4
  29. package/cascader-panel/index.js +1 -1
  30. package/cascader-select/column-index.js +150 -0
  31. package/cascader-select/column.js +120 -0
  32. package/cascader-select/index.js +29 -165
  33. package/cascader-select/usePicker.js +251 -0
  34. package/cascader-select/useTouch.js +65 -0
  35. package/cascader-select/vue.js +35 -47
  36. package/cell/vue.js +2 -1
  37. package/chart-bar/index.js +2 -3
  38. package/chart-core/deps/constants.js +43 -43
  39. package/chart-core/index.js +1 -1
  40. package/chart-gauge/index.js +2 -2
  41. package/chart-heatmap/index.js +17 -10
  42. package/chart-line/index.js +8 -9
  43. package/chart-tree/index.js +2 -2
  44. package/chart-waterfall/index.js +4 -6
  45. package/checkbox/index.js +18 -1
  46. package/checkbox/vue.js +15 -7
  47. package/checkbox-group/vue.js +1 -0
  48. package/col/vue.js +1 -1
  49. package/collapse/index.js +3 -3
  50. package/color-select-panel/vue.js +0 -7
  51. package/column-list-item/index.js +17 -1
  52. package/column-list-item/vue.js +8 -3
  53. package/common/bigInt.js +2 -2
  54. package/common/date.js +7 -5
  55. package/common/deps/clickoutside.js +6 -2
  56. package/common/deps/date-util.js +4 -2
  57. package/common/deps/dom.js +19 -4
  58. package/common/deps/popper.js +44 -11
  59. package/common/deps/resize-event.js +1 -0
  60. package/common/deps/touch-emulator.js +4 -1
  61. package/common/deps/tree-model/node.js +2 -2
  62. package/common/deps/tree-model/tree-store.js +2 -13
  63. package/common/deps/useRect.js +25 -0
  64. package/common/deps/vue-popper.js +38 -20
  65. package/common/index.js +2 -2
  66. package/common/runtime.js +1 -1
  67. package/common/string.js +2 -2
  68. package/common/type.js +2 -1
  69. package/common/validate/rules/enum.js +1 -1
  70. package/common/validate/rules/pattern.js +2 -2
  71. package/common/validate/rules/range.js +8 -5
  72. package/common/validate/rules/required.js +1 -1
  73. package/common/validate/rules/type.js +5 -5
  74. package/common/validate/rules/whitespace.js +1 -1
  75. package/common/validate/util.js +15 -16
  76. package/common/validate/validations/integer.js +1 -1
  77. package/common/validate/validations/method.js +1 -1
  78. package/currency/index.js +74 -7
  79. package/currency/vue.js +21 -5
  80. package/date-panel/index.js +16 -0
  81. package/date-panel/vue.js +8 -2
  82. package/date-picker-mobile/index.js +12 -0
  83. package/date-picker-mobile/vue.js +7 -1
  84. package/date-range/vue.js +15 -6
  85. package/date-table/index.js +35 -53
  86. package/date-table/vue.js +4 -2
  87. package/dialog-box/index.js +46 -14
  88. package/dialog-box/vue.js +30 -7
  89. package/dialog-select/index.js +6 -3
  90. package/dialog-select/vue.js +8 -4
  91. package/drawer/index.js +27 -5
  92. package/drawer/vue.js +14 -7
  93. package/dropdown/index.js +7 -7
  94. package/dropdown/vue.js +6 -2
  95. package/dropdown-item/index.js +9 -1
  96. package/dropdown-item/mf.js +6 -10
  97. package/dropdown-item/vue.js +20 -7
  98. package/dropdown-menu/index.js +20 -7
  99. package/dropdown-menu/vue.js +4 -3
  100. package/exception/index.js +2 -7
  101. package/exception/vue.js +7 -10
  102. package/fall-menu/index.js +5 -1
  103. package/fall-menu/vue.js +13 -2
  104. package/file-upload/index.js +68 -18
  105. package/file-upload/vue.js +38 -8
  106. package/filter-box/index.js +1 -0
  107. package/float-button/index.js +42 -0
  108. package/float-button/vue.js +101 -0
  109. package/floating-button/index.js +62 -16
  110. package/floating-button/vue.js +27 -9
  111. package/flowchart/index.js +134 -25
  112. package/flowchart/node.js +13 -4
  113. package/flowchart/vue.js +16 -4
  114. package/form/vue.js +8 -0
  115. package/form-item/index.js +5 -5
  116. package/form-item/vue.js +3 -1
  117. package/fullscreen/index.js +5 -5
  118. package/fullscreen/vue.js +3 -3
  119. package/grid/plugins/export.js +5 -2
  120. package/grid/utils/column.js +1 -0
  121. package/grid/utils/dom.js +7 -1
  122. package/image/index.js +6 -1
  123. package/image/vue.js +6 -3
  124. package/image-viewer/index.js +62 -51
  125. package/image-viewer/vue.js +17 -5
  126. package/input/index.js +81 -20
  127. package/input/vue.js +44 -18
  128. package/ip-address/index.js +61 -19
  129. package/ip-address/vue.js +22 -4
  130. package/link/vue.js +3 -1
  131. package/loading/index.js +2 -2
  132. package/loading/vue.js +8 -2
  133. package/logout/index.js +1 -1
  134. package/menu/index.js +15 -2
  135. package/menu/vue.js +22 -17
  136. package/mind-map/index.js +47 -0
  137. package/mind-map/vue.js +53 -0
  138. package/modal/index.js +44 -4
  139. package/modal/vue.js +18 -4
  140. package/multi-select/index.js +186 -11
  141. package/multi-select/vue.js +60 -15
  142. package/multi-select-item/index.js +23 -0
  143. package/multi-select-item/vue.js +31 -0
  144. package/numeric/index.js +48 -12
  145. package/numeric/vue.js +44 -19
  146. package/option/index.js +27 -9
  147. package/option/vue.js +37 -21
  148. package/option-group/index.js +3 -3
  149. package/package.json +1 -1
  150. package/pager/index.js +18 -4
  151. package/pager/vue.js +16 -5
  152. package/picker/index.js +290 -77
  153. package/picker/mb.js +42 -0
  154. package/picker/vue.js +76 -20
  155. package/picker-column/index.js +1 -1
  156. package/pop-upload/vue.js +3 -0
  157. package/popconfirm/index.js +3 -6
  158. package/popconfirm/vue.js +1 -1
  159. package/popeditor/index.js +73 -34
  160. package/popeditor/vue.js +15 -11
  161. package/popover/index.js +4 -4
  162. package/popover/vue.js +6 -6
  163. package/popup/index.js +3 -3
  164. package/popup/vue.js +5 -5
  165. package/pull-refresh/index.js +13 -13
  166. package/pull-refresh/vue.js +5 -4
  167. package/radio/index.js +0 -17
  168. package/radio/vue.js +4 -10
  169. package/rate/index.js +1 -1
  170. package/rate/vue.js +0 -2
  171. package/record/index.js +4 -1
  172. package/rich-text/clipboard.js +54 -0
  173. package/rich-text/index.js +192 -0
  174. package/rich-text/module/file-upload.js +107 -0
  175. package/rich-text/module/image-drop.js +63 -0
  176. package/rich-text/module/image-upload.js +89 -0
  177. package/rich-text/options.js +141 -0
  178. package/rich-text/table-module.js +382 -0
  179. package/rich-text/vue.js +102 -0
  180. package/{rich-text-edtior → rich-text-editor}/index.js +2 -2
  181. package/{rich-text-edtior → rich-text-editor}/vue.js +2 -5
  182. package/scrollbar/index.js +11 -11
  183. package/scrollbar/vue-bar.js +3 -3
  184. package/scrollbar/vue.js +5 -5
  185. package/search/index.js +9 -9
  186. package/search/vue.js +8 -6
  187. package/select/index.js +442 -393
  188. package/select/vue.js +278 -164
  189. package/select-dropdown/index.js +61 -3
  190. package/select-dropdown/vue.js +85 -8
  191. package/select-view/index.js +3 -1
  192. package/selected-box/index.js +2 -0
  193. package/selected-box/vue.js +6 -3
  194. package/signature/index.js +241 -0
  195. package/signature/vue.js +88 -0
  196. package/skeleton/index.js +14 -0
  197. package/skeleton/vue.js +15 -0
  198. package/skeleton-item/vue.js +15 -0
  199. package/slider/index.js +70 -17
  200. package/slider/vue.js +16 -7
  201. package/split/index.js +5 -3
  202. package/split/vue.js +4 -6
  203. package/standard-list-item/index.js +15 -1
  204. package/standard-list-item/vue.js +6 -5
  205. package/steps/index.js +25 -2
  206. package/steps/slide-bar.js +8 -1
  207. package/steps/vue.js +15 -3
  208. package/tab-item-mf/vue.js +14 -8
  209. package/tab-nav/index.js +30 -5
  210. package/tab-nav/vue.js +16 -4
  211. package/tabbar/vue.js +9 -3
  212. package/tabbar-item/vue.js +3 -2
  213. package/tabs/index.js +16 -4
  214. package/tabs/vue.js +2 -1
  215. package/tabs-mf/index.js +20 -6
  216. package/tabs-mf/vue-nav.js +26 -11
  217. package/tabs-mf/vue.js +7 -7
  218. package/tabs-mf/wheel.js +1 -0
  219. package/tag/index.js +1 -1
  220. package/tag-group/index.js +2 -1
  221. package/time/index.js +5 -2
  222. package/time/vue.js +1 -1
  223. package/time-line/index.js +3 -3
  224. package/time-line/vue.js +2 -2
  225. package/time-picker-mobile/index.js +24 -5
  226. package/time-picker-mobile/vue.js +17 -7
  227. package/time-range/index.js +2 -0
  228. package/timeline-item/vue.js +1 -1
  229. package/tooltip/index.js +6 -3
  230. package/tooltip/vue.js +4 -4
  231. package/transfer/index.js +20 -22
  232. package/transfer/vue.js +1 -6
  233. package/transfer-panel/vue.js +3 -5
  234. package/tree/index.js +21 -4
  235. package/tree/vue.js +10 -8
  236. package/tree-menu/index.js +29 -3
  237. package/tree-menu/vue.js +28 -15
  238. package/tree-node/index.js +18 -18
  239. package/tree-node/vue.js +6 -5
  240. package/types/action-sheet.type.d.ts +118 -1
  241. package/types/amount.type.d.ts +168 -1
  242. package/types/area.type.d.ts +134 -1
  243. package/types/async-flowchart.type.d.ts +72 -0
  244. package/types/autocomplete.type.d.ts +199 -1
  245. package/types/badge.type.d.ts +3 -1
  246. package/types/breadcrumb-item.type.d.ts +2 -0
  247. package/types/breadcrumb.type.d.ts +2 -0
  248. package/types/button-group.type.d.ts +3 -3
  249. package/types/button.type.d.ts +4 -0
  250. package/types/cascader-menu.type.d.ts +3 -4
  251. package/types/cascader-node.type.d.ts +5 -2
  252. package/types/cascader-panel.type-2bd03be3.d.ts +241 -0
  253. package/types/cascader-panel.type.d.ts +3 -241
  254. package/types/cascader.type.d.ts +329 -1
  255. package/types/checkbox.type.d.ts +6 -0
  256. package/types/collapse.type.d.ts +19 -2
  257. package/types/date-picker.type.d.ts +38 -1
  258. package/types/dialog-box.type.d.ts +13 -3
  259. package/types/drawer.type.d.ts +133 -1
  260. package/types/{dropdown-item.type-8ea6c633.d.ts → dropdown-item.type-8475a549.d.ts} +7 -13
  261. package/types/dropdown-item.type.d.ts +1 -1
  262. package/types/dropdown-menu.type.d.ts +1 -1
  263. package/types/dropdown.type.d.ts +1 -5
  264. package/types/fall-menu.type.d.ts +94 -1
  265. package/types/file-upload.type.d.ts +1 -1
  266. package/types/float-button.type.d.ts +123 -0
  267. package/types/form-item.type.d.ts +1 -1
  268. package/types/{form.type-d0fd42f3.d.ts → form.type-a2dc0099.d.ts} +4 -1
  269. package/types/form.type.d.ts +1 -1
  270. package/types/{index-e0250f63.d.ts → index-b012f687.d.ts} +9 -0
  271. package/types/input.type.d.ts +2 -6
  272. package/types/ip-address.type.d.ts +160 -1
  273. package/types/link.type.d.ts +6 -3
  274. package/types/loading.type.d.ts +7 -0
  275. package/types/mind-map.type.d.ts +20 -0
  276. package/types/modal.type.d.ts +29 -2
  277. package/types/numeric.type.d.ts +41 -10
  278. package/types/pager.type.d.ts +12 -0
  279. package/types/picker.type.d.ts +18 -0
  280. package/types/popconfirm.type.d.ts +86 -1
  281. package/types/popeditor.type.d.ts +4 -0
  282. package/types/popover.type.d.ts +3 -3
  283. package/types/progress.type.d.ts +2 -0
  284. package/types/radio.type.d.ts +0 -4
  285. package/types/rate.type.d.ts +236 -1
  286. package/types/search.type.d.ts +88 -1
  287. package/types/shared.type.d.ts +1 -1
  288. package/types/skeleton-item.type.d.ts +38 -0
  289. package/types/skeleton.type.d.ts +45 -0
  290. package/types/slider.type.d.ts +49 -10
  291. package/types/steps.type.d.ts +14 -3
  292. package/types/tab-bar.type.d.ts +1 -1
  293. package/types/tab-nav.type.d.ts +7 -2
  294. package/types/tabs.type.d.ts +9 -1
  295. package/types/tag-group.type.d.ts +64 -1
  296. package/types/{time-line.type-d7daa669.d.ts → time-line.type-b155cb4f.d.ts} +12 -0
  297. package/types/time-line.type.d.ts +1 -1
  298. package/types/timeline-item.type.d.ts +1 -1
  299. package/types/tooltip.type.d.ts +2 -2
  300. package/types/transfer.type.d.ts +185 -1
  301. package/types/tree-menu.type.d.ts +210 -1
  302. package/types/upload-dragger.type.d.ts +1 -1
  303. package/types/{upload-list.type-343e8c11.d.ts → upload-list.type-6d6e3d0e.d.ts} +35 -8
  304. package/types/upload-list.type.d.ts +1 -1
  305. package/types/upload.type.d.ts +1 -1
  306. package/types/user-head.type.d.ts +146 -1
  307. package/types/wizard.type.d.ts +1 -0
  308. package/upload/index.js +64 -34
  309. package/upload/vue.js +9 -5
  310. package/upload-dragger/index.js +22 -20
  311. package/upload-list/index.js +24 -18
  312. package/upload-list/vue.js +9 -4
  313. package/user/index.js +35 -26
  314. package/user/vue.js +1 -1
  315. package/user-head/index.js +3 -3
  316. package/watermark/index.js +11 -0
  317. package/wheel/index.js +3 -0
  318. package/wizard/vue.js +4 -2
  319. package/common/deps/modal-queue.js +0 -6
  320. package/common/deps/requestAnimationFrame.js +0 -25
package/numeric/vue.js CHANGED
@@ -25,7 +25,10 @@ import {
25
25
  initService,
26
26
  dispatchDisplayedValue,
27
27
  getDisplayedValue,
28
- getDisplayOnlyText
28
+ getDisplayOnlyText,
29
+ filterValue,
30
+ handleClear,
31
+ handleChange
29
32
  } from "./index";
30
33
  const api = [
31
34
  "state",
@@ -37,9 +40,19 @@ const api = [
37
40
  "handleInputChange",
38
41
  "mouseEvent",
39
42
  "focus",
40
- "select"
43
+ "select",
44
+ "handleClear",
45
+ "handleChange"
41
46
  ];
42
- const initState = ({ reactive, computed, props, api: api2, $service, parent }) => {
47
+ const initState = ({
48
+ reactive,
49
+ computed,
50
+ props,
51
+ api: api2,
52
+ $service,
53
+ constants,
54
+ parent
55
+ }) => {
43
56
  const state = reactive({
44
57
  currentValue: props.modelValue,
45
58
  userInput: props.modelValue,
@@ -57,8 +70,13 @@ const initState = ({ reactive, computed, props, api: api2, $service, parent }) =
57
70
  maxDisabled: computed(() => !props.circulate && state.currentValue >= props.max || state.formDisabled),
58
71
  controlsAtRight: computed(() => props.controls && props.controlsPosition === "right"),
59
72
  format: computed(() => getUnitPrecision({ service: $service, props })),
73
+ filterMenu: constants.FILTER_OPTION,
74
+ filterValue: computed(() => api2.filterValue()),
75
+ handleClear: computed(() => api2.handleClear()),
76
+ handleChange: computed(() => api2.handleClear()),
60
77
  isDisplayOnly: computed(() => props.displayOnly || (parent.tinyForm || {}).displayOnly),
61
- displayOnlyText: computed(() => api2.getDisplayOnlyText())
78
+ displayOnlyText: computed(() => api2.getDisplayOnlyText()),
79
+ controls: props.controls
62
80
  });
63
81
  return state;
64
82
  };
@@ -67,7 +85,7 @@ const initApi = ({
67
85
  props,
68
86
  state,
69
87
  parent,
70
- refs,
88
+ vm,
71
89
  emit,
72
90
  dispatch,
73
91
  constants,
@@ -75,30 +93,33 @@ const initApi = ({
75
93
  }) => {
76
94
  Object.assign(api2, {
77
95
  state,
78
- focus: focus(refs),
79
- select: select(refs),
96
+ focus: focus(vm),
97
+ select: select(vm),
80
98
  getPrecision: getPrecision(),
81
99
  toPrecision: toPrecision(state),
82
100
  updated: updated({ constants, parent, state }),
83
101
  mounted: mounted({ constants, parent, props, state }),
84
102
  unmounted: unmounted({ parent, state }),
85
103
  getDecimal: getDecimal(props),
86
- handleFocus: handleFocus({ emit, state, props, api: api2, refs }),
104
+ handleFocus: handleFocus({ emit, state, props, api: api2, vm }),
87
105
  decrease: decrease({ api: api2, props, state }),
88
106
  increase: increase({ api: api2, props, state }),
89
107
  handleInput: handleInput({ state, api: api2, emit, props }),
90
108
  getNumPecision: getNumPecision({ api: api2, props }),
91
- displayValue: displayValue({ props, state }),
109
+ displayValue: displayValue({ props, state, api: api2 }),
92
110
  internalDecrease: internalDecrease({ api: api2, state }),
93
111
  internalIncrease: internalIncrease({ api: api2, state }),
94
112
  handleInputChange: handleInputChange({ api: api2, state, props }),
95
113
  mouseEvent: mouseEvent({ api: api2, props, state }),
96
114
  handleBlur: handleBlur({ constants, dispatch, emit, props, state, api: api2 }),
97
- watchValue: watchValue({ api: api2, state, nextTick }),
115
+ watchValue: watchValue({ api: api2, props, state, nextTick }),
98
116
  setCurrentValue: setCurrentValue({ api: api2, constants, dispatch, emit, props, state }),
99
117
  dispatchDisplayedValue: dispatchDisplayedValue({ api: api2, state, dispatch }),
100
118
  getDisplayedValue: getDisplayedValue({ state, props }),
101
- getDisplayOnlyText: getDisplayOnlyText({ parent, props, state })
119
+ getDisplayOnlyText: getDisplayOnlyText({ parent, props, state }),
120
+ filterValue: filterValue({ state }),
121
+ handleClear: handleClear({ state, emit }),
122
+ handleChange: handleChange({ state, emit })
102
123
  });
103
124
  api2.getDecimal(0);
104
125
  };
@@ -108,20 +129,24 @@ const initWatch = ({
108
129
  props,
109
130
  api: api2
110
131
  }) => {
111
- watch(() => [props.max, props.min], ([curMax, curMin]) => {
112
- if (curMax < curMin) {
113
- throw new Error("[Numeric]: The maximum value should not be less than to the minimum value");
114
- }
115
- }, { immediate: true });
132
+ watch(
133
+ () => [props.max, props.min],
134
+ ([curMax, curMin]) => {
135
+ if (curMax < curMin) {
136
+ throw new Error("[Numeric]: The maximum value should not be less than to the minimum value");
137
+ }
138
+ },
139
+ { immediate: true }
140
+ );
116
141
  watch(() => props.modelValue, api2.watchValue, { immediate: true });
117
142
  watch(() => state.isDisplayOnly, api2.dispatchDisplayedValue);
118
143
  };
119
- const renderless = (props, { computed, onMounted, onUpdated, onUnmounted, reactive, watch, inject }, { parent, emit, refs, constants, dispatch, service, nextTick }) => {
144
+ const renderless = (props, { computed, onMounted, onUpdated, onUnmounted, reactive, watch, inject }, { parent, emit, vm, constants, dispatch, service, nextTick }) => {
120
145
  const api2 = {};
121
146
  const $service = initService(service);
122
- const state = initState({ reactive, computed, props, api: api2, $service, parent });
147
+ const state = initState({ reactive, computed, props, api: api2, constants, $service, parent });
123
148
  parent.tinyForm = parent.tinyForm || inject("form", null);
124
- initApi({ api: api2, props, state, parent, refs, emit, dispatch, constants, nextTick });
149
+ initApi({ api: api2, props, state, parent, vm, emit, dispatch, constants, nextTick });
125
150
  initWatch({ state, watch, props, api: api2 });
126
151
  onMounted(() => {
127
152
  api2.dispatchDisplayedValue();
package/option/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
2
  import { getObj } from "../common/object";
3
+ import { omitText } from "../common/string";
3
4
  const escapeRegexpString = (value = "") => String(value).replace(/[|\\{}()[\]^$+*?.]/g, "\\$&");
4
5
  const isEqual = ({ select, state }) => (a, b) => {
5
6
  if (!state.isObject) {
@@ -14,15 +15,26 @@ const contains = ({ select, state }) => (arr = [], target = null) => {
14
15
  return arr && arr.includes(target);
15
16
  } else {
16
17
  const valueKey = select.valueKey;
17
- return arr && arr.some((item) => getObj(item, valueKey) === getObj(target, valueKey));
18
+ return arr && arr.some((item) => {
19
+ return getObj(item, valueKey) === getObj(target, valueKey);
20
+ });
18
21
  }
19
22
  };
20
- const handleGroupDisabled = (state) => (val) => {
23
+ const handleGroupDisabled = ({ state, vm }) => (val) => {
21
24
  state.groupDisabled = val;
25
+ vm.groupDisabled = val;
22
26
  };
23
- const hoverItem = ({ select, props, state, vm }) => () => {
24
- if (!props.disabled && !state.groupDisabled) {
25
- select.state.hoverIndex = select.state.options.indexOf(vm);
27
+ const hoverItem = ({ select, props, state }) => (e) => {
28
+ const dom = e.target;
29
+ const text = dom.textContent;
30
+ const style = window.getComputedStyle(dom);
31
+ const font = style.font;
32
+ const rect = dom.getBoundingClientRect();
33
+ const textWidth = rect.width - parseInt(style.paddingLeft || 0) - parseInt(style.paddingRight || 0);
34
+ const res = omitText(text, font, textWidth);
35
+ state.showTitle = res.o;
36
+ if (!props.disabled && !state.groupDisabled && !select.state.disabledOptionHover) {
37
+ select.state.hoverIndex = select.state.optionIndexArr.indexOf(state.index);
26
38
  }
27
39
  };
28
40
  const selectOptionClick = ({ props, state, select, constants, vm }) => () => {
@@ -32,14 +44,19 @@ const selectOptionClick = ({ props, state, select, constants, vm }) => () => {
32
44
  select.state.selectEmitter.emit(constants.EVENT_NAME.handleOptionClick, vm, true);
33
45
  }
34
46
  };
35
- const queryChange = ({ props, state }) => (query) => {
36
- state.visible = new RegExp(escapeRegexpString(query), "i").test(state.currentLabel) || props.created;
47
+ const queryChange = ({ select, props, state }) => (query) => {
48
+ const oldVisible = state.visible;
49
+ const newVisible = new RegExp(escapeRegexpString(query), "i").test(state.currentLabel) || !!props.created;
50
+ if (oldVisible !== newVisible) {
51
+ state.visible = newVisible;
52
+ select.state.filteredOptionsCount += newVisible ? 1 : -1;
53
+ }
37
54
  };
38
55
  const toggleEvent = ({ props, vm, type }) => {
39
56
  const optionEl = vm.$refs.option;
40
- Object.keys(props.events).forEach((ev) => {
57
+ for (let ev in props.events) {
41
58
  optionEl[type + "EventListener"](ev, props.events[ev]);
42
- });
59
+ }
43
60
  };
44
61
  const initValue = ({ select, props, constants, vm }) => () => {
45
62
  if (select.multiple && props.required) {
@@ -48,6 +65,7 @@ const initValue = ({ select, props, constants, vm }) => () => {
48
65
  };
49
66
  export {
50
67
  contains,
68
+ escapeRegexpString,
51
69
  handleGroupDisabled,
52
70
  hoverItem,
53
71
  initValue,
package/option/vue.js CHANGED
@@ -1,4 +1,7 @@
1
- import "../chunk-G2ADBYYC.js";
1
+ import {
2
+ __spreadProps,
3
+ __spreadValues
4
+ } from "../chunk-G2ADBYYC.js";
2
5
  import {
3
6
  isEqual,
4
7
  contains,
@@ -16,30 +19,33 @@ const initState = ({ reactive, computed, props, api: api2, markRaw, select, pare
16
19
  created: computed(() => props.created),
17
20
  index: -1,
18
21
  select: markRaw(select),
19
- hover: false,
22
+ hover: computed(() => !state.select.optimization && state.select.state.hoverValue === state.index),
20
23
  visible: true,
21
24
  hitState: false,
22
25
  groupDisabled: false,
23
- disabled: computed(() => props.disabled),
26
+ disabled: computed(() => props.disabled || state.groupDisabled),
24
27
  isObject: computed(() => Object.prototype.toString.call(props.value).toLowerCase() === "[object object]"),
25
28
  currentLabel: computed(() => props.label || (state.isObject ? "" : props.value)),
29
+ showTitle: false,
26
30
  currentValue: computed(() => props.value || props.label || ""),
27
31
  itemSelected: computed(() => {
28
32
  if (!select.multiple) {
29
- return api2.isEqual(props.value, select.modelValue);
33
+ return api2.isEqual(props.value, select.state.modelValue);
30
34
  } else {
31
- return api2.contains(select.modelValue, props.value);
35
+ return api2.contains(select.state.modelValue, props.value);
32
36
  }
33
37
  }),
34
38
  limitReached: computed(() => {
35
39
  if (select.multiple) {
36
40
  const multipleLimit = select.state.multipleLimit;
37
- return !state.itemSelected && (select.modelValue || []).length >= multipleLimit && multipleLimit > 0;
41
+ return !state.itemSelected && (select.state.modelValue || []).length >= multipleLimit && multipleLimit > 0;
38
42
  } else {
39
43
  return false;
40
44
  }
41
45
  }),
42
- selectCls: computed(() => state.itemSelected ? "checked-sur" : "check")
46
+ selectCls: computed(() => {
47
+ return state.itemSelected ? "checked-sur" : "check";
48
+ })
43
49
  });
44
50
  return state;
45
51
  };
@@ -48,10 +54,10 @@ const initApi = ({ api: api2, props, state, select, constants, vm }) => {
48
54
  state,
49
55
  isEqual: isEqual({ select, state }),
50
56
  contains: contains({ select, state }),
51
- hoverItem: hoverItem({ select, vm, props, state }),
52
- queryChange: queryChange({ props, state }),
57
+ hoverItem: hoverItem({ select, props, state }),
58
+ queryChange: queryChange({ select, props, state }),
53
59
  selectOptionClick: selectOptionClick({ constants, vm, props, state, select }),
54
- handleGroupDisabled: handleGroupDisabled(state),
60
+ handleGroupDisabled: handleGroupDisabled({ state, vm }),
55
61
  initValue: initValue({ select, props, constants, vm })
56
62
  });
57
63
  };
@@ -87,20 +93,33 @@ const initOnMounted = ({ onMounted, props, api: api2, vm, state, constants, sele
87
93
  onMounted(() => {
88
94
  state.el = vm.$el;
89
95
  toggleEvent({ props, vm, type: "add" });
90
- select.state.selectEmitter.on(constants.EVENT_NAME.queryChange, api2.queryChange);
96
+ if (!select.optimization) {
97
+ select.state.selectEmitter.on(constants.EVENT_NAME.queryChange, api2.queryChange);
98
+ }
91
99
  api2.initValue();
92
100
  });
93
101
  };
94
- const initOnBeforeUnmount = ({ onBeforeUnmount, props, select, vm }) => {
102
+ const initOnBeforeUnmount = ({ onBeforeUnmount, props, select, vm, state }) => {
95
103
  onBeforeUnmount(() => {
96
- const index = select.state.cachedOptions.indexOf(vm);
104
+ let selectedOptions = select.multiple ? select.state.selected : [select.state.selected];
105
+ const index = select.state.cachedOptions.findIndex((opt) => opt.state === state);
106
+ const selectedIndex = selectedOptions.findIndex((opt) => opt.state === state);
97
107
  toggleEvent({ props, vm, type: "remove" });
98
- if (index === -1) {
108
+ if (index > -1 && selectedIndex < 0) {
99
109
  select.state.cachedOptions.splice(index, 1);
100
110
  }
101
- select.onOptionDestroy(select.state.options.indexOf(vm));
111
+ select.onOptionDestroy(select.state.options.findIndex((opt) => opt.state === state));
102
112
  });
103
113
  };
114
+ const initSelectState = ({ state, select, markRaw, props }) => {
115
+ let vm = __spreadProps(__spreadValues({}, props), { state });
116
+ select.state.options.push(markRaw(vm));
117
+ select.state.cachedOptions.push(markRaw(vm));
118
+ select.state.optionsIndex++;
119
+ state.index = select.state.optionsIndex;
120
+ select.state.optionsCount++;
121
+ select.state.filteredOptionsCount++;
122
+ };
104
123
  const renderless = (props, { computed, onMounted, onBeforeUnmount, reactive, watch, inject, markRaw }, { vm, parent }) => {
105
124
  const api2 = {};
106
125
  const select = inject("select");
@@ -109,12 +128,9 @@ const renderless = (props, { computed, onMounted, onBeforeUnmount, reactive, wat
109
128
  initApi({ api: api2, props, state, select, constants, vm });
110
129
  initWatch({ watch, props, state, select, constants });
111
130
  initOnMounted({ onMounted, props, api: api2, vm, state, constants, select });
112
- initOnBeforeUnmount({ onBeforeUnmount, props, select, vm });
113
- select.state.options.push(markRaw(vm));
114
- select.state.cachedOptions.push(markRaw(vm));
115
- select.state.optionsCount++;
116
- select.state.filteredOptionsCount++;
117
- vm.$on(constants.EVENT_NAME.handleGroupDisabled, api2.handleGroupDisabled);
131
+ initOnBeforeUnmount({ onBeforeUnmount, props, select, vm, state });
132
+ initSelectState({ state, select, markRaw, props });
133
+ parent.$on(constants.EVENT_NAME.handleGroupDisabled, api2.handleGroupDisabled);
118
134
  return api2;
119
135
  };
120
136
  export {
@@ -2,9 +2,9 @@ import "../chunk-G2ADBYYC.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(
6
- (option) => option.state.parent && vm && option.state.parent.label === vm.label
7
- );
5
+ const groupOptions = select.state.options.filter((option) => {
6
+ return option.state.parent.$parent && vm && option.state.parent.$parent.label === vm.label;
7
+ });
8
8
  if (Array.isArray(groupOptions)) {
9
9
  state.visible = groupOptions.some((option) => option.visible === true);
10
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/vue-renderless",
3
- "version": "3.13.2",
3
+ "version": "3.14.1",
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": [
package/pager/index.js CHANGED
@@ -34,11 +34,11 @@ const computedTotalText = ({ props, t }) => () => {
34
34
  const HUNDRED_THOUSAND = 1e5;
35
35
  const MILLION = 1e6;
36
36
  const TEN_MILLION = 1e7;
37
- if (totals <= HUNDRED_THOUSAND) {
37
+ if (totals < HUNDRED_THOUSAND) {
38
38
  return String(totals);
39
- } else if (totals <= MILLION) {
39
+ } else if (totals < MILLION) {
40
40
  return t("ui.page.hundredThousand");
41
- } else if (totals <= TEN_MILLION) {
41
+ } else if (totals < TEN_MILLION) {
42
42
  return t("ui.page.million");
43
43
  } else {
44
44
  return t("ui.page.tenMillion");
@@ -61,7 +61,7 @@ const watchInternalCurrentPage = ({ state, emit }) => (currentPage) => {
61
61
  if (state.jumperValue !== value) {
62
62
  state.jumperValue = value;
63
63
  }
64
- emit("update:currentPage", currentPage);
64
+ emit("update:current-page", currentPage);
65
65
  emit("current-change", currentPage);
66
66
  state.lastEmittedPage = -1;
67
67
  };
@@ -89,6 +89,17 @@ const watchPageSize = ({ state }) => (pageSize) => {
89
89
  const watchTotal = ({ state }) => (total) => {
90
90
  state.internalTotal = total;
91
91
  };
92
+ const watchShowSizes = ({ nextTick, vm }) => (newVal) => {
93
+ if (newVal) {
94
+ nextTick(() => {
95
+ const width = vm.$refs.pageSize[0].getBoundingClientRect().width;
96
+ const popover = document.querySelectorAll(".tiny-pager__selector");
97
+ Array.from(popover).forEach((ele) => {
98
+ ele.style.width = width + "px";
99
+ });
100
+ });
101
+ }
102
+ };
92
103
  const handleSizeChange = ({ props, state, api, emit, vm }) => (val) => {
93
104
  val = Number(val);
94
105
  if (val !== state.internalPageSize) {
@@ -322,6 +333,7 @@ const emitChange = ({ state, nextTick, emit }) => () => {
322
333
  const setTotal = ({ state }) => (val) => {
323
334
  state.internalTotal = val;
324
335
  };
336
+ const clickSizes = () => (e) => e.stopPropagation();
325
337
  export {
326
338
  beforeChangeHandler,
327
339
  beforeJumperChangeHandler,
@@ -329,6 +341,7 @@ export {
329
341
  beforeSizeChangeHandler,
330
342
  buildBeforePageChangeParam,
331
343
  canJumperGo,
344
+ clickSizes,
332
345
  computedInternalLayout,
333
346
  computedInternalPageCount,
334
347
  computedShowPager,
@@ -354,5 +367,6 @@ export {
354
367
  watchInternalPageCount,
355
368
  watchPageSize,
356
369
  watchPageSizes,
370
+ watchShowSizes,
357
371
  watchTotal
358
372
  };
package/pager/vue.js CHANGED
@@ -25,12 +25,14 @@ import {
25
25
  getValidCurrentPage,
26
26
  emitChange,
27
27
  setTotal,
28
+ clickSizes,
28
29
  watchInternalCurrentPage,
29
30
  watchPageSizes,
30
31
  watchCurrentPage,
31
32
  watchInternalPageCount,
32
33
  watchPageSize,
33
- watchTotal
34
+ watchTotal,
35
+ watchShowSizes
34
36
  } from "./index";
35
37
  const api = [
36
38
  "state",
@@ -54,9 +56,11 @@ const api = [
54
56
  "buildBeforePageChangeParam",
55
57
  "getValidCurrentPage",
56
58
  "emitChange",
57
- "setTotal"
59
+ "setTotal",
60
+ "clickSizes"
58
61
  ];
59
- const renderless = (props, { reactive, computed, watch }, { emit, vm, nextTick, t }) => {
62
+ const renderless = (props, { reactive, computed, watch }, { emit, vm, nextTick, t, designConfig }) => {
63
+ var _a, _b, _c, _d, _e, _f, _g;
60
64
  const api2 = {};
61
65
  const state = reactive({
62
66
  showSizes: false,
@@ -70,7 +74,11 @@ const renderless = (props, { reactive, computed, watch }, { emit, vm, nextTick,
70
74
  showPager: computed(() => api2.computedShowPager()),
71
75
  internalLayout: computed(() => api2.computedInternalLayout()),
72
76
  totalText: computed(() => api2.computedTotalText()),
73
- internalPageCount: computed(() => api2.computedInternalPageCount())
77
+ internalPageCount: computed(() => api2.computedInternalPageCount()),
78
+ showJumperSufix: (_b = (_a = designConfig == null ? void 0 : designConfig.state) == null ? void 0 : _a.showJumperSufix) != null ? _b : true,
79
+ align: props.align || ((_c = designConfig == null ? void 0 : designConfig.state) == null ? void 0 : _c.align) || "left",
80
+ totalI18n: ((_d = designConfig == null ? void 0 : designConfig.state) == null ? void 0 : _d.totalI18n) || "totals",
81
+ totalFixedLeft: (_g = (_f = props.totalFixedLeft) != null ? _f : (_e = designConfig == null ? void 0 : designConfig.state) == null ? void 0 : _e.totalFixedLeft) != null ? _g : false
74
82
  });
75
83
  Object.assign(api2, {
76
84
  state,
@@ -99,13 +107,15 @@ const renderless = (props, { reactive, computed, watch }, { emit, vm, nextTick,
99
107
  buildBeforePageChangeParam: buildBeforePageChangeParam({ state }),
100
108
  emitChange: emitChange({ state, nextTick, emit }),
101
109
  setTotal: setTotal({ state }),
110
+ clickSizes: clickSizes(),
102
111
  // watch
103
112
  watchInternalCurrentPage: watchInternalCurrentPage({ state, emit }),
104
113
  watchPageSizes: watchPageSizes({ state, props }),
105
114
  watchCurrentPage: watchCurrentPage({ state, api: api2 }),
106
115
  watchInternalPageCount: watchInternalPageCount({ state, api: api2 }),
107
116
  watchPageSize: watchPageSize({ state }),
108
- watchTotal: watchTotal({ state })
117
+ watchTotal: watchTotal({ state }),
118
+ watchShowSizes: watchShowSizes({ nextTick, vm })
109
119
  });
110
120
  state.internalCurrentPage = api2.getValidCurrentPage(props.currentPage);
111
121
  watch(() => state.internalCurrentPage, api2.watchInternalCurrentPage);
@@ -114,6 +124,7 @@ const renderless = (props, { reactive, computed, watch }, { emit, vm, nextTick,
114
124
  watch(() => state.internalPageCount, api2.watchInternalPageCount);
115
125
  watch(() => props.pageSize, api2.watchPageSize, { immediate: true });
116
126
  watch(() => props.total, api2.watchTotal);
127
+ watch(() => state.showSizes, api2.watchShowSizes);
117
128
  return api2;
118
129
  };
119
130
  export {