@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
@@ -22,7 +22,7 @@ const setSheetStyle = ({ state, props }) => () => {
22
22
  const initScrollMenu = ({ state, nextTick, refs, BScroll }) => () => {
23
23
  nextTick(() => {
24
24
  const { scrollMenu } = refs;
25
- if (!state.scroll) {
25
+ if (state.scroll) {
26
26
  state.scroll = new BScroll(scrollMenu, {
27
27
  probeType: 3,
28
28
  tap: "tap"
@@ -51,9 +51,36 @@ const menuHandle = ({ emit, state }) => (item) => {
51
51
  emit("update:modelValue", item.id);
52
52
  emit("click", item);
53
53
  };
54
+ const close = ({ emit, vm }) => () => {
55
+ vm.$refs.drawer.close();
56
+ emit("close", false);
57
+ };
58
+ const hide = (emit) => () => {
59
+ emit("hide", false);
60
+ emit("update:visible", false);
61
+ };
62
+ const selectOption = ({ emit, props }) => (option) => {
63
+ const { valueField } = props;
64
+ emit("update:visible", false);
65
+ emit("update:modelValue", option[valueField]);
66
+ emit("click", option);
67
+ };
68
+ const confirm = ({ emit, state }) => () => {
69
+ emit("confirm", state);
70
+ emit("update:visible", false);
71
+ };
72
+ const actionSelectOption = ({ emit }) => (option, index) => {
73
+ emit("update:visible", false);
74
+ emit("click", option, index);
75
+ };
54
76
  export {
77
+ actionSelectOption,
78
+ close,
79
+ confirm,
80
+ hide,
55
81
  initScrollMenu,
56
82
  menuHandle,
83
+ selectOption,
57
84
  setSheetStyle,
58
85
  visibleHandle,
59
86
  watchVisible
@@ -1,7 +1,7 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
- import { setSheetStyle, initScrollMenu, visibleHandle, watchVisible, menuHandle } from "./index";
3
- const api = ["state", "setSheetStyle", "initScrollMenu", "visibleHandle", "menuHandle"];
4
- const renderless = (props, { reactive, watch }, { emit, nextTick, refs }, { BScroll }) => {
2
+ import { setSheetStyle, initScrollMenu, visibleHandle, watchVisible, menuHandle, close, selectOption, confirm, actionSelectOption, hide } from "./index";
3
+ const api = ["state", "setSheetStyle", "initScrollMenu", "visibleHandle", "menuHandle", "close", "selectOption", "confirm", "actionSelectOption", "hide"];
4
+ const renderless = (props, { reactive, watch }, { emit, nextTick, refs, vm }, { BScroll }) => {
5
5
  const api2 = {};
6
6
  const state = reactive({
7
7
  toggle: false,
@@ -20,13 +20,19 @@ const renderless = (props, { reactive, watch }, { emit, nextTick, refs }, { BScr
20
20
  api2.watchVisible(value);
21
21
  }
22
22
  );
23
+ watch(() => props.visible, api2.watchVisible, { immediate: true });
23
24
  Object.assign(api2, {
24
25
  state,
25
26
  setSheetStyle: setSheetStyle({ state, props }),
26
27
  initScrollMenu: initScrollMenu({ state, nextTick, refs, BScroll }),
27
28
  visibleHandle: visibleHandle({ emit, state }),
28
29
  watchVisible: watchVisible({ emit, props, state }),
29
- menuHandle: menuHandle({ state, emit })
30
+ menuHandle: menuHandle({ state, emit }),
31
+ confirm: confirm({ state, emit }),
32
+ selectOption: selectOption({ emit, props }),
33
+ actionSelectOption: actionSelectOption({ emit }),
34
+ close: close({ emit, vm }),
35
+ hide: hide(emit)
30
36
  });
31
37
  return api2;
32
38
  };
package/alert/index.js CHANGED
@@ -3,10 +3,32 @@ const close = ({ emit, state }) => () => {
3
3
  state.show = false;
4
4
  emit("close");
5
5
  };
6
- const computedGetIcon = ({ constants, props }) => () => props.icon || constants.ICON_MAP[props.type];
6
+ const computedGetIcon = ({ constants, props, designConfig }) => () => {
7
+ var _a;
8
+ const designIcon = (_a = designConfig == null ? void 0 : designConfig.icons) == null ? void 0 : _a[props.type];
9
+ return props.icon || designIcon || constants.ICON_MAP[props.type];
10
+ };
7
11
  const computedGetTitle = ({ constants, t, props }) => () => props.title || t(constants.TITLE_MAP[props.type]);
12
+ const handleHeaderClick = ({ state, props, vm }) => () => {
13
+ if (props.showFoldable) {
14
+ state.contentVisible = !state.contentVisible;
15
+ }
16
+ if (vm.$refs.ContentDescribe) {
17
+ state.contentDescribeHeight = vm.$refs.ContentDescribe.scrollHeight;
18
+ if (state.contentDescribeHeight > state.contentMaxHeight) {
19
+ state.scrollStatus = true;
20
+ }
21
+ }
22
+ if (vm.$refs.ContentDefault) {
23
+ state.contentDefaultHeight = vm.$refs.ContentDefault.scrollHeight;
24
+ if (state.contentDefaultHeight > state.contentMaxHeight) {
25
+ state.scrollStatus = true;
26
+ }
27
+ }
28
+ };
8
29
  export {
9
30
  close,
10
31
  computedGetIcon,
11
- computedGetTitle
32
+ computedGetTitle,
33
+ handleHeaderClick
12
34
  };
package/alert/vue.js CHANGED
@@ -1,20 +1,24 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
- import { close, computedGetIcon, computedGetTitle } from "./index";
3
- const api = ["close", "state"];
4
- const renderless = (props, { computed, reactive }, { t, emit, constants }) => {
5
- const api2 = {
6
- computedGetIcon: computedGetIcon({ constants, props }),
7
- computedGetTitle: computedGetTitle({ constants, props, t })
8
- };
2
+ import { close, computedGetIcon, computedGetTitle, handleHeaderClick } from "./index";
3
+ const api = ["close", "state", "handleHeaderClick"];
4
+ const renderless = (props, { computed, reactive }, { t, emit, constants, vm, designConfig }) => {
9
5
  const state = reactive({
10
6
  show: true,
11
7
  getIcon: computed(() => api2.computedGetIcon()),
12
- getTitle: computed(() => api2.computedGetTitle())
8
+ getTitle: computed(() => api2.computedGetTitle()),
9
+ contentVisible: false,
10
+ contentDescribeHeight: 0,
11
+ contentDefaultHeight: 0,
12
+ contentMaxHeight: constants.CONTENT_MAXHEUGHT,
13
+ scrollStatus: false
13
14
  });
14
- Object.assign(api2, {
15
+ const api2 = {
15
16
  state,
16
- close: close({ state, emit })
17
- });
17
+ computedGetIcon: computedGetIcon({ constants, props, designConfig }),
18
+ computedGetTitle: computedGetTitle({ constants, props, t }),
19
+ close: close({ state, emit }),
20
+ handleHeaderClick: handleHeaderClick({ state, props, vm })
21
+ };
18
22
  return api2;
19
23
  };
20
24
  export {
package/amount/index.js CHANGED
@@ -2,10 +2,10 @@ import {
2
2
  __spreadProps,
3
3
  __spreadValues
4
4
  } from "../chunk-PKUHTIDK.js";
5
- import { on, off } from "@opentiny/vue-renderless/common/deps/dom";
6
- import { formatNumber } from "@opentiny/vue-renderless/common/decimal";
7
- import { getMiniDecimal, equalsDecimal } from "@opentiny/vue-renderless/common/bigInt";
8
- import { isNumber } from "@opentiny/vue-renderless/common/type";
5
+ import { on, off } from "../common/deps/dom";
6
+ import { formatNumber } from "../common/decimal";
7
+ import { getMiniDecimal, equalsDecimal } from "../common/bigInt";
8
+ import { isNumber } from "../common/type";
9
9
  const initService = (service) => {
10
10
  const { utils = {} } = service || {};
11
11
  const noopFn = () => null;
package/anchor/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
- import { addClass, removeClass } from "@opentiny/vue-renderless/common/deps/dom";
2
+ import { addClass, removeClass } from "../common/deps/dom";
3
3
  const setFixAnchor = ({ vm }) => {
4
4
  const { fixRef } = vm.$refs;
5
5
  if (fixRef) {
@@ -1,7 +1,7 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
- import debounce from "@opentiny/vue-renderless/common/deps/debounce";
3
- import userPopper from "@opentiny/vue-renderless/common/deps/vue-popper";
4
- import { guid } from "@opentiny/vue-renderless/common/string";
2
+ import debounce from "../common/deps/debounce";
3
+ import userPopper from "../common/deps/vue-popper";
4
+ import { guid } from "../common/string";
5
5
  import {
6
6
  computedVisible,
7
7
  watchVisible,
@@ -1,5 +1,5 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
- import { getAmap } from "@opentiny/vue-renderless/chart-core/deps/utils";
2
+ import { getAmap } from "../chart-core/deps/utils";
3
3
  const amap = (columns, rows, settings, extra) => {
4
4
  const { key, v, amap: amap2, useOuterMap, url } = settings;
5
5
  const { _once } = extra;
package/badge/vue.js CHANGED
@@ -1,19 +1,19 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
2
  import { computedContent, computedValueRef } from "./index";
3
- import { xss } from "@opentiny/vue-renderless/common/xss";
3
+ import { xss } from "../common/xss";
4
4
  const api = ["state"];
5
5
  const renderless = (props, { computed, reactive }) => {
6
- const api2 = {
7
- computedValueRef: computedValueRef({ props })
8
- };
9
6
  const state = reactive({
10
7
  isOverstep: false,
11
8
  valueRef: computed(() => api2.computedValueRef()),
12
9
  content: computed(() => api2.computedContent()),
13
10
  href: computed(() => xss.filterUrl(props.href))
14
11
  });
15
- api2.state = state;
16
- api2.computedContent = computedContent({ props, state });
12
+ const api2 = {
13
+ state,
14
+ computedValueRef: computedValueRef({ props }),
15
+ computedContent: computedContent({ props, state })
16
+ };
17
17
  return api2;
18
18
  };
19
19
  export {
@@ -1,5 +1,5 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
- import { getBmap } from "@opentiny/vue-renderless/chart-core/deps/utils";
2
+ import { getBmap } from "../chart-core/deps/utils";
3
3
  const bmap = (columns, rows, settings, extra) => {
4
4
  const { key, v, bmap: bmap2, useOuterMap, url } = settings;
5
5
  const { _once } = extra;
@@ -1,5 +1,5 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
- import { xss } from "@opentiny/vue-renderless/common/xss.js";
2
+ import { xss } from "../common/xss.js";
3
3
  const getRoute = (route) => `/${route || ""}`.replace(/^\/+/, "/");
4
4
  const computedDataList = ({ props, state }) => () => {
5
5
  const list = props.data[Number(state.actName) - 1] || [];
package/calendar/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
- import { isLeapYear } from "@opentiny/vue-renderless/common/date";
3
- import { copyArray } from "@opentiny/vue-renderless/common/object";
2
+ import { isLeapYear } from "../common/date";
3
+ import { copyArray } from "../common/object";
4
4
  const getDays = (year, month) => [31, isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month - 1];
5
5
  const getWeek = (year, month, day) => (/* @__PURE__ */ new Date(`${year}/${month}/${day}`)).getDay();
6
6
  const lastMonth = (year, month) => {
@@ -0,0 +1,268 @@
1
+ import "../chunk-PKUHTIDK.js";
2
+ const normalConfig = (config, state) => {
3
+ let { weekFirst, disabled, holiday, workday, mark } = config || {};
4
+ const minWeekFirst = 0;
5
+ const maxWeekFirst = state.dayOfWeek - 1;
6
+ weekFirst = typeof weekFirst === "number" && weekFirst >= minWeekFirst && weekFirst <= maxWeekFirst ? Math.round(weekFirst) : minWeekFirst;
7
+ disabled = typeof disabled === "function" ? disabled : () => false;
8
+ holiday = typeof holiday === "function" ? holiday : () => true;
9
+ workday = typeof workday === "function" ? workday : () => true;
10
+ mark = typeof mark === "function" ? mark : () => "";
11
+ return { weekFirst, disabled, holiday, workday, mark };
12
+ };
13
+ const normalDate = (date) => {
14
+ date = !date ? /* @__PURE__ */ new Date() : !(date instanceof Date) ? new Date(date) : date;
15
+ date = date.toString() === "Invalid Date" ? /* @__PURE__ */ new Date() : date;
16
+ return date;
17
+ };
18
+ const splitDate = (date) => {
19
+ const today = /* @__PURE__ */ new Date();
20
+ const todayFullYear = today.getFullYear();
21
+ const todayMonth = today.getMonth() + 1;
22
+ const todayDate = today.getDate();
23
+ const currentFullYear = date.getFullYear();
24
+ const currentMonth = date.getMonth() + 1;
25
+ const currentDate = date.getDate();
26
+ return { todayFullYear, todayMonth, todayDate, currentFullYear, currentMonth, currentDate };
27
+ };
28
+ const getBuildDay = (args) => (year, month, date) => {
29
+ const { pad0: pad02, isCurrent, currentFullYear, currentMonth, holiday, workday, mark } = args;
30
+ const { currentDate, isToday, disabled, dayOfWeek } = args;
31
+ const dateStr = `${year}-${pad02(month)}-${pad02(date)}`;
32
+ const d = new Date(dateStr);
33
+ const isCurMon = isCurrent(year, month);
34
+ const isSat = d.getDay() === dayOfWeek - 1;
35
+ const isSun = d.getDay() === 0;
36
+ let isWorkday, isHoliday;
37
+ if (year === currentFullYear && month === currentMonth) {
38
+ if (isSat || isSun) {
39
+ isHoliday = holiday(d);
40
+ isWorkday = !isHoliday;
41
+ } else {
42
+ isWorkday = workday(d);
43
+ isHoliday = !isWorkday;
44
+ }
45
+ }
46
+ const markMsg = mark(d);
47
+ const marked = !!markMsg;
48
+ const day = { dateStr, marked, markMsg, isWorkday, isHoliday, isSat, isSun, isCurMon };
49
+ day.isCur = isCurMon && date === currentDate;
50
+ day.isToday = isToday(year, month, date);
51
+ day.disabled = disabled(d);
52
+ day.dateArr = [year, month, date];
53
+ return day;
54
+ };
55
+ const getPadCalendarDays = ({ calendarDays, buildDay }) => (flag, count, cur) => {
56
+ const sign = flag === "s" ? -1 : 1;
57
+ Array.from({ length: count }).map((v, i) => {
58
+ const d = new Date(cur.getTime() + (i + 1) * sign * 864e5);
59
+ const year = d.getFullYear();
60
+ const month = d.getMonth() + 1;
61
+ const date = d.getDate();
62
+ calendarDays[flag === "s" ? "unshift" : "push"](buildDay(year, month, date));
63
+ });
64
+ };
65
+ const equalArr = (arr1, arr2) => Array.isArray(arr1) && Array.isArray(arr2) && arr1.join(",") === arr2.join(",");
66
+ const setDayRow = ({ calendarDays, state }) => calendarDays.map((day, i) => day.row = Math.floor(i / state.dayOfWeek));
67
+ const pad0 = (str, n = 2) => String(str).padStart(n, "0");
68
+ const getCalendarDays = (state) => (date, config) => {
69
+ date = normalDate(date);
70
+ let { weekFirst, disabled, holiday, workday, mark } = normalConfig(config, state);
71
+ const { todayFullYear, todayMonth, todayDate, currentFullYear, currentMonth, currentDate } = splitDate(date);
72
+ const isToday = (year, month, date2) => year === todayFullYear && month === todayMonth && date2 === todayDate;
73
+ const isCurrent = (year, month) => year === currentFullYear && month === currentMonth;
74
+ const february = currentFullYear % 4 === 0 && currentFullYear % 100 !== 0 || currentFullYear % 400 === 0 ? 29 : 28;
75
+ const monthDays = [-1, 31, february, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
76
+ const f = (arr) => arr[0];
77
+ const l = (arr) => arr[arr.length - 1];
78
+ const { dayOfWeek } = state;
79
+ const args = { pad0, isCurrent, currentFullYear, currentMonth, holiday, workday, mark };
80
+ Object.assign(args, { currentDate, isToday, disabled, dayOfWeek });
81
+ const buildDay = getBuildDay(args);
82
+ const calendarDays = Array.from({ length: monthDays[currentMonth] }).map(
83
+ (v, i) => buildDay(currentFullYear, currentMonth, i + 1)
84
+ );
85
+ const weekDays = Array.from({ length: dayOfWeek }).map((v, i) => (weekFirst + i) % dayOfWeek);
86
+ const monthDaysFirst = new Date(f(calendarDays).dateStr).getDay();
87
+ const monthDaysLast = new Date(l(calendarDays).dateStr).getDay();
88
+ const padCalendarDays = getPadCalendarDays({ calendarDays, buildDay });
89
+ let count = monthDaysFirst !== f(weekDays) ? weekDays.indexOf(monthDaysFirst) : dayOfWeek;
90
+ padCalendarDays("s", count, new Date(f(calendarDays).dateStr));
91
+ count = monthDaysLast !== l(weekDays) ? dayOfWeek - 1 - weekDays.indexOf(monthDaysLast) : dayOfWeek;
92
+ padCalendarDays("e", count, new Date(l(calendarDays).dateStr));
93
+ setDayRow({ calendarDays, state });
94
+ if (!equalArr(state.weekDays, weekDays)) {
95
+ state.weekDays = weekDays;
96
+ }
97
+ state.calendarDays = calendarDays;
98
+ state.currentYear = `${currentFullYear}`;
99
+ state.currentMonth = `${currentMonth}`;
100
+ state.currentDate = `${currentDate}`;
101
+ state.cascaderCurrent = [currentFullYear, currentMonth];
102
+ };
103
+ const setStackRows = (state) => {
104
+ const { calendarDays } = state;
105
+ if (Array.isArray(calendarDays) && calendarDays.length) {
106
+ const currentDay = calendarDays.find((day) => day.isCur);
107
+ const allRows = [...new Set(calendarDays.map((day) => day.row))];
108
+ const index = allRows.indexOf(currentDay.row);
109
+ const stackRows = allRows.slice(index + 1).reverse().concat(allRows.slice(0, index));
110
+ state.stackRows = stackRows;
111
+ }
112
+ };
113
+ const computedCurrentRow = (state) => () => {
114
+ const { calendarDays } = state;
115
+ setStackRows(state);
116
+ if (Array.isArray(calendarDays) && calendarDays.length) {
117
+ const currentDay = calendarDays.find((day) => day.isCur);
118
+ if (currentDay) {
119
+ return currentDay.row;
120
+ }
121
+ }
122
+ return null;
123
+ };
124
+ const computedFilteredCalendarDays = (state) => () => {
125
+ const { calendarDays, currentRow, visibleRows } = state;
126
+ if (Array.isArray(calendarDays) && calendarDays.length && currentRow !== null) {
127
+ const rows = [...visibleRows, currentRow];
128
+ return calendarDays.filter((day) => ~rows.indexOf(day.row));
129
+ }
130
+ return [];
131
+ };
132
+ const clearVisibleRows = (state) => state.visibleRows = [];
133
+ const fillVisibleRows = (state) => state.visibleRows = [...new Set((state.calendarDays || []).map((day) => day.row))];
134
+ const handleDraggerClick = (state) => () => {
135
+ const { visibleRows } = state;
136
+ if (state.dragging)
137
+ return;
138
+ if (Array.isArray(visibleRows) && visibleRows.length) {
139
+ clearVisibleRows(state);
140
+ } else {
141
+ fillVisibleRows(state);
142
+ }
143
+ };
144
+ const handleClickDay = ({ api, emit, props }) => (day) => {
145
+ if (day.isCur || day.disabled)
146
+ return;
147
+ if (typeof day.dateStr === "string") {
148
+ api.getCalendarDays(day.dateStr, props.config);
149
+ emit("update:modelValue", day.dateStr);
150
+ }
151
+ };
152
+ const calcCalendarItemHeight = ({ state, vm }) => () => {
153
+ const calendarPanel = vm.$refs.calendarPanel;
154
+ if (calendarPanel && calendarPanel.childNodes instanceof NodeList && calendarPanel.childNodes.length > 1) {
155
+ setTimeout(() => {
156
+ state.itemHeight = calendarPanel.childNodes[1].offsetHeight;
157
+ });
158
+ }
159
+ };
160
+ const computedTotalRows = (state) => () => {
161
+ const { calendarDays, dayOfWeek } = state;
162
+ const total = Math.floor(calendarDays.length / dayOfWeek);
163
+ return total;
164
+ };
165
+ const dragStart = ({ state, vm, clientX, clientY }) => {
166
+ state.dragPosStart = state.dragPos = { clientX, clientY };
167
+ state.calendarPanelHeight = vm.$refs.calendarPanel.offsetHeight;
168
+ state.stackRowsCopy = state.stackRows.slice(0);
169
+ };
170
+ const dragEnd = ({ state, vm, clientY }) => {
171
+ const dy = clientY - state.dragPosStart.clientY;
172
+ state.dragPosStart = state.dragPos = {};
173
+ vm.$refs.calendarPanel.style.height = "auto";
174
+ if (dy > 0) {
175
+ fillVisibleRows(state);
176
+ } else if (dy < 0) {
177
+ clearVisibleRows(state);
178
+ }
179
+ };
180
+ const dragMove = ({ state, vm, clientX, clientY }) => {
181
+ const { dragPos: lastPos, itemHeight, totalRows, stackRowsCopy, currentRow } = state;
182
+ const minH = itemHeight;
183
+ const maxH = itemHeight * totalRows;
184
+ state.dragPos = { clientX, clientY };
185
+ state.calendarPanelHeight += clientY - lastPos.clientY;
186
+ let h = state.calendarPanelHeight;
187
+ h = h < minH ? minH : h > maxH ? maxH : h;
188
+ const showRows = Math.floor(h / itemHeight);
189
+ vm.$refs.calendarPanel.style.height = `${h}px`;
190
+ state.visibleRows = stackRowsCopy.slice(0).concat(currentRow).reverse().slice(0, showRows);
191
+ };
192
+ const handleDraggerMousedown = ({ api, state, vm }) => (e) => {
193
+ const { clientX, clientY } = e;
194
+ dragStart({ state, vm, clientX, clientY });
195
+ document.addEventListener("mouseup", api.handleMouseup);
196
+ document.addEventListener("mousemove", api.throttledHandleMousemove);
197
+ };
198
+ const handleMouseup = ({ api, state, vm }) => (e) => {
199
+ setTimeout(() => state.dragging = false);
200
+ document.removeEventListener("mouseup", api.handleMouseup);
201
+ document.removeEventListener("mousemove", api.throttledHandleMousemove);
202
+ dragEnd({ state, vm, clientY: e.clientY });
203
+ };
204
+ const handleMousemove = ({ state, vm }) => (e) => {
205
+ state.dragging = true;
206
+ const { clientX, clientY } = e;
207
+ dragMove({ state, vm, clientX, clientY });
208
+ };
209
+ const handleDraggerTouchstart = ({ state, vm }) => (e) => {
210
+ const { clientX, clientY } = e.changedTouches[0];
211
+ state.touching = true;
212
+ dragStart({ state, vm, clientX, clientY });
213
+ };
214
+ const handleDraggerTouchend = ({ state, vm }) => (e) => {
215
+ const { clientY } = e.changedTouches[0];
216
+ state.touching = false;
217
+ dragEnd({ state, vm, clientY });
218
+ };
219
+ const handleDraggerTouchmove = ({ state, vm }) => (e) => {
220
+ const { clientX, clientY } = e.changedTouches[0];
221
+ dragMove({ state, vm, clientX, clientY });
222
+ };
223
+ const setCascaderVisible = (state) => (value) => state.cascaderVisible = !!value;
224
+ const handleCascaderChange = ({ api, emit, props, state }) => (val) => {
225
+ const { currentDate } = state;
226
+ let dateStr = `${val[0]}-${pad0(val[1])}-${pad0(currentDate)}`;
227
+ const numberCurrentDate = Number(currentDate);
228
+ const { currentFullYear: curYear, currentMonth: curMonth, currentDate: curDate } = splitDate(new Date(dateStr));
229
+ if (curYear !== val[0] || curMonth !== val[1] || curDate !== numberCurrentDate) {
230
+ dateStr = `${val[0]}-${pad0(val[1])}-01`;
231
+ }
232
+ api.getCalendarDays(dateStr, props.config);
233
+ emit("update:modelValue", dateStr);
234
+ };
235
+ const computeCascaderOptions = (t) => () => [
236
+ {
237
+ range: [2e3, 2050],
238
+ optionMethod: (i) => ({ id: i, label: t("ui.calendarBar.year").replace("%s", String(i)) })
239
+ },
240
+ { range: [1, 12], optionMethod: (i) => ({ id: i, label: t(`ui.calendarBar.month.${i}`) }) }
241
+ ];
242
+ const i18nYearMonth = ({ state, t }) => () => {
243
+ const { currentYear, currentMonth } = state;
244
+ let template = t("ui.calendarBar.yearMonth");
245
+ const monthAbbr = t(`ui.calendarBar.monthAbbr.${currentMonth}`);
246
+ template = template.replace("%y", currentYear);
247
+ template = template.replace("%m", monthAbbr);
248
+ return template;
249
+ };
250
+ export {
251
+ calcCalendarItemHeight,
252
+ computeCascaderOptions,
253
+ computedCurrentRow,
254
+ computedFilteredCalendarDays,
255
+ computedTotalRows,
256
+ getCalendarDays,
257
+ handleCascaderChange,
258
+ handleClickDay,
259
+ handleDraggerClick,
260
+ handleDraggerMousedown,
261
+ handleDraggerTouchend,
262
+ handleDraggerTouchmove,
263
+ handleDraggerTouchstart,
264
+ handleMousemove,
265
+ handleMouseup,
266
+ i18nYearMonth,
267
+ setCascaderVisible
268
+ };
@@ -0,0 +1,87 @@
1
+ import "../chunk-PKUHTIDK.js";
2
+ import {
3
+ getCalendarDays,
4
+ computedCurrentRow,
5
+ computedFilteredCalendarDays,
6
+ handleDraggerClick,
7
+ handleClickDay,
8
+ calcCalendarItemHeight,
9
+ computedTotalRows,
10
+ handleDraggerMousedown,
11
+ handleMouseup,
12
+ handleMousemove,
13
+ handleDraggerTouchstart,
14
+ handleDraggerTouchend,
15
+ handleDraggerTouchmove,
16
+ setCascaderVisible,
17
+ handleCascaderChange,
18
+ computeCascaderOptions,
19
+ i18nYearMonth
20
+ } from "./index";
21
+ import throttle from "../common/deps/throttle";
22
+ const api = [
23
+ "state",
24
+ "handleDraggerClick",
25
+ "handleClickDay",
26
+ "handleDraggerMousedown",
27
+ "handleDraggerTouchstart",
28
+ "handleDraggerTouchend",
29
+ "throttledHandleDraggerTouchmove",
30
+ "setCascaderVisible",
31
+ "handleCascaderChange",
32
+ "i18nYearMonth"
33
+ ];
34
+ const renderless = (props, { reactive, computed, onBeforeMount, onMounted }, { emit, vm, t }) => {
35
+ const state = reactive({
36
+ minSize2: "min-width: 3rem; min-height: 2rem",
37
+ minSize3: "min-width: 3rem; min-height: 3rem",
38
+ dayOfWeek: 7,
39
+ weekDays: [],
40
+ calendarDays: [],
41
+ currentYear: "",
42
+ currentMonth: "",
43
+ currentRow: computed(() => api2.computedCurrentRow()),
44
+ filteredCalendarDays: computed(() => api2.computedFilteredCalendarDays()),
45
+ visibleRows: [],
46
+ itemHeight: 0,
47
+ totalRows: computed(() => api2.computedTotalRows()),
48
+ dragging: false,
49
+ touching: false,
50
+ cascaderCurrent: [],
51
+ cascaderOptions: computed(() => api2.computeCascaderOptions()),
52
+ cascaderVisible: false
53
+ });
54
+ const api2 = {
55
+ state,
56
+ getCalendarDays: getCalendarDays(state),
57
+ computedCurrentRow: computedCurrentRow(state),
58
+ computedFilteredCalendarDays: computedFilteredCalendarDays(state),
59
+ handleDraggerClick: handleDraggerClick(state),
60
+ calcCalendarItemHeight: calcCalendarItemHeight({ state, vm }),
61
+ computedTotalRows: computedTotalRows(state),
62
+ throttledHandleMousemove: throttle(20, handleMousemove({ state, vm })),
63
+ handleDraggerTouchstart: handleDraggerTouchstart({ state, vm }),
64
+ handleDraggerTouchend: handleDraggerTouchend({ state, vm }),
65
+ throttledHandleDraggerTouchmove: throttle(20, handleDraggerTouchmove({ state, vm })),
66
+ setCascaderVisible: setCascaderVisible(state),
67
+ computeCascaderOptions: computeCascaderOptions(t),
68
+ i18nYearMonth: i18nYearMonth({ state, t })
69
+ };
70
+ Object.assign(api2, {
71
+ handleClickDay: handleClickDay({ api: api2, emit, props }),
72
+ handleDraggerMousedown: handleDraggerMousedown({ api: api2, state, vm }),
73
+ handleMouseup: handleMouseup({ api: api2, state, vm }),
74
+ handleCascaderChange: handleCascaderChange({ api: api2, emit, props, state })
75
+ });
76
+ onBeforeMount(() => {
77
+ api2.getCalendarDays(props.modelValue, props.config);
78
+ });
79
+ onMounted(() => {
80
+ api2.calcCalendarItemHeight();
81
+ });
82
+ return api2;
83
+ };
84
+ export {
85
+ api,
86
+ renderless
87
+ };