@live-change/vue3-components 0.2.7 → 0.2.8
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/logic/synchronizedList.js +13 -3
- package/package.json +2 -2
|
@@ -69,12 +69,17 @@ function synchronizedList(options) {
|
|
|
69
69
|
return synchronizedElement
|
|
70
70
|
}
|
|
71
71
|
function synchronizeFromSource() {
|
|
72
|
-
console.log("SYNCHRONIZE FROM SOURCE!")
|
|
72
|
+
//console.log("SYNCHRONIZE FROM SOURCE!")
|
|
73
73
|
let obsoleteLocallyAdded = new Set()
|
|
74
74
|
let obsoleteLocallyDeleted = new Set()
|
|
75
75
|
let newSynchronized = sortedArraysMerge(
|
|
76
76
|
(synchronizedElement, sourceElement, locallyAddedElement, locallyDeletedElement) => {
|
|
77
77
|
|
|
78
|
+
/*console.log("MERGE ELEMENT", synchronizedElement)
|
|
79
|
+
console.log("SOURCE ELEMENT", sourceElement)
|
|
80
|
+
console.log("LOCALLY ADDED", locallyAddedElement)
|
|
81
|
+
console.log("LOCALLY DELETED", locallyDeletedElement)*/
|
|
82
|
+
|
|
78
83
|
if(locallyAddedElement && sourceElement) {
|
|
79
84
|
obsoleteLocallyAdded.add(locallyAddedElement.id)
|
|
80
85
|
}
|
|
@@ -88,13 +93,15 @@ function synchronizedList(options) {
|
|
|
88
93
|
}
|
|
89
94
|
if(sourceElement) {
|
|
90
95
|
synchronizedElement.source.value = sourceElement
|
|
96
|
+
return synchronizedElement
|
|
91
97
|
} else if(locallyAddedElement) {
|
|
92
98
|
synchronizedElement.source.value = locallyAddedElement
|
|
99
|
+
return synchronizedElement
|
|
93
100
|
} else {
|
|
94
101
|
return null // synchronized element deleted
|
|
95
102
|
}
|
|
96
103
|
} else if(sourceElement) {
|
|
97
|
-
console.log("CREATE SYNCHRONIZED FROM SOURCE!")
|
|
104
|
+
//console.log("CREATE SYNCHRONIZED FROM SOURCE!")
|
|
98
105
|
return createSynchronizedElement(sourceElement)
|
|
99
106
|
} else if(locallyAddedElement) {
|
|
100
107
|
return createSynchronizedElement(locallyAddedElement)
|
|
@@ -113,7 +120,10 @@ function synchronizedList(options) {
|
|
|
113
120
|
synchronizedList.value = newSynchronized
|
|
114
121
|
}
|
|
115
122
|
|
|
116
|
-
watch(() => (source.value ?? []).map(({ id }) => id), sourceIds =>
|
|
123
|
+
watch(() => (source.value ?? []).map(({ id }) => id), (sourceIds, oldSourceIds) => {
|
|
124
|
+
console.log("SOURCE IDs changed", oldSourceIds, '=>', sourceIds)
|
|
125
|
+
synchronizeFromSource()
|
|
126
|
+
})
|
|
117
127
|
synchronizeFromSource()
|
|
118
128
|
|
|
119
129
|
const changed = computed(() => (synchronizedList.value.some(({ changed }) => changed.value))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/vue3-components",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"description": "Live Change Framework - vue components",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"mitt": "3.0.0",
|
|
27
27
|
"vue": "^3.2.31"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "3d267cf03e99822c79c8954b12c1bdb5f388e269"
|
|
30
30
|
}
|