@weconstudio/nuxt 0.0.0-stage → 1.72.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 (208) hide show
  1. package/LICENSE +1 -0
  2. package/README.md +115 -2
  3. package/dist/module.d.mts +7 -0
  4. package/dist/module.json +12 -0
  5. package/dist/module.mjs +250 -0
  6. package/dist/runtime/components/We/Autocomplete.d.vue.ts +13 -0
  7. package/dist/runtime/components/We/Autocomplete.vue +91 -0
  8. package/dist/runtime/components/We/Autocomplete.vue.d.ts +13 -0
  9. package/dist/runtime/components/We/BoldText.d.vue.ts +17 -0
  10. package/dist/runtime/components/We/BoldText.vue +29 -0
  11. package/dist/runtime/components/We/BoldText.vue.d.ts +17 -0
  12. package/dist/runtime/components/We/ColorPicker.d.vue.ts +11 -0
  13. package/dist/runtime/components/We/ColorPicker.vue +199 -0
  14. package/dist/runtime/components/We/ColorPicker.vue.d.ts +11 -0
  15. package/dist/runtime/components/We/ConfirmDialog.d.vue.ts +104 -0
  16. package/dist/runtime/components/We/ConfirmDialog.vue +143 -0
  17. package/dist/runtime/components/We/ConfirmDialog.vue.d.ts +104 -0
  18. package/dist/runtime/components/We/Datatable.d.vue.ts +40 -0
  19. package/dist/runtime/components/We/Datatable.vue +87 -0
  20. package/dist/runtime/components/We/Datatable.vue.d.ts +40 -0
  21. package/dist/runtime/components/We/DatatableInternal.d.vue.ts +194 -0
  22. package/dist/runtime/components/We/DatatableInternal.vue +638 -0
  23. package/dist/runtime/components/We/DatatableInternal.vue.d.ts +194 -0
  24. package/dist/runtime/components/We/DatePicker.d.vue.ts +51 -0
  25. package/dist/runtime/components/We/DatePicker.vue +901 -0
  26. package/dist/runtime/components/We/DatePicker.vue.d.ts +51 -0
  27. package/dist/runtime/components/We/Dt/Actions.d.vue.ts +51 -0
  28. package/dist/runtime/components/We/Dt/Actions.vue +106 -0
  29. package/dist/runtime/components/We/Dt/Actions.vue.d.ts +51 -0
  30. package/dist/runtime/components/We/Dt/BooleanFormatter.d.vue.ts +8 -0
  31. package/dist/runtime/components/We/Dt/BooleanFormatter.vue +26 -0
  32. package/dist/runtime/components/We/Dt/BooleanFormatter.vue.d.ts +8 -0
  33. package/dist/runtime/components/We/Dt/CardFilterContainer.d.vue.ts +17 -0
  34. package/dist/runtime/components/We/Dt/CardFilterContainer.vue +60 -0
  35. package/dist/runtime/components/We/Dt/CardFilterContainer.vue.d.ts +17 -0
  36. package/dist/runtime/components/We/Dt/CheckboxFilter.d.vue.ts +16 -0
  37. package/dist/runtime/components/We/Dt/CheckboxFilter.vue +47 -0
  38. package/dist/runtime/components/We/Dt/CheckboxFilter.vue.d.ts +16 -0
  39. package/dist/runtime/components/We/Dt/ChipGroupSelect.d.vue.ts +7 -0
  40. package/dist/runtime/components/We/Dt/ChipGroupSelect.vue +35 -0
  41. package/dist/runtime/components/We/Dt/ChipGroupSelect.vue.d.ts +7 -0
  42. package/dist/runtime/components/We/Dt/ClusterFilter.d.vue.ts +18 -0
  43. package/dist/runtime/components/We/Dt/ClusterFilter.vue +68 -0
  44. package/dist/runtime/components/We/Dt/ClusterFilter.vue.d.ts +18 -0
  45. package/dist/runtime/components/We/Dt/DatasetFormatter.d.vue.ts +19 -0
  46. package/dist/runtime/components/We/Dt/DatasetFormatter.vue +65 -0
  47. package/dist/runtime/components/We/Dt/DatasetFormatter.vue.d.ts +19 -0
  48. package/dist/runtime/components/We/Dt/DaterangeFilter.d.vue.ts +28 -0
  49. package/dist/runtime/components/We/Dt/DaterangeFilter.vue +140 -0
  50. package/dist/runtime/components/We/Dt/DaterangeFilter.vue.d.ts +28 -0
  51. package/dist/runtime/components/We/Dt/Filter.d.vue.ts +7 -0
  52. package/dist/runtime/components/We/Dt/Filter.vue +234 -0
  53. package/dist/runtime/components/We/Dt/Filter.vue.d.ts +7 -0
  54. package/dist/runtime/components/We/Dt/Filters.d.vue.ts +6 -0
  55. package/dist/runtime/components/We/Dt/Filters.vue +24 -0
  56. package/dist/runtime/components/We/Dt/Filters.vue.d.ts +6 -0
  57. package/dist/runtime/components/We/Dt/LuxonFormatter.d.vue.ts +12 -0
  58. package/dist/runtime/components/We/Dt/LuxonFormatter.vue +23 -0
  59. package/dist/runtime/components/We/Dt/LuxonFormatter.vue.d.ts +12 -0
  60. package/dist/runtime/components/We/Dt/SelectFilter.d.vue.ts +60 -0
  61. package/dist/runtime/components/We/Dt/SelectFilter.vue +333 -0
  62. package/dist/runtime/components/We/Dt/SelectFilter.vue.d.ts +60 -0
  63. package/dist/runtime/components/We/Dt/SelectResourceFilter.d.vue.ts +43 -0
  64. package/dist/runtime/components/We/Dt/SelectResourceFilter.vue +127 -0
  65. package/dist/runtime/components/We/Dt/SelectResourceFilter.vue.d.ts +43 -0
  66. package/dist/runtime/components/We/Dt/dt.types.d.ts +8 -0
  67. package/dist/runtime/components/We/EndpointSwitcher.d.vue.ts +12 -0
  68. package/dist/runtime/components/We/EndpointSwitcher.vue +256 -0
  69. package/dist/runtime/components/We/EndpointSwitcher.vue.d.ts +12 -0
  70. package/dist/runtime/components/We/Import.d.vue.ts +118 -0
  71. package/dist/runtime/components/We/Import.vue +730 -0
  72. package/dist/runtime/components/We/Import.vue.d.ts +118 -0
  73. package/dist/runtime/components/We/ImportDefaultValues.d.vue.ts +3666 -0
  74. package/dist/runtime/components/We/ImportDefaultValues.vue +115 -0
  75. package/dist/runtime/components/We/ImportDefaultValues.vue.d.ts +3666 -0
  76. package/dist/runtime/components/We/ImportMatchColumns.d.vue.ts +66 -0
  77. package/dist/runtime/components/We/ImportMatchColumns.vue +172 -0
  78. package/dist/runtime/components/We/ImportMatchColumns.vue.d.ts +66 -0
  79. package/dist/runtime/components/We/ImportPreviewResults.d.vue.ts +38 -0
  80. package/dist/runtime/components/We/ImportPreviewResults.vue +165 -0
  81. package/dist/runtime/components/We/ImportPreviewResults.vue.d.ts +38 -0
  82. package/dist/runtime/components/We/ImportSelectStart.d.vue.ts +47 -0
  83. package/dist/runtime/components/We/ImportSelectStart.vue +106 -0
  84. package/dist/runtime/components/We/ImportSelectStart.vue.d.ts +47 -0
  85. package/dist/runtime/components/We/Notification.d.vue.ts +7 -0
  86. package/dist/runtime/components/We/Notification.vue +49 -0
  87. package/dist/runtime/components/We/Notification.vue.d.ts +7 -0
  88. package/dist/runtime/components/We/S3Dropzone.d.vue.ts +17 -0
  89. package/dist/runtime/components/We/S3Dropzone.vue +527 -0
  90. package/dist/runtime/components/We/S3Dropzone.vue.d.ts +17 -0
  91. package/dist/runtime/components/We/Select.d.vue.ts +39 -0
  92. package/dist/runtime/components/We/Select.vue +354 -0
  93. package/dist/runtime/components/We/Select.vue.d.ts +39 -0
  94. package/dist/runtime/components/We/TipTap.d.vue.ts +26 -0
  95. package/dist/runtime/components/We/TipTap.vue +362 -0
  96. package/dist/runtime/components/We/TipTap.vue.d.ts +26 -0
  97. package/dist/runtime/components/We/datatable.props.d.ts +57 -0
  98. package/dist/runtime/components/We/datatable.props.js +60 -0
  99. package/dist/runtime/composables/datatable/useAutoFillHeight.d.ts +31 -0
  100. package/dist/runtime/composables/datatable/useAutoFillHeight.js +57 -0
  101. package/dist/runtime/composables/datatable/useDataTable.d.ts +33 -0
  102. package/dist/runtime/composables/datatable/useDataTable.js +161 -0
  103. package/dist/runtime/composables/datatable/useDatatableColumns.d.ts +12 -0
  104. package/dist/runtime/composables/datatable/useDatatableColumns.js +96 -0
  105. package/dist/runtime/composables/useApi.d.ts +56 -0
  106. package/dist/runtime/composables/useApi.js +230 -0
  107. package/dist/runtime/composables/useApiFetch.d.ts +2 -0
  108. package/dist/runtime/composables/useApiFetch.js +9 -0
  109. package/dist/runtime/composables/useApiUrl.d.ts +10 -0
  110. package/dist/runtime/composables/useApiUrl.js +37 -0
  111. package/dist/runtime/composables/useAuth.d.ts +9 -0
  112. package/dist/runtime/composables/useAuth.js +22 -0
  113. package/dist/runtime/composables/useBus.d.ts +8 -0
  114. package/dist/runtime/composables/useBus.js +18 -0
  115. package/dist/runtime/composables/useDateRangePresets.d.ts +21 -0
  116. package/dist/runtime/composables/useDateRangePresets.js +90 -0
  117. package/dist/runtime/composables/useForm.d.ts +29 -0
  118. package/dist/runtime/composables/useForm.js +74 -0
  119. package/dist/runtime/composables/useFormLock.d.ts +11 -0
  120. package/dist/runtime/composables/useFormLock.js +8 -0
  121. package/dist/runtime/composables/useFormWrapper.d.ts +16 -0
  122. package/dist/runtime/composables/useFormWrapper.js +36 -0
  123. package/dist/runtime/composables/useImportJob.d.ts +55 -0
  124. package/dist/runtime/composables/useImportJob.js +94 -0
  125. package/dist/runtime/composables/useLux.d.ts +1 -0
  126. package/dist/runtime/composables/useLux.js +8 -0
  127. package/dist/runtime/composables/useNotify.d.ts +12 -0
  128. package/dist/runtime/composables/useNotify.js +24 -0
  129. package/dist/runtime/composables/usePaginatedFetch.d.ts +24 -0
  130. package/dist/runtime/composables/usePaginatedFetch.js +154 -0
  131. package/dist/runtime/composables/useServerErrors.d.ts +16 -0
  132. package/dist/runtime/composables/useServerErrors.js +60 -0
  133. package/dist/runtime/composables/useValidators.d.ts +18 -0
  134. package/dist/runtime/composables/useValidators.js +56 -0
  135. package/dist/runtime/generator/code/dt.d.ts +8 -0
  136. package/dist/runtime/generator/code/dt.js +97 -0
  137. package/dist/runtime/generator/code/edit.d.ts +4 -0
  138. package/dist/runtime/generator/code/edit.js +41 -0
  139. package/dist/runtime/generator/code/form.d.ts +6 -0
  140. package/dist/runtime/generator/code/form.js +229 -0
  141. package/dist/runtime/generator/code/i18n.d.ts +5 -0
  142. package/dist/runtime/generator/code/i18n.js +43 -0
  143. package/dist/runtime/generator/code/index.d.ts +11 -0
  144. package/dist/runtime/generator/code/index.js +90 -0
  145. package/dist/runtime/generator/components/CodeSnippet.d.vue.ts +14 -0
  146. package/dist/runtime/generator/components/CodeSnippet.vue +49 -0
  147. package/dist/runtime/generator/components/CodeSnippet.vue.d.ts +14 -0
  148. package/dist/runtime/generator/components/Configuration.d.vue.ts +16 -0
  149. package/dist/runtime/generator/components/Configuration.vue +154 -0
  150. package/dist/runtime/generator/components/Configuration.vue.d.ts +16 -0
  151. package/dist/runtime/generator/components/GeneratorPage.d.vue.ts +50 -0
  152. package/dist/runtime/generator/components/GeneratorPage.vue +226 -0
  153. package/dist/runtime/generator/components/GeneratorPage.vue.d.ts +50 -0
  154. package/dist/runtime/generator/fs.d.ts +16 -0
  155. package/dist/runtime/generator/fs.js +79 -0
  156. package/dist/runtime/generator/index.d.vue.ts +52 -0
  157. package/dist/runtime/generator/index.vue +17 -0
  158. package/dist/runtime/generator/index.vue.d.ts +52 -0
  159. package/dist/runtime/internals/api.d.ts +3 -0
  160. package/dist/runtime/internals/api.js +16 -0
  161. package/dist/runtime/internals/bus.d.ts +1 -0
  162. package/dist/runtime/internals/bus.js +2 -0
  163. package/dist/runtime/internals/dt.d.ts +24 -0
  164. package/dist/runtime/internals/dt.js +57 -0
  165. package/dist/runtime/lang/en.json +211 -0
  166. package/dist/runtime/lang/it.json +211 -0
  167. package/dist/runtime/mixins/formValidator.d.ts +38 -0
  168. package/dist/runtime/mixins/formValidator.js +118 -0
  169. package/dist/runtime/plugins/api-legacy.d.ts +76 -0
  170. package/dist/runtime/plugins/api-legacy.js +11 -0
  171. package/dist/runtime/plugins/auth-legacy.d.ts +22 -0
  172. package/dist/runtime/plugins/auth-legacy.js +14 -0
  173. package/dist/runtime/plugins/bus-legacy.d.ts +6 -0
  174. package/dist/runtime/plugins/bus-legacy.js +9 -0
  175. package/dist/runtime/plugins/notify-legacy.d.ts +25 -0
  176. package/dist/runtime/plugins/notify-legacy.js +35 -0
  177. package/dist/runtime/plugins/portal.d.ts +2 -0
  178. package/dist/runtime/plugins/portal.js +5 -0
  179. package/dist/runtime/plugins/update-sanctum-app-config.d.ts +2 -0
  180. package/dist/runtime/plugins/update-sanctum-app-config.js +44 -0
  181. package/dist/runtime/plugins/vuetify-nuxt-icon.d.ts +4 -0
  182. package/dist/runtime/plugins/vuetify-nuxt-icon.js +30 -0
  183. package/dist/runtime/types/app-config.d.ts +24 -0
  184. package/dist/runtime/types/app-config.js +1 -0
  185. package/dist/runtime/types/icons.d.ts +82 -0
  186. package/dist/runtime/types/icons.js +84 -0
  187. package/dist/runtime/types/index.d.ts +2 -0
  188. package/dist/runtime/types/index.js +2 -0
  189. package/dist/runtime/types/module-options.d.ts +29 -0
  190. package/dist/runtime/types/module-options.js +0 -0
  191. package/dist/runtime/types/runtime-hooks.d.ts +17 -0
  192. package/dist/runtime/types/runtime-hooks.js +1 -0
  193. package/dist/runtime/utils/color.d.ts +10 -0
  194. package/dist/runtime/utils/color.js +38 -0
  195. package/dist/runtime/utils/file.d.ts +17 -0
  196. package/dist/runtime/utils/file.js +108 -0
  197. package/dist/runtime/utils/format.d.ts +1 -0
  198. package/dist/runtime/utils/format.js +14 -0
  199. package/dist/runtime/utils/make-enum.d.ts +15 -0
  200. package/dist/runtime/utils/make-enum.js +27 -0
  201. package/dist/runtime/utils/mergeDefaults.d.ts +1 -0
  202. package/dist/runtime/utils/mergeDefaults.js +18 -0
  203. package/dist/runtime/utils/object-to-formdata.d.ts +10 -0
  204. package/dist/runtime/utils/object-to-formdata.js +82 -0
  205. package/dist/runtime/utils/uuid.d.ts +1 -0
  206. package/dist/runtime/utils/uuid.js +9 -0
  207. package/dist/types.d.mts +9 -0
  208. package/package.json +92 -4
@@ -0,0 +1,14 @@
1
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ code: {
3
+ type: StringConstructor;
4
+ required: true;
5
+ };
6
+ }>, {}, {}, {}, {
7
+ copy(): Promise<void>;
8
+ }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
9
+ code: {
10
+ type: StringConstructor;
11
+ required: true;
12
+ };
13
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
14
+ export default _default;
@@ -0,0 +1,49 @@
1
+ <template>
2
+ <v-card
3
+ tile
4
+ dark
5
+ class="pa-0"
6
+ >
7
+ <v-btn
8
+ icon
9
+ size="small"
10
+ variant="text"
11
+ position="absolute"
12
+ location="top right"
13
+ @click="copy"
14
+ >
15
+ <v-icon>mdi-content-copy</v-icon>
16
+ </v-btn>
17
+ <!-- <vue-code-highlight language="html"> -->
18
+ <pre>
19
+ {{ code }}
20
+ </pre>
21
+ <!-- </vue-code-highlight> -->
22
+ </v-card>
23
+ </template>
24
+
25
+ <script>
26
+ export default {
27
+ // components: {
28
+ // VueCodeHighlight,
29
+ // },
30
+ props: {
31
+ code: {
32
+ type: String,
33
+ required: true
34
+ }
35
+ },
36
+ methods: {
37
+ async copy() {
38
+ await navigator.clipboard.writeText(this.code);
39
+ }
40
+ }
41
+ };
42
+ </script>
43
+
44
+ <style>
45
+ .theme--dark.v-application code {
46
+ background-color: unset;
47
+ color: unset;
48
+ }
49
+ </style>
@@ -0,0 +1,14 @@
1
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ code: {
3
+ type: StringConstructor;
4
+ required: true;
5
+ };
6
+ }>, {}, {}, {}, {
7
+ copy(): Promise<void>;
8
+ }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
9
+ code: {
10
+ type: StringConstructor;
11
+ required: true;
12
+ };
13
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
14
+ export default _default;
@@ -0,0 +1,16 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {
2
+ resourceName: string;
3
+ prefix: string;
4
+ editMode: string;
5
+ layout: string;
6
+ part: string;
7
+ i18n: string;
8
+ }, {
9
+ projectFolderName(): any;
10
+ }, {
11
+ selectProjectFolder(): void;
12
+ emit(): void;
13
+ }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "load"[], "load", import("vue").PublicProps, Readonly<{}> & Readonly<{
14
+ onLoad?: ((...args: any[]) => any) | undefined;
15
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
16
+ export default _default;
@@ -0,0 +1,154 @@
1
+ <template>
2
+ <v-container>
3
+ <v-row>
4
+ <v-col cols="12">
5
+ <h2>boilerplate generator</h2>
6
+ <p>Generates datatable pages and forms to edit/create resources</p>
7
+ </v-col>
8
+ <v-col cols="6">
9
+ <v-text-field
10
+ :value="projectFolderName"
11
+ persistent-hint
12
+ filled
13
+ append-icon="mdi-folder-arrow-down-outline"
14
+ placeholder="Select project folder"
15
+ hint="Will write files in this folder"
16
+ @click="selectProjectFolder"
17
+ />
18
+ </v-col>
19
+ <v-col cols="3">
20
+ <v-text-field
21
+ v-model="resourceName"
22
+ hide-details
23
+ filled
24
+ label="Resource name"
25
+ />
26
+ </v-col>
27
+
28
+ <v-col cols="3">
29
+ <v-btn
30
+ size="x-large"
31
+ block
32
+ color="primary"
33
+ @click="emit"
34
+ >
35
+ Select fields
36
+ </v-btn>
37
+ </v-col>
38
+ </v-row>
39
+ <v-card
40
+ class="mt-8"
41
+ outlined
42
+ >
43
+ <v-container>
44
+ <h3>Route (<code>{{ prefix }}{{ part }}</code>)</h3>
45
+ <v-row class="mt-1">
46
+ <v-col cols="3">
47
+ <v-text-field
48
+ v-model="prefix"
49
+ persistent-hint
50
+ hint="e.g. /admin/"
51
+ filled
52
+ label="Prefix"
53
+ />
54
+ </v-col>
55
+ <v-col>
56
+ <v-text-field
57
+ v-model="part"
58
+ persistent-hint
59
+ filled
60
+ hint="page name for the resource"
61
+ label="Page name"
62
+ />
63
+ </v-col>
64
+ </v-row>
65
+ </v-container>
66
+ </v-card>
67
+ <v-card
68
+ class="mt-8"
69
+ outlined
70
+ >
71
+ <v-container>
72
+ <h3>Edit/create template</h3>
73
+ <v-radio-group v-model="editMode">
74
+ <v-radio
75
+ label="FormWrapper"
76
+ value="form-wrapper"
77
+ />
78
+ <v-radio
79
+ label="Dedicated page ([id].vue)"
80
+ value="page"
81
+ />
82
+ <v-radio
83
+ label="None"
84
+ value="none"
85
+ />
86
+ </v-radio-group>
87
+ </v-container>
88
+ </v-card>
89
+ <v-card
90
+ class="mt-8"
91
+ outlined
92
+ >
93
+ <v-container>
94
+ <h3>i18n</h3>
95
+ <v-radio-group v-model="i18n">
96
+ <v-radio
97
+ label="flat"
98
+ value="flat"
99
+ />
100
+ <v-radio
101
+ label="nested"
102
+ value="nested"
103
+ />
104
+ <v-radio
105
+ label="none"
106
+ value=""
107
+ />
108
+ </v-radio-group>
109
+ </v-container>
110
+ </v-card>
111
+ </v-container>
112
+ </template>
113
+
114
+ <script>
115
+ import { cleanResourceName } from "../code";
116
+ export default {
117
+ emits: ["load"],
118
+ data: () => ({
119
+ resourceName: "users",
120
+ prefix: "/",
121
+ editMode: "form-wrapper",
122
+ layout: "default",
123
+ part: "user",
124
+ i18n: "flat"
125
+ }),
126
+ computed: {
127
+ projectFolderName() {
128
+ return this.$fs.rootHandle.value?.name;
129
+ }
130
+ },
131
+ watch: {
132
+ resourceName: {
133
+ handler(val) {
134
+ this.part = cleanResourceName(val);
135
+ }
136
+ }
137
+ },
138
+ methods: {
139
+ selectProjectFolder() {
140
+ this.$fs.showDirectoryPicker().catch((e) => console.error(e));
141
+ },
142
+ emit() {
143
+ this.$emit("load", {
144
+ resourceName: this.resourceName,
145
+ part: this.part,
146
+ prefix: this.prefix,
147
+ editMode: this.editMode,
148
+ layout: this.layout,
149
+ i18n: this.i18n
150
+ });
151
+ }
152
+ }
153
+ };
154
+ </script>
@@ -0,0 +1,16 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {
2
+ resourceName: string;
3
+ prefix: string;
4
+ editMode: string;
5
+ layout: string;
6
+ part: string;
7
+ i18n: string;
8
+ }, {
9
+ projectFolderName(): any;
10
+ }, {
11
+ selectProjectFolder(): void;
12
+ emit(): void;
13
+ }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "load"[], "load", import("vue").PublicProps, Readonly<{}> & Readonly<{
14
+ onLoad?: ((...args: any[]) => any) | undefined;
15
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
16
+ export default _default;
@@ -0,0 +1,50 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {
2
+ tab: null;
3
+ tabs: never[];
4
+ fields: never[];
5
+ dialog: boolean;
6
+ fieldBlacklist: string[];
7
+ fieldPaginate: string[];
8
+ wroteFiles: boolean;
9
+ showHiddenFields: boolean;
10
+ configuration: {};
11
+ }, {
12
+ resourceName(): any;
13
+ prefix(): any;
14
+ editMode(): any;
15
+ part(): any;
16
+ }, {
17
+ load(configuration: any): Promise<void>;
18
+ writeFiles(): Promise<void>;
19
+ generate(): Promise<void>;
20
+ }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {
21
+ Configuration: import("vue").DefineComponent<{}, {}, {
22
+ resourceName: string;
23
+ prefix: string;
24
+ editMode: string;
25
+ layout: string;
26
+ part: string;
27
+ i18n: string;
28
+ }, {
29
+ projectFolderName(): any;
30
+ }, {
31
+ selectProjectFolder(): void;
32
+ emit(): void;
33
+ }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "load"[], "load", import("vue").PublicProps, Readonly<{}> & Readonly<{
34
+ onLoad?: ((...args: any[]) => any) | undefined;
35
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
36
+ CodeSnippet: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
37
+ code: {
38
+ type: StringConstructor;
39
+ required: true;
40
+ };
41
+ }>, {}, {}, {}, {
42
+ copy(): Promise<void>;
43
+ }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
44
+ code: {
45
+ type: StringConstructor;
46
+ required: true;
47
+ };
48
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
49
+ }, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
50
+ export default _default;
@@ -0,0 +1,226 @@
1
+ <template>
2
+ <v-container fluid>
3
+ <configuration @load="load" />
4
+ <v-row
5
+ v-if="tabs.length"
6
+ >
7
+ <v-col
8
+ class="mt-6 d-flex"
9
+ cols="12"
10
+ >
11
+ <v-btn
12
+ class="ml-auto"
13
+ color="success"
14
+ light
15
+ @click="writeFiles"
16
+ >
17
+ Write files <v-icon
18
+ v-if="wroteFiles"
19
+ color="green"
20
+ end
21
+ >
22
+ mdi-content-save-check
23
+ </v-icon> <v-icon
24
+ v-else
25
+ end
26
+ >
27
+ mdi-content-save
28
+ </v-icon>
29
+ </v-btn>
30
+ </v-col>
31
+ <v-col cols="12">
32
+ <v-card>
33
+ <v-tabs
34
+ v-model="tab"
35
+ dark
36
+ grow
37
+ >
38
+ <v-tab
39
+ v-for="(item, i) in tabs"
40
+ :key="i"
41
+ :value="item"
42
+ >
43
+ {{ item.name }}
44
+ </v-tab>
45
+ </v-tabs>
46
+
47
+ <v-tabs-window v-model="tab">
48
+ <v-tabs-window-item
49
+ v-for="(item, i) in tabs"
50
+ :key="i"
51
+ :value="item"
52
+ >
53
+ <code-snippet :code="item.code" />
54
+ </v-tabs-window-item>
55
+ </v-tabs-window>
56
+ </v-card>
57
+ </v-col>
58
+ </v-row>
59
+ <v-dialog
60
+ v-model="dialog"
61
+ scrollable
62
+ max-width="1500"
63
+ >
64
+ <v-card height="50vh">
65
+ <v-card-title class="d-flex justify-space-between">
66
+ Select fields
67
+
68
+ <v-btn
69
+ icon
70
+ @click="dialog = false"
71
+ >
72
+ <v-icon>mdi-close</v-icon>
73
+ </v-btn>
74
+ </v-card-title>
75
+ <v-card-subtitle>
76
+ <v-switch
77
+ v-model="showHiddenFields"
78
+ hide-details
79
+ label="Show hidden fields"
80
+ />
81
+ </v-card-subtitle>
82
+ <v-card-text
83
+ class="fields-grid"
84
+ >
85
+ <template v-for="(f, i) in fields">
86
+ <v-card
87
+ v-if="showHiddenFields || !fieldBlacklist.includes(f.name)"
88
+ :key="i"
89
+ outlined
90
+ class="pa-4 h-100"
91
+ >
92
+ <div class="d-flex">
93
+ <v-checkbox
94
+ v-model="f.use"
95
+ class="mt-0 font-weight-bold"
96
+ hide-details
97
+ :label="`${f.name} (${f.type})`"
98
+ />
99
+ <span
100
+ v-if="f.notnull"
101
+ class="mandatory"
102
+ >*</span>
103
+ </div>
104
+ <v-switch
105
+ v-model="f.paginate"
106
+ :disabled="!f.foreignKeys"
107
+ hide-details
108
+ label="paginate"
109
+ />
110
+ </v-card>
111
+ </template>
112
+ </v-card-text>
113
+ <v-card-actions @click="generate">
114
+ <v-btn
115
+ color="primary"
116
+ block
117
+ size="x-large"
118
+ >
119
+ Generate
120
+ </v-btn>
121
+ </v-card-actions>
122
+ </v-card>
123
+ </v-dialog>
124
+ </v-container>
125
+ </template>
126
+
127
+ <script>
128
+ import generator from "../code";
129
+ import CodeSnippet from "./CodeSnippet.vue";
130
+ import Configuration from "./Configuration.vue";
131
+ export default {
132
+ components: {
133
+ Configuration,
134
+ CodeSnippet
135
+ },
136
+ data: () => ({
137
+ tab: null,
138
+ tabs: [],
139
+ fields: [],
140
+ dialog: false,
141
+ fieldBlacklist: [
142
+ "id",
143
+ "deleted_user_id",
144
+ "created_user_id",
145
+ "updated_user_id",
146
+ "deleted_at",
147
+ "created_at",
148
+ "updated_at"
149
+ ],
150
+ fieldPaginate: [
151
+ "user_id"
152
+ ],
153
+ wroteFiles: false,
154
+ showHiddenFields: false,
155
+ configuration: {}
156
+ }),
157
+ computed: {
158
+ resourceName() {
159
+ return this.configuration?.resourceName;
160
+ },
161
+ prefix() {
162
+ return this.configuration?.prefix;
163
+ },
164
+ editMode() {
165
+ return this.configuration?.editMode;
166
+ },
167
+ part() {
168
+ return this.configuration?.part;
169
+ }
170
+ },
171
+ methods: {
172
+ async load(configuration) {
173
+ this.configuration = configuration;
174
+ this.wroteFiles = false;
175
+ try {
176
+ const url = `/datatables/fields/${this.resourceName}`;
177
+ this.fields = await this.$api.get(url);
178
+ this.fields = this.fields.map((f) => ({
179
+ ...f,
180
+ fk_name: f.foreignKeys ? f.name.replaceAll("_id", "") : null,
181
+ use: !this.fieldBlacklist.includes(f.name),
182
+ paginate: this.fieldPaginate.includes(f.name)
183
+ }));
184
+ this.dialog = true;
185
+ } catch (e) {
186
+ this.$notify.error(e);
187
+ console.error(e);
188
+ }
189
+ },
190
+ async writeFiles() {
191
+ try {
192
+ await Promise.all(this.tabs.map(async (t) => {
193
+ if (t.mode === "write") {
194
+ await this.$fs.writeFile(t.name, t.code);
195
+ } else if (t.mode === "append-json") {
196
+ await this.$fs.appendJson(t.name, JSON.parse(t.code));
197
+ }
198
+ }));
199
+ this.wroteFiles = true;
200
+ } catch (e) {
201
+ this.$notify.error(e);
202
+ console.error(e);
203
+ }
204
+ },
205
+ async generate() {
206
+ this.dialog = false;
207
+ const fields = this.fields.filter((f) => f.use);
208
+ const conf = {
209
+ ...this.configuration,
210
+ part: this.part,
211
+ resourceName: this.resourceName,
212
+ prefix: this.prefix,
213
+ editMode: this.editMode
214
+ };
215
+ this.tabs = generator(fields, conf);
216
+ if (this.$fs.rootHandle.value || confirm("Vuoi scrivere i file?")) {
217
+ this.writeFiles();
218
+ }
219
+ }
220
+ }
221
+ };
222
+ </script>
223
+
224
+ <style scoped>
225
+ .v-tab{text-transform:unset!important}.fields-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));grid-gap:10px}.mandatory{color:red;font-size:1.2rem;font-weight:700}
226
+ </style>
@@ -0,0 +1,50 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {
2
+ tab: null;
3
+ tabs: never[];
4
+ fields: never[];
5
+ dialog: boolean;
6
+ fieldBlacklist: string[];
7
+ fieldPaginate: string[];
8
+ wroteFiles: boolean;
9
+ showHiddenFields: boolean;
10
+ configuration: {};
11
+ }, {
12
+ resourceName(): any;
13
+ prefix(): any;
14
+ editMode(): any;
15
+ part(): any;
16
+ }, {
17
+ load(configuration: any): Promise<void>;
18
+ writeFiles(): Promise<void>;
19
+ generate(): Promise<void>;
20
+ }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {
21
+ Configuration: import("vue").DefineComponent<{}, {}, {
22
+ resourceName: string;
23
+ prefix: string;
24
+ editMode: string;
25
+ layout: string;
26
+ part: string;
27
+ i18n: string;
28
+ }, {
29
+ projectFolderName(): any;
30
+ }, {
31
+ selectProjectFolder(): void;
32
+ emit(): void;
33
+ }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "load"[], "load", import("vue").PublicProps, Readonly<{}> & Readonly<{
34
+ onLoad?: ((...args: any[]) => any) | undefined;
35
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
36
+ CodeSnippet: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
37
+ code: {
38
+ type: StringConstructor;
39
+ required: true;
40
+ };
41
+ }>, {}, {}, {}, {
42
+ copy(): Promise<void>;
43
+ }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
44
+ code: {
45
+ type: StringConstructor;
46
+ required: true;
47
+ };
48
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
49
+ }, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
50
+ export default _default;
@@ -0,0 +1,16 @@
1
+ declare const _default: import("#app").Plugin<{
2
+ fs: {
3
+ rootHandle: import("vue").Ref<null, null>;
4
+ showDirectoryPicker: () => Promise<null>;
5
+ writeFile: (path: any, content: any, overwrite?: boolean) => Promise<void>;
6
+ appendJson: (path: any, content: any) => Promise<void>;
7
+ };
8
+ }> & import("#app").ObjectPlugin<{
9
+ fs: {
10
+ rootHandle: import("vue").Ref<null, null>;
11
+ showDirectoryPicker: () => Promise<null>;
12
+ writeFile: (path: any, content: any, overwrite?: boolean) => Promise<void>;
13
+ appendJson: (path: any, content: any) => Promise<void>;
14
+ };
15
+ }>;
16
+ export default _default;
@@ -0,0 +1,79 @@
1
+ import { defineNuxtPlugin } from '#app'
2
+ import { computed, ref } from 'vue'
3
+
4
+ export default defineNuxtPlugin((nuxtApp) => {
5
+ const rootHandle = ref(null)
6
+ const hasRootHandle = computed(() => rootHandle.value !== null)
7
+
8
+ const showDirectoryPicker = async () => {
9
+ rootHandle.value = await window.showDirectoryPicker().catch(() => null)
10
+ return rootHandle.value
11
+ }
12
+
13
+ const getDirectoryHandle = async (dirs) => {
14
+ let handle = rootHandle.value
15
+ for (const d of dirs) {
16
+ handle = await handle.getDirectoryHandle(d, { create: true })
17
+ }
18
+ return handle
19
+ }
20
+
21
+ const getFileHandle = async (path, options = { create: false }) => {
22
+ if (!hasRootHandle.value) {
23
+ await showDirectoryPicker()
24
+ }
25
+ const [dirs, name] = parsePath(path)
26
+ const directoryHandle = await getDirectoryHandle(dirs)
27
+ return await directoryHandle.getFileHandle(name, options)
28
+ }
29
+
30
+ const parsePath = (path) => {
31
+ const s = path.split('/')
32
+ const dirs = s.slice(0, -1)
33
+ const name = s.at(-1)
34
+ return [dirs, name]
35
+ }
36
+
37
+ const readFile = async (path) => {
38
+ const fileHandle = await getFileHandle(path)
39
+ const file = await fileHandle.getFile()
40
+ return await file.text()
41
+ }
42
+
43
+ const fileExists = async (path) => {
44
+ return getFileHandle(path).then(() => true).catch(() => false)
45
+ }
46
+
47
+ const appendJson = async (path, content) => {
48
+ const originalContent = await readFile(path).catch(() => '{}')
49
+ const newContent = JSON.stringify({ ...JSON.parse(originalContent), ...content }, null, 2)
50
+ await writeFile(path, newContent, true)
51
+ }
52
+
53
+ const writeFile = async (path, content, overwrite = false) => {
54
+ // if (!overwrite) {
55
+ // const exists = await fileExists(path)
56
+
57
+ // if (exists && !confirm(`Il file ${path} esiste già, vuoi sovrascriverlo?`)) { return }
58
+ // overwrite = true
59
+ // }
60
+
61
+ overwrite = true
62
+
63
+ const fileHandle = await getFileHandle(path, { create: overwrite })
64
+ const writable = await fileHandle.createWritable()
65
+ await writable.write(content)
66
+ await writable.close()
67
+ }
68
+
69
+ return {
70
+ provide: {
71
+ fs: {
72
+ rootHandle,
73
+ showDirectoryPicker,
74
+ writeFile,
75
+ appendJson,
76
+ },
77
+ },
78
+ }
79
+ })