orion-design 0.1.30 → 0.1.31

Sign up to get free protection for your applications and to get access to all the features.
Files changed (199) hide show
  1. package/README.md +5 -5
  2. package/dist/Throne/index.js +30 -14
  3. package/dist/Throne/index.js.map +1 -1
  4. package/dist/_commonjsHelpers-DWwsNxpa.js +9 -0
  5. package/dist/_commonjsHelpers-DWwsNxpa.js.map +1 -0
  6. package/dist/components/Button/index.js +40 -33
  7. package/dist/components/Button/index.js.map +1 -1
  8. package/dist/components/Flex/index.js +122 -89
  9. package/dist/components/Flex/index.js.map +1 -1
  10. package/dist/components/Form/Form.js +2 -2
  11. package/dist/components/Form/Form.js.map +1 -1
  12. package/dist/components/Form/LovInput/LovInput.js +2 -2
  13. package/dist/components/Form/LovInput/LovInput.js.map +1 -1
  14. package/dist/components/Form/LovInput/hooks/useLov.js +5 -5
  15. package/dist/components/Form/LovInput/hooks/useLov.js.map +1 -1
  16. package/dist/components/Form/LovInput/index.js +4 -4
  17. package/dist/components/Form/hooks/FormItemValidateTrigger.js +2 -2
  18. package/dist/components/Form/hooks/FormItemValidateTrigger.js.map +1 -1
  19. package/dist/components/Form/hooks/index.js +128 -66
  20. package/dist/components/Form/hooks/index.js.map +1 -1
  21. package/dist/components/Form/index.js +836 -656
  22. package/dist/components/Form/index.js.map +1 -1
  23. package/dist/components/Form/utils/index.js +30 -18
  24. package/dist/components/Form/utils/index.js.map +1 -1
  25. package/dist/components/LovTable/index.js +179 -105
  26. package/dist/components/LovTable/index.js.map +1 -1
  27. package/dist/components/Modal/index.js +111 -56
  28. package/dist/components/Modal/index.js.map +1 -1
  29. package/dist/components/Modal/types.js +4 -3
  30. package/dist/components/Modal/types.js.map +1 -1
  31. package/dist/components/Modal/useModal.js +5 -5
  32. package/dist/components/Modal/useModal.js.map +1 -1
  33. package/dist/components/Pagetable/hooks/useColumns.js +88 -80
  34. package/dist/components/Pagetable/hooks/useColumns.js.map +1 -1
  35. package/dist/components/Pagetable/index.js +687 -542
  36. package/dist/components/Pagetable/index.js.map +1 -1
  37. package/dist/components/Pagetable/utils/index.js +92 -54
  38. package/dist/components/Pagetable/utils/index.js.map +1 -1
  39. package/dist/components/Querytable/hooks/useColumns.js +82 -74
  40. package/dist/components/Querytable/hooks/useColumns.js.map +1 -1
  41. package/dist/components/Querytable/index.js +579 -469
  42. package/dist/components/Querytable/index.js.map +1 -1
  43. package/dist/components/Querytable/utils/index.js +92 -54
  44. package/dist/components/Querytable/utils/index.js.map +1 -1
  45. package/dist/components/RichTextEditor/index.js +100 -74
  46. package/dist/components/RichTextEditor/index.js.map +1 -1
  47. package/dist/components/Tabs/constants.js +2 -2
  48. package/dist/components/Tabs/constants.js.map +1 -1
  49. package/dist/components/Tabs/index.js +603 -358
  50. package/dist/components/Tabs/index.js.map +1 -1
  51. package/dist/components/Tabs/tab-bar.js +6 -6
  52. package/dist/components/Tabs/tab-bar.js.map +1 -1
  53. package/dist/components/Tabs/tab-pane.js +3 -3
  54. package/dist/components/Tabs/tab-pane.js.map +1 -1
  55. package/dist/components/_constants/aria.js +2 -2
  56. package/dist/components/_constants/aria.js.map +1 -1
  57. package/dist/components/_constants/event.js +6 -4
  58. package/dist/components/_constants/event.js.map +1 -1
  59. package/dist/components/_constants/index.js +6 -6
  60. package/dist/components/_hooks/index.js +7 -7
  61. package/dist/components/_hooks/use-namespace/index.js +74 -39
  62. package/dist/components/_hooks/use-namespace/index.js.map +1 -1
  63. package/dist/components/_hooks/use-ordered-children/index.js +29 -19
  64. package/dist/components/_hooks/use-ordered-children/index.js.map +1 -1
  65. package/dist/components/_util/arrays.js +9 -5
  66. package/dist/components/_util/arrays.js.map +1 -1
  67. package/dist/components/_util/browser.js +6 -6
  68. package/dist/components/_util/browser.js.map +1 -1
  69. package/dist/components/_util/classNames.js +22 -17
  70. package/dist/components/_util/classNames.js.map +1 -1
  71. package/dist/components/_util/dom/aria.js +74 -39
  72. package/dist/components/_util/dom/aria.js.map +1 -1
  73. package/dist/components/_util/dom/element.js +9 -8
  74. package/dist/components/_util/dom/element.js.map +1 -1
  75. package/dist/components/_util/dom/event.js +14 -7
  76. package/dist/components/_util/dom/event.js.map +1 -1
  77. package/dist/components/_util/dom/index.js +36 -36
  78. package/dist/components/_util/dom/position.js +49 -25
  79. package/dist/components/_util/dom/position.js.map +1 -1
  80. package/dist/components/_util/dom/scroll.js +103 -61
  81. package/dist/components/_util/dom/scroll.js.map +1 -1
  82. package/dist/components/_util/dom/style.js +65 -50
  83. package/dist/components/_util/dom/style.js.map +1 -1
  84. package/dist/components/_util/easings.js +8 -4
  85. package/dist/components/_util/easings.js.map +1 -1
  86. package/dist/components/_util/error.js +12 -11
  87. package/dist/components/_util/error.js.map +1 -1
  88. package/dist/components/_util/functions.js +3 -3
  89. package/dist/components/_util/i18n.js +2 -2
  90. package/dist/components/_util/i18n.js.map +1 -1
  91. package/dist/components/_util/index.js +137 -137
  92. package/dist/components/_util/isValid.js +4 -2
  93. package/dist/components/_util/isValid.js.map +1 -1
  94. package/dist/components/_util/objects.js +18 -14
  95. package/dist/components/_util/objects.js.map +1 -1
  96. package/dist/components/_util/props-util/index.js +46 -20
  97. package/dist/components/_util/props-util/index.js.map +1 -1
  98. package/dist/components/_util/props-util/initDefaultProps.js +18 -10
  99. package/dist/components/_util/props-util/initDefaultProps.js.map +1 -1
  100. package/dist/components/_util/raf.js +5 -4
  101. package/dist/components/_util/raf.js.map +1 -1
  102. package/dist/components/_util/rand.js +4 -3
  103. package/dist/components/_util/rand.js.map +1 -1
  104. package/dist/components/_util/strings.js +9 -8
  105. package/dist/components/_util/strings.js.map +1 -1
  106. package/dist/components/_util/throttleByRaf.js +16 -10
  107. package/dist/components/_util/throttleByRaf.js.map +1 -1
  108. package/dist/components/_util/type.js +41 -38
  109. package/dist/components/_util/type.js.map +1 -1
  110. package/dist/components/_util/types.js +41 -22
  111. package/dist/components/_util/types.js.map +1 -1
  112. package/dist/components/_util/typescript.js +2 -2
  113. package/dist/components/_util/typescript.js.map +1 -1
  114. package/dist/components/_util/util.js +85 -43
  115. package/dist/components/_util/util.js.map +1 -1
  116. package/dist/components/_util/vue/global-node.js +27 -15
  117. package/dist/components/_util/vue/global-node.js.map +1 -1
  118. package/dist/components/_util/vue/icon.js +29 -25
  119. package/dist/components/_util/vue/icon.js.map +1 -1
  120. package/dist/components/_util/vue/index.js +41 -41
  121. package/dist/components/_util/vue/install.js +35 -18
  122. package/dist/components/_util/vue/install.js.map +1 -1
  123. package/dist/components/_util/vue/props/index.js +6 -6
  124. package/dist/components/_util/vue/props/runtime.js +46 -30
  125. package/dist/components/_util/vue/props/runtime.js.map +1 -1
  126. package/dist/components/_util/vue/refs.js +12 -6
  127. package/dist/components/_util/vue/refs.js.map +1 -1
  128. package/dist/components/_util/vue/size.js +5 -3
  129. package/dist/components/_util/vue/size.js.map +1 -1
  130. package/dist/components/_util/vue/validator.js +5 -4
  131. package/dist/components/_util/vue/validator.js.map +1 -1
  132. package/dist/components/_util/vue/vnode.js +100 -54
  133. package/dist/components/_util/vue/vnode.js.map +1 -1
  134. package/dist/components/_util/vue-types/index.js +231 -220
  135. package/dist/components/_util/vue-types/index.js.map +1 -1
  136. package/dist/components/components.js +20 -20
  137. package/dist/components/index.js +38 -35
  138. package/dist/components/index.js.map +1 -1
  139. package/dist/components-B3d9m_tn.js +27 -0
  140. package/dist/components-B3d9m_tn.js.map +1 -0
  141. package/dist/error/OrionError.js +8 -4
  142. package/dist/error/OrionError.js.map +1 -1
  143. package/dist/functions-BeMkokbY.js +63 -0
  144. package/dist/functions-BeMkokbY.js.map +1 -0
  145. package/dist/index-BOKLZnqH.js +54 -0
  146. package/dist/index-BOKLZnqH.js.map +1 -0
  147. package/dist/index-D1m0KTpK.js +69 -0
  148. package/dist/index-D1m0KTpK.js.map +1 -0
  149. package/dist/index-DR5ZP7mD.js +160 -0
  150. package/dist/index-DR5ZP7mD.js.map +1 -0
  151. package/dist/index-DkwIULcN.js +200 -0
  152. package/dist/index-DkwIULcN.js.map +1 -0
  153. package/dist/index.css +797 -1
  154. package/dist/index.js +36 -36
  155. package/dist/print/LodopFuncs.js +101 -43
  156. package/dist/print/LodopFuncs.js.map +1 -1
  157. package/dist/print/index.js +200 -108
  158. package/dist/print/index.js.map +1 -1
  159. package/dist/request/ErrorHandlerChain.js +17 -14
  160. package/dist/request/ErrorHandlerChain.js.map +1 -1
  161. package/dist/request/RequestFilterChain.js +16 -13
  162. package/dist/request/RequestFilterChain.js.map +1 -1
  163. package/dist/request/ResponseParserChain.js +17 -14
  164. package/dist/request/ResponseParserChain.js.map +1 -1
  165. package/dist/request/disivion/DateSerializer.js +47 -22
  166. package/dist/request/disivion/DateSerializer.js.map +1 -1
  167. package/dist/request/disivion/DivisionErrorHandler.js +40 -25
  168. package/dist/request/disivion/DivisionErrorHandler.js.map +1 -1
  169. package/dist/request/disivion/DivisionResponseParser.js +16 -10
  170. package/dist/request/disivion/DivisionResponseParser.js.map +1 -1
  171. package/dist/request/disivion/index.js +305 -201
  172. package/dist/request/disivion/index.js.map +1 -1
  173. package/dist/request/error/BizExceptionResponseError.js +11 -5
  174. package/dist/request/error/BizExceptionResponseError.js.map +1 -1
  175. package/dist/request/error/ExceptionResponseError.js +11 -5
  176. package/dist/request/error/ExceptionResponseError.js.map +1 -1
  177. package/dist/request/error/ResponseError.js +9 -4
  178. package/dist/request/error/ResponseError.js.map +1 -1
  179. package/dist/request/error/SessionExceptionResponseError.js +11 -5
  180. package/dist/request/error/SessionExceptionResponseError.js.map +1 -1
  181. package/dist/request/index.js +11 -11
  182. package/dist/utils/DateUtil.js +48 -33
  183. package/dist/utils/DateUtil.js.map +1 -1
  184. package/dist/utils/NumberUtil.js +6 -6
  185. package/dist/utils/NumberUtil.js.map +1 -1
  186. package/dist/utils/cloneDeep.js +2 -2
  187. package/dist/utils/delay.js +3 -3
  188. package/dist/utils/delay.js.map +1 -1
  189. package/dist/utils/functions.js +3 -3
  190. package/dist/utils/index.js +12 -12
  191. package/dist/utils/md5.js +191 -93
  192. package/dist/utils/md5.js.map +1 -1
  193. package/dist/utils/uuid.js +35 -25
  194. package/dist/utils/uuid.js.map +1 -1
  195. package/dist/version/index.js +2 -2
  196. package/dist/version/version.d.ts +1 -1
  197. package/dist/version/version.js +2 -2
  198. package/dist/version/version.js.map +1 -1
  199. package/package.json +1 -1
@@ -1,68 +1,114 @@
1
- import { isVNode as u, Fragment as m, Text as A, Comment as N, createCommentVNode as S, openBlock as s, createBlock as L } from "vue";
2
- import { h as _, c as C, i as E } from "../../../functions-DzLqXvGt.js";
1
+ import { isVNode, Fragment, Text, Comment, createCommentVNode, openBlock, createBlock } from "vue";
2
+ import { h as hasOwn, c as camelize, i as isArray } from "../../../functions-BeMkokbY.js";
3
3
  import "lodash-es";
4
- import { debugWarn as O } from "../error.js";
5
- const R = "utils/vue/vnode";
6
- var D = /* @__PURE__ */ ((e) => (e[e.TEXT = 1] = "TEXT", e[e.CLASS = 2] = "CLASS", e[e.STYLE = 4] = "STYLE", e[e.PROPS = 8] = "PROPS", e[e.FULL_PROPS = 16] = "FULL_PROPS", e[e.HYDRATE_EVENTS = 32] = "HYDRATE_EVENTS", e[e.STABLE_FRAGMENT = 64] = "STABLE_FRAGMENT", e[e.KEYED_FRAGMENT = 128] = "KEYED_FRAGMENT", e[e.UNKEYED_FRAGMENT = 256] = "UNKEYED_FRAGMENT", e[e.NEED_PATCH = 512] = "NEED_PATCH", e[e.DYNAMIC_SLOTS = 1024] = "DYNAMIC_SLOTS", e[e.HOISTED = -1] = "HOISTED", e[e.BAIL = -2] = "BAIL", e))(D || {});
7
- function f(e) {
8
- return u(e) && e.type === m;
4
+ import { debugWarn } from "../error.js";
5
+ const SCOPE = "utils/vue/vnode";
6
+ var PatchFlags = /* @__PURE__ */ ((PatchFlags2) => {
7
+ PatchFlags2[PatchFlags2["TEXT"] = 1] = "TEXT";
8
+ PatchFlags2[PatchFlags2["CLASS"] = 2] = "CLASS";
9
+ PatchFlags2[PatchFlags2["STYLE"] = 4] = "STYLE";
10
+ PatchFlags2[PatchFlags2["PROPS"] = 8] = "PROPS";
11
+ PatchFlags2[PatchFlags2["FULL_PROPS"] = 16] = "FULL_PROPS";
12
+ PatchFlags2[PatchFlags2["HYDRATE_EVENTS"] = 32] = "HYDRATE_EVENTS";
13
+ PatchFlags2[PatchFlags2["STABLE_FRAGMENT"] = 64] = "STABLE_FRAGMENT";
14
+ PatchFlags2[PatchFlags2["KEYED_FRAGMENT"] = 128] = "KEYED_FRAGMENT";
15
+ PatchFlags2[PatchFlags2["UNKEYED_FRAGMENT"] = 256] = "UNKEYED_FRAGMENT";
16
+ PatchFlags2[PatchFlags2["NEED_PATCH"] = 512] = "NEED_PATCH";
17
+ PatchFlags2[PatchFlags2["DYNAMIC_SLOTS"] = 1024] = "DYNAMIC_SLOTS";
18
+ PatchFlags2[PatchFlags2["HOISTED"] = -1] = "HOISTED";
19
+ PatchFlags2[PatchFlags2["BAIL"] = -2] = "BAIL";
20
+ return PatchFlags2;
21
+ })(PatchFlags || {});
22
+ function isFragment(node) {
23
+ return isVNode(node) && node.type === Fragment;
9
24
  }
10
- function G(e) {
11
- return u(e) && e.type === A;
25
+ function isText(node) {
26
+ return isVNode(node) && node.type === Text;
12
27
  }
13
- function p(e) {
14
- return u(e) && e.type === N;
28
+ function isComment(node) {
29
+ return isVNode(node) && node.type === Comment;
15
30
  }
16
- const y = "template";
17
- function Y(e) {
18
- return u(e) && e.type === y;
31
+ const TEMPLATE = "template";
32
+ function isTemplate(node) {
33
+ return isVNode(node) && node.type === TEMPLATE;
19
34
  }
20
- function H(e) {
21
- return u(e) && !f(e) && !p(e);
35
+ function isValidElementNode(node) {
36
+ return isVNode(node) && !isFragment(node) && !isComment(node);
22
37
  }
23
- function T(e, t) {
24
- if (!p(e))
25
- return f(e) || Y(e) ? t > 0 ? M(e.children, t - 1) : void 0 : e;
38
+ function getChildren(node, depth) {
39
+ if (isComment(node)) return;
40
+ if (isFragment(node) || isTemplate(node)) {
41
+ return depth > 0 ? getFirstValidNode(node.children, depth - 1) : void 0;
42
+ }
43
+ return node;
26
44
  }
27
- const M = (e, t = 3) => Array.isArray(e) ? T(e[0], t) : T(e, t);
28
- function w(e, ...t) {
29
- return e ? v(...t) : S("v-if", !0);
45
+ const getFirstValidNode = (nodes, maxDepth = 3) => {
46
+ if (Array.isArray(nodes)) {
47
+ return getChildren(nodes[0], maxDepth);
48
+ } else {
49
+ return getChildren(nodes, maxDepth);
50
+ }
51
+ };
52
+ function renderIf(condition, ...args) {
53
+ return condition ? renderBlock(...args) : createCommentVNode("v-if", true);
30
54
  }
31
- function v(...e) {
32
- return s(), L(...e);
55
+ function renderBlock(...args) {
56
+ return openBlock(), createBlock(...args);
33
57
  }
34
- const K = (e) => {
35
- if (!u(e))
36
- return O(R, "[getNormalizedProps] must be a VNode"), {};
37
- const t = e.props || {}, n = (u(e.type) ? e.type.props : void 0) || {}, r = {};
38
- return Object.keys(n).forEach((o) => {
39
- _(n[o], "default") && (r[o] = n[o].default);
40
- }), Object.keys(t).forEach((o) => {
41
- r[C(o)] = t[o];
42
- }), r;
43
- }, U = (e) => {
44
- if (!E(e) || e.length > 1)
58
+ const getNormalizedProps = (node) => {
59
+ if (!isVNode(node)) {
60
+ debugWarn(SCOPE, "[getNormalizedProps] must be a VNode");
61
+ return {};
62
+ }
63
+ const raw = node.props || {};
64
+ const type = (isVNode(node.type) ? node.type.props : void 0) || {};
65
+ const props = {};
66
+ Object.keys(type).forEach((key) => {
67
+ if (hasOwn(type[key], "default")) {
68
+ props[key] = type[key].default;
69
+ }
70
+ });
71
+ Object.keys(raw).forEach((key) => {
72
+ props[camelize(key)] = raw[key];
73
+ });
74
+ return props;
75
+ };
76
+ const ensureOnlyChild = (children) => {
77
+ if (!isArray(children) || children.length > 1) {
45
78
  throw new Error("expect to receive a single Vue element child");
46
- return e[0];
47
- }, i = (e) => {
48
- const t = E(e) ? e : [e], n = [];
49
- return t.forEach((r) => {
50
- var o;
51
- E(r) ? n.push(...i(r)) : u(r) && E(r.children) ? n.push(...i(r.children)) : (n.push(r), u(r) && ((o = r.component) != null && o.subTree) && n.push(...i(r.component.subTree)));
52
- }), n;
79
+ }
80
+ return children[0];
81
+ };
82
+ const flattedChildren = (children) => {
83
+ const vNodes = isArray(children) ? children : [children];
84
+ const result = [];
85
+ vNodes.forEach((child) => {
86
+ var _a;
87
+ if (isArray(child)) {
88
+ result.push(...flattedChildren(child));
89
+ } else if (isVNode(child) && isArray(child.children)) {
90
+ result.push(...flattedChildren(child.children));
91
+ } else {
92
+ result.push(child);
93
+ if (isVNode(child) && ((_a = child.component) == null ? void 0 : _a.subTree)) {
94
+ result.push(...flattedChildren(child.component.subTree));
95
+ }
96
+ }
97
+ });
98
+ return result;
53
99
  };
54
100
  export {
55
- D as PatchFlags,
56
- U as ensureOnlyChild,
57
- i as flattedChildren,
58
- M as getFirstValidNode,
59
- K as getNormalizedProps,
60
- p as isComment,
61
- f as isFragment,
62
- Y as isTemplate,
63
- G as isText,
64
- H as isValidElementNode,
65
- v as renderBlock,
66
- w as renderIf
101
+ PatchFlags,
102
+ ensureOnlyChild,
103
+ flattedChildren,
104
+ getFirstValidNode,
105
+ getNormalizedProps,
106
+ isComment,
107
+ isFragment,
108
+ isTemplate,
109
+ isText,
110
+ isValidElementNode,
111
+ renderBlock,
112
+ renderIf
67
113
  };
68
114
  //# sourceMappingURL=vnode.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"vnode.js","sources":["../../../../src/components/_util/vue/vnode.ts"],"sourcesContent":["import {\r\n Comment,\r\n Fragment,\r\n Text,\r\n createBlock,\r\n createCommentVNode,\r\n isVNode,\r\n openBlock,\r\n} from 'vue'\r\nimport { camelize } from '../strings'\r\nimport { isArray } from '../types'\r\nimport { hasOwn } from '../objects'\r\nimport { debugWarn } from '../error'\r\nimport type {\r\n VNode,\r\n VNodeArrayChildren,\r\n VNodeChild,\r\n VNodeNormalizedChildren,\r\n} from 'vue'\r\n\r\nconst SCOPE = 'utils/vue/vnode'\r\n\r\nexport enum PatchFlags {\r\n TEXT = 1,\r\n CLASS = 2,\r\n STYLE = 4,\r\n PROPS = 8,\r\n FULL_PROPS = 16,\r\n HYDRATE_EVENTS = 32,\r\n STABLE_FRAGMENT = 64,\r\n KEYED_FRAGMENT = 128,\r\n UNKEYED_FRAGMENT = 256,\r\n NEED_PATCH = 512,\r\n DYNAMIC_SLOTS = 1024,\r\n HOISTED = -1,\r\n BAIL = -2,\r\n}\r\n\r\nexport type VNodeChildAtom = Exclude<VNodeChild, Array<any>>\r\nexport type RawSlots = Exclude<\r\n VNodeNormalizedChildren,\r\n Array<any> | null | string\r\n>\r\n\r\nexport function isFragment(node: VNode): boolean\r\nexport function isFragment(node: unknown): node is VNode\r\nexport function isFragment(node: unknown): node is VNode {\r\n return isVNode(node) && node.type === Fragment\r\n}\r\n\r\nexport function isText(node: VNode): boolean\r\nexport function isText(node: unknown): node is VNode\r\nexport function isText(node: unknown): node is VNode {\r\n return isVNode(node) && node.type === Text\r\n}\r\n\r\nexport function isComment(node: VNode): boolean\r\nexport function isComment(node: unknown): node is VNode\r\nexport function isComment(node: unknown): node is VNode {\r\n return isVNode(node) && node.type === Comment\r\n}\r\n\r\nconst TEMPLATE = 'template'\r\nexport function isTemplate(node: VNode): boolean\r\nexport function isTemplate(node: unknown): node is VNode\r\nexport function isTemplate(node: unknown): node is VNode {\r\n return isVNode(node) && node.type === TEMPLATE\r\n}\r\n\r\n/**\r\n * determine if the element is a valid element type rather than fragments and comment e.g. <template> v-if\r\n * @param node {VNode} node to be tested\r\n */\r\nexport function isValidElementNode(node: VNode): boolean\r\nexport function isValidElementNode(node: unknown): node is VNode\r\nexport function isValidElementNode(node: unknown): node is VNode {\r\n return isVNode(node) && !isFragment(node) && !isComment(node)\r\n}\r\n\r\n/**\r\n * get a valid child node (not fragment nor comment)\r\n * @param node {VNode} node to be searched\r\n * @param depth {number} depth to be searched\r\n */\r\nfunction getChildren(\r\n node: VNodeNormalizedChildren | VNodeChild,\r\n depth: number\r\n): VNodeNormalizedChildren | VNodeChild {\r\n if (isComment(node)) return\r\n if (isFragment(node) || isTemplate(node)) {\r\n return depth > 0 ? getFirstValidNode(node.children, depth - 1) : undefined\r\n }\r\n return node\r\n}\r\n\r\nexport const getFirstValidNode = (\r\n nodes: VNodeNormalizedChildren,\r\n maxDepth = 3\r\n) => {\r\n if (Array.isArray(nodes)) {\r\n return getChildren(nodes[0], maxDepth)\r\n } else {\r\n return getChildren(nodes, maxDepth)\r\n }\r\n}\r\n\r\nexport function renderIf(\r\n condition: boolean,\r\n ...args: Parameters<typeof createBlock>\r\n) {\r\n return condition ? renderBlock(...args) : createCommentVNode('v-if', true)\r\n}\r\n\r\nexport function renderBlock(...args: Parameters<typeof createBlock>) {\r\n return openBlock(), createBlock(...args)\r\n}\r\n\r\nexport const getNormalizedProps = (node: VNode) => {\r\n if (!isVNode(node)) {\r\n debugWarn(SCOPE, '[getNormalizedProps] must be a VNode')\r\n return {}\r\n }\r\n\r\n const raw = node.props || {}\r\n const type = (isVNode(node.type) ? node.type.props : undefined) || {}\r\n const props: Record<string, any> = {}\r\n\r\n Object.keys(type).forEach((key) => {\r\n if (hasOwn(type[key], 'default')) {\r\n props[key] = type[key].default\r\n }\r\n })\r\n\r\n Object.keys(raw).forEach((key) => {\r\n props[camelize(key)] = raw[key]\r\n })\r\n\r\n return props\r\n}\r\n\r\nexport const ensureOnlyChild = (children: VNodeArrayChildren | undefined) => {\r\n if (!isArray(children) || children.length > 1) {\r\n throw new Error('expect to receive a single Vue element child')\r\n }\r\n return children[0]\r\n}\r\n\r\nexport type FlattenVNodes = Array<VNodeChildAtom | RawSlots>\r\n\r\nexport const flattedChildren = (\r\n children: FlattenVNodes | VNode | VNodeNormalizedChildren\r\n): FlattenVNodes => {\r\n const vNodes = isArray(children) ? children : [children]\r\n const result: FlattenVNodes = []\r\n\r\n vNodes.forEach((child) => {\r\n if (isArray(child)) {\r\n result.push(...flattedChildren(child))\r\n } else if (isVNode(child) && isArray(child.children)) {\r\n result.push(...flattedChildren(child.children))\r\n } else {\r\n result.push(child)\r\n if (isVNode(child) && child.component?.subTree) {\r\n result.push(...flattedChildren(child.component.subTree))\r\n }\r\n }\r\n })\r\n return result\r\n}\r\n"],"names":["SCOPE","PatchFlags","isFragment","node","isVNode","Fragment","isText","Text","isComment","Comment","TEMPLATE","isTemplate","isValidElementNode","getChildren","depth","getFirstValidNode","nodes","maxDepth","renderIf","condition","args","renderBlock","createCommentVNode","openBlock","createBlock","getNormalizedProps","debugWarn","raw","type","props","key","hasOwn","camelize","ensureOnlyChild","children","isArray","flattedChildren","vNodes","result","child","_a"],"mappings":";;;;AAoBA,MAAMA,IAAQ;AAEF,IAAAC,sBAAAA,OACVA,EAAAA,EAAA,OAAO,CAAP,IAAA,QACAA,EAAAA,EAAA,QAAQ,CAAR,IAAA,SACAA,EAAAA,EAAA,QAAQ,CAAR,IAAA,SACAA,EAAAA,EAAA,QAAQ,CAAR,IAAA,SACAA,EAAAA,EAAA,aAAa,EAAb,IAAA,cACAA,EAAAA,EAAA,iBAAiB,EAAjB,IAAA,kBACAA,EAAAA,EAAA,kBAAkB,EAAlB,IAAA,mBACAA,EAAAA,EAAA,iBAAiB,GAAjB,IAAA,kBACAA,EAAAA,EAAA,mBAAmB,GAAnB,IAAA,oBACAA,EAAAA,EAAA,aAAa,GAAb,IAAA,cACAA,EAAAA,EAAA,gBAAgB,IAAhB,IAAA,iBACAA,EAAAA,EAAA,UAAU,EAAV,IAAA,WACAA,EAAAA,EAAA,OAAO,EAAP,IAAA,QAbUA,IAAAA,KAAA,CAAA,CAAA;AAwBL,SAASC,EAAWC,GAA8B;AACvD,SAAOC,EAAQD,CAAI,KAAKA,EAAK,SAASE;AACxC;AAIO,SAASC,EAAOH,GAA8B;AACnD,SAAOC,EAAQD,CAAI,KAAKA,EAAK,SAASI;AACxC;AAIO,SAASC,EAAUL,GAA8B;AACtD,SAAOC,EAAQD,CAAI,KAAKA,EAAK,SAASM;AACxC;AAEA,MAAMC,IAAW;AAGV,SAASC,EAAWR,GAA8B;AACvD,SAAOC,EAAQD,CAAI,KAAKA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EAAQD,CAAQ,KAAKA,EAAS,SAAS;AACpC,UAAA,IAAI,MAAM,8CAA8C;AAEhE,SAAOA,EAAS,CAAC;AACnB,GAIaE,IAAkB,CAC7BF,MACkB;AAClB,QAAMG,IAASF,EAAQD,CAAQ,IAAIA,IAAW,CAACA,CAAQ,GACjDI,IAAwB,CAAA;AAEvB,SAAAD,EAAA,QAAQ,CAACE,MAAU;;AACpB,IAAAJ,EAAQI,CAAK,IACfD,EAAO,KAAK,GAAGF,EAAgBG,CAAK,CAAC,IAC5BnC,EAAQmC,CAAK,KAAKJ,EAAQI,EAAM,QAAQ,IACjDD,EAAO,KAAK,GAAGF,EAAgBG,EAAM,QAAQ,CAAC,KAE9CD,EAAO,KAAKC,CAAK,GACbnC,EAAQmC,CAAK,OAAKC,IAAAD,EAAM,cAAN,QAAAC,EAAiB,YACrCF,EAAO,KAAK,GAAGF,EAAgBG,EAAM,UAAU,OAAO,CAAC;AAAA,EAE3D,CACD,GACMD;AACT;"}
1
+ {"version":3,"file":"vnode.js","sources":["../../../../src/components/_util/vue/vnode.ts"],"sourcesContent":["import {\r\n Comment,\r\n Fragment,\r\n Text,\r\n createBlock,\r\n createCommentVNode,\r\n isVNode,\r\n openBlock,\r\n} from 'vue'\r\nimport { camelize } from '../strings'\r\nimport { isArray } from '../types'\r\nimport { hasOwn } from '../objects'\r\nimport { debugWarn } from '../error'\r\nimport type {\r\n VNode,\r\n VNodeArrayChildren,\r\n VNodeChild,\r\n VNodeNormalizedChildren,\r\n} from 'vue'\r\n\r\nconst SCOPE = 'utils/vue/vnode'\r\n\r\nexport enum PatchFlags {\r\n TEXT = 1,\r\n CLASS = 2,\r\n STYLE = 4,\r\n PROPS = 8,\r\n FULL_PROPS = 16,\r\n HYDRATE_EVENTS = 32,\r\n STABLE_FRAGMENT = 64,\r\n KEYED_FRAGMENT = 128,\r\n UNKEYED_FRAGMENT = 256,\r\n NEED_PATCH = 512,\r\n DYNAMIC_SLOTS = 1024,\r\n HOISTED = -1,\r\n BAIL = -2,\r\n}\r\n\r\nexport type VNodeChildAtom = Exclude<VNodeChild, Array<any>>\r\nexport type RawSlots = Exclude<\r\n VNodeNormalizedChildren,\r\n Array<any> | null | string\r\n>\r\n\r\nexport function isFragment(node: VNode): boolean\r\nexport function isFragment(node: unknown): node is VNode\r\nexport function isFragment(node: unknown): node is VNode {\r\n return isVNode(node) && node.type === Fragment\r\n}\r\n\r\nexport function isText(node: VNode): boolean\r\nexport function isText(node: unknown): node is VNode\r\nexport function isText(node: unknown): node is VNode {\r\n return isVNode(node) && node.type === Text\r\n}\r\n\r\nexport function isComment(node: VNode): boolean\r\nexport function isComment(node: unknown): node is VNode\r\nexport function isComment(node: unknown): node is VNode {\r\n return isVNode(node) && node.type === Comment\r\n}\r\n\r\nconst TEMPLATE = 'template'\r\nexport function isTemplate(node: VNode): boolean\r\nexport function isTemplate(node: unknown): node is VNode\r\nexport function isTemplate(node: unknown): node is VNode {\r\n return isVNode(node) && node.type === TEMPLATE\r\n}\r\n\r\n/**\r\n * determine if the element is a valid element type rather than fragments and comment e.g. <template> v-if\r\n * @param node {VNode} node to be tested\r\n */\r\nexport function isValidElementNode(node: VNode): boolean\r\nexport function isValidElementNode(node: unknown): node is VNode\r\nexport function isValidElementNode(node: unknown): node is VNode {\r\n return isVNode(node) && !isFragment(node) && !isComment(node)\r\n}\r\n\r\n/**\r\n * get a valid child node (not fragment nor comment)\r\n * @param node {VNode} node to be searched\r\n * @param depth {number} depth to be searched\r\n */\r\nfunction getChildren(\r\n node: VNodeNormalizedChildren | VNodeChild,\r\n depth: number\r\n): VNodeNormalizedChildren | VNodeChild {\r\n if (isComment(node)) return\r\n if (isFragment(node) || isTemplate(node)) {\r\n return depth > 0 ? getFirstValidNode(node.children, depth - 1) : undefined\r\n }\r\n return node\r\n}\r\n\r\nexport const getFirstValidNode = (\r\n nodes: VNodeNormalizedChildren,\r\n maxDepth = 3\r\n) => {\r\n if (Array.isArray(nodes)) {\r\n return getChildren(nodes[0], maxDepth)\r\n } else {\r\n return getChildren(nodes, maxDepth)\r\n }\r\n}\r\n\r\nexport function renderIf(\r\n condition: boolean,\r\n ...args: Parameters<typeof createBlock>\r\n) {\r\n return condition ? renderBlock(...args) : createCommentVNode('v-if', true)\r\n}\r\n\r\nexport function renderBlock(...args: Parameters<typeof createBlock>) {\r\n return openBlock(), createBlock(...args)\r\n}\r\n\r\nexport const getNormalizedProps = (node: VNode) => {\r\n if (!isVNode(node)) {\r\n debugWarn(SCOPE, '[getNormalizedProps] must be a VNode')\r\n return {}\r\n }\r\n\r\n const raw = node.props || {}\r\n const type = (isVNode(node.type) ? node.type.props : undefined) || {}\r\n const props: Record<string, any> = {}\r\n\r\n Object.keys(type).forEach((key) => {\r\n if (hasOwn(type[key], 'default')) {\r\n props[key] = type[key].default\r\n }\r\n })\r\n\r\n Object.keys(raw).forEach((key) => {\r\n props[camelize(key)] = raw[key]\r\n })\r\n\r\n return props\r\n}\r\n\r\nexport const ensureOnlyChild = (children: VNodeArrayChildren | undefined) => {\r\n if (!isArray(children) || children.length > 1) {\r\n throw new Error('expect to receive a single Vue element child')\r\n }\r\n return children[0]\r\n}\r\n\r\nexport type FlattenVNodes = Array<VNodeChildAtom | RawSlots>\r\n\r\nexport const flattedChildren = (\r\n children: FlattenVNodes | VNode | VNodeNormalizedChildren\r\n): FlattenVNodes => {\r\n const vNodes = isArray(children) ? children : [children]\r\n const result: FlattenVNodes = []\r\n\r\n vNodes.forEach((child) => {\r\n if (isArray(child)) {\r\n result.push(...flattedChildren(child))\r\n } else if (isVNode(child) && isArray(child.children)) {\r\n result.push(...flattedChildren(child.children))\r\n } else {\r\n result.push(child)\r\n if (isVNode(child) && child.component?.subTree) {\r\n result.push(...flattedChildren(child.component.subTree))\r\n }\r\n }\r\n })\r\n return result\r\n}\r\n"],"names":["PatchFlags"],"mappings":";;;;AAoBA,MAAM,QAAQ;AAEF,IAAA,+BAAAA,gBAAL;AACLA,cAAAA,YAAA,UAAO,CAAP,IAAA;AACAA,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