@live-change/vue3-components 0.8.110 → 0.8.112
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/synchronized.js +13 -4
- package/package.json +3 -3
package/logic/synchronized.js
CHANGED
|
@@ -59,7 +59,10 @@ function synchronized(options) {
|
|
|
59
59
|
// console.log("SYNCHRONIZED JSON", JSON.stringify(synchronizedValue.value))
|
|
60
60
|
try {
|
|
61
61
|
if(updateDataProperty) {
|
|
62
|
-
await update({
|
|
62
|
+
await update({
|
|
63
|
+
[updateDataProperty]: { ...data, [timeField]: lastLocalUpdate.value },
|
|
64
|
+
...unref(identifiers)
|
|
65
|
+
})
|
|
63
66
|
} else {
|
|
64
67
|
await update({ ...data, [timeField]: lastLocalUpdate.value, ...unref(identifiers) })
|
|
65
68
|
}
|
|
@@ -93,23 +96,28 @@ function synchronized(options) {
|
|
|
93
96
|
lastLocalUpdate.value = sourceData[timeField]
|
|
94
97
|
synchronizedValue.value = copy(sourceData)
|
|
95
98
|
}
|
|
96
|
-
|
|
97
99
|
}
|
|
98
100
|
})
|
|
99
|
-
return { value: synchronizedValue, save, changed }
|
|
101
|
+
return { value: synchronizedValue, save, changed, saving }
|
|
100
102
|
} else {
|
|
101
103
|
const local = ref(source.value)
|
|
102
104
|
const changed = computed(() => (JSON.stringify(source.value) !== JSON.stringify(local.value))
|
|
103
105
|
&& ( ((local.value && local.value[timeField]) ?? '')
|
|
104
106
|
> ((source.value && source.value[timeField]) ?? '')))
|
|
107
|
+
const saving = ref(false)
|
|
105
108
|
async function save() {
|
|
106
109
|
if((JSON.stringify(source.value) === JSON.stringify(local.value))
|
|
107
110
|
|| ( ((local.value && local.value[timeField]) ?? '')
|
|
108
111
|
<= ((source.value && source.value[timeField]) ?? ''))) return false // identical, no need to save
|
|
112
|
+
|
|
113
|
+
saving.value = true
|
|
109
114
|
const data = JSON.parse(JSON.stringify(local.value))
|
|
110
115
|
try {
|
|
111
116
|
if(updateDataProperty) {
|
|
112
|
-
await update({
|
|
117
|
+
await update({
|
|
118
|
+
[updateDataProperty]: { ...data, [timeField]: lastLocalUpdate.value },
|
|
119
|
+
...unref(identifiers)
|
|
120
|
+
})
|
|
113
121
|
} else {
|
|
114
122
|
await update({ ...data, [timeField]: lastLocalUpdate.value, ...unref(identifiers) })
|
|
115
123
|
}
|
|
@@ -119,6 +127,7 @@ function synchronized(options) {
|
|
|
119
127
|
console.error("SAVE ERROR", e)
|
|
120
128
|
onSaveError(e)
|
|
121
129
|
}
|
|
130
|
+
saving.value = false
|
|
122
131
|
return true
|
|
123
132
|
}
|
|
124
133
|
const throttledSave = debounce ? () => {} : (throttle ? useThrottleFn(save, throttle) : save)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/vue3-components",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.112",
|
|
4
4
|
"description": "Live Change Framework - vue components",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
},
|
|
22
22
|
"homepage": "https://github.com/live-change/live-change-stack",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@live-change/vue3-ssr": "^0.8.
|
|
24
|
+
"@live-change/vue3-ssr": "^0.8.112",
|
|
25
25
|
"debug": "^4.3.4",
|
|
26
26
|
"mitt": "3.0.1",
|
|
27
27
|
"vue": "^3.4.29"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "e0d0db33777f8f9fc9f5ebe1a977cf574b837be6"
|
|
30
30
|
}
|