@opentiny/vue-renderless 3.6.7 → 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 +10 -6
  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 -2
  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
@@ -1,6 +1,6 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
2
  import { getRouteActive, onClick, bindChildren, routeTab } from "./index";
3
- import { xss } from "@opentiny/vue-renderless/common/xss.js";
3
+ import { xss } from "../common/xss.js";
4
4
  const api = ["state", "onClick"];
5
5
  const renderless = (props, { computed, onMounted, reactive }, { parent, emit, nextTick, route, router }) => {
6
6
  const api2 = {};
package/tabs/index.js CHANGED
@@ -27,19 +27,19 @@ const calcPaneInstances = ({ constants, parent, state, childrenHandler }) => (is
27
27
  state.panes = [];
28
28
  }
29
29
  };
30
- const calcMorePanes = ({ parent, props, state }) => () => {
30
+ const calcMorePanes = ({ parent, props, state, refs }) => () => {
31
31
  if (!props.showMoreTabs) {
32
32
  return;
33
33
  }
34
34
  const el = parent.$el;
35
35
  const tabs = el.querySelectorAll(".tiny-tabs__item");
36
- if (tabs && tabs.length) {
37
- const tabsHeaderWidth = el.querySelector(".tiny-tabs__nav-scroll").clientWidth + 15;
38
- let tabsAllWidth = 0;
39
- for (let i = 0, length = tabs.length; i < length; i++) {
40
- const width = tabs[i].offsetWidth;
41
- tabsAllWidth += width;
42
- if (tabsAllWidth > tabsHeaderWidth) {
36
+ const navRef = refs.nav.$refs;
37
+ const NavWidth = navRef.nav.offsetWidth || 0;
38
+ const tabsHeaderWidth = navRef.navScroll.offsetWidth || 0;
39
+ if (NavWidth > tabsHeaderWidth) {
40
+ for (let i = 0; i < tabs.length; i++) {
41
+ const isHiddenWidth = tabs[i].offsetLeft + tabs[i].offsetWidth / 2;
42
+ if (isHiddenWidth > tabsHeaderWidth) {
43
43
  state.showPanesCount = i;
44
44
  break;
45
45
  }
@@ -60,7 +60,6 @@ const handleTabClick = ({ api, emit, props, refs }) => (pane, tabName, event) =>
60
60
  if (pane.disabled) {
61
61
  return;
62
62
  }
63
- event.stopPropagation();
64
63
  api.setCurrentName(tabName);
65
64
  emit("click", pane, event);
66
65
  if (props.showExpandTabs) {
package/tabs/vue.js CHANGED
@@ -72,7 +72,7 @@ const renderless = (props, { onMounted, onUpdated, provide, reactive, watch }, {
72
72
  handleTabRemove: handleTabRemove(emit),
73
73
  changeDirection: changeDirection({ props, state }),
74
74
  changeCurrentName: changeCurrentName({ emit, state }),
75
- calcMorePanes: calcMorePanes({ parent, props, state }),
75
+ calcMorePanes: calcMorePanes({ parent, props, state, refs }),
76
76
  calcExpandPanes: calcExpandPanes({ parent, props, state }),
77
77
  calcPaneInstances: calcPaneInstances({ constants, parent, state, childrenHandler }),
78
78
  handleTabDragStart: handleTabDragStart({ emit }),
@@ -0,0 +1,109 @@
1
+ import "../chunk-PKUHTIDK.js";
2
+ import { random } from "../common/string";
3
+ import debounce from "../common/deps/debounce";
4
+ const setActive = ({ emit, state, props }) => (name) => {
5
+ const current = state.currentItem ? state.currentItem.name : "";
6
+ if (current && current !== name && props.beforeLeave && !props.beforeLeave(name, current)) {
7
+ return;
8
+ }
9
+ state.items.forEach((item) => item.selected = item.name === name);
10
+ emit("update:activeName", name);
11
+ emit("update:modelValue", name);
12
+ };
13
+ const addItem = (state) => (item) => {
14
+ state.items = [...state.items, item];
15
+ };
16
+ const addNav = (state) => (nav) => {
17
+ state.navs = [...state.navs, nav];
18
+ };
19
+ const scrollTo = ({ vm, state }) => (name) => {
20
+ const { navs } = state;
21
+ const { $refs } = vm;
22
+ const { tabbar } = $refs;
23
+ const { scroll } = tabbar.$refs;
24
+ const { clientWidth, scrollWidth } = scroll;
25
+ if (name && scrollWidth > clientWidth) {
26
+ const total = navs.length;
27
+ const index = navs.findIndex((nav) => nav.name === name);
28
+ const max = scrollWidth - clientWidth;
29
+ if (~index) {
30
+ scroll.scrollLeft = max / (total - 1) * index;
31
+ tabbar.wheelListener();
32
+ }
33
+ }
34
+ };
35
+ const clickMore = (api) => (name) => {
36
+ api.setActive(name);
37
+ api.scrollTo(name);
38
+ };
39
+ const removeItem = ({ state, emit }) => (name) => {
40
+ const itemIndex = state.items.findIndex((item) => item.name === name);
41
+ const navIndex = state.navs.findIndex((item) => item.name === name);
42
+ if (~itemIndex) {
43
+ state.items.splice(itemIndex, 1);
44
+ state.items = [...state.items];
45
+ state.navs.splice(navIndex, 1);
46
+ state.navs = [...state.navs];
47
+ emit("edit", name, "remove");
48
+ emit("close", name);
49
+ }
50
+ };
51
+ const wheelListener = ({ vm, api, tabs, state }) => debounce(10, (e) => {
52
+ const { $refs } = vm;
53
+ const { getBoundRect: getBoundRect2 } = api;
54
+ e && e.stopPropagation();
55
+ $refs.scroll && ($refs.scroll.scrollLeft += ((e || {}).deltaY || 0) / 3);
56
+ state.tabMoreWidth = $refs.tabMore && $refs.tabMore.offsetWidth || 0;
57
+ state.navPaddingRight = state.tabMoreWidth + 1;
58
+ const { left, width } = getBoundRect2();
59
+ const barRange = { left, width, reserve: state.tabMoreWidth };
60
+ let { moreList = [], moreLeft = false, moreRight = false } = {};
61
+ tabs.state.navs.forEach((nav) => {
62
+ const { name, rect } = nav.getBoundRect();
63
+ const { left: left2, width: width2 } = rect;
64
+ const navRange = { name, left: left2, width: width2 };
65
+ if (navRange.left < barRange.left || navRange.left + navRange.width > barRange.left + barRange.width - barRange.reserve) {
66
+ moreList.push(navRange.name);
67
+ }
68
+ });
69
+ if (tabs.state.items.length) {
70
+ moreLeft = ~moreList.indexOf(tabs.state.items[0].name);
71
+ moreRight = ~moreList.indexOf(tabs.state.items[tabs.state.items.length - 1].name);
72
+ }
73
+ Object.assign(state, { moreList, moreLeft, moreRight });
74
+ });
75
+ const getBoundRect = (vm) => () => vm.$el.getBoundingClientRect();
76
+ const handleClickDropdownItem = (tabs) => (name) => tabs.clickMore(name);
77
+ const key = (opt) => opt.name + "-" + random();
78
+ const emitAdd = (tabs) => () => {
79
+ tabs.$emit("edit", null, "add");
80
+ tabs.$emit("add");
81
+ };
82
+ const handleNavItemClick = ({ tabs, props }) => () => {
83
+ tabs.setActive(props.navItem.name);
84
+ tabs.$emit("click", props.navItem);
85
+ };
86
+ const getBoundRectNV = ({ vm, props }) => () => ({
87
+ name: props.navItem.name,
88
+ rect: vm.$el.getBoundingClientRect()
89
+ });
90
+ const handleNavItemClose = ({ tabs, props }) => (e) => {
91
+ e.stopPropagation();
92
+ tabs.removeItem(props.navItem.name);
93
+ };
94
+ export {
95
+ addItem,
96
+ addNav,
97
+ clickMore,
98
+ emitAdd,
99
+ getBoundRect,
100
+ getBoundRectNV,
101
+ handleClickDropdownItem,
102
+ handleNavItemClick,
103
+ handleNavItemClose,
104
+ key,
105
+ removeItem,
106
+ scrollTo,
107
+ setActive,
108
+ wheelListener
109
+ };
@@ -0,0 +1,49 @@
1
+ import "../chunk-PKUHTIDK.js";
2
+ import { addResizeListener, removeResizeListener } from "../common/deps/resize-event";
3
+ import { wheelListener, getBoundRect, handleClickDropdownItem, key, emitAdd } from "./index";
4
+ import { getAddWheelListener } from "./wheel";
5
+ const { addWheelListener, removeWheelListener } = getAddWheelListener(window, document);
6
+ const api = ["state", "wheelListener", "handleClickDropdownItem", "key", "emitAdd"];
7
+ const renderless = (props, { onMounted, onBeforeUnmount, reactive, watch, inject, computed }, { vm }) => {
8
+ const tabs = inject("tabs", null);
9
+ const state = reactive({
10
+ moreList: [],
11
+ moreLeft: false,
12
+ moreRight: false,
13
+ moreOptions: [],
14
+ tabMoreWidth: 0,
15
+ navPaddingRight: 0,
16
+ withAdd: computed(() => tabs.withAdd),
17
+ slotCustom: tabs.slots.custom
18
+ });
19
+ const api2 = {
20
+ getBoundRect: getBoundRect(vm),
21
+ handleClickDropdownItem: handleClickDropdownItem(tabs),
22
+ key,
23
+ emitAdd: emitAdd(tabs)
24
+ };
25
+ Object.assign(api2, {
26
+ state,
27
+ wheelListener: wheelListener({ vm, api: api2, tabs, state })
28
+ });
29
+ watch(
30
+ () => state.moreList,
31
+ () => {
32
+ state.moreOptions = state.moreList.map((name) => tabs.state.items.find((item) => item.name === name));
33
+ }
34
+ );
35
+ onMounted(() => {
36
+ addWheelListener(vm.$refs.scroll, api2.wheelListener);
37
+ addResizeListener(vm.$el, api2.wheelListener);
38
+ api2.wheelListener();
39
+ });
40
+ onBeforeUnmount(() => {
41
+ removeWheelListener(vm.$refs.scroll, api2.wheelListener);
42
+ removeResizeListener(vm.$el, api2.wheelListener);
43
+ });
44
+ return api2;
45
+ };
46
+ export {
47
+ api,
48
+ renderless
49
+ };
@@ -0,0 +1,22 @@
1
+ import "../chunk-PKUHTIDK.js";
2
+ import { handleNavItemClick, getBoundRectNV, handleNavItemClose } from "./index";
3
+ const api = ["state", "handleNavItemClick", "getBoundRect", "handleNavItemClose"];
4
+ const renderless = (props, { inject, markRaw, reactive, computed }, { vm }) => {
5
+ const tabs = inject("tabs", null);
6
+ tabs.addNav(markRaw(vm));
7
+ const state = reactive({
8
+ tabSize: computed(() => tabs.size),
9
+ withClose: computed(() => tabs.withClose)
10
+ });
11
+ const api2 = {
12
+ state,
13
+ handleNavItemClick: handleNavItemClick({ tabs, props }),
14
+ getBoundRect: getBoundRectNV({ vm, props }),
15
+ handleNavItemClose: handleNavItemClose({ tabs, props })
16
+ };
17
+ return api2;
18
+ };
19
+ export {
20
+ api,
21
+ renderless
22
+ };
@@ -0,0 +1,13 @@
1
+ import "../chunk-PKUHTIDK.js";
2
+ const api = ["state"];
3
+ const renderless = (props, { reactive, inject, computed }) => {
4
+ const tabs = inject("tabs", null);
5
+ const state = reactive({
6
+ navItems: computed(() => tabs.state.items)
7
+ });
8
+ return { state };
9
+ };
10
+ export {
11
+ api,
12
+ renderless
13
+ };
package/tabs-mf/vue.js ADDED
@@ -0,0 +1,45 @@
1
+ import "../chunk-PKUHTIDK.js";
2
+ import { random } from "../common/string";
3
+ import { setActive, addItem, addNav, scrollTo, clickMore, removeItem } from "./index";
4
+ const api = ["state", "setActive", "addItem", "addNav", "scrollTo", "clickMore", "removeItem"];
5
+ const renderless = (props, { onMounted, onBeforeUnmount, provide, reactive, watch, computed }, { vm, emit }) => {
6
+ const state = reactive({
7
+ items: [],
8
+ navs: [],
9
+ currentItem: computed(() => state.items.find((item) => item.selected)),
10
+ key: computed(() => state.currentItem ? state.currentItem.name : random())
11
+ });
12
+ const api2 = {
13
+ setActive: setActive({ emit, state, props }),
14
+ addItem: addItem(state),
15
+ addNav: addNav(state),
16
+ scrollTo: scrollTo({ vm, state }),
17
+ removeItem: removeItem({ state, emit })
18
+ };
19
+ Object.assign(api2, {
20
+ state,
21
+ clickMore: clickMore(api2)
22
+ });
23
+ provide("tabs", vm);
24
+ watch(
25
+ () => props.activeName,
26
+ (name) => name && api2.setActive(name)
27
+ );
28
+ watch(
29
+ () => props.modelValue,
30
+ (name) => name && api2.setActive(name)
31
+ );
32
+ onMounted(() => {
33
+ props.activeName && api2.scrollTo(props.activeName);
34
+ props.modelValue && api2.scrollTo(props.modelValue);
35
+ });
36
+ onBeforeUnmount(() => {
37
+ state.navs.forEach((n, i) => state.navs[i] = null);
38
+ state.navs.length = 0;
39
+ });
40
+ return api2;
41
+ };
42
+ export {
43
+ api,
44
+ renderless
45
+ };
@@ -0,0 +1,71 @@
1
+ import "../chunk-PKUHTIDK.js";
2
+ const getAddWheelListener = (window, document) => {
3
+ const { addApiName, removeApiName, prefix } = detectEventModel(window);
4
+ const support = detectAvailableWheelEvent(document);
5
+ const params = { addApiName, removeApiName, prefix, support, window };
6
+ const { add, remove } = getWheelListener(params);
7
+ return {
8
+ addWheelListener: (elem, callback, useCapture) => {
9
+ support === "DOMMouseScroll" ? add(elem, "MozMousePixelScroll", callback, useCapture) : add(elem, support, callback, useCapture);
10
+ },
11
+ removeWheelListener: (elem, callback, useCapture) => {
12
+ support === "DOMMouseScroll" ? remove(elem, "MozMousePixelScroll", callback, useCapture) : remove(elem, support, callback, useCapture);
13
+ }
14
+ };
15
+ };
16
+ const detectEventModel = (window) => {
17
+ const flag = window.addEventListener;
18
+ const addApiName = flag ? "addEventListener" : "attachEvent";
19
+ const removeApiName = flag ? "removeEventListener" : "detachEvent";
20
+ const prefix = flag ? "" : "on";
21
+ return { addApiName, removeApiName, prefix };
22
+ };
23
+ const detectAvailableWheelEvent = (document) => {
24
+ let support;
25
+ if ("onwheel" in document.createElement("div")) {
26
+ support = "wheel";
27
+ } else if (document.onmousewheel !== void 0) {
28
+ support = "mousewheel";
29
+ } else {
30
+ support = "DOMMouseScroll";
31
+ }
32
+ return support;
33
+ };
34
+ const elemCbMap = /* @__PURE__ */ new WeakMap();
35
+ const getWheelListener = ({ addApiName, removeApiName, prefix, support, window }) => ({
36
+ add: (elem, eventName, callback, useCapture) => {
37
+ let cb = callback;
38
+ if (support !== "wheel") {
39
+ cb = (oEvent) => {
40
+ !oEvent && (oEvent = window.event);
41
+ const event = {
42
+ originalEvent: oEvent,
43
+ target: oEvent.target || oEvent.srcElement,
44
+ type: "wheel",
45
+ deltaMode: oEvent.type === "MozMousePixelScroll" ? 0 : 1,
46
+ deltaX: 0,
47
+ deltaZ: 0,
48
+ preventDefault: () => {
49
+ oEvent.preventDefault ? oEvent.preventDefault() : oEvent.returnValue = false;
50
+ }
51
+ };
52
+ if (support === "mousewheel") {
53
+ event.deltaY = -1 / 40 * oEvent.wheelDelta;
54
+ oEvent.wheelDeltaX && (event.deltaX = -1 / 40 * oEvent.wheelDeltaX);
55
+ } else {
56
+ event.deltaY = oEvent.detail;
57
+ }
58
+ return callback(event);
59
+ };
60
+ }
61
+ elemCbMap.set(elem, cb);
62
+ elem[addApiName](prefix + eventName, cb, useCapture || false);
63
+ },
64
+ remove: (elem, eventName, callback, useCapture) => {
65
+ const cb = elemCbMap.get(elem);
66
+ elem[removeApiName](prefix + eventName, cb, useCapture || false);
67
+ }
68
+ });
69
+ export {
70
+ getAddWheelListener
71
+ };
package/tag/index.js CHANGED
@@ -1,11 +1,17 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
- const handleClose = ({ emit, props }) => (event) => {
2
+ const handleClose = ({ emit, props, state }) => (event) => {
3
+ if (props.disabled)
4
+ return;
3
5
  event.stopPropagation();
6
+ state.show = false;
4
7
  const close = () => emit("close", event);
5
8
  props.beforeDelete ? props.beforeDelete(close) : close();
6
9
  };
7
- const handleClick = ({ emit, parent }) => (event) => {
10
+ const handleClick = ({ emit, props, parent, state }) => (event) => {
11
+ if (props.selectable || props.disabled)
12
+ return;
8
13
  parent.$parent && parent.$parent.tagSelectable && event.stopPropagation();
14
+ state.selected = !state.selected;
9
15
  emit("click", event);
10
16
  };
11
17
  export {
package/tag/vue.js CHANGED
@@ -1,10 +1,18 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
2
  import { handleClose, handleClick } from "./index";
3
- const api = ["handleClose", "handleClick"];
4
- const renderless = (props, hooks, { emit, parent }) => ({
5
- handleClose: handleClose({ emit, props }),
6
- handleClick: handleClick({ emit, parent })
7
- });
3
+ const api = ["state", "handleClose", "handleClick"];
4
+ const renderless = (props, { reactive, computed }, { emit, parent }) => {
5
+ const state = reactive({
6
+ type: computed(() => props.theme || props.type),
7
+ show: true,
8
+ selected: false
9
+ });
10
+ const api2 = {
11
+ handleClose: handleClose({ emit, props, state }),
12
+ handleClick: handleClick({ emit, props, parent, state })
13
+ };
14
+ return Object.assign(api2, { state });
15
+ };
8
16
  export {
9
17
  api,
10
18
  renderless
@@ -0,0 +1,24 @@
1
+ import "../chunk-PKUHTIDK.js";
2
+ const getHiddenTags = ({ props, vm, state }) => () => {
3
+ if (!props.data.length)
4
+ return;
5
+ const tagGroup = vm.$refs.tagGroup || {};
6
+ const tags = tagGroup.children;
7
+ const moreDom = vm.$refs.more || {};
8
+ const height = tags[0] && tags[0].getBoundingClientRect().height + "px";
9
+ tagGroup.style && (tagGroup.style.height = height);
10
+ moreDom.style && (moreDom.style.height = height);
11
+ state.hiddenTags = [];
12
+ Array.from(tags).forEach((el, index) => {
13
+ if (el.offsetTop > 0) {
14
+ state.hiddenTags.push({
15
+ name: el.innerText,
16
+ type: props.data[index] && props.data[index].type
17
+ });
18
+ }
19
+ });
20
+ state.showMore = !!state.hiddenTags.length;
21
+ };
22
+ export {
23
+ getHiddenTags
24
+ };
@@ -0,0 +1,29 @@
1
+ import "../chunk-PKUHTIDK.js";
2
+ import { addResizeListener, removeResizeListener } from "../common/deps/resize-event";
3
+ import debounce from "../common/deps/debounce";
4
+ import { getHiddenTags } from "./index";
5
+ const api = ["state"];
6
+ const renderless = (props, { onMounted, onBeforeUnmount, reactive }, { vm }) => {
7
+ const delay = 100;
8
+ const state = reactive({
9
+ showMore: false,
10
+ hiddenTags: []
11
+ });
12
+ const api2 = {
13
+ state,
14
+ getHiddenTags: getHiddenTags({ props, vm, state })
15
+ };
16
+ onMounted(() => {
17
+ api2.getHiddenTags();
18
+ api2.debouncedGetHiddenTags = debounce(delay, api2.getHiddenTags);
19
+ addResizeListener(vm.$refs.tagGroup, debounce(delay, api2.debouncedGetHiddenTags));
20
+ });
21
+ onBeforeUnmount(() => {
22
+ removeResizeListener(vm.$refs.tagGroup, api2.debouncedGetHiddenTags);
23
+ });
24
+ return api2;
25
+ };
26
+ export {
27
+ api,
28
+ renderless
29
+ };
@@ -1,5 +1,5 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
- import { KEY_CODE } from "@opentiny/vue-renderless/common";
2
+ import { KEY_CODE } from "../common";
3
3
  const mousedown = (event) => {
4
4
  if (event && event.preventDefault) {
5
5
  event.preventDefault();
@@ -1,6 +1,6 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
2
  import { mousedown, selectItem, keydown } from "./index";
3
- import { on, off } from "@opentiny/vue-renderless/common/deps/dom";
3
+ import { on, off } from "../common/deps/dom";
4
4
  const api = ["state", "mousedown", "selectItem"];
5
5
  const renderless = (props, { onUnmounted, reactive, watch }, { emit }) => {
6
6
  const state = reactive({
package/time/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
- import { limitTimeRange, clearMilliseconds, timeWithinRange } from "@opentiny/vue-renderless/common/deps/date-util";
2
+ import { limitTimeRange, clearMilliseconds, timeWithinRange } from "../common/deps/date-util";
3
3
  const watchValue = ({ api, nextTick, state }) => (value) => {
4
4
  let date;
5
5
  if (value instanceof Date) {
package/time/vue.js CHANGED
@@ -11,8 +11,8 @@ import {
11
11
  setSelectionRange,
12
12
  handleConfirm
13
13
  } from "./index";
14
- import { compuAmPmMode } from "@opentiny/vue-renderless/time-range";
15
- import { isDate } from "@opentiny/vue-renderless/common/deps/date-util";
14
+ import { compuAmPmMode } from "../time-range";
15
+ import { isDate } from "../common/deps/date-util";
16
16
  const api = ["state", "handleChange", "setSelectionRange", "handleCancel", "handleConfirm", "adjustSpinners"];
17
17
  const initState = ({ reactive, props, computed, api: api2 }) => {
18
18
  const state = reactive({
@@ -1,5 +1,5 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
- import { format } from "@opentiny/vue-renderless/common/date";
2
+ import { format } from "../common/date";
3
3
  const getDate = (dateTime) => ({
4
4
  date: format(dateTime, "yyyy-MM-dd"),
5
5
  time: format(dateTime, "hh:mm")
@@ -9,24 +9,45 @@ const getStatus = ({ state, t }) => (value) => {
9
9
  return status > 0 ? t("ui.steps.done") : status === 0 ? t("ui.steps.doing") : t("ui.steps.wait");
10
10
  };
11
11
  const handleClick = ({ emit, state }) => ({ index, node }) => {
12
- emit("click", state.isReverse ? state.nodes.length - index - 1 : index, node);
12
+ if (!node.disabled) {
13
+ emit("click", state.isReverse ? state.nodes.length - index - 1 : index, node);
14
+ }
13
15
  };
14
- const getStatusCls = ({ constants, state }) => (index) => {
15
- const { PROCESS_DONE_CLS, PROCESS_CUR_CLS, PROCESS_WAIT_CLS } = constants;
16
+ const getStatusCls = ({ constants, state }) => (index, node) => {
17
+ const { PROCESS_DONE_CLS, PROCESS_CUR_CLS, PROCESS_WAIT_CLS, PROCESS_DISABLED_CLS, PROCESS_ERROR_CLS } = constants;
16
18
  const cls = {};
17
19
  const reverse = state.isReverse;
18
- cls[PROCESS_DONE_CLS] = reverse ? index > state.current : index < state.current;
19
- cls[PROCESS_CUR_CLS] = index === state.current;
20
- cls[PROCESS_WAIT_CLS] = reverse ? index < state.current : index > state.current;
20
+ if (node == null ? void 0 : node.disabled) {
21
+ cls[PROCESS_DISABLED_CLS] = true;
22
+ } else if (node == null ? void 0 : node.error) {
23
+ cls[PROCESS_ERROR_CLS] = true;
24
+ } else {
25
+ cls[PROCESS_DONE_CLS] = reverse ? index > state.current : index < state.current;
26
+ cls[PROCESS_CUR_CLS] = index === state.current;
27
+ cls[PROCESS_WAIT_CLS] = reverse ? index < state.current : index > state.current;
28
+ }
21
29
  return cls;
22
30
  };
23
31
  const computedData = ({ props, state }) => () => state.isReverse ? props.data.map((item, i) => props.data[props.data.length - 1 - i]) : props.data;
24
32
  const computedCurrent = ({ props, state }) => () => state.isReverse ? state.nodes.length - props.active - 1 : props.active;
25
33
  const computedIsReverse = (props) => () => props.reverse && props.vertical;
34
+ const computedStackNodes = ({ state, constants }) => () => {
35
+ if (state.nodes.length >= constants.STACK_NODES_MAX) {
36
+ state.showData = true;
37
+ return state.nodes.slice(0, constants.LIMITED_STACK_NODES);
38
+ }
39
+ return state.nodes;
40
+ };
41
+ const changeStatus = ({ state }) => () => {
42
+ state.showAll = !state.showAll;
43
+ return state.showAll;
44
+ };
26
45
  export {
46
+ changeStatus,
27
47
  computedCurrent,
28
48
  computedData,
29
49
  computedIsReverse,
50
+ computedStackNodes,
30
51
  getDate,
31
52
  getStatus,
32
53
  getStatusCls,
package/time-line/vue.js CHANGED
@@ -1,12 +1,15 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
- import { handleClick, getStatusCls, getStatus, computedData, getDate, computedCurrent, computedIsReverse } from "./index";
3
- const api = ["state", "handleClick", "getStatusCls", "getStatus", "getDate"];
2
+ import { handleClick, getStatusCls, getStatus, computedData, getDate, computedCurrent, computedIsReverse, changeStatus, computedStackNodes } from "./index";
3
+ const api = ["state", "handleClick", "getStatusCls", "getStatus", "getDate", "changeStatus"];
4
4
  const renderless = (props, { computed, reactive }, { t, emit, constants }) => {
5
5
  const api2 = {};
6
6
  const state = reactive({
7
7
  nodes: computed(() => api2.computedData()),
8
8
  current: computed(() => api2.computedCurrent()),
9
- isReverse: computed(() => api2.computedIsReverse())
9
+ isReverse: computed(() => api2.computedIsReverse()),
10
+ stackNodes: computed(() => state.showAll ? state.nodes : api2.computedStackNodes()),
11
+ showData: false,
12
+ showAll: false
10
13
  });
11
14
  Object.assign(api2, {
12
15
  state,
@@ -16,7 +19,9 @@ const renderless = (props, { computed, reactive }, { t, emit, constants }) => {
16
19
  computedIsReverse: computedIsReverse(props),
17
20
  getStatus: getStatus({ state, t }),
18
21
  handleClick: handleClick({ emit, state, api: api2 }),
19
- getStatusCls: getStatusCls({ constants, props, state })
22
+ getStatusCls: getStatusCls({ constants, props, state }),
23
+ computedStackNodes: computedStackNodes({ state, constants }),
24
+ changeStatus: changeStatus({ state })
20
25
  });
21
26
  return api2;
22
27
  };
@@ -1,6 +1,6 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
- import scrollIntoView from "@opentiny/vue-renderless/common/deps/scroll-into-view";
3
- import { DATEPICKER } from "@opentiny/vue-renderless/common";
2
+ import scrollIntoView from "../common/deps/scroll-into-view";
3
+ import { DATEPICKER } from "../common";
4
4
  const parseTime = () => (time) => {
5
5
  const values = (time || "").split(":");
6
6
  if (values.length >= 2) {
package/time-panel/vue.js CHANGED
@@ -16,7 +16,7 @@ import {
16
16
  emitPick,
17
17
  emitDestroy
18
18
  } from "./index";
19
- import { DATEPICKER } from "@opentiny/vue-renderless/common";
19
+ import { DATEPICKER } from "../common";
20
20
  const api = ["state", "handleMenuEnter", "handleClick", "handleClear", "emitDestroy"];
21
21
  const initState = ({ reactive, computed, api: api2 }) => {
22
22
  const { Start, End, Step } = DATEPICKER;
@@ -0,0 +1,30 @@
1
+ import "../chunk-PKUHTIDK.js";
2
+ const optionMethod = (value) => {
3
+ const val = ("0" + value).slice(-2);
4
+ return { id: val, label: val };
5
+ };
6
+ const watchModelValue = ({ props, state }) => () => {
7
+ const { modelValue } = props;
8
+ state.dateArr = modelValue ? modelValue.slice() : [];
9
+ };
10
+ const watchVisible = ({ api, state }) => (value) => {
11
+ state.visible = value;
12
+ value && api.watchModelValue();
13
+ };
14
+ const updateVisible = ({ state, emit }) => (value) => {
15
+ state.visible = value;
16
+ emit("update:visible", value);
17
+ };
18
+ const confirm = ({ emit, state }) => (value) => {
19
+ const dateArr = value.map((item) => ("0" + item).slice(-2));
20
+ state.dateArr = dateArr;
21
+ emit("update:modelValue", dateArr);
22
+ emit("confirm", dateArr);
23
+ };
24
+ export {
25
+ confirm,
26
+ optionMethod,
27
+ updateVisible,
28
+ watchModelValue,
29
+ watchVisible
30
+ };