@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
@@ -0,0 +1,241 @@
1
+ import "../chunk-G2ADBYYC.js";
2
+ import { preventDefault } from "../common/deps/dom";
3
+ const getOffsetPosition = ({ touch, state }) => {
4
+ let offsetY = 0;
5
+ let offsetX = 0;
6
+ if (state.current === "default" && state.isFullscreen) {
7
+ offsetY = state.canvasRect.width - touch.clientX + (state.canvasRect.left || 0);
8
+ offsetX = touch.clientY - (state.canvasRect.top || 0);
9
+ } else {
10
+ offsetX = touch.clientX - (state.canvasRect.left || 0);
11
+ offsetY = touch.clientY - (state.canvasRect.top || 0);
12
+ }
13
+ return { offsetX, offsetY };
14
+ };
15
+ const redraw = ({ state, props, nextTick }) => ({ oldWidth, oldHeight }) => {
16
+ if (Date.now() - state.lastRedrawDate < 100) {
17
+ return;
18
+ }
19
+ state.lastRedrawDate = Date.now();
20
+ nextTick(() => {
21
+ const context = state.ctx;
22
+ context.lineWidth = props.lineWidth;
23
+ context.strokeStyle = props.penColor;
24
+ context.beginPath();
25
+ state.ctx.lineJoin = "round";
26
+ state.paths.forEach((point) => {
27
+ point.offsetX *= state.width / oldWidth;
28
+ point.offsetY *= state.height / oldHeight;
29
+ if (point.isStart) {
30
+ context.moveTo(point.offsetX, point.offsetY);
31
+ } else {
32
+ context.lineTo(point.offsetX, point.offsetY);
33
+ context.stroke();
34
+ }
35
+ });
36
+ });
37
+ };
38
+ const touchStart = ({ emit, props, state, vm, api, useRect }) => () => {
39
+ if (!state.ctx) {
40
+ return false;
41
+ }
42
+ if (!state.isBeginWrite) {
43
+ api.rewrite(true);
44
+ }
45
+ state.canvasRect = useRect(vm.$refs.canvasRef);
46
+ state.ctx.lineWidth = props.lineWidth;
47
+ state.ctx.strokeStyle = props.penColor;
48
+ const touch = event.touches[0];
49
+ if (!touch.offsetX) {
50
+ const pos = getOffsetPosition({ touch, state });
51
+ touch.offsetX = pos.offsetX;
52
+ touch.offsetY = pos.offsetY;
53
+ }
54
+ state.isDrawing = true;
55
+ const point = {
56
+ isStart: true,
57
+ offsetX: touch.offsetX,
58
+ offsetY: touch.offsetY
59
+ };
60
+ state.paths.push(point);
61
+ state.ctx.beginPath();
62
+ state.ctx.lineJoin = "round";
63
+ state.ctx.moveTo(touch.offsetX, touch.offsetY);
64
+ emit("start");
65
+ };
66
+ const touchMove = ({ emit, state }) => (e) => {
67
+ if (!state.ctx) {
68
+ return false;
69
+ }
70
+ preventDefault(e);
71
+ const touch = event.touches[0];
72
+ if (state.isDrawing) {
73
+ if (!touch.offsetX) {
74
+ const pos = getOffsetPosition({ touch, state });
75
+ touch.offsetX = pos.offsetX;
76
+ touch.offsetY = pos.offsetY;
77
+ }
78
+ state.ctx.lineTo(touch.offsetX, touch.offsetY);
79
+ state.ctx.stroke();
80
+ const point = {
81
+ isStart: false,
82
+ offsetX: touch.offsetX,
83
+ offsetY: touch.offsetY
84
+ };
85
+ state.paths.push(point);
86
+ }
87
+ emit("signing", event);
88
+ };
89
+ const touchEnd = ({ emit, state }) => (event2) => {
90
+ state.isDrawing = false;
91
+ preventDefault(event2);
92
+ emit("end");
93
+ };
94
+ const isCanvasEmpty = (canvas, props) => {
95
+ const empty = document.createElement("canvas");
96
+ const ctx = empty.getContext("2d");
97
+ empty.width = canvas.width;
98
+ empty.height = canvas.height;
99
+ ctx.font = "16px PingFangSC";
100
+ ctx.textAlign = "center";
101
+ ctx.fillStyle = "#AEAEAE";
102
+ ctx.fillText(props.placeholder, empty.width / 2, empty.height / 2);
103
+ return canvas.toDataURL() === empty.toDataURL();
104
+ };
105
+ const setCanvasBgColor = ({ props, state }) => () => {
106
+ if (state.ctx && props.backgroundColor) {
107
+ state.ctx.fillStyle = props.backgroundColor;
108
+ state.ctx.fillRect(0, 0, state.width, state.height);
109
+ }
110
+ };
111
+ const setPlaceholder = ({ props, state }) => () => {
112
+ if (state.ctx) {
113
+ state.ctx.font = "16px PingFangSC";
114
+ state.ctx.textAlign = "center";
115
+ state.ctx.fillStyle = "#AEAEAE";
116
+ state.ctx.fillText(props.placeholder, state.width / 2, state.height / 2);
117
+ }
118
+ };
119
+ const getSignatureImage = ({ props, vm, Modal, t }) => () => {
120
+ const canvas = vm.$refs.canvasRef;
121
+ if (!canvas) {
122
+ return;
123
+ }
124
+ const isEmpty = isCanvasEmpty(canvas, props);
125
+ let image = "";
126
+ if (isEmpty) {
127
+ Modal.message(t("ui.signature.tips"));
128
+ } else {
129
+ const types = {
130
+ jpg: () => canvas.toDataURL("image/jpeg", 0.8),
131
+ jpeg: () => canvas.toDataURL("image/jpeg", 0.8)
132
+ };
133
+ let type = types[props.type];
134
+ if (type) {
135
+ image = type();
136
+ } else {
137
+ image = canvas.toDataURL(`image/${props.type}`);
138
+ }
139
+ }
140
+ return { image, canvas };
141
+ };
142
+ const submit = ({ emit, api }) => () => {
143
+ const { image, canvas } = api.getSignatureImage();
144
+ emit("submit", { image, canvas });
145
+ };
146
+ const rewrite = ({ api, emit, state }) => (isBeginWrite) => {
147
+ if (state.ctx) {
148
+ state.value = false;
149
+ state.ctx.clearRect(0, 0, state.width, state.height);
150
+ state.ctx.closePath();
151
+ api.setCanvasBgColor();
152
+ state.isBeginWrite = true;
153
+ if (isBeginWrite === true)
154
+ return;
155
+ api.setPlaceholder();
156
+ state.isBeginWrite = false;
157
+ state.paths.length = 0;
158
+ emit("rewrite");
159
+ }
160
+ };
161
+ const cancel = ({ api, emit }) => () => {
162
+ api.toggleFullscreen();
163
+ emit("cancel");
164
+ };
165
+ const tranformImage = ({ api, vm, props, nextTick }) => ({ oldWidth, oldHeight }) => {
166
+ const canvas = vm.$refs.canvasRef;
167
+ if (isCanvasEmpty(canvas, props)) {
168
+ nextTick(() => {
169
+ api.setPlaceholder();
170
+ });
171
+ } else {
172
+ nextTick(() => {
173
+ api.redraw({ oldWidth, oldHeight });
174
+ });
175
+ }
176
+ };
177
+ const toggleFullscreen = ({ nextTick, api, state }) => () => {
178
+ const clientWidth = document.documentElement.clientWidth;
179
+ const clientHeight = document.documentElement.clientHeight;
180
+ const oldWidth = state.width;
181
+ const oldHeight = state.height;
182
+ state.isFullscreen = !state.isFullscreen;
183
+ nextTick(() => {
184
+ if (state.current.value === "default" && state.isFullscreen) {
185
+ state.width = clientHeight;
186
+ state.height = clientWidth;
187
+ } else {
188
+ api.initCanvas();
189
+ }
190
+ api.tranformImage({ oldWidth, oldHeight });
191
+ });
192
+ };
193
+ const initCanvas = ({ props, state, vm }) => () => {
194
+ const canvas = vm.$refs.canvasRef;
195
+ const wrap = vm.$refs.wrapRef;
196
+ const width = wrap.offsetWidth || 0;
197
+ const height = wrap.offsetHeight || 0;
198
+ state.ctx = canvas.getContext("2d");
199
+ state.width = width;
200
+ state.height = props.height || height;
201
+ };
202
+ const mounted = ({ vm, state, api, nextTick, markRaw }) => () => {
203
+ const wrap = vm.$refs.wrapRef;
204
+ const resizeObserver = new ResizeObserver((ResizeObserverEntryArr) => {
205
+ const [{ contentRect }] = ResizeObserverEntryArr;
206
+ if (contentRect.width && contentRect.height) {
207
+ api.initCanvas();
208
+ if (state.paths.length) {
209
+ api.redraw({ oldWidth: contentRect.width, oldHeight: contentRect.height });
210
+ } else {
211
+ nextTick(() => {
212
+ api.setCanvasBgColor();
213
+ api.setPlaceholder();
214
+ });
215
+ }
216
+ }
217
+ });
218
+ state.resizeObserver = markRaw(resizeObserver);
219
+ state.resizeObserver.observe(wrap);
220
+ };
221
+ const beforeUnmount = ({ vm, state }) => () => {
222
+ const wrap = vm.$refs.wrapRef;
223
+ state.resizeObserver.unobserve(wrap);
224
+ };
225
+ export {
226
+ beforeUnmount,
227
+ cancel,
228
+ getSignatureImage,
229
+ initCanvas,
230
+ mounted,
231
+ redraw,
232
+ rewrite,
233
+ setCanvasBgColor,
234
+ setPlaceholder,
235
+ submit,
236
+ toggleFullscreen,
237
+ touchEnd,
238
+ touchMove,
239
+ touchStart,
240
+ tranformImage
241
+ };
@@ -0,0 +1,88 @@
1
+ import "../chunk-G2ADBYYC.js";
2
+ import emulate from "../common/deps/touch-emulator";
3
+ import { useRect as _useRect } from "../common/deps/useRect";
4
+ import {
5
+ touchStart,
6
+ touchMove,
7
+ touchEnd,
8
+ setCanvasBgColor,
9
+ submit,
10
+ cancel,
11
+ rewrite,
12
+ mounted,
13
+ beforeUnmount,
14
+ setPlaceholder,
15
+ toggleFullscreen,
16
+ initCanvas,
17
+ tranformImage,
18
+ redraw,
19
+ getSignatureImage
20
+ } from "./index";
21
+ emulate();
22
+ const api = [
23
+ "state",
24
+ "touchStart",
25
+ "touchMove",
26
+ "touchEnd",
27
+ "rewrite",
28
+ "submit",
29
+ "toggleFullscreen",
30
+ "initCanvas",
31
+ "cancel",
32
+ "tranformImage",
33
+ "redraw",
34
+ "getSignatureImage"
35
+ ];
36
+ const renderless = (props, { unref, reactive, onMounted, onBeforeUnmount, watch, markRaw }, { emit, vm, nextTick, t, useBreakpoint }, { Modal }) => {
37
+ const { current } = useBreakpoint();
38
+ const state = reactive({
39
+ width: 0,
40
+ height: 0,
41
+ ctx: null,
42
+ isBeginWrite: false,
43
+ isFullscreen: false,
44
+ current,
45
+ canvasRect: null,
46
+ isDrawing: false,
47
+ paths: markRaw([]),
48
+ resizeObserver: null,
49
+ value: props.value,
50
+ lastRedrawDate: 0
51
+ });
52
+ watch(
53
+ () => props.value,
54
+ (newValue) => {
55
+ if (newValue) {
56
+ state.value = newValue;
57
+ }
58
+ }
59
+ );
60
+ const useRect = _useRect(unref);
61
+ const api2 = {
62
+ state,
63
+ touchMove: touchMove({ emit, state }),
64
+ touchEnd: touchEnd({ emit, state }),
65
+ setCanvasBgColor: setCanvasBgColor({ props, state }),
66
+ setPlaceholder: setPlaceholder({ props, state }),
67
+ getSignatureImage: getSignatureImage({ props, vm, Modal, t })
68
+ };
69
+ Object.assign(api2, {
70
+ touchStart: touchStart({ emit, props, state, vm, api: api2, useRect }),
71
+ rewrite: rewrite({ api: api2, emit, state }),
72
+ mounted: mounted({ state, api: api2, vm, nextTick, markRaw }),
73
+ onBeforeUnmount: beforeUnmount({ state, vm }),
74
+ initCanvas: initCanvas({ props, state, vm }),
75
+ toggleFullscreen: toggleFullscreen({ api: api2, nextTick, state }),
76
+ cancel: cancel({ api: api2, emit }),
77
+ redraw: redraw({ props, state, nextTick }),
78
+ tranformImage: tranformImage({ api: api2, vm, props, nextTick }),
79
+ submit: submit({ emit, api: api2 })
80
+ });
81
+ onMounted(() => api2.mounted());
82
+ onBeforeUnmount(() => api2.onBeforeUnmount());
83
+ return api2;
84
+ };
85
+ export {
86
+ api,
87
+ renderless
88
+ };
@@ -0,0 +1,14 @@
1
+ import "../chunk-G2ADBYYC.js";
2
+ import { isNumber, isNull } from "../common/type";
3
+ const toPxStyle = (value) => {
4
+ if (isNull(value)) {
5
+ return void 0;
6
+ }
7
+ if (isNumber(value)) {
8
+ return `${value}px`;
9
+ }
10
+ return String(value);
11
+ };
12
+ export {
13
+ toPxStyle
14
+ };
@@ -0,0 +1,15 @@
1
+ import "../chunk-G2ADBYYC.js";
2
+ import { toPxStyle } from "./index";
3
+ const api = ["toPxStyle"];
4
+ const renderless = (props, { toRefs, provide }) => {
5
+ const { active } = toRefs(props);
6
+ provide("active", active);
7
+ const api2 = {
8
+ toPxStyle
9
+ };
10
+ return api2;
11
+ };
12
+ export {
13
+ api,
14
+ renderless
15
+ };
@@ -0,0 +1,15 @@
1
+ import "../chunk-G2ADBYYC.js";
2
+ const api = ["state"];
3
+ const renderless = (props, { reactive, inject }) => {
4
+ const state = reactive({
5
+ isActive: inject("active", false)
6
+ });
7
+ const api2 = {
8
+ state
9
+ };
10
+ return api2;
11
+ };
12
+ export {
13
+ api,
14
+ renderless
15
+ };
package/slider/index.js CHANGED
@@ -17,6 +17,7 @@ const bindKeyDown = ({ api, props, state }) => (event) => {
17
17
  if (state.disabled || state.activeIndex < 0) {
18
18
  return;
19
19
  }
20
+ event.preventDefault();
20
21
  let currentValue = 0;
21
22
  switch (event.keyCode) {
22
23
  case KEY_CODE.Home:
@@ -114,7 +115,9 @@ const bindMouseUp = ({ api, emit, state }) => () => {
114
115
  if (state.disabled || !state.isDrag) {
115
116
  return;
116
117
  }
117
- state.showTip = false;
118
+ if (state.mouseOuterBtn) {
119
+ state.showTip = false;
120
+ }
118
121
  state.isDrag = false;
119
122
  off(window, "mouseup", api.bindMouseUp);
120
123
  off(window, "mousemove", api.bindMouseMove);
@@ -123,6 +126,7 @@ const bindMouseUp = ({ api, emit, state }) => () => {
123
126
  emit("stop", api.getActiveButtonValue());
124
127
  };
125
128
  const displayTip = ({ api, nextTick, state }) => (event) => {
129
+ state.mouseOuterBtn = false;
126
130
  if (!state.showTip) {
127
131
  state.showTip = true;
128
132
  api.changeActiveValue(api.getActiveButtonIndex(event) === 0);
@@ -131,7 +135,10 @@ const displayTip = ({ api, nextTick, state }) => (event) => {
131
135
  });
132
136
  }
133
137
  };
134
- const hideTip = (state) => () => !state.isDrag && (state.showTip = false);
138
+ const hideTip = (state) => () => {
139
+ state.mouseOuterBtn = true;
140
+ !state.isDrag && (state.showTip = false);
141
+ };
135
142
  const setTipStyle = ({
136
143
  constants,
137
144
  mode,
@@ -278,17 +285,14 @@ const initSlider = ({ api, props, state }) => (value) => {
278
285
  state.rightBtnValue = Math.min(Number(item), props.max);
279
286
  state.rightBtnShow = true;
280
287
  }
281
- if (state.isInit) {
282
- api.changeActiveValue(index === 0);
283
- }
288
+ api.changeActiveValue(index === 0);
284
289
  api.setButtonStyle();
285
290
  });
286
- state.isInit = false;
287
291
  api.setBarStyle();
288
292
  };
289
293
  const calculateValue = ({ props, state, vm }) => (event) => {
290
294
  let currentValue = 0;
291
- if (state.sliderSize == 0) {
295
+ if (state.sliderSize === 0) {
292
296
  const handleEl = vm.$refs.slider;
293
297
  state.sliderSize = handleEl["client" + (props.vertical ? "Height" : "Width")];
294
298
  state.sliderOffset = handleEl.getBoundingClientRect();
@@ -362,6 +366,9 @@ const watchActiveValue = ({ api, emit, props, state }) => (newValue, oldValue) =
362
366
  } else {
363
367
  state.activeValue = nNewValue || 0;
364
368
  }
369
+ if (!state.isSlotTyping) {
370
+ state.slotValue = state.activeValue;
371
+ }
365
372
  };
366
373
  const watchModelValue = ({ api, state }) => (value) => {
367
374
  if (!state.innerTrigger) {
@@ -417,6 +424,16 @@ const inputValueChange = ({ props, state, api }) => ($event, pos) => {
417
424
  }
418
425
  api.initSlider([Math.min(...state.inputValue), Math.max(...state.inputValue)]);
419
426
  };
427
+ const handleSlotInputFocus = (state) => () => {
428
+ state.isSlotTyping = true;
429
+ };
430
+ const handleSlotInputBlur = (state) => () => {
431
+ state.isSlotTyping = false;
432
+ state.slotValue = state.activeValue;
433
+ };
434
+ const handleSlotInput = (state) => (event) => {
435
+ state.activeValue = Number(event.target.value);
436
+ };
420
437
  export {
421
438
  autoSlider,
422
439
  bindEvent,
@@ -436,6 +453,9 @@ export {
436
453
  getActiveButtonValue,
437
454
  getLabels,
438
455
  getPoints,
456
+ handleSlotInput,
457
+ handleSlotInputBlur,
458
+ handleSlotInputFocus,
439
459
  hideTip,
440
460
  initSlider,
441
461
  inputValueChange,
package/slider/vue.js CHANGED
@@ -27,7 +27,10 @@ import {
27
27
  watchModelValue,
28
28
  getPoints,
29
29
  getLabels,
30
- inputValueChange
30
+ inputValueChange,
31
+ handleSlotInputFocus,
32
+ handleSlotInputBlur,
33
+ handleSlotInput
31
34
  } from "./index";
32
35
  const api = [
33
36
  "state",
@@ -54,7 +57,10 @@ const api = [
54
57
  "customBeforeAppearHook",
55
58
  "customAppearHook",
56
59
  "customAfterAppearHook",
57
- "inputValueChange"
60
+ "inputValueChange",
61
+ "handleSlotInputFocus",
62
+ "handleSlotInputBlur",
63
+ "handleSlotInput"
58
64
  ];
59
65
  const initState = ({ reactive, computed, props, api: api2, parent, inject }) => {
60
66
  const state = reactive({
@@ -64,7 +70,6 @@ const initState = ({ reactive, computed, props, api: api2, parent, inject }) =>
64
70
  moveStyle: [],
65
71
  points: [],
66
72
  labels: [],
67
- isInit: true,
68
73
  inputValue: [0, 0],
69
74
  isDrag: false,
70
75
  sliderSize: 0,
@@ -85,7 +90,10 @@ const initState = ({ reactive, computed, props, api: api2, parent, inject }) =>
85
90
  rangeDiff: computed(() => props.max - props.min),
86
91
  tipValue: computed(() => api2.formatTipValue(state.activeValue)),
87
92
  formDisabled: computed(() => (parent.tinyForm || {}).disabled),
88
- disabled: computed(() => props.disabled || state.formDisabled)
93
+ disabled: computed(() => props.disabled || state.formDisabled),
94
+ slotValue: "",
95
+ isSlotTyping: false,
96
+ mouseOuterBtn: false
89
97
  });
90
98
  return state;
91
99
  };
@@ -122,9 +130,21 @@ const renderless = (props, { computed, onBeforeUnmount, onMounted, reactive, wat
122
130
  watchActiveValue: watchActiveValue({ api: api2, emit, props, state }),
123
131
  getPoints: getPoints({ props, state }),
124
132
  getLabels: getLabels({ props, state }),
125
- inputValueChange: inputValueChange({ props, api: api2, state })
133
+ inputValueChange: inputValueChange({ props, api: api2, state }),
134
+ handleSlotInputFocus: handleSlotInputFocus(state),
135
+ handleSlotInputBlur: handleSlotInputBlur(state),
136
+ handleSlotInput: handleSlotInput(state)
126
137
  });
127
- watch(() => props.modelValue, api2.watchModelValue, { immediate: true });
138
+ watch(
139
+ () => props.modelValue,
140
+ (value) => {
141
+ if (props.max < props.min) {
142
+ throw new Error("Slider min should not be greater than max.");
143
+ }
144
+ api2.watchModelValue(value);
145
+ },
146
+ { immediate: true }
147
+ );
128
148
  watch(() => state.activeValue, api2.watchActiveValue, { immediate: true });
129
149
  watch(
130
150
  () => props.min,
@@ -142,7 +162,6 @@ const renderless = (props, { computed, onBeforeUnmount, onMounted, reactive, wat
142
162
  api2.setActiveButtonValue(value);
143
163
  }
144
164
  );
145
- watch(() => state.activeValue, api2.watchActiveValue, { immediate: true });
146
165
  watch(
147
166
  () => state.leftBtnValue,
148
167
  (newVal) => {
package/split/index.js CHANGED
@@ -44,7 +44,7 @@ const handleUp = ({ api, emit, off, state }) => () => {
44
44
  emit("moveend");
45
45
  };
46
46
  const handleMousedown = ({ api, emit, on, props, state, vm }) => (event) => {
47
- if (state.dragable) {
47
+ if (!props.disabled) {
48
48
  state.initOffset = state.isHorizontal ? event.pageX : event.pageY;
49
49
  if (state.offset === 0) {
50
50
  state.oldOffset = 0;
package/split/vue.js CHANGED
@@ -32,12 +32,10 @@ const renderless = (props, hooks, { vm, nextTick, emit, constants }) => {
32
32
  computedleftTopMin: computed(() => api2.getComputedThresholdValue("leftTopMin")),
33
33
  computedrightBottomMin: computed(() => api2.getComputedThresholdValue("rightBottomMin")),
34
34
  wrapperClasses: computed(() => [`${state.prefix}-wrapper`, state.isMoving ? "no-select" : ""]),
35
- paneClasses: computed(() => [`${state.prefix}-pane`, { [`${state.prefix}-pane-moving`]: state.isMoving }]),
36
- dragable: !props.disabled,
37
- triggerSimple: props.triggerSimple,
38
- collapseLeftTop: props.collapseLeftTop,
39
- collapseRightBottom: props.collapseRightBottom,
40
- isThreeAreas: props.threeAreas
35
+ paneClasses: computed(() => [
36
+ `${state.prefix}-pane ${props.scrollable ? "tiny-split-scroll" : ""}`,
37
+ { [`${state.prefix}-pane-moving`]: state.isMoving }
38
+ ])
41
39
  }, getUseOffset.state));
42
40
  Object.assign(api2, __spreadProps(__spreadValues({
43
41
  state,
@@ -1,4 +1,7 @@
1
- import "../chunk-G2ADBYYC.js";
1
+ import {
2
+ __spreadProps,
3
+ __spreadValues
4
+ } from "../chunk-G2ADBYYC.js";
2
5
  const handleEnterDesc = ({ state, props }) => ($event) => {
3
6
  const target = $event.target;
4
7
  if (target && target.scrollHeight > target.offsetHeight) {
@@ -17,7 +20,18 @@ const handleTitleClick = ({ props }) => () => {
17
20
  return;
18
21
  props.titleOption.click();
19
22
  };
23
+ const computedOptions = ({ props }) => () => {
24
+ return props.options.filter((item) => {
25
+ const hidden = typeof item.hidden === "function" ? item.hidden(props.data) : item.hidden;
26
+ return !hidden;
27
+ }).map((op) => {
28
+ return __spreadProps(__spreadValues({}, op), {
29
+ disabled: typeof op.disabled === "function" ? op.disabled(props.data) : op.disabled
30
+ });
31
+ });
32
+ };
20
33
  export {
34
+ computedOptions,
21
35
  handelIconClick,
22
36
  handleEnterDesc,
23
37
  handleTitleClick
@@ -1,19 +1,20 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
- import { handleEnterDesc, handelIconClick, handleTitleClick } from "./index";
3
- const api = ["state", "handelIconClick", "handleEnterDesc", "handleTitleClick"];
2
+ import { handleEnterDesc, handelIconClick, handleTitleClick, computedOptions } from "./index";
3
+ const api = ["state", "handelIconClick", "handleEnterDesc", "handleTitleClick", "computedOptions"];
4
4
  const renderless = (props, { computed, reactive }, { emit }) => {
5
+ const api2 = {};
5
6
  const state = reactive({
6
7
  descTooltip: "",
7
8
  sliceNum: 2,
8
9
  iconNum: 3,
9
- effectOptions: computed(() => props.options.filter((item) => !item.hidden))
10
+ effectOptions: computed(() => api2.computedOptions())
10
11
  });
11
- const api2 = {};
12
12
  Object.assign(api2, {
13
13
  state,
14
14
  handleTitleClick: handleTitleClick({ props }),
15
15
  handelIconClick: handelIconClick({ emit }),
16
- handleEnterDesc: handleEnterDesc({ state, props })
16
+ handleEnterDesc: handleEnterDesc({ state, props }),
17
+ computedOptions: computedOptions({ props })
17
18
  });
18
19
  return api2;
19
20
  };
package/steps/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
+ import { omitText } from "../common/string";
2
3
  const updateStartIndex = ({ state, props }) => () => {
3
4
  const { visibleNum, active } = props;
4
5
  const maxStartIndex = Math.min(props.data.length - visibleNum, active - Math.floor(visibleNum / 2));
@@ -23,9 +24,29 @@ const computedRightNodePos = ({ state, props }) => () => {
23
24
  right: -(index + 1) * 4 + "px"
24
25
  }));
25
26
  };
27
+ const handleMouseenter = ({ state, vm }) => (e, placement) => {
28
+ const ele = e.target;
29
+ const text = ele.textContent;
30
+ const font = window.getComputedStyle(ele).font;
31
+ const rect = ele.getBoundingClientRect();
32
+ const res = omitText(text, font, rect.width);
33
+ const popover = vm.$refs.popover;
34
+ if (res.o) {
35
+ popover.state.referenceElm = ele;
36
+ popover.state.popperElm && (popover.state.popperElm.style.display = "none");
37
+ popover.doDestroy();
38
+ state.popoverContent = text;
39
+ state.popoverVisible = true;
40
+ state.popoverPlacement = placement;
41
+ setTimeout(popover.updatePopper, 20);
42
+ }
43
+ };
44
+ const handleMouseleave = (state) => () => {
45
+ state.popoverVisible = false;
46
+ };
26
47
  const computedSpace = ({ props }) => {
27
- const { space } = props;
28
- if (/^\d+$/.test(space)) {
48
+ const { space = "" } = props;
49
+ if (/^\d+$/.test(String(space))) {
29
50
  return `${space}px`;
30
51
  }
31
52
  return space;
@@ -33,6 +54,8 @@ const computedSpace = ({ props }) => {
33
54
  export {
34
55
  computedRightNodePos,
35
56
  computedSpace,
57
+ handleMouseenter,
58
+ handleMouseleave,
36
59
  isVisibleHandler,
37
60
  updateStartIndex
38
61
  };
@@ -45,7 +45,14 @@ const rightSlideHandler = ({ state, api: api2 }) => () => {
45
45
  const updatePosition = ({ state, vm, props, api: api2 }) => debounce(10, (isInit) => {
46
46
  state.positionList = props.data.map((item, index) => {
47
47
  const blockRef = vm.$refs["block" + index];
48
- const position = blockRef && blockRef[0].getBoundingClientRect() || {};
48
+ let position = {};
49
+ if (blockRef) {
50
+ if (Array.isArray(blockRef)) {
51
+ position = blockRef[0] && blockRef[0].getBoundingClientRect();
52
+ } else {
53
+ position = blockRef.getBoundingClientRect();
54
+ }
55
+ }
49
56
  return Object.assign(position, { index });
50
57
  });
51
58
  state.slideMainPostion = vm.$refs.slideMain.getBoundingClientRect();