@ramathibodi/nuxt-commons 4.0.10 → 4.0.12
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/README.md +8 -0
- package/dist/module.json +1 -1
- package/dist/runtime/components/document/TemplateBuilder.d.vue.ts +8 -3
- package/dist/runtime/components/document/TemplateBuilder.vue +22 -42
- package/dist/runtime/components/document/TemplateBuilder.vue.d.ts +8 -3
- package/dist/runtime/components/form/ActionPad.vue +1 -0
- package/dist/runtime/components/form/Birthdate.d.vue.ts +3 -3
- package/dist/runtime/components/form/Birthdate.vue.d.ts +3 -3
- package/dist/runtime/components/form/Date.vue +11 -6
- package/dist/runtime/components/form/Dialog.d.vue.ts +1 -5
- package/dist/runtime/components/form/Dialog.vue +1 -0
- package/dist/runtime/components/form/Dialog.vue.d.ts +1 -5
- package/dist/runtime/components/form/EditPad.vue +1 -0
- package/dist/runtime/components/form/Pad.d.vue.ts +24 -0
- package/dist/runtime/components/form/Pad.vue +12 -7
- package/dist/runtime/components/form/Pad.vue.d.ts +24 -0
- package/dist/runtime/components/form/Time.vue +10 -5
- package/dist/runtime/components/form/images/Edit.d.vue.ts +1 -3
- package/dist/runtime/components/form/images/Edit.vue.d.ts +1 -3
- package/dist/runtime/components/model/AutoRefreshChip.d.vue.ts +16 -0
- package/dist/runtime/components/model/AutoRefreshChip.vue +34 -0
- package/dist/runtime/components/model/AutoRefreshChip.vue.d.ts +16 -0
- package/dist/runtime/components/model/Table.d.vue.ts +91 -61
- package/dist/runtime/components/model/Table.vue +24 -5
- package/dist/runtime/components/model/Table.vue.d.ts +91 -61
- package/dist/runtime/components/model/iterator.d.vue.ts +103 -71
- package/dist/runtime/components/model/iterator.vue +24 -5
- package/dist/runtime/components/model/iterator.vue.d.ts +103 -71
- package/dist/runtime/composables/apiModel.d.ts +2 -2
- package/dist/runtime/composables/apiModel.js +3 -3
- package/dist/runtime/composables/autoRefresh.d.ts +42 -0
- package/dist/runtime/composables/autoRefresh.js +57 -0
- package/dist/runtime/composables/document/template.js +10 -1
- package/dist/runtime/composables/document/templateInputTypes.d.ts +228 -0
- package/dist/runtime/composables/document/templateInputTypes.js +128 -0
- package/dist/runtime/composables/graphqlModel.d.ts +2 -2
- package/dist/runtime/composables/graphqlModel.js +3 -3
- package/dist/runtime/composables/modelAutoRefresh.d.ts +29 -0
- package/dist/runtime/composables/modelAutoRefresh.js +16 -0
- package/dist/runtime/composables/utils/validation.d.ts +4 -0
- package/dist/runtime/composables/utils/validation.js +2 -0
- package/package.json +4 -2
- package/scripts/generate-ai-summary.mjs +88 -0
- package/scripts/scaffold-playground-pages.mjs +207 -0
|
@@ -23,6 +23,9 @@ interface Props extends /* @vue-ignore */ InstanceType<typeof VDataTable['$props
|
|
|
23
23
|
api?: boolean;
|
|
24
24
|
perPageStorageKey?: string;
|
|
25
25
|
perPageStorageEnabled?: boolean;
|
|
26
|
+
autoRefresh?: number | boolean;
|
|
27
|
+
autoRefreshDefault?: number;
|
|
28
|
+
autoRefreshControl?: boolean;
|
|
26
29
|
}
|
|
27
30
|
/**
|
|
28
31
|
* Public props accepted by ModelTable.
|
|
@@ -36,12 +39,12 @@ declare var __VLS_8: {
|
|
|
36
39
|
operation: {
|
|
37
40
|
openDialog: typeof openDialog;
|
|
38
41
|
openDialogReadonly: typeof openDialogReadonly;
|
|
39
|
-
createItem: (item: Record<string, any>, callback?: FormDialogCallback, importing?: boolean) => Promise<any
|
|
40
|
-
importItems: (importItemsList: Record<string, any>[], callback?: FormDialogCallback) => void;
|
|
41
|
-
updateItem: (item: Record<string, any>, callback?: FormDialogCallback) => Promise<any
|
|
42
|
-
deleteItem: (item: Record<string, any>, callback?: FormDialogCallback) => Promise<any
|
|
43
|
-
reload: () => void;
|
|
44
|
-
setSearch: (keyword: string) => void;
|
|
42
|
+
createItem: ((item: Record<string, any>, callback?: FormDialogCallback, importing?: boolean) => Promise<void>) | ((item: Record<string, any>, callback?: FormDialogCallback, importing?: boolean) => Promise<any>);
|
|
43
|
+
importItems: ((importItems: Record<string, any>[], callback?: FormDialogCallback) => void) | ((importItemsList: Record<string, any>[], callback?: FormDialogCallback) => void);
|
|
44
|
+
updateItem: ((item: Record<string, any>, callback?: FormDialogCallback) => Promise<void>) | ((item: Record<string, any>, callback?: FormDialogCallback) => Promise<any>);
|
|
45
|
+
deleteItem: ((item: Record<string, any>, callback?: FormDialogCallback) => Promise<any>) | ((item: Record<string, any>, callback?: FormDialogCallback) => Promise<any>);
|
|
46
|
+
reload: (() => Promise<void> | undefined) | (() => Promise<void>);
|
|
47
|
+
setSearch: ((keyword: string) => void) | ((keyword: string) => void);
|
|
45
48
|
canServerPageable: boolean;
|
|
46
49
|
canServerSearch: boolean;
|
|
47
50
|
canCreate: boolean;
|
|
@@ -50,20 +53,31 @@ declare var __VLS_8: {
|
|
|
50
53
|
canEditRow: (item: Record<string, any>) => boolean;
|
|
51
54
|
onlyOwnerEdit: boolean;
|
|
52
55
|
onlyOwnerOverridePermission: string | string[] | undefined;
|
|
56
|
+
autoRefresh: import("vue").Raw<import("#imports").UseAutoRefreshHandle>;
|
|
53
57
|
};
|
|
54
58
|
}, __VLS_34: {
|
|
55
59
|
reload: () => void;
|
|
56
|
-
},
|
|
60
|
+
}, __VLS_44: {
|
|
61
|
+
enabled: import("vue").ComputedRef<boolean>;
|
|
62
|
+
isActive: import("vue").ComputedRef<boolean>;
|
|
63
|
+
isLoading: import("vue").ComputedRef<boolean>;
|
|
64
|
+
intervalSeconds: import("vue").ComputedRef<number>;
|
|
65
|
+
remainingSeconds: import("vue").Ref<number>;
|
|
66
|
+
isUserPaused: import("vue").Ref<boolean>;
|
|
67
|
+
togglePause: () => void;
|
|
68
|
+
reset: () => void;
|
|
69
|
+
reload: () => void | Promise<void>;
|
|
70
|
+
}, __VLS_57: {
|
|
57
71
|
items: Record<string, any>[];
|
|
58
72
|
operation: {
|
|
59
73
|
openDialog: typeof openDialog;
|
|
60
74
|
openDialogReadonly: typeof openDialogReadonly;
|
|
61
|
-
createItem: (item: Record<string, any>, callback?: FormDialogCallback, importing?: boolean) => Promise<any
|
|
62
|
-
importItems: (importItemsList: Record<string, any>[], callback?: FormDialogCallback) => void;
|
|
63
|
-
updateItem: (item: Record<string, any>, callback?: FormDialogCallback) => Promise<any
|
|
64
|
-
deleteItem: (item: Record<string, any>, callback?: FormDialogCallback) => Promise<any
|
|
65
|
-
reload: () => void;
|
|
66
|
-
setSearch: (keyword: string) => void;
|
|
75
|
+
createItem: ((item: Record<string, any>, callback?: FormDialogCallback, importing?: boolean) => Promise<void>) | ((item: Record<string, any>, callback?: FormDialogCallback, importing?: boolean) => Promise<any>);
|
|
76
|
+
importItems: ((importItems: Record<string, any>[], callback?: FormDialogCallback) => void) | ((importItemsList: Record<string, any>[], callback?: FormDialogCallback) => void);
|
|
77
|
+
updateItem: ((item: Record<string, any>, callback?: FormDialogCallback) => Promise<void>) | ((item: Record<string, any>, callback?: FormDialogCallback) => Promise<any>);
|
|
78
|
+
deleteItem: ((item: Record<string, any>, callback?: FormDialogCallback) => Promise<any>) | ((item: Record<string, any>, callback?: FormDialogCallback) => Promise<any>);
|
|
79
|
+
reload: (() => Promise<void> | undefined) | (() => Promise<void>);
|
|
80
|
+
setSearch: ((keyword: string) => void) | ((keyword: string) => void);
|
|
67
81
|
canServerPageable: boolean;
|
|
68
82
|
canServerSearch: boolean;
|
|
69
83
|
canCreate: boolean;
|
|
@@ -72,18 +86,19 @@ declare var __VLS_8: {
|
|
|
72
86
|
canEditRow: (item: Record<string, any>) => boolean;
|
|
73
87
|
onlyOwnerEdit: boolean;
|
|
74
88
|
onlyOwnerOverridePermission: string | string[] | undefined;
|
|
89
|
+
autoRefresh: import("vue").Raw<import("#imports").UseAutoRefreshHandle>;
|
|
75
90
|
};
|
|
76
|
-
},
|
|
91
|
+
}, __VLS_70: {
|
|
77
92
|
items: Record<string, any>[];
|
|
78
93
|
operation: {
|
|
79
94
|
openDialog: typeof openDialog;
|
|
80
95
|
openDialogReadonly: typeof openDialogReadonly;
|
|
81
|
-
createItem: (item: Record<string, any>, callback?: FormDialogCallback, importing?: boolean) => Promise<any
|
|
82
|
-
importItems: (importItemsList: Record<string, any>[], callback?: FormDialogCallback) => void;
|
|
83
|
-
updateItem: (item: Record<string, any>, callback?: FormDialogCallback) => Promise<any
|
|
84
|
-
deleteItem: (item: Record<string, any>, callback?: FormDialogCallback) => Promise<any
|
|
85
|
-
reload: () => void;
|
|
86
|
-
setSearch: (keyword: string) => void;
|
|
96
|
+
createItem: ((item: Record<string, any>, callback?: FormDialogCallback, importing?: boolean) => Promise<void>) | ((item: Record<string, any>, callback?: FormDialogCallback, importing?: boolean) => Promise<any>);
|
|
97
|
+
importItems: ((importItems: Record<string, any>[], callback?: FormDialogCallback) => void) | ((importItemsList: Record<string, any>[], callback?: FormDialogCallback) => void);
|
|
98
|
+
updateItem: ((item: Record<string, any>, callback?: FormDialogCallback) => Promise<void>) | ((item: Record<string, any>, callback?: FormDialogCallback) => Promise<any>);
|
|
99
|
+
deleteItem: ((item: Record<string, any>, callback?: FormDialogCallback) => Promise<any>) | ((item: Record<string, any>, callback?: FormDialogCallback) => Promise<any>);
|
|
100
|
+
reload: (() => Promise<void> | undefined) | (() => Promise<void>);
|
|
101
|
+
setSearch: ((keyword: string) => void) | ((keyword: string) => void);
|
|
87
102
|
canServerPageable: boolean;
|
|
88
103
|
canServerSearch: boolean;
|
|
89
104
|
canCreate: boolean;
|
|
@@ -92,17 +107,18 @@ declare var __VLS_8: {
|
|
|
92
107
|
canEditRow: (item: Record<string, any>) => boolean;
|
|
93
108
|
onlyOwnerEdit: boolean;
|
|
94
109
|
onlyOwnerOverridePermission: string | string[] | undefined;
|
|
110
|
+
autoRefresh: import("vue").Raw<import("#imports").UseAutoRefreshHandle>;
|
|
95
111
|
};
|
|
96
|
-
},
|
|
112
|
+
}, __VLS_102: never, __VLS_103: {
|
|
97
113
|
operation: {
|
|
98
114
|
openDialog: typeof openDialog;
|
|
99
115
|
openDialogReadonly: typeof openDialogReadonly;
|
|
100
|
-
createItem: (item: Record<string, any>, callback?: FormDialogCallback, importing?: boolean) => Promise<any
|
|
101
|
-
importItems: (importItemsList: Record<string, any>[], callback?: FormDialogCallback) => void;
|
|
102
|
-
updateItem: (item: Record<string, any>, callback?: FormDialogCallback) => Promise<any
|
|
103
|
-
deleteItem: (item: Record<string, any>, callback?: FormDialogCallback) => Promise<any
|
|
104
|
-
reload: () => void;
|
|
105
|
-
setSearch: (keyword: string) => void;
|
|
116
|
+
createItem: ((item: Record<string, any>, callback?: FormDialogCallback, importing?: boolean) => Promise<void>) | ((item: Record<string, any>, callback?: FormDialogCallback, importing?: boolean) => Promise<any>);
|
|
117
|
+
importItems: ((importItems: Record<string, any>[], callback?: FormDialogCallback) => void) | ((importItemsList: Record<string, any>[], callback?: FormDialogCallback) => void);
|
|
118
|
+
updateItem: ((item: Record<string, any>, callback?: FormDialogCallback) => Promise<void>) | ((item: Record<string, any>, callback?: FormDialogCallback) => Promise<any>);
|
|
119
|
+
deleteItem: ((item: Record<string, any>, callback?: FormDialogCallback) => Promise<any>) | ((item: Record<string, any>, callback?: FormDialogCallback) => Promise<any>);
|
|
120
|
+
reload: (() => Promise<void> | undefined) | (() => Promise<void>);
|
|
121
|
+
setSearch: ((keyword: string) => void) | ((keyword: string) => void);
|
|
106
122
|
canServerPageable: boolean;
|
|
107
123
|
canServerSearch: boolean;
|
|
108
124
|
canCreate: boolean;
|
|
@@ -111,17 +127,18 @@ declare var __VLS_8: {
|
|
|
111
127
|
canEditRow: (item: Record<string, any>) => boolean;
|
|
112
128
|
onlyOwnerEdit: boolean;
|
|
113
129
|
onlyOwnerOverridePermission: string | string[] | undefined;
|
|
130
|
+
autoRefresh: import("vue").Raw<import("#imports").UseAutoRefreshHandle>;
|
|
114
131
|
};
|
|
115
|
-
},
|
|
132
|
+
}, __VLS_135: never, __VLS_136: {
|
|
116
133
|
operation: {
|
|
117
134
|
openDialog: typeof openDialog;
|
|
118
135
|
openDialogReadonly: typeof openDialogReadonly;
|
|
119
|
-
createItem: (item: Record<string, any>, callback?: FormDialogCallback, importing?: boolean) => Promise<any
|
|
120
|
-
importItems: (importItemsList: Record<string, any>[], callback?: FormDialogCallback) => void;
|
|
121
|
-
updateItem: (item: Record<string, any>, callback?: FormDialogCallback) => Promise<any
|
|
122
|
-
deleteItem: (item: Record<string, any>, callback?: FormDialogCallback) => Promise<any
|
|
123
|
-
reload: () => void;
|
|
124
|
-
setSearch: (keyword: string) => void;
|
|
136
|
+
createItem: ((item: Record<string, any>, callback?: FormDialogCallback, importing?: boolean) => Promise<void>) | ((item: Record<string, any>, callback?: FormDialogCallback, importing?: boolean) => Promise<any>);
|
|
137
|
+
importItems: ((importItems: Record<string, any>[], callback?: FormDialogCallback) => void) | ((importItemsList: Record<string, any>[], callback?: FormDialogCallback) => void);
|
|
138
|
+
updateItem: ((item: Record<string, any>, callback?: FormDialogCallback) => Promise<void>) | ((item: Record<string, any>, callback?: FormDialogCallback) => Promise<any>);
|
|
139
|
+
deleteItem: ((item: Record<string, any>, callback?: FormDialogCallback) => Promise<any>) | ((item: Record<string, any>, callback?: FormDialogCallback) => Promise<any>);
|
|
140
|
+
reload: (() => Promise<void> | undefined) | (() => Promise<void>);
|
|
141
|
+
setSearch: ((keyword: string) => void) | ((keyword: string) => void);
|
|
125
142
|
canServerPageable: boolean;
|
|
126
143
|
canServerSearch: boolean;
|
|
127
144
|
canCreate: boolean;
|
|
@@ -130,26 +147,29 @@ declare var __VLS_8: {
|
|
|
130
147
|
canEditRow: (item: Record<string, any>) => boolean;
|
|
131
148
|
onlyOwnerEdit: boolean;
|
|
132
149
|
onlyOwnerOverridePermission: string | string[] | undefined;
|
|
150
|
+
autoRefresh: import("vue").Raw<import("#imports").UseAutoRefreshHandle>;
|
|
133
151
|
};
|
|
134
|
-
},
|
|
152
|
+
}, __VLS_171: any, __VLS_174: any, __VLS_177: any;
|
|
135
153
|
type __VLS_Slots = {} & {
|
|
136
|
-
[K in NonNullable<typeof
|
|
154
|
+
[K in NonNullable<typeof __VLS_102>]?: (props: typeof __VLS_103) => any;
|
|
137
155
|
} & {
|
|
138
|
-
[K in NonNullable<typeof
|
|
156
|
+
[K in NonNullable<typeof __VLS_135>]?: (props: typeof __VLS_136) => any;
|
|
139
157
|
} & {
|
|
140
158
|
header?: (props: typeof __VLS_8) => any;
|
|
141
159
|
} & {
|
|
142
160
|
title?: (props: typeof __VLS_34) => any;
|
|
143
161
|
} & {
|
|
144
|
-
|
|
162
|
+
autoRefreshControl?: (props: typeof __VLS_44) => any;
|
|
145
163
|
} & {
|
|
146
|
-
|
|
164
|
+
search?: (props: typeof __VLS_57) => any;
|
|
147
165
|
} & {
|
|
148
|
-
|
|
166
|
+
toolbarItems?: (props: typeof __VLS_70) => any;
|
|
149
167
|
} & {
|
|
150
|
-
|
|
168
|
+
form?: (props: typeof __VLS_171) => any;
|
|
151
169
|
} & {
|
|
152
|
-
|
|
170
|
+
formTitle?: (props: typeof __VLS_174) => any;
|
|
171
|
+
} & {
|
|
172
|
+
formAction?: (props: typeof __VLS_177) => any;
|
|
153
173
|
};
|
|
154
174
|
declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<__VLS_Props>, {
|
|
155
175
|
noDataText: string;
|
|
@@ -167,17 +187,20 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
167
187
|
onlyOwnerEdit: boolean;
|
|
168
188
|
api: boolean;
|
|
169
189
|
perPageStorageEnabled: boolean;
|
|
190
|
+
autoRefresh: boolean;
|
|
191
|
+
autoRefreshDefault: number;
|
|
192
|
+
autoRefreshControl: boolean;
|
|
170
193
|
}>>, {
|
|
171
|
-
reload: () => void;
|
|
194
|
+
reload: (() => Promise<void> | undefined) | (() => Promise<void>);
|
|
172
195
|
operation: import("vue").Ref<{
|
|
173
196
|
openDialog: typeof openDialog;
|
|
174
197
|
openDialogReadonly: typeof openDialogReadonly;
|
|
175
|
-
createItem: (item: Record<string, any>, callback?: FormDialogCallback, importing?: boolean) => Promise<any
|
|
176
|
-
importItems: (importItemsList: Record<string, any>[], callback?: FormDialogCallback) => void;
|
|
177
|
-
updateItem: (item: Record<string, any>, callback?: FormDialogCallback) => Promise<any
|
|
178
|
-
deleteItem: (item: Record<string, any>, callback?: FormDialogCallback) => Promise<any
|
|
179
|
-
reload: () => void;
|
|
180
|
-
setSearch: (keyword: string) => void;
|
|
198
|
+
createItem: ((item: Record<string, any>, callback?: FormDialogCallback, importing?: boolean) => Promise<void>) | ((item: Record<string, any>, callback?: FormDialogCallback, importing?: boolean) => Promise<any>);
|
|
199
|
+
importItems: ((importItems: Record<string, any>[], callback?: FormDialogCallback) => void) | ((importItemsList: Record<string, any>[], callback?: FormDialogCallback) => void);
|
|
200
|
+
updateItem: ((item: Record<string, any>, callback?: FormDialogCallback) => Promise<void>) | ((item: Record<string, any>, callback?: FormDialogCallback) => Promise<any>);
|
|
201
|
+
deleteItem: ((item: Record<string, any>, callback?: FormDialogCallback) => Promise<any>) | ((item: Record<string, any>, callback?: FormDialogCallback) => Promise<any>);
|
|
202
|
+
reload: (() => Promise<void> | undefined) | (() => Promise<void>);
|
|
203
|
+
setSearch: ((keyword: string) => void) | ((keyword: string) => void);
|
|
181
204
|
canServerPageable: boolean;
|
|
182
205
|
canServerSearch: boolean;
|
|
183
206
|
canCreate: boolean;
|
|
@@ -186,15 +209,16 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
186
209
|
canEditRow: (item: Record<string, any>) => boolean;
|
|
187
210
|
onlyOwnerEdit: boolean;
|
|
188
211
|
onlyOwnerOverridePermission: string | string[] | undefined;
|
|
212
|
+
autoRefresh: import("vue").Raw<import("#imports").UseAutoRefreshHandle>;
|
|
189
213
|
}, {
|
|
190
214
|
openDialog: typeof openDialog;
|
|
191
215
|
openDialogReadonly: typeof openDialogReadonly;
|
|
192
|
-
createItem: (item: Record<string, any>, callback?: FormDialogCallback, importing?: boolean) => Promise<any
|
|
193
|
-
importItems: (importItemsList: Record<string, any>[], callback?: FormDialogCallback) => void;
|
|
194
|
-
updateItem: (item: Record<string, any>, callback?: FormDialogCallback) => Promise<any
|
|
195
|
-
deleteItem: (item: Record<string, any>, callback?: FormDialogCallback) => Promise<any
|
|
196
|
-
reload: () => void;
|
|
197
|
-
setSearch: (keyword: string) => void;
|
|
216
|
+
createItem: ((item: Record<string, any>, callback?: FormDialogCallback, importing?: boolean) => Promise<void>) | ((item: Record<string, any>, callback?: FormDialogCallback, importing?: boolean) => Promise<any>);
|
|
217
|
+
importItems: ((importItems: Record<string, any>[], callback?: FormDialogCallback) => void) | ((importItemsList: Record<string, any>[], callback?: FormDialogCallback) => void);
|
|
218
|
+
updateItem: ((item: Record<string, any>, callback?: FormDialogCallback) => Promise<void>) | ((item: Record<string, any>, callback?: FormDialogCallback) => Promise<any>);
|
|
219
|
+
deleteItem: ((item: Record<string, any>, callback?: FormDialogCallback) => Promise<any>) | ((item: Record<string, any>, callback?: FormDialogCallback) => Promise<any>);
|
|
220
|
+
reload: (() => Promise<void> | undefined) | (() => Promise<void>);
|
|
221
|
+
setSearch: ((keyword: string) => void) | ((keyword: string) => void);
|
|
198
222
|
canServerPageable: import("vue").ComputedRef<boolean>;
|
|
199
223
|
canServerSearch: import("vue").ComputedRef<boolean>;
|
|
200
224
|
canCreate: import("vue").ComputedRef<boolean>;
|
|
@@ -203,15 +227,16 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
203
227
|
canEditRow: (item: Record<string, any>) => boolean;
|
|
204
228
|
onlyOwnerEdit: boolean;
|
|
205
229
|
onlyOwnerOverridePermission: string | string[] | undefined;
|
|
230
|
+
autoRefresh: import("vue").Raw<import("#imports").UseAutoRefreshHandle>;
|
|
206
231
|
} | {
|
|
207
232
|
openDialog: typeof openDialog;
|
|
208
233
|
openDialogReadonly: typeof openDialogReadonly;
|
|
209
|
-
createItem: (item: Record<string, any>, callback?: FormDialogCallback, importing?: boolean) => Promise<any
|
|
210
|
-
importItems: (importItemsList: Record<string, any>[], callback?: FormDialogCallback) => void;
|
|
211
|
-
updateItem: (item: Record<string, any>, callback?: FormDialogCallback) => Promise<any
|
|
212
|
-
deleteItem: (item: Record<string, any>, callback?: FormDialogCallback) => Promise<any
|
|
213
|
-
reload: () => void;
|
|
214
|
-
setSearch: (keyword: string) => void;
|
|
234
|
+
createItem: ((item: Record<string, any>, callback?: FormDialogCallback, importing?: boolean) => Promise<void>) | ((item: Record<string, any>, callback?: FormDialogCallback, importing?: boolean) => Promise<any>);
|
|
235
|
+
importItems: ((importItems: Record<string, any>[], callback?: FormDialogCallback) => void) | ((importItemsList: Record<string, any>[], callback?: FormDialogCallback) => void);
|
|
236
|
+
updateItem: ((item: Record<string, any>, callback?: FormDialogCallback) => Promise<void>) | ((item: Record<string, any>, callback?: FormDialogCallback) => Promise<any>);
|
|
237
|
+
deleteItem: ((item: Record<string, any>, callback?: FormDialogCallback) => Promise<any>) | ((item: Record<string, any>, callback?: FormDialogCallback) => Promise<any>);
|
|
238
|
+
reload: (() => Promise<void> | undefined) | (() => Promise<void>);
|
|
239
|
+
setSearch: ((keyword: string) => void) | ((keyword: string) => void);
|
|
215
240
|
canServerPageable: boolean;
|
|
216
241
|
canServerSearch: boolean;
|
|
217
242
|
canCreate: boolean;
|
|
@@ -220,8 +245,10 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
220
245
|
canEditRow: (item: Record<string, any>) => boolean;
|
|
221
246
|
onlyOwnerEdit: boolean;
|
|
222
247
|
onlyOwnerOverridePermission: string | string[] | undefined;
|
|
248
|
+
autoRefresh: import("vue").Raw<import("#imports").UseAutoRefreshHandle>;
|
|
223
249
|
}>;
|
|
224
250
|
items: import("vue").Ref<Record<string, any>[], Record<string, any>[]>;
|
|
251
|
+
autoRefresh: import("#imports").UseAutoRefreshHandle;
|
|
225
252
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
226
253
|
delete: (...args: any[]) => void;
|
|
227
254
|
create: (...args: any[]) => void;
|
|
@@ -244,6 +271,9 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
244
271
|
onlyOwnerEdit: boolean;
|
|
245
272
|
api: boolean;
|
|
246
273
|
perPageStorageEnabled: boolean;
|
|
274
|
+
autoRefresh: boolean;
|
|
275
|
+
autoRefreshDefault: number;
|
|
276
|
+
autoRefreshControl: boolean;
|
|
247
277
|
}>>> & Readonly<{
|
|
248
278
|
onDelete?: ((...args: any[]) => any) | undefined;
|
|
249
279
|
onCreate?: ((...args: any[]) => any) | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed, watch, nextTick, ref, useAttrs } from "vue";
|
|
2
|
+
import { computed, watch, nextTick, ref, markRaw, useAttrs } from "vue";
|
|
3
3
|
import { VDataTable } from "vuetify/components/VDataTable";
|
|
4
4
|
import { clone } from "lodash-es";
|
|
5
5
|
import { useGraphqlModel } from "../../composables/graphqlModel";
|
|
@@ -7,6 +7,7 @@ import { useApiModel } from "../../composables/apiModel";
|
|
|
7
7
|
import { usePerPagePreference } from "../../composables/perPagePreference";
|
|
8
8
|
import { useDialog } from "../../composables/dialog";
|
|
9
9
|
import { useUserPermission } from "../../composables/userPermission";
|
|
10
|
+
import { useModelAutoRefresh } from "../../composables/modelAutoRefresh";
|
|
10
11
|
import { useState } from "#imports";
|
|
11
12
|
defineOptions({
|
|
12
13
|
inheritAttrs: false
|
|
@@ -33,6 +34,9 @@ const props = defineProps({
|
|
|
33
34
|
api: { type: Boolean, required: false, default: false },
|
|
34
35
|
perPageStorageKey: { type: String, required: false },
|
|
35
36
|
perPageStorageEnabled: { type: Boolean, required: false, default: true },
|
|
37
|
+
autoRefresh: { type: [Number, Boolean], required: false, default: false },
|
|
38
|
+
autoRefreshDefault: { type: Number, required: false, default: 60 },
|
|
39
|
+
autoRefreshControl: { type: Boolean, required: false, default: true },
|
|
36
40
|
modelName: { type: String, required: true },
|
|
37
41
|
modelKey: { type: String, required: false, default: "id" },
|
|
38
42
|
modelBy: { type: Object, required: false, default: void 0 },
|
|
@@ -83,6 +87,11 @@ const {
|
|
|
83
87
|
reload,
|
|
84
88
|
isLoading
|
|
85
89
|
} = props.api ? useApiModel(props) : useGraphqlModel(props);
|
|
90
|
+
const { autoRefresh, manualReload } = useModelAutoRefresh(props, {
|
|
91
|
+
reload,
|
|
92
|
+
isLoading,
|
|
93
|
+
isDialogOpen
|
|
94
|
+
});
|
|
86
95
|
function openDialog(item) {
|
|
87
96
|
isDialogReadonly.value = false;
|
|
88
97
|
currentItem.value = item;
|
|
@@ -126,14 +135,14 @@ const canEditRow = function(item) {
|
|
|
126
135
|
}
|
|
127
136
|
return true;
|
|
128
137
|
};
|
|
129
|
-
const operation = ref({ openDialog, openDialogReadonly, createItem, importItems, updateItem, deleteItem, reload, setSearch, canServerPageable, canServerSearch, canCreate, canUpdate, canDelete, canEditRow, onlyOwnerEdit: props.onlyOwnerEdit, onlyOwnerOverridePermission: props.onlyOwnerOverridePermission });
|
|
138
|
+
const operation = ref({ openDialog, openDialogReadonly, createItem, importItems, updateItem, deleteItem, reload, setSearch, canServerPageable, canServerSearch, canCreate, canUpdate, canDelete, canEditRow, onlyOwnerEdit: props.onlyOwnerEdit, onlyOwnerOverridePermission: props.onlyOwnerOverridePermission, autoRefresh: markRaw(autoRefresh) });
|
|
130
139
|
const computedInitialData = computed(() => {
|
|
131
140
|
return Object.assign({}, props.initialData, props.modelBy);
|
|
132
141
|
});
|
|
133
142
|
watch(() => props.search, () => {
|
|
134
143
|
search.value = props.search;
|
|
135
144
|
}, { immediate: true });
|
|
136
|
-
defineExpose({ reload, operation, items });
|
|
145
|
+
defineExpose({ reload, operation, items, autoRefresh });
|
|
137
146
|
</script>
|
|
138
147
|
|
|
139
148
|
<template>
|
|
@@ -155,16 +164,26 @@ defineExpose({ reload, operation, items });
|
|
|
155
164
|
<VToolbarTitle class="pl-3">
|
|
156
165
|
<slot
|
|
157
166
|
name="title"
|
|
158
|
-
:reload="
|
|
167
|
+
:reload="manualReload"
|
|
159
168
|
>
|
|
160
169
|
{{ title }}
|
|
161
170
|
<v-icon
|
|
162
171
|
size="small"
|
|
163
|
-
@click="
|
|
172
|
+
@click="manualReload"
|
|
164
173
|
>
|
|
165
174
|
mdi mdi-refresh
|
|
166
175
|
</v-icon>
|
|
167
176
|
</slot>
|
|
177
|
+
<slot
|
|
178
|
+
name="autoRefreshControl"
|
|
179
|
+
v-bind="autoRefresh"
|
|
180
|
+
>
|
|
181
|
+
<ModelAutoRefreshChip
|
|
182
|
+
v-if="props.autoRefreshControl"
|
|
183
|
+
:control="autoRefresh"
|
|
184
|
+
:color="toolbarColor"
|
|
185
|
+
/>
|
|
186
|
+
</slot>
|
|
168
187
|
</VToolbarTitle>
|
|
169
188
|
</v-col>
|
|
170
189
|
<v-col cols="5">
|