rx-compo 1.0.53 → 1.0.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/entry/{types/index.d.ts → index.d.ts} +2 -3
- package/es/components/RxButton/index.d.ts +2 -1
- package/es/components/RxButton/index.js +1 -1821
- package/es/components/RxButton/src/RxButton.d.ts +8 -0
- package/es/components/RxButton/src/RxButton.vue.d.ts +6 -0
- package/es/components/date/index.d.ts +4 -0
- package/es/components/date/index.js +1 -0
- package/es/components/date/src/date.d.ts +24 -0
- package/es/components/date/src/date.vue.d.ts +32 -0
- package/es/components/icon/index.css +1 -0
- package/es/components/icon/index.d.ts +4 -0
- package/es/components/icon/index.js +1 -0
- package/es/components/icon/src/icon.d.ts +25 -0
- package/es/components/icon/src/icon.vue.d.ts +37 -0
- package/es/components/index.d.ts +8 -1
- package/es/components/index.js +1 -1
- package/es/index.d.ts +2 -3
- package/es/index.js +1 -14
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +1 -0
- package/es/utils/src/props.d.ts +74 -0
- package/es/utils/src/props.js +115 -0
- package/es/utils/with-install.d.ts +2 -2
- package/es/utils/with-install.js +0 -1
- package/index.esm.js +1 -1842
- package/index.js +1 -1850
- package/lib/components/RxButton/index.d.ts +2 -1
- package/lib/components/RxButton/index.js +1 -1826
- package/lib/components/RxButton/src/RxButton.d.ts +8 -0
- package/lib/components/RxButton/src/RxButton.vue.d.ts +6 -0
- package/lib/components/date/index.d.ts +4 -0
- package/lib/components/date/index.js +1 -0
- package/lib/components/date/src/date.d.ts +24 -0
- package/lib/components/date/src/date.vue.d.ts +32 -0
- package/lib/components/icon/index.css +1 -0
- package/lib/components/icon/index.d.ts +4 -0
- package/lib/components/icon/index.js +1 -0
- package/lib/components/icon/src/icon.d.ts +25 -0
- package/lib/components/icon/src/icon.vue.d.ts +37 -0
- package/lib/components/index.d.ts +8 -1
- package/lib/components/index.js +1 -14
- package/lib/index.d.ts +2 -3
- package/lib/index.js +1 -43
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +17 -0
- package/lib/utils/src/props.d.ts +74 -0
- package/lib/utils/src/props.js +120 -0
- package/lib/utils/with-install.d.ts +2 -2
- package/lib/utils/with-install.js +0 -1
- package/package.json +22 -16
- package/theme-chalk/components-style.css +1 -0
- package/theme-chalk/date.css +1 -0
- package/theme-chalk/fonts/iconfont.ttf +0 -0
- package/theme-chalk/fonts/iconfont.woff +0 -0
- package/theme-chalk/fonts/iconfont.woff2 +0 -0
- package/theme-chalk/icon.css +1 -0
- package/theme-chalk/index.css +2 -0
- package/types/index.d.ts +9 -0
- package/es/components/RxButton/src/index.d.ts +0 -3
- package/es/components/RxButton/src/index.vue.d.ts +0 -10
- package/lib/components/RxButton/src/index.d.ts +0 -3
- package/lib/components/RxButton/src/index.vue.d.ts +0 -10
- package/theme-chalk/css/icon.css +0 -1
- package/theme-chalk/css/index.css +0 -1
- package/types/components/RxButton/index.d.ts +0 -3
- package/types/components/RxButton/src/index.d.ts +0 -3
- package/types/components/RxButton/src/index.vue.d.ts +0 -10
- package/types/components/index.d.ts +0 -2
- package/types/utils/with-install.d.ts +0 -3
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
import { ButtonInstance } from 'element-plus';
|
|
3
|
+
declare type butonType = Omit<ButtonInstance['$props'], 'type'>;
|
|
4
|
+
export declare const RxButtonProps: {
|
|
5
|
+
type: PropType<"primary" | "danger">;
|
|
6
|
+
};
|
|
7
|
+
export declare type RxButtonPropsType = ExtractPropTypes<typeof RxButtonProps & butonType>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{
|
|
2
|
+
type: import("vue").PropType<"primary" | "danger">;
|
|
3
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
4
|
+
type: import("vue").PropType<"primary" | "danger">;
|
|
5
|
+
}>>, {}>;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{withInstall as o}from"rx-compo/es/utils/with-install";import{defineComponent as e,openBlock as t,createElementBlock as r,toDisplayString as n}from"vue";import{IxPropTypes as s}from"rx-compo/es/utils";import i from"moment";var l=e({name:"QiDate",props:{mode:s.oneOf(["primary","default","dashed","text","link"]),danger:s.bool,ghost:s.bool,disabled:s.bool,loading:s.bool,size:s.oneOf(["lg","xl","md","sm","xs"]),shape:s.oneOf(["circle","round"]),block:s.bool,icon:s.string,type:s.oneOf(["button","submit","reset"]).def("button")},setup:o=>({now:i().format("LLLL")})});const m={class:"w-[100px] h-[100px] bg-red-500"};l.render=function(o,e,s,i,l,a){return t(),r("div",m,n(o.now),1)},l.__file="packages/components/date/src/date.vue";const a=o(l);export{a as QiDate,a as default};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ExtractInnerPropTypes, ExtractPublicPropTypes } from 'rx-compo/es/utils';
|
|
2
|
+
import type { AnchorHTMLAttributes, ButtonHTMLAttributes, DefineComponent } from 'vue';
|
|
3
|
+
export declare type DateMode = 'primary' | 'default' | 'dashed' | 'text' | 'link';
|
|
4
|
+
export declare type DateShape = 'circle' | 'round';
|
|
5
|
+
export declare type DateSize = 'lg' | 'xl' | 'md' | 'sm' | 'xs';
|
|
6
|
+
export declare type DateType = 'button' | 'submit' | 'reset';
|
|
7
|
+
export declare const dateProps: {
|
|
8
|
+
mode: import("vue-types").VueTypeDef<DateMode>;
|
|
9
|
+
danger: import("vue-types").VueTypeValidableDef<boolean>;
|
|
10
|
+
ghost: import("vue-types").VueTypeValidableDef<boolean>;
|
|
11
|
+
disabled: import("vue-types").VueTypeValidableDef<boolean>;
|
|
12
|
+
loading: import("vue-types").VueTypeValidableDef<boolean>;
|
|
13
|
+
size: import("vue-types").VueTypeDef<DateSize>;
|
|
14
|
+
shape: import("vue-types").VueTypeDef<DateShape>;
|
|
15
|
+
block: import("vue-types").VueTypeValidableDef<boolean>;
|
|
16
|
+
icon: import("vue-types").VueTypeValidableDef<string>;
|
|
17
|
+
type: import("vue-types").VueTypeDef<DateType> & {
|
|
18
|
+
default: DateType;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export declare type DateProps = ExtractInnerPropTypes<typeof dateProps>;
|
|
22
|
+
export declare type DatePublicProps = ExtractPublicPropTypes<typeof dateProps>;
|
|
23
|
+
export declare type DateComponent = DefineComponent<Omit<ButtonHTMLAttributes | AnchorHTMLAttributes, keyof DatePublicProps> & DatePublicProps>;
|
|
24
|
+
export declare type DateInstance = InstanceType<DefineComponent<DateProps>>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{
|
|
2
|
+
mode: import("vue-types").VueTypeDef<import("./date").DateMode>;
|
|
3
|
+
danger: import("vue-types").VueTypeValidableDef<boolean>;
|
|
4
|
+
ghost: import("vue-types").VueTypeValidableDef<boolean>;
|
|
5
|
+
disabled: import("vue-types").VueTypeValidableDef<boolean>;
|
|
6
|
+
loading: import("vue-types").VueTypeValidableDef<boolean>;
|
|
7
|
+
size: import("vue-types").VueTypeDef<import("./date").DateSize>;
|
|
8
|
+
shape: import("vue-types").VueTypeDef<import("./date").DateShape>;
|
|
9
|
+
block: import("vue-types").VueTypeValidableDef<boolean>;
|
|
10
|
+
icon: import("vue-types").VueTypeValidableDef<string>;
|
|
11
|
+
type: import("vue-types").VueTypeDef<import("./date").DateType> & {
|
|
12
|
+
default: import("./date").DateType;
|
|
13
|
+
};
|
|
14
|
+
}, {
|
|
15
|
+
now: string;
|
|
16
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
17
|
+
mode: import("vue-types").VueTypeDef<import("./date").DateMode>;
|
|
18
|
+
danger: import("vue-types").VueTypeValidableDef<boolean>;
|
|
19
|
+
ghost: import("vue-types").VueTypeValidableDef<boolean>;
|
|
20
|
+
disabled: import("vue-types").VueTypeValidableDef<boolean>;
|
|
21
|
+
loading: import("vue-types").VueTypeValidableDef<boolean>;
|
|
22
|
+
size: import("vue-types").VueTypeDef<import("./date").DateSize>;
|
|
23
|
+
shape: import("vue-types").VueTypeDef<import("./date").DateShape>;
|
|
24
|
+
block: import("vue-types").VueTypeValidableDef<boolean>;
|
|
25
|
+
icon: import("vue-types").VueTypeValidableDef<string>;
|
|
26
|
+
type: import("vue-types").VueTypeDef<import("./date").DateType> & {
|
|
27
|
+
default: import("./date").DateType;
|
|
28
|
+
};
|
|
29
|
+
}>>, {
|
|
30
|
+
type: import("./date").DateType;
|
|
31
|
+
}>;
|
|
32
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.qi-icon{border:1px solid #000;border-radius:15px;margin:5px;padding:5px}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{withInstall as o}from"rx-compo/es/utils/with-install";import{defineComponent as e,computed as s,openBlock as t,createElementBlock as i,normalizeStyle as l,renderSlot as n}from"vue";import{IxPropTypes as r}from"rx-compo/es/utils";var c=e({name:"QiIcon",props:{color:r.string,mode:r.oneOf(["primary","default","dashed","text","link"]),danger:r.bool,ghost:r.bool,disabled:r.bool,loading:r.bool,size:r.oneOf(["lg","xl","md","sm","xs"]),shape:r.oneOf(["circle","round"]),block:r.bool,icon:r.string,type:r.oneOf(["button","submit","reset"]).def("button")},setup:o=>({style:s((()=>o.size||o.color?Object.assign(Object.assign({},o.size?{"font-size":o.size+"px"}:{}),o.color?{color:o.color}:{}):{}))})});c.render=function(o,e,s,r,c,a){return t(),i("i",{class:"qi-icon",style:l(o.style)},[n(o.$slots,"default")],4)},c.__file="packages/components/icon/src/icon.vue";const a=o(c);export{a as QiIcon,a as default};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ExtractInnerPropTypes, ExtractPublicPropTypes } from 'rx-compo/es/utils';
|
|
2
|
+
import type { AnchorHTMLAttributes, ButtonHTMLAttributes, DefineComponent } from 'vue';
|
|
3
|
+
export declare type IconMode = 'primary' | 'default' | 'dashed' | 'text' | 'link';
|
|
4
|
+
export declare type IconShape = 'circle' | 'round';
|
|
5
|
+
export declare type IconSize = 'lg' | 'xl' | 'md' | 'sm' | 'xs';
|
|
6
|
+
export declare type IconType = 'button' | 'submit' | 'reset';
|
|
7
|
+
export declare const iconProps: {
|
|
8
|
+
color: import("vue-types").VueTypeValidableDef<string>;
|
|
9
|
+
mode: import("vue-types").VueTypeDef<IconMode>;
|
|
10
|
+
danger: import("vue-types").VueTypeValidableDef<boolean>;
|
|
11
|
+
ghost: import("vue-types").VueTypeValidableDef<boolean>;
|
|
12
|
+
disabled: import("vue-types").VueTypeValidableDef<boolean>;
|
|
13
|
+
loading: import("vue-types").VueTypeValidableDef<boolean>;
|
|
14
|
+
size: import("vue-types").VueTypeDef<IconSize>;
|
|
15
|
+
shape: import("vue-types").VueTypeDef<IconShape>;
|
|
16
|
+
block: import("vue-types").VueTypeValidableDef<boolean>;
|
|
17
|
+
icon: import("vue-types").VueTypeValidableDef<string>;
|
|
18
|
+
type: import("vue-types").VueTypeDef<IconType> & {
|
|
19
|
+
default: IconType;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export declare type IconProps = ExtractInnerPropTypes<typeof iconProps>;
|
|
23
|
+
export declare type IconPublicProps = ExtractPublicPropTypes<typeof iconProps>;
|
|
24
|
+
export declare type IconComponent = DefineComponent<Omit<ButtonHTMLAttributes | AnchorHTMLAttributes, keyof IconPublicProps> & IconPublicProps>;
|
|
25
|
+
export declare type IconInstance = InstanceType<DefineComponent<IconProps>>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{
|
|
2
|
+
color: import("vue-types").VueTypeValidableDef<string>;
|
|
3
|
+
mode: import("vue-types").VueTypeDef<import("./icon").IconMode>;
|
|
4
|
+
danger: import("vue-types").VueTypeValidableDef<boolean>;
|
|
5
|
+
ghost: import("vue-types").VueTypeValidableDef<boolean>;
|
|
6
|
+
disabled: import("vue-types").VueTypeValidableDef<boolean>;
|
|
7
|
+
loading: import("vue-types").VueTypeValidableDef<boolean>;
|
|
8
|
+
size: import("vue-types").VueTypeDef<import("./icon").IconSize>;
|
|
9
|
+
shape: import("vue-types").VueTypeDef<import("./icon").IconShape>;
|
|
10
|
+
block: import("vue-types").VueTypeValidableDef<boolean>;
|
|
11
|
+
icon: import("vue-types").VueTypeValidableDef<string>;
|
|
12
|
+
type: import("vue-types").VueTypeDef<import("./icon").IconType> & {
|
|
13
|
+
default: import("./icon").IconType;
|
|
14
|
+
};
|
|
15
|
+
}, {
|
|
16
|
+
style: import("vue").ComputedRef<{
|
|
17
|
+
color?: string;
|
|
18
|
+
'font-size'?: string;
|
|
19
|
+
}>;
|
|
20
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
21
|
+
color: import("vue-types").VueTypeValidableDef<string>;
|
|
22
|
+
mode: import("vue-types").VueTypeDef<import("./icon").IconMode>;
|
|
23
|
+
danger: import("vue-types").VueTypeValidableDef<boolean>;
|
|
24
|
+
ghost: import("vue-types").VueTypeValidableDef<boolean>;
|
|
25
|
+
disabled: import("vue-types").VueTypeValidableDef<boolean>;
|
|
26
|
+
loading: import("vue-types").VueTypeValidableDef<boolean>;
|
|
27
|
+
size: import("vue-types").VueTypeDef<import("./icon").IconSize>;
|
|
28
|
+
shape: import("vue-types").VueTypeDef<import("./icon").IconShape>;
|
|
29
|
+
block: import("vue-types").VueTypeValidableDef<boolean>;
|
|
30
|
+
icon: import("vue-types").VueTypeValidableDef<string>;
|
|
31
|
+
type: import("vue-types").VueTypeDef<import("./icon").IconType> & {
|
|
32
|
+
default: import("./icon").IconType;
|
|
33
|
+
};
|
|
34
|
+
}>>, {
|
|
35
|
+
type: import("./icon").IconType;
|
|
36
|
+
}>;
|
|
37
|
+
export default _default;
|
package/es/components/index.d.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import type { App } from 'vue';
|
|
2
|
+
import 'element-plus/dist/index.css';
|
|
3
|
+
declare const _default: {
|
|
4
|
+
install: (app: App<any>) => void;
|
|
5
|
+
};
|
|
6
|
+
export default _default;
|
|
7
|
+
export * from './icon';
|
|
8
|
+
export * from './date';
|
|
2
9
|
export * from './RxButton';
|
package/es/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import o from"element-plus";import"element-plus/dist/index.css";import*as e from"@element-plus/icons-vue";import t from"./icon";export*from"./icon";import r from"./date";export*from"./date";export*from"./RxButton";const m=[t,r];var n={install:function(t){m.forEach((o=>{t.component(o.name,o)})),t.use(o),Object.entries(e).forEach((([o,e])=>{t.component(o,e)}))}};export{n as default};
|
package/es/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { App } from
|
|
2
|
-
import 'virtual:windi.css';
|
|
1
|
+
import type { App } from "vue";
|
|
3
2
|
declare const _default: {
|
|
4
3
|
install: (app: App<any>) => void;
|
|
5
4
|
};
|
|
6
5
|
export default _default;
|
|
7
|
-
export * from
|
|
6
|
+
export * from "rx-compo/es/components";
|
package/es/index.js
CHANGED
|
@@ -1,14 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export * from 'rx-compo/es/components';
|
|
3
|
-
import 'virtual:windi.css';
|
|
4
|
-
|
|
5
|
-
const install = (app) => {
|
|
6
|
-
Object.entries(components).forEach(([name, component]) => {
|
|
7
|
-
app.component(name, component);
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var index = {
|
|
11
|
-
install
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export { index as default };
|
|
1
|
+
import*as o from"rx-compo/es/components";export*from"rx-compo/es/components";import e from"element-plus";import*as t from"@element-plus/icons-vue";var r={install:r=>{Object.entries(o).forEach((([o,e])=>{r.component(o,e)})),r.use(e),Object.entries(t).forEach((([o,e])=>{r.component(o,e)}))}};export{r as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/props';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/props';
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { IfAny } from '@vue/shared';
|
|
2
|
+
import type { Prop, VNode } from 'vue';
|
|
3
|
+
import type { VueTypeDef, VueTypeValidableDef } from 'vue-types';
|
|
4
|
+
import type { InferType, VueProp, Prop as VueTypeProp } from 'vue-types/dist/types';
|
|
5
|
+
import { arrayOf, custom, instanceOf, objectOf, shape } from 'vue-types';
|
|
6
|
+
export declare type MaybeArray<T> = T | T[];
|
|
7
|
+
declare type PublicRequiredKeys<T> = {
|
|
8
|
+
[K in keyof T]: T[K] extends {
|
|
9
|
+
required: true;
|
|
10
|
+
} ? K : never;
|
|
11
|
+
}[keyof T];
|
|
12
|
+
declare type PublicOptionalKeys<T> = Exclude<keyof T, PublicRequiredKeys<T>>;
|
|
13
|
+
declare type InnerRequiredKeys<T> = {
|
|
14
|
+
[K in keyof T]: T[K] extends {
|
|
15
|
+
required: true;
|
|
16
|
+
} | {
|
|
17
|
+
default: any;
|
|
18
|
+
} ? T[K] extends {
|
|
19
|
+
default: undefined;
|
|
20
|
+
} ? never : K : never;
|
|
21
|
+
}[keyof T];
|
|
22
|
+
declare type InnerOptionalKeys<T> = Exclude<keyof T, InnerRequiredKeys<T>>;
|
|
23
|
+
declare type InferPropType<T> = [T] extends [null] ? any : [T] extends [{
|
|
24
|
+
type: null | true;
|
|
25
|
+
}] ? any : [T] extends [ObjectConstructor | {
|
|
26
|
+
type: ObjectConstructor;
|
|
27
|
+
}] ? Record<string, any> : [T] extends [BooleanConstructor | {
|
|
28
|
+
type: BooleanConstructor;
|
|
29
|
+
}] ? boolean : [T] extends [DateConstructor | {
|
|
30
|
+
type: DateConstructor;
|
|
31
|
+
}] ? Date : [T] extends [(infer U)[] | {
|
|
32
|
+
type: (infer U)[];
|
|
33
|
+
}] ? U extends DateConstructor ? Date | InferPropType<U> : InferPropType<U> : [T] extends [Prop<infer V, infer D>] ? unknown extends V ? IfAny<V, V, D> : V : T;
|
|
34
|
+
export declare type ExtractPublicPropTypes<O> = {
|
|
35
|
+
[K in keyof Pick<O, PublicRequiredKeys<O>>]: InferPropType<O[K]>;
|
|
36
|
+
} & {
|
|
37
|
+
[K in keyof Pick<O, PublicOptionalKeys<O>>]?: InferPropType<O[K]>;
|
|
38
|
+
};
|
|
39
|
+
export declare type ExtractInnerPropTypes<O> = {
|
|
40
|
+
[K in keyof Pick<O, InnerRequiredKeys<O>>]: InferPropType<O[K]>;
|
|
41
|
+
} & {
|
|
42
|
+
[K in keyof Pick<O, InnerOptionalKeys<O>>]?: InferPropType<O[K]>;
|
|
43
|
+
};
|
|
44
|
+
export declare class IxPropTypes {
|
|
45
|
+
static get any(): VueTypeValidableDef<any>;
|
|
46
|
+
static get bool(): VueTypeValidableDef<boolean>;
|
|
47
|
+
static get string(): VueTypeValidableDef<string>;
|
|
48
|
+
static get number(): VueTypeValidableDef<number>;
|
|
49
|
+
static get integer(): VueTypeValidableDef<number>;
|
|
50
|
+
static get symbol(): VueTypeDef<symbol>;
|
|
51
|
+
static custom: typeof custom;
|
|
52
|
+
static instanceOf: typeof instanceOf;
|
|
53
|
+
static arrayOf: typeof arrayOf;
|
|
54
|
+
static objectOf: typeof objectOf;
|
|
55
|
+
static shape: typeof shape;
|
|
56
|
+
static object<T>(): VueTypeValidableDef<T>;
|
|
57
|
+
static func<T extends (...args: any[]) => any>(): VueTypeValidableDef<T>;
|
|
58
|
+
static array<T>(): VueTypeValidableDef<T[]>;
|
|
59
|
+
static oneOfType<T>(arr: Array<VueProp<T> | VueTypeProp<T>>): VueTypeDef<T>;
|
|
60
|
+
static oneOfType<U extends VueProp<any> | VueTypeProp<any>, V = InferType<U>>(arr: U[]): VueTypeDef<V>;
|
|
61
|
+
static oneOf<T>(arr: T[]): VueTypeDef<T>;
|
|
62
|
+
static oneOf<T extends readonly any[]>(arr: T): VueTypeDef<T[number]>;
|
|
63
|
+
static get vNode(): VueTypeValidableDef<VNode>;
|
|
64
|
+
static maxLength(max: number): VueTypeValidableDef<string>;
|
|
65
|
+
static minLength(min: number): VueTypeValidableDef<string>;
|
|
66
|
+
static max(max: number): VueTypeValidableDef<number>;
|
|
67
|
+
static min(min: number): VueTypeValidableDef<number>;
|
|
68
|
+
static range(min: number, max: number): VueTypeValidableDef<number>;
|
|
69
|
+
static emit<T extends (...args: any[]) => any>(): VueTypeDef<T | T[]>;
|
|
70
|
+
}
|
|
71
|
+
export declare function callEmit<T extends (...args: any[]) => any>(funcs: T[] | T | undefined, ...args: Parameters<T>): ReturnType<T> | void;
|
|
72
|
+
export declare type VKey = string | number | symbol;
|
|
73
|
+
export declare const vKeyPropDef: VueTypeDef<string | number | symbol>;
|
|
74
|
+
export {};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { isVNode } from 'vue';
|
|
2
|
+
import { array, arrayOf, custom, func, instanceOf, object, objectOf, oneOf, oneOfType, shape, toType, toValidableType, } from 'vue-types';
|
|
3
|
+
export class IxPropTypes {
|
|
4
|
+
static get any() {
|
|
5
|
+
return toValidableType('any', { default: undefined });
|
|
6
|
+
}
|
|
7
|
+
static get bool() {
|
|
8
|
+
return toValidableType('boolean', {
|
|
9
|
+
type: Boolean,
|
|
10
|
+
default: undefined,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
static get string() {
|
|
14
|
+
return toValidableType('string', {
|
|
15
|
+
type: String,
|
|
16
|
+
default: undefined,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
static get number() {
|
|
20
|
+
return toValidableType('number', {
|
|
21
|
+
type: Number,
|
|
22
|
+
default: undefined,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
static get integer() {
|
|
26
|
+
return toValidableType('integer', {
|
|
27
|
+
type: Number,
|
|
28
|
+
validator(value) {
|
|
29
|
+
return Number.isInteger(value);
|
|
30
|
+
},
|
|
31
|
+
default: undefined,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
static get symbol() {
|
|
35
|
+
return toType('symbol', {
|
|
36
|
+
validator(value) {
|
|
37
|
+
return typeof value === 'symbol';
|
|
38
|
+
},
|
|
39
|
+
default: undefined,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
static object() {
|
|
43
|
+
return object();
|
|
44
|
+
}
|
|
45
|
+
static func() {
|
|
46
|
+
return func();
|
|
47
|
+
}
|
|
48
|
+
static array() {
|
|
49
|
+
return array();
|
|
50
|
+
}
|
|
51
|
+
static oneOfType(arr) {
|
|
52
|
+
const type = oneOfType(arr);
|
|
53
|
+
type.default = undefined;
|
|
54
|
+
return type;
|
|
55
|
+
}
|
|
56
|
+
static oneOf(arr) {
|
|
57
|
+
return oneOf(arr);
|
|
58
|
+
}
|
|
59
|
+
static get vNode() {
|
|
60
|
+
return toValidableType('vNode', {
|
|
61
|
+
type: Object,
|
|
62
|
+
validator: (value) => isVNode(value),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
static maxLength(max) {
|
|
66
|
+
return toValidableType('maxLength', {
|
|
67
|
+
type: String,
|
|
68
|
+
validator: (value) => value.length <= max,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
static minLength(min) {
|
|
72
|
+
return toValidableType('minLength', {
|
|
73
|
+
type: String,
|
|
74
|
+
validator: (value) => value.length >= min,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
static max(max) {
|
|
78
|
+
return toValidableType('max', {
|
|
79
|
+
type: Number,
|
|
80
|
+
validator: (value) => value <= max,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
static min(min) {
|
|
84
|
+
return toValidableType('min', {
|
|
85
|
+
type: Number,
|
|
86
|
+
validator: (value) => value >= min,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
static range(min, max) {
|
|
90
|
+
return toValidableType('range', {
|
|
91
|
+
type: Number,
|
|
92
|
+
validator: (value) => value >= min && value <= max,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
static emit() {
|
|
96
|
+
return oneOfType([func(), array()]);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
IxPropTypes.custom = custom;
|
|
100
|
+
IxPropTypes.instanceOf = instanceOf;
|
|
101
|
+
IxPropTypes.arrayOf = arrayOf;
|
|
102
|
+
IxPropTypes.objectOf = objectOf;
|
|
103
|
+
IxPropTypes.shape = shape;
|
|
104
|
+
export function callEmit(funcs, ...args) {
|
|
105
|
+
if (!funcs) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (Array.isArray(funcs)) {
|
|
109
|
+
funcs.forEach(fn => fn(...args));
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
return funcs(...args);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
export const vKeyPropDef = IxPropTypes.oneOfType([String, Number, Symbol]);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { Plugin } from
|
|
1
|
+
import type { Plugin } from "vue";
|
|
2
2
|
export declare type SFCWithInstall<T> = T & Plugin;
|
|
3
|
-
export declare const withInstall: <T>(comp: any) =>
|
|
3
|
+
export declare const withInstall: <T>(comp: any) => any;
|