@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,199 @@
1
+ <script setup>
2
+ import { computed, ref } from "vue";
3
+ import { useFormLock } from "../../composables/useFormLock";
4
+ import { textColorOn } from "../../utils/color";
5
+ const props = defineProps({
6
+ colors: {
7
+ type: Array,
8
+ required: false,
9
+ default: () => []
10
+ },
11
+ modelValue: {
12
+ type: String,
13
+ required: false,
14
+ default: void 0
15
+ },
16
+ maxWidth: {
17
+ type: [String, Number],
18
+ default: 300
19
+ },
20
+ hideCustomColors: {
21
+ type: Boolean,
22
+ default: false
23
+ },
24
+ readonly: {
25
+ type: Boolean,
26
+ default: null
27
+ },
28
+ disabled: {
29
+ type: Boolean,
30
+ default: null
31
+ }
32
+ });
33
+ const emit = defineEmits(["update:modelValue"]);
34
+ const { isReadonly, isDisabled } = useFormLock(props);
35
+ const systemColors = ref([
36
+ // Light colors
37
+ "#FFB3BA",
38
+ "#FFD580",
39
+ "#FFFFBA",
40
+ "#B3FFB3",
41
+ "#B3FFFF",
42
+ "#B3B3FF",
43
+ "#E2B3FF",
44
+ "#FFCCE5",
45
+ "#FFDFBA",
46
+ "#D1FFCC",
47
+ "#FFC8A2",
48
+ "#F5E6CC",
49
+ "#C5E1A5",
50
+ "#A5D8FF",
51
+ "#FFB5E8",
52
+ "#D4A5FF",
53
+ "#FFD1B3",
54
+ "#B2EBF2",
55
+ "#F5CBA7",
56
+ // Dark colors
57
+ "#212121",
58
+ "#424242",
59
+ "#616161",
60
+ "#263238",
61
+ "#37474F",
62
+ "#1A237E",
63
+ "#311B92",
64
+ "#004D40",
65
+ "#00695C",
66
+ "#880E4F",
67
+ "#B71C1C",
68
+ "#BF360C",
69
+ "#3E2723",
70
+ "#263238"
71
+ ]);
72
+ const useCustomColors = ref(false);
73
+ const menu = ref(false);
74
+ const color = ref(null);
75
+ const selectedColors = computed(() => props.colors?.length > 0 ? props.colors : systemColors.value);
76
+ function selectColor(selectColor2) {
77
+ emitValue(selectColor2);
78
+ menu.value = false;
79
+ }
80
+ function toggleUseCustomColors() {
81
+ useCustomColors.value = !useCustomColors.value;
82
+ if (!useCustomColors.value && !selectedColors.value.includes(props.modelValue)) {
83
+ emitValue(null);
84
+ } else {
85
+ color.value = props.modelValue;
86
+ }
87
+ }
88
+ function confirm() {
89
+ emitValue(color.value?.hex ?? color.value);
90
+ menu.value = false;
91
+ }
92
+ function emitValue(val) {
93
+ emit("update:modelValue", val);
94
+ }
95
+ </script>
96
+
97
+ <template>
98
+ <div class="d-flex align-start">
99
+ <v-menu
100
+ v-model="menu"
101
+ readonly
102
+ open-on-click
103
+ :disabled="isReadonly || isDisabled"
104
+ :close-on-content-click="false"
105
+ >
106
+ <template #activator="{ props: activatorProps }">
107
+ <v-text-field
108
+ :model-value="modelValue"
109
+ v-bind="{ ...activatorProps, ...$attrs }"
110
+ :readonly="isReadonly"
111
+ :disabled="isDisabled"
112
+ @update:model-value="emitValue"
113
+ >
114
+ <template #prepend-inner>
115
+ <v-icon
116
+ v-if="modelValue"
117
+ :color="modelValue"
118
+ icon="$delimiter"
119
+ />
120
+ <v-icon v-else icon="$color" />
121
+ </template>
122
+ </v-text-field>
123
+ </template>
124
+ <v-card :style="`max-width: ${maxWidth}px`">
125
+ <v-card-text
126
+ v-if="!useCustomColors"
127
+ class="d-flex flex-wrap"
128
+ style="gap: 1em"
129
+ >
130
+ <v-avatar
131
+ v-for="c in selectedColors"
132
+ :key="c"
133
+ :color="c"
134
+ class="color-dot"
135
+ size="40"
136
+ @click="selectColor(c)"
137
+ >
138
+ <v-icon
139
+ v-if="c === modelValue"
140
+ :color="textColorOn(c)"
141
+ icon="$complete"
142
+ />
143
+ </v-avatar>
144
+
145
+ <v-btn
146
+ v-if="!hideCustomColors"
147
+ icon
148
+ class="mr-1"
149
+ variant="tonal"
150
+ size="small"
151
+ :elevation="0"
152
+ rounded="lg"
153
+ @click="toggleUseCustomColors"
154
+ >
155
+ <v-icon
156
+ icon="$eyeDropper"
157
+ />
158
+ </v-btn>
159
+ </v-card-text>
160
+ <div v-else>
161
+ <v-card-text class="pb-0 d-flex justify-center">
162
+ <v-color-picker
163
+ v-model="color"
164
+ class="px-4"
165
+ style="box-shadow: none;"
166
+ @change="emitValue"
167
+ />
168
+ </v-card-text>
169
+ <div class="d-flex justify-end">
170
+ <div class="px-4 pb-2">
171
+ <v-btn
172
+ icon="$color"
173
+ rounded="lg"
174
+ size="small"
175
+ class="mr-2 px-0"
176
+ variant="tonal"
177
+ :elevation="0"
178
+ @click="toggleUseCustomColors"
179
+ />
180
+ <v-btn
181
+ color="primary"
182
+ variant="flat"
183
+ rounded="lg"
184
+ :elevation="0"
185
+ @click="confirm"
186
+ >
187
+ {{ $t('save') }}
188
+ </v-btn>
189
+ </div>
190
+ </div>
191
+ </div>
192
+ </v-card>
193
+ </v-menu>
194
+ </div>
195
+ </template>
196
+
197
+ <style>
198
+ .color-dot{cursor:pointer}
199
+ </style>
@@ -0,0 +1,11 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {
2
+ $emit: (event: "update:modelValue", ...args: any[]) => void;
3
+ readonly: boolean;
4
+ disabled: boolean;
5
+ colors: unknown[];
6
+ maxWidth: string | number;
7
+ hideCustomColors: boolean;
8
+ modelValue?: string | undefined;
9
+ $props: any;
10
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
11
+ export default _default;
@@ -0,0 +1,104 @@
1
+ declare const props: {
2
+ readonly type: string;
3
+ readonly maxWidth: string | number;
4
+ readonly text?: string | undefined;
5
+ readonly title?: string | undefined;
6
+ readonly color?: string | undefined;
7
+ readonly confirmButtonText?: string | undefined;
8
+ readonly cancelButtonText?: string | undefined;
9
+ readonly icon?: string | undefined;
10
+ };
11
+ declare function confirm(overrideValues?: Partial<typeof props>): Promise<boolean>;
12
+ declare var __VLS_6: any, __VLS_12: any, __VLS_18: any;
13
+ type __VLS_Slots = {} & {
14
+ content?: (props: typeof __VLS_6) => any;
15
+ } & {
16
+ default?: (props: typeof __VLS_12) => any;
17
+ } & {
18
+ actions?: (props: typeof __VLS_18) => any;
19
+ };
20
+ declare const __VLS_component: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
21
+ title: {
22
+ type: StringConstructor;
23
+ default: undefined;
24
+ };
25
+ text: {
26
+ type: StringConstructor;
27
+ default: undefined;
28
+ };
29
+ confirmButtonText: {
30
+ type: StringConstructor;
31
+ default: undefined;
32
+ };
33
+ cancelButtonText: {
34
+ type: StringConstructor;
35
+ default: undefined;
36
+ };
37
+ type: {
38
+ type: StringConstructor;
39
+ default: string;
40
+ };
41
+ icon: {
42
+ type: StringConstructor;
43
+ default: undefined;
44
+ };
45
+ color: {
46
+ type: StringConstructor;
47
+ default: undefined;
48
+ };
49
+ maxWidth: {
50
+ type: (NumberConstructor | StringConstructor)[];
51
+ default: number;
52
+ };
53
+ }>, {
54
+ confirm: typeof confirm;
55
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
56
+ title: {
57
+ type: StringConstructor;
58
+ default: undefined;
59
+ };
60
+ text: {
61
+ type: StringConstructor;
62
+ default: undefined;
63
+ };
64
+ confirmButtonText: {
65
+ type: StringConstructor;
66
+ default: undefined;
67
+ };
68
+ cancelButtonText: {
69
+ type: StringConstructor;
70
+ default: undefined;
71
+ };
72
+ type: {
73
+ type: StringConstructor;
74
+ default: string;
75
+ };
76
+ icon: {
77
+ type: StringConstructor;
78
+ default: undefined;
79
+ };
80
+ color: {
81
+ type: StringConstructor;
82
+ default: undefined;
83
+ };
84
+ maxWidth: {
85
+ type: (NumberConstructor | StringConstructor)[];
86
+ default: number;
87
+ };
88
+ }>> & Readonly<{}>, {
89
+ text: string;
90
+ type: string;
91
+ title: string;
92
+ maxWidth: string | number;
93
+ color: string;
94
+ confirmButtonText: string;
95
+ cancelButtonText: string;
96
+ icon: string;
97
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
98
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
99
+ export default _default;
100
+ type __VLS_WithSlots<T, S> = T & {
101
+ new (): {
102
+ $slots: S;
103
+ };
104
+ };
@@ -0,0 +1,143 @@
1
+ <script setup>
2
+ import defu from "defu";
3
+ import { computed, ref } from "vue";
4
+ import { useI18n } from "vue-i18n";
5
+ const props = defineProps({
6
+ title: {
7
+ type: String,
8
+ default: void 0
9
+ },
10
+ text: {
11
+ type: String,
12
+ default: void 0
13
+ },
14
+ confirmButtonText: {
15
+ type: String,
16
+ default: void 0
17
+ },
18
+ cancelButtonText: {
19
+ type: String,
20
+ default: void 0
21
+ },
22
+ type: {
23
+ type: String,
24
+ default: "confirm"
25
+ },
26
+ icon: {
27
+ type: String,
28
+ default: void 0
29
+ },
30
+ color: {
31
+ type: String,
32
+ default: void 0
33
+ },
34
+ maxWidth: {
35
+ type: [Number, String],
36
+ default: 400
37
+ }
38
+ });
39
+ const { t } = useI18n();
40
+ const overrides = ref(void 0);
41
+ const dialogConfirm = ref(false);
42
+ const responsePromiseResolve = ref();
43
+ const defaults = computed(() => {
44
+ switch (props.type) {
45
+ case "delete":
46
+ return {
47
+ title: t("weConfirmDialog.delete.title"),
48
+ text: t("weConfirmDialog.delete.text"),
49
+ icon: "$trash",
50
+ confirmButtonText: t("weConfirmDialog.delete.confirmButtonText"),
51
+ cancelButtonText: t("weConfirmDialog.delete.cancelButtonText"),
52
+ color: "error"
53
+ };
54
+ case "custom":
55
+ return {
56
+ title: void 0,
57
+ text: void 0,
58
+ icon: void 0,
59
+ confirmButtonText: t("weConfirmDialog.custom.confirmButtonText"),
60
+ cancelButtonText: t("weConfirmDialog.custom.cancelButtonText"),
61
+ color: void 0
62
+ };
63
+ case "confirm":
64
+ default:
65
+ return {
66
+ title: t("weConfirmDialog.confirm.title"),
67
+ text: t("weConfirmDialog.confirm.text"),
68
+ icon: "$success",
69
+ confirmButtonText: t("weConfirmDialog.confirm.confirmButtonText"),
70
+ cancelButtonText: t("weConfirmDialog.confirm.cancelButtonText"),
71
+ color: "primary"
72
+ };
73
+ }
74
+ });
75
+ const values = computed(() => {
76
+ return defu(overrides.value, props, defaults.value);
77
+ });
78
+ const btnColor = computed(() => values.value.color || "error");
79
+ const slotAttrs = computed(() => {
80
+ return {
81
+ resolve
82
+ };
83
+ });
84
+ function confirm(overrideValues) {
85
+ overrides.value = overrideValues;
86
+ dialogConfirm.value = true;
87
+ return new Promise((resolve2, _reject) => {
88
+ responsePromiseResolve.value = resolve2;
89
+ });
90
+ }
91
+ function resolve(val) {
92
+ if (responsePromiseResolve.value) {
93
+ responsePromiseResolve.value(val);
94
+ }
95
+ dialogConfirm.value = false;
96
+ }
97
+ defineExpose({
98
+ confirm
99
+ });
100
+ </script>
101
+
102
+ <template>
103
+ <v-dialog
104
+ v-model="dialogConfirm"
105
+ :max-width="props.maxWidth"
106
+ persistent
107
+ >
108
+ <slot
109
+ name="content"
110
+ v-bind="slotAttrs"
111
+ >
112
+ <v-card
113
+ :title="values.title ?? void 0"
114
+ :text="values.text ?? void 0"
115
+ >
116
+ <slot v-bind="slotAttrs" />
117
+
118
+ <v-card-actions class="justify-end">
119
+ <slot
120
+ name="actions"
121
+ v-bind="slotAttrs"
122
+ >
123
+ <v-btn
124
+ variant="text"
125
+ class="mr-2"
126
+ @click="resolve(false)"
127
+ >
128
+ {{ values.cancelButtonText }}
129
+ </v-btn>
130
+ <v-btn
131
+ variant="tonal"
132
+ min-width="92"
133
+ :color="btnColor"
134
+ @click="resolve(true)"
135
+ >
136
+ {{ values.confirmButtonText }}
137
+ </v-btn>
138
+ </slot>
139
+ </v-card-actions>
140
+ </v-card>
141
+ </slot>
142
+ </v-dialog>
143
+ </template>
@@ -0,0 +1,104 @@
1
+ declare const props: {
2
+ readonly type: string;
3
+ readonly maxWidth: string | number;
4
+ readonly text?: string | undefined;
5
+ readonly title?: string | undefined;
6
+ readonly color?: string | undefined;
7
+ readonly confirmButtonText?: string | undefined;
8
+ readonly cancelButtonText?: string | undefined;
9
+ readonly icon?: string | undefined;
10
+ };
11
+ declare function confirm(overrideValues?: Partial<typeof props>): Promise<boolean>;
12
+ declare var __VLS_6: any, __VLS_12: any, __VLS_18: any;
13
+ type __VLS_Slots = {} & {
14
+ content?: (props: typeof __VLS_6) => any;
15
+ } & {
16
+ default?: (props: typeof __VLS_12) => any;
17
+ } & {
18
+ actions?: (props: typeof __VLS_18) => any;
19
+ };
20
+ declare const __VLS_component: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
21
+ title: {
22
+ type: StringConstructor;
23
+ default: undefined;
24
+ };
25
+ text: {
26
+ type: StringConstructor;
27
+ default: undefined;
28
+ };
29
+ confirmButtonText: {
30
+ type: StringConstructor;
31
+ default: undefined;
32
+ };
33
+ cancelButtonText: {
34
+ type: StringConstructor;
35
+ default: undefined;
36
+ };
37
+ type: {
38
+ type: StringConstructor;
39
+ default: string;
40
+ };
41
+ icon: {
42
+ type: StringConstructor;
43
+ default: undefined;
44
+ };
45
+ color: {
46
+ type: StringConstructor;
47
+ default: undefined;
48
+ };
49
+ maxWidth: {
50
+ type: (NumberConstructor | StringConstructor)[];
51
+ default: number;
52
+ };
53
+ }>, {
54
+ confirm: typeof confirm;
55
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
56
+ title: {
57
+ type: StringConstructor;
58
+ default: undefined;
59
+ };
60
+ text: {
61
+ type: StringConstructor;
62
+ default: undefined;
63
+ };
64
+ confirmButtonText: {
65
+ type: StringConstructor;
66
+ default: undefined;
67
+ };
68
+ cancelButtonText: {
69
+ type: StringConstructor;
70
+ default: undefined;
71
+ };
72
+ type: {
73
+ type: StringConstructor;
74
+ default: string;
75
+ };
76
+ icon: {
77
+ type: StringConstructor;
78
+ default: undefined;
79
+ };
80
+ color: {
81
+ type: StringConstructor;
82
+ default: undefined;
83
+ };
84
+ maxWidth: {
85
+ type: (NumberConstructor | StringConstructor)[];
86
+ default: number;
87
+ };
88
+ }>> & Readonly<{}>, {
89
+ text: string;
90
+ type: string;
91
+ title: string;
92
+ maxWidth: string | number;
93
+ color: string;
94
+ confirmButtonText: string;
95
+ cancelButtonText: string;
96
+ icon: string;
97
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
98
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
99
+ export default _default;
100
+ type __VLS_WithSlots<T, S> = T & {
101
+ new (): {
102
+ $slots: S;
103
+ };
104
+ };
@@ -0,0 +1,40 @@
1
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ persistKey: {
3
+ type: StringConstructor;
4
+ default: undefined;
5
+ required: false;
6
+ };
7
+ persist: {
8
+ type: (BooleanConstructor | StringConstructor)[];
9
+ default: undefined;
10
+ required: false;
11
+ };
12
+ persistColumns: {
13
+ type: (BooleanConstructor | StringConstructor)[];
14
+ default: undefined;
15
+ required: false;
16
+ };
17
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
18
+ [key: string]: any;
19
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
20
+ persistKey: {
21
+ type: StringConstructor;
22
+ default: undefined;
23
+ required: false;
24
+ };
25
+ persist: {
26
+ type: (BooleanConstructor | StringConstructor)[];
27
+ default: undefined;
28
+ required: false;
29
+ };
30
+ persistColumns: {
31
+ type: (BooleanConstructor | StringConstructor)[];
32
+ default: undefined;
33
+ required: false;
34
+ };
35
+ }>> & Readonly<{}>, {
36
+ persistKey: string;
37
+ persist: string | boolean;
38
+ persistColumns: string | boolean;
39
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
40
+ export default _default;
@@ -0,0 +1,87 @@
1
+ <script>
2
+ import { useAppConfig, useState } from "#app";
3
+ import { useStorage } from "@vueuse/core";
4
+ import { computed, h, ref } from "vue";
5
+ import WeDatatableInternal from "./DatatableInternal";
6
+ export default {
7
+ props: {
8
+ persistKey: {
9
+ type: String,
10
+ default: void 0,
11
+ required: false
12
+ },
13
+ persist: {
14
+ type: [String, Boolean],
15
+ default: void 0,
16
+ required: false
17
+ },
18
+ // storage delle colonne scelte, separato dal resto dello stato; default `local`
19
+ persistColumns: {
20
+ type: [String, Boolean],
21
+ default: void 0,
22
+ required: false
23
+ }
24
+ },
25
+ setup(props, { attrs, slots, expose, emit }) {
26
+ const configuration = attrs["request-params"]?.configuration;
27
+ const defaultPersistKey = attrs.resource + (configuration ? `-${configuration}` : "");
28
+ const persistKey = props.persistKey ?? defaultPersistKey;
29
+ const appConfig = useAppConfig().we?.datatables;
30
+ const persist = props.persist ?? appConfig?.persist ?? "state";
31
+ const persistColumns = props.persistColumns ?? appConfig?.persistColumns ?? "local";
32
+ const itemsPerPage = appConfig?.itemsPerPage;
33
+ const defaultState = {
34
+ "search": attrs.search ?? "",
35
+ "page": attrs.page ?? 1,
36
+ "filters": attrs.filters ?? {},
37
+ "items-per-page": attrs["items-per-page"] ?? itemsPerPage ?? void 0,
38
+ "sort-by": attrs["sort-by"] ?? []
39
+ };
40
+ const stateFactory = (key, defaults, mode) => {
41
+ switch (mode) {
42
+ case "state":
43
+ return useState(key, () => defaults);
44
+ case "local":
45
+ return useStorage(key, defaults, void 0, { mergeDefaults: true });
46
+ case "session":
47
+ return useStorage(key, defaults, sessionStorage, { mergeDefaults: true });
48
+ default:
49
+ return ref(defaults);
50
+ }
51
+ };
52
+ const states = [
53
+ stateFactory(`we_dt_${persistKey}`, defaultState, persist),
54
+ stateFactory(`we_dt_${persistKey}_columns`, { columns: attrs.columns ?? null }, persistColumns)
55
+ ];
56
+ const dtEl = ref();
57
+ const exposedValues = ["headersMap", "totalItems"];
58
+ const exposed = ["reloadData", "clearSelection", "executeAction", ...exposedValues].reduce((acc, key) => {
59
+ if (exposedValues.includes(key)) {
60
+ acc[key] = computed(() => dtEl.value?.[key]);
61
+ } else {
62
+ acc[key] = (...args) => dtEl.value[key](...args);
63
+ }
64
+ return acc;
65
+ }, {});
66
+ expose(exposed);
67
+ return () => h(
68
+ WeDatatableInternal,
69
+ {
70
+ ...attrs,
71
+ ...states.reduce((acc, state) => {
72
+ for (const key of Object.keys(state.value)) {
73
+ acc[key] = state.value[key];
74
+ acc[`onUpdate:${key}`] = (value) => {
75
+ emit(`update:${key}`, value);
76
+ state.value[key] = value;
77
+ };
78
+ }
79
+ return acc;
80
+ }, {}),
81
+ ref: dtEl
82
+ },
83
+ slots
84
+ );
85
+ }
86
+ };
87
+ </script>