quasar-ui-danx 0.4.28 → 0.4.29

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,5 @@
1
- import { FormField } from "src/types/forms";
2
- import { TableColumn } from "src/types/tables";
3
- import { ComputedRef, Ref, ShallowRef } from "vue";
4
- import { ActionOptions, ActionPanel, ActionTargetItem, ResourceAction } from "./actions";
5
- import { AnyObject, LabelValueItem } from "./shared";
1
+ import { ActionOptions, ActionTargetItem, ResourceAction } from "./actions";
2
+ import { AnyObject, ComputedRef, LabelValueItem, Ref } from "./shared";
6
3
 
7
4
  export interface ListControlsFilter {
8
5
  [key: string]: object | object[] | null | undefined | string | number | boolean;
@@ -22,24 +19,24 @@ export interface FilterGroup {
22
19
  fields: FilterableField[];
23
20
  }
24
21
 
25
- export interface ListControlsRoutes {
26
- list(pager?: ListControlsPagination): Promise<ActionTargetItem[]>;
22
+ export interface ListControlsRoutes<T = ActionTargetItem> {
23
+ list(pager?: ListControlsPagination): Promise<T[]>;
27
24
 
28
25
  summary?(filter?: ListControlsFilter): Promise<AnyObject>;
29
26
 
30
- details?(target: ActionTargetItem): Promise<ActionTargetItem>;
27
+ details?(target: T): Promise<T>;
31
28
 
32
- detailsAndStore?(target: ActionTargetItem): Promise<ActionTargetItem>;
29
+ detailsAndStore?(target: T): Promise<T>;
33
30
 
34
- relation?(target: ActionTargetItem, relation: string): Promise<ActionTargetItem>;
31
+ relation?(target: T, relation: string): Promise<T>;
35
32
 
36
- more?(pager: ListControlsPagination): Promise<ActionTargetItem[]>;
33
+ more?(pager: ListControlsPagination): Promise<T[]>;
37
34
 
38
35
  fieldOptions?(filter?: AnyObject): Promise<AnyObject>;
39
36
 
40
- applyAction?(action: string | ResourceAction | ActionOptions, target: ActionTargetItem | null, data?: object): Promise<AnyObject>;
37
+ applyAction?(action: string | ResourceAction | ActionOptions, target: T | null, data?: object): Promise<AnyObject>;
41
38
 
42
- batchAction?(action: string | ResourceAction | ActionOptions, targets: ActionTargetItem[], data: object): Promise<AnyObject>;
39
+ batchAction?(action: string | ResourceAction | ActionOptions, targets: T[], data: object): Promise<AnyObject>;
43
40
 
44
41
  export?(filter?: ListControlsFilter, name?: string): Promise<void>;
45
42
  }
@@ -63,24 +60,24 @@ export interface ListControlsPagination {
63
60
  filter?: ListControlsFilter;
64
61
  }
65
62
 
66
- export interface PagedItems {
67
- data: ActionTargetItem[] | undefined;
63
+ export interface PagedItems<T = ActionTargetItem> {
64
+ data: T[] | undefined;
68
65
  meta: {
69
66
  total: number;
70
67
  last_page?: number;
71
68
  } | undefined;
72
69
  }
73
70
 
74
- export interface ListController {
71
+ export interface ListController<T = ActionTargetItem> {
75
72
  name: string;
76
73
  label: string;
77
- pagedItems: Ref<PagedItems | null>;
74
+ pagedItems: Ref<PagedItems<T> | null>;
78
75
  activeFilter: Ref<ListControlsFilter>;
79
76
  globalFilter: Ref<ListControlsFilter>;
80
77
  filterActiveCount: ComputedRef<number>;
81
78
  showFilters: Ref<boolean>;
82
- summary: ShallowRef<object | null>;
83
- selectedRows: ShallowRef<ActionTargetItem[]>;
79
+ summary: Ref<object | null>;
80
+ selectedRows: Ref<T[]>;
84
81
  isLoadingList: Ref<boolean>;
85
82
  isLoadingFilters: Ref<boolean>;
86
83
  isLoadingSummary: Ref<boolean>;
@@ -90,15 +87,15 @@ export interface ListController {
90
87
  filter: ListControlsFilter;
91
88
  sort: object[] | undefined;
92
89
  }>;
93
- pagination: ShallowRef<ListControlsPagination>;
94
- activeItem: ShallowRef<ActionTargetItem | null>;
95
- activePanel: ShallowRef<string | null>;
90
+ pagination: Ref<ListControlsPagination>;
91
+ activeItem: Ref<T | null>;
92
+ activePanel: Ref<string | null>;
96
93
 
97
94
  // List Controls
98
95
  initialize: () => void;
99
96
  resetPaging: () => void;
100
97
  setPagination: (updated: Partial<ListControlsPagination>) => void;
101
- setSelectedRows: (selection: ActionTargetItem[]) => void;
98
+ setSelectedRows: (selection: T[]) => void;
102
99
  clearSelectedRows: () => void;
103
100
  loadList: (filter?: ListControlsFilter) => Promise<void>;
104
101
  loadSummary: (filter?: ListControlsFilter) => Promise<void>;
@@ -108,26 +105,10 @@ export interface ListController {
108
105
  getActiveItemDetails: () => Promise<void>;
109
106
  refreshAll: () => Promise<void[]>;
110
107
  exportList: (filter?: ListControlsFilter) => Promise<void>;
111
- setActiveItem: (item: ActionTargetItem | null) => void;
108
+ setActiveItem: (item: T | null) => void;
112
109
  getNextItem: (offset: number) => Promise<void>;
113
- activatePanel: (item: ActionTargetItem | null, panel: string) => void;
110
+ activatePanel: (item: T | null, panel: string) => void;
114
111
  setActiveFilter: (filter?: ListControlsFilter) => void;
115
112
  applyFilterFromUrl: (url: string, filters?: Ref<FilterGroup[]> | null) => void;
116
113
  getFieldOptions: (field: string) => any[];
117
114
  }
118
-
119
- export interface ActionController {
120
- // Actions
121
- action?: (actionName: string, target?: ActionTargetItem | null, input?: any) => Promise<any | void>;
122
- getAction?: (actionName: string, actionOptions?: Partial<ActionOptions>) => ResourceAction;
123
- getActions?: (names?: string[]) => ResourceAction[];
124
- extendAction?: (actionName: string, extendedId: string | number, actionOptions: Partial<ActionOptions>) => ResourceAction;
125
- modifyAction?: (actionName: string, actionOptions: Partial<ActionOptions>) => ResourceAction;
126
- batchActions?: ResourceAction[];
127
- menuActions?: ResourceAction[];
128
- columns?: TableColumn[];
129
- filters?: ComputedRef<FilterGroup[]>;
130
- fields?: FormField[];
131
- panels?: ActionPanel[];
132
- routes?: ListControlsRoutes;
133
- }
@@ -12,6 +12,7 @@ export interface TextFieldProps {
12
12
  inputClass?: string | object;
13
13
  allowOverMax?: boolean;
14
14
  maxLength?: number;
15
+ rows?: number;
15
16
  autogrow?: boolean;
16
17
  noLabel?: boolean;
17
18
  showName?: boolean;
@@ -3,7 +3,7 @@ import { AnyObject, TypedObject } from "src/types/shared";
3
3
  export interface FileUploadOptions {
4
4
  directory?: string,
5
5
  createPresignedUpload?: ((path: string, name: string, mime?: string) => Promise<UploadedFile>) | null;
6
- completePresignedUpload?: ((fileId: string) => Promise<UploadedFile>) | null;
6
+ completePresignedUpload?: ((fileId: string, file: XHRFileUpload) => Promise<UploadedFile>) | null;
7
7
  refreshFile?: ((fileId: string) => Promise<UploadedFile>) | null;
8
8
  }
9
9
 
@@ -25,7 +25,7 @@ export interface UploadedFile extends TypedObject {
25
25
  mimeType?: string;
26
26
  mime?: string;
27
27
  progress?: number;
28
- location?: string;
28
+ location?: string | Partial<GeolocationCoordinates> | null;
29
29
  blobUrl?: string;
30
30
  url?: string;
31
31
  thumb?: UploadedFile;
@@ -1,3 +1,6 @@
1
+ import { ActionController, ActionTargetItem } from "./actions";
2
+ import { ListController } from "./controls";
3
+
1
4
  export * from "./actions";
2
5
  export * from "./config";
3
6
  export * from "./controls";
@@ -9,3 +12,5 @@ export * from "./forms";
9
12
  export * from "./requests";
10
13
  export * from "./shared";
11
14
  export * from "./tables";
15
+
16
+ export type DanxController<T = ActionTargetItem> = ActionController<T> & ListController<T>;
@@ -14,3 +14,12 @@ export interface LabelValueItem {
14
14
  label: string;
15
15
  value: string | number | boolean;
16
16
  }
17
+
18
+ /** Define Vue 3 Types here for better type checking in PHPStorm */
19
+ export interface Ref<T = any> {
20
+ value: T;
21
+ }
22
+
23
+ export interface ComputedRef<T = any> {
24
+ readonly value: T;
25
+ }
@@ -1,8 +1,8 @@
1
1
  import { VNode } from "vue";
2
- import { ActionOptions } from "./actions";
2
+ import { ActionOptions, ActionTargetItem } from "./actions";
3
3
 
4
- export interface TableColumn {
5
- actionMenu?: ActionOptions[];
4
+ export interface TableColumn<T = ActionTargetItem> {
5
+ actionMenu?: ActionOptions<T>[];
6
6
  align?: string;
7
7
  category?: string;
8
8
  class?: string | object;