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

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.
@@ -49,6 +49,7 @@
49
49
  import { ref, defineComponent, type PropType, watch } from "vue";
50
50
 
51
51
  import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui";
52
+ import { getCronPeriod } from "@dative-gpi/foundation-shared-components/tools";
52
53
 
53
54
  import FSPeriodicMonthlyField from "./FSPeriodicMonthlyField.vue";
54
55
  import FSPeriodicWeeklyField from "./FSPeriodicWeeklyField.vue";
@@ -93,22 +94,8 @@ export default defineComponent({
93
94
 
94
95
  const selectedPeriod = ref("daily");
95
96
 
96
- const getPeriod = (value: string) => {
97
- const cronArray = value.split(" ");
98
- if (cronArray[3] !== "*") {
99
- return "yearly";
100
- }
101
- else if(!cronArray[2].includes("*") || cronArray[2].includes("-")) {
102
- return "monthly";
103
- }
104
- else if(cronArray[4] !== "*") {
105
- return "weekly";
106
- }
107
- return "daily";
108
- };
109
-
110
97
  watch(() => selectedPeriod.value, () => {
111
- if (getPeriod(props.modelValue) === selectedPeriod.value) {
98
+ if (getCronPeriod(props.modelValue) === selectedPeriod.value) {
112
99
  return;
113
100
  }
114
101
  const period = availablePeriod.find((item) => item.value === selectedPeriod.value);
@@ -119,7 +106,7 @@ export default defineComponent({
119
106
  });
120
107
 
121
108
  watch(() => props.modelValue, () => {
122
- selectedPeriod.value = getPeriod(props.modelValue);
109
+ selectedPeriod.value = getCronPeriod(props.modelValue);
123
110
  }, { immediate: true });
124
111
 
125
112
  return {
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.176",
4
+ "version": "1.0.177",
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.176",
14
- "@dative-gpi/foundation-shared-services": "1.0.176"
13
+ "@dative-gpi/foundation-shared-domain": "1.0.177",
14
+ "@dative-gpi/foundation-shared-services": "1.0.177"
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": "a485013f28c746c842b4a917a0f8a9484b641ec8"
38
+ "gitHead": "0b54c0dddfdfcad69143175aae2c98a04eac9bca"
39
39
  }
@@ -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
+ };