@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.
Files changed (40) hide show
  1. package/dist/star-ui.common.js +1053 -758
  2. package/dist/star-ui.common.js.map +1 -1
  3. package/dist/star-ui.umd.js +1053 -758
  4. package/dist/star-ui.umd.js.map +1 -1
  5. package/dist/star-ui.umd.min.js +62 -62
  6. package/dist/star-ui.umd.min.js.map +1 -1
  7. package/package.json +1 -1
  8. package/src/components/button.vue +1 -1
  9. package/src/components/calendar.vue +8 -8
  10. package/src/components/card.vue +1 -1
  11. package/src/components/common/base-popper.vue +9 -6
  12. package/src/components/form/form/form-item.vue +96 -0
  13. package/src/components/form/form/form.vue +51 -0
  14. package/src/components/form/form/index.ts +2 -0
  15. package/src/components/form/index.ts +1 -0
  16. package/src/components/input.vue +2 -1
  17. package/src/components/layout-h.vue +4 -4
  18. package/src/components/layout-main.vue +2 -2
  19. package/src/components/layout-v.vue +4 -4
  20. package/src/components/line-h.vue +2 -2
  21. package/src/components/line-v.vue +2 -2
  22. package/src/components/menu/index.vue +2 -2
  23. package/src/components/select.vue +6 -6
  24. package/src/components/switch.vue +1 -1
  25. package/src/components/table.vue +11 -11
  26. package/src/components/tree/index.vue +1 -0
  27. package/src/components/view-control.vue +11 -17
  28. package/src/global-style.css +73 -1
  29. package/src/main.ts +1 -0
  30. package/src/outher/index.ts +5 -1
  31. package/src/reg.ts +38 -3
  32. package/types/components/common/base-popper.vue.d.ts +1 -0
  33. package/types/components/form/form/form-item.vue.d.ts +15 -0
  34. package/types/components/form/form/form.vue.d.ts +8 -0
  35. package/types/components/form/form/index.d.ts +2 -0
  36. package/types/components/form/index.d.ts +1 -0
  37. package/types/components/view-control.vue.d.ts +1 -0
  38. package/types/main.d.ts +1 -0
  39. package/types/outher/index.d.ts +3 -0
  40. 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
- export function Prop(propOptions:PropOptions):VueDecorator{
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] = propOptions;
124
+ componentOptions.props[key] = {
125
+ ...eData,
126
+ ...propOptions
127
+ };
93
128
  });
94
129
  }
@@ -14,5 +14,6 @@ export default class SuButton extends Vue {
14
14
  _clickCheck(ev: MouseEvent): boolean;
15
15
  private syncRequestId;
16
16
  _updateVisible(): void;
17
+ readonly ctrlClass: string[];
17
18
  updatePos(): void;
18
19
  }
@@ -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,2 @@
1
+ export { default as SuForm } from "./form.vue";
2
+ export { default as SuFormItem } from "./form-item.vue";
@@ -0,0 +1 @@
1
+ export * from "./form/index";
@@ -9,6 +9,7 @@ export default class SuViewControl extends Vue {
9
9
  private windowHeight;
10
10
  checkWindowSize(): void;
11
11
  get $isMobile(): boolean;
12
+ get className(): string[];
12
13
  beforeMount(): void;
13
14
  beforeUnmount(): void;
14
15
  }
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";
@@ -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
- export declare function Prop(propOptions: PropOptions): VueDecorator;
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 {};