frappe-ui 0.1.102 → 0.1.104
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/Tabs/TabList.vue +19 -18
- package/src/components/Tabs/TabPanel.vue +2 -2
- package/src/components/Tabs/Tabs.vue +9 -4
- package/src/data-fetching/useDoctype/useDoctype.ts +7 -0
- package/src/data-fetching/useList/useList.ts +8 -1
- package/src/tailwind/plugin.js +8 -8
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<TabList
|
|
3
3
|
class="relative flex"
|
|
4
4
|
:class="
|
|
5
|
-
vertical
|
|
5
|
+
t.vertical
|
|
6
6
|
? 'flex-col border-r overflow-y-auto'
|
|
7
7
|
: 'gap-7.5 border-b overflow-x-auto items-center px-5'
|
|
8
8
|
"
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<Tab
|
|
11
11
|
ref="tabRef"
|
|
12
12
|
as="template"
|
|
13
|
-
v-for="(tab, i) in tabs"
|
|
13
|
+
v-for="(tab, i) in t.tabs"
|
|
14
14
|
:key="i"
|
|
15
15
|
v-slot="{ selected }"
|
|
16
16
|
class="focus:outline-none focus:transition-none"
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
class="flex items-center gap-1.5 text-base text-ink-gray-5 duration-300 ease-in-out hover:text-ink-gray-9"
|
|
21
21
|
:class="[
|
|
22
22
|
selected ? 'text-ink-gray-9' : '',
|
|
23
|
-
vertical
|
|
23
|
+
t.vertical
|
|
24
24
|
? 'py-2.5 px-4 border-r border-transparent hover:border-outline-gray-3'
|
|
25
25
|
: 'py-3 border-b border-transparent hover:border-outline-gray-3',
|
|
26
26
|
]"
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
<div
|
|
34
34
|
ref="indicator"
|
|
35
35
|
class="tab-indicator absolute bg-surface-gray-7"
|
|
36
|
-
:class="[vertical ? 'right-0 w-px' : 'bottom-0 h-px', transitionClass]"
|
|
36
|
+
:class="[t.vertical ? 'right-0 w-px' : 'bottom-0 h-px', transitionClass]"
|
|
37
37
|
/>
|
|
38
38
|
</TabList>
|
|
39
39
|
</template>
|
|
@@ -41,13 +41,11 @@
|
|
|
41
41
|
import { TabList, Tab } from '@headlessui/vue'
|
|
42
42
|
import { ref, watch, computed, onMounted, nextTick, inject } from 'vue'
|
|
43
43
|
|
|
44
|
-
const
|
|
45
|
-
const tabs = inject('tabs')
|
|
46
|
-
const vertical = inject('vertical')
|
|
44
|
+
const t = inject('tab')
|
|
47
45
|
|
|
48
46
|
const tabRef = ref([])
|
|
49
47
|
const indicator = ref(null)
|
|
50
|
-
const tabsLength = computed(() => tabs.value?.length)
|
|
48
|
+
const tabsLength = computed(() => t.value.tabs.value?.length)
|
|
51
49
|
|
|
52
50
|
const transitionClass = ref('')
|
|
53
51
|
|
|
@@ -56,7 +54,7 @@ function moveIndicator(index) {
|
|
|
56
54
|
index = tabsLength.value - 1
|
|
57
55
|
}
|
|
58
56
|
const selectedTab = tabRef.value[index].el
|
|
59
|
-
if (vertical) {
|
|
57
|
+
if (t.value.vertical.value) {
|
|
60
58
|
indicator.value.style.height = `${selectedTab.offsetHeight}px`
|
|
61
59
|
indicator.value.style.top = `${selectedTab.offsetTop}px`
|
|
62
60
|
} else {
|
|
@@ -65,17 +63,20 @@ function moveIndicator(index) {
|
|
|
65
63
|
}
|
|
66
64
|
}
|
|
67
65
|
|
|
68
|
-
watch(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
66
|
+
watch(
|
|
67
|
+
() => t.value.tabIndex.value,
|
|
68
|
+
(index) => {
|
|
69
|
+
if (index >= tabsLength.value) {
|
|
70
|
+
t.value.tabIndex.value = tabsLength.value - 1
|
|
71
|
+
}
|
|
72
|
+
transitionClass.value = 'transition-all duration-300 ease-in-out'
|
|
73
|
+
nextTick(() => moveIndicator(index))
|
|
74
|
+
},
|
|
75
|
+
)
|
|
75
76
|
|
|
76
77
|
onMounted(() => {
|
|
77
|
-
nextTick(() => moveIndicator(tabIndex.value))
|
|
78
|
+
nextTick(() => moveIndicator(t.value.tabIndex.value))
|
|
78
79
|
// Fix for indicator not moving on initial load
|
|
79
|
-
setTimeout(() => moveIndicator(tabIndex.value), 100)
|
|
80
|
+
setTimeout(() => moveIndicator(t.value.tabIndex.value), 100)
|
|
80
81
|
})
|
|
81
82
|
</script>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<TabPanels class="flex flex-1 overflow-hidden">
|
|
3
3
|
<TabPanel
|
|
4
4
|
class="flex flex-1 flex-col overflow-y-auto focus:outline-none"
|
|
5
|
-
v-for="(tab, i) in tabs"
|
|
5
|
+
v-for="(tab, i) in t.tabs"
|
|
6
6
|
:key="i"
|
|
7
7
|
>
|
|
8
8
|
<slot v-bind="{ tab }" />
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
import { TabPanels, TabPanel } from '@headlessui/vue'
|
|
14
14
|
import { inject } from 'vue'
|
|
15
15
|
|
|
16
|
-
const
|
|
16
|
+
const t = inject('tab')
|
|
17
17
|
</script>
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
import TabList from './TabList.vue'
|
|
28
28
|
import TabPanel from './TabPanel.vue'
|
|
29
29
|
import { TabGroup } from '@headlessui/vue'
|
|
30
|
-
import { provide } from 'vue'
|
|
30
|
+
import { computed, provide } from 'vue'
|
|
31
31
|
|
|
32
32
|
const props = defineProps({
|
|
33
33
|
as: {
|
|
@@ -46,7 +46,12 @@ const props = defineProps({
|
|
|
46
46
|
|
|
47
47
|
const tabIndex = defineModel()
|
|
48
48
|
|
|
49
|
-
provide(
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
provide(
|
|
50
|
+
'tab',
|
|
51
|
+
computed(() => ({
|
|
52
|
+
tabIndex,
|
|
53
|
+
tabs: props.tabs,
|
|
54
|
+
vertical: props.vertical,
|
|
55
|
+
})),
|
|
56
|
+
)
|
|
52
57
|
</script>
|
|
@@ -48,6 +48,13 @@ function useDelete(doctype: string, options: UseDoctypeOptions = {}) {
|
|
|
48
48
|
method: 'DELETE',
|
|
49
49
|
immediate: false,
|
|
50
50
|
baseUrl,
|
|
51
|
+
onSuccess() {
|
|
52
|
+
if (delete_.params.name) {
|
|
53
|
+
let { name } = delete_.params
|
|
54
|
+
docStore.removeDoc(doctype, name)
|
|
55
|
+
listStore.removeRow(doctype, name)
|
|
56
|
+
}
|
|
57
|
+
},
|
|
51
58
|
})
|
|
52
59
|
|
|
53
60
|
return reactive({
|
|
@@ -204,7 +204,14 @@ export function useList<T extends { name: string }>(
|
|
|
204
204
|
}
|
|
205
205
|
},
|
|
206
206
|
onSuccess() {
|
|
207
|
-
if (refetch)
|
|
207
|
+
if (refetch) {
|
|
208
|
+
execute()
|
|
209
|
+
}
|
|
210
|
+
if (delete_.params.name) {
|
|
211
|
+
let { name } = delete_.params
|
|
212
|
+
docStore.removeDoc(doctype, name)
|
|
213
|
+
listStore.removeRow(doctype, name)
|
|
214
|
+
}
|
|
208
215
|
},
|
|
209
216
|
})
|
|
210
217
|
|
package/src/tailwind/plugin.js
CHANGED
|
@@ -87,7 +87,7 @@ module.exports = plugin(
|
|
|
87
87
|
'2xs': [
|
|
88
88
|
'11px',
|
|
89
89
|
{
|
|
90
|
-
lineHeight: '1.
|
|
90
|
+
lineHeight: '1.4',
|
|
91
91
|
letterSpacing: '0.01em',
|
|
92
92
|
fontWeight: '420',
|
|
93
93
|
},
|
|
@@ -95,7 +95,7 @@ module.exports = plugin(
|
|
|
95
95
|
xs: [
|
|
96
96
|
'12px',
|
|
97
97
|
{
|
|
98
|
-
lineHeight: '1.
|
|
98
|
+
lineHeight: '1.4',
|
|
99
99
|
letterSpacing: '0.02em',
|
|
100
100
|
fontWeight: '420',
|
|
101
101
|
},
|
|
@@ -103,7 +103,7 @@ module.exports = plugin(
|
|
|
103
103
|
sm: [
|
|
104
104
|
'13px',
|
|
105
105
|
{
|
|
106
|
-
lineHeight: '1.
|
|
106
|
+
lineHeight: '1.4',
|
|
107
107
|
letterSpacing: '0.02em',
|
|
108
108
|
fontWeight: '420',
|
|
109
109
|
},
|
|
@@ -111,7 +111,7 @@ module.exports = plugin(
|
|
|
111
111
|
base: [
|
|
112
112
|
'14px',
|
|
113
113
|
{
|
|
114
|
-
lineHeight: '1.
|
|
114
|
+
lineHeight: '1.4',
|
|
115
115
|
letterSpacing: '0.02em',
|
|
116
116
|
fontWeight: '420',
|
|
117
117
|
},
|
|
@@ -119,7 +119,7 @@ module.exports = plugin(
|
|
|
119
119
|
lg: [
|
|
120
120
|
'16px',
|
|
121
121
|
{
|
|
122
|
-
lineHeight: '1.
|
|
122
|
+
lineHeight: '1.4',
|
|
123
123
|
letterSpacing: '0.02em',
|
|
124
124
|
fontWeight: '400',
|
|
125
125
|
},
|
|
@@ -127,7 +127,7 @@ module.exports = plugin(
|
|
|
127
127
|
xl: [
|
|
128
128
|
'18px',
|
|
129
129
|
{
|
|
130
|
-
lineHeight: '1.
|
|
130
|
+
lineHeight: '1.3',
|
|
131
131
|
letterSpacing: '0.01em',
|
|
132
132
|
fontWeight: '400',
|
|
133
133
|
},
|
|
@@ -135,7 +135,7 @@ module.exports = plugin(
|
|
|
135
135
|
'2xl': [
|
|
136
136
|
'20px',
|
|
137
137
|
{
|
|
138
|
-
lineHeight: '1.
|
|
138
|
+
lineHeight: '1.3',
|
|
139
139
|
letterSpacing: '0.01em',
|
|
140
140
|
fontWeight: '400',
|
|
141
141
|
},
|
|
@@ -143,7 +143,7 @@ module.exports = plugin(
|
|
|
143
143
|
'3xl': [
|
|
144
144
|
'24px',
|
|
145
145
|
{
|
|
146
|
-
lineHeight: '1.
|
|
146
|
+
lineHeight: '1.25',
|
|
147
147
|
fontWeight: 400,
|
|
148
148
|
letterSpacing: '0.005em',
|
|
149
149
|
},
|