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

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.
@@ -67,7 +67,7 @@
67
67
  <script lang="ts">
68
68
  import { computed, defineComponent, onMounted, type PropType, ref, type StyleValue } from "vue";
69
69
 
70
- import { useAppTimeZone, useAppLanguageCode } from "@dative-gpi/foundation-shared-services/composables";
70
+ import { useDateFormat, useAppLanguageCode } from "@dative-gpi/foundation-shared-services/composables";
71
71
  import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
72
72
  import { useColors } from "@dative-gpi/foundation-shared-components/composables";
73
73
 
@@ -108,7 +108,7 @@ export default defineComponent({
108
108
  },
109
109
  emits: ["update:modelValue"],
110
110
  setup(props, { emit }) {
111
- const { epochToPicker, pickerToEpoch, todayToEpoch } = useAppTimeZone();
111
+ const { epochToPicker, pickerToEpoch, todayToEpoch } = useDateFormat();
112
112
  const { languageCode } = useAppLanguageCode();
113
113
  const { getColors } = useColors();
114
114
 
@@ -114,7 +114,7 @@
114
114
  <script lang="ts">
115
115
  import { computed, defineComponent, onMounted, type PropType, ref, type StyleValue } from "vue";
116
116
 
117
- import { useAppTimeZone, useAppLanguageCode } from "@dative-gpi/foundation-shared-services/composables";
117
+ import { useDateFormat, useAppLanguageCode } from "@dative-gpi/foundation-shared-services/composables";
118
118
  import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
119
119
  import { useColors } from "@dative-gpi/foundation-shared-components/composables";
120
120
 
@@ -155,7 +155,7 @@ export default defineComponent({
155
155
  },
156
156
  emits: ["update:modelValue"],
157
157
  setup(props, { emit }) {
158
- const { epochToPicker, epochToPickerHeader, pickerToEpoch, todayToEpoch } = useAppTimeZone();
158
+ const { epochToPicker, epochToPickerHeader, pickerToEpoch, todayToEpoch } = useDateFormat();
159
159
  const { languageCode } = useAppLanguageCode();
160
160
  const { getColors } = useColors();
161
161
 
@@ -55,7 +55,7 @@
55
55
  import { computed, defineComponent, type PropType, ref, type StyleValue, watch } from "vue";
56
56
 
57
57
  import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
58
- import { useAppTimeZone } from "@dative-gpi/foundation-shared-services/composables";
58
+ import { useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
59
59
  import { useColors } from "@dative-gpi/foundation-shared-components/composables";
60
60
 
61
61
  import FSSlider from "./FSSlider.vue";
@@ -98,7 +98,7 @@ export default defineComponent({
98
98
  },
99
99
  emits: ["update:modelValue"],
100
100
  setup(props, { emit }) {
101
- const { epochToLongDateFormat } = useAppTimeZone();
101
+ const { epochToLongDateFormat } = useDateFormat();
102
102
  const { getColors } = useColors();
103
103
 
104
104
  const colors = computed(() => getColors(props.color));
@@ -58,7 +58,7 @@
58
58
  import { computed, defineComponent, type PropType } from "vue";
59
59
 
60
60
  import type { FSDeviceConnectivity } from "@dative-gpi/foundation-shared-components/models";
61
- import { useAppTimeZone } from "@dative-gpi/foundation-shared-services/composables";
61
+ import { useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
62
62
 
63
63
  import { connectivityLabel } from "../../utils";
64
64
 
@@ -89,7 +89,7 @@ export default defineComponent({
89
89
  },
90
90
  emit: ["close"],
91
91
  setup(props) {
92
- const { epochToLongTimeFormat } = useAppTimeZone();
92
+ const { epochToLongTimeFormat } = useDateFormat();
93
93
 
94
94
  const deviceTimestamp = computed((): string => {
95
95
  if (props.deviceConnectivity.sourceTimestamp) {
@@ -71,7 +71,7 @@
71
71
  import { computed, defineComponent, type PropType } from "vue";
72
72
 
73
73
  import type { FSDeviceStatusGroup, FSModelStatus } from "@dative-gpi/foundation-shared-components/models";
74
- import { useAppTimeZone } from "@dative-gpi/foundation-shared-services/composables";
74
+ import { useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
75
75
 
76
76
  import FSButton from "../FSButton.vue";
77
77
  import FSCard from "../FSCard.vue";
@@ -108,7 +108,7 @@ export default defineComponent({
108
108
  },
109
109
  emits: ["close"],
110
110
  setup(props) {
111
- const { epochToLongTimeFormat } = useAppTimeZone();
111
+ const { epochToLongTimeFormat } = useDateFormat();
112
112
 
113
113
  const statusLabel = computed((): string => {
114
114
  return props.statusGroup.label || props.modelStatus.label;
@@ -61,7 +61,7 @@ import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui
61
61
  import type { FSDeviceAlert} from "@dative-gpi/foundation-shared-components/models";
62
62
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
63
63
  import { AlertStatus, Criticity } from "@dative-gpi/foundation-shared-domain/models";
64
- import { useAppTimeZone } from "@dative-gpi/foundation-shared-services/composables";
64
+ import { useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
65
65
 
66
66
  import FSButton from "../FSButton.vue";
67
67
  import FSCard from "../FSCard.vue";
@@ -90,7 +90,7 @@ export default defineComponent({
90
90
  },
91
91
  emits: ["close"],
92
92
  setup(props) {
93
- const { epochToLongTimeFormat } = useAppTimeZone();
93
+ const { epochToLongTimeFormat } = useDateFormat();
94
94
  const { $tr } = useTranslationsProvider();
95
95
 
96
96
  const criticityColor = computed(() => {
@@ -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
  }
@@ -25,48 +25,29 @@
25
25
  :clearable="false"
26
26
  :editable="$props.editable"
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-append="{ item }"
33
33
  >
34
34
  <FSRow
35
35
  class="fs-gradient-field-preview"
36
- height="fill"
36
+ height="20px"
37
37
  width="100%"
38
- :style="{ '--fs-gradient-field-background': `linear-gradient(to right, ${encodeGradientCssColors(JSON.parse(item.value))})` }"
38
+ align="center-center"
39
+ :style="{ '--fs-gradient-field-background': `linear-gradient(to right, ${encodeGradientCssColors(allGradients[item.id])})` }"
39
40
  >
40
41
  <span />
41
42
  </FSRow>
42
43
  </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>
62
- </template>
63
44
  </FSSelectField>
64
45
  </FSBaseField>
65
46
  </FSCol>
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
 
@@ -68,7 +68,7 @@
68
68
  :rules="[DateRules.required()]"
69
69
  :editable="$props.editable"
70
70
  :hideHeader="true"
71
- :modelValue="[parseForPicker(innerStartDate)!, parseForPicker(innerEndDate)!]"
71
+ :modelValue="actualValue"
72
72
  @update:modelValue="onPickDates"
73
73
  />
74
74
  </FSRow>
@@ -81,7 +81,7 @@ import { computed, defineComponent, type PropType, ref, watch } from "vue";
81
81
  import _ from "lodash";
82
82
 
83
83
  import { DateRules, NumberRules, TextRules } from "@dative-gpi/foundation-shared-components/models";
84
- import { useAppTimeZone } from "@dative-gpi/foundation-shared-services/composables";
84
+ import { useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
85
85
  import { useRules } from "@dative-gpi/foundation-shared-components/composables";
86
86
  import { DateSetting } from "@dative-gpi/foundation-shared-domain/models";
87
87
 
@@ -163,7 +163,7 @@ export default defineComponent({
163
163
  },
164
164
  emits: ["update:startDate", "update:endDate"],
165
165
  setup(props, { emit }) {
166
- const { parseForPicker, formatFromPicker, todayToPicker, yesterdayToPicker } = useAppTimeZone();
166
+ const { parseForPicker, epochToISO, todayToPicker, yesterdayToPicker } = useDateFormat();
167
167
  const { getMessages } = useRules();
168
168
 
169
169
  const innerDateSetting = ref<DateSetting>(DateSetting.PastDays);
@@ -181,6 +181,14 @@ export default defineComponent({
181
181
  ];
182
182
  });
183
183
 
184
+ const actualValue = computed(() => {
185
+ const dates = [parseForPicker(innerStartDate.value), parseForPicker(innerEndDate.value)]
186
+ if(dates.some(d => d == null)) {
187
+ return null;
188
+ }
189
+ return dates as [number, number];
190
+ })
191
+
184
192
  const messages = computed((): string[] => {
185
193
  return props.messages ??
186
194
  getMessages(props.startDate, props.rules).concat(getMessages(props.endDate, props.rules));
@@ -418,14 +426,14 @@ export default defineComponent({
418
426
  }
419
427
  else {
420
428
  console.log(value[0], value[1]);
421
- if (value && value[0] != null && formatFromPicker(value[0]) !== innerStartDate.value) {
422
- innerStartDate.value = formatFromPicker(value[0]);
429
+ if (value && value[0] != null && epochToISO(value[0]) !== innerStartDate.value) {
430
+ innerStartDate.value = epochToISO(value[0]);
423
431
  if (valid.value) {
424
432
  emit("update:startDate", innerStartDate.value);
425
433
  }
426
434
  }
427
- if (value && value[1] != null && formatFromPicker(value[1]) !== innerEndDate.value) {
428
- innerEndDate.value = formatFromPicker(value[1]);
435
+ if (value && value[1] != null && epochToISO(value[1]) !== innerEndDate.value) {
436
+ innerEndDate.value = epochToISO(value[1]);
429
437
  if (valid.value) {
430
438
  emit("update:endDate", innerEndDate.value);
431
439
  }
@@ -619,7 +627,7 @@ export default defineComponent({
619
627
  }
620
628
  }
621
629
 
622
- if (parseForPicker(props.endDate) != null && parseForPicker(props.startDate) != null) {
630
+ if (props.endDate && parseForPicker(props.endDate) != null && props.startDate && parseForPicker(props.startDate) != null) {
623
631
  innerDateSetting.value = DateSetting.Pick;
624
632
  innerDateValue.value = 1;
625
633
  return;
@@ -643,6 +651,7 @@ export default defineComponent({
643
651
  innerDateValue,
644
652
  innerStartDate,
645
653
  innerEndDate,
654
+ actualValue,
646
655
  pastSettings,
647
656
  DateSetting,
648
657
  NumberRules,
@@ -1,5 +1,6 @@
1
1
  <template>
2
2
  <FSSelectField
3
+ class="fs-select-date-setting"
3
4
  :items="dateSettings"
4
5
  :clearable="false"
5
6
  :modelValue="$props.modelValue"
package/models/rules.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
2
- import { useAppTimeZone } from "@dative-gpi/foundation-shared-services/composables";
2
+ import { useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
3
3
  import { validateExpression } from "@dative-gpi/foundation-shared-domain/tools";
4
4
 
5
5
  import { getTimeBestString } from "../utils";
6
6
  import type { TimeUnit } from "@/shared/foundation-shared-domain";
7
7
 
8
- const { epochToLongDateFormat } = useAppTimeZone()!;
8
+ const { epochToLongDateFormat } = useDateFormat()!;
9
9
  const { $tr } = useTranslationsProvider();
10
10
 
11
11
  export const TextRules = {
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.41",
4
+ "version": "1.0.42",
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.41",
14
- "@dative-gpi/foundation-shared-services": "1.0.41"
13
+ "@dative-gpi/foundation-shared-domain": "1.0.42",
14
+ "@dative-gpi/foundation-shared-services": "1.0.42"
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": "508299773d7c9704b08daf80c858931aaa823326"
38
+ "gitHead": "0c0ad1947f4b469307f0e9a5c636b4d5df11c589"
39
39
  }
@@ -1,8 +1,10 @@
1
1
 
2
2
  .fs-gradient-select-field .v-select__selection {
3
3
  width: 100%;
4
+ }
4
5
 
5
-
6
+ .fs-gradient-select-field .v-field {
7
+ grid-template-columns: min-content min-content minmax(0, 1fr) min-content;
6
8
  }
7
9
 
8
10
  .fs-gradient-field-preview {
@@ -0,0 +1,3 @@
1
+ .fs-select-field.fs-select-date-setting {
2
+ min-width: 160px;
3
+ }