poe-svelte-ui-lib 1.2.8 → 1.2.9
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/dist/Tabs/TabsProps.svelte +14 -29
- package/dist/types.d.ts +0 -1
- package/package.json +1 -1
|
@@ -56,19 +56,6 @@
|
|
|
56
56
|
} else if (width.class.includes('w-auto')) return 1
|
|
57
57
|
else return 2
|
|
58
58
|
})
|
|
59
|
-
|
|
60
|
-
const handleImageUpload = (event: Event) => {
|
|
61
|
-
const input = event.target as HTMLInputElement
|
|
62
|
-
if (!input.files || input.files.length === 0) return
|
|
63
|
-
|
|
64
|
-
const file = input.files[0]
|
|
65
|
-
const reader = new FileReader()
|
|
66
|
-
reader.onload = (e) => {
|
|
67
|
-
const base64String = e.target?.result as string
|
|
68
|
-
updateProperty('image', base64String, component, onPropertyChange)
|
|
69
|
-
}
|
|
70
|
-
reader.readAsDataURL(file)
|
|
71
|
-
}
|
|
72
59
|
</script>
|
|
73
60
|
|
|
74
61
|
{#if forConstructor}
|
|
@@ -121,19 +108,11 @@
|
|
|
121
108
|
}}
|
|
122
109
|
value={initialWidth()}
|
|
123
110
|
onChange={(value) => {
|
|
124
|
-
|
|
125
|
-
component.properties
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
})
|
|
130
|
-
} else {
|
|
131
|
-
component.properties.items.forEach((_item: any, index: number) => {
|
|
132
|
-
const items = [...(component.properties?.items || [])]
|
|
133
|
-
items[index]['class'] = twMerge(items[index].class, 'w-auto')
|
|
134
|
-
updateProperty('items', items, component, onPropertyChange)
|
|
135
|
-
})
|
|
136
|
-
}
|
|
111
|
+
component.properties.items.forEach((_item: any, index: number) => {
|
|
112
|
+
const items = [...(component.properties?.items || [])]
|
|
113
|
+
items[index]['class'] = twMerge(items[index].class, value === 2 ? `w-[${(1 / items.length) * 100}%]` : 'w-auto')
|
|
114
|
+
updateProperty('items', items, component, onPropertyChange)
|
|
115
|
+
})
|
|
137
116
|
}}
|
|
138
117
|
/>
|
|
139
118
|
</div>
|
|
@@ -146,14 +125,16 @@
|
|
|
146
125
|
wrapperClass="w-8"
|
|
147
126
|
content={{ icon: ButtonAdd }}
|
|
148
127
|
onClick={() => {
|
|
149
|
-
let tabWidth = Math.max(...Array.from(document.body.querySelectorAll('.tab')).map((item) => (item as HTMLElement).offsetWidth))
|
|
150
128
|
const newItem: { name: string; icon: string; class: string } = {
|
|
151
129
|
name: `Tab ${component.properties?.items.length + 1}`,
|
|
152
|
-
class: `
|
|
130
|
+
class: `text-${initialColor?.value.slice(3)}-500 ${initialPosition?.value}`,
|
|
153
131
|
icon: '',
|
|
154
132
|
}
|
|
155
133
|
const items = [...(component.properties?.items || []), newItem]
|
|
156
|
-
|
|
134
|
+
items.forEach((_item: any, index: number) => {
|
|
135
|
+
items[index]['class'] = twMerge(items[index].class, initialWidth() === 2 ? `w-[${(1 / items.length) * 100}%]` : 'w-auto')
|
|
136
|
+
updateProperty('items', items, component, onPropertyChange)
|
|
137
|
+
})
|
|
157
138
|
}}
|
|
158
139
|
/>
|
|
159
140
|
</div>
|
|
@@ -194,6 +175,10 @@
|
|
|
194
175
|
onClick={() => {
|
|
195
176
|
const items = [...(component.properties?.items || [])]
|
|
196
177
|
items.splice(index, 1)
|
|
178
|
+
items.forEach((_item: any, index: number) => {
|
|
179
|
+
items[index]['class'] = twMerge(items[index].class, initialWidth() === 2 ? `w-[${(1 / items.length) * 100}%]` : 'w-auto')
|
|
180
|
+
updateProperty('items', items, component, onPropertyChange)
|
|
181
|
+
})
|
|
197
182
|
updateProperty('items', items, component, onPropertyChange)
|
|
198
183
|
}}
|
|
199
184
|
/>
|
package/dist/types.d.ts
CHANGED