@lavalogic/scoria 0.37.22 → 0.37.24
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/Components/Modal.svelte +3 -0
- package/dist/Components/Table/Body/Rows/Columns/FocusableImmutableCell.svelte +28 -0
- package/dist/Components/Table/ColumnFactory.svelte.js +17 -10
- package/dist/Components/Table/Misc/TableFooter.svelte +1 -0
- package/dist/Helpers/dropdownPortal.js +10 -1
- package/dist/scss/_mixins.scss +6 -1
- package/package.json +1 -1
|
@@ -24,6 +24,33 @@
|
|
|
24
24
|
cell.column.columnDef.getDisplayValue?.(cell.row.original, cell.row.originalIndex) ?? value
|
|
25
25
|
);
|
|
26
26
|
|
|
27
|
+
/** For Date-typed display columns, expose both the local-time and UTC
|
|
28
|
+
* representations of the raw accessor value as a multi-line tooltip.
|
|
29
|
+
* The cell's body shows the locale-formatted value (via
|
|
30
|
+
* `getDisplayValue`); the title attribute below lets users hover to
|
|
31
|
+
* see Local + UTC side-by-side without expanding the column. */
|
|
32
|
+
const dateTooltip: string | undefined = $derived.by(() => {
|
|
33
|
+
if (cell.column.columnDef.filterValueType !== 'Date') {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
if (value == null || value === '' || value instanceof Promise) {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
let d: Date | undefined;
|
|
40
|
+
if (value instanceof Date) {
|
|
41
|
+
d = value;
|
|
42
|
+
} else if (typeof value === 'string' || typeof value === 'number') {
|
|
43
|
+
const parsed = new Date(value);
|
|
44
|
+
if (!Number.isNaN(parsed.getTime())) {
|
|
45
|
+
d = parsed;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (d == null) {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
return `Local: ${d.toLocaleString()}\nUTC: ${d.toUTCString()}`;
|
|
52
|
+
});
|
|
53
|
+
|
|
27
54
|
const tableContext = getContext<TableContext<T, RowIdType>>(TableContext.identifier);
|
|
28
55
|
|
|
29
56
|
const options: Array<SelectOption<unknown>> = $derived(
|
|
@@ -106,6 +133,7 @@
|
|
|
106
133
|
class:has-modal={!!modalComponent}
|
|
107
134
|
tabIndex={hasValue ? 0 : undefined}
|
|
108
135
|
class="focusable"
|
|
136
|
+
title={dateTooltip}
|
|
109
137
|
style={focusDetails.outline}
|
|
110
138
|
class:multifocus={hasValue && focusDetails.isMultiFocused}
|
|
111
139
|
class:multifocus-start={hasValue && focusDetails.isMultiFocusStart}
|
|
@@ -325,26 +325,33 @@ export function createColumnFactory() {
|
|
|
325
325
|
: opts.filterValueType === 'String'
|
|
326
326
|
? 'text'
|
|
327
327
|
: 'display';
|
|
328
|
-
//
|
|
329
|
-
//
|
|
330
|
-
//
|
|
331
|
-
//
|
|
332
|
-
//
|
|
333
|
-
//
|
|
328
|
+
// For Date-typed display columns, leave the accessor returning
|
|
329
|
+
// the raw Date / ISO string (filter / sort logic still operates
|
|
330
|
+
// on the raw value) and surface the formatted local-time
|
|
331
|
+
// string via `getDisplayValue`. The cell renders
|
|
332
|
+
// `getDisplayValue` for visible text and reads the raw value
|
|
333
|
+
// from `accessorFn` to compose the hover tooltip showing both
|
|
334
|
+
// the local-time and UTC representations.
|
|
334
335
|
const rawValue = opts.value;
|
|
335
|
-
const valueAccessor =
|
|
336
|
+
const valueAccessor = rawValue;
|
|
337
|
+
const dateDisplayValue = opts.filterValueType === 'Date'
|
|
336
338
|
? (row, index) => {
|
|
337
339
|
const v = rawValue(row, index);
|
|
338
340
|
if (v instanceof Promise) {
|
|
339
|
-
return v.then(
|
|
341
|
+
return v.then((resolved) => {
|
|
342
|
+
const formatted = formatLocaleDate(resolved);
|
|
343
|
+
return formatted == null ? null : String(formatted);
|
|
344
|
+
});
|
|
340
345
|
}
|
|
341
|
-
|
|
346
|
+
const formatted = formatLocaleDate(v);
|
|
347
|
+
return formatted == null ? null : String(formatted);
|
|
342
348
|
}
|
|
343
|
-
:
|
|
349
|
+
: undefined;
|
|
344
350
|
const def = new DisplayDef({
|
|
345
351
|
id,
|
|
346
352
|
...commonProps(opts, inferredKind),
|
|
347
353
|
accessorFn: valueAccessor,
|
|
354
|
+
getDisplayValue: dateDisplayValue,
|
|
348
355
|
modal: opts.modal,
|
|
349
356
|
// Display columns have no implicit filter type (unlike the
|
|
350
357
|
// typed kinds where the factory pins one based on the
|
|
@@ -146,7 +146,16 @@ export function attachDropdownPortal(options) {
|
|
|
146
146
|
}
|
|
147
147
|
originalParent = dropdown.parentNode;
|
|
148
148
|
originalNextSibling = dropdown.nextSibling;
|
|
149
|
-
|
|
149
|
+
// Append the dropdown to the nearest open native `<dialog>` ancestor
|
|
150
|
+
// when one exists, otherwise to `document.body`. A `<dialog>` opened
|
|
151
|
+
// via `showModal()` renders in the browser's top layer, which sits
|
|
152
|
+
// above every z-indexed element in the regular stacking context.
|
|
153
|
+
// Without this hop the dropdown's `z-index: 10000` was still painted
|
|
154
|
+
// behind the dialog backdrop and its content (the symptom that
|
|
155
|
+
// surfaced as "select options disappear behind the allocate modal").
|
|
156
|
+
const dialogHost = trigger.closest('dialog');
|
|
157
|
+
const portalTarget = dialogHost && dialogHost.open ? dialogHost : document.body;
|
|
158
|
+
portalTarget.appendChild(dropdown);
|
|
150
159
|
// Tag the teleported dropdown so any "click outside the
|
|
151
160
|
// panel" / "click outside the trigger" handler elsewhere in
|
|
152
161
|
// the codebase can recognise the dropdown as a logical
|
package/dist/scss/_mixins.scss
CHANGED
|
@@ -633,8 +633,13 @@
|
|
|
633
633
|
|
|
634
634
|
.modal-main {
|
|
635
635
|
display: flex;
|
|
636
|
+
flex-flow: column nowrap;
|
|
636
637
|
flex-grow: 1;
|
|
637
|
-
// overflow-y: auto
|
|
638
|
+
// `overflow-y: auto` is the default for the modal body so long
|
|
639
|
+
// content (form fields, lists, etc.) scrolls inside the modal
|
|
640
|
+
// rather than pushing the footer buttons out of the viewport.
|
|
641
|
+
overflow-y: auto;
|
|
642
|
+
min-height: 0;
|
|
638
643
|
padding: sizing.$half-padding;
|
|
639
644
|
background-color: colours.$ui-blue-1;
|
|
640
645
|
|