frappe-ui 0.1.62 → 0.1.64
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/Avatar.vue +11 -2
- package/src/components/DateRangePicker.vue +8 -1
- package/src/components/FileUploader.vue +5 -5
- package/src/components/ListView/ListRow.vue +18 -6
- package/src/components/Popover.vue +3 -0
- package/src/index.js +1 -0
- package/src/utils/tailwind.config.js +4 -0
package/package.json
CHANGED
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
:class="[sizeClasses, shapeClasses]"
|
|
5
5
|
>
|
|
6
6
|
<img
|
|
7
|
-
v-if="image"
|
|
7
|
+
v-if="image && !imgFetchError"
|
|
8
8
|
:src="image"
|
|
9
9
|
:alt="label"
|
|
10
10
|
:class="[shapeClasses, 'h-full w-full object-cover']"
|
|
11
|
+
@error="(err) => handleImageError(err)"
|
|
11
12
|
/>
|
|
12
13
|
<div
|
|
13
14
|
v-else
|
|
@@ -36,7 +37,9 @@
|
|
|
36
37
|
</template>
|
|
37
38
|
|
|
38
39
|
<script setup lang="ts">
|
|
39
|
-
import { computed } from 'vue'
|
|
40
|
+
import { ref, computed } from 'vue'
|
|
41
|
+
|
|
42
|
+
const imgFetchError = ref(false)
|
|
40
43
|
|
|
41
44
|
interface AvatarProps {
|
|
42
45
|
image?: string
|
|
@@ -125,4 +128,10 @@ const iconClasses = computed(() => {
|
|
|
125
128
|
'3xl': 'h-5 w-5',
|
|
126
129
|
}[props.size]
|
|
127
130
|
})
|
|
131
|
+
|
|
132
|
+
function handleImageError(err) {
|
|
133
|
+
if (err.type) {
|
|
134
|
+
imgFetchError.value = true
|
|
135
|
+
}
|
|
136
|
+
}
|
|
128
137
|
</script>
|
|
@@ -107,7 +107,14 @@ import FeatherIcon from './FeatherIcon.vue'
|
|
|
107
107
|
import TextInput from './TextInput.vue'
|
|
108
108
|
export default {
|
|
109
109
|
name: 'DateRangePicker',
|
|
110
|
-
props: [
|
|
110
|
+
props: [
|
|
111
|
+
'value',
|
|
112
|
+
'modelValue',
|
|
113
|
+
'placeholder',
|
|
114
|
+
'formatter',
|
|
115
|
+
'readonly',
|
|
116
|
+
'inputClass',
|
|
117
|
+
],
|
|
111
118
|
emits: ['update:modelValue', 'change'],
|
|
112
119
|
components: {
|
|
113
120
|
Popover,
|
|
@@ -51,11 +51,10 @@ export default {
|
|
|
51
51
|
},
|
|
52
52
|
},
|
|
53
53
|
methods: {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
54
|
+
inputRef() {
|
|
55
|
+
return this.$refs['input']
|
|
56
|
+
},
|
|
57
|
+
openFileSelector() {
|
|
59
58
|
this.$refs['input'].click()
|
|
60
59
|
},
|
|
61
60
|
async onFileAdd(e) {
|
|
@@ -118,5 +117,6 @@ export default {
|
|
|
118
117
|
})
|
|
119
118
|
},
|
|
120
119
|
},
|
|
120
|
+
expose: ['inputRef'],
|
|
121
121
|
}
|
|
122
122
|
</script>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<component
|
|
3
3
|
:is="list.options.getRowRoute ? 'router-link' : 'div'"
|
|
4
|
-
class="
|
|
4
|
+
:class="{ 'cursor-pointer': isHoverable }"
|
|
5
|
+
class="flex flex-col transition-all duration-300 ease-in-out"
|
|
5
6
|
v-bind="{
|
|
6
7
|
to: list.options.getRowRoute ? list.options.getRowRoute(row) : undefined,
|
|
7
8
|
onClick: list.options.onRowClick
|
|
@@ -15,11 +16,14 @@
|
|
|
15
16
|
>
|
|
16
17
|
<div
|
|
17
18
|
class="grid items-center space-x-4 rounded px-2"
|
|
18
|
-
:class="
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
:class="[
|
|
20
|
+
isSelected ? 'bg-gray-100' : '',
|
|
21
|
+
isHoverable
|
|
22
|
+
? isSelected
|
|
23
|
+
? 'hover:bg-gray-200'
|
|
24
|
+
: 'hover:bg-gray-50'
|
|
25
|
+
: '',
|
|
26
|
+
]"
|
|
23
27
|
:style="{
|
|
24
28
|
height: rowHeight,
|
|
25
29
|
gridTemplateColumns: getGridTemplateColumns(
|
|
@@ -91,6 +95,14 @@ const isLastRow = computed(() => {
|
|
|
91
95
|
)
|
|
92
96
|
})
|
|
93
97
|
|
|
98
|
+
const isSelected = computed(() => {
|
|
99
|
+
return list.value.selections.has(props.row[list.value.rowKey])
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
const isHoverable = computed(() => {
|
|
103
|
+
return list.value.options.getRowRoute || list.value.options.onRowClick
|
|
104
|
+
})
|
|
105
|
+
|
|
94
106
|
const rowHeight = computed(() => {
|
|
95
107
|
if (typeof list.value.options.rowHeight === 'number') {
|
|
96
108
|
return `${list.value.options.rowHeight}px`
|
|
@@ -144,6 +144,8 @@ export default {
|
|
|
144
144
|
}
|
|
145
145
|
if (this.hideOnBlur) {
|
|
146
146
|
document.addEventListener('click', this.listener)
|
|
147
|
+
// https://github.com/tailwindlabs/headlessui/issues/834#issuecomment-1030907894
|
|
148
|
+
document.addEventListener('mousedown', this.listener)
|
|
147
149
|
}
|
|
148
150
|
this.$nextTick(() => {
|
|
149
151
|
this.targetWidth = this.$refs['target'].clientWidth
|
|
@@ -152,6 +154,7 @@ export default {
|
|
|
152
154
|
beforeDestroy() {
|
|
153
155
|
this.popper && this.popper.destroy()
|
|
154
156
|
document.removeEventListener('click', this.listener)
|
|
157
|
+
document.removeEventListener('mousedown', this.listener)
|
|
155
158
|
},
|
|
156
159
|
computed: {
|
|
157
160
|
showPropPassed() {
|
package/src/index.js
CHANGED
|
@@ -59,6 +59,7 @@ export { default as Tooltip } from './components/Tooltip/Tooltip.vue'
|
|
|
59
59
|
export { default as CommandPalette } from './components/CommandPalette/CommandPalette.vue'
|
|
60
60
|
export { default as CommandPaletteItem } from './components/CommandPalette/CommandPaletteItem.vue'
|
|
61
61
|
export { default as ListFilter } from './components/ListFilter/ListFilter.vue'
|
|
62
|
+
export { default as NestedPopover } from './components/ListFilter/NestedPopover.vue'
|
|
62
63
|
|
|
63
64
|
// directives
|
|
64
65
|
export { default as onOutsideClickDirective } from './directives/onOutsideClick.js'
|