orion-design 0.1.29 → 0.1.31
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Throne/index.js +30 -14
- package/dist/Throne/index.js.map +1 -1
- package/dist/_commonjsHelpers-DWwsNxpa.js +9 -0
- package/dist/_commonjsHelpers-DWwsNxpa.js.map +1 -0
- package/dist/components/Button/index.js +40 -33
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Flex/index.js +122 -89
- package/dist/components/Flex/index.js.map +1 -1
- package/dist/components/Form/Form.js +2 -2
- package/dist/components/Form/Form.js.map +1 -1
- package/dist/components/Form/LovInput/LovInput.js +2 -2
- package/dist/components/Form/LovInput/LovInput.js.map +1 -1
- package/dist/components/Form/LovInput/hooks/useLov.js +5 -5
- package/dist/components/Form/LovInput/hooks/useLov.js.map +1 -1
- package/dist/components/Form/LovInput/index.js +4 -4
- package/dist/components/Form/hooks/FormItemValidateTrigger.js +2 -2
- package/dist/components/Form/hooks/FormItemValidateTrigger.js.map +1 -1
- package/dist/components/Form/hooks/index.js +128 -66
- package/dist/components/Form/hooks/index.js.map +1 -1
- package/dist/components/Form/index.js +836 -656
- package/dist/components/Form/index.js.map +1 -1
- package/dist/components/Form/utils/index.js +30 -18
- package/dist/components/Form/utils/index.js.map +1 -1
- package/dist/components/LovTable/LovPagetable.vue.d.ts +28 -0
- package/dist/components/LovTable/index.d.ts +14 -0
- package/dist/components/LovTable/index.js +179 -105
- package/dist/components/LovTable/index.js.map +1 -1
- package/dist/components/Modal/Modal.d.ts +2 -0
- package/dist/components/Modal/ModalLocator.vue.d.ts +20 -0
- package/dist/components/Modal/index.d.ts +4 -1
- package/dist/components/Modal/index.js +127 -0
- package/dist/components/Modal/index.js.map +1 -0
- package/dist/components/Modal/types.d.ts +18 -0
- package/dist/components/Modal/types.js +7 -0
- package/dist/components/Modal/types.js.map +1 -0
- package/dist/components/Modal/useModal.d.ts +1 -3
- package/dist/components/Modal/useModal.js +5 -4
- package/dist/components/Modal/useModal.js.map +1 -1
- package/dist/components/Pagetable/Pagetable.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnButtongroup.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnDate.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnDiy.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnLink.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnMultiselect.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnNumber.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnSingleselect.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnString.d.ts +13 -0
- package/dist/components/Pagetable/hooks/useColumns.js +88 -74
- package/dist/components/Pagetable/hooks/useColumns.js.map +1 -1
- package/dist/components/Pagetable/index.d.ts +9 -0
- package/dist/components/Pagetable/index.js +697 -491
- package/dist/components/Pagetable/index.js.map +1 -1
- package/dist/components/Pagetable/utils/index.js +92 -54
- package/dist/components/Pagetable/utils/index.js.map +1 -1
- package/dist/components/Querytable/hooks/useColumns.js +82 -74
- package/dist/components/Querytable/hooks/useColumns.js.map +1 -1
- package/dist/components/Querytable/index.js +579 -469
- package/dist/components/Querytable/index.js.map +1 -1
- package/dist/components/Querytable/utils/index.js +92 -54
- package/dist/components/Querytable/utils/index.js.map +1 -1
- package/dist/components/RichTextEditor/index.js +100 -74
- package/dist/components/RichTextEditor/index.js.map +1 -1
- package/dist/components/Tabs/constants.js +2 -2
- package/dist/components/Tabs/constants.js.map +1 -1
- package/dist/components/Tabs/index.js +603 -358
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/Tabs/tab-bar.js +6 -6
- package/dist/components/Tabs/tab-bar.js.map +1 -1
- package/dist/components/Tabs/tab-pane.js +3 -3
- package/dist/components/Tabs/tab-pane.js.map +1 -1
- package/dist/components/_constants/aria.js +2 -2
- package/dist/components/_constants/aria.js.map +1 -1
- package/dist/components/_constants/event.js +6 -4
- package/dist/components/_constants/event.js.map +1 -1
- package/dist/components/_constants/index.js +6 -6
- package/dist/components/_hooks/index.js +7 -7
- package/dist/components/_hooks/use-namespace/index.js +74 -39
- package/dist/components/_hooks/use-namespace/index.js.map +1 -1
- package/dist/components/_hooks/use-ordered-children/index.js +29 -19
- package/dist/components/_hooks/use-ordered-children/index.js.map +1 -1
- package/dist/components/_util/arrays.js +9 -5
- package/dist/components/_util/arrays.js.map +1 -1
- package/dist/components/_util/browser.js +6 -6
- package/dist/components/_util/browser.js.map +1 -1
- package/dist/components/_util/classNames.js +22 -17
- package/dist/components/_util/classNames.js.map +1 -1
- package/dist/components/_util/dom/aria.js +74 -39
- package/dist/components/_util/dom/aria.js.map +1 -1
- package/dist/components/_util/dom/element.js +9 -8
- package/dist/components/_util/dom/element.js.map +1 -1
- package/dist/components/_util/dom/event.js +14 -7
- package/dist/components/_util/dom/event.js.map +1 -1
- package/dist/components/_util/dom/index.js +36 -36
- package/dist/components/_util/dom/position.js +49 -25
- package/dist/components/_util/dom/position.js.map +1 -1
- package/dist/components/_util/dom/scroll.js +103 -61
- package/dist/components/_util/dom/scroll.js.map +1 -1
- package/dist/components/_util/dom/style.js +65 -50
- package/dist/components/_util/dom/style.js.map +1 -1
- package/dist/components/_util/easings.js +8 -4
- package/dist/components/_util/easings.js.map +1 -1
- package/dist/components/_util/error.js +12 -11
- package/dist/components/_util/error.js.map +1 -1
- package/dist/components/_util/functions.js +3 -3
- package/dist/components/_util/i18n.js +2 -2
- package/dist/components/_util/i18n.js.map +1 -1
- package/dist/components/_util/index.js +137 -137
- package/dist/components/_util/isValid.js +4 -2
- package/dist/components/_util/isValid.js.map +1 -1
- package/dist/components/_util/objects.js +18 -14
- package/dist/components/_util/objects.js.map +1 -1
- package/dist/components/_util/props-util/index.js +46 -20
- package/dist/components/_util/props-util/index.js.map +1 -1
- package/dist/components/_util/props-util/initDefaultProps.js +18 -10
- package/dist/components/_util/props-util/initDefaultProps.js.map +1 -1
- package/dist/components/_util/raf.js +5 -4
- package/dist/components/_util/raf.js.map +1 -1
- package/dist/components/_util/rand.js +4 -3
- package/dist/components/_util/rand.js.map +1 -1
- package/dist/components/_util/strings.js +9 -8
- package/dist/components/_util/strings.js.map +1 -1
- package/dist/components/_util/throttleByRaf.js +16 -10
- package/dist/components/_util/throttleByRaf.js.map +1 -1
- package/dist/components/_util/type.js +41 -38
- package/dist/components/_util/type.js.map +1 -1
- package/dist/components/_util/types.js +41 -22
- package/dist/components/_util/types.js.map +1 -1
- package/dist/components/_util/typescript.js +2 -2
- package/dist/components/_util/typescript.js.map +1 -1
- package/dist/components/_util/util.js +85 -43
- package/dist/components/_util/util.js.map +1 -1
- package/dist/components/_util/vue/global-node.js +27 -15
- package/dist/components/_util/vue/global-node.js.map +1 -1
- package/dist/components/_util/vue/icon.js +29 -25
- package/dist/components/_util/vue/icon.js.map +1 -1
- package/dist/components/_util/vue/index.js +41 -41
- package/dist/components/_util/vue/install.js +35 -18
- package/dist/components/_util/vue/install.js.map +1 -1
- package/dist/components/_util/vue/props/index.js +6 -6
- package/dist/components/_util/vue/props/runtime.js +46 -30
- package/dist/components/_util/vue/props/runtime.js.map +1 -1
- package/dist/components/_util/vue/refs.js +12 -6
- package/dist/components/_util/vue/refs.js.map +1 -1
- package/dist/components/_util/vue/size.js +5 -3
- package/dist/components/_util/vue/size.js.map +1 -1
- package/dist/components/_util/vue/validator.js +5 -4
- package/dist/components/_util/vue/validator.js.map +1 -1
- package/dist/components/_util/vue/vnode.js +100 -54
- package/dist/components/_util/vue/vnode.js.map +1 -1
- package/dist/components/_util/vue-types/index.js +231 -220
- package/dist/components/_util/vue-types/index.js.map +1 -1
- package/dist/components/components.js +20 -20
- package/dist/components/index.js +38 -35
- package/dist/components/index.js.map +1 -1
- package/dist/components-8oZ2kpUC.js +27 -0
- package/dist/components-8oZ2kpUC.js.map +1 -0
- package/dist/components-B3d9m_tn.js +27 -0
- package/dist/components-B3d9m_tn.js.map +1 -0
- package/dist/error/OrionError.js +8 -4
- package/dist/error/OrionError.js.map +1 -1
- package/dist/functions-BeMkokbY.js +63 -0
- package/dist/functions-BeMkokbY.js.map +1 -0
- package/dist/index-BOKLZnqH.js +54 -0
- package/dist/index-BOKLZnqH.js.map +1 -0
- package/dist/index-D1m0KTpK.js +69 -0
- package/dist/index-D1m0KTpK.js.map +1 -0
- package/dist/index-DR5ZP7mD.js +160 -0
- package/dist/index-DR5ZP7mD.js.map +1 -0
- package/dist/index-DkwIULcN.js +200 -0
- package/dist/index-DkwIULcN.js.map +1 -0
- package/dist/index.css +797 -1
- package/dist/index.js +36 -36
- package/dist/print/LodopFuncs.js +101 -43
- package/dist/print/LodopFuncs.js.map +1 -1
- package/dist/print/index.js +200 -108
- package/dist/print/index.js.map +1 -1
- package/dist/request/ErrorHandlerChain.js +17 -14
- package/dist/request/ErrorHandlerChain.js.map +1 -1
- package/dist/request/RequestFilterChain.js +16 -13
- package/dist/request/RequestFilterChain.js.map +1 -1
- package/dist/request/ResponseParserChain.js +17 -14
- package/dist/request/ResponseParserChain.js.map +1 -1
- package/dist/request/disivion/DateSerializer.js +47 -22
- package/dist/request/disivion/DateSerializer.js.map +1 -1
- package/dist/request/disivion/DivisionErrorHandler.js +40 -25
- package/dist/request/disivion/DivisionErrorHandler.js.map +1 -1
- package/dist/request/disivion/DivisionResponseParser.js +16 -10
- package/dist/request/disivion/DivisionResponseParser.js.map +1 -1
- package/dist/request/disivion/index.js +305 -201
- package/dist/request/disivion/index.js.map +1 -1
- package/dist/request/error/BizExceptionResponseError.js +11 -5
- package/dist/request/error/BizExceptionResponseError.js.map +1 -1
- package/dist/request/error/ExceptionResponseError.js +11 -5
- package/dist/request/error/ExceptionResponseError.js.map +1 -1
- package/dist/request/error/ResponseError.js +9 -4
- package/dist/request/error/ResponseError.js.map +1 -1
- package/dist/request/error/SessionExceptionResponseError.js +11 -5
- package/dist/request/error/SessionExceptionResponseError.js.map +1 -1
- package/dist/request/index.js +11 -11
- package/dist/utils/DateUtil.js +48 -33
- package/dist/utils/DateUtil.js.map +1 -1
- package/dist/utils/NumberUtil.js +6 -6
- package/dist/utils/NumberUtil.js.map +1 -1
- package/dist/utils/cloneDeep.js +2 -2
- package/dist/utils/delay.js +3 -3
- package/dist/utils/delay.js.map +1 -1
- package/dist/utils/functions.js +3 -3
- package/dist/utils/index.js +12 -12
- package/dist/utils/md5.js +191 -93
- package/dist/utils/md5.js.map +1 -1
- package/dist/utils/uuid.js +35 -25
- package/dist/utils/uuid.js.map +1 -1
- package/dist/version/index.js +2 -2
- package/dist/version/version.d.ts +1 -1
- package/dist/version/version.js +2 -2
- package/dist/version/version.js.map +1 -1
- package/package.json +1 -1
- package/dist/components-J6-qau6Y.js +0 -73
- package/dist/components-J6-qau6Y.js.map +0 -1
@@ -1,68 +1,114 @@
|
|
1
|
-
import { isVNode
|
2
|
-
import { h as
|
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
|
5
|
-
const
|
6
|
-
var
|
7
|
-
|
8
|
-
|
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
|
11
|
-
return
|
25
|
+
function isText(node) {
|
26
|
+
return isVNode(node) && node.type === Text;
|
12
27
|
}
|
13
|
-
function
|
14
|
-
return
|
28
|
+
function isComment(node) {
|
29
|
+
return isVNode(node) && node.type === Comment;
|
15
30
|
}
|
16
|
-
const
|
17
|
-
function
|
18
|
-
return
|
31
|
+
const TEMPLATE = "template";
|
32
|
+
function isTemplate(node) {
|
33
|
+
return isVNode(node) && node.type === TEMPLATE;
|
19
34
|
}
|
20
|
-
function
|
21
|
-
return
|
35
|
+
function isValidElementNode(node) {
|
36
|
+
return isVNode(node) && !isFragment(node) && !isComment(node);
|
22
37
|
}
|
23
|
-
function
|
24
|
-
if (
|
25
|
-
|
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
|
28
|
-
|
29
|
-
|
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
|
32
|
-
return
|
55
|
+
function renderBlock(...args) {
|
56
|
+
return openBlock(), createBlock(...args);
|
33
57
|
}
|
34
|
-
const
|
35
|
-
if (!
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
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
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
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
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
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 {\n Comment,\n Fragment,\n Text,\n createBlock,\n createCommentVNode,\n isVNode,\n openBlock,\n} from 'vue'\nimport { camelize } from '../strings'\nimport { isArray } from '../types'\nimport { hasOwn } from '../objects'\nimport { debugWarn } from '../error'\nimport type {\n VNode,\n VNodeArrayChildren,\n VNodeChild,\n VNodeNormalizedChildren,\n} from 'vue'\n\nconst SCOPE = 'utils/vue/vnode'\n\nexport enum PatchFlags {\n TEXT = 1,\n CLASS = 2,\n STYLE = 4,\n PROPS = 8,\n FULL_PROPS = 16,\n HYDRATE_EVENTS = 32,\n STABLE_FRAGMENT = 64,\n KEYED_FRAGMENT = 128,\n UNKEYED_FRAGMENT = 256,\n NEED_PATCH = 512,\n DYNAMIC_SLOTS = 1024,\n HOISTED = -1,\n BAIL = -2,\n}\n\nexport type VNodeChildAtom = Exclude<VNodeChild, Array<any>>\nexport type RawSlots = Exclude<\n VNodeNormalizedChildren,\n Array<any> | null | string\n>\n\nexport function isFragment(node: VNode): boolean\nexport function isFragment(node: unknown): node is VNode\nexport function isFragment(node: unknown): node is VNode {\n return isVNode(node) && node.type === Fragment\n}\n\nexport function isText(node: VNode): boolean\nexport function isText(node: unknown): node is VNode\nexport function isText(node: unknown): node is VNode {\n return isVNode(node) && node.type === Text\n}\n\nexport function isComment(node: VNode): boolean\nexport function isComment(node: unknown): node is VNode\nexport function isComment(node: unknown): node is VNode {\n return isVNode(node) && node.type === Comment\n}\n\nconst TEMPLATE = 'template'\nexport function isTemplate(node: VNode): boolean\nexport function isTemplate(node: unknown): node is VNode\nexport function isTemplate(node: unknown): node is VNode {\n return isVNode(node) && node.type === TEMPLATE\n}\n\n/**\n * determine if the element is a valid element type rather than fragments and comment e.g. <template> v-if\n * @param node {VNode} node to be tested\n */\nexport function isValidElementNode(node: VNode): boolean\nexport function isValidElementNode(node: unknown): node is VNode\nexport function isValidElementNode(node: unknown): node is VNode {\n return isVNode(node) && !isFragment(node) && !isComment(node)\n}\n\n/**\n * get a valid child node (not fragment nor comment)\n * @param node {VNode} node to be searched\n * @param depth {number} depth to be searched\n */\nfunction getChildren(\n node: VNodeNormalizedChildren | VNodeChild,\n depth: number\n): VNodeNormalizedChildren | VNodeChild {\n if (isComment(node)) return\n if (isFragment(node) || isTemplate(node)) {\n return depth > 0 ? getFirstValidNode(node.children, depth - 1) : undefined\n }\n return node\n}\n\nexport const getFirstValidNode = (\n nodes: VNodeNormalizedChildren,\n maxDepth = 3\n) => {\n if (Array.isArray(nodes)) {\n return getChildren(nodes[0], maxDepth)\n } else {\n return getChildren(nodes, maxDepth)\n }\n}\n\nexport function renderIf(\n condition: boolean,\n ...args: Parameters<typeof createBlock>\n) {\n return condition ? renderBlock(...args) : createCommentVNode('v-if', true)\n}\n\nexport function renderBlock(...args: Parameters<typeof createBlock>) {\n return openBlock(), createBlock(...args)\n}\n\nexport const getNormalizedProps = (node: VNode) => {\n if (!isVNode(node)) {\n debugWarn(SCOPE, '[getNormalizedProps] must be a VNode')\n return {}\n }\n\n const raw = node.props || {}\n const type = (isVNode(node.type) ? node.type.props : undefined) || {}\n const props: Record<string, any> = {}\n\n Object.keys(type).forEach((key) => {\n if (hasOwn(type[key], 'default')) {\n props[key] = type[key].default\n }\n })\n\n Object.keys(raw).forEach((key) => {\n props[camelize(key)] = raw[key]\n })\n\n return props\n}\n\nexport const ensureOnlyChild = (children: VNodeArrayChildren | undefined) => {\n if (!isArray(children) || children.length > 1) {\n throw new Error('expect to receive a single Vue element child')\n }\n return children[0]\n}\n\nexport type FlattenVNodes = Array<VNodeChildAtom | RawSlots>\n\nexport const flattedChildren = (\n children: FlattenVNodes | VNode | VNodeNormalizedChildren\n): FlattenVNodes => {\n const vNodes = isArray(children) ? children : [children]\n const result: FlattenVNodes = []\n\n vNodes.forEach((child) => {\n if (isArray(child)) {\n result.push(...flattedChildren(child))\n } else if (isVNode(child) && isArray(child.children)) {\n result.push(...flattedChildren(child.children))\n } else {\n result.push(child)\n if (isVNode(child) && child.component?.subTree) {\n result.push(...flattedChildren(child.component.subTree))\n }\n }\n })\n return result\n}\n"],"names":["
|
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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