@thestarweb/ui 1.5.2 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/star-ui.common.js +1053 -758
- package/dist/star-ui.common.js.map +1 -1
- package/dist/star-ui.umd.js +1053 -758
- package/dist/star-ui.umd.js.map +1 -1
- package/dist/star-ui.umd.min.js +62 -62
- package/dist/star-ui.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/button.vue +1 -1
- package/src/components/calendar.vue +8 -8
- package/src/components/card.vue +1 -1
- package/src/components/common/base-popper.vue +9 -6
- package/src/components/form/form/form-item.vue +96 -0
- package/src/components/form/form/form.vue +51 -0
- package/src/components/form/form/index.ts +2 -0
- package/src/components/form/index.ts +1 -0
- package/src/components/input.vue +2 -1
- package/src/components/layout-h.vue +4 -4
- package/src/components/layout-main.vue +2 -2
- package/src/components/layout-v.vue +4 -4
- package/src/components/line-h.vue +2 -2
- package/src/components/line-v.vue +2 -2
- package/src/components/menu/index.vue +2 -2
- package/src/components/select.vue +6 -6
- package/src/components/switch.vue +1 -1
- package/src/components/table.vue +11 -11
- package/src/components/tree/index.vue +1 -0
- package/src/components/view-control.vue +11 -17
- package/src/global-style.css +73 -1
- package/src/main.ts +1 -0
- package/src/outher/index.ts +5 -1
- package/src/reg.ts +38 -3
- package/types/components/common/base-popper.vue.d.ts +1 -0
- package/types/components/form/form/form-item.vue.d.ts +15 -0
- package/types/components/form/form/form.vue.d.ts +8 -0
- package/types/components/form/form/index.d.ts +2 -0
- package/types/components/form/index.d.ts +1 -0
- package/types/components/view-control.vue.d.ts +1 -0
- package/types/main.d.ts +1 -0
- package/types/outher/index.d.ts +3 -0
- package/types/reg.d.ts +10 -1
package/src/reg.ts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { VueDecorator, PropOptions, createDecorator, Vue, VueConstructor, VueBase } from "vue-class-component";
|
|
2
|
-
import { ComponentOptions, reactive } from "vue";
|
|
2
|
+
import { ComponentOptions, PropType, reactive } from "vue";
|
|
3
3
|
interface ComponentInfo{
|
|
4
4
|
hideInDoc?:boolean;
|
|
5
5
|
internalOnly?:boolean;
|
|
6
6
|
type?:'from'|'layout';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
const AutoTypes = {
|
|
10
|
+
FormLabelAlign: {
|
|
11
|
+
allow: ['left','right','top'],
|
|
12
|
+
type: String,
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
9
16
|
export const data = reactive({
|
|
10
17
|
//
|
|
11
18
|
} as {[key:string]: {
|
|
@@ -80,7 +87,18 @@ export function Emit(event?:string, shouldEmit?:(res:any)=>boolean):VueDecorator
|
|
|
80
87
|
});
|
|
81
88
|
}
|
|
82
89
|
|
|
83
|
-
|
|
90
|
+
interface RegPropOptions<T = any, D = T> extends PropOptions<T>{
|
|
91
|
+
autoType?: keyof typeof AutoTypes;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
95
|
+
function checkPropInAllow(list:any[]){
|
|
96
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
97
|
+
return function(value:any){
|
|
98
|
+
return list.includes(value);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
export function Prop({ autoType , ...propOptions}:RegPropOptions):VueDecorator{
|
|
84
102
|
return createDecorator((componentOptions, key) => {
|
|
85
103
|
if(componentOptions.name){
|
|
86
104
|
if(!data[componentOptions.name]) data[componentOptions.name] = {};
|
|
@@ -88,7 +106,24 @@ export function Prop(propOptions:PropOptions):VueDecorator{
|
|
|
88
106
|
// eslint-disable-next-line
|
|
89
107
|
(data[componentOptions.name].props!)[key] = propOptions;
|
|
90
108
|
}
|
|
109
|
+
const eData:PropOptions = {};
|
|
110
|
+
if(autoType){
|
|
111
|
+
const autoTypeData = AutoTypes[autoType];
|
|
112
|
+
if(autoTypeData.type){
|
|
113
|
+
eData.type = autoTypeData.type;
|
|
114
|
+
}
|
|
115
|
+
const validator = [];
|
|
116
|
+
if(autoTypeData.allow){
|
|
117
|
+
validator.push(checkPropInAllow(autoTypeData.allow))
|
|
118
|
+
}
|
|
119
|
+
if(validator.length === 1){
|
|
120
|
+
eData.validator = validator[0];
|
|
121
|
+
}
|
|
122
|
+
}
|
|
91
123
|
if(!componentOptions.props) componentOptions.props={};
|
|
92
|
-
componentOptions.props[key] =
|
|
124
|
+
componentOptions.props[key] = {
|
|
125
|
+
...eData,
|
|
126
|
+
...propOptions
|
|
127
|
+
};
|
|
93
128
|
});
|
|
94
129
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Vue } from "vue-class-component";
|
|
2
|
+
import { TypeFormLabelAlign } from "../../../outher";
|
|
3
|
+
import "@ui-root/global-style.css";
|
|
4
|
+
export declare const InjectLabelWidth: unique symbol;
|
|
5
|
+
export declare const InjectLabelAlign: unique symbol;
|
|
6
|
+
export default class SuButton extends Vue {
|
|
7
|
+
readonly label: string;
|
|
8
|
+
readonly labelWidth: string | number | undefined;
|
|
9
|
+
readonly pLabelWidth: string | number | undefined;
|
|
10
|
+
readonly labelAlign: TypeFormLabelAlign;
|
|
11
|
+
readonly pLabelAlign: TypeFormLabelAlign;
|
|
12
|
+
readonly col: number;
|
|
13
|
+
private get labelStyle();
|
|
14
|
+
created(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Vue } from "vue-class-component";
|
|
2
|
+
import type { TypeFormLabelAlign } from "../../../outher";
|
|
3
|
+
import "@ui-root/global-style.css";
|
|
4
|
+
export default class SuButton extends Vue {
|
|
5
|
+
readonly labelAlign: TypeFormLabelAlign;
|
|
6
|
+
readonly labelWidth: number | undefined;
|
|
7
|
+
readonly allowAotoMobile: boolean;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./form/index";
|
package/types/main.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export { default as SuHLine } from "./components/line-h.vue";
|
|
|
6
6
|
export { default as SuVLine } from "./components/line-v.vue";
|
|
7
7
|
export { default as SuCard } from "./components/card.vue";
|
|
8
8
|
export { default as SuTree } from "./components/tree/index.vue";
|
|
9
|
+
export * from "./components/form";
|
|
9
10
|
export { default as SuInput } from "./components/input.vue";
|
|
10
11
|
export { default as SuSelect } from "./components/select.vue";
|
|
11
12
|
export { default as SuButton } from "./components/button.vue";
|
package/types/outher/index.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
export declare const SuViewCtrlInjectKeyIsMobile: unique symbol;
|
|
2
2
|
export declare const SuViewCtrlInjectIsMobile: import("vue-class-component").VueDecorator;
|
|
3
|
+
export declare const SuViewCtrlInjectKeyClassName: unique symbol;
|
|
4
|
+
export declare const SuViewCtrlInjectClassName: import("vue-class-component").VueDecorator;
|
|
5
|
+
export declare type TypeFormLabelAlign = 'left' | 'right' | 'top' | undefined;
|
package/types/reg.d.ts
CHANGED
|
@@ -5,6 +5,12 @@ interface ComponentInfo {
|
|
|
5
5
|
internalOnly?: boolean;
|
|
6
6
|
type?: 'from' | 'layout';
|
|
7
7
|
}
|
|
8
|
+
declare const AutoTypes: {
|
|
9
|
+
FormLabelAlign: {
|
|
10
|
+
allow: string[];
|
|
11
|
+
type: StringConstructor;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
8
14
|
export declare const data: {
|
|
9
15
|
[x: string]: {
|
|
10
16
|
props?: {
|
|
@@ -32,5 +38,8 @@ export declare const data: {
|
|
|
32
38
|
export declare type RegisterOptions<V> = ComponentOptions & ThisType<V> & ComponentInfo;
|
|
33
39
|
export declare function Register<V extends Vue>({ hideInDoc, internalOnly, ...options }: RegisterOptions<V>): <VC extends VueConstructor<VueBase>>(target: VC) => VC;
|
|
34
40
|
export declare function Emit(event?: string, shouldEmit?: (res: any) => boolean): VueDecorator;
|
|
35
|
-
|
|
41
|
+
interface RegPropOptions<T = any, D = T> extends PropOptions<T> {
|
|
42
|
+
autoType?: keyof typeof AutoTypes;
|
|
43
|
+
}
|
|
44
|
+
export declare function Prop({ autoType, ...propOptions }: RegPropOptions): VueDecorator;
|
|
36
45
|
export {};
|