@opentiny/vue-renderless 3.13.2 → 3.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (320) hide show
  1. package/action-sheet/index.js +20 -13
  2. package/action-sheet/vue.js +8 -7
  3. package/amount/index.js +100 -25
  4. package/amount/vue.js +102 -26
  5. package/anchor/index.js +1 -0
  6. package/area/index.js +8 -8
  7. package/area/vue.js +5 -5
  8. package/async-flowchart/index.js +16 -3
  9. package/autocomplete/index.js +58 -14
  10. package/autocomplete/vue.js +40 -12
  11. package/badge/index.js +12 -0
  12. package/badge/vue.js +6 -4
  13. package/breadcrumb/vue.js +3 -1
  14. package/breadcrumb-item/vue.js +6 -2
  15. package/button/index.js +5 -1
  16. package/calendar/index.js +2 -86
  17. package/calendar-bar/index.js +18 -4
  18. package/calendar-view/index.js +5 -1
  19. package/calendar-view/vue.js +16 -3
  20. package/card-group/vue.js +4 -2
  21. package/cascader/index.js +86 -34
  22. package/cascader/vue.js +61 -20
  23. package/cascader-menu/index.js +7 -7
  24. package/cascader-menu/vue.js +2 -3
  25. package/cascader-mobile/index.js +36 -23
  26. package/cascader-mobile/vue.js +6 -0
  27. package/cascader-node/index.js +13 -1
  28. package/cascader-node/vue.js +15 -4
  29. package/cascader-panel/index.js +1 -1
  30. package/cascader-select/column-index.js +150 -0
  31. package/cascader-select/column.js +120 -0
  32. package/cascader-select/index.js +29 -165
  33. package/cascader-select/usePicker.js +251 -0
  34. package/cascader-select/useTouch.js +65 -0
  35. package/cascader-select/vue.js +35 -47
  36. package/cell/vue.js +2 -1
  37. package/chart-bar/index.js +2 -3
  38. package/chart-core/deps/constants.js +43 -43
  39. package/chart-core/index.js +1 -1
  40. package/chart-gauge/index.js +2 -2
  41. package/chart-heatmap/index.js +17 -10
  42. package/chart-line/index.js +8 -9
  43. package/chart-tree/index.js +2 -2
  44. package/chart-waterfall/index.js +4 -6
  45. package/checkbox/index.js +18 -1
  46. package/checkbox/vue.js +15 -7
  47. package/checkbox-group/vue.js +1 -0
  48. package/col/vue.js +1 -1
  49. package/collapse/index.js +3 -3
  50. package/color-select-panel/vue.js +0 -7
  51. package/column-list-item/index.js +17 -1
  52. package/column-list-item/vue.js +8 -3
  53. package/common/bigInt.js +2 -2
  54. package/common/date.js +7 -5
  55. package/common/deps/clickoutside.js +6 -2
  56. package/common/deps/date-util.js +4 -2
  57. package/common/deps/dom.js +19 -4
  58. package/common/deps/popper.js +44 -11
  59. package/common/deps/resize-event.js +1 -0
  60. package/common/deps/touch-emulator.js +4 -1
  61. package/common/deps/tree-model/node.js +2 -2
  62. package/common/deps/tree-model/tree-store.js +2 -13
  63. package/common/deps/useRect.js +25 -0
  64. package/common/deps/vue-popper.js +38 -20
  65. package/common/index.js +2 -2
  66. package/common/runtime.js +1 -1
  67. package/common/string.js +2 -2
  68. package/common/type.js +2 -1
  69. package/common/validate/rules/enum.js +1 -1
  70. package/common/validate/rules/pattern.js +2 -2
  71. package/common/validate/rules/range.js +8 -5
  72. package/common/validate/rules/required.js +1 -1
  73. package/common/validate/rules/type.js +5 -5
  74. package/common/validate/rules/whitespace.js +1 -1
  75. package/common/validate/util.js +15 -16
  76. package/common/validate/validations/integer.js +1 -1
  77. package/common/validate/validations/method.js +1 -1
  78. package/currency/index.js +74 -7
  79. package/currency/vue.js +21 -5
  80. package/date-panel/index.js +16 -0
  81. package/date-panel/vue.js +8 -2
  82. package/date-picker-mobile/index.js +12 -0
  83. package/date-picker-mobile/vue.js +7 -1
  84. package/date-range/vue.js +15 -6
  85. package/date-table/index.js +35 -53
  86. package/date-table/vue.js +4 -2
  87. package/dialog-box/index.js +46 -14
  88. package/dialog-box/vue.js +30 -7
  89. package/dialog-select/index.js +6 -3
  90. package/dialog-select/vue.js +8 -4
  91. package/drawer/index.js +27 -5
  92. package/drawer/vue.js +14 -7
  93. package/dropdown/index.js +7 -7
  94. package/dropdown/vue.js +6 -2
  95. package/dropdown-item/index.js +9 -1
  96. package/dropdown-item/mf.js +6 -10
  97. package/dropdown-item/vue.js +20 -7
  98. package/dropdown-menu/index.js +20 -7
  99. package/dropdown-menu/vue.js +4 -3
  100. package/exception/index.js +2 -7
  101. package/exception/vue.js +7 -10
  102. package/fall-menu/index.js +5 -1
  103. package/fall-menu/vue.js +13 -2
  104. package/file-upload/index.js +68 -18
  105. package/file-upload/vue.js +38 -8
  106. package/filter-box/index.js +1 -0
  107. package/float-button/index.js +42 -0
  108. package/float-button/vue.js +101 -0
  109. package/floating-button/index.js +62 -16
  110. package/floating-button/vue.js +27 -9
  111. package/flowchart/index.js +134 -25
  112. package/flowchart/node.js +13 -4
  113. package/flowchart/vue.js +16 -4
  114. package/form/vue.js +8 -0
  115. package/form-item/index.js +5 -5
  116. package/form-item/vue.js +3 -1
  117. package/fullscreen/index.js +5 -5
  118. package/fullscreen/vue.js +3 -3
  119. package/grid/plugins/export.js +5 -2
  120. package/grid/utils/column.js +1 -0
  121. package/grid/utils/dom.js +7 -1
  122. package/image/index.js +6 -1
  123. package/image/vue.js +6 -3
  124. package/image-viewer/index.js +62 -51
  125. package/image-viewer/vue.js +17 -5
  126. package/input/index.js +81 -20
  127. package/input/vue.js +44 -18
  128. package/ip-address/index.js +61 -19
  129. package/ip-address/vue.js +22 -4
  130. package/link/vue.js +3 -1
  131. package/loading/index.js +2 -2
  132. package/loading/vue.js +8 -2
  133. package/logout/index.js +1 -1
  134. package/menu/index.js +15 -2
  135. package/menu/vue.js +22 -17
  136. package/mind-map/index.js +47 -0
  137. package/mind-map/vue.js +53 -0
  138. package/modal/index.js +44 -4
  139. package/modal/vue.js +18 -4
  140. package/multi-select/index.js +186 -11
  141. package/multi-select/vue.js +60 -15
  142. package/multi-select-item/index.js +23 -0
  143. package/multi-select-item/vue.js +31 -0
  144. package/numeric/index.js +48 -12
  145. package/numeric/vue.js +44 -19
  146. package/option/index.js +27 -9
  147. package/option/vue.js +37 -21
  148. package/option-group/index.js +3 -3
  149. package/package.json +1 -1
  150. package/pager/index.js +18 -4
  151. package/pager/vue.js +16 -5
  152. package/picker/index.js +290 -77
  153. package/picker/mb.js +42 -0
  154. package/picker/vue.js +76 -20
  155. package/picker-column/index.js +1 -1
  156. package/pop-upload/vue.js +3 -0
  157. package/popconfirm/index.js +3 -6
  158. package/popconfirm/vue.js +1 -1
  159. package/popeditor/index.js +73 -34
  160. package/popeditor/vue.js +15 -11
  161. package/popover/index.js +4 -4
  162. package/popover/vue.js +6 -6
  163. package/popup/index.js +3 -3
  164. package/popup/vue.js +5 -5
  165. package/pull-refresh/index.js +13 -13
  166. package/pull-refresh/vue.js +5 -4
  167. package/radio/index.js +0 -17
  168. package/radio/vue.js +4 -10
  169. package/rate/index.js +1 -1
  170. package/rate/vue.js +0 -2
  171. package/record/index.js +4 -1
  172. package/rich-text/clipboard.js +54 -0
  173. package/rich-text/index.js +192 -0
  174. package/rich-text/module/file-upload.js +107 -0
  175. package/rich-text/module/image-drop.js +63 -0
  176. package/rich-text/module/image-upload.js +89 -0
  177. package/rich-text/options.js +141 -0
  178. package/rich-text/table-module.js +382 -0
  179. package/rich-text/vue.js +102 -0
  180. package/{rich-text-edtior → rich-text-editor}/index.js +2 -2
  181. package/{rich-text-edtior → rich-text-editor}/vue.js +2 -5
  182. package/scrollbar/index.js +11 -11
  183. package/scrollbar/vue-bar.js +3 -3
  184. package/scrollbar/vue.js +5 -5
  185. package/search/index.js +9 -9
  186. package/search/vue.js +8 -6
  187. package/select/index.js +442 -393
  188. package/select/vue.js +278 -164
  189. package/select-dropdown/index.js +61 -3
  190. package/select-dropdown/vue.js +85 -8
  191. package/select-view/index.js +3 -1
  192. package/selected-box/index.js +2 -0
  193. package/selected-box/vue.js +6 -3
  194. package/signature/index.js +241 -0
  195. package/signature/vue.js +88 -0
  196. package/skeleton/index.js +14 -0
  197. package/skeleton/vue.js +15 -0
  198. package/skeleton-item/vue.js +15 -0
  199. package/slider/index.js +70 -17
  200. package/slider/vue.js +16 -7
  201. package/split/index.js +5 -3
  202. package/split/vue.js +4 -6
  203. package/standard-list-item/index.js +15 -1
  204. package/standard-list-item/vue.js +6 -5
  205. package/steps/index.js +25 -2
  206. package/steps/slide-bar.js +8 -1
  207. package/steps/vue.js +15 -3
  208. package/tab-item-mf/vue.js +14 -8
  209. package/tab-nav/index.js +30 -5
  210. package/tab-nav/vue.js +16 -4
  211. package/tabbar/vue.js +9 -3
  212. package/tabbar-item/vue.js +3 -2
  213. package/tabs/index.js +16 -4
  214. package/tabs/vue.js +2 -1
  215. package/tabs-mf/index.js +20 -6
  216. package/tabs-mf/vue-nav.js +26 -11
  217. package/tabs-mf/vue.js +7 -7
  218. package/tabs-mf/wheel.js +1 -0
  219. package/tag/index.js +1 -1
  220. package/tag-group/index.js +2 -1
  221. package/time/index.js +5 -2
  222. package/time/vue.js +1 -1
  223. package/time-line/index.js +3 -3
  224. package/time-line/vue.js +2 -2
  225. package/time-picker-mobile/index.js +24 -5
  226. package/time-picker-mobile/vue.js +17 -7
  227. package/time-range/index.js +2 -0
  228. package/timeline-item/vue.js +1 -1
  229. package/tooltip/index.js +6 -3
  230. package/tooltip/vue.js +4 -4
  231. package/transfer/index.js +20 -22
  232. package/transfer/vue.js +1 -6
  233. package/transfer-panel/vue.js +3 -5
  234. package/tree/index.js +21 -4
  235. package/tree/vue.js +10 -8
  236. package/tree-menu/index.js +29 -3
  237. package/tree-menu/vue.js +28 -15
  238. package/tree-node/index.js +18 -18
  239. package/tree-node/vue.js +6 -5
  240. package/types/action-sheet.type.d.ts +118 -1
  241. package/types/amount.type.d.ts +168 -1
  242. package/types/area.type.d.ts +134 -1
  243. package/types/async-flowchart.type.d.ts +72 -0
  244. package/types/autocomplete.type.d.ts +199 -1
  245. package/types/badge.type.d.ts +3 -1
  246. package/types/breadcrumb-item.type.d.ts +2 -0
  247. package/types/breadcrumb.type.d.ts +2 -0
  248. package/types/button-group.type.d.ts +3 -3
  249. package/types/button.type.d.ts +4 -0
  250. package/types/cascader-menu.type.d.ts +3 -4
  251. package/types/cascader-node.type.d.ts +5 -2
  252. package/types/cascader-panel.type-2bd03be3.d.ts +241 -0
  253. package/types/cascader-panel.type.d.ts +3 -241
  254. package/types/cascader.type.d.ts +329 -1
  255. package/types/checkbox.type.d.ts +6 -0
  256. package/types/collapse.type.d.ts +19 -2
  257. package/types/date-picker.type.d.ts +38 -1
  258. package/types/dialog-box.type.d.ts +13 -3
  259. package/types/drawer.type.d.ts +133 -1
  260. package/types/{dropdown-item.type-8ea6c633.d.ts → dropdown-item.type-8475a549.d.ts} +7 -13
  261. package/types/dropdown-item.type.d.ts +1 -1
  262. package/types/dropdown-menu.type.d.ts +1 -1
  263. package/types/dropdown.type.d.ts +1 -5
  264. package/types/fall-menu.type.d.ts +94 -1
  265. package/types/file-upload.type.d.ts +1 -1
  266. package/types/float-button.type.d.ts +123 -0
  267. package/types/form-item.type.d.ts +1 -1
  268. package/types/{form.type-d0fd42f3.d.ts → form.type-a2dc0099.d.ts} +4 -1
  269. package/types/form.type.d.ts +1 -1
  270. package/types/{index-e0250f63.d.ts → index-b012f687.d.ts} +9 -0
  271. package/types/input.type.d.ts +2 -6
  272. package/types/ip-address.type.d.ts +160 -1
  273. package/types/link.type.d.ts +6 -3
  274. package/types/loading.type.d.ts +7 -0
  275. package/types/mind-map.type.d.ts +20 -0
  276. package/types/modal.type.d.ts +29 -2
  277. package/types/numeric.type.d.ts +41 -10
  278. package/types/pager.type.d.ts +12 -0
  279. package/types/picker.type.d.ts +18 -0
  280. package/types/popconfirm.type.d.ts +86 -1
  281. package/types/popeditor.type.d.ts +4 -0
  282. package/types/popover.type.d.ts +3 -3
  283. package/types/progress.type.d.ts +2 -0
  284. package/types/radio.type.d.ts +0 -4
  285. package/types/rate.type.d.ts +236 -1
  286. package/types/search.type.d.ts +88 -1
  287. package/types/shared.type.d.ts +1 -1
  288. package/types/skeleton-item.type.d.ts +38 -0
  289. package/types/skeleton.type.d.ts +45 -0
  290. package/types/slider.type.d.ts +49 -10
  291. package/types/steps.type.d.ts +14 -3
  292. package/types/tab-bar.type.d.ts +1 -1
  293. package/types/tab-nav.type.d.ts +7 -2
  294. package/types/tabs.type.d.ts +9 -1
  295. package/types/tag-group.type.d.ts +64 -1
  296. package/types/{time-line.type-d7daa669.d.ts → time-line.type-b155cb4f.d.ts} +12 -0
  297. package/types/time-line.type.d.ts +1 -1
  298. package/types/timeline-item.type.d.ts +1 -1
  299. package/types/tooltip.type.d.ts +2 -2
  300. package/types/transfer.type.d.ts +185 -1
  301. package/types/tree-menu.type.d.ts +210 -1
  302. package/types/upload-dragger.type.d.ts +1 -1
  303. package/types/{upload-list.type-343e8c11.d.ts → upload-list.type-6d6e3d0e.d.ts} +35 -8
  304. package/types/upload-list.type.d.ts +1 -1
  305. package/types/upload.type.d.ts +1 -1
  306. package/types/user-head.type.d.ts +146 -1
  307. package/types/wizard.type.d.ts +1 -0
  308. package/upload/index.js +64 -34
  309. package/upload/vue.js +9 -5
  310. package/upload-dragger/index.js +22 -20
  311. package/upload-list/index.js +24 -18
  312. package/upload-list/vue.js +9 -4
  313. package/user/index.js +35 -26
  314. package/user/vue.js +1 -1
  315. package/user-head/index.js +3 -3
  316. package/watermark/index.js +11 -0
  317. package/wheel/index.js +3 -0
  318. package/wizard/vue.js +4 -2
  319. package/common/deps/modal-queue.js +0 -6
  320. package/common/deps/requestAnimationFrame.js +0 -25
package/tree/index.js CHANGED
@@ -193,7 +193,7 @@ const afterLoadHandler = ({ state, emit, props, api }) => (params) => {
193
193
  }
194
194
  };
195
195
  const initTreeStore = ({ api, props, state, emit }) => () => {
196
- const { nodeKey, data, lazy, load, afterLoad, currentNodeKey, checkStrictly, checkDescendants } = props;
196
+ const { nodeKey, data, lazy, load, currentNodeKey, checkStrictly, checkDescendants } = props;
197
197
  const { defaultCheckedKeys, defaultExpandedKeys, autoExpandParent, defaultExpandAll, filterNodeMethod } = props;
198
198
  state.store = new TreeStore({
199
199
  key: nodeKey,
@@ -213,7 +213,9 @@ const initTreeStore = ({ api, props, state, emit }) => () => {
213
213
  });
214
214
  state.root = state.store.root;
215
215
  api.initIsCurrent();
216
- api.initPlainNodeStore();
216
+ if (props.willChangeView) {
217
+ api.initPlainNodeStore();
218
+ }
217
219
  };
218
220
  const created = ({ api, state }) => () => {
219
221
  state.isTree = true;
@@ -533,6 +535,10 @@ const saveNode = ({ state, emit, api }) => () => {
533
535
  };
534
536
  const addNode = ({ api }) => (node) => {
535
537
  const newNode = { label: "" };
538
+ const isLeafField = node.store && node.store.props.isLeaf;
539
+ if (isLeafField) {
540
+ newNode[isLeafField] = true;
541
+ }
536
542
  Object.defineProperty(newNode, "_isNewNode", {
537
543
  value: true,
538
544
  enumerable: false,
@@ -573,13 +579,22 @@ const deleteAction = ({ state, api, emit }) => () => {
573
579
  emit("delete-node", node);
574
580
  api.remove(state.action.node, isSaveChildNode, true);
575
581
  };
576
- const deleteConfirm = ({ state }) => (event2, node) => {
582
+ const deleteConfirm = ({ state, props, api }) => (event2, node) => {
577
583
  state.action.type = "delete";
578
584
  state.action.node = node;
579
585
  state.action.isLeaf = !node.childNodes || !node.childNodes.length;
580
586
  state.action.referenceElm = event2.currentTarget;
581
587
  state.action.popoverVisible = false;
582
588
  state.action.isSaveChildNode = false;
589
+ if (typeof props.deleteNodeMethod === "function") {
590
+ const promise = props.deleteNodeMethod({ event: event2, node });
591
+ if (promise && typeof promise.then === "function") {
592
+ promise.then((bool) => bool && api.deleteAction());
593
+ } else if (promise) {
594
+ api.deleteAction();
595
+ }
596
+ return;
597
+ }
583
598
  setTimeout(() => {
584
599
  state.action.popoverVisible = true;
585
600
  }, 300);
@@ -650,7 +665,9 @@ const initPlainNodeStore = ({ props, state }) => () => {
650
665
  state.plainNodeStore = plainNodeStore;
651
666
  };
652
667
  const handleCheckPlainNode = ({ props, emit }) => (e, plainNode) => {
653
- plainNode.node.setChecked(e, !props.checkStrictly);
668
+ if (props.showCheckbox) {
669
+ plainNode.node.setChecked(e, !props.checkStrictly);
670
+ }
654
671
  emit("check-plain", plainNode, e);
655
672
  };
656
673
  const handleClickPlainNode = (emit) => (e, plainNode) => {
package/tree/vue.js CHANGED
@@ -119,7 +119,7 @@ const api = [
119
119
  ];
120
120
  const initState = ({ reactive, emitter, props, computed, api: api2 }) => {
121
121
  const state = reactive({
122
- loaded: false,
122
+ loaded: !props.lazy,
123
123
  checkEasily: false,
124
124
  root: null,
125
125
  store: null,
@@ -164,7 +164,7 @@ const initState = ({ reactive, emitter, props, computed, api: api2 }) => {
164
164
  });
165
165
  return state;
166
166
  };
167
- const initApi = ({ state, dispatch, broadcast, props, vm, constants, t, emit, refs }) => ({
167
+ const initApi = ({ state, dispatch, broadcast, props, vm, constants, t, emit }) => ({
168
168
  state,
169
169
  dispatch,
170
170
  broadcast,
@@ -208,11 +208,11 @@ const initApi = ({ state, dispatch, broadcast, props, vm, constants, t, emit, re
208
208
  initIsCurrent: debounce(20, initIsCurrent({ props, state })),
209
209
  setCheckedByNodeKey: setCheckedByNodeKey({ props, state })
210
210
  });
211
- const initWatcher = ({ watch, props, api: api2, state }) => {
211
+ const initWatcher = ({ watch, props, api: api2, state, isVue2 }) => {
212
212
  watch(() => props.defaultCheckedKeys, api2.watchDefaultCheckedKeys);
213
213
  watch(() => props.defaultExpandedKeys, api2.watchDefaultExpandedKeys);
214
214
  watch(() => props.defaultExpandedKeysHighlight, api2.initIsCurrent);
215
- watch(() => props.data, api2.watchData, { deep: true });
215
+ watch(() => props.data, api2.watchData, { deep: !isVue2 });
216
216
  watch(() => props.checkboxItems, api2.watchCheckboxItems);
217
217
  watch(() => props.checkStrictly, api2.watchCheckStrictly);
218
218
  watch(() => props.defaultCheckedKeys, api2.setCurrentRadio, { immediate: true });
@@ -231,9 +231,11 @@ const initWatcher = ({ watch, props, api: api2, state }) => {
231
231
  (value) => state.action.addDisabled = value || [],
232
232
  { immediate: true }
233
233
  );
234
- watch(() => state.root, api2.initPlainNodeStore, { deep: true });
234
+ if (props.willChangeView) {
235
+ watch(() => state.root, api2.initPlainNodeStore, { deep: true });
236
+ }
235
237
  };
236
- const renderless = (props, { computed, onMounted, onUpdated, reactive, watch, provide, onBeforeUnmount }, { vm, t, emit, constants, broadcast, dispatch, service, emitter, nextTick }) => {
238
+ const renderless = (props, { computed, onMounted, onUpdated, reactive, watch, provide, onBeforeUnmount }, { vm, t, emit, constants, broadcast, dispatch, service, emitter, nextTick }, { isVue2 }) => {
237
239
  const api2 = {};
238
240
  const state = initState({ reactive, emitter, props, computed, api: api2 });
239
241
  provide("parentEmitter", state.emitter);
@@ -247,7 +249,7 @@ const renderless = (props, { computed, onMounted, onUpdated, reactive, watch, pr
247
249
  wrapMounted: wrapMounted({ api: api2, props, service }),
248
250
  initTreeStore: initTreeStore({ api: api2, props, state, emit }),
249
251
  deleteAction: deleteAction({ state, api: api2, emit }),
250
- deleteConfirm: deleteConfirm({ state }),
252
+ deleteConfirm: deleteConfirm({ state, props, api: api2 }),
251
253
  getSameDataIndex,
252
254
  loopGetTreeData,
253
255
  cancelDelete: cancelDelete({ state }),
@@ -267,7 +269,7 @@ const renderless = (props, { computed, onMounted, onUpdated, reactive, watch, pr
267
269
  handleClickPlainNode: handleClickPlainNode(emit)
268
270
  });
269
271
  api2.created();
270
- initWatcher({ watch, props, api: api2, state });
272
+ initWatcher({ watch, props, api: api2, state, isVue2 });
271
273
  onMounted(api2.wrapMounted);
272
274
  onUpdated(api2.updated);
273
275
  onBeforeUnmount(api2.beforeUnmount);
@@ -38,11 +38,13 @@ const setMenuKey = (api) => ({ newData, menuData }) => {
38
38
  });
39
39
  return newData;
40
40
  };
41
- const filterNode = () => (value, data) => {
41
+ const filterNode = (props) => (value, data) => {
42
+ var _a;
42
43
  if (!value) {
43
44
  return true;
44
45
  }
45
- return data.label.includes(value);
46
+ const propsLabel = ((_a = props.props) == null ? void 0 : _a.label) || "label";
47
+ return data[propsLabel].includes(value);
46
48
  };
47
49
  const watchFilterText = ({ vm }) => (value) => {
48
50
  vm.$refs.tree.filter(value);
@@ -68,8 +70,11 @@ const nodeExpand = (emit) => (nodeData, node) => {
68
70
  const nodeCollapse = (emit) => (nodeData, node) => {
69
71
  emit("node-collapse", nodeData, node);
70
72
  };
71
- const nodeClick = (emit) => (nodeData, node) => {
73
+ const nodeClick = ({ emit, props, state }) => (nodeData, node) => {
72
74
  emit("node-click", nodeData, node);
75
+ if (props.showExpand && state.isExpand) {
76
+ state.isExpand = false;
77
+ }
73
78
  };
74
79
  const checkChange = (emit) => (data, checked, indeterminate) => {
75
80
  emit("check-change", data, checked, indeterminate);
@@ -109,17 +114,38 @@ const setCurrentNode = ({ vm }) => (key) => {
109
114
  const getCurrentNode = ({ vm }) => () => {
110
115
  return vm.$refs.tree.getCurrentNode();
111
116
  };
117
+ const handleToggleMenu = ({ state, vm }) => (type) => {
118
+ state.isExpand = !state.isExpand;
119
+ if (type === "expand") {
120
+ state.currentKey = state.nodeKey !== null ? [state.nodeKey] : [];
121
+ } else {
122
+ state.nodeKey = vm.$refs.tree.getCurrentKey();
123
+ vm.$refs.tree.expandAllNodes(false);
124
+ }
125
+ };
126
+ const computedTreeStyle = ({ props }) => () => {
127
+ let minusHeight = 0;
128
+ if (props.showExpand) {
129
+ minusHeight += 64;
130
+ }
131
+ if (props.showFilter) {
132
+ minusHeight += 42;
133
+ }
134
+ return { "height": `calc(100% - ${minusHeight}px)` };
135
+ };
112
136
  export {
113
137
  check,
114
138
  checkChange,
115
139
  collapseChange,
116
140
  collapseMenu,
141
+ computedTreeStyle,
117
142
  currentChange,
118
143
  expandMenu,
119
144
  filterNode,
120
145
  getCurrentKey,
121
146
  getCurrentNode,
122
147
  getTitle,
148
+ handleToggleMenu,
123
149
  initData,
124
150
  nodeClick,
125
151
  nodeCollapse,
package/tree-menu/vue.js CHANGED
@@ -22,7 +22,9 @@ import {
22
22
  setCurrentKey,
23
23
  getCurrentKey,
24
24
  setCurrentNode,
25
- getCurrentNode
25
+ getCurrentNode,
26
+ handleToggleMenu,
27
+ computedTreeStyle
26
28
  } from "./index";
27
29
  const api = [
28
30
  "state",
@@ -48,23 +50,32 @@ const api = [
48
50
  "setCurrentKey",
49
51
  "getCurrentKey",
50
52
  "setCurrentNode",
51
- "getCurrentNode"
53
+ "getCurrentNode",
54
+ "handleToggleMenu"
52
55
  ];
53
- const renderless = (props, { watch, reactive, onMounted }, { t, service, emit, vm }) => {
56
+ const renderless = (props, { computed, watch, reactive, onMounted }, { t, service, emit, vm }) => {
54
57
  service = service || { base: {} };
55
58
  service = { getMenuDataSync: props.getMenuDataSync || service.base.getMenuDataSync };
59
+ const api2 = {};
56
60
  const state = reactive({
57
61
  data: [],
58
62
  filterText: "",
59
- isCollapsed: false
63
+ isExpand: false,
64
+ isCollapsed: false,
65
+ nodeKey: null,
66
+ currentKey: [],
67
+ treeStyle: computed(() => api2.computedTreeStyle()),
68
+ defaultExpandedKeys: computed(
69
+ () => props.defaultExpandedKeys && props.defaultExpandedKeys.length ? props.defaultExpandedKeys : state.currentKey
70
+ )
60
71
  });
61
- Object.assign(api, {
72
+ Object.assign(api2, {
62
73
  t,
63
74
  state,
64
75
  check: check(emit),
65
- filterNode: filterNode(),
76
+ filterNode: filterNode(props),
66
77
  nodeDrop: nodeDrop(emit),
67
- nodeClick: nodeClick(emit),
78
+ nodeClick: nodeClick({ emit, props, state }),
68
79
  nodeExpand: nodeExpand(emit),
69
80
  nodeDragEnd: nodeDragEnd(emit),
70
81
  checkChange: checkChange(emit),
@@ -75,24 +86,26 @@ const renderless = (props, { watch, reactive, onMounted }, { t, service, emit, v
75
86
  currentChange: currentChange(emit),
76
87
  watchFilterText: watchFilterText({ vm }),
77
88
  getTitle: getTitle(props),
78
- setMenuKey: setMenuKey(api),
79
- initData: initData({ state, props, service, api }),
89
+ setMenuKey: setMenuKey(api2),
90
+ initData: initData({ state, props, service, api: api2 }),
80
91
  collapseChange: collapseChange({ state, props, emit }),
81
- collapseMenu: collapseMenu({ state, props, api }),
82
- expandMenu: expandMenu({ state, props, api }),
92
+ collapseMenu: collapseMenu({ state, props, api: api2 }),
93
+ expandMenu: expandMenu({ state, props, api: api2 }),
83
94
  setCurrentKey: setCurrentKey({ vm }),
84
95
  getCurrentKey: getCurrentKey({ vm }),
85
96
  setCurrentNode: setCurrentNode({ vm }),
86
- getCurrentNode: getCurrentNode({ vm })
97
+ getCurrentNode: getCurrentNode({ vm }),
98
+ handleToggleMenu: handleToggleMenu({ state, vm }),
99
+ computedTreeStyle: computedTreeStyle({ props })
87
100
  });
88
101
  watch(
89
102
  () => props.data,
90
103
  (value) => state.data = value,
91
104
  { immediate: true }
92
105
  );
93
- watch(() => state.filterText, api.watchFilterText, { deep: true });
94
- onMounted(api.initData);
95
- return api;
106
+ watch(() => state.filterText, api2.watchFilterText, { deep: true });
107
+ onMounted(api2.initData);
108
+ return api2;
96
109
  };
97
110
  export {
98
111
  api,
@@ -47,7 +47,7 @@ const handleSelectChange = ({ props, state }) => (checked, indeterminate) => {
47
47
  state.oldChecked = checked;
48
48
  state.indeterminate = indeterminate;
49
49
  };
50
- const handleClick = ({ api, vm, props, state }) => (e) => {
50
+ const handleClick = ({ api, vm, props, state }) => (e, trigger) => {
51
51
  const store = state.tree.state.store;
52
52
  state.tree.clearCurrentStore(props.node);
53
53
  if (!state.tree.onlyCheckChildren) {
@@ -58,7 +58,7 @@ const handleClick = ({ api, vm, props, state }) => (e) => {
58
58
  state.tree.$emit("current-change", store.currentNode ? store.currentNode.data : null, store.currentNode);
59
59
  }
60
60
  state.tree.currentNode = vm;
61
- if (state.tree.checkOnClickNode && !props.node.disabled) {
61
+ if (state.tree.checkOnClickNode && !props.node.disabled && trigger !== "checkbox") {
62
62
  e.target.checked = !props.node.checked;
63
63
  api.handleCheckChange(null, e);
64
64
  }
@@ -68,18 +68,15 @@ const handleClick = ({ api, vm, props, state }) => (e) => {
68
68
  state.tree.$emit("node-click", props.node.data, props.node, vm);
69
69
  return;
70
70
  }
71
+ api.handleExpandClick(false);
71
72
  } else {
72
73
  if (!state.tree.collapsible || !state.tree.expandOnClickNode) {
73
74
  !props.node.disabled && state.tree.$emit("node-click", props.node.data, props.node, vm);
74
75
  return;
75
76
  }
76
- }
77
- if (!state.tree.onlyCheckChildren) {
78
77
  if (state.tree.expandOnClickNode && isCheck) {
79
78
  api.handleExpandClick(isCheck);
80
79
  }
81
- } else {
82
- api.handleExpandClick(false);
83
80
  }
84
81
  };
85
82
  const closeMenu = (state) => () => {
@@ -202,10 +199,12 @@ const onSiblingToggleExpand = ({ state, props }) => ({ isExpand, sibling }) => {
202
199
  }
203
200
  };
204
201
  const watchExpandedChange = ({ state, props }) => () => {
205
- state.parentEmitter.emit("sibling-node-toggle-expand", {
206
- isExpand: props.node.expanded,
207
- sibling: props.node
208
- });
202
+ if (state.tree.accordion) {
203
+ state.parentEmitter.emit("sibling-node-toggle-expand", {
204
+ isExpand: props.node.expanded,
205
+ sibling: props.node
206
+ });
207
+ }
209
208
  };
210
209
  const openEdit = ({ state, vm }) => (node) => {
211
210
  state.tree.state.emitter.emit("tree-node-edit", node);
@@ -229,16 +228,17 @@ const addNode = ({ state, props, api }) => (event, node) => {
229
228
  api.openEdit();
230
229
  state.tree.state.emitter.emit("tree-node-add", event, node);
231
230
  };
232
- const computedExpandIcon = ({ designConfig }) => ({ showLine }, { tree, expanded, isSaaSTheme }) => {
233
- if (tree.icon) {
234
- return tree.icon;
231
+ const computedExpandIcon = ({ designConfig }) => (treeRoot, state) => {
232
+ var _a, _b;
233
+ if (state.tree.icon) {
234
+ return state.tree.icon;
235
235
  }
236
- if (showLine) {
237
- const expandIcon = (designConfig == null ? void 0 : designConfig.icons.expanded) || "icon-minus-square";
238
- const collapseIcon = (designConfig == null ? void 0 : designConfig.icons.collapse) || "icon-plus-square";
239
- return expanded ? expandIcon : collapseIcon;
236
+ if (treeRoot.showLine) {
237
+ const expandIcon = ((_a = designConfig == null ? void 0 : designConfig.icons) == null ? void 0 : _a.expanded) || "icon-minus-square";
238
+ const collapseIcon = ((_b = designConfig == null ? void 0 : designConfig.icons) == null ? void 0 : _b.collapse) || "icon-plus-square";
239
+ return state.expanded ? expandIcon : collapseIcon;
240
240
  }
241
- return isSaaSTheme ? "icon-arrow-bottom" : "icon-chevron-right";
241
+ return "icon-chevron-right";
242
242
  };
243
243
  const computedIndent = () => ({ node, showLine }, { tree }) => {
244
244
  return (node.level > 1 ? 1 : 0) * (parseInt(tree.indent) + (showLine ? 8 : 0)) + parseInt(tree.baseIndent) + "px";
package/tree-node/vue.js CHANGED
@@ -70,7 +70,7 @@ const initState = ({ reactive, treeRoot, props, emitter, $parentEmitter, vm, api
70
70
  });
71
71
  return state;
72
72
  };
73
- const initApi = ({ api: api2, state, dispatch, broadcast, vm, props, parent, treeRoot, nextTick, emit, designConfig }) => {
73
+ const initApi = ({ api: api2, state, dispatch, broadcast, vm, props, treeRoot, nextTick, emit, designConfig }) => {
74
74
  Object.assign(api2, {
75
75
  state,
76
76
  dispatch,
@@ -109,15 +109,16 @@ const initWatcher = ({ watch, state, api: api2, props }) => {
109
109
  watch(() => props.node.checked, api2.watchChecked, { deep: true });
110
110
  watch(() => props.node.expanded, api2.watchExpanded, { deep: true });
111
111
  };
112
- const renderless = (props, { reactive, watch, inject, provide, computed }, { parent: parentVm, vm, nextTick, emit, broadcast, dispatch, emitter, designConfig }, { isVue2 }) => {
112
+ const renderless = (props, { reactive, watch, inject, provide, computed }, { vm, nextTick, emit, broadcast, dispatch, emitter, designConfig }, { isVue2 }) => {
113
113
  const api2 = {};
114
- const parent = inject("parentTree") || parentVm;
115
114
  const treeRoot = inject("TreeRoot");
116
115
  const $parentEmitter = inject("parentEmitter");
117
116
  const state = initState({ reactive, treeRoot, props, emitter, $parentEmitter, vm, api: api2, computed });
118
- state.parentEmitter.on("sibling-node-toggle-expand", (event) => api2.onSiblingToggleExpand(event));
117
+ if (state.tree.accordion) {
118
+ state.parentEmitter.on("sibling-node-toggle-expand", (event) => api2.onSiblingToggleExpand(event));
119
+ }
119
120
  provide("parentEmitter", state.emitter);
120
- initApi({ api: api2, state, dispatch, broadcast, vm, props, parent, treeRoot, nextTick, emit, designConfig });
121
+ initApi({ api: api2, state, dispatch, broadcast, vm, props, treeRoot, nextTick, emit, designConfig });
121
122
  initWatcher({ watch, state, api: api2, props });
122
123
  api2.created((childrenKey) => {
123
124
  watch(
@@ -1,2 +1,119 @@
1
+ import { CSSProperties, ExtractPropTypes } from 'vue';
2
+ import { ISharedRenderlessParamUtils } from './shared.type.js';
1
3
 
2
- export { }
4
+ declare const actionSheetProps: {
5
+ menus: {
6
+ type: ArrayConstructor;
7
+ default: () => never[];
8
+ };
9
+ modelValue: (StringConstructor | ArrayConstructor | NumberConstructor)[];
10
+ beforeClose: FunctionConstructor;
11
+ visible: {
12
+ type: BooleanConstructor;
13
+ default: boolean;
14
+ };
15
+ ellipsis: {
16
+ type: BooleanConstructor;
17
+ default: boolean;
18
+ };
19
+ height: {
20
+ type: StringConstructor;
21
+ default: string;
22
+ };
23
+ valueField: {
24
+ type: StringConstructor;
25
+ default: string;
26
+ };
27
+ textField: {
28
+ type: StringConstructor;
29
+ default: string;
30
+ };
31
+ title: StringConstructor;
32
+ showHeader: {
33
+ type: BooleanConstructor;
34
+ default: boolean;
35
+ };
36
+ showFooter: {
37
+ type: BooleanConstructor;
38
+ default: boolean;
39
+ };
40
+ showClose: {
41
+ type: BooleanConstructor;
42
+ default: () => boolean;
43
+ };
44
+ fullscreen: {
45
+ type: BooleanConstructor;
46
+ default: () => boolean;
47
+ };
48
+ customClass: (StringConstructor | ObjectConstructor | ArrayConstructor)[];
49
+ contentClass: StringConstructor;
50
+ type: {
51
+ type: StringConstructor;
52
+ default: string;
53
+ };
54
+ mask: {
55
+ type: BooleanConstructor;
56
+ default: boolean;
57
+ };
58
+ maskClosable: {
59
+ type: BooleanConstructor;
60
+ default: boolean;
61
+ };
62
+ lockScroll: {
63
+ type: BooleanConstructor;
64
+ default: boolean;
65
+ };
66
+ flex: {
67
+ type: BooleanConstructor;
68
+ default: boolean;
69
+ };
70
+ contentPosition: {
71
+ type: BooleanConstructor;
72
+ default: boolean;
73
+ };
74
+ contentStyle: {
75
+ type: ObjectConstructor;
76
+ default: () => {};
77
+ };
78
+ tiny_mode: StringConstructor;
79
+ tiny_mode_root: BooleanConstructor;
80
+ tiny_template: (FunctionConstructor | ObjectConstructor)[];
81
+ tiny_renderless: FunctionConstructor;
82
+ tiny_theme: StringConstructor;
83
+ tiny_chart_theme: ObjectConstructor;
84
+ };
85
+
86
+ interface IActionSheetState {
87
+ toggle: boolean;
88
+ sheetMaskStyle: CSSProperties;
89
+ sheetContentStyle: CSSProperties;
90
+ scroll: null | object;
91
+ }
92
+ type IActionSheetProps = ExtractPropTypes<typeof actionSheetProps>;
93
+ type IActionSheetRenderlessParamUtils = ISharedRenderlessParamUtils<null>;
94
+ interface IActionSheetApi {
95
+ state: IActionSheetState;
96
+ setSheetStyle: ({ state, props }: {
97
+ state: IActionSheetState;
98
+ props: IActionSheetProps;
99
+ }) => void;
100
+ initScrollMenu: ({ state, nextTick, refs, BScroll }: {
101
+ state: IActionSheetState;
102
+ nextTick: IActionSheetRenderlessParamUtils['nextTick'];
103
+ refs: IActionSheetRenderlessParamUtils['refs'];
104
+ BScroll: object;
105
+ }) => void;
106
+ visibleHandle: ({ emit, state }: {
107
+ emit: IActionSheetRenderlessParamUtils['emit'];
108
+ state: IActionSheetState;
109
+ }) => void;
110
+ watchVisible: (value: boolean) => void;
111
+ menuHandle: (item: any) => void;
112
+ confirm: () => void;
113
+ selectOption: (option: any) => void;
114
+ actionSelectOption: (option: any, index: any) => void;
115
+ close: () => void;
116
+ hide: () => void;
117
+ }
118
+
119
+ export { IActionSheetApi, IActionSheetProps, IActionSheetRenderlessParamUtils, IActionSheetState };
@@ -1,2 +1,169 @@
1
+ import { ComputedRef, ExtractPropTypes } from 'vue';
2
+ import { ISharedRenderlessParamUtils } from './shared.type.js';
1
3
 
2
- export { }
4
+ declare const amountProps: {
5
+ _constants: {
6
+ type: ObjectConstructor;
7
+ default: () => {
8
+ FILTER_OPTION: string[];
9
+ };
10
+ };
11
+ modelValue: {
12
+ type: (StringConstructor | NumberConstructor)[];
13
+ };
14
+ tabindex: {
15
+ type: StringConstructor;
16
+ default: string;
17
+ };
18
+ size: StringConstructor;
19
+ placeholder: {
20
+ type: StringConstructor;
21
+ default: string;
22
+ };
23
+ currency: {
24
+ type: StringConstructor;
25
+ default: string;
26
+ };
27
+ date: (StringConstructor | DateConstructor)[];
28
+ dateAllowEmpty: {
29
+ type: BooleanConstructor;
30
+ default: boolean;
31
+ };
32
+ digits: {
33
+ type: NumberConstructor;
34
+ default: number;
35
+ };
36
+ stringMode: {
37
+ type: BooleanConstructor;
38
+ default: boolean;
39
+ };
40
+ rounding: {
41
+ type: BooleanConstructor;
42
+ default: boolean;
43
+ };
44
+ maxLen: {
45
+ type: NumberConstructor;
46
+ default: number;
47
+ };
48
+ negative: {
49
+ type: BooleanConstructor;
50
+ default: boolean;
51
+ };
52
+ disabled: {
53
+ type: BooleanConstructor;
54
+ default: boolean;
55
+ };
56
+ fetchCurrency: FunctionConstructor;
57
+ fields: ObjectConstructor;
58
+ popperClass: StringConstructor;
59
+ popperAppendToBody: {
60
+ type: BooleanConstructor;
61
+ default: boolean;
62
+ };
63
+ format: ObjectConstructor;
64
+ type: {
65
+ type: StringConstructor;
66
+ default: string;
67
+ };
68
+ holdZero: {
69
+ type: BooleanConstructor;
70
+ default: boolean;
71
+ };
72
+ modelTruncation: {
73
+ type: BooleanConstructor;
74
+ default: boolean;
75
+ };
76
+ strictInput: {
77
+ type: BooleanConstructor;
78
+ default: boolean;
79
+ };
80
+ plugin: FunctionConstructor;
81
+ popUp: {
82
+ type: BooleanConstructor;
83
+ default: boolean;
84
+ };
85
+ hideCurrency: {
86
+ type: BooleanConstructor;
87
+ default: boolean;
88
+ };
89
+ displayOnly: {
90
+ type: BooleanConstructor;
91
+ default: boolean;
92
+ };
93
+ hideIcon: {
94
+ type: BooleanConstructor;
95
+ default: boolean;
96
+ };
97
+ numAllowEmpty: {
98
+ type: BooleanConstructor;
99
+ default: boolean;
100
+ };
101
+ label: {
102
+ type: StringConstructor;
103
+ default: string;
104
+ };
105
+ tip: StringConstructor;
106
+ shape: StringConstructor;
107
+ clearable: {
108
+ type: BooleanConstructor;
109
+ default: boolean;
110
+ };
111
+ filter: {
112
+ type: BooleanConstructor;
113
+ default: boolean;
114
+ };
115
+ blank: {
116
+ type: BooleanConstructor;
117
+ default: boolean;
118
+ };
119
+ tiny_mode: StringConstructor;
120
+ tiny_mode_root: BooleanConstructor;
121
+ tiny_template: (FunctionConstructor | ObjectConstructor)[];
122
+ tiny_renderless: FunctionConstructor;
123
+ tiny_theme: StringConstructor;
124
+ tiny_chart_theme: ObjectConstructor;
125
+ };
126
+
127
+ interface IAmountState {
128
+ visible: boolean;
129
+ amount: string;
130
+ currency: string;
131
+ date: string | Date | undefined;
132
+ overMaxLen: boolean;
133
+ isFocus: boolean;
134
+ lock: boolean;
135
+ amountText: string;
136
+ lastInput: string | number | undefined;
137
+ lastCurrency: number;
138
+ lastDate: string | Date | undefined;
139
+ format: ComputedRef<object>;
140
+ }
141
+ type IAmountEditorState = Pick<IAmountState, 'amount' | 'date' | 'currency' | 'lastInput'>;
142
+ type IAmountProps = ExtractPropTypes<typeof amountProps>;
143
+ type IAmountRenderlessParamUtils = ISharedRenderlessParamUtils<null>;
144
+ interface IAmountApi {
145
+ state: IAmountState;
146
+ t: ISharedRenderlessParamUtils['t'];
147
+ editorState: IAmountEditorState;
148
+ getDecimal: (value: any) => any;
149
+ innerFormat: (value: any) => any;
150
+ getAmountText: (value: any) => any;
151
+ initAmount: () => any;
152
+ onInputPreprocess: (value: any) => any;
153
+ onInput: (value: any) => any;
154
+ initText: () => void;
155
+ inputFocus: () => void;
156
+ inputBlur: () => void;
157
+ closePopper: () => void;
158
+ emitChange: () => void;
159
+ popInput: (value: any) => void;
160
+ save: () => void;
161
+ reset: () => void;
162
+ handelClick: (e: any) => void;
163
+ addOutSideEvent: (visible: any) => void;
164
+ watchModelValue: () => void;
165
+ watchCurrency: (value: any) => void;
166
+ toggleVisible: () => void;
167
+ }
168
+
169
+ export { IAmountApi, IAmountEditorState, IAmountProps, IAmountRenderlessParamUtils, IAmountState };