@dative-gpi/foundation-shared-components 1.0.177 → 1.0.179-edit-image

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.
@@ -13,7 +13,7 @@ import { computed, defineComponent, type PropType } from "vue";
13
13
 
14
14
  import { IMAGE_RAW_URL } from "@dative-gpi/foundation-shared-services/config";
15
15
 
16
- import { useImage } from "@dative-gpi/foundation-shared-services/composables";
16
+ import { useImage, useAppAuthToken } from "@dative-gpi/foundation-shared-services/composables";
17
17
 
18
18
  import FSEditImageUI from "./FSEditImageUI.vue";
19
19
 
@@ -32,10 +32,11 @@ export default defineComponent({
32
32
  emits: ["update:imageId"],
33
33
  setup(props) {
34
34
  const { get: getImage, entity: image } = useImage();
35
+ const { authToken } = useAppAuthToken();
35
36
 
36
37
  const source = computed(() => {
37
- return props.imageId ? IMAGE_RAW_URL(props.imageId) : null;
38
- })
38
+ return props.imageId ? IMAGE_RAW_URL(props.imageId, authToken.value) : null;
39
+ });
39
40
 
40
41
  const onError = (): void => {
41
42
  if (props.imageId) {
@@ -84,7 +84,7 @@
84
84
  </template>
85
85
 
86
86
  <script lang="ts">
87
- import { computed, defineComponent, type PropType, ref, type StyleValue } from "vue";
87
+ import { computed, defineComponent, type PropType, ref, type StyleValue, watch } from "vue";
88
88
 
89
89
  import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
90
90
  import { useAppLanguages } from "@dative-gpi/foundation-shared-services/composables";
@@ -165,7 +165,10 @@ export default defineComponent({
165
165
 
166
166
  const dialog = ref(false);
167
167
 
168
- const innerTranslations = ref(props.translations);
168
+ const innerTranslations = ref<{
169
+ languageCode: string;
170
+ [key: string]: string | null;
171
+ }[]>(props.translations);
169
172
 
170
173
  const lights = getColors(ColorEnum.Light);
171
174
  const darks = getColors(ColorEnum.Dark);
@@ -189,7 +192,8 @@ export default defineComponent({
189
192
  if (!translation || !translation[props.property]) {
190
193
  return "";
191
194
  }
192
- return translation[props.property];
195
+
196
+ return translation[props.property] ?? "";
193
197
  };
194
198
 
195
199
  const setTranslation = (languageCode: string, value: string): void => {
@@ -219,6 +223,10 @@ export default defineComponent({
219
223
  }
220
224
  };
221
225
 
226
+ watch(() => props.translations, (newVal) => {
227
+ innerTranslations.value = newVal;
228
+ }, { immediate: true, deep: true });
229
+
222
230
  return {
223
231
  innerTranslations,
224
232
  ColorEnum,
@@ -86,7 +86,7 @@
86
86
  </template>
87
87
 
88
88
  <script lang="ts">
89
- import { computed, defineComponent, type PropType, ref, type StyleValue } from "vue";
89
+ import { computed, defineComponent, type PropType, ref, type StyleValue, watch } from "vue";
90
90
 
91
91
  import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
92
92
  import { useAppLanguages } from "@dative-gpi/foundation-shared-services/composables";
@@ -164,7 +164,10 @@ export default defineComponent({
164
164
 
165
165
  const dialog = ref(false);
166
166
 
167
- const innerTranslations = ref(props.translations);
167
+ const innerTranslations = ref<{
168
+ languageCode: string;
169
+ [key: string]: string | null;
170
+ }[]>(props.translations);
168
171
 
169
172
  const lights = getColors(ColorEnum.Light);
170
173
  const darks = getColors(ColorEnum.Dark);
@@ -188,7 +191,7 @@ export default defineComponent({
188
191
  if (!translation || !translation[props.property]) {
189
192
  return "";
190
193
  }
191
- return translation[props.property];
194
+ return translation[props.property] ?? "";
192
195
  };
193
196
 
194
197
  const setTranslation = (languageCode: string, value: string): void => {
@@ -218,6 +221,10 @@ export default defineComponent({
218
221
  }
219
222
  };
220
223
 
224
+ watch(() => props.translations, (newVal) => {
225
+ innerTranslations.value = newVal;
226
+ }, { immediate: true, deep: true });
227
+
221
228
  return {
222
229
  innerTranslations,
223
230
  ColorEnum,
@@ -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.179-edit-image",
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.179-edit-image",
14
+ "@dative-gpi/foundation-shared-services": "1.0.179-edit-image"
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": "72963582266af77cf47e4585c5540f61cf80958f"
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
+ }