@hostlink/nuxt-light 1.27.8 → 1.28.1
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/module.d.mts +2 -1
- package/dist/module.json +3 -3
- package/dist/module.mjs +40 -42
- package/dist/runtime/components/L/CustomField/Add.vue +41 -52
- package/dist/runtime/components/L/CustomField/Add.vue.d.ts +2 -0
- package/dist/runtime/components/L/CustomField/List.vue +26 -30
- package/dist/runtime/components/L/CustomField/List.vue.d.ts +2 -0
- package/dist/runtime/components/L/Database/create-table-dialog.vue +22 -38
- package/dist/runtime/components/L/Database/create-table-dialog.vue.d.ts +2 -0
- package/dist/runtime/components/L/Fieldset.vue +19 -23
- package/dist/runtime/components/L/Fieldset.vue.d.ts +2 -0
- package/dist/runtime/components/L/ForgetPasswordDialog.vue +39 -41
- package/dist/runtime/components/L/ForgetPasswordDialog.vue.d.ts +2 -0
- package/dist/runtime/components/L/Revision.vue +101 -137
- package/dist/runtime/components/L/Revision.vue.d.ts +2 -0
- package/dist/runtime/components/L/Storage.vue +26 -30
- package/dist/runtime/components/L/Storage.vue.d.ts +2 -0
- package/dist/runtime/components/L/System/Setting/authentication.vue +22 -44
- package/dist/runtime/components/L/System/Setting/authentication.vue.d.ts +2 -0
- package/dist/runtime/components/L/System/Setting/developer.vue +43 -59
- package/dist/runtime/components/L/System/Setting/developer.vue.d.ts +2 -0
- package/dist/runtime/components/L/System/Setting/forget-password.vue +42 -58
- package/dist/runtime/components/L/System/Setting/forget-password.vue.d.ts +2 -0
- package/dist/runtime/components/L/System/Setting/general.vue +29 -41
- package/dist/runtime/components/L/System/Setting/general.vue.d.ts +2 -0
- package/dist/runtime/components/L/System/Setting/mail.vue +39 -42
- package/dist/runtime/components/L/System/Setting/mail.vue.d.ts +2 -0
- package/dist/runtime/components/L/System/Setting/modules.vue +9 -9
- package/dist/runtime/components/L/System/Setting/modules.vue.d.ts +2 -0
- package/dist/runtime/components/L/System/Setting/security.vue +20 -39
- package/dist/runtime/components/L/System/Setting/security.vue.d.ts +2 -0
- package/dist/runtime/components/L/User/eventlog.vue +26 -26
- package/dist/runtime/components/L/User/eventlog.vue.d.ts +2 -0
- package/dist/runtime/components/L/User/overview.vue +25 -27
- package/dist/runtime/components/L/User/overview.vue.d.ts +2 -0
- package/dist/runtime/components/L/User/userlog.vue +22 -28
- package/dist/runtime/components/L/User/userlog.vue.d.ts +2 -0
- package/dist/runtime/components/L/ValidationInput.vue +68 -91
- package/dist/runtime/components/L/ValidationInput.vue.d.ts +2 -0
- package/dist/runtime/components/MyTest.vue +8 -7
- package/dist/runtime/components/MyTest.vue.d.ts +2 -0
- package/dist/runtime/components/l-add-btn.vue +13 -12
- package/dist/runtime/components/l-add-btn.vue.d.ts +2 -0
- package/dist/runtime/components/l-alert.vue +25 -29
- package/dist/runtime/components/l-alert.vue.d.ts +2 -0
- package/dist/runtime/components/l-app-main.vue +226 -294
- package/dist/runtime/components/l-app-main.vue.d.ts +2 -0
- package/dist/runtime/components/l-app.vue +76 -89
- package/dist/runtime/components/l-app.vue.d.ts +2 -0
- package/dist/runtime/components/l-audit-card.vue +8 -14
- package/dist/runtime/components/l-audit-card.vue.d.ts +2 -0
- package/dist/runtime/components/l-back-btn.vue.d.ts +2 -0
- package/dist/runtime/components/l-banner.vue +28 -34
- package/dist/runtime/components/l-banner.vue.d.ts +2 -0
- package/dist/runtime/components/l-bar.vue +21 -25
- package/dist/runtime/components/l-bar.vue.d.ts +2 -0
- package/dist/runtime/components/l-btn.vue +62 -37
- package/dist/runtime/components/l-btn.vue.d.ts +2 -0
- package/dist/runtime/components/l-card.vue +90 -141
- package/dist/runtime/components/l-card.vue.d.ts +2 -0
- package/dist/runtime/components/l-checkbox.vue +30 -7
- package/dist/runtime/components/l-checkbox.vue.d.ts +2 -0
- package/dist/runtime/components/l-col.vue +21 -29
- package/dist/runtime/components/l-col.vue.d.ts +2 -0
- package/dist/runtime/components/l-customizer.vue +84 -100
- package/dist/runtime/components/l-customizer.vue.d.ts +2 -0
- package/dist/runtime/components/l-date-picker.vue +101 -147
- package/dist/runtime/components/l-date-picker.vue.d.ts +2 -0
- package/dist/runtime/components/l-delete-btn.vue +22 -27
- package/dist/runtime/components/l-delete-btn.vue.d.ts +2 -0
- package/dist/runtime/components/l-dialog-database-field-add.vue +19 -36
- package/dist/runtime/components/l-dialog-database-field-add.vue.d.ts +2 -0
- package/dist/runtime/components/l-drag-drop-container.vue +44 -62
- package/dist/runtime/components/l-drag-drop-container.vue.d.ts +2 -0
- package/dist/runtime/components/l-drag-drop-group.vue +49 -70
- package/dist/runtime/components/l-drag-drop-group.vue.d.ts +2 -0
- package/dist/runtime/components/l-drag-drop.vue +33 -44
- package/dist/runtime/components/l-drag-drop.vue.d.ts +2 -0
- package/dist/runtime/components/l-edit-btn.vue.d.ts +2 -0
- package/dist/runtime/components/l-editor.vue +185 -172
- package/dist/runtime/components/l-editor.vue.d.ts +2 -0
- package/dist/runtime/components/l-facebook-button.vue +18 -26
- package/dist/runtime/components/l-facebook-button.vue.d.ts +2 -0
- package/dist/runtime/components/l-fav-menu.vue +19 -24
- package/dist/runtime/components/l-fav-menu.vue.d.ts +2 -0
- package/dist/runtime/components/l-field.vue +49 -18
- package/dist/runtime/components/l-field.vue.d.ts +2 -0
- package/dist/runtime/components/l-file-manager-labels.vue +46 -48
- package/dist/runtime/components/l-file-manager-labels.vue.d.ts +2 -0
- package/dist/runtime/components/l-file-manager-move.vue +53 -68
- package/dist/runtime/components/l-file-manager-move.vue.d.ts +2 -0
- package/dist/runtime/components/l-file-manager-preview.vue +46 -81
- package/dist/runtime/components/l-file-manager-preview.vue.d.ts +2 -0
- package/dist/runtime/components/l-file-manager.vue +498 -640
- package/dist/runtime/components/l-file-manager.vue.d.ts +2 -0
- package/dist/runtime/components/l-file-upload.vue +80 -109
- package/dist/runtime/components/l-file-upload.vue.d.ts +2 -0
- package/dist/runtime/components/l-file.vue +37 -61
- package/dist/runtime/components/l-file.vue.d.ts +2 -0
- package/dist/runtime/components/l-form-dialog.vue +71 -83
- package/dist/runtime/components/l-form-dialog.vue.d.ts +2 -0
- package/dist/runtime/components/l-form.vue +82 -96
- package/dist/runtime/components/l-form.vue.d.ts +2 -0
- package/dist/runtime/components/l-group-select.vue +59 -94
- package/dist/runtime/components/l-group-select.vue.d.ts +2 -0
- package/dist/runtime/components/l-icon-picker.vue +3265 -3274
- package/dist/runtime/components/l-icon-picker.vue.d.ts +2 -0
- package/dist/runtime/components/l-input-xlsx.vue +30 -38
- package/dist/runtime/components/l-input-xlsx.vue.d.ts +2 -0
- package/dist/runtime/components/l-input.vue +141 -127
- package/dist/runtime/components/l-input.vue.d.ts +2 -0
- package/dist/runtime/components/l-item.vue +30 -21
- package/dist/runtime/components/l-item.vue.d.ts +2 -0
- package/dist/runtime/components/l-link.vue +16 -15
- package/dist/runtime/components/l-link.vue.d.ts +2 -0
- package/dist/runtime/components/l-list.vue +27 -35
- package/dist/runtime/components/l-list.vue.d.ts +2 -0
- package/dist/runtime/components/l-login.vue +246 -287
- package/dist/runtime/components/l-login.vue.d.ts +2 -0
- package/dist/runtime/components/l-menu.vue +45 -54
- package/dist/runtime/components/l-menu.vue.d.ts +2 -0
- package/dist/runtime/components/l-microsoft-button.vue +42 -52
- package/dist/runtime/components/l-microsoft-button.vue.d.ts +2 -0
- package/dist/runtime/components/l-page.vue +48 -67
- package/dist/runtime/components/l-page.vue.d.ts +2 -0
- package/dist/runtime/components/l-row.vue +8 -13
- package/dist/runtime/components/l-row.vue.d.ts +2 -0
- package/dist/runtime/components/l-save-btn.vue.d.ts +2 -0
- package/dist/runtime/components/l-select.vue +150 -76
- package/dist/runtime/components/l-select.vue.d.ts +2 -0
- package/dist/runtime/components/l-small-box.vue +18 -31
- package/dist/runtime/components/l-small-box.vue.d.ts +2 -0
- package/dist/runtime/components/l-statistic.vue +17 -23
- package/dist/runtime/components/l-statistic.vue.d.ts +2 -0
- package/dist/runtime/components/l-tab.vue +20 -15
- package/dist/runtime/components/l-tab.vue.d.ts +2 -0
- package/dist/runtime/components/l-table.vue +444 -560
- package/dist/runtime/components/l-table.vue.d.ts +2 -0
- package/dist/runtime/components/l-tabs.vue +34 -16
- package/dist/runtime/components/l-tabs.vue.d.ts +2 -0
- package/dist/runtime/components/l-test2.vue +10 -9
- package/dist/runtime/components/l-test2.vue.d.ts +2 -0
- package/dist/runtime/components/l-time-picker.vue +53 -68
- package/dist/runtime/components/l-time-picker.vue.d.ts +2 -0
- package/dist/runtime/components/l-view-btn.vue.d.ts +2 -0
- package/dist/runtime/composables/mytest.d.ts +2 -0
- package/dist/runtime/composables/mytest.js +3 -0
- package/dist/runtime/formkit/Checkbox.vue +15 -18
- package/dist/runtime/formkit/Checkbox.vue.d.ts +2 -0
- package/dist/runtime/formkit/DatePicker.vue +15 -18
- package/dist/runtime/formkit/DatePicker.vue.d.ts +2 -0
- package/dist/runtime/formkit/Editor.vue +15 -18
- package/dist/runtime/formkit/Editor.vue.d.ts +2 -0
- package/dist/runtime/formkit/File.vue +30 -37
- package/dist/runtime/formkit/File.vue.d.ts +2 -0
- package/dist/runtime/formkit/FilePicker.vue +22 -25
- package/dist/runtime/formkit/FilePicker.vue.d.ts +2 -0
- package/dist/runtime/formkit/FileUpload.vue +22 -25
- package/dist/runtime/formkit/FileUpload.vue.d.ts +2 -0
- package/dist/runtime/formkit/Form.vue +79 -100
- package/dist/runtime/formkit/Form.vue.d.ts +2 -0
- package/dist/runtime/formkit/GroupSelect.vue +21 -27
- package/dist/runtime/formkit/GroupSelect.vue.d.ts +2 -0
- package/dist/runtime/formkit/Input.vue +53 -61
- package/dist/runtime/formkit/Input.vue.d.ts +2 -0
- package/dist/runtime/formkit/InputXlsx.vue +15 -18
- package/dist/runtime/formkit/InputXlsx.vue.d.ts +2 -0
- package/dist/runtime/formkit/OptionGroup.vue +20 -26
- package/dist/runtime/formkit/OptionGroup.vue.d.ts +2 -0
- package/dist/runtime/formkit/Radio.vue +15 -18
- package/dist/runtime/formkit/Radio.vue.d.ts +2 -0
- package/dist/runtime/formkit/Repeater.vue +62 -76
- package/dist/runtime/formkit/Repeater.vue.d.ts +2 -0
- package/dist/runtime/formkit/Select.vue +21 -29
- package/dist/runtime/formkit/Select.vue.d.ts +2 -0
- package/dist/runtime/formkit/TimePicker.vue +15 -19
- package/dist/runtime/formkit/TimePicker.vue.d.ts +2 -0
- package/dist/runtime/formkit/Toggle.vue +13 -16
- package/dist/runtime/formkit/Toggle.vue.d.ts +2 -0
- package/dist/runtime/light.d.ts +1129 -6
- package/dist/runtime/pages/CustomField/[custom_field_id]/edit.vue +24 -26
- package/dist/runtime/pages/CustomField/[custom_field_id]/edit.vue.d.ts +2 -0
- package/dist/runtime/pages/CustomField/index.vue +22 -29
- package/dist/runtime/pages/CustomField/index.vue.d.ts +2 -0
- package/dist/runtime/pages/EventLog/_eventlog_id/view.vue +8 -8
- package/dist/runtime/pages/EventLog/_eventlog_id/view.vue.d.ts +2 -0
- package/dist/runtime/pages/EventLog/index.vue +7 -6
- package/dist/runtime/pages/EventLog/index.vue.d.ts +2 -0
- package/dist/runtime/pages/FileManager/index.vue.d.ts +2 -0
- package/dist/runtime/pages/MailLog/index.vue +7 -6
- package/dist/runtime/pages/MailLog/index.vue.d.ts +2 -0
- package/dist/runtime/pages/Permission/add.vue +26 -29
- package/dist/runtime/pages/Permission/add.vue.d.ts +2 -0
- package/dist/runtime/pages/Permission/all.vue +57 -73
- package/dist/runtime/pages/Permission/all.vue.d.ts +2 -0
- package/dist/runtime/pages/Permission/export.vue +49 -62
- package/dist/runtime/pages/Permission/export.vue.d.ts +2 -0
- package/dist/runtime/pages/Permission/index.vue +19 -20
- package/dist/runtime/pages/Permission/index.vue.d.ts +2 -0
- package/dist/runtime/pages/Role/_name/update-child.vue +12 -14
- package/dist/runtime/pages/Role/_name/update-child.vue.d.ts +2 -0
- package/dist/runtime/pages/Role/add.vue +13 -15
- package/dist/runtime/pages/Role/add.vue.d.ts +2 -0
- package/dist/runtime/pages/Role/add2.vue +27 -38
- package/dist/runtime/pages/Role/add2.vue.d.ts +2 -0
- package/dist/runtime/pages/Role/index.vue +100 -127
- package/dist/runtime/pages/Role/index.vue.d.ts +2 -0
- package/dist/runtime/pages/System/database/backup.vue +28 -36
- package/dist/runtime/pages/System/database/backup.vue.d.ts +2 -0
- package/dist/runtime/pages/System/database/process.vue +33 -43
- package/dist/runtime/pages/System/database/process.vue.d.ts +2 -0
- package/dist/runtime/pages/System/database/table.vue +168 -205
- package/dist/runtime/pages/System/database/table.vue.d.ts +2 -0
- package/dist/runtime/pages/System/fs.vue +95 -107
- package/dist/runtime/pages/System/fs.vue.d.ts +2 -0
- package/dist/runtime/pages/System/index.vue +30 -31
- package/dist/runtime/pages/System/index.vue.d.ts +2 -0
- package/dist/runtime/pages/System/mailtest.vue +29 -35
- package/dist/runtime/pages/System/mailtest.vue.d.ts +2 -0
- package/dist/runtime/pages/System/menu/index.vue +175 -223
- package/dist/runtime/pages/System/menu/index.vue.d.ts +2 -0
- package/dist/runtime/pages/System/package.vue +21 -21
- package/dist/runtime/pages/System/package.vue.d.ts +2 -0
- package/dist/runtime/pages/System/phpinfo.vue +11 -10
- package/dist/runtime/pages/System/phpinfo.vue.d.ts +2 -0
- package/dist/runtime/pages/System/setting.vue +42 -59
- package/dist/runtime/pages/System/setting.vue.d.ts +2 -0
- package/dist/runtime/pages/System/test.vue.d.ts +2 -0
- package/dist/runtime/pages/System/view_as.vue +65 -68
- package/dist/runtime/pages/System/view_as.vue.d.ts +2 -0
- package/dist/runtime/pages/SystemValue/_systemvalue_id/edit.vue +7 -7
- package/dist/runtime/pages/SystemValue/_systemvalue_id/edit.vue.d.ts +2 -0
- package/dist/runtime/pages/SystemValue/add.vue.d.ts +2 -0
- package/dist/runtime/pages/SystemValue/index.vue +7 -6
- package/dist/runtime/pages/SystemValue/index.vue.d.ts +2 -0
- package/dist/runtime/pages/Translate/index.vue +81 -100
- package/dist/runtime/pages/Translate/index.vue.d.ts +2 -0
- package/dist/runtime/pages/User/_user_id/change-password.vue +38 -45
- package/dist/runtime/pages/User/_user_id/change-password.vue.d.ts +2 -0
- package/dist/runtime/pages/User/_user_id/edit.vue +35 -26
- package/dist/runtime/pages/User/_user_id/edit.vue.d.ts +2 -0
- package/dist/runtime/pages/User/_user_id/update-role.vue +33 -43
- package/dist/runtime/pages/User/_user_id/update-role.vue.d.ts +2 -0
- package/dist/runtime/pages/User/_user_id/view.vue +35 -37
- package/dist/runtime/pages/User/_user_id/view.vue.d.ts +2 -0
- package/dist/runtime/pages/User/add.vue +52 -60
- package/dist/runtime/pages/User/add.vue.d.ts +2 -0
- package/dist/runtime/pages/User/index.vue +23 -32
- package/dist/runtime/pages/User/index.vue.d.ts +2 -0
- package/dist/runtime/pages/User/profile.vue +52 -58
- package/dist/runtime/pages/User/profile.vue.d.ts +2 -0
- package/dist/runtime/pages/User/setting/bio-auth.vue +85 -95
- package/dist/runtime/pages/User/setting/bio-auth.vue.d.ts +2 -0
- package/dist/runtime/pages/User/setting/index.vue +27 -28
- package/dist/runtime/pages/User/setting/index.vue.d.ts +2 -0
- package/dist/runtime/pages/User/setting/information.vue +28 -27
- package/dist/runtime/pages/User/setting/information.vue.d.ts +2 -0
- package/dist/runtime/pages/User/setting/my_favorite.vue +29 -35
- package/dist/runtime/pages/User/setting/my_favorite.vue.d.ts +2 -0
- package/dist/runtime/pages/User/setting/open_id.vue +140 -165
- package/dist/runtime/pages/User/setting/open_id.vue.d.ts +2 -0
- package/dist/runtime/pages/User/setting/password.vue +37 -44
- package/dist/runtime/pages/User/setting/password.vue.d.ts +2 -0
- package/dist/runtime/pages/User/setting/style.vue +84 -102
- package/dist/runtime/pages/User/setting/style.vue.d.ts +2 -0
- package/dist/runtime/pages/User/setting/two-factor-auth.vue +51 -61
- package/dist/runtime/pages/User/setting/two-factor-auth.vue.d.ts +2 -0
- package/dist/runtime/pages/User/setting.vue +9 -9
- package/dist/runtime/pages/User/setting.vue.d.ts +2 -0
- package/dist/runtime/pages/UserLog/index.vue +7 -6
- package/dist/runtime/pages/UserLog/index.vue.d.ts +2 -0
- package/dist/types.d.mts +3 -1
- package/package.json +9 -11
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -7
- package/dist/types.d.ts +0 -1
|
@@ -1,562 +1,446 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
import { useQuasar, QTable, Dialog } from
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
if (props.
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
if (
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
const
|
|
424
|
-
|
|
425
|
-
});
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
emits("delete", id);
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
const attrs = computed(() => {
|
|
449
|
-
const a = { ...light.styles.table, ...Object.fromEntries(Object.entries(props).filter(([key, value]) => value !== undefined)) };
|
|
450
|
-
|
|
451
|
-
return {
|
|
452
|
-
...a,
|
|
453
|
-
loadingLabel: t(props.loadingLabel),
|
|
454
|
-
noDataLabel: t(props.noDataLabel),
|
|
455
|
-
rowsPerPageOptions: props.rowsPerPageOptions,
|
|
456
|
-
rowsPerPageLabel: t(props.rowsPerPageLabel),
|
|
457
|
-
selection: props.selection,
|
|
458
|
-
rowKey: props.rowKey,
|
|
459
|
-
}
|
|
460
|
-
});
|
|
461
|
-
|
|
462
|
-
const filter = ref('');
|
|
463
|
-
|
|
464
|
-
const toColumns = props.columns?.filter((col: any) => {
|
|
465
|
-
return col.to;
|
|
466
|
-
}).map((col: any) => {
|
|
467
|
-
col.slot_name = 'body-cell-' + col.name;
|
|
468
|
-
return col;
|
|
469
|
-
|
|
470
|
-
})
|
|
471
|
-
/*
|
|
472
|
-
const filterFn = (val, update, abort) {
|
|
473
|
-
update(() => {
|
|
474
|
-
const needle = val.toLocaleLowerCase()
|
|
475
|
-
options.value = stringOptions.filter(v => v.toLocaleLowerCase().indexOf(needle) > -1)
|
|
476
|
-
})
|
|
477
|
-
},
|
|
478
|
-
*/
|
|
479
|
-
|
|
480
|
-
const isDark = computed(() => {
|
|
481
|
-
return light.theme == "dark";
|
|
482
|
-
})
|
|
483
|
-
|
|
484
|
-
const hasRowExpand = computed(() => {
|
|
485
|
-
return ss.indexOf("row-expand") >= 0;
|
|
486
|
-
})
|
|
487
|
-
|
|
488
|
-
const hasActions = computed(() => {
|
|
489
|
-
return props.actions.length > 0;
|
|
490
|
-
})
|
|
491
|
-
|
|
492
|
-
const getCellStyle = (col: any, row: any) => {
|
|
493
|
-
const style: any = col.cellStyle ?? {};
|
|
494
|
-
if (col.backgroundColor) {
|
|
495
|
-
if (typeof col.backgroundColor == "function") {
|
|
496
|
-
style.backgroundColor = col.backgroundColor(row);
|
|
497
|
-
} else {
|
|
498
|
-
style.backgroundColor = col.backgroundColor;
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
}
|
|
502
|
-
return style;
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
const getCellClass = (col: any, row: any) => {
|
|
506
|
-
const cl: any = [];
|
|
507
|
-
|
|
508
|
-
if (col.cellClass) {
|
|
509
|
-
if (typeof col.cellClass == "function") {
|
|
510
|
-
cl.push(col.cellClass(row));
|
|
511
|
-
} else {
|
|
512
|
-
cl.push(col.cellClass);
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
}
|
|
516
|
-
return cl;
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
const localSelected = computed({
|
|
520
|
-
get() {
|
|
521
|
-
return props.selected;
|
|
522
|
-
},
|
|
523
|
-
set(val) {
|
|
524
|
-
emits("update:selected", val);
|
|
525
|
-
}
|
|
526
|
-
});
|
|
527
|
-
|
|
528
|
-
watch(() => props.rows, (val) => {
|
|
529
|
-
rows.value = val;
|
|
530
|
-
});
|
|
531
|
-
|
|
532
|
-
const computedColumns = computed(() => {
|
|
533
|
-
return props.columns;
|
|
534
|
-
})
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
function requestServerInteraction() {
|
|
538
|
-
table.value && table.value.requestServerInteraction();
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
defineExpose({
|
|
542
|
-
requestServerInteraction
|
|
543
|
-
})
|
|
544
|
-
|
|
545
|
-
const onAdd = () => {
|
|
546
|
-
if (!props.addComponent) return;
|
|
547
|
-
|
|
548
|
-
$q.dialog({
|
|
549
|
-
component: props.addComponent,
|
|
550
|
-
componentProps: props.addComponentProps,
|
|
551
|
-
|
|
552
|
-
}).onOk(() => {
|
|
553
|
-
requestServerInteraction();
|
|
554
|
-
})
|
|
555
|
-
}
|
|
556
|
-
</script>
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
<template>
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useQuasar, QTable, Dialog } from "quasar";
|
|
3
|
+
import { ref, computed, onMounted, useSlots, watch } from "vue";
|
|
4
|
+
import { useLight, GQLFieldBuilder, model } from "../";
|
|
5
|
+
import { toQuery } from "@hostlink/light";
|
|
6
|
+
import { collect } from "#imports";
|
|
7
|
+
import { useI18n } from "vue-i18n";
|
|
8
|
+
const $q = useQuasar();
|
|
9
|
+
const { t } = useI18n();
|
|
10
|
+
const minimized = defineModel("minimized", { type: Boolean, ...{ default: false } });
|
|
11
|
+
const maximized = defineModel("maximized", { type: Boolean, ...{ default: false } });
|
|
12
|
+
const errors = ref([]);
|
|
13
|
+
const props = defineProps({
|
|
14
|
+
fullscreen: { type: Boolean, required: false, skipCheck: true, default: false },
|
|
15
|
+
noRouteFullscreenExit: { type: Boolean, required: false, skipCheck: true },
|
|
16
|
+
rows: { type: Array, required: false },
|
|
17
|
+
rowKey: { type: [String, Function], required: false },
|
|
18
|
+
virtualScroll: { type: Boolean, required: false, skipCheck: true },
|
|
19
|
+
virtualScrollTarget: { type: null, required: false },
|
|
20
|
+
virtualScrollSliceSize: { type: null, required: false },
|
|
21
|
+
virtualScrollSliceRatioBefore: { type: null, required: false },
|
|
22
|
+
virtualScrollSliceRatioAfter: { type: null, required: false },
|
|
23
|
+
virtualScrollItemSize: { type: null, required: false },
|
|
24
|
+
virtualScrollStickySizeStart: { type: null, required: false },
|
|
25
|
+
virtualScrollStickySizeEnd: { type: null, required: false },
|
|
26
|
+
tableColspan: { type: null, required: false },
|
|
27
|
+
color: { type: null, required: false },
|
|
28
|
+
iconFirstPage: { type: null, required: false },
|
|
29
|
+
iconPrevPage: { type: null, required: false },
|
|
30
|
+
iconNextPage: { type: null, required: false },
|
|
31
|
+
iconLastPage: { type: null, required: false },
|
|
32
|
+
grid: { type: Boolean, required: false, skipCheck: true },
|
|
33
|
+
gridHeader: { type: Boolean, required: false, skipCheck: true },
|
|
34
|
+
dense: { type: Boolean, required: false, skipCheck: true, default: void 0 },
|
|
35
|
+
columns: { type: Array, required: false },
|
|
36
|
+
visibleColumns: { type: null, required: false },
|
|
37
|
+
loading: { type: Boolean, required: false, skipCheck: true },
|
|
38
|
+
title: { type: null, required: false },
|
|
39
|
+
hideHeader: { type: Boolean, required: false, skipCheck: true },
|
|
40
|
+
hideBottom: { type: Boolean, required: false, skipCheck: true },
|
|
41
|
+
hideSelectedBanner: { type: Boolean, required: false, skipCheck: true },
|
|
42
|
+
hideNoData: { type: Boolean, required: false, skipCheck: true },
|
|
43
|
+
hidePagination: { type: Boolean, required: false, skipCheck: true },
|
|
44
|
+
dark: { type: [Boolean, null], required: false, skipCheck: true, default: void 0 },
|
|
45
|
+
flat: { type: Boolean, required: false, skipCheck: true, default: void 0 },
|
|
46
|
+
bordered: { type: Boolean, required: false, skipCheck: true, default: void 0 },
|
|
47
|
+
square: { type: Boolean, required: false, skipCheck: true },
|
|
48
|
+
separator: { type: null, required: false },
|
|
49
|
+
wrapCells: { type: Boolean, required: false, skipCheck: true },
|
|
50
|
+
binaryStateSort: { type: Boolean, required: false, skipCheck: true },
|
|
51
|
+
columnSortOrder: { type: null, required: false },
|
|
52
|
+
noDataLabel: { type: null, required: false, default: "No data available" },
|
|
53
|
+
noResultsLabel: { type: null, required: false },
|
|
54
|
+
loadingLabel: { type: null, required: false, default: "Loading..." },
|
|
55
|
+
selectedRowsLabel: { type: Function, required: false, skipCheck: true },
|
|
56
|
+
rowsPerPageLabel: { type: null, required: false, default: "Records per page:" },
|
|
57
|
+
paginationLabel: { type: Function, required: false, skipCheck: true },
|
|
58
|
+
tableStyle: { type: null, required: false },
|
|
59
|
+
tableClass: { type: null, required: false },
|
|
60
|
+
tableHeaderStyle: { type: null, required: false },
|
|
61
|
+
tableHeaderClass: { type: null, required: false },
|
|
62
|
+
cardContainerStyle: { type: null, required: false },
|
|
63
|
+
cardContainerClass: { type: null, required: false },
|
|
64
|
+
cardStyle: { type: null, required: false },
|
|
65
|
+
cardClass: { type: null, required: false },
|
|
66
|
+
titleClass: { type: null, required: false },
|
|
67
|
+
filter: { type: null, required: false },
|
|
68
|
+
filterMethod: { type: Function, required: false, skipCheck: true },
|
|
69
|
+
pagination: { type: null, required: false, default: () => {
|
|
70
|
+
return {
|
|
71
|
+
sortBy: null,
|
|
72
|
+
descending: true,
|
|
73
|
+
page: 1,
|
|
74
|
+
rowsPerPage: 10
|
|
75
|
+
};
|
|
76
|
+
} },
|
|
77
|
+
rowsPerPageOptions: { type: null, required: false, default: () => [5, 10, 20, 50, 100, 0] },
|
|
78
|
+
selection: { type: null, required: false, default: "none" },
|
|
79
|
+
selected: { type: Array, required: false, default: () => [] },
|
|
80
|
+
expanded: { type: null, required: false },
|
|
81
|
+
sortMethod: { type: Function, required: false, skipCheck: true },
|
|
82
|
+
onFullscreen: { type: Function, required: false },
|
|
83
|
+
"onUpdate:fullscreen": { type: Function, required: false },
|
|
84
|
+
onRowClick: { type: Function, required: false },
|
|
85
|
+
onRowDblclick: { type: Function, required: false },
|
|
86
|
+
onRowContextmenu: { type: Function, required: false },
|
|
87
|
+
onRequest: { type: Function, required: false },
|
|
88
|
+
onSelection: { type: Function, required: false },
|
|
89
|
+
"onUpdate:pagination": { type: Function, required: false },
|
|
90
|
+
"onUpdate:selected": { type: Function, required: false },
|
|
91
|
+
"onUpdate:expanded": { type: Function, required: false },
|
|
92
|
+
onVirtualScroll: { type: Function, required: false },
|
|
93
|
+
actions: { type: Array, required: false, default: () => [] },
|
|
94
|
+
sortBy: { type: null, required: false },
|
|
95
|
+
modelName: { type: null, required: false },
|
|
96
|
+
searchable: { type: [Boolean, null], required: false, skipCheck: true, default: false },
|
|
97
|
+
maximizable: { type: Boolean, required: false, default: false },
|
|
98
|
+
minimizable: { type: Boolean, required: false, default: false },
|
|
99
|
+
onRequestData: { type: Function, required: false },
|
|
100
|
+
addComponent: { type: Object, required: false },
|
|
101
|
+
addComponentProps: { type: null, required: false }
|
|
102
|
+
});
|
|
103
|
+
const isServerSide = props.rows == void 0;
|
|
104
|
+
const light = useLight();
|
|
105
|
+
const pagination = ref(props.pagination);
|
|
106
|
+
if (props.rowsPerPageOptions[0] == 0) {
|
|
107
|
+
pagination.value.rowsPerPage = 0;
|
|
108
|
+
}
|
|
109
|
+
props.columns?.forEach((col) => {
|
|
110
|
+
if (!col.align) {
|
|
111
|
+
col.align = "left";
|
|
112
|
+
}
|
|
113
|
+
if (!col.field && col.name) {
|
|
114
|
+
col.field = col.name;
|
|
115
|
+
}
|
|
116
|
+
col.label = t(col.label);
|
|
117
|
+
});
|
|
118
|
+
if (props.columns) {
|
|
119
|
+
for (let i = 0; i < props.columns.length; i++) {
|
|
120
|
+
if (props.columns[i].searchOptions) {
|
|
121
|
+
let opts = props.columns[i].searchOptions;
|
|
122
|
+
if (typeof opts == "function") {
|
|
123
|
+
props.columns[i].searchOptions = await opts();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
const emits = defineEmits(["request-data", "update:selected", "delete"]);
|
|
129
|
+
const loading = ref(false);
|
|
130
|
+
let activeEdit = false;
|
|
131
|
+
let actionView = false;
|
|
132
|
+
let actionDelete = false;
|
|
133
|
+
if (props.actions.length > 0) {
|
|
134
|
+
actionView = props.actions.includes("view");
|
|
135
|
+
activeEdit = props.actions.includes("edit");
|
|
136
|
+
actionDelete = props.actions.includes("delete");
|
|
137
|
+
}
|
|
138
|
+
if (props.sortBy) {
|
|
139
|
+
let [sortBy, descending] = props.sortBy.split(":");
|
|
140
|
+
pagination.value.sortBy = sortBy;
|
|
141
|
+
pagination.value.descending = descending == "desc";
|
|
142
|
+
}
|
|
143
|
+
const hasSearch = computed(() => {
|
|
144
|
+
return props.columns?.some((col) => {
|
|
145
|
+
return col.searchable;
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
const table = ref();
|
|
149
|
+
const filters = ref({});
|
|
150
|
+
const rows = ref(props.rows);
|
|
151
|
+
if (rows.value == void 0) {
|
|
152
|
+
rows.value = [];
|
|
153
|
+
}
|
|
154
|
+
onMounted(() => {
|
|
155
|
+
table.value && table.value.requestServerInteraction();
|
|
156
|
+
});
|
|
157
|
+
let primaryKey = ref(props.rowKey);
|
|
158
|
+
const modelName = ref(props.modelName);
|
|
159
|
+
const validateData = () => {
|
|
160
|
+
if (primaryKey.value == null) return;
|
|
161
|
+
if (props.actions.includes("edit")) {
|
|
162
|
+
if (rows.value.length > 0) {
|
|
163
|
+
let row = rows.value[0];
|
|
164
|
+
if (!row[primaryKey.value]) {
|
|
165
|
+
errors.value.push("[edit] Primary key not found in the data");
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (props.actions.includes("delete")) {
|
|
170
|
+
if (rows.value.length > 0) {
|
|
171
|
+
let row = rows.value[0];
|
|
172
|
+
if (!row[primaryKey.value]) {
|
|
173
|
+
errors.value.push("[delete] Primary key not found in the data");
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
const onLocalRequest = async (p) => {
|
|
179
|
+
if (!isServerSide) return;
|
|
180
|
+
let sort = "";
|
|
181
|
+
if (p.pagination.sortBy) {
|
|
182
|
+
sort = p.pagination.sortBy + ":" + (p.pagination.descending ? "desc" : "asc");
|
|
183
|
+
}
|
|
184
|
+
const builder = GQLFieldBuilder();
|
|
185
|
+
if (props.rowKey) {
|
|
186
|
+
builder.add(props.rowKey);
|
|
187
|
+
}
|
|
188
|
+
props.columns?.forEach((col) => {
|
|
189
|
+
if (col.gqlField) {
|
|
190
|
+
builder.add(col.gqlField);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
if (!col.name) return;
|
|
194
|
+
if (col.name.startsWith("_")) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
builder.add(col.name);
|
|
198
|
+
});
|
|
199
|
+
if (actionView) {
|
|
200
|
+
builder.add("canView");
|
|
201
|
+
}
|
|
202
|
+
if (actionDelete) {
|
|
203
|
+
builder.add("canDelete");
|
|
204
|
+
}
|
|
205
|
+
if (activeEdit) {
|
|
206
|
+
builder.add("canUpdate");
|
|
207
|
+
}
|
|
208
|
+
const callback = {
|
|
209
|
+
sort,
|
|
210
|
+
fields: builder.get(),
|
|
211
|
+
offset: (p.pagination.page - 1) * p.pagination.rowsPerPage,
|
|
212
|
+
limit: p.pagination.rowsPerPage,
|
|
213
|
+
gql: {
|
|
214
|
+
__args: {
|
|
215
|
+
filters: getFilterValue(),
|
|
216
|
+
sort
|
|
217
|
+
},
|
|
218
|
+
data: {
|
|
219
|
+
__args: {
|
|
220
|
+
limit: p.pagination.rowsPerPage,
|
|
221
|
+
offset: (p.pagination.page - 1) * p.pagination.rowsPerPage
|
|
222
|
+
},
|
|
223
|
+
...toQuery(builder.get())
|
|
224
|
+
},
|
|
225
|
+
meta: {
|
|
226
|
+
total: true,
|
|
227
|
+
key: true,
|
|
228
|
+
name: true
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
setData(data) {
|
|
232
|
+
rows.value = data.data;
|
|
233
|
+
primaryKey.value = data.meta.key;
|
|
234
|
+
modelName.value = data.meta.name;
|
|
235
|
+
pagination.value.rowsNumber = data.meta.total;
|
|
236
|
+
pagination.value.page = p.pagination.page;
|
|
237
|
+
pagination.value.sortBy = p.pagination.sortBy;
|
|
238
|
+
pagination.value.descending = p.pagination.descending;
|
|
239
|
+
pagination.value.rowsPerPage = p.pagination.rowsPerPage;
|
|
240
|
+
loading.value = false;
|
|
241
|
+
validateData();
|
|
242
|
+
},
|
|
243
|
+
loadObjects(model2, filters2 = null, fields = []) {
|
|
244
|
+
return this.loadData(model2, filters2, fields);
|
|
245
|
+
},
|
|
246
|
+
async loadData(model2, filters2 = null, fields = []) {
|
|
247
|
+
fields.forEach((f) => {
|
|
248
|
+
builder.add(f);
|
|
249
|
+
});
|
|
250
|
+
let localFilters = getFilterValue();
|
|
251
|
+
if (filters2) {
|
|
252
|
+
localFilters = {
|
|
253
|
+
...localFilters,
|
|
254
|
+
...filters2
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
loading.value = true;
|
|
258
|
+
try {
|
|
259
|
+
let c = collect(model2, builder.get());
|
|
260
|
+
if (localFilters) {
|
|
261
|
+
for (let [key, value] of Object.entries(localFilters)) {
|
|
262
|
+
if (typeof value == "object") {
|
|
263
|
+
if (value.contains) {
|
|
264
|
+
c = c.whereContains(key, value.contains);
|
|
265
|
+
}
|
|
266
|
+
if (value.between) {
|
|
267
|
+
c = c.whereBetween(key, value.between);
|
|
268
|
+
}
|
|
269
|
+
} else {
|
|
270
|
+
c = c.where(key, value);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
if (sort) {
|
|
275
|
+
if (sort.split(":")[1] == "asc") {
|
|
276
|
+
c = c.sortBy(sort.split(":")[0]);
|
|
277
|
+
} else {
|
|
278
|
+
c = c.sortByDesc(sort.split(":")[0]);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
if (p.pagination.rowsPerPage != 0) {
|
|
282
|
+
c = c.forPage(p.pagination.page, p.pagination.rowsPerPage);
|
|
283
|
+
}
|
|
284
|
+
const data = await c.all();
|
|
285
|
+
const allData = {
|
|
286
|
+
data,
|
|
287
|
+
meta: c.meta
|
|
288
|
+
};
|
|
289
|
+
this.setData(allData);
|
|
290
|
+
} catch (e) {
|
|
291
|
+
quasar.dialog({
|
|
292
|
+
message: e,
|
|
293
|
+
color: "negative"
|
|
294
|
+
});
|
|
295
|
+
this.setData({ data: [], meta: { total: 0, key: "", name: "" } });
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
loading.value = true;
|
|
300
|
+
emits("request-data", callback);
|
|
301
|
+
};
|
|
302
|
+
const getFilterValue = () => {
|
|
303
|
+
let f = {};
|
|
304
|
+
props.columns?.forEach((col) => {
|
|
305
|
+
if (col.searchable) {
|
|
306
|
+
if (filters.value[col.name] !== null && filters.value[col.name] !== "" && filters.value[col.name] !== void 0) {
|
|
307
|
+
if (col.searchType == "number") {
|
|
308
|
+
f[col.name] = filters.value[col.name];
|
|
309
|
+
} else if (col.searchType == "date") {
|
|
310
|
+
if (filters.value[col.name].from) {
|
|
311
|
+
f[col.name] = {
|
|
312
|
+
between: [filters.value[col.name].from, filters.value[col.name].to]
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
} else if (col.searchType == "select") {
|
|
316
|
+
f[col.name] = filters.value[col.name];
|
|
317
|
+
} else {
|
|
318
|
+
if (col.searchMethod == "equals") {
|
|
319
|
+
f[col.name] = filters.value[col.name];
|
|
320
|
+
} else {
|
|
321
|
+
f[col.name] = {
|
|
322
|
+
contains: filters.value[col.name]
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
return f;
|
|
330
|
+
};
|
|
331
|
+
const onFilters = () => {
|
|
332
|
+
onLocalRequest({
|
|
333
|
+
pagination: {
|
|
334
|
+
page: 1,
|
|
335
|
+
rowsPerPage: props.pagination.rowsPerPage,
|
|
336
|
+
sortBy: props.pagination.sortBy,
|
|
337
|
+
descending: props.pagination.descending
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
};
|
|
341
|
+
const slots = useSlots();
|
|
342
|
+
const ss = Object.entries(slots).map(([key, value]) => {
|
|
343
|
+
return key;
|
|
344
|
+
});
|
|
345
|
+
const quasar = useQuasar();
|
|
346
|
+
const onDelete = async (id) => {
|
|
347
|
+
if (modelName.value == null) return;
|
|
348
|
+
try {
|
|
349
|
+
await model(modelName.value).delete(id);
|
|
350
|
+
} catch (e) {
|
|
351
|
+
quasar.notify({
|
|
352
|
+
message: e.message,
|
|
353
|
+
color: "negative"
|
|
354
|
+
});
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
if (table.value) {
|
|
358
|
+
table.value.requestServerInteraction();
|
|
359
|
+
}
|
|
360
|
+
emits("delete", id);
|
|
361
|
+
};
|
|
362
|
+
const attrs = computed(() => {
|
|
363
|
+
const a = { ...light.styles.table, ...Object.fromEntries(Object.entries(props).filter(([key, value]) => value !== void 0)) };
|
|
364
|
+
return {
|
|
365
|
+
...a,
|
|
366
|
+
loadingLabel: t(props.loadingLabel),
|
|
367
|
+
noDataLabel: t(props.noDataLabel),
|
|
368
|
+
rowsPerPageOptions: props.rowsPerPageOptions,
|
|
369
|
+
rowsPerPageLabel: t(props.rowsPerPageLabel),
|
|
370
|
+
selection: props.selection,
|
|
371
|
+
rowKey: props.rowKey
|
|
372
|
+
};
|
|
373
|
+
});
|
|
374
|
+
const filter = ref("");
|
|
375
|
+
const toColumns = props.columns?.filter((col) => {
|
|
376
|
+
return col.to;
|
|
377
|
+
}).map((col) => {
|
|
378
|
+
col.slot_name = "body-cell-" + col.name;
|
|
379
|
+
return col;
|
|
380
|
+
});
|
|
381
|
+
const isDark = computed(() => {
|
|
382
|
+
return light.theme == "dark";
|
|
383
|
+
});
|
|
384
|
+
const hasRowExpand = computed(() => {
|
|
385
|
+
return ss.indexOf("row-expand") >= 0;
|
|
386
|
+
});
|
|
387
|
+
const hasActions = computed(() => {
|
|
388
|
+
return props.actions.length > 0;
|
|
389
|
+
});
|
|
390
|
+
const getCellStyle = (col, row) => {
|
|
391
|
+
const style = col.cellStyle ?? {};
|
|
392
|
+
if (col.backgroundColor) {
|
|
393
|
+
if (typeof col.backgroundColor == "function") {
|
|
394
|
+
style.backgroundColor = col.backgroundColor(row);
|
|
395
|
+
} else {
|
|
396
|
+
style.backgroundColor = col.backgroundColor;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
return style;
|
|
400
|
+
};
|
|
401
|
+
const getCellClass = (col, row) => {
|
|
402
|
+
const cl = [];
|
|
403
|
+
if (col.cellClass) {
|
|
404
|
+
if (typeof col.cellClass == "function") {
|
|
405
|
+
cl.push(col.cellClass(row));
|
|
406
|
+
} else {
|
|
407
|
+
cl.push(col.cellClass);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
return cl;
|
|
411
|
+
};
|
|
412
|
+
const localSelected = computed({
|
|
413
|
+
get() {
|
|
414
|
+
return props.selected;
|
|
415
|
+
},
|
|
416
|
+
set(val) {
|
|
417
|
+
emits("update:selected", val);
|
|
418
|
+
}
|
|
419
|
+
});
|
|
420
|
+
watch(() => props.rows, (val) => {
|
|
421
|
+
rows.value = val;
|
|
422
|
+
});
|
|
423
|
+
const computedColumns = computed(() => {
|
|
424
|
+
return props.columns;
|
|
425
|
+
});
|
|
426
|
+
function requestServerInteraction() {
|
|
427
|
+
table.value && table.value.requestServerInteraction();
|
|
428
|
+
}
|
|
429
|
+
defineExpose({
|
|
430
|
+
requestServerInteraction
|
|
431
|
+
});
|
|
432
|
+
const onAdd = () => {
|
|
433
|
+
if (!props.addComponent) return;
|
|
434
|
+
$q.dialog({
|
|
435
|
+
component: props.addComponent,
|
|
436
|
+
componentProps: props.addComponentProps
|
|
437
|
+
}).onOk(() => {
|
|
438
|
+
requestServerInteraction();
|
|
439
|
+
});
|
|
440
|
+
};
|
|
441
|
+
</script>
|
|
442
|
+
|
|
443
|
+
<template>
|
|
560
444
|
<l-card v-bind="attrs" :maximizable="maximizable" :minimizable="minimizable" :title="title"
|
|
561
445
|
v-model:minimized="minimized" v-model:maximized="maximized">
|
|
562
446
|
|
|
@@ -717,4 +601,4 @@ const onAdd = () => {
|
|
|
717
601
|
</template>
|
|
718
602
|
</q-table>
|
|
719
603
|
</l-card>
|
|
720
|
-
</template>
|
|
604
|
+
</template>
|