frappe-ui 0.1.17 → 0.1.19
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/package.json
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import ListHeader from './ListHeader.vue'
|
|
17
17
|
import ListRows from './ListRows.vue'
|
|
18
18
|
import ListSelectBanner from './ListSelectBanner.vue'
|
|
19
|
-
import { reactive, computed, provide } from 'vue'
|
|
19
|
+
import { reactive, computed, provide, watch } from 'vue'
|
|
20
20
|
|
|
21
21
|
defineOptions({
|
|
22
22
|
inheritAttrs: false,
|
|
@@ -48,6 +48,12 @@ const props = defineProps({
|
|
|
48
48
|
|
|
49
49
|
let selections = reactive(new Set())
|
|
50
50
|
|
|
51
|
+
const emit = defineEmits(['update:selections'])
|
|
52
|
+
|
|
53
|
+
watch(selections, (value) => {
|
|
54
|
+
emit('update:selections', value)
|
|
55
|
+
})
|
|
56
|
+
|
|
51
57
|
let _options = computed(() => {
|
|
52
58
|
function defaultTrue(value) {
|
|
53
59
|
return value === undefined ? true : value
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
deleteRowInListResource,
|
|
6
6
|
revertRowInListResource,
|
|
7
7
|
} from './listResource'
|
|
8
|
-
import { getLocal, saveLocal } from './local'
|
|
8
|
+
import { getLocal, saveLocal, deleteLocal } from './local'
|
|
9
9
|
import { onDocUpdate } from './realtime'
|
|
10
10
|
import { getConfig } from '../utils/config'
|
|
11
11
|
|
|
@@ -83,7 +83,12 @@ export function createDocumentResource(options, vm) {
|
|
|
83
83
|
out.originalDoc = JSON.parse(JSON.stringify(out.doc))
|
|
84
84
|
options.onSuccess?.call(vm, out.doc)
|
|
85
85
|
},
|
|
86
|
-
onError
|
|
86
|
+
onError(error) {
|
|
87
|
+
deleteLocal(cacheKey)
|
|
88
|
+
out.doc = null
|
|
89
|
+
out.originalDoc = null
|
|
90
|
+
options.onError?.call(vm, error)
|
|
91
|
+
},
|
|
87
92
|
},
|
|
88
93
|
vm
|
|
89
94
|
),
|
package/src/resources/local.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { get, set } from 'idb-keyval'
|
|
1
|
+
import { get, set, del } from 'idb-keyval'
|
|
2
2
|
|
|
3
3
|
export function saveLocal(key, data) {
|
|
4
4
|
if (typeof indexedDB === 'undefined') {
|
|
@@ -8,6 +8,14 @@ export function saveLocal(key, data) {
|
|
|
8
8
|
return set(key, JSON.stringify(data))
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
export function deleteLocal(key) {
|
|
12
|
+
if (typeof indexedDB === 'undefined') {
|
|
13
|
+
return Promise.resolve(null)
|
|
14
|
+
}
|
|
15
|
+
if (!key) return Promise.resolve()
|
|
16
|
+
return del(key)
|
|
17
|
+
}
|
|
18
|
+
|
|
11
19
|
export function getLocal(key) {
|
|
12
20
|
if (typeof indexedDB === 'undefined') {
|
|
13
21
|
return Promise.resolve(null)
|