@dative-gpi/foundation-shared-components 1.0.178 → 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
  };
@@ -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"
@@ -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.178",
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.178",
14
- "@dative-gpi/foundation-shared-services": "1.0.178"
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": "231d210bbd4400f3a7c3f8efb35384c6bfc6d2cd"
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
- }