@lavalogic/scoria 0.7.1 → 0.7.2
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.
|
@@ -55,26 +55,28 @@
|
|
|
55
55
|
let asyncCounter = 0;
|
|
56
56
|
$effect(() => {
|
|
57
57
|
void editableAsync;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
58
|
+
untrack(() => {
|
|
59
|
+
const localCounter = (asyncCounter = asyncCounter + 1);
|
|
60
|
+
(async () => {
|
|
61
|
+
try {
|
|
62
|
+
const isEditable = await editableAsync;
|
|
63
|
+
if (asyncCounter === localCounter) {
|
|
64
|
+
editable = isEditable;
|
|
65
|
+
} else if (dev) {
|
|
66
|
+
console.log('skipping async editable because it is stale');
|
|
67
|
+
}
|
|
68
|
+
} catch (e) {
|
|
69
|
+
if (dev) {
|
|
70
|
+
console.error(e);
|
|
71
|
+
}
|
|
72
|
+
if (asyncCounter === localCounter) {
|
|
73
|
+
editable = false;
|
|
74
|
+
} else if (dev) {
|
|
75
|
+
console.log('skipping async editable because it is stale');
|
|
76
|
+
}
|
|
75
77
|
}
|
|
76
|
-
}
|
|
77
|
-
})
|
|
78
|
+
})();
|
|
79
|
+
});
|
|
78
80
|
});
|
|
79
81
|
|
|
80
82
|
const focusDetails: TableFocusDetails<T> = $derived(
|
|
@@ -600,7 +600,13 @@ export class TableContext {
|
|
|
600
600
|
const rows = sortedData.map((item, index) => {
|
|
601
601
|
const unsortedIndex = this.originalRowIndices.get(item) ?? index;
|
|
602
602
|
const row = {
|
|
603
|
-
getValue: (key) =>
|
|
603
|
+
getValue: (key) => {
|
|
604
|
+
const gotValue = this.columnDefsById.get(key).accessorFn?.(item, index);
|
|
605
|
+
if (gotValue !== undefined) {
|
|
606
|
+
return gotValue;
|
|
607
|
+
}
|
|
608
|
+
return item[key];
|
|
609
|
+
},
|
|
604
610
|
original: item,
|
|
605
611
|
visibleIndex: index,
|
|
606
612
|
originalIndex: unsortedIndex,
|
|
@@ -633,7 +639,13 @@ export class TableContext {
|
|
|
633
639
|
},
|
|
634
640
|
id: `${index}_${def.id}`,
|
|
635
641
|
row: row,
|
|
636
|
-
getValue: () =>
|
|
642
|
+
getValue: () => {
|
|
643
|
+
const gotValue = def.accessorFn?.(item, index);
|
|
644
|
+
if (gotValue !== undefined) {
|
|
645
|
+
return gotValue;
|
|
646
|
+
}
|
|
647
|
+
return item[def.id];
|
|
648
|
+
}
|
|
637
649
|
};
|
|
638
650
|
};
|
|
639
651
|
const makeCellFromId = (columnId) => {
|
|
@@ -1585,7 +1597,13 @@ export class TableContext {
|
|
|
1585
1597
|
// #region private methods
|
|
1586
1598
|
createRow(item, index, unsortedIndex) {
|
|
1587
1599
|
const row = {
|
|
1588
|
-
getValue: (key) =>
|
|
1600
|
+
getValue: (key) => {
|
|
1601
|
+
const gotValue = this.columnDefsById.get(key).accessorFn?.(item, unsortedIndex);
|
|
1602
|
+
if (gotValue !== undefined) {
|
|
1603
|
+
return gotValue;
|
|
1604
|
+
}
|
|
1605
|
+
return item[key];
|
|
1606
|
+
},
|
|
1589
1607
|
original: item,
|
|
1590
1608
|
visibleIndex: index,
|
|
1591
1609
|
originalIndex: unsortedIndex,
|
|
@@ -1618,7 +1636,13 @@ export class TableContext {
|
|
|
1618
1636
|
},
|
|
1619
1637
|
id: `${index}_${def.id}`,
|
|
1620
1638
|
row: row,
|
|
1621
|
-
getValue: () =>
|
|
1639
|
+
getValue: () => {
|
|
1640
|
+
const gotValue = def.accessorFn?.(item, index);
|
|
1641
|
+
if (gotValue !== undefined) {
|
|
1642
|
+
return gotValue;
|
|
1643
|
+
}
|
|
1644
|
+
return item[def.id];
|
|
1645
|
+
}
|
|
1622
1646
|
};
|
|
1623
1647
|
};
|
|
1624
1648
|
const makeCellFromId = (columnId) => {
|