frappe-ui 0.0.6 → 0.0.7
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 +1 -1
- package/src/components/Dialog.vue +14 -13
- package/src/utils/resources.js +12 -9
package/package.json
CHANGED
|
@@ -44,25 +44,25 @@
|
|
|
44
44
|
<slot name="body">
|
|
45
45
|
<slot name="body-main">
|
|
46
46
|
<div class="px-4 py-5 bg-white sm:p-6">
|
|
47
|
-
<div>
|
|
47
|
+
<div class="flex flex-col sm:flex-row">
|
|
48
48
|
<div
|
|
49
49
|
v-if="icon"
|
|
50
|
-
class="flex items-center justify-center flex-shrink-0 w-12 h-12 mx-auto mb-3 rounded-full sm:mx-0 sm:h-
|
|
50
|
+
class="flex items-center justify-center flex-shrink-0 w-12 h-12 mx-auto mb-3 rounded-full sm:mx-0 sm:h-9 sm:w-9 sm:mb-0 sm:mr-4"
|
|
51
51
|
:class="{
|
|
52
|
-
'bg-yellow-100': icon.
|
|
53
|
-
'bg-blue-100': icon.
|
|
54
|
-
'bg-red-100': icon.
|
|
55
|
-
'bg-green-100': icon.
|
|
52
|
+
'bg-yellow-100': icon.appearance === 'warning',
|
|
53
|
+
'bg-blue-100': icon.appearance === 'info',
|
|
54
|
+
'bg-red-100': icon.appearance === 'danger',
|
|
55
|
+
'bg-green-100': icon.appearance === 'success',
|
|
56
56
|
}"
|
|
57
57
|
>
|
|
58
58
|
<FeatherIcon
|
|
59
59
|
:name="icon.name"
|
|
60
|
-
class="w-6 h-6 text-red-600"
|
|
60
|
+
class="w-6 h-6 text-red-600 sm:w-5 sm:h-5"
|
|
61
61
|
:class="{
|
|
62
|
-
'text-yellow-600': icon.
|
|
63
|
-
'text-blue-600': icon.
|
|
64
|
-
'text-red-600': icon.
|
|
65
|
-
'text-green-600': icon.
|
|
62
|
+
'text-yellow-600': icon.appearance === 'warning',
|
|
63
|
+
'text-blue-600': icon.appearance === 'info',
|
|
64
|
+
'text-red-600': icon.appearance === 'danger',
|
|
65
|
+
'text-green-600': icon.appearance === 'success',
|
|
66
66
|
}"
|
|
67
67
|
aria-hidden="true"
|
|
68
68
|
/>
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
</DialogTitle>
|
|
80
80
|
|
|
81
81
|
<slot name="body-content">
|
|
82
|
-
<p class="text-sm text-gray-
|
|
82
|
+
<p class="text-sm text-gray-600" v-if="options.message">
|
|
83
83
|
{{ options.message }}
|
|
84
84
|
</p>
|
|
85
85
|
</slot>
|
|
@@ -93,9 +93,10 @@
|
|
|
93
93
|
>
|
|
94
94
|
<slot name="actions" v-bind="{ close: () => (open = false) }">
|
|
95
95
|
<Button
|
|
96
|
+
class="w-full sm:w-max"
|
|
96
97
|
v-for="action in options.actions"
|
|
97
98
|
:key="action.label"
|
|
98
|
-
|
|
99
|
+
v-bind="action"
|
|
99
100
|
@click="
|
|
100
101
|
() => {
|
|
101
102
|
if (action.handler && action.handler === 'cancel') {
|
package/src/utils/resources.js
CHANGED
|
@@ -6,11 +6,7 @@ let cached = {}
|
|
|
6
6
|
function createResource(options, vm, getResource) {
|
|
7
7
|
let cacheKey = null
|
|
8
8
|
if (options.cache) {
|
|
9
|
-
cacheKey = options.cache
|
|
10
|
-
if (typeof cacheKey === 'string') {
|
|
11
|
-
cacheKey = [cacheKey]
|
|
12
|
-
}
|
|
13
|
-
cacheKey = JSON.stringify(cacheKey)
|
|
9
|
+
cacheKey = getCacheKey(options.cache)
|
|
14
10
|
if (cached[cacheKey]) {
|
|
15
11
|
return cached[cacheKey]
|
|
16
12
|
}
|
|
@@ -113,6 +109,13 @@ function createResource(options, vm, getResource) {
|
|
|
113
109
|
return out
|
|
114
110
|
}
|
|
115
111
|
|
|
112
|
+
function getCacheKey(cacheKey) {
|
|
113
|
+
if (typeof cacheKey === 'string') {
|
|
114
|
+
cacheKey = [cacheKey]
|
|
115
|
+
}
|
|
116
|
+
return JSON.stringify(cacheKey)
|
|
117
|
+
}
|
|
118
|
+
|
|
116
119
|
let createMixin = (mixinOptions) => ({
|
|
117
120
|
created() {
|
|
118
121
|
if (this.$options.resources) {
|
|
@@ -160,10 +163,10 @@ let createMixin = (mixinOptions) => ({
|
|
|
160
163
|
}
|
|
161
164
|
},
|
|
162
165
|
methods: {
|
|
163
|
-
$refetchResource(
|
|
164
|
-
let
|
|
165
|
-
if (cached[
|
|
166
|
-
let resource = cached[
|
|
166
|
+
$refetchResource(cache) {
|
|
167
|
+
let cacheKey = getCacheKey(cache)
|
|
168
|
+
if (cached[cacheKey]) {
|
|
169
|
+
let resource = cached[cacheKey]
|
|
167
170
|
resource.fetch()
|
|
168
171
|
}
|
|
169
172
|
},
|