@design.estate/dees-catalog 21.28.0 → 21.29.0
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_bundle/bundle.js +281 -99
- package/dist_bundle/bundle.js.map +1 -1
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-45QQJK4L.js → chunk-CJVVAKHG.js} +509 -358
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-45QQJK4L.js.map → chunk-CJVVAKHG.js.map} +1 -1
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-C63GPX4U.js → chunk-QFJ7LA5L.js} +2 -2
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-OYJYQPHK.js → dees-modal-NVJRWZKO.js} +2 -2
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-UTDYRJTX.js → dees-workspace-terminal-BSBYG5IX.js} +3 -3
- package/dist_ts_web/00_commitinfo_data.js +1 -1
- package/dist_ts_web/elements/00actionerror.d.ts +4 -2
- package/dist_ts_web/elements/00actionerror.js +1 -1
- package/dist_ts_web/elements/00group-button/dees-actionfooter/dees-actionfooter.d.ts +77 -0
- package/dist_ts_web/elements/00group-button/dees-actionfooter/dees-actionfooter.demo.d.ts +1 -0
- package/dist_ts_web/elements/00group-button/dees-actionfooter/dees-actionfooter.demo.js +60 -0
- package/dist_ts_web/elements/00group-button/dees-actionfooter/dees-actionfooter.js +240 -0
- package/dist_ts_web/elements/00group-button/dees-actionfooter/index.d.ts +1 -0
- package/dist_ts_web/elements/00group-button/dees-actionfooter/index.js +2 -0
- package/dist_ts_web/elements/00group-button/index.d.ts +1 -0
- package/dist_ts_web/elements/00group-button/index.js +2 -1
- package/dist_ts_web/elements/00group-dataview/dees-table/filters.d.ts +8 -3
- package/dist_ts_web/elements/00group-dataview/dees-table/filters.js +13 -15
- package/dist_ts_web/elements/00group-dataview/dees-table/search.js +3 -2
- package/dist_ts_web/elements/00group-input/dees-input-radiogroup/dees-input-radiogroup.d.ts +7 -1
- package/dist_ts_web/elements/00group-input/dees-input-radiogroup/dees-input-radiogroup.demo.js +17 -2
- package/dist_ts_web/elements/00group-input/dees-input-radiogroup/dees-input-radiogroup.js +25 -4
- package/dist_ts_web/elements/00group-input/profilepicture/profilepicture.modal.d.ts +1 -1
- package/dist_ts_web/elements/00group-input/profilepicture/profilepicture.modal.js +8 -20
- package/dist_ts_web/elements/00group-layout/dees-stepper/dees-stepper.d.ts +44 -3
- package/dist_ts_web/elements/00group-layout/dees-stepper/dees-stepper.demo.d.ts +2 -0
- package/dist_ts_web/elements/00group-layout/dees-stepper/dees-stepper.demo.js +118 -9
- package/dist_ts_web/elements/00group-layout/dees-stepper/dees-stepper.js +70 -13
- package/dist_ts_web/elements/00group-layout/dees-stepper/styles.js +54 -6
- package/dist_ts_web/elements/00group-overlay/dees-modal/dees-modal.d.ts +18 -26
- package/dist_ts_web/elements/00group-overlay/dees-modal/dees-modal.js +33 -100
- package/dist_ts_web/elements/00group-overlay/dees-popover/dees-popover.d.ts +14 -0
- package/dist_ts_web/elements/00group-overlay/dees-popover/dees-popover.js +49 -6
- package/package.json +1 -1
- package/readme.md +109 -16
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/elements/00actionerror.ts +4 -2
- package/ts_web/elements/00group-button/dees-actionfooter/dees-actionfooter.demo.ts +64 -0
- package/ts_web/elements/00group-button/dees-actionfooter/dees-actionfooter.ts +196 -0
- package/ts_web/elements/00group-button/dees-actionfooter/index.ts +1 -0
- package/ts_web/elements/00group-button/index.ts +1 -0
- package/ts_web/elements/00group-dataview/dees-table/filters.ts +14 -14
- package/ts_web/elements/00group-dataview/dees-table/search.ts +2 -1
- package/ts_web/elements/00group-input/dees-input-radiogroup/dees-input-radiogroup.demo.ts +22 -1
- package/ts_web/elements/00group-input/dees-input-radiogroup/dees-input-radiogroup.ts +31 -5
- package/ts_web/elements/00group-input/profilepicture/profilepicture.modal.ts +7 -19
- package/ts_web/elements/00group-layout/dees-stepper/dees-stepper.demo.ts +106 -4
- package/ts_web/elements/00group-layout/dees-stepper/dees-stepper.ts +95 -33
- package/ts_web/elements/00group-layout/dees-stepper/styles.ts +55 -5
- package/ts_web/elements/00group-overlay/dees-modal/dees-modal.ts +43 -101
- package/ts_web/elements/00group-overlay/dees-popover/dees-popover.ts +36 -2
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-C63GPX4U.js.map → chunk-QFJ7LA5L.js.map} +0 -0
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-OYJYQPHK.js.map → dees-modal-NVJRWZKO.js.map} +0 -0
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-UTDYRJTX.js.map → dees-workspace-terminal-BSBYG5IX.js.map} +0 -0
package/readme.md
CHANGED
|
@@ -50,6 +50,7 @@ switcher**, **view-toggle**, and **single-selection toggle** all lead to
|
|
|
50
50
|
| Edit project files with terminals | [`dees-workspace`](#deesworkspace) | Monaco, file tree, terminal and diff workspace. |
|
|
51
51
|
| Run an agent conversation with tools and decisions | [`dees-harness-chat`](#deesharnesschat) | Compose the harness family; use its session list for conversation management. |
|
|
52
52
|
| Ask for a focused decision or show contextual commands | [`dees-modal`](#deesmodal), [`dees-contextmenu`](#deescontextmenu) | Modal task flow versus contextual action menu. Use existing overlay ownership. |
|
|
53
|
+
| Put the actions of a dialog, a speech bubble or a card of your own at its bottom edge | [`dees-actionfooter`](#deesactionfooter) | Divider, tinted strip, the primary rightmost, one action at a time. A dialog's `menuOptions` and a bubble's `actions` are drawn by it already; never a row of buttons built by hand. Not the countdown question bar, which is [`dees-actionbar`](#deesactionbar). |
|
|
53
54
|
| Show completion, progress or transient feedback | [`dees-stepper`](#deesstepper), [`dees-progressbar`](#deesprogressbar), [`dees-toast`](#deestoast) | Workflow stages, measurable progress, or a brief notification. |
|
|
54
55
|
|
|
55
56
|
### Before adding a control
|
|
@@ -342,6 +343,7 @@ task guide and examples deliberately; the generated table does not replace them.
|
|
|
342
343
|
| Element | Family | API | Source |
|
|
343
344
|
| --- | --- | --- | --- |
|
|
344
345
|
| `dees-actionbar` | feedback | [DeesActionbar](#deesactionbar) | [Source](ts_web/elements/00group-feedback/dees-actionbar/dees-actionbar.ts) |
|
|
346
|
+
| `dees-actionfooter` | button | [DeesActionFooter](#deesactionfooter) | [Source](ts_web/elements/00group-button/dees-actionfooter/dees-actionfooter.ts) |
|
|
345
347
|
| `dees-appui` | appui | [DeesAppui](#deesappui) | [Source](ts_web/elements/00group-appui/dees-appui/dees-appui.ts) |
|
|
346
348
|
| `dees-appui-activitylog` | appui | [DeesAppuiActivitylog](#deesappuiactivitylog) | [Source](ts_web/elements/00group-appui/dees-appui-activitylog/dees-appui-activitylog.ts) |
|
|
347
349
|
| `dees-appui-appbar` | appui | — | [Source](ts_web/elements/00group-appui/dees-appui-appbar/component.ts) |
|
|
@@ -510,7 +512,8 @@ new public primitive property that neither reflects nor is listed there.
|
|
|
510
512
|
|
|
511
513
|
Components that run an application callback — `dees-modal`'s `menuOptions[].action`,
|
|
512
514
|
`dees-table`'s `dataActions[].actionFunc` and `onRetry`, `dees-tile`'s `actions[].actionFunc`,
|
|
513
|
-
`dees-appui-page`'s `actions[].action
|
|
515
|
+
`dees-appui-page`'s `actions[].action`, `dees-state`'s `actions[].action` and `onRetry`,
|
|
516
|
+
`dees-popover`'s `actions[].action` and `dees-actionfooter`'s `actions[].action` —
|
|
514
517
|
await it. A rejected callback is
|
|
515
518
|
never dropped: the component dispatches the cancelable `dees-action-error` event
|
|
516
519
|
(bubbling and composed) and, unless a listener cancels it, shows the error through
|
|
@@ -519,10 +522,11 @@ never dropped: the component dispatches the cancelable `dees-action-error` event
|
|
|
519
522
|
```typescript
|
|
520
523
|
element.addEventListener('dees-action-error', (event: CustomEvent<IActionErrorDetail>) => {
|
|
521
524
|
const { error, action, source } = event.detail;
|
|
522
|
-
// source: 'modal-menu' | 'modal-dismiss' | 'table-header' | 'table-footer' | 'table-empty'
|
|
525
|
+
// source: 'modal-menu' | 'modal-dismiss' | 'stepper-cancel' | 'table-header' | 'table-footer' | 'table-empty'
|
|
523
526
|
// | 'table-row' | 'table-rowmenu' | 'table-contextmenu' | 'table-doubleclick' | 'table-rowclick'
|
|
524
527
|
// | 'table-keycombination'
|
|
525
528
|
// | 'tile-header' | 'tile-footer' | 'page-action' | 'state-action' | 'state-retry'
|
|
529
|
+
// | 'popover-action' | 'actionfooter' (a footer's own `source` when it sets one)
|
|
526
530
|
event.preventDefault(); // render your own error surface instead of the toast
|
|
527
531
|
reportToCrashService(error);
|
|
528
532
|
});
|
|
@@ -544,6 +548,7 @@ implementation offers its actions the same way. Choose the place by what the act
|
|
|
544
548
|
| What a tile shows: a summary, a status, a chart, a list that is not a table | the tile's [`actions`](#deestile), `type: ['footer']` for the way on from the content, `['header']` for one that adds to or refreshes it | "Open the audit trail", "Export CSV", "New invoice" |
|
|
545
549
|
| A whole page or view | [`dees-appui-page`](#deesappuipage) `actions` | "New service" |
|
|
546
550
|
| A decision a dialog asks for | [`dees-modal`](#deesmodal) `menuOptions` | "Cancel", "Delete" |
|
|
551
|
+
| What a speech bubble shows, such as its filters | the bubble's [`actions`](#deespopover) | "Clear filters" |
|
|
547
552
|
| A place that loads, is empty or failed | [`dees-state`](#deesstate) `actions` | "Retry", "New service" |
|
|
548
553
|
| Not an action: a standing explanation of a view — how a feature works, what a list holds | the table's or the tile's `info`: an info button (ⓘ) at the end of the footer bar, after the footer actions, that opens it in the [speech bubble](#deespopover) | "A GoBD year archive holds one fiscal year: …" |
|
|
549
554
|
| Not an action: the view's filters | the table's [`filters`](#deestable), behind the filter button at the end of its search field; what is active shows as chips in the active-filter bar above the column headers | "Account", "Month", "Include private" |
|
|
@@ -551,6 +556,10 @@ implementation offers its actions the same way. Choose the place by what the act
|
|
|
551
556
|
- Never build a bar of buttons into a tile's footer or header slot. Tile actions and a table's
|
|
552
557
|
header and footer actions are one standard, drawn by one renderer: they share their size, type,
|
|
553
558
|
spacing, wrapping, glyph, busy face, keyboard behaviour and accessible name.
|
|
559
|
+
- A dialog's and a speech bubble's actions stand in their action footer,
|
|
560
|
+
[`dees-actionfooter`](#deesactionfooter), at the bottom edge: a divider, a tinted strip, the
|
|
561
|
+
primary rightmost. Never build a row of buttons into a dialog's or a bubble's content; a surface
|
|
562
|
+
of your own that asks like a dialog, a card centred in a view, places the same footer.
|
|
554
563
|
- A tile whose content is a table offers the actions about the table's rows as the table's own
|
|
555
564
|
header or footer actions, never in a second footer under the table's: the table's footer already
|
|
556
565
|
carries its count and its actions.
|
|
@@ -569,8 +578,8 @@ implementation offers its actions the same way. Choose the place by what the act
|
|
|
569
578
|
button is the sliders button at the end of the table's search field, in the table's header or
|
|
570
579
|
in [`dees-table-search`](#deestablesearch) on the page header: one entry point, never a second
|
|
571
580
|
filter control beside the field. It counts the active filters and opens them in the speech
|
|
572
|
-
bubble, with "Filter by column"
|
|
573
|
-
as it is made. Each filter declares its `default`, the value that means "not filtered" (every
|
|
581
|
+
bubble, with "Filter by column" and where the search looks, and "Clear filters" in the bubble's
|
|
582
|
+
action footer; a choice applies as it is made. Each filter declares its `default`, the value that means "not filtered" (every
|
|
574
583
|
account, any month, private movements included): only a filter at another value is active,
|
|
575
584
|
counts on the button, shows as a chip ("Account: Sparkasse", "Without private") in the
|
|
576
585
|
active-filter bar between the header and the column headers, and "Clear all" puts it back to
|
|
@@ -1337,6 +1346,53 @@ Container for grouping related buttons together.
|
|
|
1337
1346
|
</dees-button-group>
|
|
1338
1347
|
```
|
|
1339
1348
|
|
|
1349
|
+
#### `DeesActionFooter`
|
|
1350
|
+
|
|
1351
|
+
The action row at the bottom edge of a surface: a hairline divider, a tinted strip
|
|
1352
|
+
(`--dees-color-modal-sidebar`), the actions on the inline end with the primary rightmost.
|
|
1353
|
+
[`dees-modal`](#deesmodal) draws its `menuOptions` with it and [`dees-popover`](#deespopover) its
|
|
1354
|
+
`actions`; place it yourself only on a surface of your own that asks like a dialog, such as a card
|
|
1355
|
+
centred in a view. It is not [`dees-actionbar`](#deesactionbar), the bar that asks one question
|
|
1356
|
+
at a time with a countdown.
|
|
1357
|
+
|
|
1358
|
+
```typescript
|
|
1359
|
+
import { catalogAction } from '@design.estate/dees-catalog';
|
|
1360
|
+
|
|
1361
|
+
html`<dees-actionfooter .context=${card} .actions=${[
|
|
1362
|
+
catalogAction('common.cancel', async () => card.close()),
|
|
1363
|
+
{ name: 'Save changes', action: async (cardArg) => save(cardArg) },
|
|
1364
|
+
]}></dees-actionfooter>`
|
|
1365
|
+
```
|
|
1366
|
+
|
|
1367
|
+
- **Primary.** Without `primary` on any action, the last one is the primary, drawn as `accent`, or as
|
|
1368
|
+
`destructive` with `primaryActionType="destructive"` for an action that deletes or cannot be
|
|
1369
|
+
taken back. Once an action carries `primary`, only the first marked `primary: true` is the
|
|
1370
|
+
primary; actions all marked `primary: false` have none, as a filter bubble's lone "Clear
|
|
1371
|
+
filters". The primary stands rightmost wherever it sits in `actions`; the others are
|
|
1372
|
+
`secondary` and keep their order.
|
|
1373
|
+
- **One at a time.** Every action is awaited: while its promise is pending its button shows the
|
|
1374
|
+
busy face, the others are unavailable, and a second press is ignored. A rejection is announced
|
|
1375
|
+
through `dees-action-error` with the footer's `source` (`actionfooter` unless the surface names
|
|
1376
|
+
itself, as `modal-menu` and `popover-action` do; see [Failed actions](#failed-actions)), and
|
|
1377
|
+
the row is usable again. A running action is known by its object, so keep the action objects
|
|
1378
|
+
while one runs.
|
|
1379
|
+
- **Unavailable.** `disabled: true` on an action keeps it visible but unavailable, as "Clear
|
|
1380
|
+
filters" while nothing is filtered; `disabled` on the footer makes every action unavailable.
|
|
1381
|
+
- **Context.** Each action receives `context`, the dialog, bubble or card the footer belongs to,
|
|
1382
|
+
or the footer itself when it is unset. `runPrimary()` runs the primary as a press would; a
|
|
1383
|
+
dialog runs it on Enter in its form's last field.
|
|
1384
|
+
- **Words.** `catalogAction('common.cancel' | 'common.create' | 'modal.continue', action)` makes
|
|
1385
|
+
an action named by a catalog word: the footer reads it in the reader's language while it
|
|
1386
|
+
renders, so it follows a change of language while it shows.
|
|
1387
|
+
- **Inset and wrapping.** `--dees-actionfooter-inset` sets the inline padding (24px by default)
|
|
1388
|
+
so the actions line up with the surface's heading and content; the modal sets its own inset,
|
|
1389
|
+
a bubble 16px. A label too long for the row wraps inside its button instead of being cut off.
|
|
1390
|
+
|
|
1391
|
+
The buttons are drawn in the footer's own shadow root. A test that reached a dialog's buttons
|
|
1392
|
+
through `modal.shadowRoot.querySelectorAll('dees-button')` reads them one root further down:
|
|
1393
|
+
`modal.shadowRoot.querySelector('dees-actionfooter').shadowRoot.querySelectorAll('dees-button')`.
|
|
1394
|
+
Role and text locators find them as before.
|
|
1395
|
+
|
|
1340
1396
|
#### `DeesHeading`
|
|
1341
1397
|
Consistent heading component; the text is slotted.
|
|
1342
1398
|
|
|
@@ -1825,7 +1881,7 @@ translate the inner input event into their own public event should stop the inne
|
|
|
1825
1881
|
event's propagation.
|
|
1826
1882
|
|
|
1827
1883
|
#### `DeesInputRadiogroup`
|
|
1828
|
-
Radio-style single-choice form input, including required validation and optional payload values. For a segmented view switcher, use [`dees-input-multitoggle`](#deesinputmultitoggle). Object options use `{ key, option, payload? }`; the visible text field is `option`, unlike multitoggle's `label`.
|
|
1884
|
+
Radio-style single-choice form input, including required validation and optional payload values. For a segmented view switcher, use [`dees-input-multitoggle`](#deesinputmultitoggle). Object options use `{ key, option, payload?, description? }`; the visible text field is `option`, unlike multitoggle's `label`. A `description` is a line under the option's label that explains the choice (secondary footnote text); the circle stays on the label's line, and the description is the radio's accessible description.
|
|
1829
1885
|
|
|
1830
1886
|
The options sit in one `radiogroup` named by the label (with `aria-required`, `aria-disabled` and `aria-invalid`), and the group is one tab stop: Tab reaches the chosen option, or the first while nothing is chosen. The arrow keys move the choice with the focus and wrap; Space chooses the focused option. Enter belongs to the form, as in a native radio group: it moves to the next field, or submits from the last.
|
|
1831
1887
|
|
|
@@ -1850,6 +1906,16 @@ The options sit in one `radiogroup` named by the label (with `aria-required`, `a
|
|
|
1850
1906
|
]}
|
|
1851
1907
|
selectedOption="medium"
|
|
1852
1908
|
></dees-input-radiogroup>
|
|
1909
|
+
|
|
1910
|
+
// Choices that explain themselves
|
|
1911
|
+
<dees-input-radiogroup
|
|
1912
|
+
key="source"
|
|
1913
|
+
label="How do you want to add the contact?"
|
|
1914
|
+
.options=${[
|
|
1915
|
+
{ key: 'manual', option: 'Enter the details yourself', description: 'Type the name and whatever else you know.' },
|
|
1916
|
+
{ key: 'text', option: 'Read them from a text', description: 'Paste a signature; a language model picks out the details.' }
|
|
1917
|
+
]}
|
|
1918
|
+
></dees-input-radiogroup>
|
|
1853
1919
|
```
|
|
1854
1920
|
|
|
1855
1921
|
#### `DeesInputTags`
|
|
@@ -4279,9 +4345,12 @@ or a pixel value. `minWidth` and `maxWidth` remain bounded by the viewport.
|
|
|
4279
4345
|
`showCloseButton`, `showHelpButton`, and `onHelp`. `contentPadding` defaults to 24px; at 0 the
|
|
4280
4346
|
body runs to the sheet's edges and declares the heading's inset as the
|
|
4281
4347
|
[region inset](#region-inset), so a frameless table or code view in it lines up with the heading.
|
|
4282
|
-
The
|
|
4283
|
-
`
|
|
4284
|
-
|
|
4348
|
+
The `menuOptions` stand in the dialog's action footer, a
|
|
4349
|
+
[`dees-actionfooter`](#deesactionfooter) inset like the heading. The final action is the primary
|
|
4350
|
+
one, drawn as an `accent` button and standing rightmost, unless an action carries `primary`
|
|
4351
|
+
(`IActionFooterAction`); set `primaryActionType: 'destructive'` to draw it as a destructive button
|
|
4352
|
+
for an action that deletes or cannot be taken back. `disabled: true` shows an action that cannot
|
|
4353
|
+
be taken yet. An action whose label is
|
|
4285
4354
|
wider than the dialog wraps onto more lines inside it rather than being cut off; a label
|
|
4286
4355
|
that fits keeps the one-line action.
|
|
4287
4356
|
|
|
@@ -4418,6 +4487,7 @@ The catalog's one speech bubble: nonmodal content anchored in the browser's top
|
|
|
4418
4487
|
- **Placement.** `.placement` (`TDeesPopoverPlacement`) is `'auto'` by default: the bubble measures the room around the part of its anchor the reader sees — its box cut by the viewport and the scroll containers around it — and opens below or above it, wherever it fits with more room (below a header, above a footer), beside it only when neither fits, and on the side with the most room for its size when nothing fits. `'top'`, `'bottom'`, `'start'` and `'end'` (the inline sides in the anchor's writing direction; `'end'` is the right in a left-to-right page) name the side, which then holds. Either way the bubble keeps 8px from the viewport's edges, sliding along its side, and its tail keeps pointing at the anchor's middle. The side it took is the `actual-placement` attribute (`top`, `bottom`, `left`, `right`). While open it places itself again as the page scrolls or resizes and as its anchor or its content resizes, keeping its side while it still fits there. It eases in from its anchor on that side, at once under `prefers-reduced-motion: reduce`.
|
|
4419
4488
|
- **Scrolling.** Content taller than `.maxHeight` scrolls inside the bubble's frame and fades out toward the edges past which more lies ([Scroll edges](#scroll-edges), the fade look); content that fits fades nowhere.
|
|
4420
4489
|
- **Controls inside.** A dropdown's list, a date picker or a context menu opened from a control inside the bubble shows above it: they mount in the bubble's own top layer (its `overlayLayer`, which `getOverlayContainer` finds as it finds an open dialog), and the bubble leaves the keys to them while one is open, so Escape closes the list first and the bubble with the next press. A press in the list does not close the bubble. A toast raised inside the bubble is no part of it: it shows above the bubble and stays when it closes.
|
|
4490
|
+
- **Actions.** `.actions` (`IActionFooterAction<DeesPopover>[]`) are the bubble's actions about what it shows, such as a filter bubble's "Clear filters". They stand in its [action footer](#deesactionfooter) at the bottom edge, which stays in place while the content scrolls: the primary rightmost (the last action unless one carries `primary`; `primary: false` on all of them draws plain buttons), one action at a time, each called with the bubble, a failure announced with the source `popover-action`. A press on one keeps the bubble open. When the tail leaves the bubble from the footer — the bubble above its anchor, or beside it level with the footer — it takes the footer's tint. Without actions the bubble has no footer; a tooltip has none.
|
|
4421
4491
|
- **Tooltip.** A host that opens the bubble on hover gives it `role="tooltip"`: it is then named by its content, not by `.label`, and leaves its anchor's state alone (no `aria-expanded`, `aria-haspopup` or `aria-controls`); the host describes the anchor by it. `dees-speechbubble` does this for its rich bubbles.
|
|
4422
4492
|
|
|
4423
4493
|
```typescript
|
|
@@ -4557,6 +4627,15 @@ modal with `DeesStepper.createAndShow({ steps, cancelable: true })`.
|
|
|
4557
4627
|
a small modal), where the card also tightens its padding in any layout. The ribbon follows
|
|
4558
4628
|
the writing direction: in a right-to-left page it stands on the steps' right, the
|
|
4559
4629
|
strip fills from the right and the steps slide the other way.
|
|
4630
|
+
- **A centred card.** `cardAlign` (also a `createAndShow` option) sets where the card
|
|
4631
|
+
stands in the stepper's height. `'start'` (default) sets it at an offset from the top.
|
|
4632
|
+
`'center'` centres it, with as much room above it as below and the ribbon at its top
|
|
4633
|
+
edge (in the vertical layout the strip and the card stand centred together): a
|
|
4634
|
+
focused, dialog-like card inside a page or a tab that the flow has to itself, without
|
|
4635
|
+
a modal. Each step is centred at its own height, a leaving step fades out where it
|
|
4636
|
+
stood, and a step taller than the stepper scrolls inside its card. The text in the
|
|
4637
|
+
card keeps its alignment. (The property is not called `align`: on an element, that
|
|
4638
|
+
attribute is the browser's legacy text alignment.)
|
|
4560
4639
|
- Async actions prevent duplicate activation and display failures in the current
|
|
4561
4640
|
step. The running action alone shows its busy face; the others are disabled
|
|
4562
4641
|
until it settles. Progress failures expose **Try again**; `retryStep()` reruns validation.
|
|
@@ -4571,18 +4650,29 @@ modal with `DeesStepper.createAndShow({ steps, cancelable: true })`.
|
|
|
4571
4650
|
and `goBack()` keep what the reader entered, and custom elements in it disconnect
|
|
4572
4651
|
while their step is off the stage and connect again when it returns. Back honors
|
|
4573
4652
|
`allowBack: false`. A leaving step is inert. A step starts at a fixed height and
|
|
4574
|
-
grows downward
|
|
4575
|
-
scrolls to place a step. Transitions use the
|
|
4576
|
-
where they are when interrupted, and are instant
|
|
4653
|
+
grows downward (a centred card grows from its middle), so new content never moves
|
|
4654
|
+
its title; nothing in the stepper scrolls to place a step. Transitions use the
|
|
4655
|
+
theme's motion tokens, turn from where they are when interrupted, and are instant
|
|
4656
|
+
under reduced motion.
|
|
4577
4657
|
- **Cancelling.** Each step's header carries `dees-modal`'s close control (×) at its
|
|
4578
4658
|
inline end. It, Escape (overlay mode) and backdrop clicks (anywhere beside the current
|
|
4579
4659
|
step and the ribbon) share a confirmation flow (an Escape that closes an open bubble closes only the
|
|
4580
4660
|
bubble); `cancelable: false` removes the close control and
|
|
4581
|
-
disables those dismissal paths, however often Escape is pressed. A
|
|
4661
|
+
disables those dismissal paths, however often Escape is pressed. A flow that knows
|
|
4662
|
+
what a cancel would lose sets `beforeClose` (also a `createAndShow` option), which
|
|
4663
|
+
is asked in place of the stepper's own confirmation, as `dees-modal`'s is: only
|
|
4664
|
+
`false` keeps the flow open, so the flow can ask its own question, or close at once
|
|
4665
|
+
while nothing is entered. A hook that throws or rejects keeps the flow open and is
|
|
4666
|
+
announced through `dees-action-error` with the source `stepper-cancel`. A close the
|
|
4582
4667
|
browser still forces, such as a system back gesture, ends the flow as a
|
|
4583
4668
|
dismissal: the step's work is aborted, the stepper is removed and `stepper-close`
|
|
4584
|
-
fires. `destroy()` closes the flow
|
|
4585
|
-
|
|
4669
|
+
fires. `destroy()` closes the flow: the stepper removes itself and `stepper-close`
|
|
4670
|
+
fires, once. Only closing the flow fires it: `destroy()`, a confirmed cancel, or a
|
|
4671
|
+
close the browser forces. When the page takes an inline stepper out and puts it
|
|
4672
|
+
back (a tab switch, a re-render that moves it), the flow goes on: the step, what was
|
|
4673
|
+
entered and a running action are kept, and no `stepper-close` fires. While it is out,
|
|
4674
|
+
the step's `validationFunc` work is aborted, and it starts again when the stepper is
|
|
4675
|
+
back; observers and the confirmation are released. Overlay mode uses native
|
|
4586
4676
|
dialog focus containment and restoration.
|
|
4587
4677
|
- The stepper fires `deesElementConnected` once it has connected and made its
|
|
4588
4678
|
selected step the working one (its form read for the primary, its work started);
|
|
@@ -4595,8 +4685,11 @@ modal with `DeesStepper.createAndShow({ steps, cancelable: true })`.
|
|
|
4595
4685
|
|
|
4596
4686
|
The catalog demo combines setup fields, preferences, a review, background work,
|
|
4597
4687
|
and completion. **Retry example** fails the first background attempt and preserves
|
|
4598
|
-
the choices for recovery, **Lookup** a flow of unknown length (`'position'`),
|
|
4599
|
-
**
|
|
4688
|
+
the choices for recovery, **Lookup** a flow of unknown length (`'position'`),
|
|
4689
|
+
**Choice first** a flow whose later steps follow the first step's answer (three
|
|
4690
|
+
described choices in a `dees-input-radiogroup`; its `beforeClose` asks first only once
|
|
4691
|
+
something was read), and **Long flow** a ribbon that
|
|
4692
|
+
scrolls. **Narrow** shows the strip, **Centred** the centred card. It also shows
|
|
4600
4693
|
optional and required-completion overlays.
|
|
4601
4694
|
|
|
4602
4695
|
```typescript
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@design.estate/dees-catalog',
|
|
6
|
-
version: '21.
|
|
6
|
+
version: '21.29.0',
|
|
7
7
|
description: 'A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript.'
|
|
8
8
|
}
|
|
@@ -8,14 +8,16 @@ export interface IActionErrorDetail<TAction = unknown> {
|
|
|
8
8
|
action: TAction;
|
|
9
9
|
/**
|
|
10
10
|
* Where the action was invoked from. Catalog sources are `modal-menu`,
|
|
11
|
-
* `modal-dismiss` (a failing `beforeClose` hook), `
|
|
11
|
+
* `modal-dismiss` (a failing `beforeClose` hook), `stepper-cancel` (a
|
|
12
|
+
* `dees-stepper`'s failing `beforeClose` hook), `table-header`,
|
|
12
13
|
* `table-footer`, `table-empty`, `table-row`, `table-rowmenu`,
|
|
13
14
|
* `table-contextmenu`, `table-doubleclick`, `table-rowclick`,
|
|
14
15
|
* `table-keycombination`, `page-action` (a
|
|
15
16
|
* `dees-appui-page` header action), `state-action` and `state-retry` (a
|
|
16
17
|
* `dees-state` action and its Retry), and `statusbutton-action` (a
|
|
17
18
|
* `dees-statusbutton` status's action); `tile-header` and `tile-footer` are
|
|
18
|
-
* a `dees-tile`'s actions
|
|
19
|
+
* a `dees-tile`'s actions; `popover-action` is a `dees-popover`'s action and
|
|
20
|
+
* `actionfooter` one of a `dees-actionfooter` placed on its own.
|
|
19
21
|
*/
|
|
20
22
|
source: string;
|
|
21
23
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { html } from '@design.estate/dees-element';
|
|
2
|
+
import { demoPage, demoSection, demoOutput, demoCode, showDemoResult } from '../../../demos/templates.js';
|
|
3
|
+
import type { IActionFooterAction } from './dees-actionfooter.js';
|
|
4
|
+
|
|
5
|
+
const surfaceStyles = html`<style>
|
|
6
|
+
.demo-surface { display: grid; max-width: 480px; overflow: hidden; border-radius: var(--dees-radius-2xl); background: var(--dees-material-thick-bg-opaque); box-shadow: 0 0 0 var(--dees-line-width-hairline) var(--dees-color-border-subtle), var(--dees-shadow-lg); }
|
|
7
|
+
.demo-surface.narrow { max-width: 280px; }
|
|
8
|
+
.demo-surface-body { padding: var(--dees-spacing-xl); font-size: var(--dees-font-footnote-size); line-height: var(--dees-font-footnote-line); color: var(--dees-color-text-secondary); }
|
|
9
|
+
.demo-surface-body strong { display: block; margin-bottom: var(--dees-spacing-xs); font-size: var(--dees-font-subhead-size); line-height: var(--dees-font-subhead-line); color: var(--dees-color-text-primary); }
|
|
10
|
+
</style>`;
|
|
11
|
+
|
|
12
|
+
/** A surface with a body and the footer at its bottom edge, as a dialog or a card draws it. */
|
|
13
|
+
const surface = (title: string, body: string, footer: ReturnType<typeof html>, narrow = false) => html`
|
|
14
|
+
<div class="demo-surface ${narrow ? 'narrow' : ''}">
|
|
15
|
+
<div class="demo-surface-body"><strong>${title}</strong>${body}</div>
|
|
16
|
+
${footer}
|
|
17
|
+
</div>`;
|
|
18
|
+
|
|
19
|
+
const report = (name: string): IActionFooterAction<HTMLElement>['action'] => async (footer) => {
|
|
20
|
+
showDemoResult(footer!, `${name} pressed`);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const demoFunc = () => demoPage('Action footer', 'The action row at the bottom edge of a dialog, a speech bubble or a card: a divider, a tinted strip, the primary rightmost.', html`
|
|
24
|
+
${surfaceStyles}
|
|
25
|
+
${demoSection('Two actions', 'The last action is the primary unless one says otherwise; the others are secondary.', html`
|
|
26
|
+
${surface('Save the draft?', 'Your changes stay on this device until you save them.', html`
|
|
27
|
+
<dees-actionfooter .actions=${[
|
|
28
|
+
{ name: 'Cancel', action: report('Cancel') },
|
|
29
|
+
{ name: 'Save changes', action: report('Save changes') },
|
|
30
|
+
]}></dees-actionfooter>`)}
|
|
31
|
+
${demoOutput('Press an action.')}
|
|
32
|
+
${demoCode("<dees-actionfooter .actions=${[\n { name: 'Cancel', action: cancel },\n { name: 'Save changes', action: save },\n]}></dees-actionfooter>")}`)}
|
|
33
|
+
${demoSection('A destructive primary', 'An action that deletes or cannot be taken back is drawn as destructive.', html`
|
|
34
|
+
${surface('Remove this member?', 'They lose access to the workspace immediately.', html`
|
|
35
|
+
<dees-actionfooter primaryActionType="destructive" .actions=${[
|
|
36
|
+
{ name: 'Keep', action: report('Keep') },
|
|
37
|
+
{ name: 'Remove', action: report('Remove') },
|
|
38
|
+
]}></dees-actionfooter>`)}
|
|
39
|
+
${demoOutput('Press an action.')}`)}
|
|
40
|
+
${demoSection('No primary', 'Actions all marked primary: false are ordinary buttons, as a filter bubble\'s Clear filters. A disabled action stays visible.', html`
|
|
41
|
+
${surface('Filters', 'Two filters narrow the list.', html`
|
|
42
|
+
<dees-actionfooter style="--dees-actionfooter-inset: var(--dees-spacing-lg)" .actions=${[
|
|
43
|
+
{ name: 'Undo', primary: false, disabled: true, action: report('Undo') },
|
|
44
|
+
{ name: 'Clear filters', primary: false, action: report('Clear filters') },
|
|
45
|
+
]}></dees-actionfooter>`)}
|
|
46
|
+
${demoOutput('Press Clear filters.')}`)}
|
|
47
|
+
${demoSection('Actions that take a moment', 'One action runs at a time: its button shows the busy face and the others wait. A failure is announced and hands the row back.', html`
|
|
48
|
+
${surface('Issue the invoice', 'Issuing takes a moment; failing shows a notification.', html`
|
|
49
|
+
<dees-actionfooter .actions=${[
|
|
50
|
+
{ name: 'Fail', action: async () => { throw new Error('The invoicing service is unavailable.'); } },
|
|
51
|
+
{ name: 'Issue', action: async (footer: HTMLElement) => {
|
|
52
|
+
await new Promise((resolve) => setTimeout(resolve, 1500));
|
|
53
|
+
showDemoResult(footer, 'Issued once');
|
|
54
|
+
} },
|
|
55
|
+
]}></dees-actionfooter>`)}
|
|
56
|
+
${demoOutput('Press Issue twice in a row to see it run once.')}`)}
|
|
57
|
+
${demoSection('Long labels', 'A label too long for the row wraps inside its button instead of being cut off.', html`
|
|
58
|
+
${surface('Discard the import?', 'The imported rows have not been checked yet.', html`
|
|
59
|
+
<dees-actionfooter .actions=${[
|
|
60
|
+
{ name: 'Discard all imported rows', action: report('Discard') },
|
|
61
|
+
{ name: 'Check the imported rows one by one', action: report('Check') },
|
|
62
|
+
]}></dees-actionfooter>`, true)}
|
|
63
|
+
${demoOutput('Press an action.')}`)}
|
|
64
|
+
`);
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import * as plugins from '../../00plugins.js';
|
|
2
|
+
import { runAction } from '../../00actionerror.js';
|
|
3
|
+
import { dcMessages } from '../../../i18n/messages.js';
|
|
4
|
+
import { dcLocalize } from '../../../i18n/localize.js';
|
|
5
|
+
import {
|
|
6
|
+
DeesElement,
|
|
7
|
+
css,
|
|
8
|
+
cssManager,
|
|
9
|
+
customElement,
|
|
10
|
+
html,
|
|
11
|
+
property,
|
|
12
|
+
state,
|
|
13
|
+
type TemplateResult,
|
|
14
|
+
} from '@design.estate/dees-element';
|
|
15
|
+
|
|
16
|
+
import { demoFunc } from './dees-actionfooter.demo.js';
|
|
17
|
+
import { themeDefaultStyles } from '../../00theme.js';
|
|
18
|
+
import '../dees-button/dees-button.js';
|
|
19
|
+
|
|
20
|
+
declare global {
|
|
21
|
+
interface HTMLElementTagNameMap {
|
|
22
|
+
'dees-actionfooter': DeesActionFooter;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* One action of a footer. Without `primary` on any of the actions, the last one is the primary.
|
|
28
|
+
* Once one of them carries `primary`, only the first marked `primary: true` is: actions that are
|
|
29
|
+
* all marked `primary: false` have no primary, as a bubble's lone "Clear filters".
|
|
30
|
+
*/
|
|
31
|
+
export interface IActionFooterAction<T = any> extends plugins.tsclass.website.IMenuItem<T> {
|
|
32
|
+
/** Whether this is the footer's primary action, drawn in the primary type and run by `runPrimary()`. */
|
|
33
|
+
primary?: boolean;
|
|
34
|
+
/** Shown but not available, as "Clear filters" while nothing is filtered. */
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** The dees-button types the primary action may take. */
|
|
39
|
+
export type TActionFooterPrimaryType = 'accent' | 'destructive';
|
|
40
|
+
|
|
41
|
+
/** The catalog words an action of `catalogAction()` may be named by. */
|
|
42
|
+
export type TActionFooterWord = 'common.cancel' | 'common.create' | 'modal.continue';
|
|
43
|
+
|
|
44
|
+
/** The catalog word of each action `catalogAction()` made. */
|
|
45
|
+
const catalogWords = new WeakMap<IActionFooterAction, TActionFooterWord>();
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* An action named by a catalog word rather than by its caller: the footer reads its name in the
|
|
49
|
+
* reader's language while it renders, so the name follows a change of language while the footer
|
|
50
|
+
* shows, as the Cancel and Create of `DeesModal.prompt()` do.
|
|
51
|
+
*/
|
|
52
|
+
export const catalogAction = <T = any>(
|
|
53
|
+
wordArg: TActionFooterWord,
|
|
54
|
+
actionArg: IActionFooterAction<T>['action'],
|
|
55
|
+
): IActionFooterAction<T> => {
|
|
56
|
+
const item: IActionFooterAction<T> = { name: dcMessages.entries[wordArg].message, action: actionArg };
|
|
57
|
+
catalogWords.set(item, wordArg);
|
|
58
|
+
return item;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The action row at the bottom edge of a surface — a dialog, a speech bubble, a card: a hairline
|
|
63
|
+
* divider, a tinted strip, the actions on the inline end with the primary rightmost in the accent
|
|
64
|
+
* colour and the others secondary. A label too long for the row wraps inside its button instead of
|
|
65
|
+
* being cut off. `dees-modal` and `dees-popover` draw their actions with it.
|
|
66
|
+
*
|
|
67
|
+
* It runs one action at a time: while an action's promise is pending, its button shows the busy
|
|
68
|
+
* face and the others are unavailable, so a second press cannot run an irreversible operation
|
|
69
|
+
* twice. A rejection is announced through `dees-action-error` and, unless a listener cancels it,
|
|
70
|
+
* a notification in the dialog the footer sits in; the footer is usable again either way.
|
|
71
|
+
*
|
|
72
|
+
* The surface sets the inline inset with `--dees-actionfooter-inset` (24px by default) so the
|
|
73
|
+
* actions line up with its heading and content.
|
|
74
|
+
*/
|
|
75
|
+
@customElement('dees-actionfooter')
|
|
76
|
+
export class DeesActionFooter extends DeesElement {
|
|
77
|
+
public static demo = demoFunc;
|
|
78
|
+
public static demoGroups = ['Button'];
|
|
79
|
+
|
|
80
|
+
private readonly t = dcLocalize(this);
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The actions, in reading order; the primary always stands rightmost, wherever it sits here. A
|
|
84
|
+
* running action is known by its object, so a host keeps its action objects while one runs.
|
|
85
|
+
*/
|
|
86
|
+
@property({ attribute: false })
|
|
87
|
+
accessor actions: IActionFooterAction[] = [];
|
|
88
|
+
|
|
89
|
+
/** What each action's callback receives: the dialog, the bubble or the card the footer belongs to; the footer itself when unset. */
|
|
90
|
+
@property({ attribute: false })
|
|
91
|
+
accessor context: unknown = undefined;
|
|
92
|
+
|
|
93
|
+
/** How the primary action is drawn: `accent` for a step forward, `destructive` for one that deletes or cannot be taken back. */
|
|
94
|
+
@property({ type: String, reflect: true })
|
|
95
|
+
accessor primaryActionType: TActionFooterPrimaryType = 'accent';
|
|
96
|
+
|
|
97
|
+
/** Every action unavailable, as while the dialog the footer belongs to confirms a prompt. */
|
|
98
|
+
@property({ type: Boolean, reflect: true })
|
|
99
|
+
accessor disabled = false;
|
|
100
|
+
|
|
101
|
+
/** The `source` of a failed action's `dees-action-error`, naming the surface: `modal-menu`, `popover-action`. */
|
|
102
|
+
@property({ type: String, reflect: true })
|
|
103
|
+
accessor source = 'actionfooter';
|
|
104
|
+
|
|
105
|
+
/** The action whose promise is still pending, if any. */
|
|
106
|
+
@state()
|
|
107
|
+
private accessor pendingAction: IActionFooterAction | null = null;
|
|
108
|
+
|
|
109
|
+
public static styles = [
|
|
110
|
+
themeDefaultStyles,
|
|
111
|
+
cssManager.defaultStyles,
|
|
112
|
+
css`
|
|
113
|
+
:host {
|
|
114
|
+
display: flex;
|
|
115
|
+
flex-wrap: wrap;
|
|
116
|
+
justify-content: flex-end;
|
|
117
|
+
align-items: center;
|
|
118
|
+
gap: var(--dees-spacing-sm);
|
|
119
|
+
padding: var(--dees-spacing-md) var(--dees-actionfooter-inset, var(--dees-spacing-xl));
|
|
120
|
+
border-top: var(--dees-line-width-hairline) solid var(--dees-color-border-subtle);
|
|
121
|
+
background: var(--dees-color-modal-sidebar);
|
|
122
|
+
font-family: var(--dees-font-family);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
:host([hidden]) {
|
|
126
|
+
display: none;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* An action keeps the one-line 28px face while its label fits. A label wider than the row
|
|
130
|
+
(a long confirmation on a phone) wraps onto more lines inside it instead of being cut
|
|
131
|
+
off: the face grows in height, never past the row's width. */
|
|
132
|
+
.action {
|
|
133
|
+
max-width: 100%;
|
|
134
|
+
min-width: 0;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.action::part(button) {
|
|
138
|
+
height: auto;
|
|
139
|
+
min-height: var(--dees-control-height-md);
|
|
140
|
+
max-width: 100%;
|
|
141
|
+
padding-block: var(--dees-spacing-xs);
|
|
142
|
+
white-space: normal;
|
|
143
|
+
/* anywhere, not break-word: only anywhere counts toward min-content, so an unbreakable
|
|
144
|
+
token (an e-mail address, an identifier) breaks inside the face instead of spilling */
|
|
145
|
+
overflow-wrap: anywhere;
|
|
146
|
+
text-align: center;
|
|
147
|
+
font-size: var(--dees-font-control-size);
|
|
148
|
+
border-radius: var(--dees-radius-md);
|
|
149
|
+
}
|
|
150
|
+
`,
|
|
151
|
+
];
|
|
152
|
+
|
|
153
|
+
public render(): TemplateResult {
|
|
154
|
+
const primary = this.primaryAction;
|
|
155
|
+
const ordered = primary ? [...this.actions.filter((action) => action !== primary), primary] : this.actions;
|
|
156
|
+
return html`${ordered.map((action) => html`
|
|
157
|
+
<dees-button class="action" .text=${this.actionName(action)}
|
|
158
|
+
.disabled=${this.disabled || !!action.disabled || (this.pendingAction !== null && this.pendingAction !== action)}
|
|
159
|
+
.status=${this.pendingAction === action ? 'pending' : 'normal'}
|
|
160
|
+
.type=${action === primary ? this.primaryActionType : 'secondary'}
|
|
161
|
+
@clicked=${() => this.run(action)}></dees-button>
|
|
162
|
+
`)}`;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** The primary action: the first marked `primary: true`, or the last when none carries the flag. */
|
|
166
|
+
public get primaryAction(): IActionFooterAction | undefined {
|
|
167
|
+
if (this.actions.some((action) => action.primary !== undefined)) return this.actions.find((action) => action.primary === true);
|
|
168
|
+
return this.actions[this.actions.length - 1];
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Runs the primary action as a press on its button would — Enter in a dialog's form does this.
|
|
173
|
+
* Nothing starts while an action runs, while the footer or the primary is disabled, or without a
|
|
174
|
+
* primary.
|
|
175
|
+
*/
|
|
176
|
+
public async runPrimary(): Promise<void> {
|
|
177
|
+
const primary = this.primaryAction;
|
|
178
|
+
if (primary) await this.run(primary);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** An action's name: the caller's, or the catalog's for an action `catalogAction()` made. */
|
|
182
|
+
private actionName(actionArg: IActionFooterAction): string {
|
|
183
|
+
const word = catalogWords.get(actionArg);
|
|
184
|
+
return word ? this.t(word) : actionArg.name;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
private async run(actionArg: IActionFooterAction): Promise<void> {
|
|
188
|
+
if (this.pendingAction || this.disabled || actionArg.disabled) return;
|
|
189
|
+
this.pendingAction = actionArg;
|
|
190
|
+
try {
|
|
191
|
+
await runAction(this, { action: actionArg, source: this.source, ownerElement: this }, () => actionArg.action(this.context ?? this));
|
|
192
|
+
} finally {
|
|
193
|
+
this.pendingAction = null;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dees-actionfooter.js';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { css, html, type CSSResult, type TemplateResult } from '@design.estate/dees-element';
|
|
2
2
|
import type { TDcLocalizer } from '../../../i18n/messages.js';
|
|
3
|
+
import type { IActionFooterAction } from '../../00group-button/dees-actionfooter/dees-actionfooter.js';
|
|
3
4
|
import type { DeesTable } from './dees-table.js';
|
|
4
5
|
import type { Column, TTableSearchMode } from './types.js';
|
|
5
6
|
import '../../00group-input/dees-input-dropdown/dees-input-dropdown.js';
|
|
@@ -8,7 +9,6 @@ import '../../00group-input/dees-input-datepicker/index.js';
|
|
|
8
9
|
import '../../00group-input/dees-input-text/dees-input-text.js';
|
|
9
10
|
import '../../00group-input/dees-input-toggle/dees-input-toggle.js';
|
|
10
11
|
import '../../00group-input/dees-input-radiogroup/dees-input-radiogroup.js';
|
|
11
|
-
import '../../00group-button/dees-button/dees-button.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* The value of a view's filter: an option's `key` (`'select'`), on or off (`'toggle'`), a day as
|
|
@@ -116,11 +116,6 @@ export const tableFilterPanelStyles: CSSResult = css`
|
|
|
116
116
|
padding-top: 14px;
|
|
117
117
|
border-top: var(--dees-line-width-hairline) solid var(--dees-color-border-subtle);
|
|
118
118
|
}
|
|
119
|
-
|
|
120
|
-
.filterPanelFooter {
|
|
121
|
-
display: flex;
|
|
122
|
-
justify-content: flex-end;
|
|
123
|
-
}
|
|
124
119
|
`;
|
|
125
120
|
|
|
126
121
|
/** Renders one filter as its field; a choice applies as it is made. */
|
|
@@ -156,8 +151,8 @@ const renderFilterField = (tableArg: DeesTable<any>, filterArg: ITableFilter): T
|
|
|
156
151
|
|
|
157
152
|
/**
|
|
158
153
|
* The filter bubble's content for a table: its filters, "Filter by column" for its column filter
|
|
159
|
-
* row, where its search looks ("Search in", the scope its search field's menu chose before)
|
|
160
|
-
* "Clear filters".
|
|
154
|
+
* row, and where its search looks ("Search in", the scope its search field's menu chose before).
|
|
155
|
+
* "Clear filters" is the bubble's action (`tableFilterActions`).
|
|
161
156
|
*/
|
|
162
157
|
export const renderTableFilterPanel = (tableArg: DeesTable<any>, t: TDcLocalizer): TemplateResult => {
|
|
163
158
|
const filterable = tableArg.hasFilterableColumns;
|
|
@@ -181,11 +176,16 @@ export const renderTableFilterPanel = (tableArg: DeesTable<any>, t: TDcLocalizer
|
|
|
181
176
|
}}
|
|
182
177
|
></dees-input-radiogroup>
|
|
183
178
|
</div>
|
|
184
|
-
<div class="filterPanelFooter">
|
|
185
|
-
<dees-button class="clearFilters" type="outline" size="sm" .text=${t('table.clearFilters')}
|
|
186
|
-
.disabled=${!tableArg.activeFilters.length}
|
|
187
|
-
@clicked=${() => tableArg.clearFilters()}
|
|
188
|
-
></dees-button>
|
|
189
|
-
</div>
|
|
190
179
|
</div>`;
|
|
191
180
|
};
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* The filter bubble's action: "Clear filters", in its action footer. It is no step forward, so it
|
|
184
|
+
* is not drawn as a primary; while nothing is filtered it is unavailable.
|
|
185
|
+
*/
|
|
186
|
+
export const tableFilterActions = (tableArg: DeesTable<any>, t: TDcLocalizer): IActionFooterAction[] => [{
|
|
187
|
+
name: t('table.clearFilters'),
|
|
188
|
+
primary: false,
|
|
189
|
+
disabled: !tableArg.activeFilters.length,
|
|
190
|
+
action: async () => tableArg.clearFilters(),
|
|
191
|
+
}];
|
|
@@ -6,7 +6,7 @@ import type { DeesPopover, IDeesPopoverCloseDetail } from '../../00group-overlay
|
|
|
6
6
|
import '../../00group-overlay/dees-popover/dees-popover.js';
|
|
7
7
|
import type { DeesTable } from './dees-table.js';
|
|
8
8
|
import { dataNameForms } from './data.js';
|
|
9
|
-
import { renderTableFilterPanel } from './filters.js';
|
|
9
|
+
import { renderTableFilterPanel, tableFilterActions } from './filters.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* A table's search field: the query input and, at its end, the table's filter button. The table
|
|
@@ -59,6 +59,7 @@ export class TableSearchField implements TReactiveController {
|
|
|
59
59
|
</div>${table
|
|
60
60
|
? html`<dees-popover class="filterBubble" .label=${this.t('table.filters')} .open=${this.filtersOpen}
|
|
61
61
|
.dismissOnTab=${false} width="min(320px, calc(100vw - 16px))" maxHeight="min(70vh, 560px)"
|
|
62
|
+
.actions=${tableFilterActions(table, this.t)}
|
|
62
63
|
@dees-popover-close=${this.handleClose}
|
|
63
64
|
>${renderTableFilterPanel(table, this.t)}</dees-popover>`
|
|
64
65
|
: ''}`;
|