@opentiny/vue-renderless 3.6.8 → 3.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (314) hide show
  1. package/action-sheet/index.js +28 -1
  2. package/action-sheet/vue.js +10 -4
  3. package/alert/index.js +24 -2
  4. package/alert/vue.js +15 -11
  5. package/amount/index.js +4 -4
  6. package/anchor/index.js +1 -1
  7. package/autocomplete/vue.js +3 -3
  8. package/autonavi-map/index.js +1 -1
  9. package/badge/vue.js +6 -6
  10. package/baidu-map/index.js +1 -1
  11. package/bulletin-board/index.js +1 -1
  12. package/calendar/index.js +2 -2
  13. package/calendar-bar/index.js +268 -0
  14. package/calendar-bar/vue.js +87 -0
  15. package/card/index.js +84 -0
  16. package/card/vue.js +70 -0
  17. package/card-group/index.js +16 -0
  18. package/card-group/vue.js +21 -0
  19. package/card-template/index.js +1 -1
  20. package/carousel/index.js +89 -2
  21. package/carousel/vue.js +14 -5
  22. package/carousel-item/index.js +8 -0
  23. package/carousel-item/vue.js +7 -3
  24. package/cascader/index.js +6 -6
  25. package/cascader/vue.js +3 -3
  26. package/cascader-menu/vue.js +2 -2
  27. package/cascader-panel/index.js +4 -4
  28. package/cascader-panel/node.js +4 -4
  29. package/cascader-panel/vue.js +2 -2
  30. package/cascader-select/index.js +179 -0
  31. package/cascader-select/vue.js +74 -0
  32. package/cell/vue.js +16 -0
  33. package/chart-bar/index.js +3 -3
  34. package/chart-boxplot/index.js +2 -2
  35. package/chart-candle/index.js +3 -3
  36. package/chart-core/deps/utils.js +7 -7
  37. package/chart-core/index.js +2 -2
  38. package/chart-funnel/index.js +3 -3
  39. package/chart-gauge/index.js +3 -3
  40. package/chart-graph/index.js +1 -1
  41. package/chart-heatmap/index.js +2 -2
  42. package/chart-line/index.js +3 -3
  43. package/chart-liquidfill/index.js +2 -2
  44. package/chart-map/index.js +3 -3
  45. package/chart-pie/index.js +3 -3
  46. package/chart-radar/index.js +3 -3
  47. package/chart-sankey/index.js +3 -3
  48. package/chart-scatter/index.js +4 -4
  49. package/chart-sunburst/index.js +1 -1
  50. package/chart-tree/index.js +2 -2
  51. package/chart-waterfall/index.js +3 -3
  52. package/chart-wordcloud/index.js +2 -2
  53. package/checkbox/index.js +21 -0
  54. package/checkbox/vue.js +16 -3
  55. package/checkbox-button/vue.js +1 -1
  56. package/collapse-item/vue.js +1 -1
  57. package/column-list-group/index.js +0 -0
  58. package/column-list-group/vue.js +14 -0
  59. package/column-list-item/index.js +50 -0
  60. package/column-list-item/vue.js +39 -0
  61. package/common/array.js +3 -3
  62. package/common/bigInt.js +5 -2
  63. package/common/dataset/index.js +3 -3
  64. package/common/date.js +2 -2
  65. package/common/deps/ResizeObserver.js +1 -1
  66. package/common/deps/clickoutside.js +1 -1
  67. package/common/deps/date-util.js +4 -4
  68. package/common/deps/date.js +2 -2
  69. package/common/deps/debounce.js +1 -1
  70. package/common/deps/dom.js +1 -1
  71. package/common/deps/fullscreen/apis.js +3 -3
  72. package/common/deps/fullscreen/screenfull.js +1 -1
  73. package/common/deps/infinite-scroll.js +176 -0
  74. package/common/deps/letter-only.js +1 -1
  75. package/common/deps/number-only.js +1 -1
  76. package/common/deps/observe-visibility.js +106 -0
  77. package/common/deps/popper.js +20 -22
  78. package/common/deps/popup-manager.js +2 -2
  79. package/common/deps/repeat-click.js +1 -1
  80. package/common/deps/resize-event.js +1 -1
  81. package/common/deps/tree-model/node.js +5 -5
  82. package/common/deps/tree-model/tree-store.js +3 -3
  83. package/common/deps/upload-ajax.js +2 -2
  84. package/common/deps/vue-popper.js +4 -4
  85. package/common/deps/vue-popup.js +4 -4
  86. package/common/index.js +2 -2
  87. package/common/object.js +1 -1
  88. package/common/runtime.js +24 -24
  89. package/common/string.js +23 -4
  90. package/common/validate/rules/range.js +2 -2
  91. package/common/validate/rules/required.js +1 -1
  92. package/common/validate/rules/type.js +3 -3
  93. package/common/validate/schema.js +1 -1
  94. package/common/validate/util.js +1 -1
  95. package/common/validate/validations/array.js +1 -1
  96. package/common/validate/validations/date.js +1 -1
  97. package/common/validate/validations/enum.js +1 -1
  98. package/common/validate/validations/float.js +1 -1
  99. package/common/validate/validations/integer.js +1 -1
  100. package/common/validate/validations/method.js +1 -1
  101. package/common/validate/validations/number.js +1 -1
  102. package/common/validate/validations/pattern.js +1 -1
  103. package/common/validate/validations/string.js +1 -1
  104. package/common/validate/validations/type.js +1 -1
  105. package/container/index.js +1 -1
  106. package/crop/index.js +2 -2
  107. package/currency/index.js +2 -2
  108. package/date-panel/index.js +7 -7
  109. package/date-panel/vue.js +3 -2
  110. package/date-picker-mobile/index.js +250 -0
  111. package/date-picker-mobile/vue.js +86 -0
  112. package/date-range/index.js +1 -1
  113. package/date-range/vue.js +1 -1
  114. package/date-table/index.js +3 -3
  115. package/date-table/vue.js +1 -1
  116. package/dialog-box/index.js +6 -4
  117. package/dialog-box/vue.js +1 -1
  118. package/dialog-select/index.js +345 -0
  119. package/dialog-select/vue.js +110 -0
  120. package/drawer/index.js +83 -0
  121. package/drawer/vue.js +51 -0
  122. package/drop-times/index.js +1 -1
  123. package/dropdown/index.js +2 -2
  124. package/dropdown/vue.js +1 -1
  125. package/dropdown-item/index.js +1 -1
  126. package/dropdown-item/mf.js +79 -0
  127. package/dropdown-menu/index.js +30 -1
  128. package/dropdown-menu/vue.js +17 -7
  129. package/dynamic-scroller/index.js +117 -0
  130. package/dynamic-scroller/vue.js +88 -0
  131. package/dynamic-scroller-item/index.js +147 -0
  132. package/dynamic-scroller-item/vue.js +92 -0
  133. package/espace/index.js +1 -1
  134. package/espace/vue.js +1 -1
  135. package/exception/vue.js +3 -1
  136. package/fall-menu/index.js +4 -4
  137. package/file-upload/index.js +872 -408
  138. package/file-upload/vue.js +87 -36
  139. package/filter/index.js +131 -0
  140. package/filter/tag-group.js +43 -0
  141. package/filter/vue.js +73 -0
  142. package/filter-bar/index.js +9 -0
  143. package/filter-bar/vue.js +16 -0
  144. package/filter-box/index.js +17 -0
  145. package/filter-box/vue.js +19 -0
  146. package/filter-panel/index.js +42 -0
  147. package/filter-panel/vue.js +33 -0
  148. package/floatbar/index.js +1 -1
  149. package/flowchart/index.js +721 -0
  150. package/flowchart/vue.js +81 -0
  151. package/form/index.js +15 -1
  152. package/form/vue.js +10 -4
  153. package/form-item/index.js +46 -6
  154. package/form-item/vue.js +27 -3
  155. package/fullscreen/index.js +1 -1
  156. package/fullscreen/vue.js +1 -1
  157. package/grid/plugins/export.js +2 -2
  158. package/grid/plugins/exportExcel.js +2 -2
  159. package/grid/plugins/resize.js +1 -1
  160. package/grid/static/base/helperEqualCompare.js +1 -1
  161. package/grid/static/base/isPlainObject.js +1 -1
  162. package/grid/utils/common.js +3 -3
  163. package/grid/utils/dom.js +3 -3
  164. package/grid/utils/event.js +2 -2
  165. package/guide/index.js +168 -0
  166. package/guide/vue.js +36 -0
  167. package/hrapprover/index.js +1 -1
  168. package/image/index.js +8 -4
  169. package/image/vue.js +12 -6
  170. package/image-viewer/index.js +3 -3
  171. package/image-viewer/vue.js +16 -6
  172. package/input/index.js +34 -1
  173. package/input/vue.js +22 -6
  174. package/ip-address/index.js +1 -1
  175. package/ip-address/vue.js +1 -1
  176. package/link-menu/index.js +2 -2
  177. package/link-menu/vue.js +2 -2
  178. package/loading/index.js +2 -2
  179. package/loading/vue.js +2 -1
  180. package/locales/index.js +1 -1
  181. package/logout/index.js +1 -1
  182. package/milestone/index.js +5 -1
  183. package/modal/index.js +68 -39
  184. package/modal/vue.js +15 -12
  185. package/month-range/index.js +1 -1
  186. package/month-range/vue.js +1 -1
  187. package/month-table/index.js +5 -5
  188. package/month-table/vue.js +1 -1
  189. package/multi-select/index.js +5 -2
  190. package/multi-select/vue.js +4 -5
  191. package/nav-menu/index.js +6 -6
  192. package/notify/index.js +3 -3
  193. package/numeric/index.js +15 -5
  194. package/numeric/vue.js +15 -6
  195. package/option/index.js +1 -1
  196. package/package.json +2 -1
  197. package/pager-item/index.js +1 -1
  198. package/panel/index.js +1 -1
  199. package/picker/index.js +7 -7
  200. package/picker/vue.js +1 -1
  201. package/picker-column/index.js +1 -1
  202. package/popconfirm/index.js +25 -0
  203. package/popconfirm/vue.js +22 -0
  204. package/popeditor/index.js +7 -7
  205. package/popeditor/vue.js +2 -2
  206. package/popover/index.js +11 -3
  207. package/popover/vue.js +33 -10
  208. package/popup/index.js +4 -4
  209. package/pull-refresh/index.js +8 -11
  210. package/pull-refresh/vue.js +7 -7
  211. package/radio/index.js +17 -0
  212. package/radio/vue.js +18 -3
  213. package/radio-button/index.js +8 -0
  214. package/radio-button/vue.js +19 -4
  215. package/radio-group/index.js +1 -1
  216. package/radio-group/vue.js +5 -2
  217. package/rate/index.js +4 -2
  218. package/rate/vue.js +1 -1
  219. package/record/index.js +190 -0
  220. package/record/vue.js +44 -0
  221. package/recycle-scroller/index.js +470 -0
  222. package/recycle-scroller/vue.js +135 -0
  223. package/river/index.js +371 -0
  224. package/river/river.js +352 -0
  225. package/river/vue.js +77 -0
  226. package/roles/index.js +1 -1
  227. package/scrollbar/vue-bar.js +1 -1
  228. package/scrollbar/vue.js +1 -1
  229. package/search/index.js +3 -3
  230. package/select/index.js +17 -14
  231. package/select/vue.js +14 -8
  232. package/select-dropdown/vue.js +1 -1
  233. package/select-mobile/index.js +111 -0
  234. package/select-mobile/vue.js +58 -0
  235. package/select-view/index.js +170 -0
  236. package/select-view/vue.js +82 -0
  237. package/selected-box/index.js +216 -0
  238. package/selected-box/vue.js +98 -0
  239. package/slide-bar/index.js +1 -1
  240. package/slider/index.js +49 -4
  241. package/slider/vue.js +15 -4
  242. package/split/vue.js +1 -1
  243. package/standard-list-item/index.js +18 -0
  244. package/standard-list-item/vue.js +22 -0
  245. package/steps/index.js +30 -0
  246. package/steps/slide-bar.js +122 -0
  247. package/steps/vue.js +15 -3
  248. package/switch/index.js +1 -1
  249. package/switch/vue.js +2 -1
  250. package/tab-bar/index.js +2 -2
  251. package/tab-item/index.js +2 -2
  252. package/tab-item/vue.js +1 -1
  253. package/tab-item-mf/index.js +0 -0
  254. package/tab-item-mf/vue.js +16 -0
  255. package/tab-nav/index.js +78 -4
  256. package/tab-nav/vue.js +11 -3
  257. package/tabbar-item/index.js +1 -1
  258. package/tabbar-item/vue.js +1 -1
  259. package/tabs/index.js +8 -9
  260. package/tabs/vue.js +1 -1
  261. package/tabs-mf/index.js +109 -0
  262. package/tabs-mf/vue-bar.js +49 -0
  263. package/tabs-mf/vue-nav-item.js +22 -0
  264. package/tabs-mf/vue-nav.js +13 -0
  265. package/tabs-mf/vue.js +45 -0
  266. package/tabs-mf/wheel.js +71 -0
  267. package/tag/index.js +8 -2
  268. package/tag/vue.js +13 -5
  269. package/tag-group/index.js +24 -0
  270. package/tag-group/vue.js +29 -0
  271. package/tall-storage/index.js +1 -1
  272. package/tall-storage/vue.js +1 -1
  273. package/time/index.js +1 -1
  274. package/time/vue.js +2 -2
  275. package/time-line/index.js +28 -7
  276. package/time-line/vue.js +9 -4
  277. package/time-panel/index.js +2 -2
  278. package/time-panel/vue.js +1 -1
  279. package/time-picker-mobile/index.js +30 -0
  280. package/time-picker-mobile/vue.js +30 -0
  281. package/time-range/index.js +1 -1
  282. package/time-range/vue.js +1 -1
  283. package/time-spinner/index.js +2 -2
  284. package/time-spinner/vue.js +1 -1
  285. package/toggle-menu/index.js +2 -2
  286. package/toggle-menu/vue.js +1 -1
  287. package/tooltip/index.js +30 -3
  288. package/tooltip/vue.js +33 -12
  289. package/top-box/index.js +3 -3
  290. package/transfer/index.js +1 -1
  291. package/transfer-panel/index.js +2 -2
  292. package/tree/index.js +6 -6
  293. package/tree/vue.js +1 -1
  294. package/tree-node/index.js +1 -1
  295. package/upload/index.js +1 -1
  296. package/upload/vue.js +2 -2
  297. package/upload-dragger/index.js +5 -1
  298. package/upload-dragger/vue.js +9 -3
  299. package/upload-list/index.js +158 -8
  300. package/upload-list/vue.js +77 -25
  301. package/user/index.js +86 -70
  302. package/user/vue.js +15 -5
  303. package/user-account/vue.js +1 -1
  304. package/user-contact/index.js +49 -3
  305. package/user-contact/vue.js +17 -8
  306. package/user-head-group/vue.js +17 -0
  307. package/user-link/index.js +10 -2
  308. package/user-link/vue.js +11 -6
  309. package/wheel/index.js +1 -1
  310. package/wizard/index.js +3 -3
  311. package/year-range/index.js +125 -0
  312. package/year-range/vue.js +88 -0
  313. package/year-table/index.js +175 -11
  314. package/year-table/vue.js +17 -5
@@ -0,0 +1,98 @@
1
+ import "../chunk-PKUHTIDK.js";
2
+ import {
3
+ init,
4
+ submitSelection,
5
+ getSelection,
6
+ i18nSelected,
7
+ computedShowAuxi,
8
+ textPrimary,
9
+ textAuxi,
10
+ handleMouseenter,
11
+ handleMouseleave,
12
+ handleClear,
13
+ handleDelete,
14
+ emitChange,
15
+ keyOption,
16
+ keyType,
17
+ initDrag,
18
+ unmount,
19
+ arrayMinus,
20
+ batchSubmit,
21
+ getParams,
22
+ coverSubmit
23
+ } from "./index";
24
+ const api = [
25
+ "state",
26
+ "init",
27
+ "submitSelection",
28
+ "getSelection",
29
+ "i18nSelected",
30
+ "textPrimary",
31
+ "textAuxi",
32
+ "handleMouseenter",
33
+ "handleMouseleave",
34
+ "handleClear",
35
+ "handleDelete",
36
+ "keyOption",
37
+ "keyType",
38
+ "batchSubmit",
39
+ "coverSubmit"
40
+ ];
41
+ const renderless = (props, { reactive, computed, onBeforeMount, onMounted, onBeforeUnmount, watch, markRaw }, { emit, t, vm }) => {
42
+ const state = reactive({
43
+ inverse: false,
44
+ total: 0,
45
+ select: [],
46
+ refresh: 0,
47
+ optionSelector: '[data-tag="tiny-selected-box-item"]',
48
+ dragAnimation: 100,
49
+ showAuxi: computed(() => api2.computedShowAuxi()),
50
+ popoverVisible: false,
51
+ popoverContent: "",
52
+ dragInstance: null,
53
+ slotParams: computed(() => ({ inverse: state.inverse, total: state.total, select: state.select }))
54
+ });
55
+ const api2 = {
56
+ state,
57
+ init: init({ props, state }),
58
+ i18nSelected: i18nSelected({ state, t }),
59
+ computedShowAuxi: computedShowAuxi(props),
60
+ textPrimary: textPrimary(props),
61
+ textAuxi: textAuxi(props),
62
+ handleMouseenter: handleMouseenter({ state, vm }),
63
+ handleMouseleave: handleMouseleave(state),
64
+ keyType: keyType(props),
65
+ unmount: unmount(state),
66
+ getParams: getParams(state)
67
+ };
68
+ Object.assign(api2, {
69
+ submitSelection: submitSelection({ api: api2, state }),
70
+ handleClear: handleClear({ api: api2, emit, props, state }),
71
+ handleDelete: handleDelete({ api: api2, emit, state }),
72
+ emitChange: emitChange({ api: api2, emit }),
73
+ initDrag: initDrag({ api: api2, emit, markRaw, props, state, vm }),
74
+ arrayMinus: arrayMinus(api2),
75
+ batchSubmit: batchSubmit({ api: api2, state }),
76
+ getSelection: getSelection({ api: api2, state }),
77
+ coverSubmit: coverSubmit({ api: api2, props, state }),
78
+ keyOption: keyOption({ api: api2, props })
79
+ });
80
+ onBeforeMount(() => {
81
+ api2.init();
82
+ });
83
+ onMounted(() => {
84
+ api2.initDrag();
85
+ });
86
+ onBeforeUnmount(() => {
87
+ api2.unmount();
88
+ });
89
+ watch(
90
+ () => props.inverse,
91
+ () => api2.init()
92
+ );
93
+ return api2;
94
+ };
95
+ export {
96
+ api,
97
+ renderless
98
+ };
@@ -1,5 +1,5 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
- import { emitEvent } from "@opentiny/vue-renderless/common/event";
2
+ import { emitEvent } from "../common/event";
3
3
  const leftClick = ({ api, props, refs, state }) => () => {
4
4
  if (state.leftLength >= 0) {
5
5
  return;
package/slider/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
- import { KEY_CODE } from "@opentiny/vue-renderless/common";
3
- import { emitEvent } from "@opentiny/vue-renderless/common/event";
4
- import { on, off, hasClass } from "@opentiny/vue-renderless/common/deps/dom";
5
- import { toNumber } from "@opentiny/vue-renderless/common/string";
2
+ import { KEY_CODE } from "../common";
3
+ import { emitEvent } from "../common/event";
4
+ import { on, off, hasClass } from "../common/deps/dom";
5
+ import { toNumber } from "../common/string";
6
6
  const bindEvent = (api) => () => {
7
7
  on(window, "resize", api.bindResize);
8
8
  api.bindResize();
@@ -314,6 +314,48 @@ const watchModelValue = ({ api, state }) => (value) => {
314
314
  }
315
315
  }
316
316
  };
317
+ const getPoints = ({ props, state }) => () => {
318
+ if (props.showSteps && props.step > 0) {
319
+ state.points = [];
320
+ const num = parseInt(props.max / props.step);
321
+ for (let i = 1; i < num; i++) {
322
+ const point = {
323
+ position: i / num * 100 + "%",
324
+ value: i / num * props.max
325
+ };
326
+ state.points.push(point);
327
+ }
328
+ }
329
+ };
330
+ const getLabels = ({ props, state }) => () => {
331
+ if (props.showLabel) {
332
+ state.labels = [];
333
+ const isFunction = props.formatLabel instanceof Function;
334
+ const num = parseInt(props.max / props.step);
335
+ for (let i = 0; i <= num; i++) {
336
+ const val = i / num * props.max;
337
+ const label = {
338
+ position: i / num * 100 + "%",
339
+ label: isFunction ? props.formatLabel(val, i) : val,
340
+ value: val
341
+ };
342
+ state.labels.push(label);
343
+ }
344
+ }
345
+ };
346
+ const inputValueChange = ({ props, state, api }) => ($event, pos) => {
347
+ if (props.disabled || !state.isDouble)
348
+ return;
349
+ if (!/^\d+$/.test($event.target.value)) {
350
+ if (pos === "left") {
351
+ state.inputValue.splice(0, 1, state.leftBtnValue);
352
+ } else {
353
+ state.inputValue.splice(1, 1, state.rightBtnValue);
354
+ }
355
+ return;
356
+ }
357
+ api.initSlider([Math.min(...state.inputValue), Math.max(...state.inputValue)]);
358
+ };
317
359
  export {
318
360
  autoSlider,
319
361
  bindEvent,
@@ -330,8 +372,11 @@ export {
330
372
  formatTipValue,
331
373
  getActiveButtonIndex,
332
374
  getActiveButtonValue,
375
+ getLabels,
376
+ getPoints,
333
377
  hideTip,
334
378
  initSlider,
379
+ inputValueChange,
335
380
  setActiveButtonValue,
336
381
  setBarStyle,
337
382
  setButtonStyle,
package/slider/vue.js CHANGED
@@ -23,7 +23,10 @@ import {
23
23
  customBeforeAppearHook,
24
24
  customAfterAppearHook,
25
25
  watchActiveValue,
26
- watchModelValue
26
+ watchModelValue,
27
+ getPoints,
28
+ getLabels,
29
+ inputValueChange
27
30
  } from "./index";
28
31
  const api = [
29
32
  "state",
@@ -48,7 +51,8 @@ const api = [
48
51
  "hideTip",
49
52
  "autoSlider",
50
53
  "customBeforeAppearHook",
51
- "customAfterAppearHook"
54
+ "customAfterAppearHook",
55
+ "inputValueChange"
52
56
  ];
53
57
  const initState = ({ reactive, computed, props, api: api2, parent }) => {
54
58
  const state = reactive({
@@ -108,11 +112,18 @@ const renderless = (props, { computed, onBeforeUnmount, onMounted, reactive, wat
108
112
  setActiveButtonValue: setActiveButtonValue({ api: api2, emit, props, state }),
109
113
  initSlider: initSlider({ api: api2, props, state }),
110
114
  watchModelValue: watchModelValue({ api: api2, state }),
111
- watchActiveValue: watchActiveValue({ api: api2, emit, props, state })
115
+ watchActiveValue: watchActiveValue({ api: api2, emit, props, state }),
116
+ getPoints: getPoints({ props, state }),
117
+ getLabels: getLabels({ props, state }),
118
+ inputValueChange: inputValueChange({ props, api: api2, state })
112
119
  });
113
120
  watch(() => props.modelValue, api2.watchModelValue, { immediate: true });
114
121
  watch(() => state.activeValue, api2.watchActiveValue, { immediate: true });
115
- onMounted(api2.bindEvent);
122
+ onMounted(() => {
123
+ api2.bindEvent();
124
+ api2.getPoints();
125
+ api2.getLabels();
126
+ });
116
127
  onBeforeUnmount(api2.unBindEvent);
117
128
  return api2;
118
129
  };
package/split/vue.js CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  computeOffset,
15
15
  handleCollapse
16
16
  } from "./index";
17
- import { on, off } from "@opentiny/vue-renderless/common/deps/dom";
17
+ import { on, off } from "../common/deps/dom";
18
18
  const api = ["state", "handleMousedown", "handleCollapse"];
19
19
  const useOffset = ({ nextTick, props, refs, constants, hooks }) => {
20
20
  const api2 = {};
@@ -0,0 +1,18 @@
1
+ import "../chunk-PKUHTIDK.js";
2
+ const handleEnterDesc = ({ state, props }) => ($event) => {
3
+ const target = $event.target;
4
+ if (target && target.scrollHeight > target.offsetHeight) {
5
+ state.descTooltip = props.data.desc;
6
+ } else {
7
+ state.descTooltip = "";
8
+ }
9
+ };
10
+ const handelIconClick = ({ emit }) => (item, index) => {
11
+ if (item.disabled)
12
+ return;
13
+ emit("icon-click", item, index);
14
+ };
15
+ export {
16
+ handelIconClick,
17
+ handleEnterDesc
18
+ };
@@ -0,0 +1,22 @@
1
+ import "../chunk-PKUHTIDK.js";
2
+ import { handleEnterDesc, handelIconClick } from "./index";
3
+ const api = ["state", "handelIconClick", "handleEnterDesc"];
4
+ const renderless = (props, { computed, reactive }, { emit }) => {
5
+ const state = reactive({
6
+ descTooltip: "",
7
+ sliceNum: 2,
8
+ iconNum: 3,
9
+ effectOptions: computed(() => props.options.filter((item) => !item.hidden))
10
+ });
11
+ const api2 = {};
12
+ Object.assign(api2, {
13
+ state,
14
+ handelIconClick: handelIconClick({ emit }),
15
+ handleEnterDesc: handleEnterDesc({ state, props })
16
+ });
17
+ return api2;
18
+ };
19
+ export {
20
+ api,
21
+ renderless
22
+ };
package/steps/index.js ADDED
@@ -0,0 +1,30 @@
1
+ import "../chunk-PKUHTIDK.js";
2
+ const updateStartIndex = ({ state, props }) => () => {
3
+ const { visibleNum, active } = props;
4
+ const maxStartIndex = Math.min(props.data.length - visibleNum, active - Math.floor(visibleNum / 2));
5
+ state.startIndex = Math.max(0, maxStartIndex);
6
+ };
7
+ const isVisibleHandler = ({ state, props }) => (index) => {
8
+ if (index < state.startIndex) {
9
+ return "hidden-left";
10
+ } else if (index >= state.startIndex + props.visibleNum) {
11
+ return "hidden-right";
12
+ } else {
13
+ return "visible";
14
+ }
15
+ };
16
+ const computedRightNodePos = ({ state, props }) => () => {
17
+ const { data } = props;
18
+ const { endIndex } = state;
19
+ const dataLength = data.length;
20
+ const nodesLength = dataLength - 1 - endIndex;
21
+ return Array.from({ length: nodesLength }).map((item, index) => ({
22
+ zIndex: dataLength - index,
23
+ right: -(index + 1) * 4 + "px"
24
+ }));
25
+ };
26
+ export {
27
+ computedRightNodePos,
28
+ isVisibleHandler,
29
+ updateStartIndex
30
+ };
@@ -0,0 +1,122 @@
1
+ import "../chunk-PKUHTIDK.js";
2
+ import debounce from "../common/deps/debounce";
3
+ import { on, off } from "../common/deps/dom";
4
+ const getBoundingPosition = ({ state }) => () => {
5
+ const { slideMainPostion, positionList } = state;
6
+ const list = positionList.slice();
7
+ const len = list.length;
8
+ state.boundingIndex = {
9
+ left: -1,
10
+ right: -1
11
+ };
12
+ for (let i = 0; i < len; i++) {
13
+ if (list[i].right > slideMainPostion.right + 2) {
14
+ state.boundingIndex.right = i;
15
+ break;
16
+ }
17
+ }
18
+ for (let i = len - 1; i >= 0; i--) {
19
+ if (list[i].left < slideMainPostion.left) {
20
+ state.boundingIndex.left = i;
21
+ break;
22
+ }
23
+ }
24
+ };
25
+ const leftSlideHandler = ({ state, api: api2 }) => () => {
26
+ const { canLeftScroll, slideMainPostion, positionList, boundingIndex } = state;
27
+ if (!canLeftScroll || state.timer) {
28
+ return;
29
+ }
30
+ const position = boundingIndex.left !== -1 && positionList[boundingIndex.left];
31
+ if (position) {
32
+ api2.animationHandler(position.left - slideMainPostion.left);
33
+ }
34
+ };
35
+ const rightSlideHandler = ({ state, api: api2 }) => () => {
36
+ const { canRightScroll, slideMainPostion, positionList, boundingIndex } = state;
37
+ if (!canRightScroll || state.timer) {
38
+ return;
39
+ }
40
+ const position = boundingIndex.right !== -1 && positionList[boundingIndex.right];
41
+ if (position) {
42
+ api2.animationHandler(position.right - slideMainPostion.right);
43
+ }
44
+ };
45
+ const updatePosition = ({ state, vm, props, api: api2 }) => debounce(10, (isInit) => {
46
+ state.positionList = props.data.map((item, index) => {
47
+ const blockRef = vm.$refs["block" + index];
48
+ const position = blockRef && blockRef[0].getBoundingClientRect() || {};
49
+ return Object.assign(position, { index });
50
+ });
51
+ state.slideMainPostion = vm.$refs.slideMain.getBoundingClientRect();
52
+ api2.getBoundingPosition();
53
+ isInit === true && api2.updatePosition();
54
+ });
55
+ const animationLoop = ({ state, api: api2, vm }) => (offset, delay, scorllLeft, cb) => {
56
+ const elScrollLeft = vm.$refs.slideMain.scrollLeft;
57
+ clearTimeout(state.timer);
58
+ if (elScrollLeft !== state.oldScrollLeft && Math.abs(elScrollLeft - scorllLeft) > Math.abs(offset)) {
59
+ state.timer = setTimeout(() => {
60
+ vm.$refs.slideMain.scrollLeft += offset;
61
+ state.oldScrollLeft = elScrollLeft;
62
+ api2.animationLoop(offset, delay, scorllLeft, cb);
63
+ }, delay);
64
+ } else {
65
+ state.timer = null;
66
+ vm.$refs.slideMain.scrollLeft = scorllLeft;
67
+ cb && cb();
68
+ }
69
+ };
70
+ const animationHandler = ({ api: api2, vm, props }) => (allOffset) => {
71
+ const { duration, delay } = props;
72
+ const mathFn = allOffset > 0 ? Math.ceil : Math.floor;
73
+ const offsetInt = mathFn(allOffset);
74
+ if (!duration) {
75
+ vm.$refs.slideMain.scrollLeft += offsetInt;
76
+ api2.updatePosition();
77
+ return;
78
+ }
79
+ const offset = mathFn(offsetInt / (duration / delay));
80
+ const scorllLeft = vm.$refs.slideMain.scrollLeft + offsetInt;
81
+ api2.animationLoop(offset, delay, scorllLeft, () => {
82
+ api2.updatePosition();
83
+ });
84
+ };
85
+ const api = ["slideBarState", "leftSlideHandler", "rightSlideHandler", "updatePosition"];
86
+ const renderless = (props, { reactive, onMounted, onUnmounted, computed }, { vm }) => {
87
+ const state = reactive({
88
+ timer: null,
89
+ oldScrollLeft: -1,
90
+ slideMainPostion: {},
91
+ positionList: [],
92
+ canLeftScroll: computed(() => !props.noArrow && state.boundingIndex.left !== -1),
93
+ canRightScroll: computed(() => !props.noArrow && state.boundingIndex.right !== -1),
94
+ boundingIndex: {
95
+ left: -1,
96
+ right: -1
97
+ }
98
+ });
99
+ const api2 = {};
100
+ Object.assign(api2, {
101
+ slideBarState: state,
102
+ // 内部 state 重命名,避免使用插槽时 state 覆盖问题
103
+ leftSlideHandler: leftSlideHandler({ state, api: api2 }),
104
+ rightSlideHandler: rightSlideHandler({ state, api: api2 }),
105
+ animationHandler: animationHandler({ api: api2, vm, props }),
106
+ animationLoop: animationLoop({ state, api: api2, vm }),
107
+ getBoundingPosition: getBoundingPosition({ state, api: api2, vm }),
108
+ updatePosition: updatePosition({ state, vm, props, api: api2 })
109
+ });
110
+ onMounted(() => {
111
+ api2.updatePosition(true);
112
+ on(window, "resize", api2.updatePosition);
113
+ });
114
+ onUnmounted(() => {
115
+ off(window, "resize", api2.updatePosition);
116
+ });
117
+ return api2;
118
+ };
119
+ export {
120
+ api,
121
+ renderless
122
+ };
package/steps/vue.js CHANGED
@@ -1,7 +1,19 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
- const api = [];
3
- const renderless = function() {
4
- return {};
2
+ import { updateStartIndex, isVisibleHandler, computedRightNodePos } from "./index";
3
+ const api = ["state", "isVisibleHandler"];
4
+ const renderless = (props, { reactive, watch, computed }) => {
5
+ const state = reactive({
6
+ startIndex: 0,
7
+ endIndex: computed(() => state.startIndex + props.visibleNum),
8
+ rightNodePositions: computed(() => api2.computedRightNodePos())
9
+ });
10
+ const api2 = {
11
+ updateStartIndex: updateStartIndex({ state, props }),
12
+ isVisibleHandler: isVisibleHandler({ state, props }),
13
+ computedRightNodePos: computedRightNodePos({ state, props })
14
+ };
15
+ watch(() => props.active, api2.updateStartIndex, { immediate: true });
16
+ return Object.assign(api2, { state });
5
17
  };
6
18
  export {
7
19
  api,
package/switch/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
- import { isNull } from "@opentiny/vue-renderless/common/type";
2
+ import { isNull } from "../common/type";
3
3
  const toggle = ({ emit, props, state }) => (event) => {
4
4
  event.preventDefault();
5
5
  if (state.disabled) {
package/switch/vue.js CHANGED
@@ -13,7 +13,8 @@ const renderless = (props, { computed, watch, reactive, inject }, { parent, cons
13
13
  wrapClasses: computed(() => api2.computedWarpClasses()),
14
14
  style: computed(() => api2.computedStyle()),
15
15
  formDisabled: computed(() => (parent.tinyForm || {}).disabled),
16
- disabled: computed(() => props.disabled || state.formDisabled)
16
+ disabled: computed(() => props.disabled || state.formDisabled),
17
+ isDisplayOnly: computed(() => props.displayOnly || (parent.tinyForm || {}).displayOnly)
17
18
  });
18
19
  Object.assign(api2, {
19
20
  state,
package/tab-bar/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
- import { POSITION } from "@opentiny/vue-renderless/common";
3
- import { capitalize } from "@opentiny/vue-renderless/common/string";
2
+ import { POSITION } from "../common";
3
+ import { capitalize } from "../common/string";
4
4
  const computedBarStyle = (parent) => (props, state) => {
5
5
  const style = {};
6
6
  let offset = 0;
package/tab-item/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
2
  const computedIsClosable = ({ parent, props }) => () => props.withClose || parent.withClose;
3
- const computedActive = ({ parent, nextTick, props, state }) => () => {
4
- const active = parent.state.currentName === (props.name || state.index);
3
+ const computedActive = ({ nextTick, props, state }) => () => {
4
+ const active = state.rootTabs.state.currentName === (props.name || state.index);
5
5
  if (active) {
6
6
  state.loaded = true;
7
7
  nextTick(() => {
package/tab-item/vue.js CHANGED
@@ -17,7 +17,7 @@ const renderless = (props, { computed, inject, reactive, watch }, { parent, next
17
17
  });
18
18
  Object.assign(api2, {
19
19
  state,
20
- computedActive: computedActive({ parent, nextTick, props, state }),
20
+ computedActive: computedActive({ nextTick, props, state }),
21
21
  computedPaneName: computedPaneName({ props, state })
22
22
  });
23
23
  watch(() => props.title, api2.watchTitle);
File without changes
@@ -0,0 +1,16 @@
1
+ import "../chunk-PKUHTIDK.js";
2
+ const renderless = (props, { inject }, { slots }) => {
3
+ const tabs = inject("tabs", null);
4
+ const { title, name } = props;
5
+ const item = { title, name, slotDefault: slots.default, slotTitle: slots.title, slotSetting: slots.setting };
6
+ if (props.renderTitle)
7
+ item.slotTitle = props.renderTitle;
8
+ if (props.renderSetting)
9
+ item.slotSetting = props.renderSetting;
10
+ item.selected = (tabs.activeName || tabs.modelValue) === name;
11
+ tabs.addItem(item);
12
+ return {};
13
+ };
14
+ export {
15
+ renderless
16
+ };
package/tab-nav/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
- import { KEY_CODE, POSITION } from "@opentiny/vue-renderless/common";
3
- import { capitalize } from "@opentiny/vue-renderless/common/string";
4
- import { addResizeListener, removeResizeListener } from "@opentiny/vue-renderless/common/deps/resize-event";
5
- import { on, off } from "@opentiny/vue-renderless/common/deps/dom";
2
+ import { KEY_CODE, POSITION } from "../common";
3
+ import { capitalize } from "../common/string";
4
+ import { addResizeListener, removeResizeListener } from "../common/deps/resize-event";
5
+ import { on, off } from "../common/deps/dom";
6
6
  const computedNavStyle = (state) => {
7
7
  const dir = ~[POSITION.Top, POSITION.Bottom].indexOf(state.rootTabs.position) ? "X" : "Y";
8
8
  if (state.mode === "mobile") {
@@ -75,6 +75,7 @@ const mounted = ({ api, parent }) => {
75
75
  on(window, "focus", api.windowFocusHandler);
76
76
  api.scrollToActiveTab();
77
77
  api.scrollIntoView();
78
+ api.sortableEvent();
78
79
  };
79
80
  const beforeUnmount = ({ api, parent }) => {
80
81
  const el = parent.$refs.nav && parent.$refs.nav.$el;
@@ -208,6 +209,75 @@ const computedHeaderStyle = ({ refs, state }) => () => {
208
209
  }
209
210
  return state.expandHeaderStyle;
210
211
  };
212
+ const handleTabDragStart = ({ state, vm, emit }) => (event) => {
213
+ state.dragging = true;
214
+ if ([POSITION.Top, POSITION.Bottom].indexOf(state.rootTabs.position) === -1) {
215
+ emit("tab-drag-start", event);
216
+ return;
217
+ }
218
+ const navContainer = vm.$refs.navScroll;
219
+ const nav = vm.$refs.nav;
220
+ const containerWidth = navContainer.offsetWidth;
221
+ const navWidth = nav.offsetWidth;
222
+ if (navWidth > containerWidth) {
223
+ const navHeight = nav.offsetHeight;
224
+ navContainer.style.height = navHeight + "px";
225
+ nav.style.transition = "none";
226
+ nav.style.transform = "";
227
+ nav.style.width = containerWidth + "px";
228
+ nav.style.overflowX = "scroll";
229
+ nav.scrollTo(state.navOffset, 0);
230
+ }
231
+ emit("tab-drag-start", event);
232
+ };
233
+ const handleTabDragEnd = ({ vm, state, nextTick }) => () => {
234
+ state.dragging = false;
235
+ if ([POSITION.Top, POSITION.Bottom].indexOf(state.rootTabs.position) === -1) {
236
+ return;
237
+ }
238
+ const nav = vm.$refs.nav;
239
+ if (nav.style.width) {
240
+ const navOffset = nav.scrollLeft;
241
+ const navContainer = vm.$refs.navScroll;
242
+ navContainer.style.height = "";
243
+ nav.style.width = "";
244
+ nav.style.overflowX = "";
245
+ state.navOffset = navOffset;
246
+ nextTick(() => {
247
+ nav.style.transition = "";
248
+ });
249
+ }
250
+ };
251
+ const sortableEvent = ({ api, props, state, vm, emit, markRaw }) => () => {
252
+ if (!props.dropConfig || typeof props.dropConfig.plugin !== "function") {
253
+ return;
254
+ }
255
+ const navSortableObj = new props.dropConfig.plugin(vm.$refs.nav, {
256
+ sort: true,
257
+ draggable: ".tiny-tabs__item",
258
+ onUpdate(event) {
259
+ emit("tab-drag-end", event);
260
+ },
261
+ onMove(event) {
262
+ emit("tab-drag-over", event);
263
+ },
264
+ onStart(event) {
265
+ api.handleTabDragStart(event);
266
+ },
267
+ onEnd(event) {
268
+ api.handleTabDragEnd(event);
269
+ }
270
+ });
271
+ state.navSortableObj = markRaw(navSortableObj);
272
+ };
273
+ const watchCurrentName = ({ nextTick, vm, state }) => () => {
274
+ nextTick(() => {
275
+ const tabBarVnode = vm.$refs.tabBar;
276
+ if (tabBarVnode) {
277
+ tabBarVnode.state.barStyle = tabBarVnode.computedBarStyle(tabBarVnode, state);
278
+ }
279
+ });
280
+ };
211
281
  export {
212
282
  beforeUnmount,
213
283
  changeTab,
@@ -216,6 +286,8 @@ export {
216
286
  computedSizeName,
217
287
  expandTabHide,
218
288
  expandTabShow,
289
+ handleTabDragEnd,
290
+ handleTabDragStart,
219
291
  moreTabShow,
220
292
  mounted,
221
293
  removeFocus,
@@ -224,8 +296,10 @@ export {
224
296
  scrollPrev,
225
297
  scrollToActiveTab,
226
298
  setFocus,
299
+ sortableEvent,
227
300
  updated,
228
301
  visibilityChangeHandler,
302
+ watchCurrentName,
229
303
  windowBlurHandler,
230
304
  windowFocusHandler
231
305
  };
package/tab-nav/vue.js CHANGED
@@ -18,7 +18,11 @@ import {
18
18
  scrollNext,
19
19
  changeTab,
20
20
  setFocus,
21
- removeFocus
21
+ removeFocus,
22
+ sortableEvent,
23
+ handleTabDragStart,
24
+ handleTabDragEnd,
25
+ watchCurrentName
22
26
  } from "./index";
23
27
  const api = [
24
28
  "state",
@@ -35,7 +39,7 @@ const api = [
35
39
  "computedHeaderStyle",
36
40
  "swiperHandle"
37
41
  ];
38
- const renderless = (props, { computed, inject, onBeforeUnmount, onMounted, onUpdated, reactive }, { parent, refs, mode: tinyMode }) => {
42
+ const renderless = (props, { computed, inject, onBeforeUnmount, onMounted, onUpdated, reactive, markRaw }, { parent, vm, nextTick, refs, mode: tinyMode, emit }) => {
39
43
  const api2 = { mounted, beforeUnmount, computedNavStyle, computedSizeName };
40
44
  const state = reactive({
41
45
  navOffset: 0,
@@ -68,7 +72,11 @@ const renderless = (props, { computed, inject, onBeforeUnmount, onMounted, onUpd
68
72
  visibilityChangeHandler: visibilityChangeHandler(state),
69
73
  scrollToActiveTab: scrollToActiveTab({ props, parent, refs, state }),
70
74
  scrollIntoView: scrollIntoView({ props, parent, refs, state }),
71
- computedHeaderStyle: computedHeaderStyle({ refs, state })
75
+ computedHeaderStyle: computedHeaderStyle({ refs, state }),
76
+ watchCurrentName: watchCurrentName({ nextTick, vm, state }),
77
+ handleTabDragStart: handleTabDragStart({ state, vm, emit }),
78
+ handleTabDragEnd: handleTabDragEnd({ state, vm, nextTick }),
79
+ sortableEvent: sortableEvent({ api: api2, props, state, vm, emit, markRaw })
72
80
  });
73
81
  Object.assign(api2, { updated: updated({ api: api2, props, refs, state }), changeTab: changeTab(api2) });
74
82
  onUpdated(() => api2.updated());
@@ -1,5 +1,5 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
- import { isObject, isNull } from "@opentiny/vue-renderless/common/type";
2
+ import { isObject, isNull } from "../common/type";
3
3
  const getRouteActive = ({ props, route }) => () => {
4
4
  if (props.to && route) {
5
5
  const config = isObject(props.to) ? props.to : { path: props.to };