@thestarweb/ui 1.5.2 → 1.7.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 (71) hide show
  1. package/dist/star-ui.common.js +9086 -1335
  2. package/dist/star-ui.common.js.map +1 -1
  3. package/dist/star-ui.umd.js +9088 -1337
  4. package/dist/star-ui.umd.js.map +1 -1
  5. package/dist/star-ui.umd.min.js +139 -139
  6. package/dist/star-ui.umd.min.js.map +1 -1
  7. package/package.json +1 -1
  8. package/src/components/button.vue +4 -4
  9. package/src/components/calendar.vue +8 -8
  10. package/src/components/card.vue +1 -1
  11. package/src/components/common/base-popper.vue +28 -27
  12. package/src/components/content/context-menu-box/index.vue +117 -0
  13. package/src/components/content/index.ts +5 -1
  14. package/src/components/{menu → content/menu}/index.vue +2 -2
  15. package/src/components/{menu → content/menu}/menu-h/index.vue +3 -1
  16. package/src/components/{menu → content/menu}/menu-h/menu-h-child.vue +0 -0
  17. package/src/components/{menu → content/menu}/menu-h/menu-h-item.vue +4 -3
  18. package/src/components/{menu → content/menu}/menu-v/index.vue +0 -0
  19. package/src/components/content/modals/confirm.vue +45 -0
  20. package/src/components/content/modals/modal.vue +110 -0
  21. package/src/components/content/page.vue +2 -1
  22. package/src/components/form/form/form-item.vue +116 -0
  23. package/src/components/form/form/form.vue +109 -0
  24. package/src/components/form/form/index.ts +2 -0
  25. package/src/components/form/index.ts +1 -0
  26. package/src/components/input.vue +2 -1
  27. package/src/components/layout/auto-direction/index.vue +28 -0
  28. package/src/components/layout/index.ts +1 -0
  29. package/src/components/layout-h.vue +4 -4
  30. package/src/components/layout-main.vue +2 -2
  31. package/src/components/layout-v.vue +4 -4
  32. package/src/components/line-h.vue +2 -2
  33. package/src/components/line-v.vue +2 -2
  34. package/src/components/select.vue +6 -6
  35. package/src/components/switch.vue +1 -1
  36. package/src/components/table.vue +11 -11
  37. package/src/components/tree/index.vue +1 -0
  38. package/src/components/view-control.vue +12 -19
  39. package/src/func/download.ts +15 -0
  40. package/src/func/index.ts +2 -0
  41. package/src/func/modal/index.ts +72 -0
  42. package/src/global-style.css +75 -1
  43. package/src/main.ts +5 -1
  44. package/src/outher/index.ts +5 -1
  45. package/src/reg.ts +38 -3
  46. package/src/types.d.ts +6 -0
  47. package/types/components/common/base-popper.vue.d.ts +5 -2
  48. package/types/components/content/context-menu-box/index.vue.d.ts +20 -0
  49. package/types/components/content/index.d.ts +4 -0
  50. package/types/components/{menu → content/menu}/index.vue.d.ts +0 -0
  51. package/types/components/{menu → content/menu}/menu-h/index.vue.d.ts +0 -0
  52. package/types/components/{menu → content/menu}/menu-h/menu-h-child.vue.d.ts +0 -0
  53. package/types/components/{menu → content/menu}/menu-h/menu-h-item.vue.d.ts +0 -0
  54. package/types/components/{menu → content/menu}/menu-v/index.vue.d.ts +0 -0
  55. package/types/components/content/modals/confirm.vue.d.ts +7 -0
  56. package/types/components/content/modals/modal.vue.d.ts +12 -0
  57. package/types/components/form/form/form-item.vue.d.ts +22 -0
  58. package/types/components/form/form/form.vue.d.ts +24 -0
  59. package/types/components/form/form/index.d.ts +2 -0
  60. package/types/components/form/index.d.ts +1 -0
  61. package/types/components/layout/auto-direction/index.vue.d.ts +4 -0
  62. package/types/components/layout/index.d.ts +1 -0
  63. package/types/components/view-control.vue.d.ts +1 -0
  64. package/types/func/download.d.ts +1 -0
  65. package/types/func/index.d.ts +2 -0
  66. package/types/func/modal/index.d.ts +13 -0
  67. package/types/main.d.ts +3 -1
  68. package/types/outher/index.d.ts +3 -0
  69. package/types/reg.d.ts +10 -1
  70. package/src/components/menu/index.ts +0 -1
  71. package/types/components/menu/index.d.ts +0 -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
  }
package/src/types.d.ts CHANGED
@@ -7,3 +7,9 @@ export interface MenuItem{
7
7
  title:string;
8
8
  children?:MenuItem[];
9
9
  }
10
+ export interface ContextMenuItem{
11
+ name?:string;
12
+ click?:() => unknown;
13
+ title:string;
14
+ children?:ContextMenuItem[];
15
+ }
@@ -1,18 +1,21 @@
1
1
  import { Vue } from 'vue-class-component';
2
2
  import "../../global-style.css";
3
3
  export default class SuButton extends Vue {
4
+ $refs: {
5
+ root: HTMLDivElement;
6
+ };
4
7
  fromItem: Vue | HTMLElement;
5
8
  private div;
6
9
  private id;
7
10
  private updateType;
8
11
  private visible;
9
12
  readonly isMobile: false;
10
- beforeCreate(): void;
11
- unmounted(): void;
12
13
  mounted(): void;
13
14
  beforeUnmount(): void;
14
15
  _clickCheck(ev: MouseEvent): boolean;
15
16
  private syncRequestId;
16
17
  _updateVisible(): void;
18
+ readonly ctrlClass: string[];
19
+ private baseStyle;
17
20
  updatePos(): void;
18
21
  }
@@ -0,0 +1,20 @@
1
+ import { Vue } from "vue-class-component";
2
+ import "@ui-root/global-style.css";
3
+ import { ContextMenuItem } from "../../../types";
4
+ export default class SuMain extends Vue {
5
+ private itemComponent;
6
+ $refs: {
7
+ mask: HTMLDivElement;
8
+ };
9
+ readonly isMobile: boolean;
10
+ readonly ctrlClass: string[];
11
+ private get component();
12
+ private menu;
13
+ private isOpenMenu;
14
+ private currentMenu;
15
+ private currentX;
16
+ private currentY;
17
+ private handleContextMenu;
18
+ handleMaskClick(ev: MouseEvent): void;
19
+ handleItemClick(item: ContextMenuItem): void;
20
+ }
@@ -1 +1,5 @@
1
1
  export { default as SuPage } from "./page.vue";
2
+ export { default as SuMenu } from "./menu/index.vue";
3
+ export { default as SuContextMenuBox } from "./context-menu-box/index.vue";
4
+ export { default as SuModal } from "./modals/modal.vue";
5
+ export { default as SuModalConfirm } from "./modals/confirm.vue";
@@ -0,0 +1,7 @@
1
+ import { Vue } from 'vue-class-component';
2
+ export default class SuModalConfirm extends Vue {
3
+ private readonly title;
4
+ private readonly visible;
5
+ private close;
6
+ private confirm;
7
+ }
@@ -0,0 +1,12 @@
1
+ import { Vue } from 'vue-class-component';
2
+ import "@ui-root/global-style.css";
3
+ export default class SuModalConfirm extends Vue {
4
+ private readonly visible;
5
+ private locVisable;
6
+ private updateVisable;
7
+ close(): void;
8
+ show(): void;
9
+ private readonly title;
10
+ created(): void;
11
+ readonly isMobile: boolean;
12
+ }
@@ -0,0 +1,22 @@
1
+ import { Vue } from "vue-class-component";
2
+ import { TypeFormLabelAlign } from "../../../outher";
3
+ import { Bus } from "./form.vue";
4
+ import "@ui-root/global-style.css";
5
+ export declare const InjectLabelWidth: unique symbol;
6
+ export declare const InjectLabelAlign: unique symbol;
7
+ export declare const InjectEventBus: unique symbol;
8
+ export default class SuButton extends Vue {
9
+ $refs: {
10
+ labelDiv: HTMLDivElement;
11
+ };
12
+ readonly label: string;
13
+ readonly labelWidth: string | number | undefined;
14
+ readonly pLabelWidth: string | number | undefined;
15
+ readonly labelAlign: TypeFormLabelAlign;
16
+ readonly pLabelAlign: TypeFormLabelAlign;
17
+ readonly col: number;
18
+ private get labelStyle();
19
+ readonly bus: Bus | undefined;
20
+ created(): void;
21
+ beforeUnmount(): void;
22
+ }
@@ -0,0 +1,24 @@
1
+ import { Vue } from "vue-class-component";
2
+ import type { TypeFormLabelAlign } from "../../../outher";
3
+ import Item from "./form-item.vue";
4
+ import "@ui-root/global-style.css";
5
+ export interface Bus {
6
+ addItem: (item: Item) => void;
7
+ removeItem: (item: Item) => void;
8
+ labelUpdate: (item: Item) => void;
9
+ }
10
+ export default class SuButton extends Vue {
11
+ readonly labelAlign: TypeFormLabelAlign;
12
+ readonly labelWidth: number | undefined;
13
+ readonly allowAotoMobile: boolean;
14
+ private bus;
15
+ private items;
16
+ private addItem;
17
+ private removeItem;
18
+ private updateLabelWidth;
19
+ private isLoaded;
20
+ private sendLabelWidth;
21
+ created(): void;
22
+ mounted(): void;
23
+ beforeUnmount(): void;
24
+ }
@@ -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";
@@ -0,0 +1,4 @@
1
+ import { Vue } from "vue-class-component";
2
+ import "@ui-root/global-style.css";
3
+ export default class SuAutoDirection extends Vue {
4
+ }
@@ -0,0 +1 @@
1
+ export { default as SuAutoDirection } from "./auto-direction/index.vue";
@@ -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
  }
@@ -0,0 +1 @@
1
+ export default function (data: Blob | Uint8Array, name: string): void;
@@ -0,0 +1,2 @@
1
+ export { default as download } from "./download";
2
+ export * from "./modal";
@@ -0,0 +1,13 @@
1
+ import { VNode } from 'vue';
2
+ declare type PWidthClose = Promise<boolean> & {
3
+ close: () => void;
4
+ };
5
+ export declare function confirm(title: string): PWidthClose;
6
+ export declare function modal(slots: {
7
+ title?: string | VNode | (() => VNode | string);
8
+ body?: string | VNode | (() => VNode | string);
9
+ footer?: string | VNode | (() => VNode | string);
10
+ } | VNode | string | (() => VNode | string), controlProp?: {}, defalueShow?: boolean): {
11
+ close: () => any;
12
+ };
13
+ export {};
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";
@@ -13,8 +14,9 @@ export { default as SuSwitch } from "./components/switch.vue";
13
14
  export { default as SuSlider } from "./components/slider.vue";
14
15
  export { default as SuCalendar } from "./components/calendar.vue";
15
16
  export { default as SuViewControl } from "./components/view-control.vue";
16
- export * from "./components/menu";
17
+ export * from "./components/layout";
17
18
  export * from "./components/content";
19
+ export * as func from "./func/index";
18
20
  export * from "./outher";
19
21
  import { App } from "vue";
20
22
  export declare const components: Record<string, any>;
@@ -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 {};
@@ -1 +0,0 @@
1
- export {default as SuMenu} from "./index.vue";
@@ -1 +0,0 @@
1
- export { default as SuMenu } from "./index.vue";