@dative-gpi/foundation-shared-components 1.0.41 → 1.0.43

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.
@@ -152,7 +152,7 @@ import _ from "lodash";
152
152
 
153
153
  import { useBreakpoints, useRules } from "@dative-gpi/foundation-shared-components/composables";
154
154
  import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
155
- import { useAppTimeZone } from "@dative-gpi/foundation-shared-services/composables";
155
+ import { useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
156
156
 
157
157
  import FSDialogMenu from "../FSDialogMenu.vue";
158
158
  import FSTextField from "./FSTextField.vue";
@@ -215,7 +215,7 @@ export default defineComponent({
215
215
  },
216
216
  emits: ["update:modelValue"],
217
217
  setup(props, { emit }) {
218
- const { epochToLongDateFormat } = useAppTimeZone();
218
+ const { epochToLongDateFormat } = useDateFormat();
219
219
  const { validateOn, getMessages} = useRules();
220
220
  const { isExtraSmall } = useBreakpoints();
221
221
 
@@ -62,7 +62,7 @@ import { computed, defineComponent, type PropType, ref, watch } from "vue";
62
62
  import _ from "lodash";
63
63
 
64
64
  import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
65
- import { useAppTimeZone } from "@dative-gpi/foundation-shared-services/composables";
65
+ import { useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
66
66
  import { useRules } from "@dative-gpi/foundation-shared-components/composables";
67
67
 
68
68
  import FSDialogSubmit from "../FSDialogSubmit.vue";
@@ -123,7 +123,7 @@ export default defineComponent({
123
123
  emits: ["update:modelValue"],
124
124
  setup(props, { emit }) {
125
125
  const { validateOn, getMessages } = useRules();
126
- const { epochToShortDateFormat } = useAppTimeZone();
126
+ const { epochToShortDateFormat } = useDateFormat();
127
127
 
128
128
  const dialog = ref(false);
129
129
 
@@ -197,7 +197,7 @@ import { computed, defineComponent, type PropType, ref, watch } from "vue";
197
197
 
198
198
  import { useBreakpoints, useRules } from "@dative-gpi/foundation-shared-components/composables";
199
199
  import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
200
- import { useAppTimeZone } from "@dative-gpi/foundation-shared-services/composables";
200
+ import { useAppTimeZone, useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
201
201
 
202
202
  import FSDialogMenu from "../FSDialogMenu.vue";
203
203
  import FSTextField from "./FSTextField.vue";
@@ -264,7 +264,8 @@ export default defineComponent({
264
264
  },
265
265
  emits: ["update:modelValue"],
266
266
  setup(props, { emit }) {
267
- const { epochToLongTimeFormat, getOffsetUser } = useAppTimeZone();
267
+ const { getUserOffset } = useAppTimeZone();
268
+ const { epochToLongTimeFormat } = useDateFormat();
268
269
  const { validateOn, getMessages } = useRules();
269
270
  const { isExtraSmall } = useBreakpoints();
270
271
 
@@ -300,7 +301,7 @@ export default defineComponent({
300
301
  if (props.modelValue) {
301
302
  // FSClock just gives two numbers without consideration for the time zone
302
303
  // We must adjust the time to the user's time zone
303
- innerTime.value = Math.floor((props.modelValue + getOffsetUser()) % (24 * 60 * 60 * 1000));
304
+ innerTime.value = Math.floor((props.modelValue + getUserOffset()) % (24 * 60 * 60 * 1000));
304
305
  innerDate.value = props.modelValue - innerTime.value;
305
306
  }
306
307
  else {
@@ -79,7 +79,7 @@
79
79
  import { computed, defineComponent, type PropType, ref, watch } from "vue";
80
80
 
81
81
  import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
82
- import { useAppTimeZone } from "@dative-gpi/foundation-shared-services/composables";
82
+ import { useAppTimeZone, useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
83
83
  import { useRules } from "@dative-gpi/foundation-shared-components/composables";
84
84
 
85
85
  import FSDialogSubmit from "../FSDialogSubmit.vue";
@@ -115,7 +115,7 @@ export default defineComponent({
115
115
  modelValue: {
116
116
  type: Array as PropType<number[] | null>,
117
117
  required: false,
118
- default: null
118
+ default: () => null
119
119
  },
120
120
  color: {
121
121
  type: String as PropType<ColorBase>,
@@ -145,7 +145,8 @@ export default defineComponent({
145
145
  },
146
146
  emits: ["update:modelValue"],
147
147
  setup(props, { emit }) {
148
- const { epochToShortTimeFormat, getOffsetUser } = useAppTimeZone();
148
+ const { getUserOffset } = useAppTimeZone();
149
+ const { epochToShortTimeFormat } = useDateFormat();
149
150
  const { validateOn, getMessages } = useRules();
150
151
 
151
152
  const dialog = ref(false);
@@ -206,13 +207,13 @@ export default defineComponent({
206
207
  break;
207
208
  }
208
209
  case 1: {
209
- innerTimeLeft.value = Math.floor((props.modelValue[0] + getOffsetUser()) % (24 * 60 * 60 * 1000));
210
+ innerTimeLeft.value = Math.floor((props.modelValue[0] + getUserOffset()) % (24 * 60 * 60 * 1000));
210
211
  innerDateRange.value = [props.modelValue[0] - innerTimeLeft.value];
211
212
  break;
212
213
  }
213
214
  default: {
214
- innerTimeLeft.value = Math.floor((props.modelValue[0] + getOffsetUser()) % (24 * 60 * 60 * 1000));
215
- innerTimeRight.value = Math.floor((props.modelValue[1] + getOffsetUser()) % (24 * 60 * 60 * 1000));
215
+ innerTimeLeft.value = Math.floor((props.modelValue[0] + getUserOffset()) % (24 * 60 * 60 * 1000));
216
+ innerTimeRight.value = Math.floor((props.modelValue[1] + getUserOffset()) % (24 * 60 * 60 * 1000));
216
217
  innerDateRange.value = [props.modelValue[0] - innerTimeLeft.value, props.modelValue[1] - innerTimeRight.value];
217
218
  break;
218
219
  }
@@ -21,44 +21,25 @@
21
21
  />
22
22
  </FSRow>
23
23
  <FSSelectField
24
- class="fs-gradient-select-field"
25
- :clearable="false"
24
+ class="fs-gradient-field-select"
26
25
  :editable="$props.editable"
26
+ :clearable="false"
27
27
  :items="items"
28
- :modelValue="JSON.stringify($props.modelValue)"
29
- @update:modelValue="$emit('update:modelValue', presetGradients[$event])"
28
+ modelValue="custom"
29
+ @update:modelValue="$emit('update:modelValue', allGradients[$event])"
30
30
  >
31
31
  <template
32
- v-slot:selection="{ item }"
32
+ #item-prepend="{ item }"
33
33
  >
34
34
  <FSRow
35
35
  class="fs-gradient-field-preview"
36
- height="fill"
36
+ align="center-center"
37
+ height="12px"
37
38
  width="100%"
38
- :style="{ '--fs-gradient-field-background': `linear-gradient(to right, ${encodeGradientCssColors(JSON.parse(item.value))})` }"
39
- >
40
- <span />
41
- </FSRow>
42
- </template>
43
- <template
44
- v-slot:item="{ item, props }"
45
- >
46
- <v-list-item
47
- v-bind="props"
48
- >
49
- <template
50
- #title
51
- >
52
- <FSRow
53
- class="fs-gradient-field-preview"
54
- height="fill"
55
- width="100%"
56
- :style="{ '--fs-gradient-field-background': `linear-gradient(to right, ${encodeGradientCssColors(presetGradients[item.value])})` }"
57
- >
58
- <span />
59
- </FSRow>
60
- </template>
61
- </v-list-item>
39
+ :style="{
40
+ '--fs-gradient-field-background': `linear-gradient(to right, ${encodeGradientCssColors(allGradients[item.id])})`
41
+ }"
42
+ />
62
43
  </template>
63
44
  </FSSelectField>
64
45
  </FSBaseField>
@@ -66,7 +47,7 @@
66
47
  </template>
67
48
 
68
49
  <script lang="ts">
69
- import { type PropType, defineComponent } from "vue";
50
+ import { type PropType, defineComponent, computed } from "vue";
70
51
 
71
52
  import { groupedGradients } from "../../utils";
72
53
  import { useColors } from "../../composables";
@@ -127,14 +108,27 @@ export default defineComponent({
127
108
  const { getColors } = useColors();
128
109
 
129
110
  const presetGradients = groupedGradients[props.colorCount];
130
- const items = Object.keys(presetGradients)
111
+
112
+ const allGradients = computed<Record<string, string[]>>(() => {
113
+ return {
114
+ 'custom': [
115
+ ...props.modelValue
116
+ ],
117
+ ...presetGradients
118
+ }
119
+ });
120
+
121
+ const items = Object.keys(allGradients.value).map((key) => ({
122
+ id: key,
123
+ label: null
124
+ }));
131
125
 
132
126
  const encodeGradientCssColors = (colors: string[]) => {
133
127
  return colors.map((color) => getColors(color).base).join(", ");
134
128
  };
135
129
 
136
130
  return {
137
- presetGradients,
131
+ allGradients,
138
132
  items,
139
133
  encodeGradientCssColors
140
134
  };
@@ -62,7 +62,7 @@ import { computed, defineComponent, type PropType } from "vue";
62
62
 
63
63
  import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
64
64
 
65
- import { useAppTimeZone } from "@dative-gpi/foundation-shared-services/composables";
65
+ import { useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
66
66
 
67
67
  import { useMagicFieldProvider } from "../../composables";
68
68
  import { MagicFieldType } from "../../models/magicFields";
@@ -105,7 +105,7 @@ export default defineComponent({
105
105
  },
106
106
  emits: ["update:modelValue"],
107
107
  setup(props, { emit }) {
108
- const { epochToShortTimeFormat } = useAppTimeZone();
108
+ const { epochToShortTimeFormat } = useDateFormat();
109
109
  const { $tr } = useTranslationsProvider();
110
110
  const { get } = useMagicFieldProvider();
111
111