@dative-gpi/foundation-shared-components 1.0.139 → 1.0.140-selectable
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/FSButton.vue +6 -6
- package/components/FSCalendarTwin.vue +1 -5
- package/components/FSCheckbox.vue +4 -4
- package/components/FSChip.vue +3 -3
- package/components/FSClickable.vue +6 -6
- package/components/FSClock.vue +16 -7
- package/components/FSDialogFormBody.vue +3 -3
- package/components/FSDialogMultiFormBody.vue +3 -3
- package/components/FSDialogSubmit.vue +3 -3
- package/components/FSInstantPicker.vue +8 -5
- package/components/FSOptionGroup.vue +8 -8
- package/components/FSOptionItem.vue +4 -4
- package/components/FSPagination.vue +1 -1
- package/components/FSRadio.vue +4 -4
- package/components/FSRadioGroup.vue +3 -3
- package/components/FSSlider.vue +4 -4
- package/components/FSSwitch.vue +6 -4
- package/components/FSTag.vue +2 -2
- package/components/FSTagGroup.vue +3 -3
- package/components/FSToggleSet.vue +7 -7
- package/components/autocompletes/FSAutoCompleteAddress.vue +3 -0
- package/components/buttons/FSButtonCheckbox.vue +4 -4
- package/components/fields/FSAutocompleteField.vue +21 -15
- package/components/fields/FSBaseField.vue +3 -3
- package/components/fields/FSColorField.vue +6 -6
- package/components/fields/FSDateField.vue +8 -8
- package/components/fields/FSDateRangeField.vue +5 -5
- package/components/fields/FSDateTimeField.vue +8 -8
- package/components/fields/FSDateTimeRangeDialog.vue +160 -0
- package/components/fields/FSDateTimeRangeField.vue +22 -115
- package/components/fields/FSEntityFieldUI.vue +6 -6
- package/components/fields/FSGradientField.vue +5 -5
- package/components/fields/FSIconField.vue +6 -6
- package/components/fields/FSMagicConfigField.vue +5 -4
- package/components/fields/FSNumberField.vue +3 -3
- package/components/fields/FSPasswordField.vue +7 -7
- package/components/fields/FSRichTextField.vue +18 -23
- package/components/fields/FSSelectField.vue +22 -16
- package/components/fields/FSTagField.vue +9 -9
- package/components/fields/FSTermField.vue +51 -42
- package/components/fields/FSTextArea.vue +7 -7
- package/components/fields/FSTextField.vue +7 -7
- package/components/fields/FSTimeField.vue +14 -10
- package/components/fields/FSTimeRangeField.vue +7 -7
- package/components/fields/FSTimeStepField.vue +5 -5
- package/components/fields/FSTranslateField.vue +7 -7
- package/components/fields/FSTranslateRichTextField.vue +7 -7
- package/components/fields/FSTranslateTextArea.vue +7 -7
- package/components/fields/FSTreeViewField.vue +11 -11
- package/components/fields/periodicField/FSPeriodicDailyField.vue +5 -5
- package/components/fields/periodicField/FSPeriodicField.vue +7 -7
- package/components/fields/periodicField/FSPeriodicMonthlyField.vue +8 -8
- package/components/fields/periodicField/FSPeriodicWeeklyField.vue +5 -5
- package/components/fields/periodicField/FSPeriodicYearlyField.vue +6 -6
- package/components/lists/FSDataIteratorItem.vue +23 -67
- package/components/lists/FSDataTableUI.vue +24 -19
- package/components/lists/FSFilterButton.vue +3 -3
- package/components/lists/FSHeaderButton.vue +3 -3
- package/components/lists/FSHiddenButton.vue +2 -2
- package/components/lists/FSSimpleListItem.vue +0 -1
- package/components/tiles/FSDeviceOrganisationTileUI.vue +0 -6
- package/components/tiles/FSGroupTileUI.vue +0 -6
- package/components/tiles/FSLoadTile.vue +3 -2
- package/components/tiles/FSServiceAccountOrganisationTileUI.vue +0 -6
- package/components/tiles/FSSimpleTileUI.vue +0 -6
- package/components/tiles/FSTile.vue +42 -48
- package/components/tiles/FSUserOrganisationTileUI.vue +0 -6
- package/composables/useAddress.ts +40 -8
- package/composables/useColors.ts +16 -7
- package/package.json +4 -4
- package/styles/components/fs_calendar.scss +1 -0
- package/styles/components/fs_chip.scss +1 -1
- package/styles/components/fs_draggable.scss +0 -5
- package/styles/components/index.scss +0 -1
- package/styles/components/fs_data_iterator_item.scss +0 -35
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
:label="$tr('data-table.reset-filters', 'Reset')"
|
|
113
113
|
:height="['30px', '24px']"
|
|
114
114
|
:color="ColorEnum.Error"
|
|
115
|
-
:
|
|
115
|
+
:clickable="true"
|
|
116
116
|
@click="resetFilter"
|
|
117
117
|
/>
|
|
118
118
|
<FSHiddenButton
|
|
@@ -478,18 +478,20 @@
|
|
|
478
478
|
>
|
|
479
479
|
<FSDataIteratorItem
|
|
480
480
|
v-if="item.type === 'item'"
|
|
481
|
-
:
|
|
481
|
+
:leftColor="$props.rowColor ? $props.rowColor(item.raw) : null"
|
|
482
482
|
:headers="innerHeaders.filter(h => !$props.sneakyHeaders.includes(h.value))"
|
|
483
|
-
:
|
|
484
|
-
:
|
|
485
|
-
:
|
|
486
|
-
:
|
|
483
|
+
:selectable="$props.showSelect"
|
|
484
|
+
:singleSelect="$props.singleSelect"
|
|
485
|
+
:to="$props.itemTo"
|
|
486
|
+
:bottomColor="$props.color"
|
|
487
487
|
:item="item.raw"
|
|
488
488
|
:key="index"
|
|
489
|
-
:modelValue="$props.modelValue
|
|
490
|
-
@update:modelValue="toggleSelect"
|
|
491
|
-
|
|
492
|
-
|
|
489
|
+
:modelValue="$props.modelValue?.includes(item.raw[$props.itemValue])"
|
|
490
|
+
@update:modelValue="toggleSelect(item.raw)"
|
|
491
|
+
v-bind="onClickLibrary.clickable ? {
|
|
492
|
+
onClick: (event) => onClickLibrary.mobile(event, item),
|
|
493
|
+
onAuxclick: (event) => onClickLibrary.mobile(event, item)
|
|
494
|
+
} : {}"
|
|
493
495
|
>
|
|
494
496
|
<template
|
|
495
497
|
#item.top="props"
|
|
@@ -649,18 +651,20 @@
|
|
|
649
651
|
v-bind="{ index, item: item.raw, toggleSelect }"
|
|
650
652
|
>
|
|
651
653
|
<FSDataIteratorItem
|
|
652
|
-
:
|
|
654
|
+
:leftColor="$props.rowColor ? $props.rowColor(item.raw) : null"
|
|
653
655
|
:headers="innerHeaders.filter(h => !$props.sneakyHeaders.includes(h.value))"
|
|
654
|
-
:
|
|
655
|
-
:
|
|
656
|
-
:
|
|
657
|
-
:
|
|
656
|
+
:selectable="$props.showSelect"
|
|
657
|
+
:singleSelect="$props.singleSelect"
|
|
658
|
+
:to="$props.itemTo"
|
|
659
|
+
:bottomColor="$props.color"
|
|
658
660
|
:item="item.raw"
|
|
659
661
|
:key="index"
|
|
660
|
-
:modelValue="$props.modelValue
|
|
661
|
-
@update:modelValue="toggleSelect"
|
|
662
|
-
|
|
663
|
-
|
|
662
|
+
:modelValue="$props.modelValue?.includes(item.raw[$props.itemValue])"
|
|
663
|
+
@update:modelValue="toggleSelect(item.raw)"
|
|
664
|
+
v-bind="onClickLibrary.clickable ? {
|
|
665
|
+
onClick: (event) => onClickLibrary.mobile(event, item),
|
|
666
|
+
onAuxclick: (event) => onClickLibrary.mobile(event, item)
|
|
667
|
+
} : {}"
|
|
664
668
|
>
|
|
665
669
|
<template
|
|
666
670
|
#item.top="props"
|
|
@@ -1126,6 +1130,7 @@ export default defineComponent({
|
|
|
1126
1130
|
});
|
|
1127
1131
|
|
|
1128
1132
|
const onClickLibrary = computed((): { [key: string]: Function | boolean } => {
|
|
1133
|
+
console.log(props["onClick:row"]);
|
|
1129
1134
|
if (props["onClick:row"] || props.itemTo) {
|
|
1130
1135
|
return {
|
|
1131
1136
|
clickable: true,
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
variant="standard"
|
|
13
13
|
:height="['30px', '24px']"
|
|
14
14
|
:color="ColorEnum.Dark"
|
|
15
|
-
:
|
|
15
|
+
:clickable="true"
|
|
16
16
|
:label="label"
|
|
17
17
|
v-bind="props"
|
|
18
18
|
/>
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
:height="['30px', '24px']"
|
|
41
41
|
:variant="getAllVariant()"
|
|
42
42
|
:color="$props.color"
|
|
43
|
-
:
|
|
43
|
+
:clickable="true"
|
|
44
44
|
@click="onToggleAll"
|
|
45
45
|
/>
|
|
46
46
|
<FSDivider />
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
:height="['30px', '24px']"
|
|
64
64
|
:color="$props.color"
|
|
65
65
|
:label="filter.text"
|
|
66
|
-
:
|
|
66
|
+
:clickable="true"
|
|
67
67
|
:key="index"
|
|
68
68
|
@click="() => onToggle(filter)"
|
|
69
69
|
>
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
variant="borderless"
|
|
36
36
|
:label="$tr('data-table.hide-column', 'Hide column')"
|
|
37
37
|
:height="[30, 24]"
|
|
38
|
-
:
|
|
38
|
+
:clickable="true"
|
|
39
39
|
@click="$emit('update:hide')"
|
|
40
40
|
/>
|
|
41
41
|
<FSChip
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
prependIcon="mdi-chevron-left"
|
|
46
46
|
:label="$tr('data-table.move-left', 'Move to the left')"
|
|
47
47
|
:height="[30, 24]"
|
|
48
|
-
:
|
|
48
|
+
:clickable="true"
|
|
49
49
|
@click="$emit('update:left')"
|
|
50
50
|
/>
|
|
51
51
|
<FSChip
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
prependIcon="mdi-chevron-right"
|
|
56
56
|
:label="$tr('data-table.move-right', 'Move to the right')"
|
|
57
57
|
:height="[30, 24]"
|
|
58
|
-
:
|
|
58
|
+
:clickable="true"
|
|
59
59
|
@click="$emit('update:right')"
|
|
60
60
|
/>
|
|
61
61
|
</FSCol>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
prependIcon="mdi-eye-off-outline"
|
|
11
11
|
:height="[30, 24]"
|
|
12
12
|
:color="ColorEnum.Light"
|
|
13
|
-
:
|
|
13
|
+
:clickable="true"
|
|
14
14
|
:label="$tr('data-table.hidden-columns', '{0} hidden column(s)', $props.headers.length.toString())"
|
|
15
15
|
v-bind="props"
|
|
16
16
|
/>
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
:height="['30px', '24px']"
|
|
47
47
|
:color="$props.color"
|
|
48
48
|
:label="header.text"
|
|
49
|
-
:
|
|
49
|
+
:clickable="true"
|
|
50
50
|
:key="index"
|
|
51
51
|
@click="$emit('update:show', header)"
|
|
52
52
|
>
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
<FSTile
|
|
3
3
|
:activeColor="ColorEnum.Primary"
|
|
4
4
|
:bottomColor="ColorEnum.Primary"
|
|
5
|
-
:editable="$props.editable"
|
|
6
5
|
:width="$props.width"
|
|
7
6
|
:modelValue="$props.modelValue"
|
|
8
7
|
v-bind="$attrs"
|
|
@@ -147,11 +146,6 @@ export default defineComponent({
|
|
|
147
146
|
type: Boolean,
|
|
148
147
|
required: false,
|
|
149
148
|
default: false
|
|
150
|
-
},
|
|
151
|
-
editable: {
|
|
152
|
-
type: Boolean,
|
|
153
|
-
required: false,
|
|
154
|
-
default: true
|
|
155
149
|
}
|
|
156
150
|
},
|
|
157
151
|
setup(props) {
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
<FSTile
|
|
3
3
|
:activeColor="ColorEnum.Primary"
|
|
4
4
|
:bottomColor="ColorEnum.Error"
|
|
5
|
-
:editable="$props.editable"
|
|
6
5
|
:width="$props.width"
|
|
7
6
|
:modelValue="$props.modelValue"
|
|
8
7
|
v-bind="$attrs"
|
|
@@ -169,11 +168,6 @@ export default defineComponent({
|
|
|
169
168
|
required: false,
|
|
170
169
|
default: false
|
|
171
170
|
},
|
|
172
|
-
editable: {
|
|
173
|
-
type: Boolean,
|
|
174
|
-
required: false,
|
|
175
|
-
default: true
|
|
176
|
-
},
|
|
177
171
|
width: {
|
|
178
172
|
type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
|
|
179
173
|
required: false,
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
/>
|
|
41
41
|
</FSRow>
|
|
42
42
|
<FSCard
|
|
43
|
-
v-if="$props.
|
|
43
|
+
v-if="$props.selectable"
|
|
44
44
|
class="fs-tile-checkbox"
|
|
45
45
|
:height="['40px', '32px']"
|
|
46
46
|
:width="['40px', '32px']"
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
>
|
|
49
49
|
<FSCheckbox
|
|
50
50
|
:modelValue="$props.modelValue"
|
|
51
|
+
:disabled="true"
|
|
51
52
|
@update:modelValue="() => $emit('update:modelValue', !$props.modelValue)"
|
|
52
53
|
/>
|
|
53
54
|
</FSCard>
|
|
@@ -81,7 +82,7 @@ export default defineComponent({
|
|
|
81
82
|
required: false,
|
|
82
83
|
default: false
|
|
83
84
|
},
|
|
84
|
-
|
|
85
|
+
selectable: {
|
|
85
86
|
type: Boolean,
|
|
86
87
|
required: false,
|
|
87
88
|
default: false
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<FSTile
|
|
3
3
|
:activeColor="ColorEnum.Primary"
|
|
4
|
-
:editable="$props.editable"
|
|
5
4
|
:width="$props.width"
|
|
6
5
|
:modelValue="$props.modelValue"
|
|
7
6
|
v-bind="$attrs"
|
|
@@ -108,11 +107,6 @@ export default defineComponent({
|
|
|
108
107
|
type: Boolean,
|
|
109
108
|
required: false,
|
|
110
109
|
default: false
|
|
111
|
-
},
|
|
112
|
-
editable: {
|
|
113
|
-
type: Boolean,
|
|
114
|
-
required: false,
|
|
115
|
-
default: true
|
|
116
110
|
}
|
|
117
111
|
},
|
|
118
112
|
setup(props) {
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
<FSTile
|
|
3
3
|
:activeColor="$props.activeColor"
|
|
4
4
|
:bottomColor="$props.bottomColor"
|
|
5
|
-
:editable="$props.editable"
|
|
6
5
|
:width="$props.width"
|
|
7
6
|
:modelValue="$props.modelValue"
|
|
8
7
|
v-bind="$attrs"
|
|
@@ -136,11 +135,6 @@ export default defineComponent({
|
|
|
136
135
|
type: Boolean,
|
|
137
136
|
required: false,
|
|
138
137
|
default: false
|
|
139
|
-
},
|
|
140
|
-
editable: {
|
|
141
|
-
type: Boolean,
|
|
142
|
-
required: false,
|
|
143
|
-
default: true
|
|
144
138
|
}
|
|
145
139
|
},
|
|
146
140
|
setup(props) {
|
|
@@ -4,58 +4,52 @@
|
|
|
4
4
|
:height="$props.height"
|
|
5
5
|
:width="$props.width"
|
|
6
6
|
>
|
|
7
|
-
<
|
|
8
|
-
v-if="$props.
|
|
7
|
+
<FSClickable
|
|
8
|
+
v-if="($props.href || $props.to || $attrs.onClick)"
|
|
9
|
+
variant="background"
|
|
10
|
+
class="fs-tile"
|
|
11
|
+
padding="12px"
|
|
12
|
+
:href="$props.href"
|
|
13
|
+
width="100%"
|
|
14
|
+
height="100%"
|
|
15
|
+
:to="$props.to"
|
|
16
|
+
:style="style"
|
|
17
|
+
v-bind="$attrs"
|
|
9
18
|
>
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
:
|
|
15
|
-
:
|
|
16
|
-
|
|
17
|
-
height="100%"
|
|
18
|
-
@click="() => $emit('update:modelValue', !$props.modelValue)"
|
|
19
|
-
v-bind="$attrs"
|
|
20
|
-
>
|
|
21
|
-
<slot />
|
|
22
|
-
</FSClickable>
|
|
23
|
-
<FSClickable
|
|
24
|
-
v-else-if="$props.href || $props.to || $attrs.onClick"
|
|
25
|
-
variant="background"
|
|
26
|
-
class="fs-tile"
|
|
27
|
-
padding="12px"
|
|
28
|
-
:color="ColorEnum.Background"
|
|
29
|
-
:href="$props.href"
|
|
30
|
-
width="100%"
|
|
31
|
-
height="100%"
|
|
32
|
-
:to="$props.to"
|
|
33
|
-
:style="style"
|
|
34
|
-
v-bind="$attrs"
|
|
19
|
+
<slot />
|
|
20
|
+
<FSCard
|
|
21
|
+
v-if="$props.selectable"
|
|
22
|
+
class="fs-tile-checkbox"
|
|
23
|
+
:height="['40px', '32px']"
|
|
24
|
+
:width="['40px', '32px']"
|
|
25
|
+
:border="false"
|
|
35
26
|
>
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
27
|
+
<FSCheckbox
|
|
28
|
+
:modelValue="$props.modelValue"
|
|
29
|
+
@update:modelValue="() => $emit('update:modelValue', !$props.modelValue)"
|
|
30
|
+
/>
|
|
31
|
+
</FSCard>
|
|
32
|
+
</FSClickable>
|
|
33
|
+
|
|
34
|
+
<FSClickable
|
|
35
|
+
v-else-if="$props.selectable && $props.singleSelect"
|
|
36
|
+
padding="12px"
|
|
37
|
+
:variant="variant"
|
|
38
|
+
:color="color"
|
|
39
|
+
:style="style"
|
|
40
|
+
width="100%"
|
|
41
|
+
height="100%"
|
|
42
|
+
@click="() => $emit('update:modelValue', !$props.modelValue)"
|
|
43
|
+
v-bind="$attrs"
|
|
44
|
+
>
|
|
45
|
+
<slot />
|
|
46
|
+
</FSClickable>
|
|
47
|
+
|
|
53
48
|
<FSCard
|
|
54
49
|
v-else
|
|
55
50
|
variant="background"
|
|
56
51
|
class="fs-tile"
|
|
57
52
|
padding="12px"
|
|
58
|
-
:color="color"
|
|
59
53
|
:style="style"
|
|
60
54
|
width="100%"
|
|
61
55
|
height="100%"
|
|
@@ -63,13 +57,12 @@
|
|
|
63
57
|
>
|
|
64
58
|
<slot />
|
|
65
59
|
<FSCard
|
|
66
|
-
v-if="$props.
|
|
60
|
+
v-if="$props.selectable"
|
|
67
61
|
class="fs-tile-checkbox"
|
|
68
62
|
variant="background"
|
|
69
63
|
:height="['40px', '32px']"
|
|
70
64
|
:width="['40px', '32px']"
|
|
71
65
|
:border="false"
|
|
72
|
-
v-bind="$attrs"
|
|
73
66
|
>
|
|
74
67
|
<FSCheckbox
|
|
75
68
|
:modelValue="$props.modelValue"
|
|
@@ -77,6 +70,7 @@
|
|
|
77
70
|
/>
|
|
78
71
|
</FSCard>
|
|
79
72
|
</FSCard>
|
|
73
|
+
|
|
80
74
|
<div
|
|
81
75
|
v-if="$props.leftColor"
|
|
82
76
|
class="fs-tile-left"
|
|
@@ -139,7 +133,7 @@ export default defineComponent({
|
|
|
139
133
|
required: false,
|
|
140
134
|
default: null
|
|
141
135
|
},
|
|
142
|
-
|
|
136
|
+
selectable: {
|
|
143
137
|
type: Boolean,
|
|
144
138
|
required: false,
|
|
145
139
|
default: false
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<FSTile
|
|
3
3
|
:activeColor="ColorEnum.Primary"
|
|
4
|
-
:editable="$props.editable"
|
|
5
4
|
:width="$props.width"
|
|
6
5
|
:modelValue="$props.modelValue"
|
|
7
6
|
v-bind="$attrs"
|
|
@@ -114,11 +113,6 @@ export default defineComponent({
|
|
|
114
113
|
type: Boolean,
|
|
115
114
|
required: false,
|
|
116
115
|
default: false
|
|
117
|
-
},
|
|
118
|
-
editable: {
|
|
119
|
-
type: Boolean,
|
|
120
|
-
required: false,
|
|
121
|
-
default: true
|
|
122
116
|
}
|
|
123
117
|
},
|
|
124
118
|
setup(props) {
|
|
@@ -1,20 +1,25 @@
|
|
|
1
|
+
/// <reference types="@types/google.maps" />
|
|
1
2
|
import _ from "lodash";
|
|
2
3
|
|
|
3
4
|
import { Address, type Place } from "@dative-gpi/foundation-shared-domain/models";
|
|
5
|
+
import { useAppLanguageCode } from '@dative-gpi/foundation-shared-services/composables';
|
|
4
6
|
|
|
5
7
|
export const useAddress = () => {
|
|
6
8
|
const enabled = true;
|
|
9
|
+
const { languageCode } = useAppLanguageCode();
|
|
10
|
+
|
|
7
11
|
let initialized = false;
|
|
12
|
+
let userLocation: google.maps.LatLngLiteral | null;
|
|
8
13
|
let searchService: google.maps.places.AutocompleteService;
|
|
9
14
|
let placeService: google.maps.places.PlacesService;
|
|
10
15
|
let sessionId: google.maps.places.AutocompleteSessionToken;
|
|
11
|
-
|
|
12
16
|
|
|
13
17
|
const init = async () => {
|
|
14
18
|
await window.initMap;
|
|
19
|
+
userLocation = await getCurrentLocation();
|
|
15
20
|
searchService = new google.maps.places.AutocompleteService();
|
|
16
21
|
placeService = new google.maps.places.PlacesService(
|
|
17
|
-
document.
|
|
22
|
+
document.createElement("div")
|
|
18
23
|
);
|
|
19
24
|
sessionId = new google.maps.places.AutocompleteSessionToken();
|
|
20
25
|
initialized = true;
|
|
@@ -25,11 +30,12 @@ export const useAddress = () => {
|
|
|
25
30
|
await init();
|
|
26
31
|
}
|
|
27
32
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
const mapsResults = await _search(search);
|
|
34
|
+
|
|
35
|
+
return mapsResults.map((result) => ({
|
|
36
|
+
id: result.place_id,
|
|
37
|
+
label: result.description
|
|
38
|
+
}));
|
|
33
39
|
}
|
|
34
40
|
|
|
35
41
|
const get = async (place: Place): Promise<Address> => {
|
|
@@ -78,16 +84,42 @@ export const useAddress = () => {
|
|
|
78
84
|
});
|
|
79
85
|
}
|
|
80
86
|
|
|
87
|
+
const getCurrentLocation = async (): Promise<google.maps.LatLngLiteral | null> => {
|
|
88
|
+
if (!navigator.geolocation) {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return new Promise((resolve) => {
|
|
93
|
+
navigator.geolocation.getCurrentPosition(
|
|
94
|
+
(position) => {
|
|
95
|
+
resolve({
|
|
96
|
+
lat: position.coords.latitude,
|
|
97
|
+
lng: position.coords.longitude
|
|
98
|
+
});
|
|
99
|
+
},
|
|
100
|
+
() => resolve(null)
|
|
101
|
+
);
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
|
|
81
105
|
const _search = (search: string) => {
|
|
82
106
|
if (!enabled) {
|
|
83
107
|
throw new Error("offline mode, do not call this method");
|
|
84
108
|
}
|
|
85
109
|
return new Promise<google.maps.places.AutocompletePrediction[]>(
|
|
86
110
|
(resolve, reject) => {
|
|
111
|
+
/**
|
|
112
|
+
* ISO 3166 language code
|
|
113
|
+
*/
|
|
114
|
+
const isoLanguageCode = languageCode.value?.split("-")[0];
|
|
115
|
+
|
|
87
116
|
searchService!.getPlacePredictions(
|
|
88
117
|
{
|
|
89
118
|
input: search,
|
|
90
|
-
|
|
119
|
+
region: isoLanguageCode,
|
|
120
|
+
language: isoLanguageCode,
|
|
121
|
+
sessionToken: sessionId,
|
|
122
|
+
locationBias: userLocation,
|
|
91
123
|
},
|
|
92
124
|
function (result, status) {
|
|
93
125
|
if (status != google.maps.places.PlacesServiceStatus.OK || !result) {
|
package/composables/useColors.ts
CHANGED
|
@@ -5,6 +5,8 @@ import Color from "color";
|
|
|
5
5
|
import type { ColorBase, ColorVariations } from "@dative-gpi/foundation-shared-components/models";
|
|
6
6
|
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
7
7
|
|
|
8
|
+
const colorsCache: Map<string, ColorVariations> = new Map();
|
|
9
|
+
|
|
8
10
|
export const useColors = () => {
|
|
9
11
|
const theme = useTheme().current.value;
|
|
10
12
|
const baseMinSaturation = 0;
|
|
@@ -40,17 +42,17 @@ export const useColors = () => {
|
|
|
40
42
|
};
|
|
41
43
|
|
|
42
44
|
const getContrast = (color: Color): Color => {
|
|
43
|
-
if(isGrayScale(color)){
|
|
45
|
+
if (isGrayScale(color)) {
|
|
44
46
|
const coeff = 4
|
|
45
47
|
return color
|
|
46
48
|
.value(color.value() < 70 ? 100 : Math.max(color.value() / coeff, 0));
|
|
47
49
|
}
|
|
48
50
|
|
|
49
|
-
if(isPastel(color)){
|
|
51
|
+
if (isPastel(color)) {
|
|
50
52
|
return color.darken(0.6);
|
|
51
53
|
}
|
|
52
54
|
|
|
53
|
-
if(color.darken(0.15).isLight()){
|
|
55
|
+
if (color.darken(0.15).isLight()) {
|
|
54
56
|
return color.darken(0.8);
|
|
55
57
|
}
|
|
56
58
|
|
|
@@ -59,7 +61,7 @@ export const useColors = () => {
|
|
|
59
61
|
|
|
60
62
|
const parseColor = (color: ColorBase): Color => {
|
|
61
63
|
const themed = (Object as any).values(ColorEnum).includes(color);
|
|
62
|
-
|
|
64
|
+
|
|
63
65
|
try {
|
|
64
66
|
return themed ? new Color(theme.colors[color as ColorEnum]) : new Color(color);
|
|
65
67
|
}
|
|
@@ -70,7 +72,7 @@ export const useColors = () => {
|
|
|
70
72
|
|
|
71
73
|
const getColors = (color: ColorBase): ColorVariations => {
|
|
72
74
|
const base = parseColor(color);
|
|
73
|
-
|
|
75
|
+
|
|
74
76
|
const light = getLight(base);
|
|
75
77
|
const soft = getSoft(base);
|
|
76
78
|
const dark = getDark(base);
|
|
@@ -88,7 +90,7 @@ export const useColors = () => {
|
|
|
88
90
|
};
|
|
89
91
|
|
|
90
92
|
const getGradients = (colors: ColorBase | ColorBase[], rotation: number = 90): ColorVariations => {
|
|
91
|
-
const variations = Array.isArray(colors) ? colors.map(
|
|
93
|
+
const variations = Array.isArray(colors) ? colors.map(getColorsCached) : [getColorsCached(colors)];
|
|
92
94
|
|
|
93
95
|
if (variations.length === 1) {
|
|
94
96
|
return variations[0];
|
|
@@ -121,9 +123,16 @@ export const useColors = () => {
|
|
|
121
123
|
return colors;
|
|
122
124
|
}
|
|
123
125
|
|
|
126
|
+
const getColorsCached = (color: ColorBase): ColorVariations => {
|
|
127
|
+
if (!colorsCache.has(color)) {
|
|
128
|
+
const variations = getColors(color);
|
|
129
|
+
colorsCache.set(color, variations);
|
|
130
|
+
}
|
|
131
|
+
return colorsCache.get(color) as ColorVariations;
|
|
132
|
+
};
|
|
124
133
|
|
|
125
134
|
return {
|
|
126
|
-
getColors,
|
|
135
|
+
getColors : getColorsCached,
|
|
127
136
|
getGradients,
|
|
128
137
|
getBasePaletteColors
|
|
129
138
|
};
|
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.
|
|
4
|
+
"version": "1.0.140-selectable",
|
|
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.
|
|
14
|
-
"@dative-gpi/foundation-shared-services": "1.0.
|
|
13
|
+
"@dative-gpi/foundation-shared-domain": "1.0.140-selectable",
|
|
14
|
+
"@dative-gpi/foundation-shared-services": "1.0.140-selectable"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"@dative-gpi/bones-ui": "^1.0.0",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"sass": "1.71.1",
|
|
36
36
|
"sass-loader": "13.3.2"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "6faaffa554359a3319265c4f25e44a5da901fe20"
|
|
39
39
|
}
|