@dative-gpi/foundation-shared-components 0.0.45 → 0.0.47
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/FSCheckbox.vue +61 -24
- package/components/FSGrid.vue +132 -0
- package/components/FSGridMosaic.vue +67 -0
- package/components/FSRadio.vue +62 -20
- package/components/FSSwitch.vue +29 -1
- package/components/buttons/FSButtonFile.vue +3 -2
- package/components/buttons/FSButtonFileIcon.vue +3 -2
- package/components/buttons/FSButtonFileLabel.vue +3 -2
- package/components/buttons/FSButtonFileMini.vue +3 -2
- package/components/fields/FSRichTextField.vue +8 -3
- package/models/grids.ts +12 -0
- package/models/index.ts +1 -0
- package/models/rules.ts +5 -1
- package/package.json +4 -4
- package/styles/components/fs_grid.scss +4 -0
- package/styles/components/index.scss +1 -0
- package/styles/globals/overrides.scss +25 -3
|
@@ -2,30 +2,43 @@
|
|
|
2
2
|
<FSCol
|
|
3
3
|
width="hug"
|
|
4
4
|
>
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
<v-checkbox
|
|
6
|
+
hide-details
|
|
7
|
+
:ripple="false"
|
|
8
|
+
:rules="$props.rules"
|
|
9
|
+
:validateOn="validateOn"
|
|
10
|
+
:modelValue="$props.modelValue"
|
|
11
|
+
@click.prevent
|
|
12
|
+
@blur="blurred = true"
|
|
13
|
+
v-bind="$attrs"
|
|
8
14
|
>
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
@click.stop="onToggle"
|
|
14
|
-
>
|
|
15
|
-
{{ icon }}
|
|
16
|
-
</FSIcon>
|
|
17
|
-
<slot>
|
|
18
|
-
<FSSpan
|
|
19
|
-
v-if="$props.label"
|
|
20
|
-
class="fs-checkbox-label"
|
|
15
|
+
<template #input>
|
|
16
|
+
<FSRow
|
|
17
|
+
align="center-left"
|
|
18
|
+
width="hug"
|
|
21
19
|
:style="style"
|
|
22
|
-
:font="font"
|
|
23
20
|
@click.stop="onToggle"
|
|
24
21
|
>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
<FSIcon
|
|
23
|
+
class="fs-checkbox"
|
|
24
|
+
size="l"
|
|
25
|
+
:style="style"
|
|
26
|
+
>
|
|
27
|
+
{{ icon }}
|
|
28
|
+
</FSIcon>
|
|
29
|
+
<slot>
|
|
30
|
+
<FSSpan
|
|
31
|
+
v-if="$props.label"
|
|
32
|
+
class="fs-checkbox-label"
|
|
33
|
+
:style="style"
|
|
34
|
+
:font="font"
|
|
35
|
+
>
|
|
36
|
+
{{ $props.label }}
|
|
37
|
+
</FSSpan>
|
|
38
|
+
</slot>
|
|
39
|
+
</FSRow>
|
|
40
|
+
</template>
|
|
41
|
+
</v-checkbox>
|
|
29
42
|
<slot name="description">
|
|
30
43
|
<FSSpan
|
|
31
44
|
v-if="$props.description"
|
|
@@ -42,8 +55,8 @@
|
|
|
42
55
|
<script lang="ts">
|
|
43
56
|
import { computed, defineComponent, PropType } from "vue";
|
|
44
57
|
|
|
58
|
+
import { useColors, useRules } from "@dative-gpi/foundation-shared-components/composables";
|
|
45
59
|
import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
46
|
-
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
47
60
|
|
|
48
61
|
import FSIcon from "./FSIcon.vue";
|
|
49
62
|
import FSSpan from "./FSSpan.vue";
|
|
@@ -74,15 +87,25 @@ export default defineComponent({
|
|
|
74
87
|
required: false,
|
|
75
88
|
default: false
|
|
76
89
|
},
|
|
90
|
+
indeterminate: {
|
|
91
|
+
type: Boolean,
|
|
92
|
+
required: false,
|
|
93
|
+
default: false
|
|
94
|
+
},
|
|
77
95
|
color: {
|
|
78
96
|
type: String as PropType<ColorBase>,
|
|
79
97
|
required: false,
|
|
80
98
|
default: ColorEnum.Primary
|
|
81
99
|
},
|
|
82
|
-
|
|
83
|
-
type:
|
|
100
|
+
rules: {
|
|
101
|
+
type: Array as PropType<Function[]>,
|
|
84
102
|
required: false,
|
|
85
|
-
default:
|
|
103
|
+
default: () => []
|
|
104
|
+
},
|
|
105
|
+
messages: {
|
|
106
|
+
type: Array as PropType<string[]>,
|
|
107
|
+
required: false,
|
|
108
|
+
default: null
|
|
86
109
|
},
|
|
87
110
|
editable: {
|
|
88
111
|
type: Boolean,
|
|
@@ -92,9 +115,11 @@ export default defineComponent({
|
|
|
92
115
|
},
|
|
93
116
|
emits: ["update:modelValue"],
|
|
94
117
|
setup(props, { emit }) {
|
|
118
|
+
const { validateOn, blurred, getMessages } = useRules();
|
|
95
119
|
const { getColors } = useColors();
|
|
96
120
|
|
|
97
121
|
const colors = computed(() => getColors(props.color));
|
|
122
|
+
const errors = getColors(ColorEnum.Error);
|
|
98
123
|
const lights = getColors(ColorEnum.Light);
|
|
99
124
|
const darks = getColors(ColorEnum.Dark);
|
|
100
125
|
|
|
@@ -106,6 +131,13 @@ export default defineComponent({
|
|
|
106
131
|
"--fs-checkbox-color" : lights.dark
|
|
107
132
|
};
|
|
108
133
|
}
|
|
134
|
+
if (messages.value.length) {
|
|
135
|
+
return {
|
|
136
|
+
"--fs-checkbox-cursor" : "pointer",
|
|
137
|
+
"--fs-checkbox-checkbox-color": errors.base,
|
|
138
|
+
"--fs-checkbox-color" : darks.base
|
|
139
|
+
}
|
|
140
|
+
}
|
|
109
141
|
return {
|
|
110
142
|
"--fs-checkbox-cursor" : "pointer",
|
|
111
143
|
"--fs-checkbox-checkbox-color": (props.modelValue || props.indeterminate) ? colors.value.base : darks.base,
|
|
@@ -117,6 +149,8 @@ export default defineComponent({
|
|
|
117
149
|
|
|
118
150
|
const font = computed((): string => props.modelValue ? "text-button" : "text-body");
|
|
119
151
|
|
|
152
|
+
const messages = computed((): string[] => props.messages ?? getMessages(props.modelValue, props.rules));
|
|
153
|
+
|
|
120
154
|
const onToggle = (): void => {
|
|
121
155
|
if (!props.editable) {
|
|
122
156
|
return;
|
|
@@ -125,6 +159,9 @@ export default defineComponent({
|
|
|
125
159
|
};
|
|
126
160
|
|
|
127
161
|
return {
|
|
162
|
+
validateOn,
|
|
163
|
+
messages,
|
|
164
|
+
blurred,
|
|
128
165
|
style,
|
|
129
166
|
icon,
|
|
130
167
|
font,
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSCol
|
|
3
|
+
gap="0"
|
|
4
|
+
>
|
|
5
|
+
<FSRow
|
|
6
|
+
v-for="(item, index) in $props.items"
|
|
7
|
+
align="center-center"
|
|
8
|
+
class="fs-grid-item"
|
|
9
|
+
padding="0 8px"
|
|
10
|
+
height="hug"
|
|
11
|
+
:style="style"
|
|
12
|
+
:key="index"
|
|
13
|
+
>
|
|
14
|
+
<FSCol
|
|
15
|
+
gap="2px"
|
|
16
|
+
>
|
|
17
|
+
<template v-if="headerSlot(item.code)">
|
|
18
|
+
<component
|
|
19
|
+
:is="headerSlot(item.code)"
|
|
20
|
+
v-bind="{ item }"
|
|
21
|
+
/>
|
|
22
|
+
</template>
|
|
23
|
+
<template v-else>
|
|
24
|
+
<FSText
|
|
25
|
+
:font="item.hideDefault ? 'text-body' : 'text-overline'"
|
|
26
|
+
>
|
|
27
|
+
{{ item.label }}
|
|
28
|
+
</FSText>
|
|
29
|
+
</template>
|
|
30
|
+
<template v-if="!item.hideDefault">
|
|
31
|
+
<template v-if="itemSlot(item.code)">
|
|
32
|
+
<component
|
|
33
|
+
:is="itemSlot(item.code)"
|
|
34
|
+
v-bind="{ item }"
|
|
35
|
+
/>
|
|
36
|
+
</template>
|
|
37
|
+
<template v-else>
|
|
38
|
+
<FSText>
|
|
39
|
+
{{ item.value }}
|
|
40
|
+
</FSText>
|
|
41
|
+
</template>
|
|
42
|
+
</template>
|
|
43
|
+
</FSCol>
|
|
44
|
+
<v-spacer />
|
|
45
|
+
<FSRow
|
|
46
|
+
v-if="itemEndSlot(item.code)"
|
|
47
|
+
align="center-right"
|
|
48
|
+
>
|
|
49
|
+
<component
|
|
50
|
+
:is="itemEndSlot(item.code)"
|
|
51
|
+
v-bind="{ item }"
|
|
52
|
+
/>
|
|
53
|
+
</FSRow>
|
|
54
|
+
</FSRow>
|
|
55
|
+
</FSCol>
|
|
56
|
+
</template>
|
|
57
|
+
|
|
58
|
+
<script lang="ts">
|
|
59
|
+
import { computed, defineComponent, PropType } from "vue";
|
|
60
|
+
|
|
61
|
+
import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
|
|
62
|
+
import { ColorEnum, GridItem } from "@dative-gpi/foundation-shared-components/models";
|
|
63
|
+
|
|
64
|
+
import FSText from "./FSText.vue";
|
|
65
|
+
import FSCol from "./FSCol.vue";
|
|
66
|
+
import FSRow from "./FSRow.vue";
|
|
67
|
+
|
|
68
|
+
export default defineComponent({
|
|
69
|
+
name: "FSGrid",
|
|
70
|
+
components: {
|
|
71
|
+
FSText,
|
|
72
|
+
FSCol,
|
|
73
|
+
FSRow
|
|
74
|
+
},
|
|
75
|
+
props: {
|
|
76
|
+
items: {
|
|
77
|
+
type: Array as PropType<GridItem[]>,
|
|
78
|
+
default: [],
|
|
79
|
+
required: false
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
setup() {
|
|
83
|
+
const { getColors } = useColors();
|
|
84
|
+
const { slots } = useSlots();
|
|
85
|
+
|
|
86
|
+
const lights = getColors(ColorEnum.Light);
|
|
87
|
+
|
|
88
|
+
const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
|
|
89
|
+
return {
|
|
90
|
+
"--fs-grid-border-color": lights.dark
|
|
91
|
+
};
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
const headerSlot = (code: string) => {
|
|
95
|
+
if (slots[`header.${code}`]) {
|
|
96
|
+
return slots[`header.${code}`];
|
|
97
|
+
}
|
|
98
|
+
else if (slots[`header`]) {
|
|
99
|
+
return slots[`header`];
|
|
100
|
+
}
|
|
101
|
+
return null;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const itemSlot = (code: string) => {
|
|
105
|
+
if (slots[`item.${code}`]) {
|
|
106
|
+
return slots[`item.${code}`];
|
|
107
|
+
}
|
|
108
|
+
else if (slots[`item`]) {
|
|
109
|
+
return slots[`item`];
|
|
110
|
+
}
|
|
111
|
+
return null;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const itemEndSlot = (code: string) => {
|
|
115
|
+
if (slots[`item-end.${code}`]) {
|
|
116
|
+
return slots[`item-end.${code}`];
|
|
117
|
+
}
|
|
118
|
+
else if (slots[`item-end`]) {
|
|
119
|
+
return slots[`item-end`];
|
|
120
|
+
}
|
|
121
|
+
return null;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
return {
|
|
125
|
+
style,
|
|
126
|
+
itemSlot,
|
|
127
|
+
headerSlot,
|
|
128
|
+
itemEndSlot
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
</script>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSRow
|
|
3
|
+
gap="32px"
|
|
4
|
+
>
|
|
5
|
+
<FSRow
|
|
6
|
+
v-for="(item, index) in items"
|
|
7
|
+
:width="width"
|
|
8
|
+
:key="index"
|
|
9
|
+
>
|
|
10
|
+
<FSCol
|
|
11
|
+
gap="16px"
|
|
12
|
+
>
|
|
13
|
+
<FSText
|
|
14
|
+
font="text-h3"
|
|
15
|
+
>
|
|
16
|
+
{{ item.categoryLabel }}
|
|
17
|
+
</FSText>
|
|
18
|
+
<FSGrid
|
|
19
|
+
:items="item.items"
|
|
20
|
+
/>
|
|
21
|
+
</FSCol>
|
|
22
|
+
</FSRow>
|
|
23
|
+
</FSRow>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script lang="ts">
|
|
27
|
+
import { computed, defineComponent, PropType } from "vue";
|
|
28
|
+
|
|
29
|
+
import { useBreakpoints } from "@dative-gpi/foundation-shared-components/composables";
|
|
30
|
+
import { GridMosaic } from "@dative-gpi/foundation-shared-components/models";
|
|
31
|
+
|
|
32
|
+
import FSGrid from "./FSGrid.vue";
|
|
33
|
+
import FSCol from "./FSCol.vue";
|
|
34
|
+
import FSRow from "./FSRow.vue";
|
|
35
|
+
|
|
36
|
+
export default defineComponent({
|
|
37
|
+
name: "FSGridMosaic",
|
|
38
|
+
components: {
|
|
39
|
+
FSGrid,
|
|
40
|
+
FSCol,
|
|
41
|
+
FSRow
|
|
42
|
+
},
|
|
43
|
+
props: {
|
|
44
|
+
items: {
|
|
45
|
+
type: Array as PropType<GridMosaic[]>,
|
|
46
|
+
default: [],
|
|
47
|
+
required: false
|
|
48
|
+
},
|
|
49
|
+
cols: {
|
|
50
|
+
type: Number as PropType<1 | 2>,
|
|
51
|
+
required: false,
|
|
52
|
+
default: 1
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
setup(props) {
|
|
56
|
+
const { isExtraSmall } = useBreakpoints();
|
|
57
|
+
|
|
58
|
+
const width = computed(() => {
|
|
59
|
+
return props.cols == 2 && !isExtraSmall.value ? "calc(50% - 16px)" : "100%";
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
width
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
</script>
|
package/components/FSRadio.vue
CHANGED
|
@@ -1,26 +1,44 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<FSCol
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
<FSCol
|
|
3
|
+
width="hug"
|
|
4
|
+
>
|
|
5
|
+
<v-radio
|
|
6
|
+
hide-details
|
|
7
|
+
:ripple="false"
|
|
8
|
+
:rules="$props.rules"
|
|
9
|
+
:validateOn="validateOn"
|
|
10
|
+
:modelValue="$props.selected"
|
|
11
|
+
@click.prevent
|
|
12
|
+
@blur="blurred = true"
|
|
13
|
+
v-bind="$attrs"
|
|
14
|
+
>
|
|
15
|
+
<template #input>
|
|
16
|
+
<FSRow
|
|
17
|
+
align="center-left"
|
|
18
|
+
width="hug"
|
|
16
19
|
:style="style"
|
|
17
|
-
:font="font"
|
|
18
20
|
@click.stop="onToggle"
|
|
19
21
|
>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
<FSIcon
|
|
23
|
+
class="fs-radio"
|
|
24
|
+
size="l"
|
|
25
|
+
:style="style"
|
|
26
|
+
>
|
|
27
|
+
{{ icon }}
|
|
28
|
+
</FSIcon>
|
|
29
|
+
<slot>
|
|
30
|
+
<FSSpan
|
|
31
|
+
v-if="$props.label"
|
|
32
|
+
class="fs-radio-label"
|
|
33
|
+
:style="style"
|
|
34
|
+
:font="font"
|
|
35
|
+
>
|
|
36
|
+
{{ $props.label }}
|
|
37
|
+
</FSSpan>
|
|
38
|
+
</slot>
|
|
39
|
+
</FSRow>
|
|
40
|
+
</template>
|
|
41
|
+
</v-radio>
|
|
24
42
|
<slot name="description">
|
|
25
43
|
<FSSpan
|
|
26
44
|
v-if="$props.description"
|
|
@@ -37,8 +55,8 @@
|
|
|
37
55
|
<script lang="ts">
|
|
38
56
|
import { computed, defineComponent, PropType } from "vue";
|
|
39
57
|
|
|
58
|
+
import { useColors, useRules } from "@dative-gpi/foundation-shared-components/composables";
|
|
40
59
|
import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
41
|
-
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
42
60
|
|
|
43
61
|
import FSIcon from "./FSIcon.vue";
|
|
44
62
|
import FSSpan from "./FSSpan.vue";
|
|
@@ -78,6 +96,16 @@ export default defineComponent({
|
|
|
78
96
|
required: false,
|
|
79
97
|
default: ColorEnum.Primary
|
|
80
98
|
},
|
|
99
|
+
rules: {
|
|
100
|
+
type: Array as PropType<Function[]>,
|
|
101
|
+
required: false,
|
|
102
|
+
default: () => []
|
|
103
|
+
},
|
|
104
|
+
messages: {
|
|
105
|
+
type: Array as PropType<string[]>,
|
|
106
|
+
required: false,
|
|
107
|
+
default: null
|
|
108
|
+
},
|
|
81
109
|
editable: {
|
|
82
110
|
type: Boolean,
|
|
83
111
|
required: false,
|
|
@@ -86,9 +114,11 @@ export default defineComponent({
|
|
|
86
114
|
},
|
|
87
115
|
emits: ["update:modelValue"],
|
|
88
116
|
setup(props, { emit }) {
|
|
117
|
+
const { validateOn, blurred, getMessages } = useRules();
|
|
89
118
|
const { getColors } = useColors();
|
|
90
119
|
|
|
91
120
|
const colors = computed(() => getColors(props.color));
|
|
121
|
+
const errors = getColors(ColorEnum.Error);
|
|
92
122
|
const lights = getColors(ColorEnum.Light);
|
|
93
123
|
const darks = getColors(ColorEnum.Dark);
|
|
94
124
|
|
|
@@ -100,6 +130,13 @@ export default defineComponent({
|
|
|
100
130
|
"--fs-radio-color" : lights.dark
|
|
101
131
|
};
|
|
102
132
|
}
|
|
133
|
+
if (messages.value.length) {
|
|
134
|
+
return {
|
|
135
|
+
"--fs-radio-cursor" : "pointer",
|
|
136
|
+
"--fs-radio-radio-color": errors.base,
|
|
137
|
+
"--fs-radio-color" : darks.base
|
|
138
|
+
}
|
|
139
|
+
}
|
|
103
140
|
return {
|
|
104
141
|
"--fs-radio-cursor" : props.selected ? "default" : "pointer",
|
|
105
142
|
"--fs-radio-radio-color": props.selected ? colors.value.base : darks.base,
|
|
@@ -111,6 +148,8 @@ export default defineComponent({
|
|
|
111
148
|
|
|
112
149
|
const font = computed((): string => props.selected ? "text-button" : "text-body");
|
|
113
150
|
|
|
151
|
+
const messages = computed((): string[] => props.messages ?? getMessages(props.modelValue, props.rules));
|
|
152
|
+
|
|
114
153
|
const onToggle = (): void => {
|
|
115
154
|
if (!props.editable) {
|
|
116
155
|
return;
|
|
@@ -121,6 +160,9 @@ export default defineComponent({
|
|
|
121
160
|
};
|
|
122
161
|
|
|
123
162
|
return {
|
|
163
|
+
validateOn,
|
|
164
|
+
messages,
|
|
165
|
+
blurred,
|
|
124
166
|
style,
|
|
125
167
|
icon,
|
|
126
168
|
font,
|
package/components/FSSwitch.vue
CHANGED
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
inset
|
|
13
13
|
:style="style"
|
|
14
14
|
:ripple="false"
|
|
15
|
+
:rules="$props.rules"
|
|
16
|
+
:validateOn="validateOn"
|
|
15
17
|
:modelValue="$props.modelValue"
|
|
16
18
|
@update:modelValue="onToggle"
|
|
17
19
|
v-bind="$attrs"
|
|
@@ -44,8 +46,8 @@
|
|
|
44
46
|
<script lang="ts">
|
|
45
47
|
import { computed, defineComponent, PropType } from "vue";
|
|
46
48
|
|
|
49
|
+
import { useColors, useRules } from "@dative-gpi/foundation-shared-components/composables";
|
|
47
50
|
import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
48
|
-
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
49
51
|
|
|
50
52
|
import FSSpan from "./FSSpan.vue";
|
|
51
53
|
import FSCol from "./FSCol.vue";
|
|
@@ -79,6 +81,16 @@ export default defineComponent({
|
|
|
79
81
|
required: false,
|
|
80
82
|
default: ColorEnum.Primary
|
|
81
83
|
},
|
|
84
|
+
rules: {
|
|
85
|
+
type: Array as PropType<Function[]>,
|
|
86
|
+
required: false,
|
|
87
|
+
default: () => []
|
|
88
|
+
},
|
|
89
|
+
messages: {
|
|
90
|
+
type: Array as PropType<string[]>,
|
|
91
|
+
required: false,
|
|
92
|
+
default: null
|
|
93
|
+
},
|
|
82
94
|
editable: {
|
|
83
95
|
type: Boolean,
|
|
84
96
|
required: false,
|
|
@@ -87,10 +99,12 @@ export default defineComponent({
|
|
|
87
99
|
},
|
|
88
100
|
emits: ["update:modelValue"],
|
|
89
101
|
setup(props, { emit }) {
|
|
102
|
+
const { validateOn, blurred, getMessages } = useRules();
|
|
90
103
|
const { getColors } = useColors();
|
|
91
104
|
|
|
92
105
|
const colors = computed(() => getColors(props.color));
|
|
93
106
|
const backgrounds = getColors(ColorEnum.Background);
|
|
107
|
+
const errors = getColors(ColorEnum.Error);
|
|
94
108
|
const lights = getColors(ColorEnum.Light);
|
|
95
109
|
const darks = getColors(ColorEnum.Dark);
|
|
96
110
|
|
|
@@ -104,6 +118,15 @@ export default defineComponent({
|
|
|
104
118
|
"--fs-switch-color" : lights.dark
|
|
105
119
|
};
|
|
106
120
|
}
|
|
121
|
+
if (messages.value.length) {
|
|
122
|
+
return {
|
|
123
|
+
"--fs-switch-translate-x": props.modelValue ? "8px" : "-8px",
|
|
124
|
+
"--fs-switch-cursor" : "pointer",
|
|
125
|
+
"--fs-switch-track-color": errors.base,
|
|
126
|
+
"--fs-switch-thumb-color": backgrounds.base,
|
|
127
|
+
"--fs-switch-color" : darks.base
|
|
128
|
+
};
|
|
129
|
+
}
|
|
107
130
|
return {
|
|
108
131
|
"--fs-switch-translate-x": props.modelValue ? "8px" : "-8px",
|
|
109
132
|
"--fs-switch-cursor" : "pointer",
|
|
@@ -115,6 +138,8 @@ export default defineComponent({
|
|
|
115
138
|
|
|
116
139
|
const font = computed((): string => props.modelValue ? "text-button" : "text-body");
|
|
117
140
|
|
|
141
|
+
const messages = computed((): string[] => props.messages ?? getMessages(props.modelValue, props.rules));
|
|
142
|
+
|
|
118
143
|
const onToggle = (): void => {
|
|
119
144
|
if (!props.editable) {
|
|
120
145
|
return;
|
|
@@ -123,6 +148,9 @@ export default defineComponent({
|
|
|
123
148
|
}
|
|
124
149
|
|
|
125
150
|
return {
|
|
151
|
+
validateOn,
|
|
152
|
+
messages,
|
|
153
|
+
blurred,
|
|
126
154
|
style,
|
|
127
155
|
font,
|
|
128
156
|
onToggle
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
<script lang="ts">
|
|
23
23
|
import { defineComponent, ref } from "vue";
|
|
24
|
+
|
|
24
25
|
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
25
26
|
|
|
26
27
|
import FSButton from "../FSButton.vue";
|
|
@@ -34,12 +35,12 @@ export default defineComponent({
|
|
|
34
35
|
accept: {
|
|
35
36
|
type: String,
|
|
36
37
|
required: false,
|
|
37
|
-
default: ""
|
|
38
|
+
default: ""
|
|
38
39
|
},
|
|
39
40
|
readFile: {
|
|
40
41
|
type: Boolean,
|
|
41
42
|
required: false,
|
|
42
|
-
default: true
|
|
43
|
+
default: true
|
|
43
44
|
}
|
|
44
45
|
},
|
|
45
46
|
emits: ["update:modelValue"],
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
<script lang="ts">
|
|
23
23
|
import { defineComponent, ref } from "vue";
|
|
24
|
+
|
|
24
25
|
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
25
26
|
|
|
26
27
|
import FSButton from "../FSButton.vue";
|
|
@@ -34,12 +35,12 @@ export default defineComponent({
|
|
|
34
35
|
accept: {
|
|
35
36
|
type: String,
|
|
36
37
|
required: false,
|
|
37
|
-
default: ""
|
|
38
|
+
default: ""
|
|
38
39
|
},
|
|
39
40
|
readFile: {
|
|
40
41
|
type: Boolean,
|
|
41
42
|
required: false,
|
|
42
|
-
default: true
|
|
43
|
+
default: true
|
|
43
44
|
}
|
|
44
45
|
},
|
|
45
46
|
emits: ["update:modelValue"],
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
<script lang="ts">
|
|
22
22
|
import { defineComponent, ref } from "vue";
|
|
23
|
+
|
|
23
24
|
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
24
25
|
|
|
25
26
|
import FSButton from "../FSButton.vue";
|
|
@@ -33,12 +34,12 @@ export default defineComponent({
|
|
|
33
34
|
accept: {
|
|
34
35
|
type: String,
|
|
35
36
|
required: false,
|
|
36
|
-
default: ""
|
|
37
|
+
default: ""
|
|
37
38
|
},
|
|
38
39
|
readFile: {
|
|
39
40
|
type: Boolean,
|
|
40
41
|
required: false,
|
|
41
|
-
default: true
|
|
42
|
+
default: true
|
|
42
43
|
}
|
|
43
44
|
},
|
|
44
45
|
emits: ["update:modelValue"],
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
<script lang="ts">
|
|
22
22
|
import { defineComponent, ref } from "vue";
|
|
23
|
+
|
|
23
24
|
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
24
25
|
|
|
25
26
|
import FSButton from "../FSButton.vue";
|
|
@@ -33,12 +34,12 @@ export default defineComponent({
|
|
|
33
34
|
accept: {
|
|
34
35
|
type: String,
|
|
35
36
|
required: false,
|
|
36
|
-
default: ""
|
|
37
|
+
default: ""
|
|
37
38
|
},
|
|
38
39
|
readFile: {
|
|
39
40
|
type: Boolean,
|
|
40
41
|
required: false,
|
|
41
|
-
default: true
|
|
42
|
+
default: true
|
|
42
43
|
}
|
|
43
44
|
},
|
|
44
45
|
emits: ["update:modelValue"],
|
|
@@ -383,7 +383,12 @@ export default defineComponent({
|
|
|
383
383
|
editor.registerUpdateListener(({ editorState }) => {
|
|
384
384
|
editorState.read(() => {
|
|
385
385
|
updateToolbar();
|
|
386
|
-
|
|
386
|
+
if (JSON.stringify(editorState.toJSON()) !== emptyState) {
|
|
387
|
+
emit("update:modelValue", JSON.stringify(editorState.toJSON()));
|
|
388
|
+
}
|
|
389
|
+
else {
|
|
390
|
+
emit("update:modelValue", null);
|
|
391
|
+
}
|
|
387
392
|
});
|
|
388
393
|
});
|
|
389
394
|
|
|
@@ -541,13 +546,13 @@ export default defineComponent({
|
|
|
541
546
|
}
|
|
542
547
|
|
|
543
548
|
watch(() => props.modelValue, () => {
|
|
544
|
-
if (
|
|
549
|
+
if (JSON.stringify(editor.getEditorState().toJSON()) != props.modelValue) {
|
|
545
550
|
if (props.modelValue != null) {
|
|
546
551
|
editor.update(() => {
|
|
547
552
|
editor.setEditorState(editor.parseEditorState(props.modelValue));
|
|
548
553
|
});
|
|
549
554
|
}
|
|
550
|
-
else {
|
|
555
|
+
else if (JSON.stringify(editor.getEditorState().toJSON()) !== emptyState) {
|
|
551
556
|
editor.update(() => {
|
|
552
557
|
editor.setEditorState(editor.parseEditorState(emptyState));
|
|
553
558
|
});
|
package/models/grids.ts
ADDED
package/models/index.ts
CHANGED
package/models/rules.ts
CHANGED
|
@@ -58,4 +58,8 @@ export const TimeRules = {
|
|
|
58
58
|
required: (message: string) => (value: number) => !!value || (message ?? $tr("ui.rules.required", "Required")),
|
|
59
59
|
min: (min: number, message: string) => (value: number) => value >= min || (message ?? $tr("ui.rules.time-min", "Must be more than {0}", getTimeBestString(min))),
|
|
60
60
|
max: (max: number, message: string) => (value: number) => value <= max || (message ?? $tr("ui.rules.time-max", "Must be less than {0}", getTimeBestString(max)))
|
|
61
|
-
};
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const ToggleRules = {
|
|
64
|
+
required: (message: string) => (value: boolean) => value || (message ?? $tr("ui.rules.required", "Required"))
|
|
65
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dative-gpi/foundation-shared-components",
|
|
3
3
|
"sideEffects": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.47",
|
|
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": "0.0.
|
|
14
|
-
"@dative-gpi/foundation-shared-services": "0.0.
|
|
13
|
+
"@dative-gpi/foundation-shared-domain": "0.0.47",
|
|
14
|
+
"@dative-gpi/foundation-shared-services": "0.0.47",
|
|
15
15
|
"@fontsource/montserrat": "^5.0.16",
|
|
16
16
|
"@lexical/clipboard": "^0.12.5",
|
|
17
17
|
"@lexical/history": "^0.12.5",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"sass": "^1.69.5",
|
|
33
33
|
"sass-loader": "^13.3.2"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "4fe5299cdc8c81c71d98ab53e944e1ebacaf9e24"
|
|
36
36
|
}
|
|
@@ -3,9 +3,27 @@
|
|
|
3
3
|
display: none;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
// No default hover effect on switches and others
|
|
7
|
-
.v-selection-
|
|
8
|
-
|
|
6
|
+
// No default hover effect on switches and others, no limited opacity, no limited width...
|
|
7
|
+
.v-selection-control {
|
|
8
|
+
min-height: 0 !important;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.v-selection-control__wrapper {
|
|
12
|
+
height: auto !important;
|
|
13
|
+
width: auto !important;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.v-selection-control__input {
|
|
17
|
+
height: auto !important;
|
|
18
|
+
width: auto !important;
|
|
19
|
+
|
|
20
|
+
& > .v-icon {
|
|
21
|
+
opacity: 1 !important;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&::before {
|
|
25
|
+
display: none;
|
|
26
|
+
}
|
|
9
27
|
}
|
|
10
28
|
|
|
11
29
|
// Applies to all inputs
|
|
@@ -64,6 +82,10 @@
|
|
|
64
82
|
}
|
|
65
83
|
}
|
|
66
84
|
|
|
85
|
+
// No input messages allowed
|
|
86
|
+
.v-input__details {
|
|
87
|
+
display: none !important;
|
|
88
|
+
}
|
|
67
89
|
|
|
68
90
|
// No up / down buttons in input field of type number
|
|
69
91
|
input[type=number] {
|