@dative-gpi/foundation-shared-components 1.0.29 → 1.0.30
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/autocompletes/FSAutocompleteTimeZone.vue +2 -2
- package/components/buttons/FSButtonCopy.vue +28 -0
- package/components/buttons/FSButtonCopyIcon.vue +28 -0
- package/components/buttons/FSButtonCopyLabel.vue +27 -0
- package/components/buttons/FSButtonCopyMini.vue +28 -0
- package/components/fields/periodicField/FSPeriodicDailyField.vue +113 -0
- package/components/fields/periodicField/FSPeriodicField.vue +131 -0
- package/components/fields/periodicField/FSPeriodicMonthlyField.vue +208 -0
- package/components/fields/periodicField/FSPeriodicWeeklyField.vue +114 -0
- package/components/fields/periodicField/FSPeriodicYearlyField.vue +135 -0
- package/components/selects/FSSelectMonths.vue +67 -0
- package/package.json +4 -4
- package/styles/components/fs_radio.scss +11 -0
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
@click="props.toggle(props.item)"
|
|
54
54
|
>
|
|
55
55
|
<template
|
|
56
|
+
v-if="props.item.offset"
|
|
56
57
|
#prepend
|
|
57
58
|
>
|
|
58
59
|
<FSChip
|
|
@@ -121,7 +122,7 @@ export default defineComponent({
|
|
|
121
122
|
return getManyTimeZones({ ...props.timeZoneFilters, search: search ?? undefined });
|
|
122
123
|
};
|
|
123
124
|
|
|
124
|
-
const { toggleSet,
|
|
125
|
+
const { toggleSet, init, onUpdate } = useAutocomplete(
|
|
125
126
|
timeZones,
|
|
126
127
|
[() => props.timeZoneFilters],
|
|
127
128
|
emit,
|
|
@@ -136,7 +137,6 @@ export default defineComponent({
|
|
|
136
137
|
timeZones,
|
|
137
138
|
toggleSet,
|
|
138
139
|
loading,
|
|
139
|
-
search,
|
|
140
140
|
onUpdate
|
|
141
141
|
};
|
|
142
142
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSButton
|
|
3
|
+
prependIcon="mdi-content-copy"
|
|
4
|
+
:label="$tr('ui.button.copy', 'Copy')"
|
|
5
|
+
:color="ColorEnum.Light"
|
|
6
|
+
v-bind="$attrs"
|
|
7
|
+
/>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import { defineComponent } from "vue";
|
|
12
|
+
|
|
13
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
14
|
+
|
|
15
|
+
import FSButton from "../FSButton.vue";
|
|
16
|
+
|
|
17
|
+
export default defineComponent({
|
|
18
|
+
name: "FSButtonCopy",
|
|
19
|
+
components: {
|
|
20
|
+
FSButton
|
|
21
|
+
},
|
|
22
|
+
setup() {
|
|
23
|
+
return {
|
|
24
|
+
ColorEnum
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
</script>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSButton
|
|
3
|
+
icon="mdi-content-copy"
|
|
4
|
+
variant="icon"
|
|
5
|
+
:color="ColorEnum.Light"
|
|
6
|
+
v-bind="$attrs"
|
|
7
|
+
/>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import { defineComponent } from "vue";
|
|
12
|
+
|
|
13
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
14
|
+
|
|
15
|
+
import FSButton from "../FSButton.vue";
|
|
16
|
+
|
|
17
|
+
export default defineComponent({
|
|
18
|
+
name: "FSButtonCopyIcon",
|
|
19
|
+
components: {
|
|
20
|
+
FSButton
|
|
21
|
+
},
|
|
22
|
+
setup() {
|
|
23
|
+
return {
|
|
24
|
+
ColorEnum
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
</script>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSButton
|
|
3
|
+
:label="$tr('ui.button.copy', 'Copy')"
|
|
4
|
+
:color="ColorEnum.Light"
|
|
5
|
+
v-bind="$attrs"
|
|
6
|
+
/>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script lang="ts">
|
|
10
|
+
import { defineComponent } from "vue";
|
|
11
|
+
|
|
12
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
13
|
+
|
|
14
|
+
import FSButton from "../FSButton.vue";
|
|
15
|
+
|
|
16
|
+
export default defineComponent({
|
|
17
|
+
name: "FSButtonCopyLabel",
|
|
18
|
+
components: {
|
|
19
|
+
FSButton
|
|
20
|
+
},
|
|
21
|
+
setup() {
|
|
22
|
+
return {
|
|
23
|
+
ColorEnum
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
</script>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSButton
|
|
3
|
+
prependIcon="mdi-content-copy"
|
|
4
|
+
|
|
5
|
+
:color="ColorEnum.Light"
|
|
6
|
+
v-bind="$attrs"
|
|
7
|
+
/>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import { defineComponent } from "vue";
|
|
12
|
+
|
|
13
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
14
|
+
|
|
15
|
+
import FSButton from "../FSButton.vue";
|
|
16
|
+
|
|
17
|
+
export default defineComponent({
|
|
18
|
+
name: "FSButtonCopyMini",
|
|
19
|
+
components: {
|
|
20
|
+
FSButton
|
|
21
|
+
},
|
|
22
|
+
setup() {
|
|
23
|
+
return {
|
|
24
|
+
ColorEnum
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
</script>
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSRadioGroup
|
|
3
|
+
:values="availableConfigurations"
|
|
4
|
+
:editable="$props.editable"
|
|
5
|
+
v-model="selectedConfiguration"
|
|
6
|
+
>
|
|
7
|
+
<template
|
|
8
|
+
#label="{ item, font }"
|
|
9
|
+
>
|
|
10
|
+
<FSRow
|
|
11
|
+
v-if="item.value === 'custom'"
|
|
12
|
+
align="center-left"
|
|
13
|
+
>
|
|
14
|
+
<FSSpan
|
|
15
|
+
:font="font"
|
|
16
|
+
>
|
|
17
|
+
{{ $tr('ui.periodicfield.daily.every', 'Every') }}
|
|
18
|
+
</FSSpan>
|
|
19
|
+
<FSNumberField
|
|
20
|
+
:editable="$props.editable"
|
|
21
|
+
:modelValue="days"
|
|
22
|
+
:hideHeader="true"
|
|
23
|
+
:clearable="false"
|
|
24
|
+
@update:modelValue="onUpdateDays($event)"
|
|
25
|
+
/>
|
|
26
|
+
<FSSpan
|
|
27
|
+
:font="font"
|
|
28
|
+
>
|
|
29
|
+
{{ $tr('ui.periodicfield.daily.daysat', 'day(s) at') }}
|
|
30
|
+
</FSSpan>
|
|
31
|
+
<FSClock
|
|
32
|
+
:editable="$props.editable"
|
|
33
|
+
:color="ColorEnum.Light"
|
|
34
|
+
:modelValue="time"
|
|
35
|
+
:hideHeader="true"
|
|
36
|
+
:slider="false"
|
|
37
|
+
@update:modelValue="onUpdateHours($event)"
|
|
38
|
+
/>
|
|
39
|
+
</FSRow>
|
|
40
|
+
</template>
|
|
41
|
+
</FSRadioGroup>
|
|
42
|
+
</template>
|
|
43
|
+
|
|
44
|
+
<script lang="ts">
|
|
45
|
+
import { ref, defineComponent, computed } from "vue";
|
|
46
|
+
|
|
47
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
48
|
+
|
|
49
|
+
import FSRadioGroup from "../../FSRadioGroup.vue";
|
|
50
|
+
import FSNumberField from "../FSNumberField.vue";
|
|
51
|
+
import FSClock from "../../FSClock.vue";
|
|
52
|
+
import FSSpan from "../../FSSpan.vue";
|
|
53
|
+
import FSRow from "../../FSRow.vue";
|
|
54
|
+
|
|
55
|
+
export default defineComponent({
|
|
56
|
+
name: "FSPeriodicDailyField",
|
|
57
|
+
components: {
|
|
58
|
+
FSNumberField,
|
|
59
|
+
FSRadioGroup,
|
|
60
|
+
FSClock,
|
|
61
|
+
FSSpan,
|
|
62
|
+
FSRow
|
|
63
|
+
},
|
|
64
|
+
props: {
|
|
65
|
+
modelValue: {
|
|
66
|
+
type: Array<string>,
|
|
67
|
+
required: true
|
|
68
|
+
},
|
|
69
|
+
editable: {
|
|
70
|
+
type: Boolean,
|
|
71
|
+
required: false,
|
|
72
|
+
default: true
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
emits: ["update:modelValue"],
|
|
76
|
+
setup(props, { emit }) {
|
|
77
|
+
const availableConfigurations = [
|
|
78
|
+
{ value: "custom", item: { value: "custom" } }
|
|
79
|
+
];
|
|
80
|
+
|
|
81
|
+
const selectedConfiguration = ref("custom");
|
|
82
|
+
|
|
83
|
+
const days = computed(() => {
|
|
84
|
+
return +props.modelValue[2].replace("*/", "");
|
|
85
|
+
});
|
|
86
|
+
const time = computed(() => {
|
|
87
|
+
return (+props.modelValue[1] * 60 + +props.modelValue[0]) * 1000 * 60;
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
const onUpdateDays = (value: number) => {
|
|
91
|
+
const hours = Math.floor(value / (60 * 60 * 1000));
|
|
92
|
+
const minutes = Math.floor(value / (60 * 1000) % 60);
|
|
93
|
+
emit("update:modelValue", [`${minutes}`, `${hours}`, `*/${value}`, "*", "*"]);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const onUpdateHours = (value: number) => {
|
|
97
|
+
const hours = Math.floor(value / (60 * 60 * 1000));
|
|
98
|
+
const minutes = Math.floor(value / (60 * 1000) % 60);
|
|
99
|
+
emit("update:modelValue", [`${minutes}`, `${hours}`, `*/${days.value}`, "*", "*"]);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return {
|
|
103
|
+
availableConfigurations,
|
|
104
|
+
selectedConfiguration,
|
|
105
|
+
ColorEnum,
|
|
106
|
+
days,
|
|
107
|
+
time,
|
|
108
|
+
onUpdateHours,
|
|
109
|
+
onUpdateDays
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
})
|
|
113
|
+
</script>
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSRow
|
|
3
|
+
gap="12px"
|
|
4
|
+
:wrap="false"
|
|
5
|
+
>
|
|
6
|
+
<FSRadioGroup
|
|
7
|
+
:values="availablePeriod"
|
|
8
|
+
:editable="editable"
|
|
9
|
+
v-model="selectedPeriod"
|
|
10
|
+
/>
|
|
11
|
+
<FSRow
|
|
12
|
+
align="center-left"
|
|
13
|
+
height="fill"
|
|
14
|
+
gap="12px"
|
|
15
|
+
:wrap="false"
|
|
16
|
+
>
|
|
17
|
+
<FSDivider
|
|
18
|
+
:vertical="true"
|
|
19
|
+
/>
|
|
20
|
+
<FSPeriodicDailyField
|
|
21
|
+
v-if="selectedPeriod === 'daily'"
|
|
22
|
+
:editable="editable"
|
|
23
|
+
:modelValue="$props.modelValue.split(' ')"
|
|
24
|
+
@update:modelValue="$emit('update:modelValue', $event.join(' '))"
|
|
25
|
+
/>
|
|
26
|
+
<FSPeriodicWeeklyField
|
|
27
|
+
v-else-if="selectedPeriod === 'weekly'"
|
|
28
|
+
:editable="editable"
|
|
29
|
+
:modelValue="$props.modelValue.split(' ')"
|
|
30
|
+
@update:modelValue="$emit('update:modelValue', $event.join(' '))"
|
|
31
|
+
/>
|
|
32
|
+
<FSPeriodicMonthlyField
|
|
33
|
+
v-else-if="selectedPeriod === 'monthly'"
|
|
34
|
+
:editable="editable"
|
|
35
|
+
:modelValue="$props.modelValue.split(' ')"
|
|
36
|
+
@update:modelValue="$emit('update:modelValue', $event.join(' '))"
|
|
37
|
+
/>
|
|
38
|
+
<FSPeriodicYearlyField
|
|
39
|
+
v-else-if="selectedPeriod === 'yearly'"
|
|
40
|
+
:editable="editable"
|
|
41
|
+
:modelValue="$props.modelValue.split(' ')"
|
|
42
|
+
@update:modelValue="$emit('update:modelValue', $event.join(' '))"
|
|
43
|
+
/>
|
|
44
|
+
</FSRow>
|
|
45
|
+
</FSRow>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<script lang="ts">
|
|
49
|
+
import { ref, defineComponent, onMounted, type PropType, watch } from "vue";
|
|
50
|
+
|
|
51
|
+
import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui";
|
|
52
|
+
|
|
53
|
+
import FSPeriodicMonthlyField from "./FSPeriodicMonthlyField.vue";
|
|
54
|
+
import FSPeriodicWeeklyField from "./FSPeriodicWeeklyField.vue";
|
|
55
|
+
import FSPeriodicYearlyField from "./FSPeriodicYearlyField.vue";
|
|
56
|
+
import FSPeriodicDailyField from "./FSPeriodicDailyField.vue";
|
|
57
|
+
import FSRadioGroup from "../../FSRadioGroup.vue";
|
|
58
|
+
import FSDivider from "../../FSDivider.vue";
|
|
59
|
+
import FSRow from "../../FSRow.vue";
|
|
60
|
+
|
|
61
|
+
export default defineComponent({
|
|
62
|
+
name: "FSPeriodicField",
|
|
63
|
+
components: {
|
|
64
|
+
FSPeriodicMonthlyField,
|
|
65
|
+
FSPeriodicWeeklyField,
|
|
66
|
+
FSPeriodicYearlyField,
|
|
67
|
+
FSPeriodicDailyField,
|
|
68
|
+
FSRadioGroup,
|
|
69
|
+
FSDivider,
|
|
70
|
+
FSRow
|
|
71
|
+
},
|
|
72
|
+
props: {
|
|
73
|
+
modelValue: {
|
|
74
|
+
type: String as PropType<"daily" | "weekly" | "monthly" | "yearly">,
|
|
75
|
+
required: true
|
|
76
|
+
},
|
|
77
|
+
editable: {
|
|
78
|
+
type: Boolean,
|
|
79
|
+
required: false,
|
|
80
|
+
default: true
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
emits: ["update:modelValue"],
|
|
84
|
+
setup(props, { emit }) {
|
|
85
|
+
const { $tr } = useTranslationsProvider();
|
|
86
|
+
|
|
87
|
+
const availablePeriod = [
|
|
88
|
+
{ label: $tr("ui.periodicField.daily", "Daily") , value: "daily" , item: { default : "0 12 */1 * *"} },
|
|
89
|
+
{ label: $tr("ui.periodicField.weekly", "Weekly") , value: "weekly" , item: { default : "0 12 * * 1"} },
|
|
90
|
+
{ label: $tr("ui.periodicField.monthly", "Monthly"), value: "monthly", item: { default : "0 12 1 * *"} },
|
|
91
|
+
{ label: $tr("ui.periodicField.yearly", "Yearly") , value: "yearly" , item: { default : "0 12 1 1 *"} }
|
|
92
|
+
];
|
|
93
|
+
|
|
94
|
+
const selectedPeriod = ref("daily");
|
|
95
|
+
|
|
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
|
+
watch(() => selectedPeriod.value, () => {
|
|
111
|
+
if (getPeriod(props.modelValue) === selectedPeriod.value) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const period = availablePeriod.find((item) => item.value === selectedPeriod.value);
|
|
115
|
+
if (!period) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
emit('update:modelValue', period.item.default);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
onMounted(() => {
|
|
122
|
+
selectedPeriod.value = getPeriod(props.modelValue);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
return {
|
|
126
|
+
availablePeriod,
|
|
127
|
+
selectedPeriod
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
</script>
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSRadioGroup
|
|
3
|
+
:values="availableConfigurations"
|
|
4
|
+
:editable="$props.editable"
|
|
5
|
+
v-model="selectedConfiguration"
|
|
6
|
+
>
|
|
7
|
+
<template
|
|
8
|
+
#label="{ item, font }"
|
|
9
|
+
>
|
|
10
|
+
<FSRow
|
|
11
|
+
v-if="item.value === 'customDayNumber'"
|
|
12
|
+
align="center-left"
|
|
13
|
+
>
|
|
14
|
+
<FSSpan
|
|
15
|
+
:font="font"
|
|
16
|
+
>
|
|
17
|
+
{{ $tr("ui.periodicfield.monthly.day", "Day") }}
|
|
18
|
+
</FSSpan>
|
|
19
|
+
<FSSelectField
|
|
20
|
+
:editable="$props.editable"
|
|
21
|
+
:items="dayNumbers"
|
|
22
|
+
:hideHeader="true"
|
|
23
|
+
:clearable="false"
|
|
24
|
+
:modelValue="dayNumber"
|
|
25
|
+
@update:modelValue="onUpdateDayNumber($event)"
|
|
26
|
+
/>
|
|
27
|
+
<FSSpan
|
|
28
|
+
:font="font"
|
|
29
|
+
>
|
|
30
|
+
{{ $tr("ui.periodicfield.monthly.every-month-at", "every month at") }}
|
|
31
|
+
</FSSpan>
|
|
32
|
+
<FSClock
|
|
33
|
+
:editable="$props.editable"
|
|
34
|
+
:color="ColorEnum.Light"
|
|
35
|
+
:hideHeader="true"
|
|
36
|
+
:slider="false"
|
|
37
|
+
:modelValue="time"
|
|
38
|
+
@update:modelValue="onUpdateHours($event)"
|
|
39
|
+
/>
|
|
40
|
+
</FSRow>
|
|
41
|
+
<FSRow
|
|
42
|
+
v-else-if="item.value === 'customDayWeek'"
|
|
43
|
+
align="center-left"
|
|
44
|
+
>
|
|
45
|
+
<FSSpan
|
|
46
|
+
:font="font"
|
|
47
|
+
>
|
|
48
|
+
{{ $tr("ui.periodicfield.monthly.every", "Every") }}
|
|
49
|
+
</FSSpan>
|
|
50
|
+
<FSSelectField
|
|
51
|
+
:editable="$props.editable"
|
|
52
|
+
:items="dayWeekNumbers"
|
|
53
|
+
:hideHeader="true"
|
|
54
|
+
:clearable="false"
|
|
55
|
+
:modelValue="dayWeekNumber"
|
|
56
|
+
@update:modelValue="onUpdateDayWeekNumber($event)"
|
|
57
|
+
/>
|
|
58
|
+
<FSSelectDays
|
|
59
|
+
:editable="$props.editable"
|
|
60
|
+
:useAllDays="false"
|
|
61
|
+
:hideHeader="true"
|
|
62
|
+
:modelValue="dayWeek"
|
|
63
|
+
@update:modelValue="onUpdateDayWeek($event)"
|
|
64
|
+
/>
|
|
65
|
+
<FSSpan
|
|
66
|
+
:font="font"
|
|
67
|
+
>
|
|
68
|
+
{{ $tr("ui.periodicfield.monthly.at", "at") }}
|
|
69
|
+
</FSSpan>
|
|
70
|
+
<FSClock
|
|
71
|
+
:editable="$props.editable"
|
|
72
|
+
:color="ColorEnum.Light"
|
|
73
|
+
:hideHeader="true"
|
|
74
|
+
:slider="false"
|
|
75
|
+
:modelValue="time"
|
|
76
|
+
@update:modelValue="onUpdateHours($event)"
|
|
77
|
+
/>
|
|
78
|
+
</FSRow>
|
|
79
|
+
</template>
|
|
80
|
+
</FSRadioGroup>
|
|
81
|
+
</template>
|
|
82
|
+
|
|
83
|
+
<script lang="ts">
|
|
84
|
+
import { ref, defineComponent, watch, computed } from "vue";
|
|
85
|
+
|
|
86
|
+
import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui";
|
|
87
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
88
|
+
|
|
89
|
+
import FSSelectField from "../../fields/FSSelectField.vue";
|
|
90
|
+
import FSSelectDays from "../../selects/FSSelectDays.vue";
|
|
91
|
+
import FSRadioGroup from "../../FSRadioGroup.vue";
|
|
92
|
+
import FSClock from "../../FSClock.vue";
|
|
93
|
+
import FSSpan from "../../FSSpan.vue";
|
|
94
|
+
import FSRow from "../../FSRow.vue";
|
|
95
|
+
|
|
96
|
+
export default defineComponent({
|
|
97
|
+
name: "FSPeriodicMonthlyField",
|
|
98
|
+
components: {
|
|
99
|
+
FSSelectField,
|
|
100
|
+
FSRadioGroup,
|
|
101
|
+
FSSelectDays,
|
|
102
|
+
FSClock,
|
|
103
|
+
FSSpan,
|
|
104
|
+
FSRow
|
|
105
|
+
},
|
|
106
|
+
props: {
|
|
107
|
+
modelValue: {
|
|
108
|
+
type: Array<string>,
|
|
109
|
+
required: true
|
|
110
|
+
},
|
|
111
|
+
editable: {
|
|
112
|
+
type: Boolean,
|
|
113
|
+
required: false,
|
|
114
|
+
default: true
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
emits: ["update:modelValue"],
|
|
118
|
+
setup(props, { emit }) {
|
|
119
|
+
const { $tr } = useTranslationsProvider();
|
|
120
|
+
|
|
121
|
+
const dayWeekNumbers = [
|
|
122
|
+
{ id: 1, label: $tr("ui.periodicfield.monthly.first" , "First") },
|
|
123
|
+
{ id: 2, label: $tr("ui.periodicfield.monthly.second", "Second") },
|
|
124
|
+
{ id: 3, label: $tr("ui.periodicfield.monthly.third" , "Third") },
|
|
125
|
+
{ id: 4, label: $tr("ui.periodicfield.monthly.fourth", "Fourth") },
|
|
126
|
+
];
|
|
127
|
+
|
|
128
|
+
const availableConfigurations = [
|
|
129
|
+
{ value: "customDayNumber", item: { value: "customDayNumber" } },
|
|
130
|
+
{ value: "customDayWeek" , item: { value: "customDayWeek" } }
|
|
131
|
+
];
|
|
132
|
+
|
|
133
|
+
const dayNumbers = Array.from({ length: 31 }, (_, index) => ({ id: index + 1, label: String(index + 1) }));
|
|
134
|
+
|
|
135
|
+
const selectedConfiguration = ref(props.modelValue[4] !== "*" ? "customDayWeek" : "customDayNumber");
|
|
136
|
+
|
|
137
|
+
const dayNumber = computed(() =>
|
|
138
|
+
props.modelValue[4] !== "*" ? 1 : +props.modelValue[2]
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
const dayWeek = computed(() =>
|
|
142
|
+
props.modelValue[4] === "*" ? 0 : +props.modelValue[4] - 1
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
const dayWeekNumber = computed(() =>
|
|
146
|
+
props.modelValue[2].includes("-") ? Math.floor(+props.modelValue[2].split("-")[1] / 7) : 1
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
const time = computed(() => (+props.modelValue[1] * 60 + +props.modelValue[0]) * 1000 * 60);
|
|
150
|
+
|
|
151
|
+
const onUpdateDayNumber = (value: number) => {
|
|
152
|
+
const hours = Math.floor(value / (60 * 60 * 1000));
|
|
153
|
+
const minutes = Math.floor(value / (60 * 1000) % 60);
|
|
154
|
+
emit("update:modelValue", [`${minutes}`, `${hours}`, `${value}`, `*`, `*`]);
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
const onUpdateDayWeekNumber = (value: number) => {
|
|
158
|
+
const hours = Math.floor(value / (60 * 60 * 1000));
|
|
159
|
+
const minutes = Math.floor(value / (60 * 1000) % 60);
|
|
160
|
+
emit("update:modelValue", [`${minutes}`, `${hours}`, `${(value - 1) * 7 + 1}-${value * 7}`, `*`, `${dayWeek.value + 1}`]);
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
const onUpdateDayWeek = (value: number) => {
|
|
164
|
+
const hours = Math.floor(value / (60 * 60 * 1000));
|
|
165
|
+
const minutes = Math.floor(value / (60 * 1000) % 60);
|
|
166
|
+
emit("update:modelValue", [`${minutes}`, `${hours}`, `${(dayWeekNumber.value - 1) * 7 + 1}-${dayWeekNumber.value * 7}`, `*`, `${value + 1}`]);
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
const onUpdateHours = (value: number) => {
|
|
170
|
+
const hours = Math.floor(value / (60 * 60 * 1000));
|
|
171
|
+
const minutes = Math.floor(value / (60 * 1000) % 60);
|
|
172
|
+
if (selectedConfiguration.value === "customDayNumber") {
|
|
173
|
+
emit("update:modelValue", [`${minutes}`, `${hours}`, `${dayNumber.value}`, `*`, `*`]);
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
emit("update:modelValue", [`${minutes}`, `${hours}`, `${(dayWeekNumber.value - 1) * 7 + 1}-${dayWeekNumber.value * 7}`, `*`, `${dayWeek.value + 1}`]);
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
watch(() => selectedConfiguration.value, (value: string) => {
|
|
181
|
+
const hours = Math.floor(time.value / (60 * 60 * 1000));
|
|
182
|
+
const minutes = Math.floor(time.value / (60 * 1000) % 60);
|
|
183
|
+
if(value === "customDayNumber") {
|
|
184
|
+
emit("update:modelValue", [`${minutes}`, `${hours}`, `${dayNumber.value}`, `*`, `*`]);
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
emit("update:modelValue", [`${minutes}`, `${hours}`, `${(dayWeekNumber.value - 1) * 7 + 1}-${dayWeekNumber.value * 7}`, `*`, `${dayWeek.value + 1}`]);
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
return {
|
|
192
|
+
availableConfigurations,
|
|
193
|
+
selectedConfiguration,
|
|
194
|
+
dayWeekNumbers,
|
|
195
|
+
dayWeekNumber,
|
|
196
|
+
dayNumbers,
|
|
197
|
+
ColorEnum,
|
|
198
|
+
dayNumber,
|
|
199
|
+
dayWeek,
|
|
200
|
+
time,
|
|
201
|
+
onUpdateDayWeekNumber,
|
|
202
|
+
onUpdateDayNumber,
|
|
203
|
+
onUpdateDayWeek,
|
|
204
|
+
onUpdateHours
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
</script>
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSRadioGroup
|
|
3
|
+
:values="availableConfigurations"
|
|
4
|
+
:editable="$props.editable"
|
|
5
|
+
v-model="selectedConfiguration"
|
|
6
|
+
>
|
|
7
|
+
<template
|
|
8
|
+
#label="{ item, font }"
|
|
9
|
+
>
|
|
10
|
+
<FSRow
|
|
11
|
+
v-if="item.value === 'custom'"
|
|
12
|
+
align="center-left"
|
|
13
|
+
>
|
|
14
|
+
<FSSpan
|
|
15
|
+
:font="font"
|
|
16
|
+
>
|
|
17
|
+
{{ $tr("ui.periodicfield.weekly.every", "Every") }}
|
|
18
|
+
</FSSpan>
|
|
19
|
+
<FSSelectDays
|
|
20
|
+
:editable="$props.editable"
|
|
21
|
+
:useAllDays="false"
|
|
22
|
+
:hideHeader="true"
|
|
23
|
+
:modelValue="day"
|
|
24
|
+
@update:modelValue="onUpdateDay($event)"
|
|
25
|
+
/>
|
|
26
|
+
<FSSpan
|
|
27
|
+
:font="font"
|
|
28
|
+
>
|
|
29
|
+
{{ $tr("ui.periodicfield.weekly.at", "at") }}
|
|
30
|
+
</FSSpan>
|
|
31
|
+
<FSClock
|
|
32
|
+
:editable="$props.editable"
|
|
33
|
+
:color="ColorEnum.Light"
|
|
34
|
+
:hideHeader="true"
|
|
35
|
+
:slider="false"
|
|
36
|
+
:modelValue="time"
|
|
37
|
+
@update:modelValue="onUpdateHours($event)"
|
|
38
|
+
/>
|
|
39
|
+
</FSRow>
|
|
40
|
+
</template>
|
|
41
|
+
</FSRadioGroup>
|
|
42
|
+
</template>
|
|
43
|
+
|
|
44
|
+
<script lang="ts">
|
|
45
|
+
import { ref, defineComponent, computed } from "vue";
|
|
46
|
+
|
|
47
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
48
|
+
|
|
49
|
+
import FSSelectDays from "../../selects/FSSelectDays.vue";
|
|
50
|
+
import FSRadioGroup from "../../FSRadioGroup.vue";
|
|
51
|
+
import FSClock from "../../FSClock.vue";
|
|
52
|
+
import FSSpan from "../../FSSpan.vue";
|
|
53
|
+
import FSRow from "../../FSRow.vue";
|
|
54
|
+
|
|
55
|
+
export default defineComponent({
|
|
56
|
+
name: "FSPeriodicWeeklyField",
|
|
57
|
+
components: {
|
|
58
|
+
FSRadioGroup,
|
|
59
|
+
FSSelectDays,
|
|
60
|
+
FSClock,
|
|
61
|
+
FSSpan,
|
|
62
|
+
FSRow
|
|
63
|
+
},
|
|
64
|
+
props: {
|
|
65
|
+
modelValue: {
|
|
66
|
+
type: Array<string>,
|
|
67
|
+
required: true
|
|
68
|
+
},
|
|
69
|
+
editable: {
|
|
70
|
+
type: Boolean,
|
|
71
|
+
required: false,
|
|
72
|
+
default: true
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
emits: ["update:modelValue"],
|
|
76
|
+
setup(props, { emit }) {
|
|
77
|
+
const availableConfigurations = [
|
|
78
|
+
{ value: "custom", item: { value: "custom" } }
|
|
79
|
+
];
|
|
80
|
+
|
|
81
|
+
const selectedConfiguration = ref("custom");
|
|
82
|
+
|
|
83
|
+
const day = computed(() => {
|
|
84
|
+
return +props.modelValue[4] - 1;
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
const time = computed(() => {
|
|
88
|
+
return (+props.modelValue[1] * 60 + +props.modelValue[0]) * 1000 * 60;
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const onUpdateDay = (value: number) => {
|
|
92
|
+
const hours = Math.floor(value / (60 * 60 * 1000));
|
|
93
|
+
const minutes = Math.floor(value / (60 * 1000) % 60);
|
|
94
|
+
emit("update:modelValue", [`${minutes}`, `${hours}`, `*`, `*`, `${value + 1}`]);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const onUpdateHours = (value: number) => {
|
|
98
|
+
const hours = Math.floor(value / (60 * 60 * 1000));
|
|
99
|
+
const minutes = Math.floor(value / (60 * 1000) % 60);
|
|
100
|
+
emit("update:modelValue", [`${minutes}`, `${hours}`, `*`, `*`, `${day.value + 1}`]);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
return {
|
|
104
|
+
availableConfigurations,
|
|
105
|
+
selectedConfiguration,
|
|
106
|
+
ColorEnum,
|
|
107
|
+
time,
|
|
108
|
+
day,
|
|
109
|
+
onUpdateHours,
|
|
110
|
+
onUpdateDay
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
</script>
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSRadioGroup
|
|
3
|
+
:values="availableConfigurations"
|
|
4
|
+
:editable="$props.editable"
|
|
5
|
+
v-model="selectedConfiguration"
|
|
6
|
+
>
|
|
7
|
+
<template
|
|
8
|
+
#label="{ item, font }"
|
|
9
|
+
>
|
|
10
|
+
<FSRow
|
|
11
|
+
v-if="item.value === 'custom'"
|
|
12
|
+
align="center-left"
|
|
13
|
+
>
|
|
14
|
+
<FSSpan
|
|
15
|
+
:font="font"
|
|
16
|
+
>
|
|
17
|
+
{{ $tr("ui.periodicfield.yearly.everyyear", "Every year") }}
|
|
18
|
+
</FSSpan>
|
|
19
|
+
<FSSelectMonths
|
|
20
|
+
:editable="$props.editable"
|
|
21
|
+
:useAllMonths="false"
|
|
22
|
+
:hideHeader="true"
|
|
23
|
+
:modelValue="month"
|
|
24
|
+
@update:modelValue="onUpdateMonth($event)"
|
|
25
|
+
/>
|
|
26
|
+
<FSNumberField
|
|
27
|
+
:editable="$props.editable"
|
|
28
|
+
:hideHeader="true"
|
|
29
|
+
:clearable="false"
|
|
30
|
+
:modelValue="day"
|
|
31
|
+
@update:modelValue="onUpdateDay($event)"
|
|
32
|
+
/>
|
|
33
|
+
<FSSpan
|
|
34
|
+
:font="font"
|
|
35
|
+
>
|
|
36
|
+
{{ $tr("ui.periodicfield.yearly.at", "at") }}
|
|
37
|
+
</FSSpan>
|
|
38
|
+
<FSClock
|
|
39
|
+
:editable="$props.editable"
|
|
40
|
+
:color="ColorEnum.Light"
|
|
41
|
+
:hideHeader="true"
|
|
42
|
+
:slider="false"
|
|
43
|
+
:modelValue="time"
|
|
44
|
+
@update:modelValue="onUpdateHours($event)"
|
|
45
|
+
/>
|
|
46
|
+
</FSRow>
|
|
47
|
+
</template>
|
|
48
|
+
</FSRadioGroup>
|
|
49
|
+
</template>
|
|
50
|
+
|
|
51
|
+
<script lang="ts">
|
|
52
|
+
import { ref, defineComponent, computed } from "vue";
|
|
53
|
+
|
|
54
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
55
|
+
|
|
56
|
+
import FSSelectMonths from "../../selects/FSSelectMonths.vue";
|
|
57
|
+
import FSRadioGroup from "../../FSRadioGroup.vue";
|
|
58
|
+
import FSNumberField from "../FSNumberField.vue";
|
|
59
|
+
import FSClock from "../../FSClock.vue";
|
|
60
|
+
import FSSpan from "../../FSSpan.vue";
|
|
61
|
+
import FSRow from "../../FSRow.vue";
|
|
62
|
+
|
|
63
|
+
export default defineComponent({
|
|
64
|
+
name: "FSPeriodicDailyField",
|
|
65
|
+
components: {
|
|
66
|
+
FSSelectMonths,
|
|
67
|
+
FSNumberField,
|
|
68
|
+
FSRadioGroup,
|
|
69
|
+
FSClock,
|
|
70
|
+
FSSpan,
|
|
71
|
+
FSRow
|
|
72
|
+
},
|
|
73
|
+
props: {
|
|
74
|
+
modelValue: {
|
|
75
|
+
type: Array<string>,
|
|
76
|
+
required: true
|
|
77
|
+
},
|
|
78
|
+
editable: {
|
|
79
|
+
type: Boolean,
|
|
80
|
+
required: false,
|
|
81
|
+
default: true
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
emits: ["update:modelValue"],
|
|
85
|
+
setup(props, { emit }) {
|
|
86
|
+
const availableConfigurations = [
|
|
87
|
+
{ value: "custom", item: { value: "custom" } }
|
|
88
|
+
];
|
|
89
|
+
|
|
90
|
+
const selectedConfiguration = ref("custom");
|
|
91
|
+
|
|
92
|
+
const day = computed(() => {
|
|
93
|
+
return +props.modelValue[2];
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
const month = computed(() => {
|
|
97
|
+
return +props.modelValue[3] - 1;
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
const time = computed(() => {
|
|
101
|
+
return (+props.modelValue[1] * 60 + +props.modelValue[0]) * 1000 * 60;
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const onUpdateDay = (value: number) => {
|
|
105
|
+
const hours = Math.floor(value / (60 * 60 * 1000));
|
|
106
|
+
const minutes = Math.floor(value / (60 * 1000) % 60);
|
|
107
|
+
emit("update:modelValue", [`${minutes}`, `${hours}`, `${value}`, `${month.value + 1}`, "*"]);
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const onUpdateHours = (value: number) => {
|
|
111
|
+
const hours = Math.floor(value / (60 * 60 * 1000));
|
|
112
|
+
const minutes = Math.floor(value / (60 * 1000) % 60);
|
|
113
|
+
emit("update:modelValue", [`${minutes}`, `${hours}`, `${day.value}`, `${month.value + 1}`, "*"]);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const onUpdateMonth = (value: number) => {
|
|
117
|
+
const hours = Math.floor(value / (60 * 60 * 1000));
|
|
118
|
+
const minutes = Math.floor(value / (60 * 1000) % 60);
|
|
119
|
+
emit("update:modelValue", [`${minutes}`, `${hours}`, `${day.value}`, `${value + 1}`, "*"]);
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
return {
|
|
123
|
+
availableConfigurations,
|
|
124
|
+
selectedConfiguration,
|
|
125
|
+
ColorEnum,
|
|
126
|
+
month,
|
|
127
|
+
time,
|
|
128
|
+
day,
|
|
129
|
+
onUpdateHours,
|
|
130
|
+
onUpdateMonth,
|
|
131
|
+
onUpdateDay
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
</script>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSSelectField
|
|
3
|
+
:clearable="false"
|
|
4
|
+
:items="months"
|
|
5
|
+
:modelValue="$props.modelValue"
|
|
6
|
+
@update:modelValue="$emit('update:modelValue', $event)"
|
|
7
|
+
v-bind="$attrs"
|
|
8
|
+
/>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script lang="ts">
|
|
12
|
+
import type { PropType} from "vue";
|
|
13
|
+
import { computed, defineComponent } from "vue";
|
|
14
|
+
|
|
15
|
+
import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
|
|
16
|
+
import { Months } from "@dative-gpi/foundation-shared-domain/models";
|
|
17
|
+
|
|
18
|
+
import FSSelectField from "../fields/FSSelectField.vue";
|
|
19
|
+
|
|
20
|
+
export default defineComponent({
|
|
21
|
+
name: "FSSelectMonths",
|
|
22
|
+
components: {
|
|
23
|
+
FSSelectField
|
|
24
|
+
},
|
|
25
|
+
props: {
|
|
26
|
+
modelValue: {
|
|
27
|
+
type: Number as PropType<Months>,
|
|
28
|
+
required: false,
|
|
29
|
+
default: Months.January
|
|
30
|
+
},
|
|
31
|
+
useAllMonths: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
required: false,
|
|
34
|
+
default: true
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
emits: ["update:modelValue"],
|
|
38
|
+
setup(props) {
|
|
39
|
+
const { $tr } = useTranslationsProvider();
|
|
40
|
+
|
|
41
|
+
const months = computed((): { id: Months; label: string }[] => {
|
|
42
|
+
const items = [
|
|
43
|
+
{ id: Months.January, label: $tr("ui.months.january", "January") },
|
|
44
|
+
{ id: Months.February, label: $tr("ui.months.february", "February") },
|
|
45
|
+
{ id: Months.March, label: $tr("ui.months.march", "March") },
|
|
46
|
+
{ id: Months.April, label: $tr("ui.months.april", "April") },
|
|
47
|
+
{ id: Months.May, label: $tr("ui.months.may", "May") },
|
|
48
|
+
{ id: Months.June, label: $tr("ui.months.june", "June") },
|
|
49
|
+
{ id: Months.July, label: $tr("ui.months.july", "July") },
|
|
50
|
+
{ id: Months.August, label: $tr("ui.months.august", "August") },
|
|
51
|
+
{ id: Months.September, label: $tr("ui.months.september", "September") },
|
|
52
|
+
{ id: Months.October, label: $tr("ui.months.october", "October") },
|
|
53
|
+
{ id: Months.November, label: $tr("ui.months.november", "November") },
|
|
54
|
+
{ id: Months.December, label: $tr("ui.months.december", "December") }
|
|
55
|
+
];
|
|
56
|
+
if (props.useAllMonths) {
|
|
57
|
+
items.unshift({ id: Months.AllMonths, label: $tr("ui.months.all-months", "All months") });
|
|
58
|
+
}
|
|
59
|
+
return items;
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
months
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
</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.30",
|
|
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.30",
|
|
14
|
+
"@dative-gpi/foundation-shared-services": "1.0.30"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"@dative-gpi/bones-ui": "^0.0.75",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"sass": "1.71.1",
|
|
36
36
|
"sass-loader": "13.3.2"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "33f1a6d59ab513176b3710729a39ec701462fdfb"
|
|
39
39
|
}
|
|
@@ -11,4 +11,15 @@
|
|
|
11
11
|
|
|
12
12
|
.fs-radio-description {
|
|
13
13
|
color: var(--fs-radio-color) !important;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.fs-radio-label .v-input__control {
|
|
17
|
+
@include web {
|
|
18
|
+
height: 40px !important;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@include mobile {
|
|
22
|
+
height: 36px !important;
|
|
23
|
+
}
|
|
24
|
+
grid-area: 1 / 2 / 3 / 3 !important;
|
|
14
25
|
}
|