@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,65 @@
1
+ <script>
2
+ import { VChip } from "vuetify/components/VChip";
3
+ export default {
4
+ props: {
5
+ item: Object,
6
+ value: [Object, String, Number, Array],
7
+ field: Object
8
+ },
9
+ computed: {
10
+ dataset() {
11
+ return (this.field?.filter?.type?.dataset || []).reduce(
12
+ (acc, item) => {
13
+ acc[item.value] = item;
14
+ return acc;
15
+ },
16
+ {}
17
+ );
18
+ },
19
+ component() {
20
+ const map = {
21
+ "v-chip": VChip
22
+ };
23
+ const c = this.field.formatter?.component;
24
+ return map[c] ?? "div";
25
+ },
26
+ props() {
27
+ return this.field.formatter?.component_props ?? {};
28
+ },
29
+ values() {
30
+ if (this.value === void 0 || this.value === null) {
31
+ return [];
32
+ }
33
+ const value = Array.isArray(this.value) ? this.value : [this.value];
34
+ return value.map((v) => {
35
+ const props = {
36
+ ...this.props,
37
+ ...this.dataset[v]?.props,
38
+ color: this.dataset[v]?.color
39
+ };
40
+ return {
41
+ value: v,
42
+ text: this.dataset[v]?.text ?? v,
43
+ props
44
+ };
45
+ });
46
+ }
47
+ }
48
+ };
49
+ </script>
50
+
51
+ <template>
52
+ <div
53
+ class="d-flex flex-wrap"
54
+ style="gap:2px"
55
+ >
56
+ <component
57
+ :is="component"
58
+ v-for="v in values"
59
+ :key="v.value"
60
+ v-bind="v.props"
61
+ >
62
+ {{ v.text }}
63
+ </component>
64
+ </div>
65
+ </template>
@@ -0,0 +1,19 @@
1
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ item: ObjectConstructor;
3
+ value: (ObjectConstructor | ArrayConstructor | NumberConstructor | StringConstructor)[];
4
+ field: ObjectConstructor;
5
+ }>, {}, {}, {
6
+ dataset(): any;
7
+ component(): any;
8
+ props(): any;
9
+ values(): {
10
+ value: any;
11
+ text: any;
12
+ props: any;
13
+ }[];
14
+ }, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
15
+ item: ObjectConstructor;
16
+ value: (ObjectConstructor | ArrayConstructor | NumberConstructor | StringConstructor)[];
17
+ field: ObjectConstructor;
18
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
19
+ export default _default;
@@ -0,0 +1,28 @@
1
+ type __VLS_Props = {
2
+ label?: string;
3
+ presetDates?: PresetDateProp[];
4
+ emitRawValue?: boolean;
5
+ withTime?: boolean;
6
+ clearable?: boolean;
7
+ position?: string;
8
+ multiCalendar?: boolean;
9
+ mode?: 'menu' | 'bottom-sheet';
10
+ };
11
+ interface PresetDate {
12
+ label: string;
13
+ value: string[];
14
+ }
15
+ type PresetDateProp = PresetDate;
16
+ interface CompleteFilter {
17
+ operator: 'between';
18
+ value?: string[];
19
+ }
20
+ type __VLS_PublicProps = __VLS_Props & {
21
+ modelValue?: string[] | CompleteFilter | null;
22
+ };
23
+ declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
24
+ "update:modelValue": (value: string[] | CompleteFilter | null | undefined) => any;
25
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
26
+ "onUpdate:modelValue"?: ((value: string[] | CompleteFilter | null | undefined) => any) | undefined;
27
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
28
+ export default _default;
@@ -0,0 +1,140 @@
1
+ <template>
2
+ <WeDtCardFilterContainer v-bind="$attrs">
3
+ <we-date-picker
4
+ v-model="model"
5
+ range
6
+ class="w-100 align-self-stretch"
7
+ :preset-dates="$presetDates"
8
+ :multi-calendars="pickerMultiCalendars"
9
+ :type="withTime ? 'datetime' : 'date'"
10
+ :show-seconds="withTime"
11
+ :start-time="withTime ? startTime : void 0"
12
+ :position="pickerPosition"
13
+ :enable-time-picker="false"
14
+ :title="safeLabel"
15
+ :clearable="clearable"
16
+ :mode="defaulted.mode"
17
+ >
18
+ <template #activator="{ sheet }">
19
+ <v-card-text class="d-flex align-center py-0 h-100">
20
+ <v-icon>
21
+ $calendar
22
+ </v-icon>
23
+ <!-- In bottom-sheet il periodo è testo semplice, "da → a", senza chip né freccia del menu -->
24
+ <span
25
+ v-if="sheet && isSelected"
26
+ class="mx-2 font-weight-bold text-no-wrap text-truncate"
27
+ >
28
+ {{ formatValue(" \u2192 ") }}
29
+ </span>
30
+ <v-chip
31
+ v-else-if="isSelected"
32
+ variant="tonal"
33
+ rounded="lg"
34
+ class="mx-2 font-weight-bold"
35
+ color="primary"
36
+ >
37
+ {{ formatValue(" - ") }}
38
+ </v-chip>
39
+ <span
40
+ v-else
41
+ class="mx-2 text-no-wrap text-truncate"
42
+ >
43
+ {{ safeLabel }}
44
+ </span>
45
+ <v-icon v-if="!sheet">
46
+ $dropdown
47
+ </v-icon>
48
+ <v-spacer />
49
+ <v-icon
50
+ v-if="isSelected && clearable"
51
+ class="ml-2"
52
+ @click.stop.prevent="model = null"
53
+ >
54
+ $clear
55
+ </v-icon>
56
+ </v-card-text>
57
+ </template>
58
+ </we-date-picker>
59
+ </WeDtCardFilterContainer>
60
+ </template>
61
+
62
+ <script setup>
63
+ import { useDateRangePresets, useI18n, useLux } from "#imports";
64
+ import { computed } from "vue";
65
+ import { useDefaults, useDisplay } from "vuetify";
66
+ const { label = null, presetDates = null, emitRawValue = false, withTime = false, clearable = true, position, multiCalendar = void 0, mode } = defineProps({
67
+ label: { type: String, required: false },
68
+ presetDates: { type: Array, required: false },
69
+ emitRawValue: { type: Boolean, required: false },
70
+ withTime: { type: Boolean, required: false },
71
+ clearable: { type: Boolean, required: false },
72
+ position: { type: String, required: false },
73
+ multiCalendar: { type: Boolean, required: false },
74
+ mode: { type: String, required: false }
75
+ });
76
+ const defaulted = useDefaults({ get mode() {
77
+ return mode;
78
+ } }, "WeDtDaterangeFilter");
79
+ const { mobile } = useDisplay();
80
+ const pickerMultiCalendars = computed(() => {
81
+ if (multiCalendar === void 0) {
82
+ return mobile.value ? false : 2;
83
+ }
84
+ return multiCalendar;
85
+ });
86
+ const pickerPosition = computed(() => {
87
+ if (!position) {
88
+ return mobile.value ? "center" : void 0;
89
+ }
90
+ return position;
91
+ });
92
+ const { $lux } = useLux();
93
+ const { t } = useI18n();
94
+ const { defaultPresets, resolvePresets } = useDateRangePresets({ withTime });
95
+ const safeLabel = computed(() => {
96
+ return label ?? t("dt.daterangeFilter.label.default");
97
+ });
98
+ const startTime = computed(() => {
99
+ return [{ hours: 0, minutes: 0, seconds: 0 }, { hours: 23, minutes: 59, seconds: 59 }];
100
+ });
101
+ const filterModel = defineModel({ type: [Array, Object, null] });
102
+ const model = computed({
103
+ get() {
104
+ const v = (typeof filterModel.value === "object" && !Array.isArray(filterModel.value) ? filterModel.value?.value : filterModel.value) || null;
105
+ if (Array.isArray(v) && v.length === 0) {
106
+ return null;
107
+ }
108
+ return v;
109
+ },
110
+ set(val) {
111
+ filterModel.value = emitRawValue || val === null ? val : {
112
+ operator: "between",
113
+ value: val
114
+ };
115
+ }
116
+ });
117
+ const isSelected = computed(() => {
118
+ return model.value !== null && model.value.length === 2;
119
+ });
120
+ const $presetDates = computed(() => {
121
+ if (presetDates) {
122
+ return resolvePresets(presetDates);
123
+ }
124
+ return defaultPresets.value;
125
+ });
126
+ function formatValue(separator) {
127
+ if (!isSelected.value) {
128
+ return null;
129
+ }
130
+ const match = $presetDates.value.find((preset) => {
131
+ return preset.value[0] === model.value?.[0] && preset.value[1] === model.value?.[1];
132
+ });
133
+ if (match) {
134
+ return match.label;
135
+ }
136
+ return model.value?.map((date) => {
137
+ return $lux(date);
138
+ }).join(separator);
139
+ }
140
+ </script>
@@ -0,0 +1,28 @@
1
+ type __VLS_Props = {
2
+ label?: string;
3
+ presetDates?: PresetDateProp[];
4
+ emitRawValue?: boolean;
5
+ withTime?: boolean;
6
+ clearable?: boolean;
7
+ position?: string;
8
+ multiCalendar?: boolean;
9
+ mode?: 'menu' | 'bottom-sheet';
10
+ };
11
+ interface PresetDate {
12
+ label: string;
13
+ value: string[];
14
+ }
15
+ type PresetDateProp = PresetDate;
16
+ interface CompleteFilter {
17
+ operator: 'between';
18
+ value?: string[];
19
+ }
20
+ type __VLS_PublicProps = __VLS_Props & {
21
+ modelValue?: string[] | CompleteFilter | null;
22
+ };
23
+ declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
24
+ "update:modelValue": (value: string[] | CompleteFilter | null | undefined) => any;
25
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
26
+ "onUpdate:modelValue"?: ((value: string[] | CompleteFilter | null | undefined) => any) | undefined;
27
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
28
+ export default _default;
@@ -0,0 +1,7 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {
2
+ $emit: (event: "update:modelValue", ...args: any[]) => void;
3
+ header: Record<string, any>;
4
+ modelValue?: Record<string, any> | undefined;
5
+ $props: any;
6
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
7
+ export default _default;
@@ -0,0 +1,234 @@
1
+ <template>
2
+ <v-menu
3
+ v-model="menu"
4
+ :close-on-content-click="false"
5
+ min-width="290px"
6
+ max-width="290px"
7
+ >
8
+ <template #activator="{ props: activatorProps }">
9
+ <v-chip
10
+ :color="isApplied ? 'primary' : undefined"
11
+ v-bind="activatorProps"
12
+ :prepend-icon="icon"
13
+ >
14
+ {{ header.title }} {{ isApplied ? '✓' : '' }}
15
+ </v-chip>
16
+ </template>
17
+ <!-- campi da 200px (+ pa-2): il min-width di v-menu è limitato alla larghezza del chip (resta per i chip > 290px) -->
18
+ <v-card
19
+ class="pa-2"
20
+ min-width="216"
21
+ >
22
+ <v-select
23
+ v-model="operator"
24
+ :items="operators"
25
+ item-title="label"
26
+ item-value="id"
27
+ hide-details
28
+ variant="solo-filled"
29
+ flat
30
+ density="compact"
31
+ />
32
+
33
+ <div
34
+ v-if="multipleTextValues"
35
+ class="pt-2 d-flex flex-column ga-2 overflow-y-auto"
36
+ style="max-height: 300px"
37
+ >
38
+ <v-text-field
39
+ v-for="(_, index) in value"
40
+ :key="index"
41
+ :model-value="value[index]"
42
+ :autofocus="index === 0"
43
+ hide-details
44
+ flat
45
+ :label="$t('dt.filter.value')"
46
+ @update:model-value="v => value = withEmptyLast(value.with(index, v))"
47
+ @keydown.enter="apply"
48
+ >
49
+ <!-- l'ultimo campo (sempre vuoto) non si elimina; fuori dal tab, che passa da campo a campo -->
50
+ <template v-if="index < value.length - 1" #append-inner>
51
+ <v-btn
52
+ icon="mdi-close"
53
+ variant="text"
54
+ size="x-small"
55
+ tabindex="-1"
56
+ @click="value = withEmptyLast(value.toSpliced(index, 1))"
57
+ />
58
+ </template>
59
+ </v-text-field>
60
+ </div>
61
+ <component
62
+ :is="component"
63
+ v-else-if="!noField"
64
+ v-model="value"
65
+ class="mt-2"
66
+ autofocus
67
+ hide-details
68
+ flat
69
+ :label="$t('dt.filter.value')"
70
+ :clear-on-select="component === VAutocomplete || undefined"
71
+ v-bind="componentProps"
72
+ @keyup.enter="apply"
73
+ />
74
+ <!-- mousedown.prevent: il focus resta nel campo, così l'autocomplete non si accorcia
75
+ (blur) spostando i bottoni sotto il puntatore prima del click -->
76
+ <div class="mt-2 d-flex justify-end">
77
+ <v-btn
78
+ variant="text"
79
+ class="mr-2"
80
+ @mousedown.prevent
81
+ @click="clear"
82
+ >
83
+ {{ $t('dt.filter.clear') }}
84
+ </v-btn>
85
+ <v-btn
86
+ variant="tonal"
87
+ color="primary"
88
+ @mousedown.prevent
89
+ @click="apply"
90
+ @keydown.enter.prevent.stop="apply"
91
+ >
92
+ {{ $t('dt.filter.apply') }}
93
+ </v-btn>
94
+ </div>
95
+ </v-card>
96
+ </v-menu>
97
+ </template>
98
+
99
+ <script setup>
100
+ import { computed, ref, toRef, watch } from "vue";
101
+ import { VAutocomplete, VTextField } from "vuetify/components";
102
+ import { cleanMultipleValues, isFilterComplete, multipleFieldOperator, noFieldsOperator, rangeOperator, toMultipleValues, withEmptyLast } from "../../../internals/dt";
103
+ import WeDatePicker from "../DatePicker";
104
+ import WeDtChipGroupSelect from "./ChipGroupSelect";
105
+ const props = defineProps({
106
+ header: {
107
+ type: Object,
108
+ required: true
109
+ },
110
+ modelValue: {
111
+ type: Object,
112
+ required: false
113
+ }
114
+ });
115
+ const emit = defineEmits(["update:modelValue"]);
116
+ const header = toRef(props, "header");
117
+ const modelValue = toRef(props, "modelValue");
118
+ const operator = ref();
119
+ const value = ref();
120
+ const menu = ref(false);
121
+ const filter = computed(() => {
122
+ return header.value.filter;
123
+ });
124
+ const operators = computed(() => {
125
+ return filter.value.operators;
126
+ });
127
+ const multiple = computed(() => {
128
+ return multipleFieldOperator(operator.value);
129
+ });
130
+ const noField = computed(() => {
131
+ return noFieldsOperator(operator.value);
132
+ });
133
+ const type = computed(() => {
134
+ const { value: value2, dataset, autocomplete } = filter.value?.type ?? {};
135
+ if (autocomplete) {
136
+ return "autocomplete";
137
+ }
138
+ if (dataset) {
139
+ return "select";
140
+ }
141
+ return value2;
142
+ });
143
+ const defaultOperator = computed(() => {
144
+ const between = ["date", "datetime", "time"].includes(type.value) && operators.value.find((o) => o.id === "between");
145
+ return (between || operators.value[0]).id;
146
+ });
147
+ const multipleTextValues = computed(() => {
148
+ return multiple.value && !["select", "autocomplete", "date", "datetime", "time"].includes(type.value);
149
+ });
150
+ const componentProps = computed(() => {
151
+ switch (type.value) {
152
+ case "select":
153
+ return {
154
+ items: filter.value?.type?.dataset ?? [],
155
+ itemTitle: "text",
156
+ itemValue: "value",
157
+ multiple: multiple.value,
158
+ chips: true,
159
+ closableChips: true
160
+ };
161
+ case "date":
162
+ case "datetime":
163
+ case "time":
164
+ return {
165
+ range: rangeOperator(operator.value),
166
+ multiDates: multiple.value,
167
+ inline: true,
168
+ type: type.value
169
+ };
170
+ }
171
+ return {
172
+ type: type.value
173
+ };
174
+ });
175
+ const component = computed(() => {
176
+ switch (type.value) {
177
+ case "select":
178
+ if (componentProps.value.items.length > 10) {
179
+ return VAutocomplete;
180
+ }
181
+ return WeDtChipGroupSelect;
182
+ case "autocomplete":
183
+ return VAutocomplete;
184
+ case "date":
185
+ case "datetime":
186
+ case "time":
187
+ return WeDatePicker;
188
+ default:
189
+ return VTextField;
190
+ }
191
+ });
192
+ const icon = computed(() => {
193
+ switch (type.value) {
194
+ case "select":
195
+ return "mdi-format-list-bulleted";
196
+ case "date":
197
+ case "datetime":
198
+ case "time":
199
+ return "$calendar";
200
+ case "number":
201
+ case "integer":
202
+ case "decimal":
203
+ case "float":
204
+ return "mdi-numeric";
205
+ }
206
+ return "mdi-format-text";
207
+ });
208
+ const isApplied = computed(() => {
209
+ return isFilterComplete({ value: modelValue.value?.value, operator: modelValue.value?.operator });
210
+ });
211
+ watch(() => modelValue, (val) => {
212
+ operator.value = val.value?.operator ?? defaultOperator.value;
213
+ value.value = multipleTextValues.value ? toMultipleValues(val.value?.value) : val.value?.value ?? null;
214
+ }, { immediate: true, deep: true });
215
+ watch(multipleTextValues, (isMultiple) => {
216
+ if (isMultiple) {
217
+ value.value = toMultipleValues(value.value);
218
+ } else if (Array.isArray(value.value)) {
219
+ value.value = cleanMultipleValues(value.value)[0] ?? null;
220
+ }
221
+ });
222
+ function clear() {
223
+ operator.value = defaultOperator.value;
224
+ value.value = null;
225
+ apply();
226
+ }
227
+ function apply() {
228
+ emit("update:modelValue", {
229
+ operator: operator.value,
230
+ value: multipleTextValues.value ? cleanMultipleValues(value.value) : value.value
231
+ });
232
+ menu.value = false;
233
+ }
234
+ </script>
@@ -0,0 +1,7 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {
2
+ $emit: (event: "update:modelValue", ...args: any[]) => void;
3
+ header: Record<string, any>;
4
+ modelValue?: Record<string, any> | undefined;
5
+ $props: any;
6
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
7
+ export default _default;
@@ -0,0 +1,6 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {
2
+ modelValue: Record<string, any>;
3
+ availableFilters: unknown[];
4
+ $props: any;
5
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
6
+ export default _default;
@@ -0,0 +1,24 @@
1
+ <template>
2
+ <WeDtFilter
3
+ v-for="item in availableFilters"
4
+ :key="item.key"
5
+ v-model="modelValue[item.key]"
6
+ :header="item"
7
+ />
8
+ </template>
9
+
10
+ <script setup>
11
+ import { toRef } from "vue";
12
+ const props = defineProps({
13
+ availableFilters: {
14
+ type: Array,
15
+ required: true
16
+ },
17
+ modelValue: {
18
+ type: Object,
19
+ required: true
20
+ }
21
+ });
22
+ const availableFilters = toRef(props, "availableFilters");
23
+ const modelValue = toRef(props, "modelValue");
24
+ </script>
@@ -0,0 +1,6 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {
2
+ modelValue: Record<string, any>;
3
+ availableFilters: unknown[];
4
+ $props: any;
5
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
6
+ export default _default;
@@ -0,0 +1,12 @@
1
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ item: ObjectConstructor;
3
+ value: (ObjectConstructor | NumberConstructor | StringConstructor)[];
4
+ field: ObjectConstructor;
5
+ }>, {}, {}, {
6
+ formatted(): any;
7
+ }, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
8
+ item: ObjectConstructor;
9
+ value: (ObjectConstructor | NumberConstructor | StringConstructor)[];
10
+ field: ObjectConstructor;
11
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
12
+ export default _default;
@@ -0,0 +1,23 @@
1
+ <script>
2
+ export default {
3
+ props: {
4
+ item: Object,
5
+ value: [Object, String, Number],
6
+ field: Object
7
+ },
8
+ computed: {
9
+ formatted() {
10
+ if (!this.value) {
11
+ return "";
12
+ }
13
+ const { type } = this.field || {};
14
+ const format = type === "datetime" ? "dd/MM/yyyy HH:mm" : "dd/MM/yyyy";
15
+ return this.$lux(this.value, format);
16
+ }
17
+ }
18
+ };
19
+ </script>
20
+
21
+ <template>
22
+ <div>{{ formatted }}</div>
23
+ </template>
@@ -0,0 +1,12 @@
1
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ item: ObjectConstructor;
3
+ value: (ObjectConstructor | NumberConstructor | StringConstructor)[];
4
+ field: ObjectConstructor;
5
+ }>, {}, {}, {
6
+ formatted(): any;
7
+ }, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
8
+ item: ObjectConstructor;
9
+ value: (ObjectConstructor | NumberConstructor | StringConstructor)[];
10
+ field: ObjectConstructor;
11
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
12
+ export default _default;
@@ -0,0 +1,60 @@
1
+ import type { Anchor } from 'vuetify';
2
+ import type { DtFilterSelectItem } from './dt.types.js';
3
+ type __VLS_Props = {
4
+ items?: DtFilterSelectItem[];
5
+ resolvedItems?: DtFilterSelectItem[];
6
+ label?: string;
7
+ width?: string | number;
8
+ maxChips?: number;
9
+ maxSelection?: number | string;
10
+ emitRawValue?: boolean;
11
+ location?: Anchor;
12
+ hideSearch?: boolean;
13
+ clearable?: boolean;
14
+ loading?: boolean;
15
+ multiple?: boolean;
16
+ mandatory?: boolean;
17
+ hideColor?: boolean;
18
+ chipProps?: Record<string, unknown>;
19
+ truncateChipText?: boolean;
20
+ onIntersectLast?: (isIntersecting: boolean) => void;
21
+ };
22
+ declare const search: import("vue").ModelRef<string, string, string, string>;
23
+ declare const menu: import("vue").ModelRef<boolean, string, boolean, boolean>;
24
+ type __VLS_PublicProps = __VLS_Props & {
25
+ modelValue?: any | {
26
+ value: any;
27
+ };
28
+ 'search'?: typeof search['value'];
29
+ 'menu'?: typeof menu['value'];
30
+ };
31
+ declare var __VLS_70: {
32
+ filteredItems: any;
33
+ selectAll: any;
34
+ deselectAll: any;
35
+ allSelected: any;
36
+ someSelected: any;
37
+ }, __VLS_96: {
38
+ item: any;
39
+ };
40
+ type __VLS_Slots = {} & {
41
+ 'before-list'?: (props: typeof __VLS_70) => any;
42
+ } & {
43
+ 'item-title'?: (props: typeof __VLS_96) => any;
44
+ };
45
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
46
+ "update:modelValue": (value: any) => any;
47
+ "update:search": (value: string) => any;
48
+ "update:menu": (value: boolean) => any;
49
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
50
+ "onUpdate:modelValue"?: ((value: any) => any) | undefined;
51
+ "onUpdate:search"?: ((value: string) => any) | undefined;
52
+ "onUpdate:menu"?: ((value: boolean) => any) | undefined;
53
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
54
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
55
+ export default _default;
56
+ type __VLS_WithSlots<T, S> = T & {
57
+ new (): {
58
+ $slots: S;
59
+ };
60
+ };