@opentiny/vue-renderless 3.21.1 → 3.22.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 (323) hide show
  1. package/amount/index.js +4 -4
  2. package/anchor/index.js +1 -1
  3. package/async-flowchart/index.js +1 -1
  4. package/autocomplete/index.js +1 -1
  5. package/autocomplete/vue.js +3 -3
  6. package/base-select/index.js +19 -19
  7. package/base-select/vue.js +2 -2
  8. package/calendar/index.js +2 -2
  9. package/calendar-bar/index.js +2 -2
  10. package/calendar-bar/vue.js +1 -1
  11. package/calendar-view/index.js +66 -22
  12. package/calendar-view/vue.js +2 -3
  13. package/card/index.js +1 -1
  14. package/card-template/index.js +1 -1
  15. package/carousel/index.js +4 -4
  16. package/carousel/vue.js +1 -1
  17. package/cascader/index.js +21 -11
  18. package/cascader/vue.js +6 -5
  19. package/cascader-menu/vue.js +2 -2
  20. package/cascader-mobile/index.js +1 -1
  21. package/cascader-panel/index.js +4 -4
  22. package/cascader-panel/node.js +3 -4
  23. package/cascader-panel/vue.js +1 -1
  24. package/cascader-select/column-index.js +2 -2
  25. package/cascader-view/index.js +1 -1
  26. package/chart-bar/index.js +1 -1
  27. package/chart-candle/index.js +1 -1
  28. package/chart-core/deps/utils.js +6 -6
  29. package/chart-core/index.js +1 -1
  30. package/chart-funnel/index.js +1 -1
  31. package/chart-gauge/index.js +1 -1
  32. package/chart-line/index.js +1 -1
  33. package/chart-map/index.js +1 -1
  34. package/chart-pie/index.js +1 -1
  35. package/chart-radar/index.js +1 -1
  36. package/chart-sankey/index.js +1 -1
  37. package/chart-scatter/index.js +1 -1
  38. package/chart-waterfall/index.js +1 -1
  39. package/chart-wordcloud/index.js +1 -1
  40. package/checkbox/index.js +1 -1
  41. package/collapse-item/vue.js +1 -1
  42. package/column-list-item/index.js +1 -1
  43. package/common/deps/dom.js +20 -196
  44. package/common/deps/infinite-scroll.js +4 -43
  45. package/common/deps/popup-manager.js +1 -200
  46. package/container/index.js +2 -2
  47. package/crop/index.js +3 -3
  48. package/currency/index.js +2 -2
  49. package/date-panel/index.js +75 -25
  50. package/date-panel/vue.js +53 -21
  51. package/date-picker/vue.js +1 -1
  52. package/date-picker-mobile/index.js +1 -1
  53. package/date-range/index.js +71 -37
  54. package/date-range/vue.js +27 -23
  55. package/date-table/index.js +8 -5
  56. package/date-table/vue.js +1 -1
  57. package/dialog-box/index.js +3 -3
  58. package/dialog-box/vue.js +1 -1
  59. package/dialog-select/vue.js +7 -4
  60. package/drawer/index.js +2 -2
  61. package/drop-times/index.js +1 -1
  62. package/dropdown/index.js +11 -3
  63. package/dropdown/vue.js +2 -2
  64. package/dropdown-item/index.js +1 -1
  65. package/dropdown-item/mf.js +1 -1
  66. package/dropdown-menu/index.js +1 -1
  67. package/espace/vue.js +2 -2
  68. package/fall-menu/index.js +3 -3
  69. package/file-upload/index.js +16 -13
  70. package/file-upload/vue.js +2 -2
  71. package/filter/vue.js +1 -1
  72. package/filter-panel/vue.js +1 -2
  73. package/floating-button/index.js +1 -1
  74. package/flowchart/index.js +3 -3
  75. package/flowchart/vue.js +1 -1
  76. package/fluent-editor/index.js +5 -7
  77. package/fluent-editor/options.js +2 -2
  78. package/form/index.js +20 -2
  79. package/form-item/index.js +6 -6
  80. package/fullscreen/index.js +1 -1
  81. package/fullscreen/vue.js +1 -1
  82. package/grid/plugins/export.js +2 -2
  83. package/grid/plugins/exportExcel.js +3 -3
  84. package/grid/plugins/resize.js +2 -2
  85. package/grid/static/base/helperEqualCompare.js +1 -1
  86. package/grid/static/base/isPlainObject.js +1 -1
  87. package/grid/utils/common.js +2 -2
  88. package/grid/utils/dom.js +16 -8
  89. package/grid/utils/event.js +4 -4
  90. package/hrapprover/index.js +1 -1
  91. package/image/index.js +3 -3
  92. package/image-viewer/index.js +4 -6
  93. package/input/index.js +2 -2
  94. package/input/vue.js +1 -1
  95. package/ip-address/index.js +17 -21
  96. package/ip-address/vue.js +1 -1
  97. package/link-menu/index.js +1 -1
  98. package/link-menu/vue.js +1 -1
  99. package/load-list/index.js +1 -1
  100. package/load-list/vue.js +4 -4
  101. package/loading/index.js +2 -2
  102. package/menu/vue.js +1 -1
  103. package/milestone/index.js +6 -45
  104. package/modal/index.js +5 -5
  105. package/month-range/index.js +45 -5
  106. package/month-range/vue.js +19 -15
  107. package/month-table/index.js +5 -5
  108. package/month-table/vue.js +1 -1
  109. package/nav-menu/index.js +7 -7
  110. package/notify/index.js +3 -3
  111. package/numeric/index.js +5 -5
  112. package/option/index.js +1 -1
  113. package/option/vue.js +2 -1
  114. package/package.json +4 -3
  115. package/pager/index.js +28 -16
  116. package/pager/vue.js +27 -16
  117. package/panel/index.js +1 -1
  118. package/picker/index.js +11 -11
  119. package/picker/vue.js +2 -2
  120. package/picker-column/index.js +1 -1
  121. package/pop-upload/vue.js +1 -1
  122. package/popconfirm/vue.js +1 -1
  123. package/popeditor/index.js +6 -6
  124. package/popeditor/vue.js +2 -2
  125. package/popover/index.js +3 -3
  126. package/popover/vue.js +1 -1
  127. package/popup/index.js +3 -3
  128. package/pull-refresh/index.js +1 -1
  129. package/pull-refresh-mobile-first/index.js +1 -1
  130. package/pull-refresh-mobile-first/vue.js +4 -4
  131. package/quarter-panel/index.js +2 -2
  132. package/quarter-panel/vue.js +1 -1
  133. package/radio-group/index.js +1 -1
  134. package/rate/index.js +1 -1
  135. package/rate/vue.js +1 -1
  136. package/recycle-scroller/index.js +2 -2
  137. package/recycle-scroller/vue.js +1 -1
  138. package/rich-text/index.js +1 -1
  139. package/rich-text/table-module.js +2 -2
  140. package/river/river.js +1 -1
  141. package/river/vue.js +1 -1
  142. package/scrollbar/vue-bar.js +1 -1
  143. package/scrollbar/vue.js +1 -1
  144. package/search/index.js +3 -3
  145. package/select/index.js +26 -22
  146. package/select/vue.js +8 -7
  147. package/select-dropdown/vue.js +5 -5
  148. package/selected-box/index.js +1 -1
  149. package/signature/index.js +1 -1
  150. package/signature/vue.js +2 -2
  151. package/skeleton/index.js +1 -1
  152. package/slider/index.js +4 -4
  153. package/slider-button-group/slide-button.js +2 -2
  154. package/split/index.js +2 -2
  155. package/split/vue.js +1 -1
  156. package/statistic/index.js +1 -1
  157. package/steps/index.js +2 -3
  158. package/steps/slide-bar.js +2 -2
  159. package/sticky/vue.js +4 -4
  160. package/tab-bar/index.js +2 -2
  161. package/tab-item-mf/vue.js +1 -1
  162. package/tab-nav/index.js +4 -4
  163. package/tabbar/index.js +1 -1
  164. package/tabbar/vue.js +1 -1
  165. package/tabbar-item/index.js +1 -1
  166. package/tabs-mf/index.js +5 -5
  167. package/tabs-mf/vue-bar.js +1 -1
  168. package/tabs-mf/vue-swipe.js +1 -1
  169. package/tabs-mf/vue.js +2 -2
  170. package/tabs-mf/wheel.js +3 -3
  171. package/tag-group/vue.js +2 -2
  172. package/tall-storage/index.js +1 -1
  173. package/tall-storage/vue.js +1 -1
  174. package/time/index.js +1 -1
  175. package/time/vue.js +1 -1
  176. package/time-line/index.js +1 -1
  177. package/time-line-new/index.js +1 -1
  178. package/time-panel/index.js +2 -2
  179. package/time-panel/vue.js +1 -1
  180. package/time-range/index.js +1 -1
  181. package/time-range/vue.js +1 -1
  182. package/time-spinner/index.js +4 -4
  183. package/time-spinner/vue.js +1 -1
  184. package/timeline-item/index.js +1 -1
  185. package/toggle-menu/index.js +1 -1
  186. package/tooltip/index.js +2 -2
  187. package/tooltip/vue.js +2 -2
  188. package/top-box/index.js +3 -3
  189. package/transfer/index.js +1 -1
  190. package/transfer-panel/index.js +1 -1
  191. package/tree/index.js +9 -9
  192. package/tree/vue.js +2 -2
  193. package/tree-node/index.js +1 -1
  194. package/tree-node/vue.js +1 -1
  195. package/tree-select/index.js +1 -1
  196. package/types/async-flowchart.type.d.ts +2 -14
  197. package/types/breadcrumb-item.type.d.ts +5 -1
  198. package/types/breadcrumb.type.d.ts +5 -1
  199. package/types/button-group.type.d.ts +5 -1
  200. package/types/button.type.d.ts +1 -1
  201. package/types/cascader.type.d.ts +6 -1
  202. package/types/date-table.type.d.ts +1 -120
  203. package/types/dropdown.type.d.ts +1 -1
  204. package/types/label.type.d.ts +1 -53
  205. package/types/loading.type.d.ts +12 -0
  206. package/types/numeric.type.d.ts +3 -22
  207. package/types/pager.type.d.ts +12 -7
  208. package/types/popconfirm.type.d.ts +2 -0
  209. package/types/steps.type.d.ts +1 -0
  210. package/types/tag-group.type.d.ts +2 -14
  211. package/types/tag.type.d.ts +4 -4
  212. package/types/tooltip.type.d.ts +3 -13
  213. package/types/user-head.type.d.ts +0 -4
  214. package/upload/index.js +1 -1
  215. package/upload-list/index.js +1 -1
  216. package/upload-list/vue.js +4 -4
  217. package/user/index.js +7 -7
  218. package/user/vue.js +15 -2
  219. package/user-contact/vue.js +2 -2
  220. package/virtual-scroll-box/index.js +2 -2
  221. package/wizard/index.js +3 -3
  222. package/year-range/index.js +61 -11
  223. package/year-range/vue.js +33 -20
  224. package/year-table/index.js +7 -5
  225. package/avatar/index.js +0 -30
  226. package/avatar/vue.js +0 -22
  227. package/common/array.js +0 -115
  228. package/common/bigInt.js +0 -315
  229. package/common/browser.js +0 -81
  230. package/common/calendar/calendar.js +0 -97
  231. package/common/dataset/index.js +0 -99
  232. package/common/date.js +0 -354
  233. package/common/decimal.js +0 -155
  234. package/common/deps/ResizeObserver.js +0 -456
  235. package/common/deps/after-leave.js +0 -27
  236. package/common/deps/clickoutside.js +0 -75
  237. package/common/deps/date-util.js +0 -255
  238. package/common/deps/date.js +0 -286
  239. package/common/deps/debounce.js +0 -8
  240. package/common/deps/eSpaceCtrl.js +0 -304
  241. package/common/deps/fastdom/async.js +0 -41
  242. package/common/deps/fastdom/index.js +0 -9
  243. package/common/deps/fastdom/sandbox.js +0 -53
  244. package/common/deps/fastdom/singleton.js +0 -88
  245. package/common/deps/fullscreen/apis.js +0 -143
  246. package/common/deps/fullscreen/screenfull.js +0 -165
  247. package/common/deps/memorize.js +0 -124
  248. package/common/deps/observe-visibility.js +0 -106
  249. package/common/deps/popper.js +0 -613
  250. package/common/deps/repeat-click.js +0 -29
  251. package/common/deps/resize-event.js +0 -39
  252. package/common/deps/scroll-into-view.js +0 -29
  253. package/common/deps/scrollbar-width.js +0 -33
  254. package/common/deps/throttle.js +0 -45
  255. package/common/deps/touch-emulator.js +0 -103
  256. package/common/deps/touch.js +0 -37
  257. package/common/deps/tree-model/node.js +0 -475
  258. package/common/deps/tree-model/tree-store.js +0 -312
  259. package/common/deps/tree-model/util.js +0 -24
  260. package/common/deps/upload-ajax.js +0 -81
  261. package/common/deps/useEventListener.js +0 -54
  262. package/common/deps/useInstanceSlots.js +0 -22
  263. package/common/deps/useRect.js +0 -25
  264. package/common/deps/useRelation.js +0 -89
  265. package/common/deps/useTouch.js +0 -68
  266. package/common/deps/useUserAgent.js +0 -16
  267. package/common/deps/useWindowSize.js +0 -23
  268. package/common/deps/vue-emitter.js +0 -34
  269. package/common/deps/vue-popper.js +0 -177
  270. package/common/deps/vue-popup.js +0 -138
  271. package/common/event.js +0 -46
  272. package/common/form/const.js +0 -10
  273. package/common/function.js +0 -28
  274. package/common/global.js +0 -11
  275. package/common/index.js +0 -259
  276. package/common/object.js +0 -227
  277. package/common/prop-util.js +0 -43
  278. package/common/runtime.js +0 -79
  279. package/common/string.js +0 -417
  280. package/common/type.js +0 -66
  281. package/common/validate/index.js +0 -10
  282. package/common/validate/messages.js +0 -65
  283. package/common/validate/rules/enum.js +0 -12
  284. package/common/validate/rules/index.js +0 -18
  285. package/common/validate/rules/pattern.js +0 -20
  286. package/common/validate/rules/range.js +0 -52
  287. package/common/validate/rules/required.js +0 -11
  288. package/common/validate/rules/type.js +0 -100
  289. package/common/validate/rules/whitespace.js +0 -10
  290. package/common/validate/schema.js +0 -290
  291. package/common/validate/util.js +0 -211
  292. package/common/validate/validations/array.js +0 -22
  293. package/common/validate/validations/date.js +0 -31
  294. package/common/validate/validations/enum.js +0 -22
  295. package/common/validate/validations/float.js +0 -22
  296. package/common/validate/validations/index.js +0 -46
  297. package/common/validate/validations/integer.js +0 -22
  298. package/common/validate/validations/method.js +0 -21
  299. package/common/validate/validations/number.js +0 -25
  300. package/common/validate/validations/pattern.js +0 -21
  301. package/common/validate/validations/required.js +0 -11
  302. package/common/validate/validations/string.js +0 -33
  303. package/common/validate/validations/type.js +0 -29
  304. package/index-bar/index.js +0 -66
  305. package/index-bar/vue.js +0 -73
  306. package/index-bar-anchor/vue.js +0 -16
  307. package/label/index.js +0 -56
  308. package/label/vue.js +0 -26
  309. package/list/index.js +0 -13
  310. package/list/vue.js +0 -17
  311. package/mask/index.js +0 -13
  312. package/mask/vue.js +0 -18
  313. package/mini-picker/index.js +0 -165
  314. package/mini-picker/vue.js +0 -122
  315. package/multi-select/index.js +0 -394
  316. package/multi-select/vue.js +0 -113
  317. package/multi-select-item/index.js +0 -23
  318. package/multi-select-item/vue.js +0 -31
  319. package/toast/index.js +0 -7
  320. package/toast/vue.js +0 -19
  321. package/types/toast.type.d.ts +0 -63
  322. package/wheel/index.js +0 -165
  323. package/wheel/vue.js +0 -79
@@ -1,312 +0,0 @@
1
- import {
2
- __spreadProps,
3
- __spreadValues
4
- } from "../../../chunk-G2ADBYYC.js";
5
- import { hasOwn, isNull } from "../../type";
6
- import { getNodeKey } from "./util";
7
- import Node from "./node";
8
- class TreeStore {
9
- constructor(options) {
10
- this.currentNode = null;
11
- this.currentNodeKey = null;
12
- for (let option in options) {
13
- if (hasOwn.call(options, option)) {
14
- this[option] = options[option];
15
- }
16
- }
17
- this.nodesMap = {};
18
- this.root = new Node({ data: this.data, store: this });
19
- if (this.lazy && this.load) {
20
- this.load(this.root, (data) => {
21
- this.root.doCreateChildren(data);
22
- this._initDefaultCheckedNodes();
23
- typeof this.afterLoad === "function" && this.afterLoad({ data, init: true });
24
- });
25
- } else {
26
- this._initDefaultCheckedNodes();
27
- }
28
- }
29
- getMappingData(data) {
30
- const props = this.props || {};
31
- const mapping = {};
32
- for (let key in props) {
33
- if (hasOwn.call(props, key)) {
34
- mapping[key] = data[props[key]];
35
- }
36
- }
37
- return __spreadValues(__spreadValues({}, data), mapping);
38
- }
39
- filter(value) {
40
- const { lazy, filterNodeMethod, getMappingData } = this;
41
- const walkTree = (node) => {
42
- const childNodes = node.root ? node.root.childNodes : node.childNodes;
43
- childNodes.forEach((child) => {
44
- const mappingData = getMappingData.call(this, child.data);
45
- child.visible = filterNodeMethod.call(child, value, mappingData, child);
46
- walkTree(child);
47
- });
48
- if (!node.visible && childNodes.length) {
49
- let allHidden = !childNodes.some(({ visible }) => visible);
50
- if (node.root) {
51
- node.root.visible = allHidden === false;
52
- } else {
53
- node.visible = allHidden === false;
54
- }
55
- }
56
- if (!value) {
57
- return;
58
- }
59
- if (node.visible && !node.isLeaf && !lazy) {
60
- node.expand();
61
- }
62
- };
63
- walkTree(this);
64
- }
65
- setData(newVal) {
66
- if (newVal !== this.root.data) {
67
- this.root.setData(newVal);
68
- this._initDefaultCheckedNodes();
69
- } else {
70
- this.root.updateChildren();
71
- }
72
- }
73
- getNode(data) {
74
- if (data instanceof Node) {
75
- return data;
76
- }
77
- const nodeKey = typeof data !== "object" ? data : getNodeKey(this.key, data);
78
- return this.nodesMap[nodeKey] || null;
79
- }
80
- insertBefore(data, insertData) {
81
- const refNode = this.getNode(insertData);
82
- refNode.parent.insertBefore({ data }, refNode);
83
- }
84
- insertAfter(data, insertData) {
85
- const refNode = this.getNode(insertData);
86
- refNode.parent.insertAfter({ data }, refNode);
87
- }
88
- remove(data, isSaveChildNode, isNode) {
89
- const treeNode = isNode ? data : this.getNode(data);
90
- if (treeNode && treeNode.parent) {
91
- if (treeNode === this.currentNode) {
92
- this.currentNode = null;
93
- }
94
- if (isSaveChildNode && treeNode.childNodes) {
95
- treeNode.childNodes.forEach((child) => {
96
- treeNode.parent.insertChild({ data: child.data });
97
- });
98
- }
99
- treeNode.parent.removeChild(treeNode);
100
- }
101
- }
102
- append(data, parentData, index) {
103
- const parentNode = parentData ? this.getNode(parentData) : this.root;
104
- if (parentNode) {
105
- const child = parentNode.insertChild({ data }, index);
106
- data._isNewNode && this.registerNode(child);
107
- }
108
- }
109
- setDefaultCheckedKey(newValue) {
110
- if (newValue !== this.defaultCheckedKeys) {
111
- this.defaultCheckedKeys = newValue;
112
- this._initDefaultCheckedNodes();
113
- }
114
- }
115
- _initDefaultCheckedNodes() {
116
- const defaultCheckedKeys = this.defaultCheckedKeys || [];
117
- const nodesMap = this.nodesMap;
118
- defaultCheckedKeys.forEach((checkedKey) => {
119
- const node = nodesMap[checkedKey];
120
- node && node.setChecked(true, !this.checkStrictly);
121
- });
122
- }
123
- _initDefaultCheckedNode(node) {
124
- const defaultCheckedKeys = this.defaultCheckedKeys || [];
125
- ~defaultCheckedKeys.indexOf(node.key) && node.setChecked(true, !this.checkStrictly);
126
- }
127
- getCheckedKeys(leafOnly = false) {
128
- return this.getCheckedNodes(leafOnly).map((node) => (node || {})[this.key]);
129
- }
130
- getHalfCheckedKeys() {
131
- return this.getHalfCheckedNodes().map((node) => (node || {})[this.key]);
132
- }
133
- deregisterNode(node) {
134
- const key = this.key;
135
- if (!key || !node || !node.data) {
136
- return;
137
- }
138
- node.childNodes.forEach((child) => {
139
- this.deregisterNode(child);
140
- });
141
- delete this.nodesMap[node.key];
142
- }
143
- registerNode(node) {
144
- const key = this.key;
145
- if (!key || !node || !node.data) {
146
- return;
147
- }
148
- const nodeKey = node.key;
149
- if (nodeKey !== void 0) {
150
- this.nodesMap[nodeKey] = node;
151
- }
152
- }
153
- getCheckedNodes(leafOnly = false, includeHalfChecked = false, isNode = false) {
154
- const checkedNodes = [];
155
- const walkTree = (node) => {
156
- const childNodes = node.root ? node.root.childNodes : node.childNodes;
157
- childNodes.forEach((child) => {
158
- const { checked, indeterminate, isLeaf, data } = child;
159
- if ((checked || includeHalfChecked && indeterminate) && (!leafOnly || leafOnly && isLeaf)) {
160
- checkedNodes.push(isNode ? child : data);
161
- }
162
- walkTree(child);
163
- });
164
- };
165
- walkTree(this);
166
- return checkedNodes;
167
- }
168
- getHalfCheckedNodes() {
169
- const nodes = [];
170
- const walkTree = (node) => {
171
- const childNodes = node.root ? node.root.childNodes : node.childNodes;
172
- childNodes.forEach((child) => {
173
- const { indeterminate, data } = child;
174
- indeterminate && nodes.push(data);
175
- walkTree(child);
176
- });
177
- };
178
- walkTree(this);
179
- return nodes;
180
- }
181
- _getAllNodes() {
182
- const allNodes = [];
183
- const nodesMap = this.nodesMap;
184
- Object.keys(nodesMap).forEach((nodeKey) => {
185
- hasOwn.call(nodesMap, nodeKey) && allNodes.push(nodesMap[nodeKey]);
186
- });
187
- return allNodes;
188
- }
189
- updateChildren(key, data) {
190
- const node = this.nodesMap[key];
191
- if (!node) {
192
- return;
193
- }
194
- const childNodes = node.childNodes;
195
- for (let i = childNodes.length - 1; i >= 0; i--) {
196
- this.remove(childNodes[i].data);
197
- }
198
- for (let i = 0, len = data.length; i < len; i++) {
199
- const child = data[i];
200
- this.append(child, node.data);
201
- }
202
- }
203
- _setCheckedKeys(key, leafOnly = false, checkedKeys = {}) {
204
- const nodes = this._getAllNodes().sort((prevNode, nextNode) => nextNode.level - prevNode.level);
205
- const cache = /* @__PURE__ */ Object.create(null);
206
- const keys = Object.keys(checkedKeys);
207
- nodes.forEach((node) => {
208
- node.setChecked(false, false);
209
- });
210
- for (let i = 0, len = nodes.length; i < len; i++) {
211
- const node = nodes[i];
212
- const nodeKey = node.data[key].toString();
213
- let checked = ~keys.indexOf(nodeKey);
214
- if (!checked) {
215
- if (node.checked && !cache[nodeKey]) {
216
- node.setChecked(false, false);
217
- }
218
- } else {
219
- let parentNode = node.parent;
220
- while (parentNode && parentNode.level > 0) {
221
- cache[parentNode.data[key]] = true;
222
- parentNode = parentNode.parent;
223
- }
224
- if (node.isLeaf || this.checkStrictly) {
225
- node.setChecked(true, false);
226
- } else if (leafOnly) {
227
- node.setChecked(false, false);
228
- const walkTree = (node2) => {
229
- const childNodes = node2.childNodes;
230
- childNodes.forEach((child) => {
231
- !child.isLeaf && child.setChecked(false, false);
232
- walkTree(child);
233
- });
234
- };
235
- walkTree(node);
236
- } else {
237
- node.setChecked(true, true);
238
- }
239
- }
240
- }
241
- }
242
- setDefaultExpandedKeys(keys) {
243
- keys = keys || [];
244
- this.defaultExpandedKeys = keys;
245
- keys.forEach((key) => {
246
- const node = this.getNode(key);
247
- node && node.expand(null, this.autoExpandParent);
248
- });
249
- }
250
- setCheckedKeys(keys, leafOnly = false) {
251
- this.defaultCheckedKeys = keys;
252
- const checkedKeys = {};
253
- keys.forEach((key) => {
254
- checkedKeys[key] = true;
255
- });
256
- this._setCheckedKeys(this.key, leafOnly, checkedKeys);
257
- }
258
- setCheckedNodes(array, leafOnly = false) {
259
- const key = this.key;
260
- const checkedKeys = {};
261
- array.forEach((item) => {
262
- checkedKeys[(item || {})[key]] = true;
263
- });
264
- this._setCheckedKeys(key, leafOnly, checkedKeys);
265
- }
266
- setChecked(data, checked, deep) {
267
- const node = this.getNode(data);
268
- node && node.setChecked(!!checked, deep);
269
- }
270
- setCurrentNode(currentNode) {
271
- const prevNode = this.currentNode;
272
- if (prevNode) {
273
- prevNode.isCurrent = false;
274
- }
275
- this.currentNode = currentNode;
276
- if (currentNode) {
277
- this.currentNode.isCurrent = true;
278
- }
279
- }
280
- getCurrentNode() {
281
- return this.currentNode;
282
- }
283
- setCurrentNodeKey(key) {
284
- if (isNull(key)) {
285
- this.currentNode && (this.currentNode.isCurrent = false);
286
- this.currentNode = null;
287
- return;
288
- }
289
- const node = this.getNode(key);
290
- node && this.setCurrentNode(node);
291
- }
292
- setUserCurrentNode(node) {
293
- const key = node[this.key];
294
- const currNode = this.nodesMap[key];
295
- this.setCurrentNode(currNode);
296
- }
297
- getData(data) {
298
- return (this.getNode(data) || {}).data;
299
- }
300
- getAllData() {
301
- const children = this.props.children;
302
- const walkTree = (nodes) => {
303
- return nodes.map((node) => {
304
- return __spreadProps(__spreadValues({}, node.data), { [children]: walkTree(node.childNodes) });
305
- });
306
- };
307
- return walkTree(this.root.childNodes);
308
- }
309
- }
310
- export {
311
- TreeStore as default
312
- };
@@ -1,24 +0,0 @@
1
- import "../../../chunk-G2ADBYYC.js";
2
- const NODE_KEY = "$treeNodeId";
3
- const getNodeKey = function(key, data) {
4
- if (!key) {
5
- return data[NODE_KEY];
6
- }
7
- return data[key];
8
- };
9
- const markNodeData = function(node, data) {
10
- if (!data || data[NODE_KEY]) {
11
- return;
12
- }
13
- Object.defineProperty(data, NODE_KEY, {
14
- value: node.id,
15
- enumerable: false,
16
- configurable: false,
17
- writable: false
18
- });
19
- };
20
- export {
21
- NODE_KEY,
22
- getNodeKey,
23
- markNodeData
24
- };
@@ -1,81 +0,0 @@
1
- import "../../chunk-G2ADBYYC.js";
2
- import { hasOwn } from "../type";
3
- import { xss } from "@opentiny/utils";
4
- const getBody = (xhr) => {
5
- const text = xhr.responseText || xhr.response;
6
- if (!text) {
7
- return text;
8
- }
9
- try {
10
- return JSON.parse(text);
11
- } catch (e) {
12
- return text;
13
- }
14
- };
15
- const getError = (action, option, xhr) => {
16
- let errorText;
17
- if (xhr.response) {
18
- errorText = xhr.response.error || xhr.response;
19
- } else if (xhr.responseText) {
20
- errorText = xhr.responseText;
21
- } else {
22
- errorText = `fail to post ${action} ${xhr.status}`;
23
- }
24
- const error = new Error(errorText);
25
- error.status = xhr.status;
26
- error.method = "post";
27
- error.url = action;
28
- return error;
29
- };
30
- var upload_ajax_default = (option) => {
31
- if (typeof XMLHttpRequest === "undefined") {
32
- return;
33
- }
34
- const xhr = new XMLHttpRequest();
35
- const action = xss.filterUrl(option.action);
36
- if (xhr.upload) {
37
- xhr.upload.onprogress = (event) => {
38
- if (event.total > 0) {
39
- event.percent = event.loaded / event.total * 100;
40
- }
41
- option.onProgress(event);
42
- };
43
- }
44
- const formData = new FormData();
45
- if (option.data) {
46
- Object.keys(option.data).forEach((key) => {
47
- formData.append(key, option.data[key]);
48
- });
49
- }
50
- if (Array.isArray(option.file)) {
51
- option.file.forEach((file) => {
52
- formData.append(option.filename, file, file.name);
53
- });
54
- } else {
55
- formData.append(option.filename, option.file, option.file.name);
56
- }
57
- xhr.onerror = (event) => {
58
- option.onError(event);
59
- };
60
- xhr.onload = () => {
61
- if (xhr.status < 200 || xhr.status >= 300) {
62
- return option.onError(getError(action, option, xhr));
63
- }
64
- option.onSuccess(getBody(xhr));
65
- };
66
- xhr.open("post", action, true);
67
- if (option.withCredentials && "withCredentials" in xhr) {
68
- xhr.withCredentials = true;
69
- }
70
- const headers = option.headers || {};
71
- for (let header in headers) {
72
- if (hasOwn.call(headers, header) && headers[header] !== null) {
73
- xhr.setRequestHeader(header, headers[header]);
74
- }
75
- }
76
- xhr.send(formData);
77
- return xhr;
78
- };
79
- export {
80
- upload_ajax_default as default
81
- };
@@ -1,54 +0,0 @@
1
- import "../../chunk-G2ADBYYC.js";
2
- import { on, off, isServer } from "./dom";
3
- const onMountedOrActivated = ({ onMounted, onActivated, nextTick }) => (hook) => {
4
- let mounted;
5
- onMounted(() => {
6
- hook();
7
- nextTick(() => mounted = true);
8
- });
9
- onActivated(() => mounted && hook());
10
- };
11
- const useEventListener = ({ unref, isRef, watch, nextTick, onMounted, onUnmounted, onActivated, onDeactivated }) => (type, listener, options = {}) => {
12
- if (isServer)
13
- return;
14
- const { target = window, passive = false, capture = false } = options;
15
- let cleaned = false;
16
- let attached;
17
- const add = (target2) => {
18
- if (cleaned)
19
- return;
20
- const element = unref(target2);
21
- if (element && !attached) {
22
- on(element, type, listener, { capture, passive });
23
- attached = true;
24
- }
25
- };
26
- const remove = (target2) => {
27
- if (cleaned)
28
- return;
29
- const element = unref(target2);
30
- if (element && attached) {
31
- off(element, type, listener, { capture, passive });
32
- attached = false;
33
- }
34
- };
35
- onUnmounted(() => remove(target));
36
- onDeactivated(() => remove(target));
37
- onMountedOrActivated({ onMounted, onActivated, nextTick })(() => add(target));
38
- let stopWatch;
39
- if (isRef(target)) {
40
- stopWatch = watch(target, (val, oldVal) => {
41
- remove(oldVal);
42
- add(val);
43
- });
44
- }
45
- return () => {
46
- stopWatch && stopWatch();
47
- remove(target);
48
- cleaned = true;
49
- };
50
- };
51
- export {
52
- onMountedOrActivated,
53
- useEventListener
54
- };
@@ -1,22 +0,0 @@
1
- import "../../chunk-G2ADBYYC.js";
2
- const useInstanceSlots = ({ getCurrentInstance, isVue2, nextTick, onUnmounted }) => () => {
3
- const publicInstance = getCurrentInstance().proxy;
4
- if (!isVue2) {
5
- Object.defineProperty(publicInstance, "$scopedSlots", { configurable: true, value: null });
6
- }
7
- Object.defineProperty(publicInstance, "instanceSlots", {
8
- configurable: true,
9
- get: () => publicInstance.$scopedSlots || publicInstance.$slots
10
- });
11
- onUnmounted(() => {
12
- nextTick(() => {
13
- if (!isVue2) {
14
- delete publicInstance.$scopedSlots;
15
- }
16
- delete publicInstance.instanceSlots;
17
- });
18
- });
19
- };
20
- export {
21
- useInstanceSlots
22
- };
@@ -1,25 +0,0 @@
1
- import "../../chunk-G2ADBYYC.js";
2
- const isWindow = (val) => val === window;
3
- const makeDOMRect = (width, height) => ({
4
- top: 0,
5
- left: 0,
6
- width,
7
- right: width,
8
- height,
9
- bottom: height
10
- });
11
- const useRect = (unref) => (elOrRef) => {
12
- const el = unref(elOrRef);
13
- if (isWindow(el)) {
14
- const width = el.innerWidth;
15
- const height = el.innerHeight;
16
- return makeDOMRect(width, height);
17
- }
18
- if (el && el.getBoundingClientRect) {
19
- return el.getBoundingClientRect();
20
- }
21
- return makeDOMRect(0, 0);
22
- };
23
- export {
24
- useRect
25
- };
@@ -1,89 +0,0 @@
1
- import "../../chunk-G2ADBYYC.js";
2
- import { noop } from "../function";
3
- import { onMountedOrActivated as createHook } from "./useEventListener";
4
- const useRelation = ({
5
- computed,
6
- getCurrentInstance,
7
- inject,
8
- markRaw,
9
- nextTick,
10
- onMounted,
11
- onActivated,
12
- onUnmounted,
13
- provide,
14
- reactive,
15
- toRef
16
- }) => ({ relationKey, relationContainer, onChange, childrenKey, delivery } = {}) => {
17
- if (!relationKey) {
18
- throw new Error("[TINY Error]<relationKey> must exist.");
19
- }
20
- const instance = getCurrentInstance();
21
- const state = reactive({ children: [], indexInParent: -1 });
22
- const injectValue = inject(relationKey, null);
23
- let callbacks = [];
24
- if (injectValue) {
25
- const { link: link2, unlink: unlink2, callbacks: injectCbs, childrenKey: injectKey, delivery: injectDelivery } = injectValue;
26
- callbacks = injectCbs;
27
- childrenKey = childrenKey || injectKey || "instanceChildren";
28
- delivery = injectDelivery;
29
- state.indexInParent = link2(instance);
30
- onUnmounted(() => unlink2(instance));
31
- } else {
32
- childrenKey = childrenKey || "instanceChildren";
33
- const onMountedOrActivated = createHook({ onMounted, onActivated, nextTick });
34
- const changeHandler = onChange ? () => nextTick(onChange) : noop;
35
- let relationMO;
36
- nextTick(() => {
37
- const targetNode = typeof relationContainer === "function" ? relationContainer() : relationContainer;
38
- if (targetNode) {
39
- relationMO = new MutationObserver((mutationList, observer) => {
40
- const flattenNodes = [];
41
- flattenChildNodes(targetNode.childNodes, flattenNodes);
42
- callbacks.forEach((callback) => callback(flattenNodes, mutationList, observer));
43
- changeHandler();
44
- });
45
- relationMO.observe(targetNode, { attributes: true, childList: true, subtree: true });
46
- }
47
- });
48
- onMountedOrActivated(() => changeHandler());
49
- onUnmounted(() => {
50
- if (relationMO) {
51
- relationMO.disconnect();
52
- relationMO = null;
53
- }
54
- callbacks = null;
55
- });
56
- }
57
- const link = (child) => {
58
- const childPublic = child.proxy;
59
- state.children.push(markRaw(childPublic));
60
- return computed(() => state.children.indexOf(childPublic));
61
- };
62
- const unlink = (child) => {
63
- const index = state.children.indexOf(child.proxy);
64
- if (index > -1) {
65
- state.children.splice(index, 1);
66
- }
67
- };
68
- callbacks.push((flattenNodes) => sortPublicInstances(state.children, flattenNodes));
69
- provide(relationKey, { link, unlink, callbacks, childrenKey, delivery });
70
- Object.defineProperty(instance.proxy, childrenKey, { configurable: true, get: () => state.children });
71
- onUnmounted(() => delete instance.proxy[childrenKey]);
72
- return { children: toRef(state, "children"), index: toRef(state, "indexInParent"), delivery };
73
- };
74
- const flattenChildNodes = (childNodes, result) => {
75
- if (childNodes.length) {
76
- childNodes.forEach((childNode) => {
77
- result.push(childNode);
78
- if (childNode.childNodes) {
79
- flattenChildNodes(childNode.childNodes, result);
80
- }
81
- });
82
- }
83
- };
84
- const sortPublicInstances = (instances, flattenNodes) => {
85
- instances.sort((a, b) => flattenNodes.indexOf(a.$el) - flattenNodes.indexOf(b.$el));
86
- };
87
- export {
88
- useRelation
89
- };
@@ -1,68 +0,0 @@
1
- import "../../chunk-G2ADBYYC.js";
2
- const TAP_OFFSET = 5;
3
- const getDirection = (x, y) => {
4
- if (x > y)
5
- return "horizontal";
6
- if (y > x)
7
- return "vertical";
8
- return "";
9
- };
10
- const touchEvent = (event) => event.touches[0];
11
- const useTouch = (ref) => () => {
12
- const startX = ref(0);
13
- const startY = ref(0);
14
- const deltaX = ref(0);
15
- const deltaY = ref(0);
16
- const offsetX = ref(0);
17
- const offsetY = ref(0);
18
- const direction = ref("");
19
- const isTap = ref(true);
20
- const isVertical = () => direction.value === "vertical";
21
- const isHorizontal = () => direction.value === "horizontal";
22
- const reset = () => {
23
- deltaX.value = 0;
24
- deltaY.value = 0;
25
- offsetX.value = 0;
26
- offsetY.value = 0;
27
- direction.value = "";
28
- isTap.value = true;
29
- };
30
- const start = (event) => {
31
- reset();
32
- const touch = touchEvent(event);
33
- startX.value = touch.clientX;
34
- startY.value = touch.clientY;
35
- };
36
- const move = (event) => {
37
- const touch = touchEvent(event);
38
- deltaX.value = (touch.clientX < 0 ? 0 : touch.clientX) - startX.value;
39
- deltaY.value = touch.clientY - startY.value;
40
- offsetX.value = Math.abs(deltaX.value);
41
- offsetY.value = Math.abs(deltaY.value);
42
- const LOCK_DIRECTION_DISTANCE = 10;
43
- if (!direction.value || offsetX.value < LOCK_DIRECTION_DISTANCE && offsetY.value < LOCK_DIRECTION_DISTANCE) {
44
- direction.value = getDirection(offsetX.value, offsetY.value);
45
- }
46
- if (isTap.value && (offsetX.value > TAP_OFFSET || offsetY.value > TAP_OFFSET)) {
47
- isTap.value = false;
48
- }
49
- };
50
- return {
51
- move,
52
- start,
53
- reset,
54
- isVertical,
55
- isHorizontal,
56
- startX,
57
- startY,
58
- deltaX,
59
- deltaY,
60
- offsetX,
61
- offsetY,
62
- direction,
63
- isTap
64
- };
65
- };
66
- export {
67
- useTouch
68
- };
@@ -1,16 +0,0 @@
1
- import "../../chunk-G2ADBYYC.js";
2
- import { isServer } from "./dom";
3
- function getIsIOS() {
4
- if (isServer)
5
- return false;
6
- return window.navigator && window.navigator.userAgent && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || // The new iPad Pro Gen3 does not identify itself as iPad, but as Macintosh.
7
- // https://github.com/vueuse/vueuse/issues/3577
8
- window.navigator.maxTouchPoints > 2 && /iPad|Macintosh/.test(window.navigator.userAgent));
9
- }
10
- const useUserAgent = () => {
11
- const isIOS = getIsIOS();
12
- return { isIOS };
13
- };
14
- export {
15
- useUserAgent
16
- };