orion-design 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +5 -0
- package/dist/components/Button/Button.vue.d.ts +2 -0
- package/dist/components/Button/index.d.ts +4 -0
- package/dist/components/Button/index.js +27 -0
- package/dist/components/Button/index.js.map +1 -0
- package/dist/components/Flex/Col.d.ts +4 -4
- package/dist/components/Flex/Item.d.ts +4 -4
- package/dist/components/Flex/Row.d.ts +4 -4
- package/dist/components/Flex/index.d.ts +4 -4
- package/dist/components/Flex/index.js +95 -127
- package/dist/components/Flex/index.js.map +1 -0
- package/dist/components/Form/Form.d.ts +21 -0
- package/dist/components/Form/Form.js +5 -0
- package/dist/components/Form/Form.js.map +1 -0
- package/dist/components/Form/Form.vue.d.ts +465 -0
- package/dist/components/Form/PasswordInput/PasswordInput.d.ts +15 -0
- package/dist/components/Form/PasswordInput/PasswordInput.js +2 -0
- package/dist/components/Form/PasswordInput/PasswordInput.js.map +1 -0
- package/dist/components/Form/PasswordInput/PasswordInput.vue.d.ts +3 -0
- package/dist/components/Form/PasswordInput/index.d.ts +1 -0
- package/dist/components/Form/PasswordInput/index.js +2 -0
- package/dist/components/Form/PasswordInput/index.js.map +1 -0
- package/dist/components/Form/StringInput/StringInput.d.ts +15 -0
- package/dist/components/Form/StringInput/StringInput.js +2 -0
- package/dist/components/Form/StringInput/StringInput.js.map +1 -0
- package/dist/components/Form/StringInput/StringInput.vue.d.ts +3 -0
- package/dist/components/Form/StringInput/index.d.ts +1 -0
- package/dist/components/Form/StringInput/index.js +2 -0
- package/dist/components/Form/StringInput/index.js.map +1 -0
- package/dist/components/Form/Textarea/Textarea.d.ts +16 -0
- package/dist/components/Form/Textarea/Textarea.js +2 -0
- package/dist/components/Form/Textarea/Textarea.js.map +1 -0
- package/dist/components/Form/Textarea/Textarea.vue.d.ts +3 -0
- package/dist/components/Form/Textarea/index.d.ts +1 -0
- package/dist/components/Form/Textarea/index.js +2 -0
- package/dist/components/Form/Textarea/index.js.map +1 -0
- package/dist/components/Form/hooks/useForm.d.ts +4 -0
- package/dist/components/Form/hooks/useForm.js +21 -0
- package/dist/components/Form/hooks/useForm.js.map +1 -0
- package/dist/components/Form/index.d.ts +273 -0
- package/dist/components/Form/index.js +194 -0
- package/dist/components/Form/index.js.map +1 -0
- package/dist/components/Modal/index.d.ts +1 -14
- package/dist/components/Modal/useModal.d.ts +1 -1
- package/dist/components/Modal/useModal.js +7 -7
- package/dist/components/Modal/useModal.js.map +1 -0
- package/dist/components/Pagetable/Pagetable.d.ts +79 -0
- package/dist/components/Pagetable/columns/PagetableDatecolumn.d.ts +88 -0
- package/dist/components/Pagetable/columns/PagetableStringcolumn.d.ts +62 -0
- package/dist/components/Pagetable/index.d.ts +60 -0
- package/dist/components/Pagetable/index.js +144 -0
- package/dist/components/Pagetable/index.js.map +1 -0
- package/dist/components/Pagetable/interface.d.ts +10 -0
- package/dist/components/Pagetable/interface.js +2 -0
- package/dist/components/Pagetable/interface.js.map +1 -0
- package/dist/components/Space/index.d.ts +9 -9
- package/dist/components/_util/arrays.d.ts +5 -0
- package/dist/components/_util/arrays.js +8 -0
- package/dist/components/_util/arrays.js.map +1 -0
- package/dist/components/_util/browser.d.ts +3 -0
- package/dist/components/_util/browser.js +9 -0
- package/dist/components/_util/browser.js.map +1 -0
- package/dist/components/_util/classNames.js +20 -27
- package/dist/components/_util/classNames.js.map +1 -0
- package/dist/components/_util/dom/aria.d.ts +30 -0
- package/dist/components/_util/dom/aria.js +46 -0
- package/dist/components/_util/dom/aria.js.map +1 -0
- package/dist/components/_util/dom/element.d.ts +3 -0
- package/dist/components/_util/dom/element.js +18 -0
- package/dist/components/_util/dom/element.js.map +1 -0
- package/dist/components/_util/dom/event.d.ts +6 -0
- package/dist/components/_util/dom/event.js +10 -0
- package/dist/components/_util/dom/event.js.map +1 -0
- package/dist/components/_util/dom/index.d.ts +6 -0
- package/dist/components/_util/dom/index.js +39 -0
- package/dist/components/_util/dom/index.js.map +1 -0
- package/dist/components/_util/dom/position.d.ts +7 -0
- package/dist/components/_util/dom/position.js +30 -0
- package/dist/components/_util/dom/position.js.map +1 -0
- package/dist/components/_util/dom/scroll.d.ts +11 -0
- package/dist/components/_util/dom/scroll.js +78 -0
- package/dist/components/_util/dom/scroll.js.map +1 -0
- package/dist/components/_util/dom/style.d.ts +9 -0
- package/dist/components/_util/dom/style.js +58 -0
- package/dist/components/_util/dom/style.js.map +1 -0
- package/dist/components/_util/easings.d.ts +1 -0
- package/dist/components/_util/easings.js +8 -0
- package/dist/components/_util/easings.js.map +1 -0
- package/dist/components/_util/error.d.ts +3 -0
- package/dist/components/_util/error.js +22 -0
- package/dist/components/_util/error.js.map +1 -0
- package/dist/components/_util/functions.d.ts +1 -0
- package/dist/components/_util/functions.js +6 -0
- package/dist/components/_util/functions.js.map +1 -0
- package/dist/components/_util/i18n.d.ts +1 -0
- package/dist/components/_util/i18n.js +5 -0
- package/dist/components/_util/i18n.js.map +1 -0
- package/dist/components/_util/index.d.ts +15 -0
- package/dist/components/_util/index.js +140 -0
- package/dist/components/_util/index.js.map +1 -0
- package/dist/components/_util/isValid.js +4 -4
- package/dist/components/_util/isValid.js.map +1 -0
- package/dist/components/_util/objects.d.ts +8 -0
- package/dist/components/_util/objects.js +17 -0
- package/dist/components/_util/objects.js.map +1 -0
- package/dist/components/_util/props-util/index.d.ts +4 -4
- package/dist/components/_util/props-util/index.js +23 -50
- package/dist/components/_util/props-util/index.js.map +1 -0
- package/dist/components/_util/props-util/initDefaultProps.d.ts +2 -2
- package/dist/components/_util/props-util/initDefaultProps.js +13 -24
- package/dist/components/_util/props-util/initDefaultProps.js.map +1 -0
- package/dist/components/_util/raf.d.ts +2 -0
- package/dist/components/_util/raf.js +7 -0
- package/dist/components/_util/raf.js.map +1 -0
- package/dist/components/_util/rand.d.ts +12 -0
- package/dist/components/_util/rand.js +6 -0
- package/dist/components/_util/rand.js.map +1 -0
- package/dist/components/_util/strings.d.ts +6 -0
- package/dist/components/_util/strings.js +11 -0
- package/dist/components/_util/strings.js.map +1 -0
- package/dist/components/_util/throttleByRaf.d.ts +4 -0
- package/dist/components/_util/throttleByRaf.js +16 -0
- package/dist/components/_util/throttleByRaf.js.map +1 -0
- package/dist/components/_util/type.d.ts +1 -1
- package/dist/components/_util/type.js +48 -65
- package/dist/components/_util/type.js.map +1 -0
- package/dist/components/_util/types.d.ts +10 -0
- package/dist/components/_util/types.js +25 -0
- package/dist/components/_util/types.js.map +1 -0
- package/dist/components/_util/typescript.d.ts +12 -0
- package/dist/components/_util/typescript.js +5 -0
- package/dist/components/_util/typescript.js.map +1 -0
- package/dist/components/_util/util.d.ts +1 -1
- package/dist/components/_util/util.js +46 -74
- package/dist/components/_util/util.js.map +1 -0
- package/dist/components/_util/vue/global-node.d.ts +3 -0
- package/dist/components/_util/vue/global-node.js +21 -0
- package/dist/components/_util/vue/global-node.js.map +1 -0
- package/dist/components/_util/vue/icon.d.ts +23 -0
- package/dist/components/_util/vue/icon.js +154 -0
- package/dist/components/_util/vue/icon.js.map +1 -0
- package/dist/components/_util/vue/index.d.ts +9 -0
- package/dist/components/_util/vue/index.js +44 -0
- package/dist/components/_util/vue/index.js.map +1 -0
- package/dist/components/_util/vue/install.d.ts +6 -0
- package/dist/components/_util/vue/install.js +21 -0
- package/dist/components/_util/vue/install.js.map +1 -0
- package/dist/components/_util/vue/props/index.d.ts +3 -0
- package/dist/components/_util/vue/props/index.js +9 -0
- package/dist/components/_util/vue/props/index.js.map +1 -0
- package/dist/components/_util/vue/props/runtime.d.ts +29 -0
- package/dist/components/_util/vue/props/runtime.js +37 -0
- package/dist/components/_util/vue/props/runtime.js.map +1 -0
- package/dist/components/_util/vue/props/types.d.ts +120 -0
- package/dist/components/_util/vue/props/types.js +2 -0
- package/dist/components/_util/vue/props/types.js.map +1 -0
- package/dist/components/_util/vue/props/util.d.ts +8 -0
- package/dist/components/_util/vue/props/util.js +2 -0
- package/dist/components/_util/vue/props/util.js.map +1 -0
- package/dist/components/_util/vue/refs.d.ts +3 -0
- package/dist/components/_util/vue/refs.js +12 -0
- package/dist/components/_util/vue/refs.js.map +1 -0
- package/dist/components/_util/vue/size.d.ts +2 -0
- package/dist/components/_util/vue/size.js +6 -0
- package/dist/components/_util/vue/size.js.map +1 -0
- package/dist/components/_util/vue/typescript.d.ts +5 -0
- package/dist/components/_util/vue/typescript.js +2 -0
- package/dist/components/_util/vue/typescript.js.map +1 -0
- package/dist/components/_util/vue/validator.d.ts +3 -0
- package/dist/components/_util/vue/validator.js +7 -0
- package/dist/components/_util/vue/validator.js.map +1 -0
- package/dist/components/_util/vue/vnode.d.ts +50 -0
- package/dist/components/_util/vue/vnode.js +68 -0
- package/dist/components/_util/vue/vnode.js.map +1 -0
- package/dist/components/_util/vue-types/index.d.ts +3 -3
- package/dist/components/_util/vue-types/index.js +275 -417
- package/dist/components/_util/vue-types/index.js.map +1 -0
- package/dist/components/components.d.ts +4 -0
- package/dist/components/components.js +18 -12
- package/dist/components/components.js.map +1 -0
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +25 -24
- package/dist/components/index.js.map +1 -0
- package/dist/components-BZukhWDk.js +106 -0
- package/dist/components-BZukhWDk.js.map +1 -0
- package/dist/error/OrionError.js +7 -12
- package/dist/error/OrionError.js.map +1 -0
- package/dist/functions-DzLqXvGt.js +33 -0
- package/dist/functions-DzLqXvGt.js.map +1 -0
- package/dist/index-C8JNJPWW.js +8 -0
- package/dist/index-C8JNJPWW.js.map +1 -0
- package/dist/index.css +1 -44
- package/dist/index.d.ts +1 -1
- package/dist/index.js +24 -14
- package/dist/index.js.map +1 -0
- package/dist/print/LodopFuncs.js +48 -111
- package/dist/print/LodopFuncs.js.map +1 -0
- package/dist/print/index.d.ts +2 -2
- package/dist/print/index.js +111 -220
- package/dist/print/index.js.map +1 -0
- package/dist/request/ErrorHandlerChain.js +17 -15
- package/dist/request/ErrorHandlerChain.js.map +1 -0
- package/dist/request/RequestFilterChain.d.ts +1 -1
- package/dist/request/RequestFilterChain.js +16 -14
- package/dist/request/RequestFilterChain.js.map +1 -0
- package/dist/request/ResponseParserChain.d.ts +1 -1
- package/dist/request/ResponseParserChain.js +17 -15
- package/dist/request/ResponseParserChain.js.map +1 -0
- package/dist/request/disivion/DateSerializer.js +25 -46
- package/dist/request/disivion/DateSerializer.js.map +1 -0
- package/dist/request/disivion/DivisionErrorHandler.d.ts +1 -1
- package/dist/request/disivion/DivisionErrorHandler.js +30 -52
- package/dist/request/disivion/DivisionErrorHandler.js.map +1 -0
- package/dist/request/disivion/DivisionResponseParser.d.ts +2 -2
- package/dist/request/disivion/DivisionResponseParser.js +13 -25
- package/dist/request/disivion/DivisionResponseParser.js.map +1 -0
- package/dist/request/disivion/index.d.ts +3 -3
- package/dist/request/disivion/index.js +230 -480
- package/dist/request/disivion/index.js.map +1 -0
- package/dist/request/error/BizExceptionResponseError.d.ts +2 -2
- package/dist/request/error/BizExceptionResponseError.js +8 -15
- package/dist/request/error/BizExceptionResponseError.js.map +1 -0
- package/dist/request/error/ExceptionResponseError.d.ts +2 -2
- package/dist/request/error/ExceptionResponseError.js +8 -15
- package/dist/request/error/ExceptionResponseError.js.map +1 -0
- package/dist/request/error/ResponseError.d.ts +1 -1
- package/dist/request/error/ResponseError.js +7 -14
- package/dist/request/error/ResponseError.js.map +1 -0
- package/dist/request/error/SessionExceptionResponseError.d.ts +2 -2
- package/dist/request/error/SessionExceptionResponseError.js +8 -15
- package/dist/request/error/SessionExceptionResponseError.js.map +1 -0
- package/dist/request/index.js +11 -17
- package/dist/request/index.js.map +1 -0
- package/dist/style/index.d.ts +0 -3
- package/dist/style/index.js +1 -0
- package/dist/style/index.js.map +1 -0
- package/dist/utils/DateUtil.js +36 -50
- package/dist/utils/DateUtil.js.map +1 -0
- package/dist/utils/NumberUtil.js +9 -8
- package/dist/utils/NumberUtil.js.map +1 -0
- package/dist/utils/cloneDeep.js +5 -1
- package/dist/utils/cloneDeep.js.map +1 -0
- package/dist/utils/delay.js +6 -4
- package/dist/utils/delay.js.map +1 -0
- package/dist/utils/functions.d.ts +1 -0
- package/dist/utils/functions.js +6 -0
- package/dist/utils/functions.js.map +1 -0
- package/dist/utils/index.js +15 -9
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/md5.js +121 -244
- package/dist/utils/md5.js.map +1 -0
- package/dist/utils/uuid.js +28 -58
- package/dist/utils/uuid.js.map +1 -0
- package/dist/utils/vue/install.d.ts +6 -0
- package/dist/utils/vue/install.js +21 -0
- package/dist/utils/vue/install.js.map +1 -0
- package/dist/utils/vue/typescript.d.ts +5 -0
- package/dist/utils/vue/typescript.js +2 -0
- package/dist/utils/vue/typescript.js.map +1 -0
- package/dist/version/index.d.ts +1 -1
- package/dist/version/index.js +5 -6
- package/dist/version/index.js.map +1 -0
- package/dist/version/version.d.ts +1 -1
- package/dist/version/version.js +5 -3
- package/dist/version/version.js.map +1 -0
- package/dist/vite.svg +1 -0
- package/global.d.ts +6 -0
- package/package.json +52 -63
- package/dist/components-BTX5S_6V.js +0 -128
@@ -0,0 +1,44 @@
|
|
1
|
+
import { changeGlobalNodesTarget as t, createGlobalNode as r, removeGlobalNode as p } from "./global-node.js";
|
2
|
+
import { CloseComponents as l, TypeComponents as n, TypeComponentsMap as a, ValidateComponentsMap as s, iconPropType as m } from "./icon.js";
|
3
|
+
import { withInstall as f, withInstallDirective as C, withInstallFunction as c, withNoopInstall as x } from "./install.js";
|
4
|
+
import { buildProp as h, buildProps as T, definePropType as g, epPropKey as y, isEpProp as N } from "./props/runtime.js";
|
5
|
+
import { composeRefs as I } from "./refs.js";
|
6
|
+
import { getComponentSize as u } from "./size.js";
|
7
|
+
import { isValidComponentSize as F, isValidDatePickType as z } from "./validator.js";
|
8
|
+
import { PatchFlags as k, ensureOnlyChild as v, flattedChildren as D, getFirstValidNode as E, getNormalizedProps as M, isComment as S, isFragment as B, isTemplate as K, isText as O, isValidElementNode as R, renderBlock as j, renderIf as q } from "./vnode.js";
|
9
|
+
export {
|
10
|
+
l as CloseComponents,
|
11
|
+
k as PatchFlags,
|
12
|
+
n as TypeComponents,
|
13
|
+
a as TypeComponentsMap,
|
14
|
+
s as ValidateComponentsMap,
|
15
|
+
h as buildProp,
|
16
|
+
T as buildProps,
|
17
|
+
t as changeGlobalNodesTarget,
|
18
|
+
I as composeRefs,
|
19
|
+
r as createGlobalNode,
|
20
|
+
g as definePropType,
|
21
|
+
v as ensureOnlyChild,
|
22
|
+
y as epPropKey,
|
23
|
+
D as flattedChildren,
|
24
|
+
u as getComponentSize,
|
25
|
+
E as getFirstValidNode,
|
26
|
+
M as getNormalizedProps,
|
27
|
+
m as iconPropType,
|
28
|
+
S as isComment,
|
29
|
+
N as isEpProp,
|
30
|
+
B as isFragment,
|
31
|
+
K as isTemplate,
|
32
|
+
O as isText,
|
33
|
+
F as isValidComponentSize,
|
34
|
+
z as isValidDatePickType,
|
35
|
+
R as isValidElementNode,
|
36
|
+
p as removeGlobalNode,
|
37
|
+
j as renderBlock,
|
38
|
+
q as renderIf,
|
39
|
+
f as withInstall,
|
40
|
+
C as withInstallDirective,
|
41
|
+
c as withInstallFunction,
|
42
|
+
x as withNoopInstall
|
43
|
+
};
|
44
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { Directive } from 'vue';
|
2
|
+
import { SFCInstallWithContext, SFCWithInstall } from './typescript';
|
3
|
+
export declare const withInstall: <T, E extends Record<string, any>>(main: T, extra?: E) => SFCWithInstall<T> & E;
|
4
|
+
export declare const withInstallFunction: <T>(fn: T, name: string) => SFCInstallWithContext<T>;
|
5
|
+
export declare const withInstallDirective: <T extends Directive>(directive: T, name: string) => SFCWithInstall<T>;
|
6
|
+
export declare const withNoopInstall: <T>(component: T) => SFCWithInstall<T>;
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { N as s } from "../../../functions-DzLqXvGt.js";
|
2
|
+
const e = (t, l) => {
|
3
|
+
if (t.install = (o) => {
|
4
|
+
for (const n of [t, ...Object.values(l ?? {})])
|
5
|
+
o.component(n.name, n);
|
6
|
+
}, l)
|
7
|
+
for (const [o, n] of Object.entries(l))
|
8
|
+
t[o] = n;
|
9
|
+
return t;
|
10
|
+
}, r = (t, l) => (t.install = (o) => {
|
11
|
+
t._context = o._context, o.config.globalProperties[l] = t;
|
12
|
+
}, t), i = (t, l) => (t.install = (o) => {
|
13
|
+
o.directive(l, t);
|
14
|
+
}, t), a = (t) => (t.install = s, t);
|
15
|
+
export {
|
16
|
+
e as withInstall,
|
17
|
+
i as withInstallDirective,
|
18
|
+
r as withInstallFunction,
|
19
|
+
a as withNoopInstall
|
20
|
+
};
|
21
|
+
//# sourceMappingURL=install.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"install.js","sources":["../../../../src/components/_util/vue/install.ts"],"sourcesContent":["import { NOOP } from '../functions'\r\n\r\nimport type { App, Directive } from 'vue'\r\nimport type { SFCInstallWithContext, SFCWithInstall } from './typescript'\r\n\r\nexport const withInstall = <T, E extends Record<string, any>>(\r\n main: T,\r\n extra?: E\r\n) => {\r\n ;(main as SFCWithInstall<T>).install = (app): void => {\r\n for (const comp of [main, ...Object.values(extra ?? {})]) {\r\n app.component(comp.name, comp)\r\n }\r\n }\r\n\r\n if (extra) {\r\n for (const [key, comp] of Object.entries(extra)) {\r\n ;(main as any)[key] = comp\r\n }\r\n }\r\n return main as SFCWithInstall<T> & E\r\n}\r\n\r\nexport const withInstallFunction = <T>(fn: T, name: string) => {\r\n ;(fn as SFCWithInstall<T>).install = (app: App) => {\r\n ;(fn as SFCInstallWithContext<T>)._context = app._context\r\n app.config.globalProperties[name] = fn\r\n }\r\n\r\n return fn as SFCInstallWithContext<T>\r\n}\r\n\r\nexport const withInstallDirective = <T extends Directive>(\r\n directive: T,\r\n name: string\r\n) => {\r\n ;(directive as SFCWithInstall<T>).install = (app: App): void => {\r\n app.directive(name, directive)\r\n }\r\n\r\n return directive as SFCWithInstall<T>\r\n}\r\n\r\nexport const withNoopInstall = <T>(component: T) => {\r\n ;(component as SFCWithInstall<T>).install = NOOP\r\n\r\n return component as SFCWithInstall<T>\r\n}\r\n"],"names":["withInstall","main","extra","app","comp","key","withInstallFunction","fn","name","withInstallDirective","directive","withNoopInstall","component","NOOP"],"mappings":";AAKa,MAAAA,IAAc,CACzBC,GACAC,MACG;AAOH,MANED,EAA2B,UAAU,CAACE,MAAc;AACzC,eAAAC,KAAQ,CAACH,GAAM,GAAG,OAAO,OAAOC,KAAS,CAAE,CAAA,CAAC;AACjD,MAAAC,EAAA,UAAUC,EAAK,MAAMA,CAAI;AAAA,EAC/B,GAGEF;AACF,eAAW,CAACG,GAAKD,CAAI,KAAK,OAAO,QAAQF,CAAK;AAC1C,MAAAD,EAAaI,CAAG,IAAID;AAGnB,SAAAH;AACT,GAEaK,IAAsB,CAAIC,GAAOC,OAC1CD,EAAyB,UAAU,CAACJ,MAAa;AAC/C,EAAAI,EAAgC,WAAWJ,EAAI,UAC7CA,EAAA,OAAO,iBAAiBK,CAAI,IAAID;AAAA,GAG/BA,IAGIE,IAAuB,CAClCC,GACAF,OAEEE,EAAgC,UAAU,CAACP,MAAmB;AAC1D,EAAAA,EAAA,UAAUK,GAAME,CAAS;AAAA,GAGxBA,IAGIC,IAAkB,CAAIC,OAC/BA,EAAgC,UAAUC,GAErCD;"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { PropType } from 'vue';
|
2
|
+
import { EpProp, EpPropConvert, EpPropFinalized, EpPropInput, EpPropMergeType, IfEpProp, IfNativePropType, NativePropType } from './types';
|
3
|
+
export declare const epPropKey = "__epPropKey";
|
4
|
+
export declare const definePropType: <T>(val: any) => PropType<T>;
|
5
|
+
export declare const isEpProp: (val: unknown) => val is EpProp<any, any, any>;
|
6
|
+
/**
|
7
|
+
* @description Build prop. It can better optimize prop types
|
8
|
+
* @description 生成 prop,能更好地优化类型
|
9
|
+
* @example
|
10
|
+
// limited options
|
11
|
+
// the type will be PropType<'light' | 'dark'>
|
12
|
+
buildProp({
|
13
|
+
type: String,
|
14
|
+
values: ['light', 'dark'],
|
15
|
+
} as const)
|
16
|
+
* @example
|
17
|
+
// limited options and other types
|
18
|
+
// the type will be PropType<'small' | 'large' | number>
|
19
|
+
buildProp({
|
20
|
+
type: [String, Number],
|
21
|
+
values: ['small', 'large'],
|
22
|
+
validator: (val: unknown): val is number => typeof val === 'number',
|
23
|
+
} as const)
|
24
|
+
@link see more: https://github.com/element-plus/element-plus/pull/3341
|
25
|
+
*/
|
26
|
+
export declare const buildProp: <Type = never, Value = never, Validator = never, Default extends EpPropMergeType<Type, Value, Validator> = never, Required extends boolean = false>(prop: EpPropInput<Type, Value, Validator, Default, Required>, key?: string) => EpPropFinalized<Type, Value, Validator, Default, Required>;
|
27
|
+
export declare const buildProps: <Props extends Record<string, {
|
28
|
+
[epPropKey]: true;
|
29
|
+
} | NativePropType | EpPropInput<any, any, any, any, any>>>(props: Props) => { [K in keyof Props]: IfEpProp<Props[K], Props[K], IfNativePropType<Props[K], Props[K], EpPropConvert<Props[K]>>>; };
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import { warn as v } from "vue";
|
2
|
+
import { fromPairs as w } from "lodash-es";
|
3
|
+
import { d as f, h as d } from "../../../../functions-DzLqXvGt.js";
|
4
|
+
const u = "__epPropKey", $ = (e) => e, y = (e) => f(e) && !!e[u], O = (e, t) => {
|
5
|
+
if (!f(e) || y(e)) return e;
|
6
|
+
const { values: r, required: p, default: n, type: c, validator: a } = e, s = {
|
7
|
+
type: c,
|
8
|
+
required: !!p,
|
9
|
+
validator: r || a ? (l) => {
|
10
|
+
let i = !1, o = [];
|
11
|
+
if (r && (o = Array.from(r), d(e, "default") && o.push(n), i || (i = o.includes(l))), a && (i || (i = a(l))), !i && o.length > 0) {
|
12
|
+
const m = [...new Set(o)].map((P) => JSON.stringify(P)).join(", ");
|
13
|
+
v(
|
14
|
+
`Invalid prop: validation failed${t ? ` for prop "${t}"` : ""}. Expected one of [${m}], got value ${JSON.stringify(
|
15
|
+
l
|
16
|
+
)}.`
|
17
|
+
);
|
18
|
+
}
|
19
|
+
return i;
|
20
|
+
} : void 0,
|
21
|
+
[u]: !0
|
22
|
+
};
|
23
|
+
return d(e, "default") && (s.default = n), s;
|
24
|
+
}, j = (e) => w(
|
25
|
+
Object.entries(e).map(([t, r]) => [
|
26
|
+
t,
|
27
|
+
O(r, t)
|
28
|
+
])
|
29
|
+
);
|
30
|
+
export {
|
31
|
+
O as buildProp,
|
32
|
+
j as buildProps,
|
33
|
+
$ as definePropType,
|
34
|
+
u as epPropKey,
|
35
|
+
y as isEpProp
|
36
|
+
};
|
37
|
+
//# sourceMappingURL=runtime.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"runtime.js","sources":["../../../../../src/components/_util/vue/props/runtime.ts"],"sourcesContent":["import { warn } from 'vue'\r\nimport { fromPairs } from 'lodash-unified'\r\nimport { isObject } from '../../types'\r\nimport { hasOwn } from '../../objects'\r\n\r\nimport type { PropType } from 'vue'\r\nimport type {\r\n EpProp,\r\n EpPropConvert,\r\n EpPropFinalized,\r\n EpPropInput,\r\n EpPropMergeType,\r\n IfEpProp,\r\n IfNativePropType,\r\n NativePropType,\r\n} from './types'\r\n\r\nexport const epPropKey = '__epPropKey'\r\n\r\nexport const definePropType = <T>(val: any): PropType<T> => val\r\n\r\nexport const isEpProp = (val: unknown): val is EpProp<any, any, any> =>\r\n isObject(val) && !!(val as any)[epPropKey]\r\n\r\n/**\r\n * @description Build prop. It can better optimize prop types\r\n * @description 生成 prop,能更好地优化类型\r\n * @example\r\n // limited options\r\n // the type will be PropType<'light' | 'dark'>\r\n buildProp({\r\n type: String,\r\n values: ['light', 'dark'],\r\n } as const)\r\n * @example\r\n // limited options and other types\r\n // the type will be PropType<'small' | 'large' | number>\r\n buildProp({\r\n type: [String, Number],\r\n values: ['small', 'large'],\r\n validator: (val: unknown): val is number => typeof val === 'number',\r\n } as const)\r\n @link see more: https://github.com/element-plus/element-plus/pull/3341\r\n */\r\nexport const buildProp = <\r\n Type = never,\r\n Value = never,\r\n Validator = never,\r\n Default extends EpPropMergeType<Type, Value, Validator> = never,\r\n Required extends boolean = false\r\n>(\r\n prop: EpPropInput<Type, Value, Validator, Default, Required>,\r\n key?: string\r\n): EpPropFinalized<Type, Value, Validator, Default, Required> => {\r\n // filter native prop type and nested prop, e.g `null`, `undefined` (from `buildProps`)\r\n if (!isObject(prop) || isEpProp(prop)) return prop as any\r\n\r\n const { values, required, default: defaultValue, type, validator } = prop\r\n\r\n const _validator =\r\n values || validator\r\n ? (val: unknown) => {\r\n let valid = false\r\n let allowedValues: unknown[] = []\r\n\r\n if (values) {\r\n allowedValues = Array.from(values)\r\n if (hasOwn(prop, 'default')) {\r\n allowedValues.push(defaultValue)\r\n }\r\n valid ||= allowedValues.includes(val)\r\n }\r\n if (validator) valid ||= validator(val)\r\n\r\n if (!valid && allowedValues.length > 0) {\r\n const allowValuesText = [...new Set(allowedValues)]\r\n .map((value) => JSON.stringify(value))\r\n .join(', ')\r\n warn(\r\n `Invalid prop: validation failed${\r\n key ? ` for prop \"${key}\"` : ''\r\n }. Expected one of [${allowValuesText}], got value ${JSON.stringify(\r\n val\r\n )}.`\r\n )\r\n }\r\n return valid\r\n }\r\n : undefined\r\n\r\n const epProp: any = {\r\n type,\r\n required: !!required,\r\n validator: _validator,\r\n [epPropKey]: true,\r\n }\r\n if (hasOwn(prop, 'default')) epProp.default = defaultValue\r\n return epProp\r\n}\r\n\r\nexport const buildProps = <\r\n Props extends Record<\r\n string,\r\n | { [epPropKey]: true }\r\n | NativePropType\r\n | EpPropInput<any, any, any, any, any>\r\n >\r\n>(\r\n props: Props\r\n): {\r\n [K in keyof Props]: IfEpProp<\r\n Props[K],\r\n Props[K],\r\n IfNativePropType<Props[K], Props[K], EpPropConvert<Props[K]>>\r\n >\r\n} =>\r\n fromPairs(\r\n Object.entries(props).map(([key, option]) => [\r\n key,\r\n buildProp(option as any, key),\r\n ])\r\n ) as any\r\n"],"names":["epPropKey","definePropType","val","isEpProp","isObject","buildProp","prop","key","values","required","defaultValue","type","validator","epProp","valid","allowedValues","hasOwn","allowValuesText","value","warn","buildProps","props","fromPairs","option"],"mappings":";;;AAiBO,MAAMA,IAAY,eAEZC,IAAiB,CAAIC,MAA0BA,GAE/CC,IAAW,CAACD,MACvBE,EAASF,CAAG,KAAK,CAAC,CAAEA,EAAYF,CAAS,GAsB9BK,IAAY,CAOvBC,GACAC,MAC+D;AAE/D,MAAI,CAACH,EAASE,CAAI,KAAKH,EAASG,CAAI,EAAU,QAAAA;AAE9C,QAAM,EAAE,QAAAE,GAAQ,UAAAC,GAAU,SAASC,GAAc,MAAAC,GAAM,WAAAC,EAAc,IAAAN,GAiC/DO,IAAc;AAAA,IAClB,MAAAF;AAAA,IACA,UAAU,CAAC,CAACF;AAAA,IACZ,WAjCAD,KAAUI,IACN,CAACV,MAAiB;AAChB,UAAIY,IAAQ,IACRC,IAA2B,CAAA;AAW/B,UATIP,MACcO,IAAA,MAAM,KAAKP,CAAM,GAC7BQ,EAAOV,GAAM,SAAS,KACxBS,EAAc,KAAKL,CAAY,GAEvBI,UAAAC,EAAc,SAASb,CAAG,KAElCU,MAAqBE,UAAAF,EAAUV,CAAG,KAElC,CAACY,KAASC,EAAc,SAAS,GAAG;AACtC,cAAME,IAAkB,CAAC,GAAG,IAAI,IAAIF,CAAa,CAAC,EAC/C,IAAI,CAACG,MAAU,KAAK,UAAUA,CAAK,CAAC,EACpC,KAAK,IAAI;AACZ,QAAAC;AAAA,UACE,kCACEZ,IAAM,cAAcA,CAAG,MAAM,EAC/B,sBAAsBU,CAAe,gBAAgB,KAAK;AAAA,YACxDf;AAAA,UACD,CAAA;AAAA,QAAA;AAAA,MAEL;AACO,aAAAY;AAAA,IAET,IAAA;AAAA,IAMJ,CAACd,CAAS,GAAG;AAAA,EAAA;AAEf,SAAIgB,EAAOV,GAAM,SAAS,QAAU,UAAUI,IACvCG;AACT,GAEaO,IAAa,CAQxBC,MAQAC;AAAA,EACE,OAAO,QAAQD,CAAK,EAAE,IAAI,CAAC,CAACd,GAAKgB,CAAM,MAAM;AAAA,IAC3ChB;AAAA,IACAF,EAAUkB,GAAehB,CAAG;AAAA,EAAA,CAC7B;AACH;"}
|
@@ -0,0 +1,120 @@
|
|
1
|
+
import { epPropKey } from './runtime';
|
2
|
+
import { ExtractPropTypes, PropType } from 'vue';
|
3
|
+
import { IfNever, UnknownToNever, WritableArray } from './util';
|
4
|
+
type Value<T> = T[keyof T];
|
5
|
+
/**
|
6
|
+
* Extract the type of a single prop
|
7
|
+
*
|
8
|
+
* 提取单个 prop 的参数类型
|
9
|
+
*
|
10
|
+
* @example
|
11
|
+
* ExtractPropType<{ type: StringConstructor }> => string | undefined
|
12
|
+
* ExtractPropType<{ type: StringConstructor, required: true }> => string
|
13
|
+
* ExtractPropType<{ type: BooleanConstructor }> => boolean
|
14
|
+
*/
|
15
|
+
export type ExtractPropType<T extends object> = Value<ExtractPropTypes<{
|
16
|
+
key: T;
|
17
|
+
}>>;
|
18
|
+
/**
|
19
|
+
* Extracts types via `ExtractPropTypes`, accepting `PropType<T>`, `XXXConstructor`, `never`...
|
20
|
+
*
|
21
|
+
* 通过 `ExtractPropTypes` 提取类型,接受 `PropType<T>`、`XXXConstructor`、`never`...
|
22
|
+
*
|
23
|
+
* @example
|
24
|
+
* ResolvePropType<BooleanConstructor> => boolean
|
25
|
+
* ResolvePropType<PropType<T>> => T
|
26
|
+
**/
|
27
|
+
export type ResolvePropType<T> = IfNever<T, never, ExtractPropType<{
|
28
|
+
type: WritableArray<T>;
|
29
|
+
required: true;
|
30
|
+
}>>;
|
31
|
+
/**
|
32
|
+
* Merge Type, Value, Validator types
|
33
|
+
* 合并 Type、Value、Validator 的类型
|
34
|
+
*
|
35
|
+
* @example
|
36
|
+
* EpPropMergeType<StringConstructor, '1', 1> => 1 | "1" // ignores StringConstructor
|
37
|
+
* EpPropMergeType<StringConstructor, never, number> => string | number
|
38
|
+
*/
|
39
|
+
export type EpPropMergeType<Type, Value, Validator> = IfNever<UnknownToNever<Value>, ResolvePropType<Type>, never> | UnknownToNever<Value> | UnknownToNever<Validator>;
|
40
|
+
/**
|
41
|
+
* Handling default values for input (constraints)
|
42
|
+
*
|
43
|
+
* 处理输入参数的默认值(约束)
|
44
|
+
*/
|
45
|
+
export type EpPropInputDefault<Required extends boolean, Default> = Required extends true ? never : Default extends Record<string, unknown> | Array<any> ? () => Default : (() => Default) | Default;
|
46
|
+
/**
|
47
|
+
* Native prop types, e.g: `BooleanConstructor`, `StringConstructor`, `null`, `undefined`, etc.
|
48
|
+
*
|
49
|
+
* 原生 prop `类型,BooleanConstructor`、`StringConstructor`、`null`、`undefined` 等
|
50
|
+
*/
|
51
|
+
export type NativePropType = ((...args: any) => any) | {
|
52
|
+
new (...args: any): any;
|
53
|
+
} | undefined | null;
|
54
|
+
export type IfNativePropType<T, Y, N> = [T] extends [NativePropType] ? Y : N;
|
55
|
+
/**
|
56
|
+
* input prop `buildProp` or `buildProps` (constraints)
|
57
|
+
*
|
58
|
+
* prop 输入参数(约束)
|
59
|
+
*
|
60
|
+
* @example
|
61
|
+
* EpPropInput<StringConstructor, 'a', never, never, true>
|
62
|
+
* ⬇️
|
63
|
+
* {
|
64
|
+
type?: StringConstructor | undefined;
|
65
|
+
required?: true | undefined;
|
66
|
+
values?: readonly "a"[] | undefined;
|
67
|
+
validator?: ((val: any) => boolean) | ((val: any) => val is never) | undefined;
|
68
|
+
default?: undefined;
|
69
|
+
}
|
70
|
+
*/
|
71
|
+
export type EpPropInput<Type, Value, Validator, Default extends EpPropMergeType<Type, Value, Validator>, Required extends boolean> = {
|
72
|
+
type?: Type;
|
73
|
+
required?: Required;
|
74
|
+
values?: readonly Value[];
|
75
|
+
validator?: ((val: any) => val is Validator) | ((val: any) => boolean);
|
76
|
+
default?: EpPropInputDefault<Required, Default>;
|
77
|
+
};
|
78
|
+
/**
|
79
|
+
* output prop `buildProp` or `buildProps`.
|
80
|
+
*
|
81
|
+
* prop 输出参数。
|
82
|
+
*
|
83
|
+
* @example
|
84
|
+
* EpProp<'a', 'b', true>
|
85
|
+
* ⬇️
|
86
|
+
* {
|
87
|
+
readonly type: PropType<"a">;
|
88
|
+
readonly required: true;
|
89
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
90
|
+
readonly default: "b";
|
91
|
+
__epPropKey: true;
|
92
|
+
}
|
93
|
+
*/
|
94
|
+
export type EpProp<Type, Default, Required> = {
|
95
|
+
readonly type: PropType<Type>;
|
96
|
+
readonly required: [Required] extends [true] ? true : false;
|
97
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
98
|
+
[epPropKey]: true;
|
99
|
+
} & IfNever<Default, unknown, {
|
100
|
+
readonly default: Default;
|
101
|
+
}>;
|
102
|
+
/**
|
103
|
+
* Determine if it is `EpProp`
|
104
|
+
*/
|
105
|
+
export type IfEpProp<T, Y, N> = T extends {
|
106
|
+
[epPropKey]: true;
|
107
|
+
} ? Y : N;
|
108
|
+
/**
|
109
|
+
* Converting input to output.
|
110
|
+
*
|
111
|
+
* 将输入转换为输出
|
112
|
+
*/
|
113
|
+
export type EpPropConvert<Input> = Input extends EpPropInput<infer Type, infer Value, infer Validator, any, infer Required> ? EpPropFinalized<Type, Value, Validator, Input['default'], Required> : never;
|
114
|
+
/**
|
115
|
+
* Finalized conversion output
|
116
|
+
*
|
117
|
+
* 最终转换 EpProp
|
118
|
+
*/
|
119
|
+
export type EpPropFinalized<Type, Value, Validator, Default, Required> = EpProp<EpPropMergeType<Type, Value, Validator>, UnknownToNever<Default>, Required>;
|
120
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
export type Writable<T> = {
|
2
|
+
-readonly [P in keyof T]: T[P];
|
3
|
+
};
|
4
|
+
export type WritableArray<T> = T extends readonly any[] ? Writable<T> : T;
|
5
|
+
export type IfNever<T, Y = true, N = false> = [T] extends [never] ? Y : N;
|
6
|
+
export type IfUnknown<T, Y, N> = [unknown] extends [T] ? Y : N;
|
7
|
+
export type UnknownToNever<T> = IfUnknown<T, never, T>;
|
8
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"util.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
@@ -0,0 +1,3 @@
|
|
1
|
+
import { ComponentPublicInstance, Ref } from 'vue';
|
2
|
+
export type RefSetter = (el: Element | ComponentPublicInstance | undefined) => void;
|
3
|
+
export declare const composeRefs: (...refs: (Ref<HTMLElement | undefined> | RefSetter)[]) => (el: Element | ComponentPublicInstance | null) => void;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { b as r } from "../../../functions-DzLqXvGt.js";
|
2
|
+
import "lodash-es";
|
3
|
+
import "vue";
|
4
|
+
const c = (...i) => (t) => {
|
5
|
+
i.forEach((o) => {
|
6
|
+
r(o) ? o(t) : o.value = t;
|
7
|
+
});
|
8
|
+
};
|
9
|
+
export {
|
10
|
+
c as composeRefs
|
11
|
+
};
|
12
|
+
//# sourceMappingURL=refs.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"refs.js","sources":["../../../../src/components/_util/vue/refs.ts"],"sourcesContent":["import { isFunction } from '../types'\r\n\r\nimport type { ComponentPublicInstance, Ref } from 'vue'\r\n\r\nexport type RefSetter = (\r\n el: Element | ComponentPublicInstance | undefined\r\n) => void\r\n\r\nexport const composeRefs = (\r\n ...refs: (Ref<HTMLElement | undefined> | RefSetter)[]\r\n) => {\r\n return (el: Element | ComponentPublicInstance | null) => {\r\n refs.forEach((ref) => {\r\n if (isFunction(ref)) {\r\n ref(el as Element | ComponentPublicInstance)\r\n } else {\r\n ref.value = el as HTMLElement | undefined\r\n }\r\n })\r\n }\r\n}\r\n"],"names":["composeRefs","refs","el","ref","isFunction"],"mappings":";;;AAQa,MAAAA,IAAc,IACtBC,MAEI,CAACC,MAAiD;AAClD,EAAAD,EAAA,QAAQ,CAACE,MAAQ;AAChB,IAAAC,EAAWD,CAAG,IAChBA,EAAID,CAAuC,IAE3CC,EAAI,QAAQD;AAAA,EACd,CACD;AAAA;"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"size.js","sources":["../../../../src/components/_util/vue/size.ts"],"sourcesContent":["import { componentSizeMap } from 'element-plus'\r\n\r\nimport type { ComponentSize } from 'element-plus'\r\n\r\nexport const getComponentSize = (size?: ComponentSize) => {\r\n return componentSizeMap[size || 'default']\r\n}\r\n"],"names":["getComponentSize","size","componentSizeMap"],"mappings":";AAIa,MAAAA,IAAmB,CAACC,MACxBC,EAAiBD,KAAQ,SAAS;"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"typescript.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"validator.js","sources":["../../../../src/components/_util/vue/validator.ts"],"sourcesContent":["import { componentSizes, datePickTypes } from 'element-plus'\r\nimport type { ComponentSize, DatePickType } from 'element-plus'\r\n\r\nexport const isValidComponentSize = (val: string): val is ComponentSize | '' =>\r\n ['', ...componentSizes].includes(val)\r\n\r\nexport const isValidDatePickType = (val: string): val is DatePickType =>\r\n ([...datePickTypes] as string[]).includes(val)\r\n"],"names":["isValidComponentSize","val","componentSizes","isValidDatePickType","datePickTypes"],"mappings":";AAGa,MAAAA,IAAuB,CAACC,MACnC,CAAC,IAAI,GAAGC,CAAc,EAAE,SAASD,CAAG,GAEzBE,IAAsB,CAACF,MACjC,CAAC,GAAGG,CAAa,EAAe,SAASH,CAAG;"}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
import { createBlock, VNode, VNodeArrayChildren, VNodeChild, VNodeNormalizedChildren } from 'vue';
|
2
|
+
export declare enum PatchFlags {
|
3
|
+
TEXT = 1,
|
4
|
+
CLASS = 2,
|
5
|
+
STYLE = 4,
|
6
|
+
PROPS = 8,
|
7
|
+
FULL_PROPS = 16,
|
8
|
+
HYDRATE_EVENTS = 32,
|
9
|
+
STABLE_FRAGMENT = 64,
|
10
|
+
KEYED_FRAGMENT = 128,
|
11
|
+
UNKEYED_FRAGMENT = 256,
|
12
|
+
NEED_PATCH = 512,
|
13
|
+
DYNAMIC_SLOTS = 1024,
|
14
|
+
HOISTED = -1,
|
15
|
+
BAIL = -2
|
16
|
+
}
|
17
|
+
export type VNodeChildAtom = Exclude<VNodeChild, Array<any>>;
|
18
|
+
export type RawSlots = Exclude<VNodeNormalizedChildren, Array<any> | null | string>;
|
19
|
+
export declare function isFragment(node: VNode): boolean;
|
20
|
+
export declare function isFragment(node: unknown): node is VNode;
|
21
|
+
export declare function isText(node: VNode): boolean;
|
22
|
+
export declare function isText(node: unknown): node is VNode;
|
23
|
+
export declare function isComment(node: VNode): boolean;
|
24
|
+
export declare function isComment(node: unknown): node is VNode;
|
25
|
+
export declare function isTemplate(node: VNode): boolean;
|
26
|
+
export declare function isTemplate(node: unknown): node is VNode;
|
27
|
+
/**
|
28
|
+
* determine if the element is a valid element type rather than fragments and comment e.g. <template> v-if
|
29
|
+
* @param node {VNode} node to be tested
|
30
|
+
*/
|
31
|
+
export declare function isValidElementNode(node: VNode): boolean;
|
32
|
+
export declare function isValidElementNode(node: unknown): node is VNode;
|
33
|
+
export declare const getFirstValidNode: (nodes: VNodeNormalizedChildren, maxDepth?: number) => string | number | boolean | void | VNodeArrayChildren | {
|
34
|
+
[name: string]: unknown;
|
35
|
+
$stable?: boolean;
|
36
|
+
} | VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
37
|
+
[key: string]: any;
|
38
|
+
}> | null | undefined;
|
39
|
+
export declare function renderIf(condition: boolean, ...args: Parameters<typeof createBlock>): VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
40
|
+
[key: string]: any;
|
41
|
+
}>;
|
42
|
+
export declare function renderBlock(...args: Parameters<typeof createBlock>): VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
43
|
+
[key: string]: any;
|
44
|
+
}>;
|
45
|
+
export declare const getNormalizedProps: (node: VNode) => Record<string, any>;
|
46
|
+
export declare const ensureOnlyChild: (children: VNodeArrayChildren | undefined) => VNodeArrayChildren | (string | number | boolean | void | VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
47
|
+
[key: string]: any;
|
48
|
+
}> | null | undefined);
|
49
|
+
export type FlattenVNodes = Array<VNodeChildAtom | RawSlots>;
|
50
|
+
export declare const flattedChildren: (children: FlattenVNodes | VNode | VNodeNormalizedChildren) => FlattenVNodes;
|
@@ -0,0 +1,68 @@
|
|
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";
|
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;
|
9
|
+
}
|
10
|
+
function G(e) {
|
11
|
+
return u(e) && e.type === A;
|
12
|
+
}
|
13
|
+
function p(e) {
|
14
|
+
return u(e) && e.type === N;
|
15
|
+
}
|
16
|
+
const y = "template";
|
17
|
+
function Y(e) {
|
18
|
+
return u(e) && e.type === y;
|
19
|
+
}
|
20
|
+
function H(e) {
|
21
|
+
return u(e) && !f(e) && !p(e);
|
22
|
+
}
|
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;
|
26
|
+
}
|
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);
|
30
|
+
}
|
31
|
+
function v(...e) {
|
32
|
+
return s(), L(...e);
|
33
|
+
}
|
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)
|
45
|
+
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;
|
53
|
+
};
|
54
|
+
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
|
67
|
+
};
|
68
|
+
//# sourceMappingURL=vnode.js.map
|
@@ -0,0 +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":"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"}
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import
|
2
|
-
import
|
3
|
-
import
|
1
|
+
import { CSSProperties } from 'vue';
|
2
|
+
import { VueTypeValidableDef, VueTypesInterface } from 'vue-types';
|
3
|
+
import { VueNode } from '../type';
|
4
4
|
export declare function withUndefined<T extends {
|
5
5
|
default?: any;
|
6
6
|
}>(type: T): T;
|