@dative-gpi/foundation-shared-components 0.0.54 → 0.0.55
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.
|
@@ -217,8 +217,8 @@ export default defineComponent({
|
|
|
217
217
|
case ColorEnum.Primary:
|
|
218
218
|
case ColorEnum.Success:
|
|
219
219
|
case ColorEnum.Warning:
|
|
220
|
-
case ColorEnum.Error : return ["
|
|
221
|
-
default : return ["
|
|
220
|
+
case ColorEnum.Error : return ["full"].includes(props.variant) ? colors.value.light : colors.value.dark;
|
|
221
|
+
default : return ["full"].includes(props.variant) ? darks.light : darks.dark;
|
|
222
222
|
}
|
|
223
223
|
});
|
|
224
224
|
|
|
@@ -1085,7 +1085,7 @@ export default defineComponent({
|
|
|
1085
1085
|
if (dragged != null) {
|
|
1086
1086
|
const target = (event.target as HTMLElement)?.closest(elementSelector);
|
|
1087
1087
|
|
|
1088
|
-
if (target != null) {
|
|
1088
|
+
if (target != null && (target !== dragged || (props.sortDraggable && props.includeDraggable))) {
|
|
1089
1089
|
if (props.includeDraggable) {
|
|
1090
1090
|
if (!props.sortDraggable) {
|
|
1091
1091
|
target.classList.add("fs-dropzone-include");
|
|
@@ -1110,14 +1110,24 @@ export default defineComponent({
|
|
|
1110
1110
|
}
|
|
1111
1111
|
}
|
|
1112
1112
|
else if (props.sortDraggable) {
|
|
1113
|
-
const
|
|
1114
|
-
const
|
|
1115
|
-
if (
|
|
1113
|
+
const draggedY = dragged.getBoundingClientRect().top;
|
|
1114
|
+
const targetY = target.getBoundingClientRect().top;
|
|
1115
|
+
if (draggedY < targetY) {
|
|
1116
1116
|
target.insertAdjacentElement("afterend", dragged);
|
|
1117
1117
|
}
|
|
1118
|
-
else {
|
|
1118
|
+
else if (draggedY > targetY) {
|
|
1119
1119
|
target.insertAdjacentElement("beforebegin", dragged);
|
|
1120
1120
|
}
|
|
1121
|
+
else {
|
|
1122
|
+
const draggedX = dragged.getBoundingClientRect().left;
|
|
1123
|
+
const targetX = target.getBoundingClientRect().left;
|
|
1124
|
+
if (draggedX < targetX) {
|
|
1125
|
+
target.insertAdjacentElement("afterend", dragged);
|
|
1126
|
+
}
|
|
1127
|
+
else {
|
|
1128
|
+
target.insertAdjacentElement("beforebegin", dragged);
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1121
1131
|
}
|
|
1122
1132
|
}
|
|
1123
1133
|
|
|
@@ -1157,7 +1167,7 @@ export default defineComponent({
|
|
|
1157
1167
|
const itemsData = draggedData.item ?? draggedData.raw;
|
|
1158
1168
|
const rowData = row.item ?? row.raw;
|
|
1159
1169
|
|
|
1160
|
-
if (target != null) {
|
|
1170
|
+
if (target != null && target !== draggedElement) {
|
|
1161
1171
|
if (props.includeDraggable && itemsData[props.itemValue] != rowData[props.itemValue]) {
|
|
1162
1172
|
emit("update:include", { draggedItem: itemsData, targetItem: rowData })
|
|
1163
1173
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<FSRow
|
|
3
|
+
width="hug"
|
|
3
4
|
:draggable="!$props.disabled"
|
|
4
5
|
:class="classes"
|
|
5
6
|
@touchstart="onTouchStart"
|
|
@@ -10,27 +11,32 @@
|
|
|
10
11
|
@dragover.prevent
|
|
11
12
|
>
|
|
12
13
|
<slot />
|
|
13
|
-
</
|
|
14
|
+
</FSRow>
|
|
14
15
|
</template>
|
|
15
16
|
|
|
16
17
|
<script lang="ts">
|
|
17
18
|
import { computed, defineComponent, ref } from "vue";
|
|
18
19
|
|
|
20
|
+
import FSRow from "../FSRow.vue";
|
|
21
|
+
|
|
19
22
|
export default defineComponent({
|
|
20
23
|
name: "FSDraggable",
|
|
21
24
|
props: {
|
|
22
25
|
elementSelector: {
|
|
23
26
|
type: String,
|
|
24
|
-
default: null
|
|
27
|
+
default: null
|
|
25
28
|
},
|
|
26
29
|
item: {
|
|
27
30
|
type: Object,
|
|
28
|
-
default: null
|
|
31
|
+
default: null
|
|
29
32
|
},
|
|
30
33
|
disabled: {
|
|
31
34
|
type: Boolean,
|
|
32
|
-
default: false
|
|
33
|
-
}
|
|
35
|
+
default: false
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
components: {
|
|
39
|
+
FSRow
|
|
34
40
|
},
|
|
35
41
|
emits: ["update:dragstart", "update:dragend"],
|
|
36
42
|
setup(props, { emit }) {
|
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.55",
|
|
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.55",
|
|
14
|
+
"@dative-gpi/foundation-shared-services": "0.0.55",
|
|
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": "c7ec3fb302319a1f49bb44f60c288eda9dec57d6"
|
|
36
36
|
}
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
.fs-draggable-item {
|
|
2
|
+
transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
|
|
3
|
+
|
|
4
|
+
&:has(.fs-data-iterator-item) {
|
|
5
|
+
flex: 1 1 0 !important;
|
|
6
|
+
width: 100% !important;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
1
10
|
.fs-draggable-dragging {
|
|
2
11
|
opacity: 0.4;
|
|
3
12
|
filter: blur(1px);
|
|
@@ -8,10 +17,6 @@
|
|
|
8
17
|
filter: brightness(0.85) contrast(1.1);
|
|
9
18
|
}
|
|
10
19
|
|
|
11
|
-
.fs-draggable-item {
|
|
12
|
-
transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
20
|
div.fs-dropzone-include {
|
|
16
21
|
transform: scale(1.04);
|
|
17
22
|
}
|