@opentiny/vue-renderless 3.12.1 → 3.13.0-alpha.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 (297) hide show
  1. package/action-sheet/index.js +20 -13
  2. package/action-sheet/vue.js +8 -7
  3. package/alert/index.js +50 -1
  4. package/alert/vue.js +36 -9
  5. package/amount/index.js +100 -25
  6. package/amount/vue.js +102 -26
  7. package/anchor/index.js +1 -0
  8. package/area/index.js +8 -8
  9. package/area/vue.js +5 -5
  10. package/async-flowchart/index.js +16 -3
  11. package/autocomplete/index.js +58 -14
  12. package/autocomplete/vue.js +40 -12
  13. package/badge/index.js +12 -0
  14. package/badge/vue.js +6 -4
  15. package/breadcrumb/vue.js +3 -1
  16. package/breadcrumb-item/vue.js +6 -2
  17. package/button/index.js +5 -1
  18. package/calendar/index.js +2 -86
  19. package/calendar-bar/index.js +20 -6
  20. package/calendar-view/index.js +10 -12
  21. package/calendar-view/vue.js +17 -4
  22. package/cascader/index.js +80 -34
  23. package/cascader/vue.js +49 -19
  24. package/cascader-menu/index.js +7 -7
  25. package/cascader-menu/vue.js +2 -3
  26. package/cascader-mobile/index.js +37 -24
  27. package/cascader-mobile/vue.js +7 -1
  28. package/cascader-node/index.js +13 -1
  29. package/cascader-node/vue.js +15 -4
  30. package/cascader-panel/index.js +1 -1
  31. package/cascader-select/column-index.js +150 -0
  32. package/cascader-select/column.js +120 -0
  33. package/cascader-select/index.js +29 -165
  34. package/cascader-select/usePicker.js +251 -0
  35. package/cascader-select/useTouch.js +65 -0
  36. package/cascader-select/vue.js +35 -47
  37. package/cascader-view/index.js +1 -1
  38. package/cell/vue.js +2 -1
  39. package/chart-bar/index.js +2 -3
  40. package/chart-core/deps/constants.js +43 -43
  41. package/chart-core/index.js +1 -1
  42. package/chart-gauge/index.js +2 -2
  43. package/chart-heatmap/index.js +17 -10
  44. package/chart-line/index.js +8 -9
  45. package/chart-tree/index.js +2 -2
  46. package/chart-waterfall/index.js +4 -6
  47. package/checkbox/index.js +17 -0
  48. package/checkbox/vue.js +16 -7
  49. package/checkbox-group/vue.js +2 -0
  50. package/col/vue.js +3 -2
  51. package/collapse/index.js +3 -3
  52. package/color-select-panel/vue.js +0 -7
  53. package/column-list-item/index.js +17 -1
  54. package/column-list-item/vue.js +8 -3
  55. package/common/date.js +2 -0
  56. package/common/deps/dom.js +19 -4
  57. package/common/deps/popper.js +48 -5
  58. package/common/deps/touch-emulator.js +4 -1
  59. package/common/deps/tree-model/node.js +1 -1
  60. package/common/deps/tree-model/tree-store.js +2 -13
  61. package/common/deps/useRect.js +25 -0
  62. package/common/deps/vue-popper.js +22 -10
  63. package/common/index.js +1 -1
  64. package/common/runtime.js +1 -1
  65. package/common/type.js +2 -1
  66. package/common/validate/rules/enum.js +1 -1
  67. package/common/validate/rules/pattern.js +2 -2
  68. package/common/validate/rules/range.js +8 -5
  69. package/common/validate/rules/required.js +1 -1
  70. package/common/validate/rules/type.js +5 -5
  71. package/common/validate/rules/whitespace.js +1 -1
  72. package/common/validate/util.js +15 -16
  73. package/common/validate/validations/integer.js +1 -1
  74. package/common/validate/validations/method.js +1 -1
  75. package/container/index.js +17 -1
  76. package/container/vue.js +12 -3
  77. package/currency/index.js +74 -7
  78. package/currency/vue.js +21 -5
  79. package/date-panel/index.js +16 -0
  80. package/date-panel/vue.js +8 -2
  81. package/date-picker-mobile/index.js +12 -0
  82. package/date-picker-mobile/vue.js +7 -1
  83. package/date-range/vue.js +12 -5
  84. package/date-table/index.js +5 -0
  85. package/date-table/vue.js +3 -1
  86. package/dialog-box/index.js +17 -6
  87. package/dialog-select/index.js +6 -3
  88. package/dialog-select/vue.js +8 -4
  89. package/drawer/index.js +26 -5
  90. package/drawer/vue.js +13 -7
  91. package/dropdown/index.js +7 -7
  92. package/dropdown/vue.js +6 -2
  93. package/dropdown-item/index.js +9 -1
  94. package/dropdown-item/mf.js +6 -10
  95. package/dropdown-item/vue.js +21 -8
  96. package/dropdown-menu/index.js +20 -7
  97. package/dropdown-menu/vue.js +4 -3
  98. package/exception/index.js +2 -7
  99. package/exception/vue.js +7 -10
  100. package/fall-menu/index.js +5 -1
  101. package/fall-menu/vue.js +13 -2
  102. package/file-upload/index.js +47 -12
  103. package/file-upload/vue.js +38 -8
  104. package/filter-box/index.js +1 -0
  105. package/floating-button/index.js +62 -16
  106. package/floating-button/vue.js +27 -9
  107. package/flowchart/index.js +134 -25
  108. package/flowchart/node.js +13 -4
  109. package/flowchart/vue.js +16 -4
  110. package/form/vue.js +3 -1
  111. package/form-item/index.js +4 -4
  112. package/form-item/vue.js +3 -1
  113. package/fullscreen/index.js +5 -5
  114. package/fullscreen/vue.js +3 -3
  115. package/grid/utils/common.js +10 -5
  116. package/grid/utils/dom.js +7 -1
  117. package/image/index.js +6 -0
  118. package/image/vue.js +6 -3
  119. package/image-viewer/index.js +62 -51
  120. package/image-viewer/vue.js +17 -5
  121. package/input/index.js +89 -22
  122. package/input/vue.js +52 -21
  123. package/ip-address/index.js +61 -19
  124. package/ip-address/vue.js +22 -4
  125. package/label/index.js +56 -0
  126. package/label/vue.js +26 -0
  127. package/link/vue.js +3 -1
  128. package/loading/vue.js +8 -2
  129. package/logout/index.js +1 -1
  130. package/mask/index.js +13 -0
  131. package/mask/vue.js +18 -0
  132. package/mind-map/index.js +47 -0
  133. package/mind-map/vue.js +53 -0
  134. package/multi-select/index.js +150 -10
  135. package/multi-select/vue.js +46 -11
  136. package/multi-select-item/index.js +17 -0
  137. package/multi-select-item/vue.js +31 -0
  138. package/numeric/index.js +51 -9
  139. package/numeric/vue.js +44 -14
  140. package/option/index.js +12 -5
  141. package/option/vue.js +15 -7
  142. package/option-group/index.js +3 -3
  143. package/package.json +1 -1
  144. package/pager/index.js +372 -0
  145. package/pager/vue.js +125 -2
  146. package/picker/index.js +253 -48
  147. package/picker/mb.js +42 -0
  148. package/picker/vue.js +70 -17
  149. package/picker-column/index.js +1 -1
  150. package/pop-upload/index.js +0 -2
  151. package/pop-upload/vue.js +3 -4
  152. package/popconfirm/index.js +3 -6
  153. package/popconfirm/vue.js +1 -1
  154. package/popeditor/index.js +55 -24
  155. package/popeditor/vue.js +15 -11
  156. package/popover/index.js +4 -4
  157. package/popover/vue.js +6 -6
  158. package/popup/index.js +3 -3
  159. package/popup/vue.js +5 -5
  160. package/pull-refresh/index.js +57 -65
  161. package/pull-refresh/vue.js +23 -7
  162. package/radio/index.js +0 -17
  163. package/radio/vue.js +4 -10
  164. package/rate/index.js +1 -1
  165. package/rate/vue.js +0 -2
  166. package/record/index.js +4 -1
  167. package/{rich-text-edtior → rich-text-editor}/index.js +2 -2
  168. package/{rich-text-edtior → rich-text-editor}/vue.js +2 -5
  169. package/scrollbar/index.js +11 -11
  170. package/scrollbar/vue-bar.js +3 -3
  171. package/scrollbar/vue.js +5 -5
  172. package/search/index.js +1 -1
  173. package/search/vue.js +3 -1
  174. package/select/index.js +176 -110
  175. package/select/vue.js +105 -20
  176. package/select-dropdown/index.js +62 -4
  177. package/select-dropdown/vue.js +85 -8
  178. package/select-view/index.js +3 -1
  179. package/signature/index.js +241 -0
  180. package/signature/vue.js +88 -0
  181. package/skeleton/index.js +14 -0
  182. package/skeleton/vue.js +15 -0
  183. package/skeleton-item/vue.js +15 -0
  184. package/slider/index.js +27 -7
  185. package/slider/vue.js +26 -7
  186. package/split/index.js +1 -1
  187. package/split/vue.js +4 -6
  188. package/standard-list-item/index.js +15 -1
  189. package/standard-list-item/vue.js +6 -5
  190. package/steps/index.js +25 -2
  191. package/steps/slide-bar.js +8 -1
  192. package/steps/vue.js +15 -3
  193. package/tab-item-mf/vue.js +14 -8
  194. package/tab-nav/index.js +9 -4
  195. package/tab-nav/vue.js +6 -2
  196. package/tabbar/vue.js +9 -3
  197. package/tabbar-item/vue.js +3 -2
  198. package/tabs/index.js +1 -1
  199. package/tabs/vue.js +1 -0
  200. package/tabs-mf/index.js +20 -6
  201. package/tabs-mf/vue-nav.js +26 -11
  202. package/tabs-mf/vue.js +7 -7
  203. package/tag/index.js +1 -1
  204. package/tag/vue.js +5 -1
  205. package/tag-group/index.js +2 -1
  206. package/tall-storage/index.js +4 -5
  207. package/time/index.js +4 -1
  208. package/time/vue.js +1 -1
  209. package/time-line/vue.js +1 -1
  210. package/time-picker-mobile/index.js +24 -5
  211. package/time-picker-mobile/vue.js +17 -7
  212. package/time-range/index.js +2 -0
  213. package/time-spinner/index.js +0 -3
  214. package/time-spinner/vue.js +2 -3
  215. package/timeline-item/vue.js +1 -1
  216. package/tooltip/index.js +1 -2
  217. package/tooltip/vue.js +3 -3
  218. package/transfer/index.js +20 -22
  219. package/transfer/vue.js +1 -6
  220. package/transfer-panel/vue.js +3 -5
  221. package/tree/index.js +21 -4
  222. package/tree/vue.js +10 -8
  223. package/tree-menu/index.js +27 -3
  224. package/tree-menu/vue.js +27 -14
  225. package/tree-node/index.js +12 -10
  226. package/tree-node/vue.js +6 -5
  227. package/types/action-menu.type.d.ts +5 -0
  228. package/types/action-sheet.type.d.ts +118 -1
  229. package/types/alert.type.d.ts +16 -1
  230. package/types/amount.type.d.ts +168 -1
  231. package/types/area.type.d.ts +134 -1
  232. package/types/async-flowchart.type.d.ts +72 -0
  233. package/types/autocomplete.type.d.ts +199 -1
  234. package/types/badge.type.d.ts +3 -1
  235. package/types/breadcrumb-item.type.d.ts +2 -0
  236. package/types/breadcrumb.type.d.ts +2 -0
  237. package/types/button.type.d.ts +5 -0
  238. package/types/cascader-menu.type.d.ts +3 -4
  239. package/types/cascader-node.type.d.ts +5 -2
  240. package/types/cascader-panel.type-2bd03be3.d.ts +241 -0
  241. package/types/cascader-panel.type.d.ts +3 -241
  242. package/types/cascader.type.d.ts +327 -1
  243. package/types/checkbox.type.d.ts +9 -0
  244. package/types/collapse.type.d.ts +19 -2
  245. package/types/date-picker.type.d.ts +34 -1
  246. package/types/dialog-box.type.d.ts +5 -1
  247. package/types/drawer.type.d.ts +132 -1
  248. package/types/{dropdown-item.type-bf83e929.d.ts → dropdown-item.type-8475a549.d.ts} +8 -14
  249. package/types/dropdown-item.type.d.ts +1 -1
  250. package/types/dropdown-menu.type.d.ts +1 -1
  251. package/types/dropdown.type.d.ts +2 -5
  252. package/types/fall-menu.type.d.ts +94 -1
  253. package/types/file-upload.type.d.ts +1 -1
  254. package/types/form-item.type.d.ts +1 -1
  255. package/types/{form.type-d0fd42f3.d.ts → form.type-d88482e4.d.ts} +3 -0
  256. package/types/form.type.d.ts +1 -1
  257. package/types/input.type.d.ts +23 -9
  258. package/types/ip-address.type.d.ts +160 -1
  259. package/types/label.type.d.ts +81 -0
  260. package/types/link.type.d.ts +6 -3
  261. package/types/mind-map.type.d.ts +20 -0
  262. package/types/modal.type.d.ts +4 -2
  263. package/types/numeric.type.d.ts +36 -9
  264. package/types/pager.type.d.ts +171 -1
  265. package/types/picker.type.d.ts +14 -0
  266. package/types/popconfirm.type.d.ts +85 -1
  267. package/types/popeditor.type.d.ts +4 -0
  268. package/types/popover.type.d.ts +3 -3
  269. package/types/radio.type.d.ts +0 -4
  270. package/types/rate.type.d.ts +236 -1
  271. package/types/search.type.d.ts +88 -1
  272. package/types/shared.type.d.ts +1 -1
  273. package/types/skeleton-item.type.d.ts +38 -0
  274. package/types/skeleton.type.d.ts +45 -0
  275. package/types/slider.type.d.ts +8 -1
  276. package/types/steps.type.d.ts +14 -3
  277. package/types/tab-item.type.d.ts +0 -1
  278. package/types/tab-nav.type.d.ts +6 -1
  279. package/types/tabs.type.d.ts +5 -0
  280. package/types/tag-group.type.d.ts +64 -1
  281. package/types/tag.type.d.ts +12 -0
  282. package/types/tooltip.type.d.ts +1 -1
  283. package/types/transfer.type.d.ts +183 -1
  284. package/types/tree-menu.type.d.ts +210 -1
  285. package/types/upload-dragger.type.d.ts +1 -1
  286. package/types/{upload-list.type-343e8c11.d.ts → upload-list.type-1078fba2.d.ts} +27 -6
  287. package/types/upload-list.type.d.ts +1 -1
  288. package/types/upload.type.d.ts +1 -1
  289. package/types/wizard.type.d.ts +1 -0
  290. package/upload/index.js +59 -29
  291. package/upload/vue.js +6 -4
  292. package/upload-list/index.js +14 -14
  293. package/upload-list/vue.js +5 -2
  294. package/user/index.js +5 -4
  295. package/user-head/index.js +1 -1
  296. package/wheel/index.js +3 -0
  297. package/wizard/vue.js +4 -2
package/input/vue.js CHANGED
@@ -29,8 +29,12 @@ import {
29
29
  hasSelection,
30
30
  handleEnterDisplayOnlyContent,
31
31
  hiddenPassword,
32
- dispatchDisplayedValue,
33
- getDisplayedValue
32
+ setInputDomValue,
33
+ getDisplayedMaskValue,
34
+ inputStyle,
35
+ handleEnterTextarea,
36
+ handleLeaveTextarea,
37
+ getDisplayOnlyText
34
38
  } from "./index";
35
39
  import useStorageBox from "../tall-storage/vue-storage-box";
36
40
  const api = [
@@ -63,7 +67,10 @@ const api = [
63
67
  "isMemoryStorage",
64
68
  "hasSelection",
65
69
  "handleEnterDisplayOnlyContent",
66
- "hiddenPassword"
70
+ "hiddenPassword",
71
+ "inputStyle",
72
+ "handleEnterTextarea",
73
+ "handleLeaveTextarea"
67
74
  ];
68
75
  const initState = ({
69
76
  reactive,
@@ -72,22 +79,28 @@ const initState = ({
72
79
  props,
73
80
  parent,
74
81
  constants,
75
- api: api2
82
+ api: api2,
83
+ vm
76
84
  }) => {
77
85
  const state = reactive({
78
86
  mode,
87
+ maskSymbol: constants.MASKSYMBOL,
79
88
  focused: false,
80
89
  hovering: false,
81
90
  isComposing: false,
82
91
  passwordVisible: false,
92
+ maskValueVisible: false,
83
93
  boxVisibility: false,
84
94
  textareaCalcStyle: {},
85
- checkedLable: "",
95
+ checkedLabel: "",
96
+ enteredTextarea: false,
86
97
  sheetvalue: props.modelValue,
87
98
  inputSize: computed(() => props.size || state.formItemSize),
99
+ inputSizeMf: computed(() => props.size || (parent.tinyForm || {}).size),
88
100
  showClear: computed(
89
101
  () => props.clearable && !state.inputDisabled && !props.readonly && state.nativeInputValue && (state.focused || state.hovering)
90
102
  ),
103
+ textareaHeight: vm.theme === "saas" ? "28px" : "30px",
91
104
  upperLimit: computed(() => parent.$attrs.maxlength),
92
105
  textLength: computed(() => textLength(props.modelValue)),
93
106
  inputExceed: computed(() => state.isWordLimitVisible && state.textLength > state.upperLimit),
@@ -98,8 +111,10 @@ const initState = ({
98
111
  () => props.disabled || (parent.tinyForm || {}).disabled || state.isDisplayOnly || (parent.tinyForm || {}).displayOnly
99
112
  ),
100
113
  validateState: computed(() => parent.formItem ? parent.formItem.validateState : ""),
114
+ inputStyle: computed(() => api2.inputStyle()),
101
115
  textareaStyle: computed(() => __spreadProps(__spreadValues({}, state.textareaCalcStyle), {
102
- resize: props.resize
116
+ resize: props.resize,
117
+ textAlign: props.textAlign
103
118
  })),
104
119
  needStatusIcon: computed(() => parent.tinyForm ? parent.tinyForm.statusIcon : false),
105
120
  showPwdVisible: computed(
@@ -115,7 +130,9 @@ const initState = ({
115
130
  () => (props.displayOnly || (parent.tinyForm || {}).displayOnly) && ["text", "textarea", "password", "number"].includes(props.type)
116
131
  ),
117
132
  displayOnlyTooltip: "",
118
- hiddenPassword: computed(() => api2.hiddenPassword())
133
+ hiddenPassword: computed(() => api2.hiddenPassword()),
134
+ displayedMaskValue: computed(() => api2.getDisplayedMaskValue()),
135
+ displayOnlyText: computed(() => api2.getDisplayOnlyText())
119
136
  });
120
137
  return state;
121
138
  };
@@ -125,10 +142,11 @@ const initApi = ({
125
142
  dispatch,
126
143
  broadcast,
127
144
  emit,
128
- refs,
145
+ vm,
129
146
  props,
130
147
  CLASS_PREFIX,
131
- parent
148
+ parent,
149
+ nextTick
132
150
  }) => {
133
151
  Object.assign(api2, {
134
152
  state,
@@ -136,7 +154,7 @@ const initApi = ({
136
154
  broadcast,
137
155
  showBox: showBox(state),
138
156
  clear: clear(emit),
139
- getInput: getInput(refs),
157
+ getInput: getInput(vm),
140
158
  handleChange: handleChange(emit),
141
159
  watchFormSelect: watchFormSelect({ emit, props, state }),
142
160
  calcIconOffset: calcIconOffset({ CLASS_PREFIX, parent }),
@@ -144,8 +162,11 @@ const initApi = ({
144
162
  calculateNodeStyling: calculateNodeStyling(),
145
163
  handleCompositionStart: handleCompositionStart(state),
146
164
  handleCompositionUpdate: handleCompositionUpdate(state),
147
- dispatchDisplayedValue: dispatchDisplayedValue({ state, props, dispatch, api: api2 }),
148
- getDisplayedValue: getDisplayedValue({ state, props })
165
+ setInputDomValue: setInputDomValue({ state, props, nextTick, vm }),
166
+ getDisplayOnlyText: getDisplayOnlyText({ parent, props, state }),
167
+ handleEnterTextarea: handleEnterTextarea({ api: api2, state, props, nextTick }),
168
+ handleLeaveTextarea: handleLeaveTextarea({ api: api2, state, props, nextTick, vm }),
169
+ inputStyle: inputStyle({ props })
149
170
  });
150
171
  };
151
172
  const mergeApi = ({
@@ -158,7 +179,7 @@ const mergeApi = ({
158
179
  nextTick,
159
180
  parent,
160
181
  state,
161
- refs
182
+ vm
162
183
  }) => {
163
184
  const { storageData, isMemoryStorage, addMemory, searchMemory, selectedMemory } = storages;
164
185
  return Object.assign(api2, {
@@ -176,11 +197,12 @@ const mergeApi = ({
176
197
  emit,
177
198
  eventName: eventName.blur,
178
199
  props,
179
- state
200
+ state,
201
+ vm
180
202
  }),
181
203
  handleFocus: handleFocus({ api: api2, emit, state }),
182
204
  handleInput: handleInput({ api: api2, emit, nextTick, state }),
183
- resizeTextarea: resizeTextarea({ api: api2, parent, refs, state }),
205
+ resizeTextarea: resizeTextarea({ api: api2, parent, vm, state, props }),
184
206
  updateIconOffset: updateIconOffset(api2),
185
207
  calcTextareaHeight: calcTextareaHeight({
186
208
  api: api2,
@@ -193,7 +215,8 @@ const mergeApi = ({
193
215
  handlePasswordVisible: handlePasswordVisible({ api: api2, nextTick, state }),
194
216
  hasSelection: hasSelection(api2),
195
217
  handleEnterDisplayOnlyContent: handleEnterDisplayOnlyContent({ state, props }),
196
- hiddenPassword: hiddenPassword({ state, props })
218
+ hiddenPassword: hiddenPassword({ state, props }),
219
+ getDisplayedMaskValue: getDisplayedMaskValue({ state })
197
220
  });
198
221
  };
199
222
  const initWatch = ({
@@ -217,6 +240,15 @@ const initWatch = ({
217
240
  if (props.validateEvent) {
218
241
  api2.dispatch(componentName, eventName.change, [value]);
219
242
  }
243
+ api2.setInputDomValue();
244
+ }
245
+ );
246
+ watch(() => state.maskValueVisible, api2.setInputDomValue);
247
+ watch(() => state.inputDisabled, api2.setInputDomValue);
248
+ watch(
249
+ () => props.mask,
250
+ () => {
251
+ api2.setInputDomValue("mask");
220
252
  }
221
253
  );
222
254
  watch(
@@ -247,7 +279,6 @@ const initWatch = ({
247
279
  api2.setNativeInputValue();
248
280
  api2.resizeTextarea();
249
281
  api2.updateIconOffset();
250
- api2.dispatchDisplayedValue();
251
282
  });
252
283
  }
253
284
  );
@@ -265,17 +296,17 @@ const renderless = (props, { computed, onMounted, onUpdated, reactive, toRefs, w
265
296
  Input: constants.inputMode(mode),
266
297
  InputGroup: constants.inputGroupMode(mode)
267
298
  };
268
- const state = initState({ reactive, computed, mode, props, parent, constants, api: api2 });
269
- initApi({ api: api2, state, dispatch, broadcast, emit, refs, props, CLASS_PREFIX, parent });
299
+ const state = initState({ reactive, computed, mode, props, parent, constants, api: api2, vm });
300
+ initApi({ api: api2, state, dispatch, broadcast, emit, refs, props, CLASS_PREFIX, parent, vm, nextTick });
270
301
  const storages = useStorageBox({ api: api2, props, reactive, toRefs });
271
302
  parent.tinyForm = parent.tinyForm || inject("form", null);
272
- mergeApi({ api: api2, storages, componentName, emit, eventName, props, state, nextTick, parent, refs });
303
+ mergeApi({ api: api2, storages, componentName, emit, eventName, props, state, nextTick, parent, vm });
273
304
  initWatch({ watch, state, api: api2, props, nextTick, emit, componentName, eventName });
274
305
  onMounted(() => {
275
306
  api2.setNativeInputValue();
276
307
  api2.resizeTextarea();
277
308
  api2.updateIconOffset();
278
- api2.dispatchDisplayedValue();
309
+ api2.setInputDomValue();
279
310
  dispatch("Select", "input-mounted", vm.$el);
280
311
  dispatch("Tooltip", "tooltip-update", vm.$el);
281
312
  });
@@ -16,12 +16,13 @@ const ipValidator = ({ props, api }) => (value) => {
16
16
  return result;
17
17
  };
18
18
  const getCursorPosition = (el) => {
19
+ var _a, _b;
19
20
  let cursorPos = 0;
20
21
  let selectRange = null;
21
- if (document.selection) {
22
- selectRange = document.selection.createRange();
23
- selectRange.moveStart("character", -el.value.length);
24
- cursorPos = selectRange.text.length;
22
+ if (document == null ? void 0 : document.selection) {
23
+ selectRange = (_a = document == null ? void 0 : document.selection) == null ? void 0 : _a.createRange();
24
+ selectRange == null ? void 0 : selectRange.moveStart("character", -el.value.length);
25
+ cursorPos = (_b = selectRange == null ? void 0 : selectRange.text) == null ? void 0 : _b.length;
25
26
  }
26
27
  if (el.selectionStart || el.selectionStart === "0") {
27
28
  cursorPos = el.selectionStart;
@@ -51,8 +52,9 @@ const getValue = ({ api, props, state }) => () => {
51
52
  return result;
52
53
  };
53
54
  const setValue = ({ api, props, state }) => (value) => {
55
+ var _a;
54
56
  if (value) {
55
- if (api.ipValidator(value)) {
57
+ if ((_a = api == null ? void 0 : api.ipValidator) == null ? void 0 : _a.call(api, value)) {
56
58
  if (api.isIP6(props.type)) {
57
59
  state.address = value.split(":").map((item) => ({ value: item }));
58
60
  if (state.address.length < 8) {
@@ -76,7 +78,14 @@ const setValue = ({ api, props, state }) => (value) => {
76
78
  state.address = api.isIP6(props.type) ? new Array(8).fill("").map(createValue) : new Array(4).fill("").map(createValue);
77
79
  }
78
80
  };
79
- const activeEvent = ({ emit, parent, state, index, event, type }) => {
81
+ const activeEvent = ({
82
+ emit,
83
+ parent,
84
+ state,
85
+ index,
86
+ event,
87
+ type
88
+ }) => {
80
89
  const target = event && event.target ? event.target : parent.$el.querySelectorAll("input")[index || 0];
81
90
  type === "focus" && (state.active = true);
82
91
  if (!event) {
@@ -92,37 +101,55 @@ const activeEvent = ({ emit, parent, state, index, event, type }) => {
92
101
  !state.isSelected && emit(type, target.value, index);
93
102
  }
94
103
  };
95
- const focus = ({ emit, parent, state }) => ({ index, event }) => {
104
+ const focus = ({
105
+ emit,
106
+ parent,
107
+ state
108
+ }) => ({ index, event }) => {
96
109
  activeEvent({ emit, parent, state, index, event, type: "focus" });
97
110
  };
98
- const select = ({ emit, parent, state }) => ({ index, event }) => {
111
+ const select = ({
112
+ emit,
113
+ parent,
114
+ state
115
+ }) => ({ index, event }) => {
99
116
  activeEvent({ emit, parent, state, index, event, type: "select" });
100
117
  };
101
118
  const inputEvent = ({ api, componentName, emit, eventName, props }) => ({ item, index }) => {
119
+ var _a, _b, _c, _d, _e;
102
120
  const val = item.value.trim();
103
121
  let value = "";
104
122
  if (api.isIP4(props.type)) {
105
- if (!index && api.ipValidator(val)) {
106
- api.setValue(val);
123
+ if (!index && ((_a = api == null ? void 0 : api.ipValidator) == null ? void 0 : _a.call(api, val))) {
124
+ (_b = api == null ? void 0 : api.setValue) == null ? void 0 : _b.call(api, val);
107
125
  } else if (isNaN(val) || val < IPTHRESHOLD.Min || val > IPTHRESHOLD.Max) {
108
126
  item.value = "";
109
127
  }
110
128
  } else {
111
- if (!index && api.ipValidator(val)) {
112
- api.setValue(val);
129
+ if (!index && ((_c = api == null ? void 0 : api.ipValidator) == null ? void 0 : _c.call(api, val))) {
130
+ (_d = api == null ? void 0 : api.setValue) == null ? void 0 : _d.call(api, val);
113
131
  } else if (val.length > 4) {
114
132
  item.value = item.value.slice(0, 4);
115
133
  }
116
134
  }
117
- value = api.getValue();
135
+ value = (_e = api == null ? void 0 : api.getValue) == null ? void 0 : _e.call(api);
118
136
  emit("update:modelValue", value, index);
137
+ emit("input", value, index);
119
138
  api.dispatch(componentName, eventName, [value]);
120
139
  };
121
140
  const change = ({ api, emit }) => () => {
122
- const value = api.getValue();
141
+ var _a;
142
+ const value = (_a = api == null ? void 0 : api.getValue) == null ? void 0 : _a.call(api);
123
143
  emit("change", value);
124
144
  };
125
- const blur = ({ api, componentName, emit, eventName, props, state }) => ({ item, index }) => {
145
+ const blur = ({
146
+ api,
147
+ componentName,
148
+ emit,
149
+ eventName,
150
+ props,
151
+ state
152
+ }) => ({ item, index }) => {
126
153
  state.active = false;
127
154
  state.isDel = false;
128
155
  if (api.isIP4(props.type)) {
@@ -162,20 +189,35 @@ const keyup = ({ api, props }) => ({ item, index, event }) => {
162
189
  }
163
190
  }
164
191
  };
165
- const checkError1 = ({ Tab, Space, NumpadDecimal, NumpadComma, keyCode, value }) => [Tab, Space, NumpadDecimal, NumpadComma].includes(keyCode) && value;
192
+ const checkError1 = ({
193
+ Tab,
194
+ Space,
195
+ NumpadDecimal,
196
+ NumpadComma,
197
+ keyCode,
198
+ value
199
+ }) => [Tab, Space, NumpadDecimal, NumpadComma].includes(keyCode) && value;
166
200
  const checkError2 = (newValue) => newValue && (isNaN(newValue) || newValue > IPTHRESHOLD.Max);
167
201
  const checkError3 = ({ isfilterKeyCodes, isSelected, value }) => !isfilterKeyCodes && !isSelected && value === "0";
168
202
  const checkError4 = ({ isfilterKeyCodes, isSelected, value, key }) => !isfilterKeyCodes && !isSelected && value + key > IPTHRESHOLD.Max;
169
203
  const checkError5 = ({ key, isfilterKeyCodes, value, ctrlKey, keyCode, KeyV }) => isNaN(key) && !isfilterKeyCodes && !(!value && ctrlKey && keyCode === KeyV);
170
- const isError = ({ key, value, isSelected, isfilterKeyCodes, ctrlKey, keyCode, newValue }) => {
204
+ const isError = ({
205
+ key,
206
+ value,
207
+ isSelected,
208
+ isfilterKeyCodes,
209
+ ctrlKey,
210
+ keyCode,
211
+ newValue
212
+ }) => {
171
213
  const { Tab, Space, NumpadDecimal, NumpadComma, KeyV } = KEY_CODE;
172
214
  return checkError1({ Tab, Space, NumpadDecimal, NumpadComma, keyCode, value }) || checkError2(newValue) || checkError3({ isfilterKeyCodes, isSelected, value }) || checkError4({ isfilterKeyCodes, isSelected, value, key }) || checkError5({ key, isfilterKeyCodes, value, ctrlKey, keyCode, KeyV });
173
215
  };
174
216
  const keydown = ({ api, props, state }) => ({ item, index, event }) => {
175
217
  const { target, key, keyCode, ctrlKey } = event;
176
218
  const value = item.value;
177
- const selectionStart = target.selectionStart;
178
- const selectionEnd = target.selectionEnd;
219
+ const selectionStart = target == null ? void 0 : target.selectionStart;
220
+ const selectionEnd = target == null ? void 0 : target.selectionEnd;
179
221
  const isSelected = selectionStart !== selectionEnd;
180
222
  const cursorPosition = api.getCursorPosition(target);
181
223
  const isfilterKeyCodes = state.filterKeyCodes.includes(keyCode);
package/ip-address/vue.js CHANGED
@@ -20,7 +20,13 @@ import {
20
20
  } from "./index";
21
21
  import { KEY_CODE } from "../common";
22
22
  const api = ["state", "focus", "inputEvent", "blur", "keyup", "keydown", "change", "select"];
23
- const initState = ({ reactive, computed, handleValue, parent, props }) => {
23
+ const initState = ({
24
+ reactive,
25
+ computed,
26
+ handleValue,
27
+ parent,
28
+ props
29
+ }) => {
24
30
  const state = reactive(__spreadProps(__spreadValues({}, handleValue.state), {
25
31
  active: false,
26
32
  isSelected: false,
@@ -40,7 +46,18 @@ const initState = ({ reactive, computed, handleValue, parent, props }) => {
40
46
  }));
41
47
  return state;
42
48
  };
43
- const initApi = ({ state, api: api2, dispatch, handleValue, emit, broadcast, parent, componentName, props, eventName }) => {
49
+ const initApi = ({
50
+ state,
51
+ api: api2,
52
+ dispatch,
53
+ handleValue,
54
+ emit,
55
+ broadcast,
56
+ parent,
57
+ componentName,
58
+ props,
59
+ eventName
60
+ }) => {
44
61
  Object.assign(api2, __spreadProps(__spreadValues({}, handleValue.api), {
45
62
  state,
46
63
  dispatch,
@@ -77,8 +94,9 @@ const useHandleValue = ({ componentName, dispatch, eventName, props, reactive, t
77
94
  watch(
78
95
  () => props.modelValue,
79
96
  (value) => {
97
+ var _a;
80
98
  if (!state.isDel) {
81
- api2.setValue(value);
99
+ (_a = api2 == null ? void 0 : api2.setValue) == null ? void 0 : _a.call(api2, value);
82
100
  dispatch(componentName, eventName, [value]);
83
101
  }
84
102
  },
@@ -89,7 +107,7 @@ const useHandleValue = ({ componentName, dispatch, eventName, props, reactive, t
89
107
  api: api2
90
108
  };
91
109
  };
92
- const renderless = (props, { reactive, toRefs, watch, inject, computed }, { $prefix, emit, parent, broadcast, dispatch }) => {
110
+ const renderless = (props, { reactive, toRefs, watch, inject, computed }, { emit, parent, broadcast, dispatch }) => {
93
111
  const api2 = {};
94
112
  const componentName = "FormItem";
95
113
  const eventName = {
package/label/index.js ADDED
@@ -0,0 +1,56 @@
1
+ import "../chunk-G2ADBYYC.js";
2
+ const prefix = "tiny-mobile-label-";
3
+ function numFormat(num, decimal) {
4
+ let str = "";
5
+ str = (Math.round(num * 100) / 100).toFixed(decimal).toString().replace(/(\d)(?=(\d{3})+\.)/g, function($0, $1) {
6
+ return $1 + ",";
7
+ });
8
+ return str;
9
+ }
10
+ function handleNumberLabel(label, decimal) {
11
+ let val = label;
12
+ const reg1 = /[^(\-|\+)?\d+(\.\d+)?$]/g;
13
+ const reg2 = /0*([1-9]\d*|0\.\d+)/;
14
+ val = val.replace(reg1, "").replace(reg2, "$1");
15
+ let arr = val.split(".");
16
+ let numStr = "";
17
+ for (let i = 0; i < arr.length; i++) {
18
+ if (i === arr.length - 1 && arr.length > 1) {
19
+ numStr += ".";
20
+ }
21
+ numStr += arr[i];
22
+ }
23
+ numStr = numFormat(numStr, decimal);
24
+ numStr = numStr.replace(/\d+/, (s) => {
25
+ return s.replace(/(\d)(?=(\d{3})+$)/g, "$1,");
26
+ });
27
+ return numStr;
28
+ }
29
+ const handleClick = ({ emit, state }) => () => {
30
+ emit("click", state.label);
31
+ };
32
+ const computeLabel = (props) => () => {
33
+ let label = props.label;
34
+ if (props.type === "number") {
35
+ label = handleNumberLabel(props.label, props.decimal);
36
+ }
37
+ if (props.limit !== 0 && label.length > props.limit) {
38
+ return label.slice(0, props.limit);
39
+ }
40
+ return label;
41
+ };
42
+ const computeLabelClass = (props) => () => {
43
+ return [
44
+ `${prefix}${props.size}`,
45
+ `${prefix}${props.color}`,
46
+ `${prefix}${props.position}`,
47
+ props.wholeline || props.ellipsis === 1 || props.ellipsis === 2 || props.ellipsis === 3 ? `${prefix}wholeline` : "",
48
+ props.ellipsis > 0 && props.ellipsis < 4 ? `${prefix}ellipsis${props.ellipsis}` : "",
49
+ props.bold ? `${prefix}bold` : ""
50
+ ];
51
+ };
52
+ export {
53
+ computeLabel,
54
+ computeLabelClass,
55
+ handleClick
56
+ };
package/label/vue.js ADDED
@@ -0,0 +1,26 @@
1
+ import "../chunk-G2ADBYYC.js";
2
+ import { handleClick, computeLabel, computeLabelClass } from "./index";
3
+ const api = ["state", "handleClick", "computeLabel", "computeLabelStyle", "computeLabelClass"];
4
+ const renderless = (props, { computed, onBeforeUnmount, reactive, watch, inject }, { emit, parent }) => {
5
+ parent.tinyForm = parent.tinyForm || inject("form", null);
6
+ const state = reactive({
7
+ label: computed(() => api2.computeLabel()),
8
+ type: props.type,
9
+ color: props.color,
10
+ size: props.size,
11
+ labelClass: computed(() => api2.computeLabelClass()),
12
+ isRequired: props.isRequired
13
+ });
14
+ const api2 = {
15
+ state,
16
+ handleClick: handleClick({ emit, state }),
17
+ computeLabel: computeLabel(props),
18
+ // computeLabelStyle: computeLabelStyle(props, state),
19
+ computeLabelClass: computeLabelClass(props)
20
+ };
21
+ return api2;
22
+ };
23
+ export {
24
+ api,
25
+ renderless
26
+ };
package/link/vue.js CHANGED
@@ -1,11 +1,13 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
+ import { xss } from "../common/xss";
2
3
  import { handleClick } from "./index";
3
4
  const api = ["state", "handleClick"];
4
5
  const renderless = (props, { inject, reactive, computed }, { emit, parent }) => {
5
6
  parent.tinyForm = parent.tinyForm || inject("form", null);
6
7
  const state = reactive({
7
8
  formDisabled: computed(() => (parent.tinyForm || {}).disabled),
8
- disabled: computed(() => props.disabled || state.formDisabled)
9
+ disabled: computed(() => props.disabled || state.formDisabled),
10
+ href: computed(() => xss.filterUrl(props.href))
9
11
  });
10
12
  return {
11
13
  state,
package/loading/vue.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
2
  import { handleAfterLeave, setText, close } from "./index";
3
3
  const api = ["state", "handleAfterLeave", "setText", "close"];
4
- const renderless = (props, { reactive }, { constants, vm, emit }) => {
4
+ const renderless = (props, { reactive, computed }, { constants, vm, emit, designConfig }) => {
5
5
  const state = reactive({
6
6
  text: null,
7
7
  spinner: null,
@@ -10,7 +10,13 @@ const renderless = (props, { reactive }, { constants, vm, emit }) => {
10
10
  background: null,
11
11
  fullscreen: true,
12
12
  closed: false,
13
- size: "small"
13
+ size: "",
14
+ iconSize: "",
15
+ loadingImg: computed(() => {
16
+ var _a;
17
+ return props.loadingImg || ((_a = designConfig == null ? void 0 : designConfig.props) == null ? void 0 : _a.loadingImg);
18
+ }),
19
+ iconStyle: computed(() => state.iconSize ? { width: state.iconSize + "px", height: state.iconSize + "px" } : {})
14
20
  });
15
21
  const api2 = {
16
22
  state,
package/logout/index.js CHANGED
@@ -2,7 +2,7 @@ import "../chunk-G2ADBYYC.js";
2
2
  import { xss } from "../common";
3
3
  const logout = ({ service, state, props }) => () => {
4
4
  let { isMock, isLocal, redirectUrl = "", getLogoutUrl, showLogin } = service;
5
- if (typeof props.beforeLogout === "function") {
5
+ if (typeof props.beforeLogout === "function" && !state.logout) {
6
6
  if (props.beforeLogout(redirectUrl) === false) {
7
7
  return;
8
8
  }
package/mask/index.js ADDED
@@ -0,0 +1,13 @@
1
+ import "../chunk-G2ADBYYC.js";
2
+ const handleTouch = ({ props, emit }) => (event) => {
3
+ if (props.cancelTouch) {
4
+ event.preventDefault();
5
+ event.stopPropagation();
6
+ } else {
7
+ emit("update:visible", false);
8
+ }
9
+ emit("click", props.visible);
10
+ };
11
+ export {
12
+ handleTouch
13
+ };
package/mask/vue.js ADDED
@@ -0,0 +1,18 @@
1
+ import "../chunk-G2ADBYYC.js";
2
+ import { handleTouch } from "./index";
3
+ const api = ["state", "handleTouch"];
4
+ const renderless = (props, { reactive, computed }, { emit }) => {
5
+ const api2 = {};
6
+ const state = reactive({
7
+ calcStyle: computed(() => ({ zIndex: props.zIndex }))
8
+ });
9
+ Object.assign(api2, {
10
+ state,
11
+ handleTouch: handleTouch({ props, emit })
12
+ });
13
+ return api2;
14
+ };
15
+ export {
16
+ api,
17
+ renderless
18
+ };
@@ -0,0 +1,47 @@
1
+ import "../chunk-G2ADBYYC.js";
2
+ const importData = (instance, data) => {
3
+ instance.init(data);
4
+ };
5
+ const initEvent = (render, emit) => {
6
+ const onOperation = (info) => {
7
+ emit("operation", { render, info });
8
+ };
9
+ const onSelectNode = (nodeObj, e) => {
10
+ emit("selectNode", { render, nodeObj, e });
11
+ };
12
+ const selectNewNode = (nodeObj) => {
13
+ emit("selectNewNode", { render, nodeObj });
14
+ };
15
+ const onSelectNodes = (nodeObj) => {
16
+ emit("selectNodes", { render, nodeObj });
17
+ };
18
+ const unselectNode = () => {
19
+ emit("unselectNode", { render });
20
+ };
21
+ const unselectNodes = () => {
22
+ emit("unselectNodes", { render });
23
+ };
24
+ const expandNode = (nodeObj) => {
25
+ emit("expandNode", { render, nodeObj });
26
+ };
27
+ render.bus.addListener("operation", onOperation);
28
+ render.bus.addListener("selectNode", onSelectNode);
29
+ render.bus.addListener("selectNewNode", selectNewNode);
30
+ render.bus.addListener("selectNodes", onSelectNodes);
31
+ render.bus.addListener("unselectNode", unselectNode);
32
+ render.bus.addListener("unselectNodes", unselectNodes);
33
+ render.bus.addListener("expandNode", expandNode);
34
+ return () => {
35
+ render.bus.removeListener("operation", onOperation);
36
+ render.bus.removeListener("selectNode", onSelectNode);
37
+ render.bus.removeListener("selectNewNode", selectNewNode);
38
+ render.bus.removeListener("selectNodes", onSelectNodes);
39
+ render.bus.removeListener("unselectNode", unselectNode);
40
+ render.bus.removeListener("unselectNodes", unselectNodes);
41
+ render.bus.removeListener("expandNode", expandNode);
42
+ };
43
+ };
44
+ export {
45
+ importData,
46
+ initEvent
47
+ };
@@ -0,0 +1,53 @@
1
+ import {
2
+ __spreadProps,
3
+ __spreadValues
4
+ } from "../chunk-G2ADBYYC.js";
5
+ import { importData, initEvent } from ".";
6
+ const api = [];
7
+ const renderless = (props, { getCurrentInstance, onMounted, onUnmounted, watch }, { emit }, {
8
+ MindElixir
9
+ }) => {
10
+ const api2 = {};
11
+ let destoryListener = null;
12
+ onMounted(() => {
13
+ var _a;
14
+ const instance = getCurrentInstance();
15
+ if (!instance) {
16
+ throw new Error(
17
+ "Can not find instance. Please open Issue: https://github.com/opentiny/tiny-vue/issues/new/choose"
18
+ );
19
+ }
20
+ const mindmap = instance.refs.mindmap;
21
+ const render = new MindElixir(__spreadProps(__spreadValues({
22
+ contextMenu: false,
23
+ toolBar: false,
24
+ nodeMenu: false
25
+ }, (_a = props.options) != null ? _a : {}), {
26
+ el: mindmap
27
+ }));
28
+ destoryListener = initEvent(render, emit);
29
+ emit("create", render);
30
+ watch(
31
+ () => props.modelValue,
32
+ () => {
33
+ if (props.modelValue) {
34
+ emit("beforeImport", { render, data: props.modelValue });
35
+ importData(render, props.modelValue);
36
+ emit("afterImport", { render, data: props.modelValue });
37
+ } else {
38
+ const root = MindElixir.new("root");
39
+ render.init(root);
40
+ }
41
+ },
42
+ { deep: true, immediate: true }
43
+ );
44
+ });
45
+ onUnmounted(() => {
46
+ destoryListener == null ? void 0 : destoryListener();
47
+ });
48
+ return api2;
49
+ };
50
+ export {
51
+ api,
52
+ renderless
53
+ };