@likable-hair/svelte 3.1.51 → 3.1.52
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.
|
@@ -13,9 +13,13 @@ export let calculateRowClasses = void 0;
|
|
|
13
13
|
onMount(() => {
|
|
14
14
|
if (resizableColumns) {
|
|
15
15
|
for (const head of [...headers, { value: "slot-append" }]) {
|
|
16
|
-
let th
|
|
16
|
+
let th;
|
|
17
|
+
if (head.value == "slot-append") {
|
|
18
|
+
th = document.getElementsByClassName(head.value).item(0);
|
|
19
|
+
} else {
|
|
20
|
+
th = document.getElementById(head.value);
|
|
21
|
+
}
|
|
17
22
|
if (!!th) {
|
|
18
|
-
let { paddingLeft, paddingRight } = getComputedStyle(th);
|
|
19
23
|
let widthWihtPadding;
|
|
20
24
|
if (!!resizedColumnSizeWithPadding[head.value]) {
|
|
21
25
|
widthWihtPadding = resizedColumnSizeWithPadding[head.value];
|
|
@@ -23,7 +27,19 @@ onMount(() => {
|
|
|
23
27
|
widthWihtPadding = th.getBoundingClientRect().width;
|
|
24
28
|
resizedColumnSizeWithPadding[head.value] = widthWihtPadding;
|
|
25
29
|
}
|
|
26
|
-
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
for (const head of [...headers, { value: "slot-append" }]) {
|
|
33
|
+
let th;
|
|
34
|
+
if (head.value == "slot-append") {
|
|
35
|
+
th = document.getElementsByClassName(head.value).item(0);
|
|
36
|
+
} else {
|
|
37
|
+
th = document.getElementById(head.value);
|
|
38
|
+
}
|
|
39
|
+
if (!!th) {
|
|
40
|
+
let { paddingLeft, paddingRight } = getComputedStyle(th);
|
|
41
|
+
let width = resizedColumnSizeWithPadding[head.value] - parseFloat(paddingLeft) - parseFloat(paddingRight);
|
|
42
|
+
console.log(resizedColumnSizeWithPadding[head.value], paddingLeft, paddingRight, width);
|
|
27
43
|
th.style.width = `${width}px`;
|
|
28
44
|
}
|
|
29
45
|
}
|
|
@@ -82,7 +98,6 @@ function resize(node) {
|
|
|
82
98
|
}
|
|
83
99
|
}, mouseUpHandler = function(e) {
|
|
84
100
|
if (!!th) {
|
|
85
|
-
e.stopPropagation();
|
|
86
101
|
resizing = false;
|
|
87
102
|
let { paddingLeft, paddingRight } = getComputedStyle(th);
|
|
88
103
|
width = th.getBoundingClientRect().width - parseFloat(paddingLeft) - parseFloat(paddingRight);
|
|
@@ -157,7 +172,7 @@ function resize(node) {
|
|
|
157
172
|
</th>
|
|
158
173
|
{/each}
|
|
159
174
|
{#if $$slots.rowActions || $$slots.append}
|
|
160
|
-
<th
|
|
175
|
+
<th class="slot-append">
|
|
161
176
|
<slot name="append" index={-1} items={undefined} />
|
|
162
177
|
</th>
|
|
163
178
|
{/if}
|
|
@@ -210,7 +225,7 @@ function resize(node) {
|
|
|
210
225
|
</td>
|
|
211
226
|
{/each}
|
|
212
227
|
{#if $$slots.rowActions || $$slots.append}
|
|
213
|
-
<td class="{clazz.cell || ''}">
|
|
228
|
+
<td class="{clazz.cell || ''} append" style:width="fit-content">
|
|
214
229
|
<slot name="rowActions" index={i} {item} />
|
|
215
230
|
<slot name="append" index={i} {item} />
|
|
216
231
|
</td>
|
|
@@ -223,6 +238,20 @@ function resize(node) {
|
|
|
223
238
|
{/if}
|
|
224
239
|
|
|
225
240
|
<style>
|
|
241
|
+
|
|
242
|
+
th.slot-append {
|
|
243
|
+
width: 1px;
|
|
244
|
+
min-width: unset;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.table.resizable .slot-append {
|
|
248
|
+
box-sizing: content-box;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.table.resizable td.append {
|
|
252
|
+
padding: 0;
|
|
253
|
+
}
|
|
254
|
+
|
|
226
255
|
.simple-table-container.resizable {
|
|
227
256
|
overflow-x: auto;
|
|
228
257
|
}
|
|
@@ -239,6 +268,7 @@ function resize(node) {
|
|
|
239
268
|
cursor: col-resize;
|
|
240
269
|
background-clip: content-box;
|
|
241
270
|
padding: 0px 5px 0px 5px;
|
|
271
|
+
box-sizing: content-box;
|
|
242
272
|
}
|
|
243
273
|
|
|
244
274
|
th:hover .resizer {
|
|
@@ -398,6 +428,7 @@ function resize(node) {
|
|
|
398
428
|
min-width: 100px;
|
|
399
429
|
position: relative;
|
|
400
430
|
user-select: none;
|
|
431
|
+
box-sizing: content-box;
|
|
401
432
|
}
|
|
402
433
|
|
|
403
434
|
td {
|