@dative-gpi/foundation-shared-components 0.0.200 → 0.0.201
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/fields/FSColorField.vue +67 -95
- package/components/fields/FSGradientField.vue +126 -0
- package/components/map/FSMap.vue +5 -5
- package/package.json +7 -7
- package/styles/components/fs_color_field.scss +12 -2
- package/styles/components/fs_gradient_field.scss +16 -0
- package/styles/components/index.scss +1 -0
- package/utils/gradient.ts +1600 -0
- package/utils/index.ts +2 -1
|
@@ -7,96 +7,40 @@
|
|
|
7
7
|
<template
|
|
8
8
|
#activator="{ props }"
|
|
9
9
|
>
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
<FSBaseField
|
|
11
|
+
class="fs-color-field"
|
|
12
|
+
:hideHeader="$props.hideHeader"
|
|
13
|
+
:required="$props.required"
|
|
14
|
+
:editable="$props.editable"
|
|
15
|
+
:modelValue="innerColor"
|
|
16
|
+
:description="$props.description"
|
|
17
|
+
:label="$props.label"
|
|
18
|
+
:style="style"
|
|
19
|
+
:width="$props.width"
|
|
20
|
+
v-bind="$attrs"
|
|
21
|
+
>
|
|
22
|
+
<FSCard
|
|
23
|
+
width="100%"
|
|
24
|
+
padding="8px"
|
|
13
25
|
v-bind="props"
|
|
26
|
+
:class="{ 'fs-color-field-disabled': !$props.editable }"
|
|
14
27
|
>
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
:hideHeader="$props.hideHeader"
|
|
18
|
-
:required="$props.required"
|
|
19
|
-
:editable="$props.editable"
|
|
20
|
-
:clearable="false"
|
|
21
|
-
:readonly="true"
|
|
22
|
-
:modelValue="innerColor"
|
|
23
|
-
v-bind="$attrs"
|
|
28
|
+
<FSRow
|
|
29
|
+
align="center-center"
|
|
24
30
|
>
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
:color="innerColor"
|
|
33
|
-
>
|
|
34
|
-
mdi-circle
|
|
35
|
-
</FSIcon>
|
|
36
|
-
</slot>
|
|
37
|
-
</template>
|
|
38
|
-
<template
|
|
39
|
-
#append
|
|
40
|
-
>
|
|
41
|
-
<FSButton
|
|
42
|
-
prependIcon="mdi-pencil"
|
|
43
|
-
variant="full"
|
|
44
|
-
:editable="$props.editable"
|
|
45
|
-
v-bind="props"
|
|
46
|
-
/>
|
|
47
|
-
</template>
|
|
48
|
-
</FSTextField>
|
|
49
|
-
<FSTextField
|
|
50
|
-
v-if="$props.allowOpacity && !$props.onlyBaseColors"
|
|
51
|
-
class="fs-color-field-opacity"
|
|
52
|
-
:label="$tr('ui.color-field.opacity', 'Opacity')"
|
|
53
|
-
:hideHeader="$props.hideHeader"
|
|
54
|
-
:required="$props.required"
|
|
55
|
-
:editable="$props.editable"
|
|
56
|
-
:clearable="false"
|
|
57
|
-
:readonly="true"
|
|
58
|
-
:modelValue="(Math.round(getPercentageFromHex(innerOpacity) * 100)) + ' %'"
|
|
59
|
-
>
|
|
60
|
-
<template
|
|
61
|
-
#prepend-inner
|
|
62
|
-
>
|
|
63
|
-
<slot
|
|
64
|
-
name="prepend-inner"
|
|
65
|
-
>
|
|
66
|
-
<FSIcon
|
|
67
|
-
:color="ColorEnum.Dark"
|
|
68
|
-
:editable="$props.editable"
|
|
69
|
-
:style="{ opacity: getPercentageFromHex(innerOpacity) }"
|
|
70
|
-
>
|
|
71
|
-
mdi-circle
|
|
72
|
-
</FSIcon>
|
|
73
|
-
</slot>
|
|
74
|
-
</template>
|
|
75
|
-
<template
|
|
76
|
-
#append
|
|
31
|
+
<FSIcon
|
|
32
|
+
:color="innerColor"
|
|
33
|
+
size="20px"
|
|
34
|
+
icon="mdi-circle-half"
|
|
35
|
+
/>
|
|
36
|
+
<FSText
|
|
37
|
+
font="text-overline"
|
|
77
38
|
>
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
/>
|
|
84
|
-
</template>
|
|
85
|
-
</FSTextField>
|
|
86
|
-
</FSRow>
|
|
87
|
-
<slot
|
|
88
|
-
name="description"
|
|
89
|
-
>
|
|
90
|
-
<FSSpan
|
|
91
|
-
v-if="$props.description"
|
|
92
|
-
class="fs-color-field-description"
|
|
93
|
-
font="text-underline"
|
|
94
|
-
:style="style"
|
|
95
|
-
>
|
|
96
|
-
{{ $props.description }}
|
|
97
|
-
</FSSpan>
|
|
98
|
-
</slot>
|
|
99
|
-
</FSCol>
|
|
39
|
+
{{ innerColor }}
|
|
40
|
+
</FSText>
|
|
41
|
+
</FSRow>
|
|
42
|
+
</FSCard>
|
|
43
|
+
</FSBaseField>
|
|
100
44
|
</template>
|
|
101
45
|
<FSCard
|
|
102
46
|
:elevation="true"
|
|
@@ -133,31 +77,36 @@
|
|
|
133
77
|
</template>
|
|
134
78
|
|
|
135
79
|
<script lang="ts">
|
|
136
|
-
import type { PropType} from "vue";
|
|
137
|
-
import { computed, defineComponent, ref } from "vue";
|
|
80
|
+
import type { PropType } from "vue";
|
|
81
|
+
import { computed, defineComponent, onMounted, ref, watch } from "vue";
|
|
138
82
|
|
|
139
83
|
import { getPercentageFromHex, getHexFromPercentage } from "@dative-gpi/foundation-shared-components/utils";
|
|
140
84
|
import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
|
|
141
85
|
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
142
86
|
|
|
143
|
-
import FSTextField from "./FSTextField.vue";
|
|
144
|
-
import FSButton from "../FSButton.vue";
|
|
145
87
|
import FSCard from "../FSCard.vue";
|
|
146
88
|
import FSIcon from "../FSIcon.vue";
|
|
147
89
|
import FSRow from "../FSRow.vue";
|
|
148
90
|
import FSCol from "../FSCol.vue";
|
|
91
|
+
import FSBaseField from "./FSBaseField.vue";
|
|
92
|
+
import FSText from "../FSText.vue";
|
|
149
93
|
|
|
150
94
|
export default defineComponent({
|
|
151
95
|
name: "FSColorField",
|
|
152
96
|
components: {
|
|
153
|
-
|
|
154
|
-
|
|
97
|
+
FSBaseField,
|
|
98
|
+
FSText,
|
|
155
99
|
FSCard,
|
|
156
100
|
FSIcon,
|
|
157
101
|
FSCol,
|
|
158
|
-
FSRow
|
|
102
|
+
FSRow,
|
|
159
103
|
},
|
|
160
104
|
props: {
|
|
105
|
+
label: {
|
|
106
|
+
type: String as PropType<string | null>,
|
|
107
|
+
required: false,
|
|
108
|
+
default: null
|
|
109
|
+
},
|
|
161
110
|
description: {
|
|
162
111
|
type: String as PropType<string | null>,
|
|
163
112
|
required: false,
|
|
@@ -197,6 +146,11 @@ export default defineComponent({
|
|
|
197
146
|
type: Boolean,
|
|
198
147
|
required: false,
|
|
199
148
|
default: false
|
|
149
|
+
},
|
|
150
|
+
width: {
|
|
151
|
+
type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
|
|
152
|
+
required: false,
|
|
153
|
+
default: "fill"
|
|
200
154
|
}
|
|
201
155
|
},
|
|
202
156
|
emits: ["update:modelValue", "update:opacity"],
|
|
@@ -217,11 +171,17 @@ export default defineComponent({
|
|
|
217
171
|
const style = computed((): { [key: string]: string | undefined } => {
|
|
218
172
|
if (!props.editable) {
|
|
219
173
|
return {
|
|
220
|
-
"--fs-color-field-
|
|
174
|
+
"--fs-color-field-cursor" : "default",
|
|
175
|
+
"--fs-color-field-border-color" : lights.base,
|
|
176
|
+
"--fs-color-field-color" : lights.dark,
|
|
177
|
+
"--fs-color-field-colorvalue": fullColor.value,
|
|
221
178
|
};
|
|
222
179
|
}
|
|
223
180
|
return {
|
|
224
|
-
"--fs-color-field-
|
|
181
|
+
"--fs-color-field-cursor" : "pointer",
|
|
182
|
+
"--fs-color-field-border-color" : lights.dark,
|
|
183
|
+
"--fs-color-field-color" : darks.base,
|
|
184
|
+
"--fs-color-field-colorvalue": fullColor.value,
|
|
225
185
|
};
|
|
226
186
|
});
|
|
227
187
|
|
|
@@ -234,6 +194,18 @@ export default defineComponent({
|
|
|
234
194
|
emit("update:opacity", getPercentageFromHex(innerOpacity.value));
|
|
235
195
|
};
|
|
236
196
|
|
|
197
|
+
onMounted(() => {
|
|
198
|
+
innerColor.value = getColors(props.modelValue)['base'];
|
|
199
|
+
innerOpacity.value = getHexFromPercentage(props.opacityValue);
|
|
200
|
+
fullColor.value = innerColor.value + innerOpacity.value;
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
watch(() => props.modelValue, (value) => {
|
|
204
|
+
innerColor.value = getColors(value)['base'];
|
|
205
|
+
innerOpacity.value = getHexFromPercentage(props.opacityValue);
|
|
206
|
+
fullColor.value = innerColor.value + innerOpacity.value;
|
|
207
|
+
});
|
|
208
|
+
|
|
237
209
|
return {
|
|
238
210
|
getPercentageFromHex,
|
|
239
211
|
getBasePaletteColors,
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSCol
|
|
3
|
+
class="fs-gradient-field"
|
|
4
|
+
>
|
|
5
|
+
<FSBaseField
|
|
6
|
+
:label="$props.label"
|
|
7
|
+
:description="$props.description"
|
|
8
|
+
:required="$props.required"
|
|
9
|
+
:editable="$props.editable"
|
|
10
|
+
v-bind="$attrs"
|
|
11
|
+
>
|
|
12
|
+
<FSRow>
|
|
13
|
+
<FSColorField
|
|
14
|
+
v-for="colorIndex in $props.colorCount"
|
|
15
|
+
:key="colorIndex"
|
|
16
|
+
:modelValue="$props.modelValue[colorIndex-1]"
|
|
17
|
+
:required="$props.required"
|
|
18
|
+
:editable="$props.editable"
|
|
19
|
+
@update:modelValue="($event, index) => $emit('update:modelValue', $props.modelValue.map((color, i) => colorIndex === i + 1 ? $event : color))"
|
|
20
|
+
/>
|
|
21
|
+
</FSRow>
|
|
22
|
+
<FSSelectField
|
|
23
|
+
class="fs-gradient-select-field"
|
|
24
|
+
:items="items"
|
|
25
|
+
@update:modelValue="$emit('update:modelValue', JSON.parse($event))"
|
|
26
|
+
:clearable="false"
|
|
27
|
+
:editable="$props.editable"
|
|
28
|
+
:modelValue="JSON.stringify($props.modelValue)"
|
|
29
|
+
>
|
|
30
|
+
<template
|
|
31
|
+
v-slot:selection="{ item }"
|
|
32
|
+
>
|
|
33
|
+
<FSRow
|
|
34
|
+
height="fill"
|
|
35
|
+
width="100%"
|
|
36
|
+
class="fs-gradient-field-preview"
|
|
37
|
+
:style="{ '--fs-gradient-field-background': `linear-gradient(to right, ${JSON.parse(item.value).join(', ')})` }"
|
|
38
|
+
>
|
|
39
|
+
<span />
|
|
40
|
+
</FSRow>
|
|
41
|
+
</template>
|
|
42
|
+
<template
|
|
43
|
+
v-slot:item="{ item, props }"
|
|
44
|
+
>
|
|
45
|
+
<v-list-item
|
|
46
|
+
v-bind="props"
|
|
47
|
+
>
|
|
48
|
+
<template
|
|
49
|
+
#title
|
|
50
|
+
>
|
|
51
|
+
<FSRow
|
|
52
|
+
height="fill"
|
|
53
|
+
width="100%"
|
|
54
|
+
class="fs-gradient-field-preview"
|
|
55
|
+
:style="{ '--fs-gradient-field-background': `linear-gradient(to right, ${JSON.parse(item.value).join(', ')})` }"
|
|
56
|
+
>
|
|
57
|
+
<span />
|
|
58
|
+
</FSRow>
|
|
59
|
+
</template>
|
|
60
|
+
</v-list-item>
|
|
61
|
+
</template>
|
|
62
|
+
</FSSelectField>
|
|
63
|
+
</FSBaseField>
|
|
64
|
+
</FSCol>
|
|
65
|
+
</template>
|
|
66
|
+
|
|
67
|
+
<script lang="ts">
|
|
68
|
+
import { type PropType, defineComponent } from "vue";
|
|
69
|
+
|
|
70
|
+
import FSColorField from "./FSColorField.vue";
|
|
71
|
+
import FSCol from "../FSCol.vue";
|
|
72
|
+
import FSRow from "../FSRow.vue";
|
|
73
|
+
import FSBaseField from "./FSBaseField.vue";
|
|
74
|
+
import FSSelectField from "./FSSelectField.vue";
|
|
75
|
+
import { groupedGradients } from "../../utils";
|
|
76
|
+
|
|
77
|
+
export default defineComponent({
|
|
78
|
+
name: "FSGradientField",
|
|
79
|
+
components: {
|
|
80
|
+
FSBaseField,
|
|
81
|
+
FSColorField,
|
|
82
|
+
FSCol,
|
|
83
|
+
FSRow,
|
|
84
|
+
FSSelectField
|
|
85
|
+
},
|
|
86
|
+
props: {
|
|
87
|
+
label: {
|
|
88
|
+
type: String as PropType<string | null>,
|
|
89
|
+
required: false,
|
|
90
|
+
default: null
|
|
91
|
+
},
|
|
92
|
+
description: {
|
|
93
|
+
type: String as PropType<string | null>,
|
|
94
|
+
required: false,
|
|
95
|
+
default: null
|
|
96
|
+
},
|
|
97
|
+
modelValue: {
|
|
98
|
+
type: Array as PropType<string[]>,
|
|
99
|
+
required: true
|
|
100
|
+
},
|
|
101
|
+
required: {
|
|
102
|
+
type: Boolean,
|
|
103
|
+
required: false,
|
|
104
|
+
default: false
|
|
105
|
+
},
|
|
106
|
+
editable: {
|
|
107
|
+
type: Boolean,
|
|
108
|
+
required: false,
|
|
109
|
+
default: true
|
|
110
|
+
},
|
|
111
|
+
colorCount: {
|
|
112
|
+
type: Number,
|
|
113
|
+
required: false,
|
|
114
|
+
default: 2
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
emits: ["update:modelValue"],
|
|
118
|
+
setup(props) {
|
|
119
|
+
const items = groupedGradients[props.colorCount] ?? [];
|
|
120
|
+
|
|
121
|
+
return {
|
|
122
|
+
items
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
</script>
|
package/components/map/FSMap.vue
CHANGED
|
@@ -350,7 +350,7 @@ export default defineComponent({
|
|
|
350
350
|
return;
|
|
351
351
|
}
|
|
352
352
|
modifyLocationAddress(props.selectedLocationId, address);
|
|
353
|
-
map?.
|
|
353
|
+
map?.panTo([address.latitude, address.longitude]);
|
|
354
354
|
};
|
|
355
355
|
|
|
356
356
|
const onNewCoordEntered = async (lat: number, lng: number) => {
|
|
@@ -374,7 +374,7 @@ export default defineComponent({
|
|
|
374
374
|
const locate = () => {
|
|
375
375
|
map?.locate();
|
|
376
376
|
map?.on('locationfound', (e: L.LocationEvent) => {
|
|
377
|
-
map?.
|
|
377
|
+
map?.panTo(e.latlng);
|
|
378
378
|
const iconHtml = `<div class="fs-map-mylocation-pin"></div>`;
|
|
379
379
|
const icon = LL.divIcon({
|
|
380
380
|
html: iconHtml,
|
|
@@ -395,7 +395,7 @@ export default defineComponent({
|
|
|
395
395
|
map?.fitBounds(markerLayerGroup.getBounds(), { maxZoom: defaultZoom });
|
|
396
396
|
}
|
|
397
397
|
else {
|
|
398
|
-
map?.
|
|
398
|
+
map?.panTo([props.center[0], props.center[1]]);
|
|
399
399
|
}
|
|
400
400
|
if (props.modelValue.length > 1) {
|
|
401
401
|
emit('update:selectedLocationId', null);
|
|
@@ -409,7 +409,7 @@ export default defineComponent({
|
|
|
409
409
|
map?.fitBounds(markerLayerGroup.getBounds(), { maxZoom: defaultZoom });
|
|
410
410
|
}
|
|
411
411
|
else {
|
|
412
|
-
map?.flyTo([props.center[0], props.center[1]], map?.getZoom() ?? defaultZoom);
|
|
412
|
+
map?.flyTo([props.center[0], props.center[1]], map?.getZoom() ?? defaultZoom, { animate: false });
|
|
413
413
|
}
|
|
414
414
|
if (props.modelValue.length > 1) {
|
|
415
415
|
emit('update:selectedLocationId', null);
|
|
@@ -434,7 +434,7 @@ export default defineComponent({
|
|
|
434
434
|
}
|
|
435
435
|
const marker = markers[props.selectedLocationId];
|
|
436
436
|
marker.getElement()?.classList.add('fs-map-location-selected');
|
|
437
|
-
map?.flyTo(marker.getLatLng(), 17);
|
|
437
|
+
map?.flyTo(marker.getLatLng(), 17, { animate: false });
|
|
438
438
|
})
|
|
439
439
|
|
|
440
440
|
watch(() => props.selectedSiteId, () => {
|
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.201",
|
|
5
5
|
"description": "",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -10,10 +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.
|
|
15
|
-
"leaflet": "1.9.4",
|
|
16
|
-
"leaflet.markercluster": "1.5.3"
|
|
13
|
+
"@dative-gpi/foundation-shared-domain": "0.0.201",
|
|
14
|
+
"@dative-gpi/foundation-shared-services": "0.0.201"
|
|
17
15
|
},
|
|
18
16
|
"peerDependencies": {
|
|
19
17
|
"@dative-gpi/bones-ui": "^0.0.75",
|
|
@@ -28,12 +26,14 @@
|
|
|
28
26
|
"@lexical/utils": "0.12.5",
|
|
29
27
|
"@mdi/font": "^7.4.47",
|
|
30
28
|
"blurhash": "2.0.5",
|
|
31
|
-
"color": "^4.2.3"
|
|
29
|
+
"color": "^4.2.3",
|
|
30
|
+
"leaflet": "1.9.4",
|
|
31
|
+
"leaflet.markercluster": "1.5.3"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/color": "3.0.6",
|
|
35
35
|
"sass": "1.71.1",
|
|
36
36
|
"sass-loader": "13.3.2"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "36570e97911fc649951dc1c63ea0fd37c6e09385"
|
|
39
39
|
}
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
.fs-color-field .
|
|
1
|
+
.fs-color-field .fs-card {
|
|
2
|
+
cursor: var(--fs-color-field-cursor) !important;
|
|
3
|
+
border-color: var(--fs-color-field-border-color) !important;
|
|
4
|
+
.fs-text {
|
|
5
|
+
color: var(--fs-color-field-color) !important;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.fs-color-field .v-icon {
|
|
10
|
+
background-color: var(--fs-color-field-colorvalue) !important;
|
|
11
|
+
border-radius: 100%;
|
|
2
12
|
opacity: 1 !important;
|
|
3
13
|
}
|
|
4
14
|
|
|
@@ -9,5 +19,5 @@
|
|
|
9
19
|
}
|
|
10
20
|
|
|
11
21
|
.fs-color-field-description {
|
|
12
|
-
|
|
22
|
+
color: var(--fs-color-field-color);
|
|
13
23
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
.fs-gradient-select-field .v-select__selection {
|
|
3
|
+
width: 100%;
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
}
|
|
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%;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|