@dative-gpi/foundation-shared-components 1.0.87 → 1.0.88
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/calendar/FSSimpleCalendar.vue +3 -18
- package/components/fields/FSRichTextField.vue +40 -27
- package/components/fields/FSSearchField.vue +7 -114
- package/components/fields/FSTimeRangeField.vue +104 -180
- package/components/fields/FSTranslateRichTextField.vue +7 -4
- package/components/lists/FSDataTableUI.vue +5 -1
- package/components/lists/FSFilterButton.vue +0 -1
- package/components/lists/FSSimpleList.vue +0 -1
- package/components/lists/FSSimpleListItem.vue +1 -0
- package/components/tiles/FSCommentTileUI.vue +26 -5
- package/models/variableNode.ts +8 -5
- package/package.json +4 -4
- package/styles/components/index.scss +0 -1
- package/tools/alertsTools.ts +15 -1
- package/tools/chartsTools.ts +145 -18
- package/tools/timeRangeTools.ts +99 -40
- package/components/fields/FSTimeSlotField.vue +0 -250
- package/styles/components/fs_timeslot_field.scss +0 -12
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
}"
|
|
14
14
|
align="center-center"
|
|
15
15
|
>
|
|
16
|
-
{{
|
|
16
|
+
{{ dayLabel(i - 1) }}
|
|
17
17
|
</FSCol>
|
|
18
18
|
</FSRow>
|
|
19
19
|
<FSRow>
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
import { startOfWeek, endOfWeek, endOfMonth, isSameDay, isBefore, isAfter, isSameMonth, addDays } from "date-fns";
|
|
41
41
|
import { defineComponent, computed } from "vue";
|
|
42
42
|
|
|
43
|
-
import {
|
|
43
|
+
import { dayLabel } from "../../tools";
|
|
44
44
|
|
|
45
45
|
import { useAppTimeZone } from "@dative-gpi/foundation-shared-services/composables";
|
|
46
46
|
|
|
@@ -68,24 +68,9 @@ export default defineComponent({
|
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
70
|
setup(props) {
|
|
71
|
-
const { $tr } = useTranslations();
|
|
72
71
|
|
|
73
72
|
const { getMachineOffset } = useAppTimeZone();
|
|
74
73
|
|
|
75
|
-
const day = (i: number) => {
|
|
76
|
-
switch(i)
|
|
77
|
-
{
|
|
78
|
-
case 0 : return $tr("ui.common.monday", "Monday");
|
|
79
|
-
case 1 : return $tr("ui.common.tuesday", "Tuesday");
|
|
80
|
-
case 2 : return $tr("ui.common.wednesday", "Wednesday");
|
|
81
|
-
case 3 : return $tr("ui.common.thursday", "Thursday");
|
|
82
|
-
case 4 : return $tr("ui.common.friday", "Friday");
|
|
83
|
-
case 5 : return $tr("ui.common.saturday", "Saturday");
|
|
84
|
-
case 6 : return $tr("ui.common.sunday", "Sunday");
|
|
85
|
-
default: return "";
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
|
|
89
74
|
const firstDayOfMonth = computed(() => {
|
|
90
75
|
const date = new Date(props.year, props.month - 1, 1);
|
|
91
76
|
const offset = getMachineOffset();
|
|
@@ -155,7 +140,7 @@ export default defineComponent({
|
|
|
155
140
|
});
|
|
156
141
|
|
|
157
142
|
return {
|
|
158
|
-
|
|
143
|
+
dayLabel,
|
|
159
144
|
days
|
|
160
145
|
};
|
|
161
146
|
|
|
@@ -191,8 +191,8 @@
|
|
|
191
191
|
>
|
|
192
192
|
<div
|
|
193
193
|
class="fs-rich-text-field-content"
|
|
194
|
-
:data-variable-values="
|
|
195
|
-
:contenteditable="!readonly && $props.editable"
|
|
194
|
+
:data-variable-values="variableValues"
|
|
195
|
+
:contenteditable="!readonly && $props.editable && !loading"
|
|
196
196
|
:data-readonly="$props.variant === 'readonly'"
|
|
197
197
|
:id="id"
|
|
198
198
|
/>
|
|
@@ -275,7 +275,7 @@ export default defineComponent({
|
|
|
275
275
|
default: null
|
|
276
276
|
},
|
|
277
277
|
modelValue: {
|
|
278
|
-
type: String as PropType<string | null>,
|
|
278
|
+
type: [Object, String] as PropType<{ [key: string]: any } | string | null>,
|
|
279
279
|
required: false,
|
|
280
280
|
default: null
|
|
281
281
|
},
|
|
@@ -323,6 +323,7 @@ export default defineComponent({
|
|
|
323
323
|
const lights = getColors(ColorEnum.Light);
|
|
324
324
|
const darks = getColors(ColorEnum.Dark);
|
|
325
325
|
|
|
326
|
+
const loading = ref(true);
|
|
326
327
|
const canUndo = ref(false);
|
|
327
328
|
const isLink = ref(false);
|
|
328
329
|
const isBold = ref(false);
|
|
@@ -375,16 +376,8 @@ export default defineComponent({
|
|
|
375
376
|
registerRichText(editor);
|
|
376
377
|
registerHistory(editor, createEmptyHistoryState(), 250);
|
|
377
378
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
editor.setEditorState(editor.parseEditorState(props.modelValue!));
|
|
381
|
-
});
|
|
382
|
-
}
|
|
383
|
-
else {
|
|
384
|
-
editor.update((): void => {
|
|
385
|
-
editor.setEditorState(editor.parseEditorState(emptyLexicalState));
|
|
386
|
-
});
|
|
387
|
-
}
|
|
379
|
+
updateEditorState();
|
|
380
|
+
loading.value = false;
|
|
388
381
|
});
|
|
389
382
|
|
|
390
383
|
const readonly = computed((): boolean => {
|
|
@@ -478,6 +471,10 @@ export default defineComponent({
|
|
|
478
471
|
}
|
|
479
472
|
});
|
|
480
473
|
|
|
474
|
+
const variableValues = computed(() => {
|
|
475
|
+
return JSON.stringify(props.variableValues)
|
|
476
|
+
});
|
|
477
|
+
|
|
481
478
|
const updateToolbar = (): void => {
|
|
482
479
|
const selection = $getSelection();
|
|
483
480
|
isVariable.value = false;
|
|
@@ -498,11 +495,16 @@ export default defineComponent({
|
|
|
498
495
|
editor.registerUpdateListener(({ editorState }) => {
|
|
499
496
|
editorState.read(() => {
|
|
500
497
|
updateToolbar();
|
|
501
|
-
if
|
|
502
|
-
|
|
498
|
+
if(loading.value) {
|
|
499
|
+
return;
|
|
503
500
|
}
|
|
504
|
-
|
|
501
|
+
const editorModelValue = JSON.stringify(editorState.toJSON());
|
|
502
|
+
if(editorModelValue === emptyLexicalState) {
|
|
505
503
|
emit("update:modelValue", null);
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
if(editorModelValue !== props.modelValue) {
|
|
507
|
+
emit("update:modelValue", editorModelValue);
|
|
506
508
|
}
|
|
507
509
|
});
|
|
508
510
|
});
|
|
@@ -665,24 +667,34 @@ export default defineComponent({
|
|
|
665
667
|
isLink.value = false;
|
|
666
668
|
}
|
|
667
669
|
|
|
668
|
-
|
|
669
|
-
if (JSON.stringify(editor.getEditorState().toJSON())
|
|
670
|
-
|
|
671
|
-
|
|
670
|
+
const updateEditorState = () => {
|
|
671
|
+
if (JSON.stringify(editor.getEditorState().toJSON()) === props.modelValue) {
|
|
672
|
+
return;
|
|
673
|
+
}
|
|
674
|
+
if (props.modelValue != null) {
|
|
675
|
+
editor.update(() => {
|
|
676
|
+
if(typeof props.modelValue === "string") {
|
|
672
677
|
editor.setEditorState(editor.parseEditorState(props.modelValue!));
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
}
|
|
678
|
+
}
|
|
679
|
+
else {
|
|
680
|
+
editor.setEditorState(editor.parseEditorState(JSON.stringify(props.modelValue)));
|
|
681
|
+
}
|
|
682
|
+
});
|
|
683
|
+
return;
|
|
680
684
|
}
|
|
685
|
+
editor.update(() => {
|
|
686
|
+
editor.setEditorState(editor.parseEditorState(emptyLexicalState));
|
|
687
|
+
});
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
watch(() => props.modelValue, () => {
|
|
691
|
+
updateEditorState();
|
|
681
692
|
});
|
|
682
693
|
|
|
683
694
|
return {
|
|
684
695
|
FORMAT_ELEMENT_COMMAND,
|
|
685
696
|
FORMAT_TEXT_COMMAND,
|
|
697
|
+
variableValues,
|
|
686
698
|
toolbarColors,
|
|
687
699
|
menuVariable,
|
|
688
700
|
UNDO_COMMAND,
|
|
@@ -690,6 +702,7 @@ export default defineComponent({
|
|
|
690
702
|
readonly,
|
|
691
703
|
linkUrl,
|
|
692
704
|
classes,
|
|
705
|
+
loading,
|
|
693
706
|
isEmpty,
|
|
694
707
|
editor,
|
|
695
708
|
isLink,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<FSTextField
|
|
3
3
|
class="fs-search-field"
|
|
4
|
-
:editable="$props.editable"
|
|
5
4
|
:placeholder="placeholder"
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
:modelValue="$props.modelValue"
|
|
6
|
+
prependInnerIcon="mdi-magnify"
|
|
7
|
+
@update:modelValue="$emit('update:modelValue', $event)"
|
|
8
8
|
v-bind="$attrs"
|
|
9
9
|
>
|
|
10
10
|
<template
|
|
11
|
-
v-for="(_, name) in slots"
|
|
11
|
+
v-for="(_, name) in $slots"
|
|
12
12
|
v-slot:[name]="slotData"
|
|
13
13
|
>
|
|
14
14
|
<slot
|
|
@@ -16,60 +16,20 @@
|
|
|
16
16
|
v-bind="slotData"
|
|
17
17
|
/>
|
|
18
18
|
</template>
|
|
19
|
-
<template
|
|
20
|
-
v-if="$props.prependInnerIcon || $slots['prepend-inner']"
|
|
21
|
-
#prepend-inner
|
|
22
|
-
>
|
|
23
|
-
<FSButton
|
|
24
|
-
v-if="$props.prependInnerIcon"
|
|
25
|
-
variant="icon"
|
|
26
|
-
:icon="$props.prependInnerIcon"
|
|
27
|
-
:editable="$props.editable"
|
|
28
|
-
:color="ColorEnum.Dark"
|
|
29
|
-
@click="onSearch"
|
|
30
|
-
/>
|
|
31
|
-
<slot
|
|
32
|
-
name="prepend-inner"
|
|
33
|
-
/>
|
|
34
|
-
</template>
|
|
35
|
-
<template
|
|
36
|
-
v-if="$props.variant !== 'instant' || $slots.append"
|
|
37
|
-
#append
|
|
38
|
-
>
|
|
39
|
-
<FSButton
|
|
40
|
-
v-if="$props.variant !== 'instant'"
|
|
41
|
-
:prependIcon="$props.buttonPrependIcon"
|
|
42
|
-
:label="buttonLabel"
|
|
43
|
-
:appendIcon="$props.buttonAppendIcon"
|
|
44
|
-
:variant="$props.buttonVariant"
|
|
45
|
-
:color="$props.buttonColor"
|
|
46
|
-
:editable="$props.editable"
|
|
47
|
-
@click="onSearch"
|
|
48
|
-
/>
|
|
49
|
-
<slot
|
|
50
|
-
name="append"
|
|
51
|
-
/>
|
|
52
|
-
</template>
|
|
53
19
|
</FSTextField>
|
|
54
20
|
</template>
|
|
55
21
|
|
|
56
22
|
<script lang="ts">
|
|
57
|
-
import type
|
|
58
|
-
import { computed, defineComponent, ref, watch } from "vue";
|
|
23
|
+
import { computed, defineComponent, type PropType } from "vue";
|
|
59
24
|
|
|
60
25
|
import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
|
|
61
|
-
import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
62
|
-
|
|
63
|
-
import { useSlots } from "../../composables";
|
|
64
26
|
|
|
65
27
|
import FSTextField from "./FSTextField.vue";
|
|
66
|
-
import FSButton from "../FSButton.vue";
|
|
67
28
|
|
|
68
29
|
export default defineComponent({
|
|
69
30
|
name: "FSSearchField",
|
|
70
31
|
components: {
|
|
71
|
-
FSTextField
|
|
72
|
-
FSButton
|
|
32
|
+
FSTextField
|
|
73
33
|
},
|
|
74
34
|
props: {
|
|
75
35
|
placeholder: {
|
|
@@ -77,89 +37,22 @@ export default defineComponent({
|
|
|
77
37
|
required: false,
|
|
78
38
|
default: null
|
|
79
39
|
},
|
|
80
|
-
prependInnerIcon: {
|
|
81
|
-
type: String as PropType<string | null>,
|
|
82
|
-
required: false,
|
|
83
|
-
default: "mdi-magnify"
|
|
84
|
-
},
|
|
85
|
-
variant: {
|
|
86
|
-
type: String as PropType<"standard" | "instant">,
|
|
87
|
-
required: false,
|
|
88
|
-
default: "instant"
|
|
89
|
-
},
|
|
90
|
-
buttonPrependIcon: {
|
|
91
|
-
type: String as PropType<string | null>,
|
|
92
|
-
required: false,
|
|
93
|
-
default: null
|
|
94
|
-
},
|
|
95
|
-
buttonLabel: {
|
|
96
|
-
type: String as PropType<string | null>,
|
|
97
|
-
required: false,
|
|
98
|
-
default: null
|
|
99
|
-
},
|
|
100
|
-
buttonAppendIcon: {
|
|
101
|
-
type: String as PropType<string | null>,
|
|
102
|
-
required: false,
|
|
103
|
-
default: null
|
|
104
|
-
},
|
|
105
|
-
buttonVariant: {
|
|
106
|
-
type: String as PropType<"standard" | "full" | "icon">,
|
|
107
|
-
required: false,
|
|
108
|
-
default: "standard"
|
|
109
|
-
},
|
|
110
40
|
modelValue: {
|
|
111
41
|
type: String as PropType<string | null>,
|
|
112
42
|
required: false,
|
|
113
43
|
default: null
|
|
114
|
-
},
|
|
115
|
-
buttonColor: {
|
|
116
|
-
type: String as PropType<ColorBase>,
|
|
117
|
-
required: false,
|
|
118
|
-
default: ColorEnum.Primary
|
|
119
|
-
},
|
|
120
|
-
editable: {
|
|
121
|
-
type: Boolean,
|
|
122
|
-
required: false,
|
|
123
|
-
default: true
|
|
124
44
|
}
|
|
125
45
|
},
|
|
126
46
|
emits: ["update:modelValue"],
|
|
127
|
-
setup(props
|
|
47
|
+
setup(props) {
|
|
128
48
|
const { $tr } = useTranslationsProvider();
|
|
129
|
-
const { slots } = useSlots();
|
|
130
|
-
|
|
131
|
-
delete slots["prepend-inner"];
|
|
132
|
-
delete slots.append;
|
|
133
|
-
|
|
134
|
-
const innerValue = ref(props.modelValue);
|
|
135
49
|
|
|
136
50
|
const placeholder = computed(() => {
|
|
137
51
|
return props.placeholder ?? $tr('ui.search.placeholder', 'Search...');
|
|
138
52
|
});
|
|
139
53
|
|
|
140
|
-
const buttonLabel = computed(() => {
|
|
141
|
-
return props.buttonLabel ?? $tr('ui.button.search', 'Search');
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
const onSearch = (event: Event) => {
|
|
145
|
-
event.stopImmediatePropagation();
|
|
146
|
-
event.preventDefault();
|
|
147
|
-
emit('update:modelValue', innerValue.value);
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
watch(innerValue, () => {
|
|
151
|
-
if (["instant"].includes(props.variant)) {
|
|
152
|
-
emit("update:modelValue", innerValue.value);
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
|
|
156
54
|
return {
|
|
157
55
|
placeholder,
|
|
158
|
-
buttonLabel,
|
|
159
|
-
innerValue,
|
|
160
|
-
ColorEnum,
|
|
161
|
-
slots,
|
|
162
|
-
onSearch
|
|
163
56
|
};
|
|
164
57
|
}
|
|
165
58
|
});
|