@hostlink/nuxt-light 1.27.7 → 1.28.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 (276) hide show
  1. package/dist/module.d.mts +2 -1
  2. package/dist/module.json +3 -3
  3. package/dist/module.mjs +40 -42
  4. package/dist/runtime/components/L/CustomField/Add.vue +41 -52
  5. package/dist/runtime/components/L/CustomField/Add.vue.d.ts +2 -0
  6. package/dist/runtime/components/L/CustomField/List.vue +26 -30
  7. package/dist/runtime/components/L/CustomField/List.vue.d.ts +2 -0
  8. package/dist/runtime/components/L/Database/create-table-dialog.vue +22 -38
  9. package/dist/runtime/components/L/Database/create-table-dialog.vue.d.ts +2 -0
  10. package/dist/runtime/components/L/Fieldset.vue +19 -23
  11. package/dist/runtime/components/L/Fieldset.vue.d.ts +2 -0
  12. package/dist/runtime/components/L/ForgetPasswordDialog.vue +39 -41
  13. package/dist/runtime/components/L/ForgetPasswordDialog.vue.d.ts +2 -0
  14. package/dist/runtime/components/L/Revision.vue +101 -137
  15. package/dist/runtime/components/L/Revision.vue.d.ts +2 -0
  16. package/dist/runtime/components/L/Storage.vue +26 -30
  17. package/dist/runtime/components/L/Storage.vue.d.ts +2 -0
  18. package/dist/runtime/components/L/System/Setting/authentication.vue +22 -44
  19. package/dist/runtime/components/L/System/Setting/authentication.vue.d.ts +2 -0
  20. package/dist/runtime/components/L/System/Setting/developer.vue +43 -59
  21. package/dist/runtime/components/L/System/Setting/developer.vue.d.ts +2 -0
  22. package/dist/runtime/components/L/System/Setting/forget-password.vue +42 -58
  23. package/dist/runtime/components/L/System/Setting/forget-password.vue.d.ts +2 -0
  24. package/dist/runtime/components/L/System/Setting/general.vue +29 -41
  25. package/dist/runtime/components/L/System/Setting/general.vue.d.ts +2 -0
  26. package/dist/runtime/components/L/System/Setting/mail.vue +39 -42
  27. package/dist/runtime/components/L/System/Setting/mail.vue.d.ts +2 -0
  28. package/dist/runtime/components/L/System/Setting/modules.vue +9 -9
  29. package/dist/runtime/components/L/System/Setting/modules.vue.d.ts +2 -0
  30. package/dist/runtime/components/L/System/Setting/security.vue +20 -39
  31. package/dist/runtime/components/L/System/Setting/security.vue.d.ts +2 -0
  32. package/dist/runtime/components/L/User/eventlog.vue +26 -26
  33. package/dist/runtime/components/L/User/eventlog.vue.d.ts +2 -0
  34. package/dist/runtime/components/L/User/overview.vue +25 -27
  35. package/dist/runtime/components/L/User/overview.vue.d.ts +2 -0
  36. package/dist/runtime/components/L/User/userlog.vue +22 -28
  37. package/dist/runtime/components/L/User/userlog.vue.d.ts +2 -0
  38. package/dist/runtime/components/L/ValidationInput.vue +68 -91
  39. package/dist/runtime/components/L/ValidationInput.vue.d.ts +2 -0
  40. package/dist/runtime/components/MyTest.vue +8 -7
  41. package/dist/runtime/components/MyTest.vue.d.ts +2 -0
  42. package/dist/runtime/components/l-add-btn.vue +13 -12
  43. package/dist/runtime/components/l-add-btn.vue.d.ts +2 -0
  44. package/dist/runtime/components/l-alert.vue +25 -29
  45. package/dist/runtime/components/l-alert.vue.d.ts +2 -0
  46. package/dist/runtime/components/l-app-main.vue +226 -294
  47. package/dist/runtime/components/l-app-main.vue.d.ts +2 -0
  48. package/dist/runtime/components/l-app.vue +76 -89
  49. package/dist/runtime/components/l-app.vue.d.ts +2 -0
  50. package/dist/runtime/components/l-audit-card.vue +8 -14
  51. package/dist/runtime/components/l-audit-card.vue.d.ts +2 -0
  52. package/dist/runtime/components/l-back-btn.vue.d.ts +2 -0
  53. package/dist/runtime/components/l-banner.vue +28 -34
  54. package/dist/runtime/components/l-banner.vue.d.ts +2 -0
  55. package/dist/runtime/components/l-bar.vue +21 -25
  56. package/dist/runtime/components/l-bar.vue.d.ts +2 -0
  57. package/dist/runtime/components/l-btn.vue +62 -39
  58. package/dist/runtime/components/l-btn.vue.d.ts +2 -0
  59. package/dist/runtime/components/l-card.vue +90 -141
  60. package/dist/runtime/components/l-card.vue.d.ts +2 -0
  61. package/dist/runtime/components/l-checkbox.vue +30 -7
  62. package/dist/runtime/components/l-checkbox.vue.d.ts +2 -0
  63. package/dist/runtime/components/l-col.vue +21 -29
  64. package/dist/runtime/components/l-col.vue.d.ts +2 -0
  65. package/dist/runtime/components/l-customizer.vue +84 -100
  66. package/dist/runtime/components/l-customizer.vue.d.ts +2 -0
  67. package/dist/runtime/components/l-date-picker.vue +101 -147
  68. package/dist/runtime/components/l-date-picker.vue.d.ts +2 -0
  69. package/dist/runtime/components/l-delete-btn.vue +22 -27
  70. package/dist/runtime/components/l-delete-btn.vue.d.ts +2 -0
  71. package/dist/runtime/components/l-dialog-database-field-add.vue +19 -36
  72. package/dist/runtime/components/l-dialog-database-field-add.vue.d.ts +2 -0
  73. package/dist/runtime/components/l-drag-drop-container.vue +44 -62
  74. package/dist/runtime/components/l-drag-drop-container.vue.d.ts +2 -0
  75. package/dist/runtime/components/l-drag-drop-group.vue +49 -70
  76. package/dist/runtime/components/l-drag-drop-group.vue.d.ts +2 -0
  77. package/dist/runtime/components/l-drag-drop.vue +33 -44
  78. package/dist/runtime/components/l-drag-drop.vue.d.ts +2 -0
  79. package/dist/runtime/components/l-edit-btn.vue.d.ts +2 -0
  80. package/dist/runtime/components/l-editor.vue +185 -172
  81. package/dist/runtime/components/l-editor.vue.d.ts +2 -0
  82. package/dist/runtime/components/l-facebook-button.vue +18 -26
  83. package/dist/runtime/components/l-facebook-button.vue.d.ts +2 -0
  84. package/dist/runtime/components/l-fav-menu.vue +19 -24
  85. package/dist/runtime/components/l-fav-menu.vue.d.ts +2 -0
  86. package/dist/runtime/components/l-field.vue +49 -18
  87. package/dist/runtime/components/l-field.vue.d.ts +2 -0
  88. package/dist/runtime/components/l-file-manager-labels.vue +46 -48
  89. package/dist/runtime/components/l-file-manager-labels.vue.d.ts +2 -0
  90. package/dist/runtime/components/l-file-manager-move.vue +53 -68
  91. package/dist/runtime/components/l-file-manager-move.vue.d.ts +2 -0
  92. package/dist/runtime/components/l-file-manager-preview.vue +46 -81
  93. package/dist/runtime/components/l-file-manager-preview.vue.d.ts +2 -0
  94. package/dist/runtime/components/l-file-manager.vue +498 -640
  95. package/dist/runtime/components/l-file-manager.vue.d.ts +2 -0
  96. package/dist/runtime/components/l-file-upload.vue +80 -109
  97. package/dist/runtime/components/l-file-upload.vue.d.ts +2 -0
  98. package/dist/runtime/components/l-file.vue +37 -61
  99. package/dist/runtime/components/l-file.vue.d.ts +2 -0
  100. package/dist/runtime/components/l-form-dialog.vue +71 -83
  101. package/dist/runtime/components/l-form-dialog.vue.d.ts +2 -0
  102. package/dist/runtime/components/l-form.vue +82 -96
  103. package/dist/runtime/components/l-form.vue.d.ts +2 -0
  104. package/dist/runtime/components/l-group-select.vue +59 -94
  105. package/dist/runtime/components/l-group-select.vue.d.ts +2 -0
  106. package/dist/runtime/components/l-icon-picker.vue +3265 -3274
  107. package/dist/runtime/components/l-icon-picker.vue.d.ts +2 -0
  108. package/dist/runtime/components/l-input-xlsx.vue +30 -38
  109. package/dist/runtime/components/l-input-xlsx.vue.d.ts +2 -0
  110. package/dist/runtime/components/l-input.vue +142 -126
  111. package/dist/runtime/components/l-input.vue.d.ts +2 -0
  112. package/dist/runtime/components/l-item.vue +30 -21
  113. package/dist/runtime/components/l-item.vue.d.ts +2 -0
  114. package/dist/runtime/components/l-link.vue +16 -15
  115. package/dist/runtime/components/l-link.vue.d.ts +2 -0
  116. package/dist/runtime/components/l-list.vue +27 -35
  117. package/dist/runtime/components/l-list.vue.d.ts +2 -0
  118. package/dist/runtime/components/l-login.vue +246 -287
  119. package/dist/runtime/components/l-login.vue.d.ts +2 -0
  120. package/dist/runtime/components/l-menu.vue +45 -54
  121. package/dist/runtime/components/l-menu.vue.d.ts +2 -0
  122. package/dist/runtime/components/l-microsoft-button.vue +42 -52
  123. package/dist/runtime/components/l-microsoft-button.vue.d.ts +2 -0
  124. package/dist/runtime/components/l-page.vue +48 -67
  125. package/dist/runtime/components/l-page.vue.d.ts +2 -0
  126. package/dist/runtime/components/l-row.vue +8 -13
  127. package/dist/runtime/components/l-row.vue.d.ts +2 -0
  128. package/dist/runtime/components/l-save-btn.vue.d.ts +2 -0
  129. package/dist/runtime/components/l-select.vue +150 -76
  130. package/dist/runtime/components/l-select.vue.d.ts +2 -0
  131. package/dist/runtime/components/l-small-box.vue +18 -31
  132. package/dist/runtime/components/l-small-box.vue.d.ts +2 -0
  133. package/dist/runtime/components/l-statistic.vue +17 -23
  134. package/dist/runtime/components/l-statistic.vue.d.ts +2 -0
  135. package/dist/runtime/components/l-tab.vue +20 -15
  136. package/dist/runtime/components/l-tab.vue.d.ts +2 -0
  137. package/dist/runtime/components/l-table.vue +444 -560
  138. package/dist/runtime/components/l-table.vue.d.ts +2 -0
  139. package/dist/runtime/components/l-tabs.vue +34 -16
  140. package/dist/runtime/components/l-tabs.vue.d.ts +2 -0
  141. package/dist/runtime/components/l-test2.vue +10 -9
  142. package/dist/runtime/components/l-test2.vue.d.ts +2 -0
  143. package/dist/runtime/components/l-time-picker.vue +53 -68
  144. package/dist/runtime/components/l-time-picker.vue.d.ts +2 -0
  145. package/dist/runtime/components/l-view-btn.vue.d.ts +2 -0
  146. package/dist/runtime/composables/mytest.d.ts +2 -0
  147. package/dist/runtime/composables/mytest.js +3 -0
  148. package/dist/runtime/formkit/Checkbox.vue +15 -18
  149. package/dist/runtime/formkit/Checkbox.vue.d.ts +2 -0
  150. package/dist/runtime/formkit/DatePicker.vue +15 -18
  151. package/dist/runtime/formkit/DatePicker.vue.d.ts +2 -0
  152. package/dist/runtime/formkit/Editor.vue +15 -18
  153. package/dist/runtime/formkit/Editor.vue.d.ts +2 -0
  154. package/dist/runtime/formkit/File.vue +30 -37
  155. package/dist/runtime/formkit/File.vue.d.ts +2 -0
  156. package/dist/runtime/formkit/FilePicker.vue +22 -25
  157. package/dist/runtime/formkit/FilePicker.vue.d.ts +2 -0
  158. package/dist/runtime/formkit/FileUpload.vue +22 -25
  159. package/dist/runtime/formkit/FileUpload.vue.d.ts +2 -0
  160. package/dist/runtime/formkit/Form.vue +79 -100
  161. package/dist/runtime/formkit/Form.vue.d.ts +2 -0
  162. package/dist/runtime/formkit/GroupSelect.vue +21 -27
  163. package/dist/runtime/formkit/GroupSelect.vue.d.ts +2 -0
  164. package/dist/runtime/formkit/Input.vue +53 -61
  165. package/dist/runtime/formkit/Input.vue.d.ts +2 -0
  166. package/dist/runtime/formkit/InputXlsx.vue +15 -18
  167. package/dist/runtime/formkit/InputXlsx.vue.d.ts +2 -0
  168. package/dist/runtime/formkit/OptionGroup.vue +20 -26
  169. package/dist/runtime/formkit/OptionGroup.vue.d.ts +2 -0
  170. package/dist/runtime/formkit/Radio.vue +15 -18
  171. package/dist/runtime/formkit/Radio.vue.d.ts +2 -0
  172. package/dist/runtime/formkit/Repeater.vue +62 -76
  173. package/dist/runtime/formkit/Repeater.vue.d.ts +2 -0
  174. package/dist/runtime/formkit/Select.vue +21 -29
  175. package/dist/runtime/formkit/Select.vue.d.ts +2 -0
  176. package/dist/runtime/formkit/TimePicker.vue +15 -19
  177. package/dist/runtime/formkit/TimePicker.vue.d.ts +2 -0
  178. package/dist/runtime/formkit/Toggle.vue +13 -16
  179. package/dist/runtime/formkit/Toggle.vue.d.ts +2 -0
  180. package/dist/runtime/light.d.ts +1129 -6
  181. package/dist/runtime/pages/CustomField/[custom_field_id]/edit.vue +24 -26
  182. package/dist/runtime/pages/CustomField/[custom_field_id]/edit.vue.d.ts +2 -0
  183. package/dist/runtime/pages/CustomField/index.vue +22 -29
  184. package/dist/runtime/pages/CustomField/index.vue.d.ts +2 -0
  185. package/dist/runtime/pages/EventLog/_eventlog_id/view.vue +8 -8
  186. package/dist/runtime/pages/EventLog/_eventlog_id/view.vue.d.ts +2 -0
  187. package/dist/runtime/pages/EventLog/index.vue +7 -6
  188. package/dist/runtime/pages/EventLog/index.vue.d.ts +2 -0
  189. package/dist/runtime/pages/FileManager/index.vue.d.ts +2 -0
  190. package/dist/runtime/pages/MailLog/index.vue +7 -6
  191. package/dist/runtime/pages/MailLog/index.vue.d.ts +2 -0
  192. package/dist/runtime/pages/Permission/add.vue +26 -29
  193. package/dist/runtime/pages/Permission/add.vue.d.ts +2 -0
  194. package/dist/runtime/pages/Permission/all.vue +57 -73
  195. package/dist/runtime/pages/Permission/all.vue.d.ts +2 -0
  196. package/dist/runtime/pages/Permission/export.vue +49 -62
  197. package/dist/runtime/pages/Permission/export.vue.d.ts +2 -0
  198. package/dist/runtime/pages/Permission/index.vue +19 -20
  199. package/dist/runtime/pages/Permission/index.vue.d.ts +2 -0
  200. package/dist/runtime/pages/Role/_name/update-child.vue +12 -14
  201. package/dist/runtime/pages/Role/_name/update-child.vue.d.ts +2 -0
  202. package/dist/runtime/pages/Role/add.vue +13 -15
  203. package/dist/runtime/pages/Role/add.vue.d.ts +2 -0
  204. package/dist/runtime/pages/Role/add2.vue +27 -38
  205. package/dist/runtime/pages/Role/add2.vue.d.ts +2 -0
  206. package/dist/runtime/pages/Role/index.vue +100 -127
  207. package/dist/runtime/pages/Role/index.vue.d.ts +2 -0
  208. package/dist/runtime/pages/System/database/backup.vue +28 -36
  209. package/dist/runtime/pages/System/database/backup.vue.d.ts +2 -0
  210. package/dist/runtime/pages/System/database/process.vue +33 -43
  211. package/dist/runtime/pages/System/database/process.vue.d.ts +2 -0
  212. package/dist/runtime/pages/System/database/table.vue +168 -205
  213. package/dist/runtime/pages/System/database/table.vue.d.ts +2 -0
  214. package/dist/runtime/pages/System/fs.vue +95 -107
  215. package/dist/runtime/pages/System/fs.vue.d.ts +2 -0
  216. package/dist/runtime/pages/System/index.vue +30 -31
  217. package/dist/runtime/pages/System/index.vue.d.ts +2 -0
  218. package/dist/runtime/pages/System/mailtest.vue +29 -35
  219. package/dist/runtime/pages/System/mailtest.vue.d.ts +2 -0
  220. package/dist/runtime/pages/System/menu/index.vue +175 -223
  221. package/dist/runtime/pages/System/menu/index.vue.d.ts +2 -0
  222. package/dist/runtime/pages/System/package.vue +21 -21
  223. package/dist/runtime/pages/System/package.vue.d.ts +2 -0
  224. package/dist/runtime/pages/System/phpinfo.vue +11 -10
  225. package/dist/runtime/pages/System/phpinfo.vue.d.ts +2 -0
  226. package/dist/runtime/pages/System/setting.vue +42 -59
  227. package/dist/runtime/pages/System/setting.vue.d.ts +2 -0
  228. package/dist/runtime/pages/System/test.vue.d.ts +2 -0
  229. package/dist/runtime/pages/System/view_as.vue +65 -68
  230. package/dist/runtime/pages/System/view_as.vue.d.ts +2 -0
  231. package/dist/runtime/pages/SystemValue/_systemvalue_id/edit.vue +7 -7
  232. package/dist/runtime/pages/SystemValue/_systemvalue_id/edit.vue.d.ts +2 -0
  233. package/dist/runtime/pages/SystemValue/add.vue.d.ts +2 -0
  234. package/dist/runtime/pages/SystemValue/index.vue +7 -6
  235. package/dist/runtime/pages/SystemValue/index.vue.d.ts +2 -0
  236. package/dist/runtime/pages/Translate/index.vue +81 -100
  237. package/dist/runtime/pages/Translate/index.vue.d.ts +2 -0
  238. package/dist/runtime/pages/User/_user_id/change-password.vue +38 -45
  239. package/dist/runtime/pages/User/_user_id/change-password.vue.d.ts +2 -0
  240. package/dist/runtime/pages/User/_user_id/edit.vue +35 -26
  241. package/dist/runtime/pages/User/_user_id/edit.vue.d.ts +2 -0
  242. package/dist/runtime/pages/User/_user_id/update-role.vue +33 -43
  243. package/dist/runtime/pages/User/_user_id/update-role.vue.d.ts +2 -0
  244. package/dist/runtime/pages/User/_user_id/view.vue +35 -37
  245. package/dist/runtime/pages/User/_user_id/view.vue.d.ts +2 -0
  246. package/dist/runtime/pages/User/add.vue +52 -60
  247. package/dist/runtime/pages/User/add.vue.d.ts +2 -0
  248. package/dist/runtime/pages/User/index.vue +23 -32
  249. package/dist/runtime/pages/User/index.vue.d.ts +2 -0
  250. package/dist/runtime/pages/User/profile.vue +52 -58
  251. package/dist/runtime/pages/User/profile.vue.d.ts +2 -0
  252. package/dist/runtime/pages/User/setting/bio-auth.vue +85 -95
  253. package/dist/runtime/pages/User/setting/bio-auth.vue.d.ts +2 -0
  254. package/dist/runtime/pages/User/setting/index.vue +27 -28
  255. package/dist/runtime/pages/User/setting/index.vue.d.ts +2 -0
  256. package/dist/runtime/pages/User/setting/information.vue +28 -27
  257. package/dist/runtime/pages/User/setting/information.vue.d.ts +2 -0
  258. package/dist/runtime/pages/User/setting/my_favorite.vue +29 -35
  259. package/dist/runtime/pages/User/setting/my_favorite.vue.d.ts +2 -0
  260. package/dist/runtime/pages/User/setting/open_id.vue +140 -165
  261. package/dist/runtime/pages/User/setting/open_id.vue.d.ts +2 -0
  262. package/dist/runtime/pages/User/setting/password.vue +37 -44
  263. package/dist/runtime/pages/User/setting/password.vue.d.ts +2 -0
  264. package/dist/runtime/pages/User/setting/style.vue +84 -102
  265. package/dist/runtime/pages/User/setting/style.vue.d.ts +2 -0
  266. package/dist/runtime/pages/User/setting/two-factor-auth.vue +51 -61
  267. package/dist/runtime/pages/User/setting/two-factor-auth.vue.d.ts +2 -0
  268. package/dist/runtime/pages/User/setting.vue +9 -9
  269. package/dist/runtime/pages/User/setting.vue.d.ts +2 -0
  270. package/dist/runtime/pages/UserLog/index.vue +7 -6
  271. package/dist/runtime/pages/UserLog/index.vue.d.ts +2 -0
  272. package/dist/types.d.mts +3 -1
  273. package/package.json +9 -11
  274. package/dist/module.cjs +0 -5
  275. package/dist/module.d.ts +0 -7
  276. package/dist/types.d.ts +0 -1
@@ -1,642 +1,500 @@
1
- <script setup>
2
- import { useI18n } from "vue-i18n";
3
- import { ref, watch, computed, onMounted } from 'vue';
4
- import { useQuasar, format } from 'quasar';
5
- import { q, m, useLight, api } from '#imports';
6
- const { humanStorageSize } = format
7
-
8
- const light = useLight();
9
- const i18n = useI18n();
10
- const $q = useQuasar();
11
- const $light = useLight();
12
-
13
- const emit = defineEmits(["input", "close"]);
14
-
15
- const { app: { drives } } = await q({
16
- app: {
17
- drives: {
18
- index: true,
19
- name: true,
20
- }
21
- }
22
- });
23
-
24
- const folders = ref([]);
25
- const files = ref([]);
26
-
27
-
28
- const nodes = drives.map((drive) => {
29
- return {
30
- icon: "sym_o_storage",
31
- name: drive.name,
32
- id: drive.index.toString(),
33
- path: "/",
34
- lazy: true,
35
- driveIndex: drive.index,
36
- type: "drive",
37
- }
38
- });
39
-
40
-
41
- const onLazyLoad = async ({ node, key, done, fail }) => {
42
-
43
- const folders = await api.drive(node.driveIndex).folders.list(node.path, {
44
- name: true,
45
- path: true
46
- });
47
-
48
- const data = folders.map((item) => {
49
- item.driveIndex = node.driveIndex;
50
- item.id = node.driveIndex + "/" + item.path;
51
- item.lazy = true;
52
- item.type = "folder";
53
- return item;
54
- });
55
- done(data);
56
- };
57
-
58
-
59
-
60
- const props = defineProps({
61
- closeable: Boolean,
62
- height: {
63
- type: String,
64
- default: "700px",
65
- },
66
- defaultAction: {
67
- default: "preview",
68
- type: String,
69
- },
70
- multiple: {
71
- default: false,
72
- type: Boolean,
73
- },
74
- base: {
75
- default: "/",
76
- type: String,
77
- },
78
- });
79
-
80
- const loading = ref(false);
81
- const folderTree = ref(null);
82
-
83
- const pagination = {
84
- rowsPerPage: 0,
85
- "rows-per-page-options": [0],
86
- };
87
-
88
- const columns = ref([
89
- {
90
- name: "icon",
91
- label: "",
92
- field: "type",
93
- },
94
- {
95
- name: "name",
96
- label: i18n.t("Name"),
97
- field: "name",
98
- sortable: true,
99
- align: "left",
100
- },
101
- {
102
- name: "last_modified",
103
- label: i18n.t("Last Modified"),
104
- field: "lastModifiedHuman",
105
- align: "left",
106
- },
107
- {
108
- name: "size_display",
109
- label: i18n.t("Size"),
110
- field: "size",
111
- align: "right",
112
- format: (val) => {
113
- if (val == null) {
114
- return "";
115
- }
116
- return humanStorageSize(val)
117
- }
118
- },
119
- { name: "action" },
120
- ]);
121
-
122
- const localSearch = ref(null);
123
- const rightDrawerOpen = ref(false);
124
- const leftDrawerOpen = ref(false);
125
- const showDateOptions = ref(false);
126
- const exactPhrase = ref("");
127
- const hasWords = ref("");
128
- const excludeWords = ref("");
129
- const byWebsite = ref("");
130
- const byDate = ref("Any time");
131
-
132
- function onClear() {
133
- exactPhrase.value = "";
134
- hasWords.value = "";
135
- excludeWords.value = "";
136
- byWebsite.value = "";
137
- byDate.value = "Any time";
138
- }
139
-
140
- function changeDate(option) {
141
- byDate.value = option;
142
- showDateOptions.value = false;
143
- }
144
-
145
- function toggleLeftDrawer() {
146
- leftDrawerOpen.value = !leftDrawerOpen.value;
147
- }
148
- const loadItems = async () => {
149
-
150
- let path = selectedPath.value;
151
-
152
- files.value = [];
153
- folders.value = [];
154
-
155
- loading.value = true;
156
-
157
- let filesParams = { path };
158
-
159
- if (label.value) {
160
- filesParams.type = label.value;
161
- }
162
-
163
- if (localSearch.value) {
164
- filesParams.search = localSearch.value;
165
- }
166
-
167
- const resp = await q({
168
- app: {
169
- drive: {
170
- __args: {
171
- index: selectedDrive.value,
172
- },
173
- files: {
174
- __args: filesParams,
175
- name: true,
176
- path: true,
177
- size: true,
178
- mime: true,
179
- url: true,
180
- lastModified: true,
181
- lastModifiedHuman: true,
182
- }
183
- }
184
- }
185
- })
186
-
187
- files.value = resp.app.drive.files.map((item) => {
188
- item.driveIndex = selectedDrive.value;
189
- item.type = "file";
190
- return item;
191
- });
192
- /* files.value = (await drive.value.files.list(path)).map((item) => {
193
- item.driveIndex = selectedDrive.value;
194
- item.type = "file";
195
- return item;
196
- });
197
- */
198
- if (!label.value && !localSearch.value) {
199
- folders.value = (await drive.value.folders.list(path)).map((item) => {
200
- item.driveIndex = selectedDrive.value;
201
- item.type = "folder";
202
- item.lazy = true;
203
- item.id = selectedDrive.value + "/" + item.path;
204
- return item;
205
- });
206
- reloadTreeFolder(selectedNodePath.value, folders.value);
207
- }
208
-
209
-
210
- loading.value = false;
211
-
212
-
213
-
214
-
215
- }
216
-
217
-
218
- const label = ref(null);
219
-
220
- watch(label, () => {
221
- loadItems();
222
- })
223
-
224
- const selected = ref([]);
225
-
226
- const breadcrumbs = computed(() => {
227
- if (selectedPath.value.toString() == "") {
228
- return [];
229
- }
230
-
231
- let paths = selectedNodePath.value.split("/");
232
-
233
- //the first element is the drive index
234
- let driveIndex = paths.shift();
235
-
236
- //find the drive name
237
- let driveName = drives.find((d) => d.index == driveIndex).name;
238
-
239
-
240
- let breadcrumbs = [{
241
- label: driveName,
242
- path: driveIndex,
243
- }]
244
-
245
-
246
-
247
- let ps = [];
248
- for (let p of paths) {
249
- if (p) {
250
- ps.push(p);
251
- breadcrumbs.push({
252
- label: p,
253
- path: driveIndex + "/" + ps.join("/"),
254
- });
255
- }
256
- }
257
-
258
-
259
- return breadcrumbs;
260
- });
261
-
262
- const onClickRow = (evt, row, index) => {
263
- if (row.type == "folder") {
264
- preview.value = null;
265
- return;
266
- }
267
-
268
- preview.value = row;
269
- }
270
-
271
- const grid = ref(false);
272
-
273
- const onDblclickRow = (evt, row, index) => {
274
- if (row.type == "folder") {
275
- selectedNodePath.value = row.driveIndex + "/" + row.path;
276
- return;
277
- }
278
- if (row.type == "file") {
279
- emit("input", row.path);
280
- }
281
- }
282
-
283
-
284
- const findFolder = (path, folders) => {
285
- folders.value.forEach((item) => {
286
- if (item.path == path) {
287
- return item;
288
- }
289
- //find in children
290
- let found = findFolder(path, item.children);
291
- if (found) {
292
- return found;
293
- }
294
- });
295
- }
296
-
297
- const reloadTreeFolder = (path, newFolders) => {
298
- let node = folderTree.value.getNodeByKey(path);
299
-
300
- if (node) {
301
- node.lazy = false;
302
- node.children = newFolders;
303
- folderTree.value.setExpanded(path, true);
304
- }
305
-
306
- }
307
-
308
- const onDeleteSelected = () => {
309
- $q.dialog({
310
- title: "Delete",
311
- message: "Are you sure you want to delete this files or folders?",
312
- cancel: true,
313
- }).onOk(async () => {
314
- for (let row of selected.value) {
315
- if (row.type == "folder") {
316
- await drive.value.folders.delete(row.path)
317
- } else {
318
- await drive.value.files.delete(row.path)
319
- }
320
- }
321
- selected.value = [];
322
- await loadItems();
323
-
324
- });
325
-
326
- }
327
-
328
-
329
-
330
- const onNewFolder = () => {
331
- $q.dialog({
332
- color: $light.color,
333
- title: "New Folder",
334
- prompt: {
335
-
336
- model: "",
337
- label: "Name",
338
- isValid: (val) => {
339
- return val.length > 0;
340
- }
341
- },
342
- cancel: true,
343
- }).onOk(async (name) => {
344
- await drive.value.folders.create(selectedPath.value + "/" + name);
345
- await loadItems();
346
- });
347
- }
348
-
349
- const onDeleteRow = (row) => {
350
- if (row.type == "file") {
351
- $q.dialog({
352
- title: "Delete",
353
- message: "Are you sure you want to delete this file?",
354
- cancel: true,
355
- }).onOk(async () => {
356
- await drive.value.files.delete(row.path);
357
- await loadItems();
358
- });
359
- } else if (row.type == "folder") {
360
- $q.dialog({
361
- title: "Delete",
362
- message: "Are you sure you want to delete this folder?",
363
- cancel: true,
364
- }).onOk(async () => {
365
- await drive.value.folders.delete(row.path);
366
- await loadItems();
367
- });
368
- }
369
- }
370
-
371
- const onRenameRow = (row) => {
372
- $q.dialog({
373
- title: "Rename " + row.type,
374
- prompt: {
375
- label: "Name",
376
- model: row.name,
377
- },
378
- cancel: true,
379
- }).onOk(async (name) => {
380
- try {
381
- if (row.type == "file") {
382
- await drive.value.files.rename(row.path, name)
383
- } else {
384
- await drive.value.folders.rename(row.path, name)
385
- }
386
- } catch (e) {
387
- $q.dialog({
388
- title: "Error",
389
- message: e.message,
390
- });
391
-
392
- return;
393
- }
394
-
395
- await loadItems();
396
-
397
- });
398
- }
399
- const uploadFiles = ref([]);
400
- const showUploadFiles = ref(false);
401
-
402
- const onUploadFiles = async () => {
403
- $q.loading.show({
404
- message: "Uploading files...",
405
- });
406
-
407
- try {
408
- for (let file of uploadFiles.value) {
409
- await m("lightDriveUploadFile", {
410
- index: selectedDrive.value,
411
- path: selectedPath.value,
412
- file
413
- });
414
- }
415
- } catch (e) {
416
- $q.dialog({
417
- title: "Error",
418
- message: e.message,
419
- });
420
- $q.loading.hide();
421
- return;
422
- }
423
- uploadFiles.value = [];
424
-
425
- $q.loading.hide();
426
-
427
- showUploadFiles.value = false;
428
-
429
- await loadItems();
430
-
431
- }
432
-
433
- const preview = ref(null);
434
-
435
-
436
- const drive = computed(() => {
437
- return api.drive(selectedDrive.value);
438
- })
439
-
440
-
441
- const moveToFolder = async (folder) => {
442
-
443
- for (let row of selected.value) {
444
-
445
- if (row.type == "folder") {
446
- await drive.value.folders.move(row.path, folder);
447
- } else {
448
- await drive.value.files.move(row.path, folder);
449
- }
450
-
451
-
452
- }
453
-
454
- await loadItems();
455
- }
456
-
457
- const submitSearch = (e) => {
458
- localSearch.value = search.value;
459
- loadItems();
460
- }
461
-
462
- const onDownloadRow = async (row) => {
463
-
464
- const app = await q({
465
- app: {
466
- drive: {
467
- __args: {
468
- index: row.driveIndex,
469
- },
470
- file: {
471
- __args: {
472
- path: row.path,
473
- },
474
- base64Content: true,
475
- }
476
- }
477
- }
478
- })
479
- console.log(app);
480
- const base64Content = app.app.drive.file.base64Content;
481
-
482
- const downloadLink = document.createElement("a");
483
- downloadLink.href = `data:application/octet-stream;base64,${base64Content}`;
484
- downloadLink.download = row.name;
485
- downloadLink.click();
486
-
487
-
488
- }
489
-
490
- const search = ref(null);
491
-
492
- const reloadStorage = async () => {
493
- path.value = props.base;
494
-
495
- search.value = "";
496
- localSearch.value = "";
497
- label.value = null;
498
- await loadItems();
499
-
500
- }
501
-
502
- const permission = await api.auth.granted([
503
- 'fs.folder.create', 'fs.folder.delete', 'fs.folder.rename',
504
- 'fs.file.delete', 'fs.file.rename', 'fs.file.upload'
505
- ]);
506
-
507
- const canDeleteRow = (row) => {
508
- if (row.type == "folder" && permission.includes("fs.folder.delete")) {
509
- return true;
510
- }
511
-
512
- if (row.type == "file" && permission.includes("fs.file.delete")) {
513
- return true;
514
- }
515
-
516
- return false;
517
- }
518
-
519
- const canRenameRow = (row) => {
520
- if (row.type == "folder" && permission.includes("fs.folder.rename")) {
521
- return true;
522
- }
523
-
524
- if (row.type == "file" && permission.includes("fs.file.rename")) {
525
- return true;
526
- }
527
-
528
- return false;
529
- }
530
-
531
- /* const perm = await q("granted", {
532
- rights: ["fs.folder.create"]
533
- }) */
534
-
535
- const showPreviewImgDialog = ref(false);
536
- const previewImg = ref(null);
537
- const isDark = computed(() => light.isDarkMode());
538
-
539
- const onPreview = (row) => {
540
- showPreviewImgDialog.value = true;
541
- previewImg.value = row.url;
542
- }
543
-
544
- const onPreviewPDF = async (row) => {
545
- const height = window.innerHeight - 200;
546
- $q.dialog({
547
- autoClose: true,
548
- fullWidth: true,
549
- fullHeight: true,
550
- title: "Preview PDF",
551
- message: "<iframe src='" + row.url + "' width='100%' height='" + height + "px'></iframe>",
552
- html: true,
553
-
554
- })
555
- }
556
-
557
- const onClickInfo = async (row) => {
558
- rightDrawerOpen.value = true;
559
-
560
- }
561
-
562
- const items = computed(() => {
563
- return [...folders.value, ...files.value];
564
- })
565
-
566
-
567
-
568
-
569
- const selectedNodePath = ref(null)
570
- const selectedDrive = computed(() => {
571
- if (selectedNodePath.value) {
572
- //split the path into drive index and folder path
573
- //examle 0/folder1/folder2
574
- const [driveIndex, ...path] = selectedNodePath.value.split("/");
575
- return parseInt(driveIndex);
576
- }
577
- return null;
578
- })
579
-
580
- const selectedPath = computed(() => {
581
- if (selectedNodePath.value) {
582
- //split the path into drive index and folder path
583
- //examle 0/folder1/folder2
584
- const [driveIndex, ...path] = selectedNodePath.value.split("/");
585
- return "/" + path.join("/");
586
- }
587
- return "";
588
- })
589
-
590
- watch(selectedNodePath, async () => {
591
- selected.value = [];
592
- await loadItems()
593
- });
594
-
595
- const canPreview = (file) => {
596
- //check file mime type
597
- const mime = ['image/jpeg', 'image/png', 'image/gif'];
598
- return mime.includes(file.mime);
599
- };
600
-
601
-
602
- const onCheckTotalSize = async (folder) => {
603
-
604
- const d = $q.dialog({
605
- title: "Total Size",
606
- progress: true,
607
-
608
- });
609
-
610
- const resp = await q({
611
- app: {
612
- drive: {
613
- __args: {
614
- index: folder.driveIndex,
615
- },
616
- folder: {
617
- __args: {
618
- path: folder.path,
619
- },
620
- totalSize: true,
621
- }
622
- }
623
-
624
- }
625
- });
626
-
627
- d.update({
628
- message: humanStorageSize(resp.app.drive.folder.totalSize),
629
- progress: false,
630
- });
631
-
632
-
633
- }
634
-
635
-
636
- selectedNodePath.value = drives[0].index.toString();
637
- </script>
638
- <template>
639
-
1
+ <script setup>
2
+ import { useI18n } from "vue-i18n";
3
+ import { ref, watch, computed, onMounted } from "vue";
4
+ import { useQuasar, format } from "quasar";
5
+ import { q, m, useLight, api } from "#imports";
6
+ const { humanStorageSize } = format;
7
+ const light = useLight();
8
+ const i18n = useI18n();
9
+ const $q = useQuasar();
10
+ const $light = useLight();
11
+ const emit = defineEmits(["input", "close"]);
12
+ const { app: { drives } } = await q({
13
+ app: {
14
+ drives: {
15
+ index: true,
16
+ name: true
17
+ }
18
+ }
19
+ });
20
+ const folders = ref([]);
21
+ const files = ref([]);
22
+ const nodes = drives.map((drive2) => {
23
+ return {
24
+ icon: "sym_o_storage",
25
+ name: drive2.name,
26
+ id: drive2.index.toString(),
27
+ path: "/",
28
+ lazy: true,
29
+ driveIndex: drive2.index,
30
+ type: "drive"
31
+ };
32
+ });
33
+ const onLazyLoad = async ({ node, key, done, fail }) => {
34
+ const folders2 = await api.drive(node.driveIndex).folders.list(node.path, {
35
+ name: true,
36
+ path: true
37
+ });
38
+ const data = folders2.map((item) => {
39
+ item.driveIndex = node.driveIndex;
40
+ item.id = node.driveIndex + "/" + item.path;
41
+ item.lazy = true;
42
+ item.type = "folder";
43
+ return item;
44
+ });
45
+ done(data);
46
+ };
47
+ const props = defineProps({
48
+ closeable: Boolean,
49
+ height: {
50
+ type: String,
51
+ default: "700px"
52
+ },
53
+ defaultAction: {
54
+ default: "preview",
55
+ type: String
56
+ },
57
+ multiple: {
58
+ default: false,
59
+ type: Boolean
60
+ },
61
+ base: {
62
+ default: "/",
63
+ type: String
64
+ }
65
+ });
66
+ const loading = ref(false);
67
+ const folderTree = ref(null);
68
+ const pagination = {
69
+ rowsPerPage: 0,
70
+ "rows-per-page-options": [0]
71
+ };
72
+ const columns = ref([
73
+ {
74
+ name: "icon",
75
+ label: "",
76
+ field: "type"
77
+ },
78
+ {
79
+ name: "name",
80
+ label: i18n.t("Name"),
81
+ field: "name",
82
+ sortable: true,
83
+ align: "left"
84
+ },
85
+ {
86
+ name: "last_modified",
87
+ label: i18n.t("Last Modified"),
88
+ field: "lastModifiedHuman",
89
+ align: "left"
90
+ },
91
+ {
92
+ name: "size_display",
93
+ label: i18n.t("Size"),
94
+ field: "size",
95
+ align: "right",
96
+ format: (val) => {
97
+ if (val == null) {
98
+ return "";
99
+ }
100
+ return humanStorageSize(val);
101
+ }
102
+ },
103
+ { name: "action" }
104
+ ]);
105
+ const localSearch = ref(null);
106
+ const rightDrawerOpen = ref(false);
107
+ const leftDrawerOpen = ref(false);
108
+ const showDateOptions = ref(false);
109
+ const exactPhrase = ref("");
110
+ const hasWords = ref("");
111
+ const excludeWords = ref("");
112
+ const byWebsite = ref("");
113
+ const byDate = ref("Any time");
114
+ function onClear() {
115
+ exactPhrase.value = "";
116
+ hasWords.value = "";
117
+ excludeWords.value = "";
118
+ byWebsite.value = "";
119
+ byDate.value = "Any time";
120
+ }
121
+ function changeDate(option) {
122
+ byDate.value = option;
123
+ showDateOptions.value = false;
124
+ }
125
+ function toggleLeftDrawer() {
126
+ leftDrawerOpen.value = !leftDrawerOpen.value;
127
+ }
128
+ const loadItems = async () => {
129
+ let path2 = selectedPath.value;
130
+ files.value = [];
131
+ folders.value = [];
132
+ loading.value = true;
133
+ let filesParams = { path: path2 };
134
+ if (label.value) {
135
+ filesParams.type = label.value;
136
+ }
137
+ if (localSearch.value) {
138
+ filesParams.search = localSearch.value;
139
+ }
140
+ const resp = await q({
141
+ app: {
142
+ drive: {
143
+ __args: {
144
+ index: selectedDrive.value
145
+ },
146
+ files: {
147
+ __args: filesParams,
148
+ name: true,
149
+ path: true,
150
+ size: true,
151
+ mime: true,
152
+ url: true,
153
+ lastModified: true,
154
+ lastModifiedHuman: true
155
+ }
156
+ }
157
+ }
158
+ });
159
+ files.value = resp.app.drive.files.map((item) => {
160
+ item.driveIndex = selectedDrive.value;
161
+ item.type = "file";
162
+ return item;
163
+ });
164
+ if (!label.value && !localSearch.value) {
165
+ folders.value = (await drive.value.folders.list(path2)).map((item) => {
166
+ item.driveIndex = selectedDrive.value;
167
+ item.type = "folder";
168
+ item.lazy = true;
169
+ item.id = selectedDrive.value + "/" + item.path;
170
+ return item;
171
+ });
172
+ reloadTreeFolder(selectedNodePath.value, folders.value);
173
+ }
174
+ loading.value = false;
175
+ };
176
+ const label = ref(null);
177
+ watch(label, () => {
178
+ loadItems();
179
+ });
180
+ const selected = ref([]);
181
+ const breadcrumbs = computed(() => {
182
+ if (selectedPath.value.toString() == "") {
183
+ return [];
184
+ }
185
+ let paths = selectedNodePath.value.split("/");
186
+ let driveIndex = paths.shift();
187
+ let driveName = drives.find((d) => d.index == driveIndex).name;
188
+ let breadcrumbs2 = [{
189
+ label: driveName,
190
+ path: driveIndex
191
+ }];
192
+ let ps = [];
193
+ for (let p of paths) {
194
+ if (p) {
195
+ ps.push(p);
196
+ breadcrumbs2.push({
197
+ label: p,
198
+ path: driveIndex + "/" + ps.join("/")
199
+ });
200
+ }
201
+ }
202
+ return breadcrumbs2;
203
+ });
204
+ const onClickRow = (evt, row, index) => {
205
+ if (row.type == "folder") {
206
+ preview.value = null;
207
+ return;
208
+ }
209
+ preview.value = row;
210
+ };
211
+ const grid = ref(false);
212
+ const onDblclickRow = (evt, row, index) => {
213
+ if (row.type == "folder") {
214
+ selectedNodePath.value = row.driveIndex + "/" + row.path;
215
+ return;
216
+ }
217
+ if (row.type == "file") {
218
+ emit("input", row.path);
219
+ }
220
+ };
221
+ const findFolder = (path2, folders2) => {
222
+ folders2.value.forEach((item) => {
223
+ if (item.path == path2) {
224
+ return item;
225
+ }
226
+ let found = findFolder(path2, item.children);
227
+ if (found) {
228
+ return found;
229
+ }
230
+ });
231
+ };
232
+ const reloadTreeFolder = (path2, newFolders) => {
233
+ let node = folderTree.value.getNodeByKey(path2);
234
+ if (node) {
235
+ node.lazy = false;
236
+ node.children = newFolders;
237
+ folderTree.value.setExpanded(path2, true);
238
+ }
239
+ };
240
+ const onDeleteSelected = () => {
241
+ $q.dialog({
242
+ title: "Delete",
243
+ message: "Are you sure you want to delete this files or folders?",
244
+ cancel: true
245
+ }).onOk(async () => {
246
+ for (let row of selected.value) {
247
+ if (row.type == "folder") {
248
+ await drive.value.folders.delete(row.path);
249
+ } else {
250
+ await drive.value.files.delete(row.path);
251
+ }
252
+ }
253
+ selected.value = [];
254
+ await loadItems();
255
+ });
256
+ };
257
+ const onNewFolder = () => {
258
+ $q.dialog({
259
+ color: $light.color,
260
+ title: "New Folder",
261
+ prompt: {
262
+ model: "",
263
+ label: "Name",
264
+ isValid: (val) => {
265
+ return val.length > 0;
266
+ }
267
+ },
268
+ cancel: true
269
+ }).onOk(async (name) => {
270
+ await drive.value.folders.create(selectedPath.value + "/" + name);
271
+ await loadItems();
272
+ });
273
+ };
274
+ const onDeleteRow = (row) => {
275
+ if (row.type == "file") {
276
+ $q.dialog({
277
+ title: "Delete",
278
+ message: "Are you sure you want to delete this file?",
279
+ cancel: true
280
+ }).onOk(async () => {
281
+ await drive.value.files.delete(row.path);
282
+ await loadItems();
283
+ });
284
+ } else if (row.type == "folder") {
285
+ $q.dialog({
286
+ title: "Delete",
287
+ message: "Are you sure you want to delete this folder?",
288
+ cancel: true
289
+ }).onOk(async () => {
290
+ await drive.value.folders.delete(row.path);
291
+ await loadItems();
292
+ });
293
+ }
294
+ };
295
+ const onRenameRow = (row) => {
296
+ $q.dialog({
297
+ title: "Rename " + row.type,
298
+ prompt: {
299
+ label: "Name",
300
+ model: row.name
301
+ },
302
+ cancel: true
303
+ }).onOk(async (name) => {
304
+ try {
305
+ if (row.type == "file") {
306
+ await drive.value.files.rename(row.path, name);
307
+ } else {
308
+ await drive.value.folders.rename(row.path, name);
309
+ }
310
+ } catch (e) {
311
+ $q.dialog({
312
+ title: "Error",
313
+ message: e.message
314
+ });
315
+ return;
316
+ }
317
+ await loadItems();
318
+ });
319
+ };
320
+ const uploadFiles = ref([]);
321
+ const showUploadFiles = ref(false);
322
+ const onUploadFiles = async () => {
323
+ $q.loading.show({
324
+ message: "Uploading files..."
325
+ });
326
+ try {
327
+ for (let file of uploadFiles.value) {
328
+ await m("lightDriveUploadFile", {
329
+ index: selectedDrive.value,
330
+ path: selectedPath.value,
331
+ file
332
+ });
333
+ }
334
+ } catch (e) {
335
+ $q.dialog({
336
+ title: "Error",
337
+ message: e.message
338
+ });
339
+ $q.loading.hide();
340
+ return;
341
+ }
342
+ uploadFiles.value = [];
343
+ $q.loading.hide();
344
+ showUploadFiles.value = false;
345
+ await loadItems();
346
+ };
347
+ const preview = ref(null);
348
+ const drive = computed(() => {
349
+ return api.drive(selectedDrive.value);
350
+ });
351
+ const moveToFolder = async (folder) => {
352
+ for (let row of selected.value) {
353
+ if (row.type == "folder") {
354
+ await drive.value.folders.move(row.path, folder);
355
+ } else {
356
+ await drive.value.files.move(row.path, folder);
357
+ }
358
+ }
359
+ await loadItems();
360
+ };
361
+ const submitSearch = (e) => {
362
+ localSearch.value = search.value;
363
+ loadItems();
364
+ };
365
+ const onDownloadRow = async (row) => {
366
+ const app = await q({
367
+ app: {
368
+ drive: {
369
+ __args: {
370
+ index: row.driveIndex
371
+ },
372
+ file: {
373
+ __args: {
374
+ path: row.path
375
+ },
376
+ base64Content: true
377
+ }
378
+ }
379
+ }
380
+ });
381
+ console.log(app);
382
+ const base64Content = app.app.drive.file.base64Content;
383
+ const downloadLink = document.createElement("a");
384
+ downloadLink.href = `data:application/octet-stream;base64,${base64Content}`;
385
+ downloadLink.download = row.name;
386
+ downloadLink.click();
387
+ };
388
+ const search = ref(null);
389
+ const reloadStorage = async () => {
390
+ path.value = props.base;
391
+ search.value = "";
392
+ localSearch.value = "";
393
+ label.value = null;
394
+ await loadItems();
395
+ };
396
+ const permission = await api.auth.granted([
397
+ "fs.folder.create",
398
+ "fs.folder.delete",
399
+ "fs.folder.rename",
400
+ "fs.file.delete",
401
+ "fs.file.rename",
402
+ "fs.file.upload"
403
+ ]);
404
+ const canDeleteRow = (row) => {
405
+ if (row.type == "folder" && permission.includes("fs.folder.delete")) {
406
+ return true;
407
+ }
408
+ if (row.type == "file" && permission.includes("fs.file.delete")) {
409
+ return true;
410
+ }
411
+ return false;
412
+ };
413
+ const canRenameRow = (row) => {
414
+ if (row.type == "folder" && permission.includes("fs.folder.rename")) {
415
+ return true;
416
+ }
417
+ if (row.type == "file" && permission.includes("fs.file.rename")) {
418
+ return true;
419
+ }
420
+ return false;
421
+ };
422
+ const showPreviewImgDialog = ref(false);
423
+ const previewImg = ref(null);
424
+ const isDark = computed(() => light.isDarkMode());
425
+ const onPreview = (row) => {
426
+ showPreviewImgDialog.value = true;
427
+ previewImg.value = row.url;
428
+ };
429
+ const onPreviewPDF = async (row) => {
430
+ const height = window.innerHeight - 200;
431
+ $q.dialog({
432
+ autoClose: true,
433
+ fullWidth: true,
434
+ fullHeight: true,
435
+ title: "Preview PDF",
436
+ message: "<iframe src='" + row.url + "' width='100%' height='" + height + "px'></iframe>",
437
+ html: true
438
+ });
439
+ };
440
+ const onClickInfo = async (row) => {
441
+ rightDrawerOpen.value = true;
442
+ };
443
+ const items = computed(() => {
444
+ return [...folders.value, ...files.value];
445
+ });
446
+ const selectedNodePath = ref(null);
447
+ const selectedDrive = computed(() => {
448
+ if (selectedNodePath.value) {
449
+ const [driveIndex, ...path2] = selectedNodePath.value.split("/");
450
+ return parseInt(driveIndex);
451
+ }
452
+ return null;
453
+ });
454
+ const selectedPath = computed(() => {
455
+ if (selectedNodePath.value) {
456
+ const [driveIndex, ...path2] = selectedNodePath.value.split("/");
457
+ return "/" + path2.join("/");
458
+ }
459
+ return "";
460
+ });
461
+ watch(selectedNodePath, async () => {
462
+ selected.value = [];
463
+ await loadItems();
464
+ });
465
+ const canPreview = (file) => {
466
+ const mime = ["image/jpeg", "image/png", "image/gif"];
467
+ return mime.includes(file.mime);
468
+ };
469
+ const onCheckTotalSize = async (folder) => {
470
+ const d = $q.dialog({
471
+ title: "Total Size",
472
+ progress: true
473
+ });
474
+ const resp = await q({
475
+ app: {
476
+ drive: {
477
+ __args: {
478
+ index: folder.driveIndex
479
+ },
480
+ folder: {
481
+ __args: {
482
+ path: folder.path
483
+ },
484
+ totalSize: true
485
+ }
486
+ }
487
+ }
488
+ });
489
+ d.update({
490
+ message: humanStorageSize(resp.app.drive.folder.totalSize),
491
+ progress: false
492
+ });
493
+ };
494
+ selectedNodePath.value = drives[0].index.toString();
495
+ </script>
496
+
497
+ <template>
640
498
  <q-layout view="hHh lpR fFf" :class="isDark ? '' : 'bg-white'" container :style="{ 'min-height': height }">
641
499
  <q-header bordered :class="isDark ? '' : 'bg-white text-grey-8'" height-hint="64">
642
500
  <q-toolbar>
@@ -884,4 +742,4 @@ selectedNodePath.value = drives[0].index.toString();
884
742
  </template>
885
743
  </q-page-container>
886
744
  </q-layout>
887
- </template>
745
+ </template>