frappe-ui 0.0.91 → 0.0.93
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
|
@@ -1,49 +1,49 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<Menu as="div" class="relative inline-block text-left" v-slot="{ open }">
|
|
3
|
-
<
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
<Popover :transition="dropdownTransition" :show="open">
|
|
4
|
+
<template #target>
|
|
5
|
+
<MenuButton as="div">
|
|
6
|
+
<slot v-if="$slots.default" v-bind="{ open }" />
|
|
7
|
+
<Button v-else :active="open" v-bind="button">
|
|
8
|
+
{{ button ? button?.label || null : 'Options' }}
|
|
9
|
+
</Button>
|
|
10
|
+
</MenuButton>
|
|
11
|
+
</template>
|
|
9
12
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
>
|
|
31
|
-
{{ group.group }}
|
|
32
|
-
</div>
|
|
33
|
-
<MenuItem
|
|
34
|
-
v-for="item in group.items"
|
|
35
|
-
:key="item.label"
|
|
36
|
-
v-slot="{ active }"
|
|
37
|
-
>
|
|
38
|
-
<button
|
|
39
|
-
:class="[
|
|
40
|
-
active ? 'bg-gray-100' : 'text-gray-900',
|
|
41
|
-
'group flex w-full items-center rounded-md px-2 py-2 text-sm',
|
|
42
|
-
]"
|
|
43
|
-
@click="item.onClick"
|
|
13
|
+
<template #body>
|
|
14
|
+
<MenuItems
|
|
15
|
+
class="min-w-40 mt-2 divide-y divide-gray-100 rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none"
|
|
16
|
+
:class="{
|
|
17
|
+
'left-0 origin-top-left': placement == 'left',
|
|
18
|
+
'right-0 origin-top-right': placement == 'right',
|
|
19
|
+
'inset-x-0 origin-top': placement == 'center',
|
|
20
|
+
}"
|
|
21
|
+
>
|
|
22
|
+
<div v-for="group in groups" :key="group.key" class="px-1 py-1">
|
|
23
|
+
<div
|
|
24
|
+
v-if="group.group && !group.hideLabel"
|
|
25
|
+
class="px-2 py-1 text-xs font-semibold uppercase tracking-wider text-gray-500"
|
|
26
|
+
>
|
|
27
|
+
{{ group.group }}
|
|
28
|
+
</div>
|
|
29
|
+
<MenuItem
|
|
30
|
+
v-for="item in group.items"
|
|
31
|
+
:key="item.label"
|
|
32
|
+
v-slot="{ active }"
|
|
44
33
|
>
|
|
45
|
-
<component
|
|
46
|
-
|
|
34
|
+
<component
|
|
35
|
+
v-if="item.component"
|
|
36
|
+
:is="item.component"
|
|
37
|
+
:active="active"
|
|
38
|
+
/>
|
|
39
|
+
<button
|
|
40
|
+
v-else
|
|
41
|
+
:class="[
|
|
42
|
+
active ? 'bg-gray-100' : 'text-gray-900',
|
|
43
|
+
'group flex w-full items-center rounded-md px-2 py-2 text-sm',
|
|
44
|
+
]"
|
|
45
|
+
@click="item.onClick"
|
|
46
|
+
>
|
|
47
47
|
<FeatherIcon
|
|
48
48
|
v-if="item.icon"
|
|
49
49
|
:name="item.icon"
|
|
@@ -53,17 +53,18 @@
|
|
|
53
53
|
<span class="whitespace-nowrap">
|
|
54
54
|
{{ item.label }}
|
|
55
55
|
</span>
|
|
56
|
-
</
|
|
57
|
-
</
|
|
58
|
-
</
|
|
59
|
-
</
|
|
60
|
-
</
|
|
61
|
-
</
|
|
56
|
+
</button>
|
|
57
|
+
</MenuItem>
|
|
58
|
+
</div>
|
|
59
|
+
</MenuItems>
|
|
60
|
+
</template>
|
|
61
|
+
</Popover>
|
|
62
62
|
</Menu>
|
|
63
63
|
</template>
|
|
64
64
|
|
|
65
65
|
<script>
|
|
66
66
|
import { Menu, MenuButton, MenuItems, MenuItem } from '@headlessui/vue'
|
|
67
|
+
import Popover from './Popover.vue'
|
|
67
68
|
import Button from './Button.vue'
|
|
68
69
|
import FeatherIcon from './FeatherIcon.vue'
|
|
69
70
|
|
|
@@ -90,6 +91,7 @@ export default {
|
|
|
90
91
|
MenuItem,
|
|
91
92
|
Button,
|
|
92
93
|
FeatherIcon,
|
|
94
|
+
Popover,
|
|
93
95
|
},
|
|
94
96
|
methods: {
|
|
95
97
|
normalizeDropdownItem(option) {
|
|
@@ -128,6 +130,16 @@ export default {
|
|
|
128
130
|
}
|
|
129
131
|
})
|
|
130
132
|
},
|
|
133
|
+
dropdownTransition() {
|
|
134
|
+
return {
|
|
135
|
+
enterActiveClass: 'transition duration-100 ease-out',
|
|
136
|
+
enterFromClass: 'transform scale-95 opacity-0',
|
|
137
|
+
enterToClass: 'transform scale-100 opacity-100',
|
|
138
|
+
leaveActiveClass: 'transition duration-75 ease-in',
|
|
139
|
+
leaveFromClass: 'transform scale-100 opacity-100',
|
|
140
|
+
leaveToClass: 'transform scale-95 opacity-0',
|
|
141
|
+
}
|
|
142
|
+
},
|
|
131
143
|
},
|
|
132
144
|
}
|
|
133
145
|
</script>
|
|
@@ -201,16 +201,10 @@ export default {
|
|
|
201
201
|
}
|
|
202
202
|
},
|
|
203
203
|
open() {
|
|
204
|
-
if (this.isOpen) {
|
|
205
|
-
return
|
|
206
|
-
}
|
|
207
204
|
this.isOpen = true
|
|
208
205
|
this.$nextTick(() => this.setupPopper())
|
|
209
206
|
},
|
|
210
207
|
close() {
|
|
211
|
-
if (!this.isOpen) {
|
|
212
|
-
return
|
|
213
|
-
}
|
|
214
208
|
this.isOpen = false
|
|
215
209
|
},
|
|
216
210
|
onMouseover() {
|
|
@@ -48,7 +48,7 @@ export function createDocumentResource(options, vm) {
|
|
|
48
48
|
doctype: options.doctype,
|
|
49
49
|
name: options.name,
|
|
50
50
|
doc: null,
|
|
51
|
-
auto: true,
|
|
51
|
+
auto: options.auto || true,
|
|
52
52
|
get: createResource(
|
|
53
53
|
{
|
|
54
54
|
url: 'frappe.client.get',
|
|
@@ -103,7 +103,7 @@ export function createDocumentResource(options, vm) {
|
|
|
103
103
|
let methodOptions = options.whitelistedMethods[methodKey]
|
|
104
104
|
if (typeof methodOptions == 'string') {
|
|
105
105
|
methodOptions = {
|
|
106
|
-
|
|
106
|
+
method: methodOptions,
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
let { method, onSuccess, ...otherOptions } = methodOptions
|
|
@@ -183,6 +183,11 @@ export function createDocumentResource(options, vm) {
|
|
|
183
183
|
out.doc = transform(data)
|
|
184
184
|
}
|
|
185
185
|
})
|
|
186
|
+
|
|
187
|
+
if (out.auto) {
|
|
188
|
+
out.get.fetch()
|
|
189
|
+
}
|
|
190
|
+
|
|
186
191
|
return out
|
|
187
192
|
}
|
|
188
193
|
|
package/src/utils/pageMeta.js
CHANGED
|
@@ -21,7 +21,7 @@ function createMixin() {
|
|
|
21
21
|
let debugInfo = `${this.$options.name} (${
|
|
22
22
|
this.$options.__file || ''
|
|
23
23
|
})`
|
|
24
|
-
if (
|
|
24
|
+
if (process.env.NODE_ENV === 'development') {
|
|
25
25
|
console.warn('Failed to parse pageMeta in', debugInfo)
|
|
26
26
|
}
|
|
27
27
|
return null
|