@dative-gpi/foundation-shared-components 1.0.177 → 1.0.179
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.
- package/components/fields/periodicField/FSPeriodicField.vue +15 -21
- package/components/timelines/FSTimeline.vue +16 -0
- package/components/timelines/FSTimelineItem.vue +29 -0
- package/package.json +4 -4
- package/tools/cronTools.ts +25 -0
- package/tools/index.ts +1 -0
- package/tools/timeRangeTools.ts +1 -15
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
:wrap="false"
|
|
5
5
|
>
|
|
6
6
|
<FSRadioGroup
|
|
7
|
-
:values="
|
|
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 ===
|
|
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 ===
|
|
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 ===
|
|
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 ===
|
|
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 {
|
|
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(
|
|
88
|
+
const selectedPeriod = ref(CronPeriod.Daily);
|
|
96
89
|
|
|
97
90
|
watch(() => selectedPeriod.value, () => {
|
|
98
|
-
if (getCronPeriod(props.modelValue)
|
|
91
|
+
if (getCronPeriod(props.modelValue).value == selectedPeriod.value) {
|
|
99
92
|
return;
|
|
100
93
|
}
|
|
101
|
-
const period =
|
|
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
|
-
|
|
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.
|
|
4
|
+
"version": "1.0.179",
|
|
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.
|
|
14
|
-
"@dative-gpi/foundation-shared-services": "1.0.
|
|
13
|
+
"@dative-gpi/foundation-shared-domain": "1.0.179",
|
|
14
|
+
"@dative-gpi/foundation-shared-services": "1.0.179"
|
|
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": "
|
|
38
|
+
"gitHead": "6500ee86f8f47666fd31d52f02426c1551a57c1c"
|
|
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
package/tools/timeRangeTools.ts
CHANGED
|
@@ -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
|
+
}
|