@dative-gpi/foundation-shared-components 0.0.91 → 0.0.93
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/FSFadeOut.vue +18 -1
- package/components/buttons/FSButtonCheckbox.vue +72 -0
- package/components/deviceOrganisations/FSConnectivityCard.vue +5 -15
- package/components/lists/FSDataTableUI.vue +8 -6
- package/package.json +4 -4
- package/utils/css.ts +1 -1
- package/utils/index.ts +1 -0
- package/utils/levenshtein.ts +3 -3
- package/utils/statuses.ts +13 -0
package/components/FSFadeOut.vue
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
</template>
|
|
11
11
|
|
|
12
12
|
<script lang="ts">
|
|
13
|
-
import { computed, defineComponent, onMounted, PropType, ref, watch } from "vue";
|
|
13
|
+
import { computed, defineComponent, onMounted, onUnmounted, PropType, ref, watch } from "vue";
|
|
14
14
|
|
|
15
15
|
import { useBreakpoints, useColors, useDebounce } from "@dative-gpi/foundation-shared-components/composables";
|
|
16
16
|
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
@@ -52,6 +52,8 @@ export default defineComponent({
|
|
|
52
52
|
const topMaskHeight = ref("0px");
|
|
53
53
|
const lastScroll = ref(0);
|
|
54
54
|
|
|
55
|
+
const resizeObserver = ref<ResizeObserver | null>(null);
|
|
56
|
+
|
|
55
57
|
const style = computed((): { [key: string] : string | undefined } => {
|
|
56
58
|
return {
|
|
57
59
|
"--fs-fade-out-height" : sizeToVar(props.height),
|
|
@@ -99,6 +101,21 @@ export default defineComponent({
|
|
|
99
101
|
|
|
100
102
|
onMounted((): void => {
|
|
101
103
|
debounceMasks();
|
|
104
|
+
|
|
105
|
+
resizeObserver.value = new ResizeObserver(entries => {
|
|
106
|
+
entries.forEach(() => {
|
|
107
|
+
debounceMasks();
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
if (document.querySelector(".fs-fade-out")) {
|
|
111
|
+
resizeObserver.value.observe(document.querySelector(".fs-fade-out")!);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
onUnmounted((): void => {
|
|
116
|
+
if (resizeObserver.value) {
|
|
117
|
+
resizeObserver.value.disconnect();
|
|
118
|
+
}
|
|
102
119
|
});
|
|
103
120
|
|
|
104
121
|
watch([() => windowWidth.value, () => windowHeight.value], debounceMasks);
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSButton
|
|
3
|
+
:editable="$props.editable"
|
|
4
|
+
:prependIcon="prependIcon"
|
|
5
|
+
:load="$props.load"
|
|
6
|
+
:variant="variant"
|
|
7
|
+
@click.stop="onClick"
|
|
8
|
+
v-bind="$attrs"
|
|
9
|
+
>
|
|
10
|
+
<template
|
|
11
|
+
v-for="(_, name) in $slots"
|
|
12
|
+
v-slot:[name]="slotData"
|
|
13
|
+
>
|
|
14
|
+
<slot
|
|
15
|
+
:name="name"
|
|
16
|
+
v-bind="slotData"
|
|
17
|
+
/>
|
|
18
|
+
</template>
|
|
19
|
+
</FSButton>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script lang="ts">
|
|
23
|
+
import { computed, defineComponent } from "vue";
|
|
24
|
+
|
|
25
|
+
import FSButton from "../FSButton.vue";
|
|
26
|
+
|
|
27
|
+
export default defineComponent({
|
|
28
|
+
name: "FSButtonCheckbox",
|
|
29
|
+
components: {
|
|
30
|
+
FSButton
|
|
31
|
+
},
|
|
32
|
+
props: {
|
|
33
|
+
modelValue: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
required: false,
|
|
36
|
+
default: false
|
|
37
|
+
},
|
|
38
|
+
load: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
required: false,
|
|
41
|
+
default: false
|
|
42
|
+
},
|
|
43
|
+
editable: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
required: false,
|
|
46
|
+
default: true
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
emits: ["update:modelValue"],
|
|
50
|
+
setup(props, { emit }) {
|
|
51
|
+
const prependIcon = computed((): string => {
|
|
52
|
+
return props.modelValue ? "mdi-checkbox-marked" : "mdi-checkbox-blank-outline";
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const variant = computed((): "full" | "standard" => {
|
|
56
|
+
return props.modelValue ? "full" : "standard";
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const onClick = (): void => {
|
|
60
|
+
if (props.editable && !props.load) {
|
|
61
|
+
emit("update:modelValue", !props.modelValue);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
return {
|
|
66
|
+
prependIcon,
|
|
67
|
+
variant,
|
|
68
|
+
onClick
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
</script>
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
<FSChip
|
|
29
29
|
:prependIcon="$props.deviceConnectivity.icon"
|
|
30
30
|
:color="$props.deviceConnectivity.color"
|
|
31
|
-
:label="connectivityLabel"
|
|
31
|
+
:label="connectivityLabel($props.deviceConnectivity.status)"
|
|
32
32
|
/>
|
|
33
33
|
<FSRow
|
|
34
34
|
width="hug"
|
|
@@ -57,10 +57,10 @@
|
|
|
57
57
|
<script lang="ts">
|
|
58
58
|
import { computed, defineComponent, PropType } from "vue";
|
|
59
59
|
|
|
60
|
-
import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
|
|
61
60
|
import { FSDeviceConnectivity } from "@dative-gpi/foundation-shared-components/models";
|
|
62
61
|
import { useAppTimeZone } from "@dative-gpi/foundation-shared-services/composables";
|
|
63
|
-
|
|
62
|
+
|
|
63
|
+
import { connectivityLabel } from "../../utils";
|
|
64
64
|
|
|
65
65
|
import FSButton from "../FSButton.vue";
|
|
66
66
|
import FSCard from "../FSCard.vue";
|
|
@@ -90,16 +90,6 @@ export default defineComponent({
|
|
|
90
90
|
emit: ["close"],
|
|
91
91
|
setup(props) {
|
|
92
92
|
const { epochToLongTimeFormat } = useAppTimeZone();
|
|
93
|
-
const { $tr } = useTranslationsProvider();
|
|
94
|
-
|
|
95
|
-
const connectivityLabel = computed((): string => {
|
|
96
|
-
switch (props.deviceConnectivity.status) {
|
|
97
|
-
case ConnectivityStatus.Connected: return $tr("ui.connectivity-status.connected", "Connected");
|
|
98
|
-
case ConnectivityStatus.PartiallyConnected: return $tr("ui.connectivity-status.partially-connected", "Partially connected");
|
|
99
|
-
case ConnectivityStatus.AlmostOffline: return $tr("ui.connectivity-status.almost-offline", "Almost offline");
|
|
100
|
-
default: return $tr("ui.connectivity-status.offline", "Offline");
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
93
|
|
|
104
94
|
const deviceTimestamp = computed((): string => {
|
|
105
95
|
if (props.deviceConnectivity.sourceTimestamp) {
|
|
@@ -109,8 +99,8 @@ export default defineComponent({
|
|
|
109
99
|
});
|
|
110
100
|
|
|
111
101
|
return {
|
|
112
|
-
|
|
113
|
-
|
|
102
|
+
deviceTimestamp,
|
|
103
|
+
connectivityLabel
|
|
114
104
|
};
|
|
115
105
|
}
|
|
116
106
|
});
|
|
@@ -303,7 +303,7 @@
|
|
|
303
303
|
</slot>
|
|
304
304
|
</template>
|
|
305
305
|
<template
|
|
306
|
-
v-for="
|
|
306
|
+
v-for="item in itemsSlots"
|
|
307
307
|
#[item.slotName]="props"
|
|
308
308
|
>
|
|
309
309
|
<div
|
|
@@ -315,7 +315,6 @@
|
|
|
315
315
|
>
|
|
316
316
|
<FSRow
|
|
317
317
|
align="center-left"
|
|
318
|
-
:key="index"
|
|
319
318
|
>
|
|
320
319
|
<FSSpan
|
|
321
320
|
font="text-overline"
|
|
@@ -1212,13 +1211,16 @@ export default defineComponent({
|
|
|
1212
1211
|
};
|
|
1213
1212
|
|
|
1214
1213
|
const toggleSort = (header: FSDataTableColumn) => {
|
|
1215
|
-
if (header.value == null) {
|
|
1216
|
-
|
|
1214
|
+
if (header.value == null) {
|
|
1215
|
+
return;
|
|
1216
|
+
}
|
|
1217
1217
|
if (innerSortBy.value?.key !== header.value) {
|
|
1218
1218
|
innerSortBy.value = { key: header.value, order: 'asc' };
|
|
1219
|
-
}
|
|
1219
|
+
}
|
|
1220
|
+
else if (innerSortBy.value.order === 'asc') {
|
|
1220
1221
|
innerSortBy.value.order = 'desc' ;
|
|
1221
|
-
}
|
|
1222
|
+
}
|
|
1223
|
+
else {
|
|
1222
1224
|
innerSortBy.value = null;
|
|
1223
1225
|
}
|
|
1224
1226
|
}
|
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.93",
|
|
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.93",
|
|
14
|
+
"@dative-gpi/foundation-shared-services": "0.0.93",
|
|
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": "04a8774b03f5a5dbf22fa3d05ad948e776d4fdad"
|
|
36
36
|
}
|
package/utils/css.ts
CHANGED
package/utils/index.ts
CHANGED
package/utils/levenshtein.ts
CHANGED
|
@@ -9,7 +9,7 @@ export const levenshteinDistance = (a: string, b: string) => {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
if (a.length > b.length) {
|
|
12
|
-
|
|
12
|
+
const tmp = a;
|
|
13
13
|
a = b;
|
|
14
14
|
b = tmp;
|
|
15
15
|
}
|
|
@@ -49,14 +49,14 @@ export const levenshteinDistance = (a: string, b: string) => {
|
|
|
49
49
|
let bx2: number;
|
|
50
50
|
let bx3: number;
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
const vector: number[] = [];
|
|
53
53
|
|
|
54
54
|
for (y = 0; y < la; y++) {
|
|
55
55
|
vector.push(y + 1);
|
|
56
56
|
vector.push(a.charCodeAt(offset + y));
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
const len = vector.length - 1;
|
|
60
60
|
|
|
61
61
|
for (; x < lb - 3;) {
|
|
62
62
|
bx0 = b.charCodeAt(offset + (d0 = x));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
|
|
2
|
+
import { ConnectivityStatus } from "@dative-gpi/foundation-shared-domain/models";
|
|
3
|
+
|
|
4
|
+
const { $tr } = useTranslationsProvider();
|
|
5
|
+
|
|
6
|
+
export const connectivityLabel = ((status: ConnectivityStatus): string => {
|
|
7
|
+
switch (status) {
|
|
8
|
+
case ConnectivityStatus.Connected: return $tr("ui.connectivity-status.connected", "Connected");
|
|
9
|
+
case ConnectivityStatus.PartiallyConnected: return $tr("ui.connectivity-status.partially-connected", "Partially connected");
|
|
10
|
+
case ConnectivityStatus.AlmostOffline: return $tr("ui.connectivity-status.almost-offline", "Almost offline");
|
|
11
|
+
default: return $tr("ui.connectivity-status.offline", "Offline");
|
|
12
|
+
}
|
|
13
|
+
});
|