@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,79 @@
1
+ import "../chunk-PKUHTIDK.js";
2
+ import { omitText } from "../common/string";
3
+ const api = ["dataStore", "handleClick", "dataStore", "mouseEnter", "mouseLeave"];
4
+ const renderless = (props, { reactive, inject }, { dispatch, vm }) => {
5
+ const api2 = {};
6
+ const dropdownMenuVm = inject("dropdownMenuVm");
7
+ const multiStage = inject("multiStage");
8
+ let dataStore = reactive({
9
+ checkedStatus: dropdownMenuVm.checkedStatus,
10
+ multiStageMenu: "",
11
+ multiStage: "",
12
+ itemData: "",
13
+ itemLabel: "",
14
+ showContent: false,
15
+ dropdownMenuVm,
16
+ currentIndex: props.currentIndex,
17
+ level: props.level
18
+ });
19
+ if (multiStage) {
20
+ dataStore.multiStageMenu = true;
21
+ }
22
+ const handleClick = ({ dataStore: dataStore2, props: props2, vm: vm2 }) => () => {
23
+ if (props2.disabled) {
24
+ dataStore2.checkedStatus = false;
25
+ return;
26
+ }
27
+ dataStore2.itemData = props2.itemData;
28
+ dataStore2.itemLabel = "";
29
+ dataStore2.showContent = false;
30
+ if (props2.level === "2") {
31
+ dataStore2.currentIndex = `${props2.level}-${props2.currentIndex}`;
32
+ } else {
33
+ dataStore2.currentIndex = `${props2.currentIndex}`;
34
+ }
35
+ dispatch("TinyDropdown", "selectedIndex", [dataStore2.currentIndex]);
36
+ dispatch("TinyDropdownMenu", "menu-item-click", [
37
+ dataStore2.itemData,
38
+ vm2,
39
+ dataStore2.itemLabel,
40
+ dataStore2.showContent,
41
+ dataStore2.currentIndex
42
+ ]);
43
+ };
44
+ const mouseLeave = ({ dataStore: dataStore2 }) => () => {
45
+ dataStore2.itemLabel = "";
46
+ dataStore2.showContent = false;
47
+ dispatch("TinyDropdownMenu", "mouseleave-tips", [dataStore2.showContent, dataStore2.itemLabel]);
48
+ };
49
+ const mouseEnter = ({ vm: vm2, dataStore: dataStore2 }) => (e) => {
50
+ const dom = e.target;
51
+ const text = dom.textContent;
52
+ const font = window.getComputedStyle(dom).font;
53
+ const rect = dom.getBoundingClientRect();
54
+ const res = omitText(text, font, rect.width);
55
+ const tooltip = dataStore2.dropdownMenuVm.$refs.tooltip;
56
+ if (res.o) {
57
+ tooltip.state.referenceElm = dom;
58
+ tooltip.state.popperElm && (tooltip.state.popperElm.style.display = "none");
59
+ tooltip.doDestroy();
60
+ dataStore2.itemLabel = text;
61
+ if (vm2.$refs.level.scrollWidth > vm2.$refs.level.offsetWidth) {
62
+ dataStore2.showContent = true;
63
+ }
64
+ setTimeout(tooltip.updatePopper, 20);
65
+ }
66
+ dispatch("TinyDropdownMenu", "mouseenter-tips", [dataStore2.showContent, dataStore2.itemLabel]);
67
+ };
68
+ Object.assign(api2, {
69
+ dataStore,
70
+ handleClick: handleClick({ dataStore, props, vm }),
71
+ mouseEnter: mouseEnter({ dataStore, vm, props }),
72
+ mouseLeave: mouseLeave({ dataStore, props })
73
+ });
74
+ return api2;
75
+ };
76
+ export {
77
+ api,
78
+ renderless
79
+ };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  __spreadValues
3
3
  } from "../chunk-PKUHTIDK.js";
4
- import userPopper from "@opentiny/vue-renderless/common/deps/vue-popper";
4
+ import userPopper from "../common/deps/vue-popper";
5
5
  const toggleItem = (state) => (active, item) => {
6
6
  if (item.disabled) {
7
7
  return;
@@ -113,9 +113,38 @@ const useVuePopper = ({ api, props, hooks, instance, state }) => {
113
113
  }
114
114
  );
115
115
  };
116
+ const mounted = ({ api, parent, state }) => () => {
117
+ parent.$on("menuselectedIndex", (selectedIndex) => {
118
+ state.selectedIndex = selectedIndex;
119
+ });
120
+ parent.$on("menu-item-click", api.handleMenuItemClick);
121
+ parent.$on("mouseenter-tips", (showContent, label) => {
122
+ state.label = label;
123
+ state.showContent = showContent;
124
+ });
125
+ parent.$on("mouseleave-tips", (showContent, label) => {
126
+ state.label = label;
127
+ state.showContent = showContent;
128
+ });
129
+ };
130
+ const handleMenuItemClick = ({ state, dispatch }) => (itemData, instance, label, showContent) => {
131
+ state.label = label;
132
+ state.showContent = showContent;
133
+ dispatch("TinyDropdown", "current-item-click", [itemData, instance]);
134
+ };
135
+ const handleMouseenter = ({ emit }) => ($event) => {
136
+ emit("mouseenter", $event);
137
+ };
138
+ const handleMouseleave = ({ emit }) => ($event) => {
139
+ emit("mouseleave", $event);
140
+ };
116
141
  export {
117
142
  clickOutside,
118
143
  getScroller,
144
+ handleMenuItemClick,
145
+ handleMouseenter,
146
+ handleMouseleave,
147
+ mounted,
119
148
  toggleItem,
120
149
  updateOffset,
121
150
  useVuePopper
@@ -1,19 +1,24 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
- import { toggleItem, updateOffset, clickOutside, getScroller, useVuePopper } from "./index";
3
- const api = ["state", "toggleItem", "updateOffset", "clickOutside", "doDestroy"];
2
+ import { toggleItem, updateOffset, clickOutside, getScroller, useVuePopper, mounted, handleMenuItemClick, handleMouseenter, handleMouseleave } from "./index";
3
+ const api = ["state", "toggleItem", "updateOffset", "clickOutside", "doDestroy", "handleMouseenter", "handleMouseleave"];
4
4
  const renderless = (props, hooks, instance) => {
5
5
  const api2 = {};
6
- const { reactive, provide } = hooks;
7
- const { refs, nextTick, mode, vm } = instance;
6
+ const { reactive, provide, onMounted } = hooks;
7
+ const { nextTick, mode, vm, parent, dispatch, emit, refs } = instance;
8
8
  const state = reactive({
9
9
  offset: 0,
10
10
  scroller: null,
11
11
  children: [],
12
12
  size: "",
13
- showPopper: false
13
+ showPopper: false,
14
+ label: "",
15
+ showContent: false,
16
+ selected: false,
17
+ selectedIndex: -1
14
18
  });
19
+ provide("dropdownMenu", vm);
20
+ provide("multiStage", props.multiStage);
15
21
  if (mode === "mobile") {
16
- provide("dropdownMenu", vm);
17
22
  nextTick(() => {
18
23
  state.scroller = getScroller(refs.menu);
19
24
  });
@@ -24,8 +29,13 @@ const renderless = (props, hooks, instance) => {
24
29
  state,
25
30
  toggleItem: toggleItem(state),
26
31
  clickOutside: clickOutside({ props, refs, state }),
27
- updateOffset: updateOffset({ props, state, refs })
32
+ updateOffset: updateOffset({ props, state, refs }),
33
+ mounted: mounted({ api: api2, parent, state }),
34
+ handleMouseenter: handleMouseenter({ emit }),
35
+ handleMouseleave: handleMouseleave({ emit }),
36
+ handleMenuItemClick: handleMenuItemClick({ dispatch, state })
28
37
  });
38
+ onMounted(api2.mounted);
29
39
  return api2;
30
40
  };
31
41
  export {
@@ -0,0 +1,117 @@
1
+ import "../chunk-PKUHTIDK.js";
2
+ const computedItemsWithSize = ({ props, state }) => () => {
3
+ const result = [];
4
+ const { items, keyField } = props;
5
+ const { simpleArray, vscrollData } = state;
6
+ const { sizes } = vscrollData;
7
+ const l = items.length;
8
+ for (let i = 0; i < l; i++) {
9
+ const item = items[i];
10
+ const id = simpleArray ? i : item[keyField];
11
+ let size = sizes[id];
12
+ if (typeof size === "undefined" && !state.temporary.undefinedMap[id]) {
13
+ size = 0;
14
+ }
15
+ result.push({ item, id, size });
16
+ }
17
+ return result;
18
+ };
19
+ const onScrollerResize = ({ api, emit, vm }) => () => {
20
+ const scroller = vm.$refs.scroller;
21
+ if (scroller) {
22
+ api.forceUpdate();
23
+ }
24
+ emit("resize");
25
+ };
26
+ const onScrollerVisible = ({ emit, state }) => () => {
27
+ state.temporary.events.emit("vscroll:update", { force: false });
28
+ emit("visible");
29
+ };
30
+ const forceUpdate = (state) => (clear = false) => {
31
+ if (clear || state.simpleArray) {
32
+ state.vscrollData.sizes = {};
33
+ }
34
+ state.temporary.events.emit("vscroll:update", { force: true });
35
+ };
36
+ const prepareProvide = (state) => {
37
+ if (typeof ResizeObserver !== "undefined") {
38
+ state.temporary.resizeObserver = new ResizeObserver((entries) => {
39
+ requestAnimationFrame(() => {
40
+ if (!Array.isArray(entries))
41
+ return;
42
+ for (const entry of entries) {
43
+ if (entry.target && entry.target._onResize) {
44
+ let width, height;
45
+ if (entry.borderBoxSize) {
46
+ const resizeObserverSize = entry.borderBoxSize[0];
47
+ width = resizeObserverSize.inlineSize;
48
+ height = resizeObserverSize.blockSize;
49
+ } else {
50
+ width = entry.contentRect.width;
51
+ height = entry.contentRect.height;
52
+ }
53
+ entry.target._onResize(entry.target._id, width, height);
54
+ }
55
+ }
56
+ });
57
+ });
58
+ }
59
+ };
60
+ const watchItemsWithSize = ({ props, vm }) => (next, prev) => {
61
+ const scrollTop = vm.$el.scrollTop;
62
+ const length = Math.min(next.length, prev.length);
63
+ let prevActiveTop = 0;
64
+ let activeTop = 0;
65
+ for (let i = 0; i < length; i++) {
66
+ if (prevActiveTop >= scrollTop)
67
+ break;
68
+ prevActiveTop += prev[i].size || props.minItemSize;
69
+ activeTop += next[i].size || props.minItemSize;
70
+ }
71
+ const offset = activeTop - prevActiveTop;
72
+ if (offset === 0)
73
+ return;
74
+ vm.$el.scrollTop += offset;
75
+ };
76
+ const scrollToItem = (vm) => (index) => {
77
+ const scroller = vm.$refs.scroller;
78
+ if (scroller)
79
+ scroller.scrollToItem(index);
80
+ };
81
+ const getItemSize = ({ props, state }) => (item, index = void 0) => {
82
+ const id = state.simpleArray ? index === 0 || index ? index : props.items.indexOf(item) : item[props.keyField];
83
+ return state.vscrollData.sizes[id] || 0;
84
+ };
85
+ const scrollToBottom = ({ state, vm, nextTick }) => () => {
86
+ if (state.temporary.scrollingToBottom)
87
+ return;
88
+ state.temporary.scrollingToBottom = true;
89
+ const el = vm.$el;
90
+ const step = (el2) => el2.scrollTop = el2.scrollHeight + 5e3;
91
+ nextTick(() => {
92
+ step(el);
93
+ const cb = () => {
94
+ step(el);
95
+ requestAnimationFrame(() => {
96
+ step(el);
97
+ if (state.temporary.undefinedSizes === 0) {
98
+ state.temporary.scrollingToBottom = false;
99
+ } else {
100
+ requestAnimationFrame(cb);
101
+ }
102
+ });
103
+ };
104
+ requestAnimationFrame(cb);
105
+ });
106
+ };
107
+ export {
108
+ computedItemsWithSize,
109
+ forceUpdate,
110
+ getItemSize,
111
+ onScrollerResize,
112
+ onScrollerVisible,
113
+ prepareProvide,
114
+ scrollToBottom,
115
+ scrollToItem,
116
+ watchItemsWithSize
117
+ };
@@ -0,0 +1,88 @@
1
+ import "../chunk-PKUHTIDK.js";
2
+ import {
3
+ computedItemsWithSize,
4
+ onScrollerResize,
5
+ onScrollerVisible,
6
+ forceUpdate,
7
+ prepareProvide,
8
+ watchItemsWithSize,
9
+ scrollToItem,
10
+ getItemSize,
11
+ scrollToBottom
12
+ } from "./index";
13
+ const api = [
14
+ "state",
15
+ "onScrollerResize",
16
+ "onScrollerVisible",
17
+ "forceUpdate",
18
+ "scrollToItem",
19
+ "getItemSize",
20
+ "scrollToBottom"
21
+ ];
22
+ const addWatchers = ({ watch, props, api: api2, state }) => {
23
+ watch(
24
+ () => props.items,
25
+ () => api2.forceUpdate()
26
+ );
27
+ watch(
28
+ () => state.simpleArray,
29
+ (value) => state.vscrollData.simpleArray = value,
30
+ { immediate: true }
31
+ );
32
+ watch(
33
+ () => props.direction,
34
+ (value) => api2.forceUpdate(value)
35
+ );
36
+ watch(
37
+ () => props.itemsWithSize,
38
+ (next, prev) => api2.watchItemsWithSize(next, prev)
39
+ );
40
+ };
41
+ const renderless = (props, { reactive, computed, onActivated, onDeactivated, watch, provide, toRef, toRefs }, { vm, nextTick, emit }, { emitter }) => {
42
+ const state = reactive({
43
+ simpleArray: computed(() => props.items.length && typeof props.items[0] !== "object"),
44
+ itemsWithSize: computed(() => api2.computedItemsWithSize()),
45
+ vscrollData: {
46
+ active: true,
47
+ sizes: {},
48
+ keyField: props.keyField,
49
+ simpleArray: false
50
+ }
51
+ });
52
+ const api2 = {
53
+ state,
54
+ computedItemsWithSize: computedItemsWithSize({ props, state }),
55
+ onScrollerVisible: onScrollerVisible({ emit, state }),
56
+ forceUpdate: forceUpdate(state),
57
+ watchItemsWithSize: watchItemsWithSize({ props, vm }),
58
+ scrollToItem: scrollToItem(vm),
59
+ getItemSize: getItemSize({ props, state }),
60
+ scrollToBottom: scrollToBottom({ state, vm, nextTick })
61
+ };
62
+ Object.assign(api2, {
63
+ onScrollerResize: onScrollerResize({ api: api2, emit, vm })
64
+ });
65
+ state.temporary = {
66
+ updates: [],
67
+ undefinedSizes: 0,
68
+ undefinedMap: {},
69
+ events: emitter(),
70
+ resizeObserver: null
71
+ };
72
+ prepareProvide(state);
73
+ provide("vscrollData", toRef(state, "vscrollData"));
74
+ provide("vscrollParent", { props: toRefs(props), state: toRefs(state) });
75
+ provide("vscrollResizeObserver", state.temporary.resizeObserver);
76
+ onActivated(() => {
77
+ state.vscrollData.active = true;
78
+ });
79
+ onDeactivated(() => {
80
+ state.vscrollData.active = false;
81
+ });
82
+ addWatchers({ watch, props, api: api2, state });
83
+ return api2;
84
+ };
85
+ export {
86
+ api,
87
+ renderless
88
+ };
@@ -0,0 +1,147 @@
1
+ import "../chunk-PKUHTIDK.js";
2
+ const computedId = ({ props, state }) => () => {
3
+ if (state.vscrollData.simpleArray)
4
+ return props.index;
5
+ if (Object.prototype.hasOwnProperty.call(props.item, state.vscrollData.keyField)) {
6
+ return props.item[state.vscrollData.keyField];
7
+ }
8
+ throw new Error(`[TINY Error][DynamicScrollerItem] keyField '${state.vscrollData.keyField}' not found in your item`);
9
+ };
10
+ const computedSize = (state) => () => state.vscrollData.sizes[state.id] || 0;
11
+ const computedFinalActive = ({ props, state }) => () => props.active && state.vscrollData.active;
12
+ const updateWatchData = ({ api, props, state, watch }) => () => {
13
+ if (props.watchData && !state.temporary.watchData) {
14
+ state.temporary.watchData = watch(props.item, api.onDataUpdate, { deep: true });
15
+ } else if (state.temporary.watchData) {
16
+ state.temporary.watchData();
17
+ state.temporary.watchData = null;
18
+ }
19
+ };
20
+ const watchId = ({ api, state, vm }) => (value, oldValue) => {
21
+ vm.$el._id = state.id;
22
+ if (!state.size) {
23
+ api.onDataUpdate();
24
+ }
25
+ if (state.temporary.sizeObserved) {
26
+ const oldSize = state.vscrollData.sizes[oldValue];
27
+ const size = state.vscrollData.sizes[value];
28
+ if (oldSize !== null && oldSize !== size) {
29
+ api.applySize(oldSize);
30
+ }
31
+ }
32
+ };
33
+ const onDataUpdate = (api) => () => {
34
+ api.updateSize();
35
+ };
36
+ const updateSize = ({ api, state }) => () => {
37
+ if (state.finalActive) {
38
+ if (state.temporary.pendingSizeUpdate !== state.id) {
39
+ state.temporary.pendingSizeUpdate = state.id;
40
+ state.temporary.forceNextVScrollUpdate = null;
41
+ state.temporary.pendingVScrollUpdate = null;
42
+ api.computeSize(state.id);
43
+ }
44
+ } else {
45
+ state.temporary.forceNextVScrollUpdate = state.id;
46
+ }
47
+ };
48
+ const computeSize = ({ api, nextTick, state, vm }) => (id) => {
49
+ nextTick(() => {
50
+ if (state.id === id) {
51
+ const width = vm.$el.offsetWidth;
52
+ const height = vm.$el.offsetHeight;
53
+ api.applyWidthHeight(width, height);
54
+ }
55
+ state.temporary.pendingSizeUpdate = null;
56
+ });
57
+ };
58
+ const applyWidthHeight = ({ api, state }) => (width, height) => {
59
+ const size = ~~(state.vscrollParent.props.direction === "vertical" ? height : width);
60
+ if (size && state.size !== size) {
61
+ api.applySize(size);
62
+ }
63
+ };
64
+ const applySize = ({ emit, props, state, vm }) => (size) => {
65
+ const { vscrollParent } = state;
66
+ if (vscrollParent.state.temporary.undefinedMap[state.id]) {
67
+ vscrollParent.state.temporary.undefinedSizes--;
68
+ vscrollParent.state.temporary.undefinedMap[state.id] = void 0;
69
+ }
70
+ vm.$set(state.vscrollData.sizes, state.id, size);
71
+ if (props.emitResize)
72
+ emit("resize", state.id);
73
+ };
74
+ const watchFinalActive = ({ api, state }) => (value) => {
75
+ if (!state.size) {
76
+ const { vscrollParent } = state;
77
+ if (value) {
78
+ if (!vscrollParent.state.temporary.undefinedMap[state.id]) {
79
+ vscrollParent.state.temporary.undefinedSizes++;
80
+ vscrollParent.state.temporary.undefinedMap[state.id] = true;
81
+ }
82
+ } else {
83
+ if (vscrollParent.state.temporary.undefinedMap[state.id]) {
84
+ vscrollParent.state.temporary.undefinedSizes--;
85
+ vscrollParent.state.temporary.undefinedMap[state.id] = false;
86
+ }
87
+ }
88
+ }
89
+ if (state.vscrollResizeObserver) {
90
+ if (value) {
91
+ api.observeSize();
92
+ } else {
93
+ api.unobserveSize();
94
+ }
95
+ } else if (value && state.temporary.pendingVScrollUpdate === state.id) {
96
+ api.updateSize();
97
+ }
98
+ };
99
+ const observeSize = ({ api, state, vm }) => () => {
100
+ if (!state.vscrollResizeObserver)
101
+ return;
102
+ if (state.temporary.sizeObserved)
103
+ return;
104
+ state.vscrollResizeObserver.observe(vm.$el);
105
+ vm.$el._id = state.id;
106
+ vm.$el._onResize = api.onResize;
107
+ state.temporary.sizeObserved = true;
108
+ };
109
+ const onResize = ({ api, state }) => (id, width, height) => {
110
+ if (state.id === id) {
111
+ api.applyWidthHeight(width, height);
112
+ }
113
+ };
114
+ const unobserveSize = ({ state, vm }) => () => {
115
+ if (!state.vscrollResizeObserver)
116
+ return;
117
+ if (!state.temporary.sizeObserved)
118
+ return;
119
+ state.vscrollResizeObserver.unobserve(vm.$el);
120
+ vm.$el._onResize = void 0;
121
+ state.temporary.sizeObserved = false;
122
+ };
123
+ const onVscrollUpdate = ({ api, state }) => ({ force }) => {
124
+ if (!state.finalActive && force) {
125
+ state.temporary.pendingVScrollUpdate = state.id;
126
+ }
127
+ if (state.temporary.forceNextVScrollUpdate === state.id || force || !state.size) {
128
+ api.updateSize();
129
+ }
130
+ };
131
+ export {
132
+ applySize,
133
+ applyWidthHeight,
134
+ computeSize,
135
+ computedFinalActive,
136
+ computedId,
137
+ computedSize,
138
+ observeSize,
139
+ onDataUpdate,
140
+ onResize,
141
+ onVscrollUpdate,
142
+ unobserveSize,
143
+ updateSize,
144
+ updateWatchData,
145
+ watchFinalActive,
146
+ watchId
147
+ };
@@ -0,0 +1,92 @@
1
+ import {
2
+ __spreadValues
3
+ } from "../chunk-PKUHTIDK.js";
4
+ import {
5
+ computedId,
6
+ computedSize,
7
+ computedFinalActive,
8
+ updateWatchData,
9
+ watchId,
10
+ onDataUpdate,
11
+ updateSize,
12
+ computeSize,
13
+ applyWidthHeight,
14
+ applySize,
15
+ watchFinalActive,
16
+ observeSize,
17
+ onResize,
18
+ unobserveSize,
19
+ onVscrollUpdate
20
+ } from "./index";
21
+ const api = ["state"];
22
+ const addWatchers = ({ watch, props, api: api2, state }) => {
23
+ watch(
24
+ () => props.watchData,
25
+ () => api2.updateWatchData()
26
+ );
27
+ watch(
28
+ () => state.id,
29
+ (value, oldValue) => api2.watchId(value, oldValue)
30
+ );
31
+ watch(
32
+ () => state.finalActive,
33
+ (value) => api2.watchFinalActive(value)
34
+ );
35
+ };
36
+ const renderless = (props, { reactive, computed, onMounted, onBeforeUnmount, watch, inject, markRaw }, { vm, nextTick, emit }) => {
37
+ const vscrollData = inject("vscrollData");
38
+ const vscrollParent = inject("vscrollParent");
39
+ const vscrollResizeObserver = markRaw(inject("vscrollResizeObserver"));
40
+ const state = reactive({
41
+ id: computed(() => api2.computedId()),
42
+ size: computed(() => api2.computedSize()),
43
+ finalActive: computed(() => api2.computedFinalActive()),
44
+ vscrollData,
45
+ vscrollParent: { props: __spreadValues({}, vscrollParent.props), state: __spreadValues({}, vscrollParent.state) },
46
+ vscrollResizeObserver
47
+ });
48
+ const api2 = {
49
+ state,
50
+ computedId: computedId({ props, state }),
51
+ computedSize: computedSize(state),
52
+ computedFinalActive: computedFinalActive({ props, state }),
53
+ applySize: applySize({ emit, props, state, vm }),
54
+ unobserveSize: unobserveSize({ state, vm })
55
+ };
56
+ Object.assign(api2, {
57
+ updateWatchData: updateWatchData({ api: api2, props, state, watch }),
58
+ watchId: watchId({ api: api2, state, vm }),
59
+ onDataUpdate: onDataUpdate(api2),
60
+ updateSize: updateSize({ api: api2, state }),
61
+ computeSize: computeSize({ api: api2, nextTick, state, vm }),
62
+ applyWidthHeight: applyWidthHeight({ api: api2, state }),
63
+ watchFinalActive: watchFinalActive({ api: api2, state }),
64
+ observeSize: observeSize({ api: api2, state, vm }),
65
+ onResize: onResize({ api: api2, state }),
66
+ onVscrollUpdate: onVscrollUpdate({ api: api2, state })
67
+ });
68
+ state.temporary = {
69
+ forceNextVScrollUpdate: null
70
+ };
71
+ api2.updateWatchData();
72
+ for (const k in props.sizeDependencies) {
73
+ watch(() => props.sizeDependencies[k], api2.onDataUpdate);
74
+ }
75
+ state.vscrollParent.state.temporary.events.on("vscroll:update", api2.onVscrollUpdate);
76
+ onMounted(() => {
77
+ if (state.finalActive) {
78
+ api2.updateSize();
79
+ api2.observeSize();
80
+ }
81
+ });
82
+ onBeforeUnmount(() => {
83
+ state.vscrollParent.state.temporary.events.off("vscroll:update", api2.onVscrollUpdate);
84
+ api2.unobserveSize();
85
+ });
86
+ addWatchers({ watch, props, api: api2, state });
87
+ return api2;
88
+ };
89
+ export {
90
+ api,
91
+ renderless
92
+ };
package/espace/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
- import { xss } from "@opentiny/vue-renderless/common";
2
+ import { xss } from "../common";
3
3
  const getUserHref = ({ api, props }) => (item) => {
4
4
  const type = item.type ? String(item.type).toLocaleLowerCase() : "";
5
5
  const value = item.value ? String(item.value).toLocaleLowerCase() : "";
package/espace/vue.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
- import { init } from "@opentiny/vue-renderless/common/deps/eSpaceCtrl";
2
+ import { init } from "../common/deps/eSpaceCtrl";
3
3
  import { getUserHref, getUserTitle, doUserAction, initEspaceLink, openEspace, testUID, soundEspace } from "./index";
4
4
  const api = ["getUserHref", "getUserTitle", "doUserAction", "initEspaceLink", "openEspace", "testUID", "soundEspace"];
5
5
  const renderless = (props, { reactive }, { service }) => {
package/exception/vue.js CHANGED
@@ -1,12 +1,14 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
2
  import { create, getMessage } from "./index";
3
3
  const api = ["state", "create"];
4
- const renderless = (props, { computed, reactive }, { t, emit }) => {
4
+ const renderless = (props, { computed, reactive }, { t, emit }, { images }) => {
5
5
  const api2 = {
6
6
  create: create(emit),
7
7
  getMessage: getMessage({ props, t })
8
8
  };
9
9
  const state = reactive({
10
+ urlType: props.type,
11
+ images,
10
12
  message: computed(() => api2.getMessage({ props, t }))
11
13
  });
12
14
  api2.state = state;
@@ -1,8 +1,8 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
- import { REFRESH_INTERVAL } from "@opentiny/vue-renderless/common";
3
- import { on, off } from "@opentiny/vue-renderless/common/deps/dom";
4
- import PopupManager from "@opentiny/vue-renderless/common/deps/popup-manager";
5
- import { xss } from "@opentiny/vue-renderless/common/xss.js";
2
+ import { REFRESH_INTERVAL } from "../common";
3
+ import { on, off } from "../common/deps/dom";
4
+ import PopupManager from "../common/deps/popup-manager";
5
+ import { xss } from "../common/xss.js";
6
6
  const arrowClick = (state) => (opt) => {
7
7
  state.pager += opt;
8
8
  };