@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.
@@ -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.43",
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.43",
14
+ "@dative-gpi/foundation-shared-services": "1.0.43"
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": "30a450a1f1843ffd8d38d5ff3f86c4349480ed74"
39
39
  }
@@ -1,16 +1,16 @@
1
+ .fs-gradient-field-select > .v-input__control > .v-field {
2
+ display: flex;
1
3
 
2
- .fs-gradient-select-field .v-select__selection {
3
- width: 100%;
4
-
5
-
6
- }
4
+ & > .v-field__prepend-inner {
5
+ flex: 1;
6
+ }
7
7
 
8
- .fs-gradient-field-preview {
9
- padding: 13px 20px;
10
- > span {
11
- height: 12px;
12
- background: var(--fs-gradient-field-background) !important;
13
- width: 100%;
8
+ & > .v-field__field {
9
+ flex: 0;
14
10
  }
15
11
  }
16
12
 
13
+ .fs-gradient-field-preview {
14
+ background: var(--fs-gradient-field-background) !important;
15
+ min-width: 100%;
16
+ }
@@ -0,0 +1,3 @@
1
+ .fs-select-field.fs-select-date-setting {
2
+ min-width: 160px;
3
+ }