@dative-gpi/foundation-shared-components 1.0.177 → 1.0.178

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.
@@ -4,7 +4,7 @@
4
4
  :wrap="false"
5
5
  >
6
6
  <FSRadioGroup
7
- :values="availablePeriod"
7
+ :values="availablePeriods"
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 === 'daily'"
21
+ v-if="selectedPeriod === CronPeriod.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 === 'weekly'"
27
+ v-else-if="selectedPeriod === CronPeriod.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 === 'monthly'"
33
+ v-else-if="selectedPeriod === CronPeriod.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 === 'yearly'"
39
+ v-else-if="selectedPeriod === CronPeriod.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 { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui";
52
- import { getCronPeriod } from "@dative-gpi/foundation-shared-components/tools";
51
+ import { CronPeriod } from "@dative-gpi/foundation-shared-domain/enums";
52
+ import { availablePeriods, 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,6 +59,7 @@ import FSRadioGroup from "../../FSRadioGroup.vue";
59
59
  import FSDivider from "../../FSDivider.vue";
60
60
  import FSRow from "../../FSRow.vue";
61
61
 
62
+
62
63
  export default defineComponent({
63
64
  name: "FSPeriodicField",
64
65
  components: {
@@ -83,22 +84,14 @@ export default defineComponent({
83
84
  },
84
85
  emits: ["update:modelValue"],
85
86
  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
- ];
94
87
 
95
- const selectedPeriod = ref("daily");
88
+ const selectedPeriod = ref(CronPeriod.Daily);
96
89
 
97
90
  watch(() => selectedPeriod.value, () => {
98
- if (getCronPeriod(props.modelValue) === selectedPeriod.value) {
91
+ if (getCronPeriod(props.modelValue).value == selectedPeriod.value) {
99
92
  return;
100
93
  }
101
- const period = availablePeriod.find((item) => item.value === selectedPeriod.value);
94
+ const period = availablePeriods.find((item) => item.value == selectedPeriod.value);
102
95
  if (!period) {
103
96
  return;
104
97
  }
@@ -106,12 +99,13 @@ export default defineComponent({
106
99
  });
107
100
 
108
101
  watch(() => props.modelValue, () => {
109
- selectedPeriod.value = getCronPeriod(props.modelValue);
102
+ selectedPeriod.value = getCronPeriod(props.modelValue).value;
110
103
  }, { immediate: true });
111
104
 
112
105
  return {
113
- availablePeriod,
114
- selectedPeriod
106
+ availablePeriods,
107
+ selectedPeriod,
108
+ CronPeriod
115
109
  };
116
110
  }
117
111
  });
@@ -0,0 +1,16 @@
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>
@@ -0,0 +1,29 @@
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>
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.177",
4
+ "version": "1.0.178",
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.177",
14
- "@dative-gpi/foundation-shared-services": "1.0.177"
13
+ "@dative-gpi/foundation-shared-domain": "1.0.178",
14
+ "@dative-gpi/foundation-shared-services": "1.0.178"
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": "0b54c0dddfdfcad69143175aae2c98a04eac9bca"
38
+ "gitHead": "231d210bbd4400f3a7c3f8efb35384c6bfc6d2cd"
39
39
  }
@@ -0,0 +1,25 @@
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
+ }
package/tools/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from "./alertsTools";
2
2
  export * from "./chartsTools";
3
+ export * from "./cronTools";
3
4
  export * from "./reportsTools";
4
5
  export * from "./timeRangeTools";
@@ -122,18 +122,4 @@ export const dayLabel = (day: Days | number): string => {
122
122
  default:
123
123
  return $tr("ui.common.all-days", "All days");
124
124
  }
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
- };
125
+ }