@dative-gpi/foundation-shared-components 1.0.179-edit-image → 1.0.179-fsdialogmulform

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.
@@ -3,10 +3,45 @@
3
3
  gap="24px"
4
4
  >
5
5
  <FSPagination
6
+ v-if="$props.mode === 'pagination'"
6
7
  width="calc(100% - 16px)"
7
8
  :pages="$props.steps"
8
9
  :modelValue="currentStep - 1"
9
10
  />
11
+ <FSTabs
12
+ v-else-if="$props.mode === 'tabs'"
13
+ :tab="currentStep - 1"
14
+ :color="$props.tabsColor"
15
+ @update:tab="(val) => currentStep = val + 1"
16
+ >
17
+ <FSTab
18
+ v-for="(step, index) in $props.steps"
19
+ :key="index"
20
+ >
21
+ <slot
22
+ :name="`tab-${index + 1}`"
23
+ >
24
+ <FSRow>
25
+ <FSIcon
26
+ v-if="hasSlot(`tab-${index + 1}-icon`)"
27
+ >
28
+ <slot
29
+ :name="`tab-${index + 1}-icon`"
30
+ />
31
+ </FSIcon>
32
+ <FSSpan
33
+ :font="index + 1 === currentStep ? 'text-button' : 'text-body'"
34
+ >
35
+ <slot
36
+ :name="`tab-${index + 1}-label`"
37
+ >
38
+ {{ $tr('ui.common.step-number', 'Step {0}', step) }}
39
+ </slot>
40
+ </FSSpan>
41
+ </FSRow>
42
+ </slot>
43
+ </FSTab>
44
+ </FSTabs>
10
45
  <FSWindow
11
46
  width="100%"
12
47
  :modelValue="currentStep - 1"
@@ -78,6 +113,11 @@ import FSButton from "./FSButton.vue";
78
113
  import FSForm from "./FSForm.vue";
79
114
  import FSCol from "./FSCol.vue";
80
115
  import FSRow from "./FSRow.vue";
116
+ import FSSpan from "./FSSpan.vue";
117
+ import FSTabs from "./FSTabs.vue";
118
+ import FSTab from "./FSTab.vue";
119
+ import FSIcon from "./FSIcon.vue";
120
+ import FSWindow from "./FSWindow.vue";
81
121
 
82
122
  export default defineComponent({
83
123
  name: "FSDialogMultiFormBody",
@@ -87,7 +127,12 @@ export default defineComponent({
87
127
  FSButton,
88
128
  FSForm,
89
129
  FSCol,
90
- FSRow
130
+ FSRow,
131
+ FSSpan,
132
+ FSTabs,
133
+ FSTab,
134
+ FSIcon,
135
+ FSWindow
91
136
  },
92
137
  props: {
93
138
  subtitle: {
@@ -178,10 +223,20 @@ export default defineComponent({
178
223
  type: Boolean,
179
224
  required: false,
180
225
  default: false
181
- }
226
+ },
227
+ mode: {
228
+ type: String as PropType<"pagination" | "tabs">,
229
+ required: false,
230
+ default: "pagination"
231
+ },
232
+ tabsColor: {
233
+ type: String as PropType<ColorBase>,
234
+ required: false,
235
+ default: ColorEnum.Primary
236
+ },
182
237
  },
183
238
  emits: ["click:cancelButton", "click:submitButton"],
184
- setup(props, { emit }) {
239
+ setup(props, { emit, slots }) {
185
240
  const { isMobileSized } = useBreakpoints();
186
241
  const { $tr } = useTranslationsProvider();
187
242
 
@@ -189,6 +244,8 @@ export default defineComponent({
189
244
  const valid = ref(false);
190
245
  const valids = ref(Array.from({ length: props.steps }, () => false));
191
246
 
247
+ const hasSlot = (name: string) => !!slots[name];
248
+
192
249
  const maxHeight = computed(() => {
193
250
  const other = 24 + 24 // Paddings
194
251
  + (isMobileSized.value ? 24 : 32) + 24 // Title
@@ -246,6 +303,7 @@ export default defineComponent({
246
303
  maxHeight,
247
304
  valids,
248
305
  valid,
306
+ hasSlot,
249
307
  onPrevious,
250
308
  onSubmit
251
309
  };
@@ -13,7 +13,7 @@ import { computed, defineComponent, type PropType } from "vue";
13
13
 
14
14
  import { IMAGE_RAW_URL } from "@dative-gpi/foundation-shared-services/config";
15
15
 
16
- import { useImage, useAppAuthToken } from "@dative-gpi/foundation-shared-services/composables";
16
+ import { useImage } from "@dative-gpi/foundation-shared-services/composables";
17
17
 
18
18
  import FSEditImageUI from "./FSEditImageUI.vue";
19
19
 
@@ -32,11 +32,10 @@ export default defineComponent({
32
32
  emits: ["update:imageId"],
33
33
  setup(props) {
34
34
  const { get: getImage, entity: image } = useImage();
35
- const { authToken } = useAppAuthToken();
36
35
 
37
36
  const source = computed(() => {
38
- return props.imageId ? IMAGE_RAW_URL(props.imageId, authToken.value) : null;
39
- });
37
+ return props.imageId ? IMAGE_RAW_URL(props.imageId) : null;
38
+ })
40
39
 
41
40
  const onError = (): void => {
42
41
  if (props.imageId) {
@@ -18,7 +18,9 @@
18
18
  {{ $props.prependIcon }}
19
19
  </FSIcon>
20
20
  </slot>
21
- <slot>
21
+ <slot
22
+ name="label"
23
+ >
22
24
  <FSSpan
23
25
  v-if="$props.label"
24
26
  font="text-button"
@@ -84,7 +84,7 @@
84
84
  </template>
85
85
 
86
86
  <script lang="ts">
87
- import { computed, defineComponent, type PropType, ref, type StyleValue, watch } from "vue";
87
+ import { computed, defineComponent, type PropType, ref, type StyleValue } from "vue";
88
88
 
89
89
  import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
90
90
  import { useAppLanguages } from "@dative-gpi/foundation-shared-services/composables";
@@ -165,10 +165,7 @@ export default defineComponent({
165
165
 
166
166
  const dialog = ref(false);
167
167
 
168
- const innerTranslations = ref<{
169
- languageCode: string;
170
- [key: string]: string | null;
171
- }[]>(props.translations);
168
+ const innerTranslations = ref(props.translations);
172
169
 
173
170
  const lights = getColors(ColorEnum.Light);
174
171
  const darks = getColors(ColorEnum.Dark);
@@ -192,8 +189,7 @@ export default defineComponent({
192
189
  if (!translation || !translation[props.property]) {
193
190
  return "";
194
191
  }
195
-
196
- return translation[props.property] ?? "";
192
+ return translation[props.property];
197
193
  };
198
194
 
199
195
  const setTranslation = (languageCode: string, value: string): void => {
@@ -223,10 +219,6 @@ export default defineComponent({
223
219
  }
224
220
  };
225
221
 
226
- watch(() => props.translations, (newVal) => {
227
- innerTranslations.value = newVal;
228
- }, { immediate: true, deep: true });
229
-
230
222
  return {
231
223
  innerTranslations,
232
224
  ColorEnum,
@@ -86,7 +86,7 @@
86
86
  </template>
87
87
 
88
88
  <script lang="ts">
89
- import { computed, defineComponent, type PropType, ref, type StyleValue, watch } from "vue";
89
+ import { computed, defineComponent, type PropType, ref, type StyleValue } from "vue";
90
90
 
91
91
  import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
92
92
  import { useAppLanguages } from "@dative-gpi/foundation-shared-services/composables";
@@ -164,10 +164,7 @@ export default defineComponent({
164
164
 
165
165
  const dialog = ref(false);
166
166
 
167
- const innerTranslations = ref<{
168
- languageCode: string;
169
- [key: string]: string | null;
170
- }[]>(props.translations);
167
+ const innerTranslations = ref(props.translations);
171
168
 
172
169
  const lights = getColors(ColorEnum.Light);
173
170
  const darks = getColors(ColorEnum.Dark);
@@ -191,7 +188,7 @@ export default defineComponent({
191
188
  if (!translation || !translation[props.property]) {
192
189
  return "";
193
190
  }
194
- return translation[props.property] ?? "";
191
+ return translation[props.property];
195
192
  };
196
193
 
197
194
  const setTranslation = (languageCode: string, value: string): void => {
@@ -221,10 +218,6 @@ export default defineComponent({
221
218
  }
222
219
  };
223
220
 
224
- watch(() => props.translations, (newVal) => {
225
- innerTranslations.value = newVal;
226
- }, { immediate: true, deep: true });
227
-
228
221
  return {
229
222
  innerTranslations,
230
223
  ColorEnum,
@@ -4,7 +4,7 @@
4
4
  :wrap="false"
5
5
  >
6
6
  <FSRadioGroup
7
- :values="availablePeriods"
7
+ :values="availablePeriod"
8
8
  :disabled="disabled"
9
9
  v-model="selectedPeriod"
10
10
  />
@@ -18,25 +18,25 @@
18
18
  :vertical="true"
19
19
  />
20
20
  <FSPeriodicDailyField
21
- v-if="selectedPeriod === CronPeriod.Daily"
21
+ v-if="selectedPeriod === 'daily'"
22
22
  :disabled="disabled"
23
23
  :modelValue="$props.modelValue.split(' ')"
24
24
  @update:modelValue="$emit('update:modelValue', $event.join(' '))"
25
25
  />
26
26
  <FSPeriodicWeeklyField
27
- v-else-if="selectedPeriod === CronPeriod.Weekly"
27
+ v-else-if="selectedPeriod === 'weekly'"
28
28
  :disabled="disabled"
29
29
  :modelValue="$props.modelValue.split(' ')"
30
30
  @update:modelValue="$emit('update:modelValue', $event.join(' '))"
31
31
  />
32
32
  <FSPeriodicMonthlyField
33
- v-else-if="selectedPeriod === CronPeriod.Monthly"
33
+ v-else-if="selectedPeriod === 'monthly'"
34
34
  :disabled="disabled"
35
35
  :modelValue="$props.modelValue.split(' ')"
36
36
  @update:modelValue="$emit('update:modelValue', $event.join(' '))"
37
37
  />
38
38
  <FSPeriodicYearlyField
39
- v-else-if="selectedPeriod === CronPeriod.Yearly"
39
+ v-else-if="selectedPeriod === 'yearly'"
40
40
  :disabled="disabled"
41
41
  :modelValue="$props.modelValue.split(' ')"
42
42
  @update:modelValue="$emit('update:modelValue', $event.join(' '))"
@@ -48,8 +48,8 @@
48
48
  <script lang="ts">
49
49
  import { ref, defineComponent, type PropType, watch } from "vue";
50
50
 
51
- import { CronPeriod } from "@dative-gpi/foundation-shared-domain/enums";
52
- import { availablePeriods, getCronPeriod } from "@dative-gpi/foundation-shared-components/tools";
51
+ import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui";
52
+ import { getCronPeriod } from "@dative-gpi/foundation-shared-components/tools";
53
53
 
54
54
  import FSPeriodicMonthlyField from "./FSPeriodicMonthlyField.vue";
55
55
  import FSPeriodicWeeklyField from "./FSPeriodicWeeklyField.vue";
@@ -59,7 +59,6 @@ import FSRadioGroup from "../../FSRadioGroup.vue";
59
59
  import FSDivider from "../../FSDivider.vue";
60
60
  import FSRow from "../../FSRow.vue";
61
61
 
62
-
63
62
  export default defineComponent({
64
63
  name: "FSPeriodicField",
65
64
  components: {
@@ -84,14 +83,22 @@ export default defineComponent({
84
83
  },
85
84
  emits: ["update:modelValue"],
86
85
  setup(props, { emit }) {
86
+ const { $tr } = useTranslationsProvider();
87
+
88
+ const availablePeriod = [
89
+ { label: $tr("ui.common.daily", "Daily") , value: "daily" , item: { default : "0 12 */1 * *"} },
90
+ { label: $tr("ui.common.weekly", "Weekly") , value: "weekly" , item: { default : "0 12 * * 1"} },
91
+ { label: $tr("ui.common.monthly", "Monthly"), value: "monthly", item: { default : "0 12 1 * *"} },
92
+ { label: $tr("ui.common.yearly", "Yearly") , value: "yearly" , item: { default : "0 12 1 1 *"} }
93
+ ];
87
94
 
88
- const selectedPeriod = ref(CronPeriod.Daily);
95
+ const selectedPeriod = ref("daily");
89
96
 
90
97
  watch(() => selectedPeriod.value, () => {
91
- if (getCronPeriod(props.modelValue).value == selectedPeriod.value) {
98
+ if (getCronPeriod(props.modelValue) === selectedPeriod.value) {
92
99
  return;
93
100
  }
94
- const period = availablePeriods.find((item) => item.value == selectedPeriod.value);
101
+ const period = availablePeriod.find((item) => item.value === selectedPeriod.value);
95
102
  if (!period) {
96
103
  return;
97
104
  }
@@ -99,13 +106,12 @@ export default defineComponent({
99
106
  });
100
107
 
101
108
  watch(() => props.modelValue, () => {
102
- selectedPeriod.value = getCronPeriod(props.modelValue).value;
109
+ selectedPeriod.value = getCronPeriod(props.modelValue);
103
110
  }, { immediate: true });
104
111
 
105
112
  return {
106
- availablePeriods,
107
- selectedPeriod,
108
- CronPeriod
113
+ availablePeriod,
114
+ selectedPeriod
109
115
  };
110
116
  }
111
117
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dative-gpi/foundation-shared-components",
3
3
  "sideEffects": false,
4
- "version": "1.0.179-edit-image",
4
+ "version": "1.0.179-fsdialogmulform",
5
5
  "description": "",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -10,8 +10,8 @@
10
10
  "author": "",
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
- "@dative-gpi/foundation-shared-domain": "1.0.179-edit-image",
14
- "@dative-gpi/foundation-shared-services": "1.0.179-edit-image"
13
+ "@dative-gpi/foundation-shared-domain": "1.0.179-fsdialogmulform",
14
+ "@dative-gpi/foundation-shared-services": "1.0.179-fsdialogmulform"
15
15
  },
16
16
  "peerDependencies": {
17
17
  "@dative-gpi/bones-ui": "^1.0.0",
@@ -35,5 +35,5 @@
35
35
  "sass": "1.71.1",
36
36
  "sass-loader": "13.3.2"
37
37
  },
38
- "gitHead": "72963582266af77cf47e4585c5540f61cf80958f"
38
+ "gitHead": "8571f4f0c114a518e8aba31a0777a9de4afad316"
39
39
  }
package/tools/index.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export * from "./alertsTools";
2
2
  export * from "./chartsTools";
3
- export * from "./cronTools";
4
3
  export * from "./reportsTools";
5
4
  export * from "./timeRangeTools";
@@ -122,4 +122,18 @@ export const dayLabel = (day: Days | number): string => {
122
122
  default:
123
123
  return $tr("ui.common.all-days", "All days");
124
124
  }
125
- }
125
+ }
126
+
127
+ export const getCronPeriod = (value: string) => {
128
+ const cronArray = value.split(" ");
129
+ if (cronArray[3] !== "*") {
130
+ return $tr("ui.common.yearly", "Yearly");
131
+ }
132
+ else if (!cronArray[2].includes("*") || cronArray[2].includes("-")) {
133
+ return $tr("ui.common.monthly", "Monthly");
134
+ }
135
+ else if (cronArray[4] !== "*") {
136
+ return $tr("ui.common.weekly", "Weekly");
137
+ }
138
+ return $tr("ui.common.daily", "Daily");
139
+ };
@@ -1,16 +0,0 @@
1
- <template>
2
- <v-timeline
3
- v-bind="$attrs"
4
- >
5
- <slot/>
6
- </v-timeline>
7
- </template>
8
-
9
- <script lang="ts">
10
- import { defineComponent } from "vue";
11
-
12
- export default defineComponent({
13
- name: "FSTimeline",
14
- inheritAttrs: false
15
- });
16
- </script>
@@ -1,29 +0,0 @@
1
- <template>
2
- <v-timeline-item
3
- v-bind="$attrs"
4
- >
5
- <template
6
- v-slot:opposite
7
- >
8
- <slot
9
- name="opposite"
10
- />
11
- </template>
12
- <template
13
- v-slot:icon
14
- >
15
- <slot
16
- name="icon"
17
- />
18
- </template>
19
- <slot/>
20
- </v-timeline-item>
21
- </template>
22
-
23
- <script lang="ts">
24
- import { defineComponent } from "vue";
25
- export default defineComponent({
26
- name: "FSTimelineItem",
27
- inheritAttrs: false
28
- });
29
- </script>
@@ -1,25 +0,0 @@
1
- import { CronPeriod } from "@dative-gpi/foundation-shared-domain/enums";
2
- import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
3
-
4
- const { $tr } = useTranslationsProvider();
5
-
6
- export const availablePeriods = [
7
- { label: $tr("ui.common.daily", "Daily"), value: CronPeriod.Daily, item: { default: "0 12 */1 * *" } },
8
- { label: $tr("ui.common.weekly", "Weekly"), value: CronPeriod.Weekly, item: { default: "0 12 * * 1" } },
9
- { label: $tr("ui.common.monthly", "Monthly"), value: CronPeriod.Monthly, item: { default: "0 12 1 * *" } },
10
- { label: $tr("ui.common.yearly", "Yearly"), value: CronPeriod.Yearly, item: { default: "0 12 1 1 *" } },
11
- ];
12
-
13
- export const getCronPeriod = (value: string) => {
14
- const cronArray = value.split(" ");
15
- if (cronArray[3] !== "*") {
16
- return availablePeriods.find(c => c.value == CronPeriod.Yearly)!;
17
- }
18
- else if (!cronArray[2].includes("*") || cronArray[2].includes("-")) {
19
- return availablePeriods.find(c => c.value == CronPeriod.Monthly)!;
20
- }
21
- else if (cronArray[4] !== "*") {
22
- return availablePeriods.find(c => c.value == CronPeriod.Weekly)!;
23
- }
24
- return availablePeriods.find(c => c.value == CronPeriod.Daily)!;
25
- }