@prismora/elements 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +21 -2
- package/components.json +15600 -0
- package/custom-elements.json +56320 -0
- package/dist/base.d.ts +42 -0
- package/dist/base.js +62 -0
- package/dist/catalog.d.ts +33 -0
- package/dist/catalog.js +803 -0
- package/dist/components/accordion.d.ts +31 -0
- package/dist/components/accordion.js +63 -0
- package/dist/components/alert.d.ts +27 -0
- package/dist/components/alert.js +40 -0
- package/dist/components/avatar-group.d.ts +23 -0
- package/dist/components/avatar-group.js +43 -0
- package/dist/components/avatar.d.ts +24 -0
- package/dist/components/avatar.js +43 -0
- package/dist/components/back-to-top.d.ts +32 -0
- package/dist/components/back-to-top.js +50 -0
- package/dist/components/badge.d.ts +17 -0
- package/dist/components/badge.js +20 -0
- package/dist/components/banner.d.ts +34 -0
- package/dist/components/banner.js +54 -0
- package/dist/components/breadcrumb.d.ts +42 -0
- package/dist/components/breadcrumb.js +63 -0
- package/dist/components/button-group.d.ts +14 -0
- package/dist/components/button-group.js +28 -0
- package/dist/components/button.d.ts +59 -0
- package/dist/components/button.js +162 -0
- package/dist/components/calendar.d.ts +48 -0
- package/dist/components/calendar.js +296 -0
- package/dist/components/card.d.ts +23 -0
- package/dist/components/card.js +44 -0
- package/dist/components/carousel.d.ts +41 -0
- package/dist/components/carousel.js +156 -0
- package/dist/components/cascader.d.ts +70 -0
- package/dist/components/cascader.js +220 -0
- package/dist/components/chart.d.ts +59 -0
- package/dist/components/chart.js +267 -0
- package/dist/components/chat.d.ts +98 -0
- package/dist/components/chat.js +134 -0
- package/dist/components/checkbox-group.d.ts +48 -0
- package/dist/components/checkbox-group.js +111 -0
- package/dist/components/checkbox.d.ts +23 -0
- package/dist/components/checkbox.js +70 -0
- package/dist/components/code-block.d.ts +46 -0
- package/dist/components/code-block.js +86 -0
- package/dist/components/color-picker.d.ts +46 -0
- package/dist/components/color-picker.js +292 -0
- package/dist/components/combobox.d.ts +89 -0
- package/dist/components/combobox.js +384 -0
- package/dist/components/command.d.ts +96 -0
- package/dist/components/command.js +289 -0
- package/dist/components/context-menu.d.ts +23 -0
- package/dist/components/context-menu.js +110 -0
- package/dist/components/copy-button.d.ts +33 -0
- package/dist/components/copy-button.js +62 -0
- package/dist/components/countdown.d.ts +36 -0
- package/dist/components/countdown.js +56 -0
- package/dist/components/data-table.d.ts +180 -0
- package/dist/components/data-table.js +1060 -0
- package/dist/components/date-picker.d.ts +47 -0
- package/dist/components/date-picker.js +267 -0
- package/dist/components/description-list.d.ts +38 -0
- package/dist/components/description-list.js +41 -0
- package/dist/components/dialog.d.ts +47 -0
- package/dist/components/dialog.js +189 -0
- package/dist/components/divider.d.ts +16 -0
- package/dist/components/divider.js +23 -0
- package/dist/components/drawer.d.ts +19 -0
- package/dist/components/drawer.js +27 -0
- package/dist/components/editor.d.ts +50 -0
- package/dist/components/editor.js +474 -0
- package/dist/components/empty-state.d.ts +24 -0
- package/dist/components/empty-state.js +27 -0
- package/dist/components/file-upload.d.ts +56 -0
- package/dist/components/file-upload.js +176 -0
- package/dist/components/form-control.d.ts +69 -0
- package/dist/components/form-control.js +134 -0
- package/dist/components/form.d.ts +38 -0
- package/dist/components/form.js +161 -0
- package/dist/components/format-number.d.ts +37 -0
- package/dist/components/format-number.js +86 -0
- package/dist/components/icon.d.ts +34 -0
- package/dist/components/icon.js +47 -0
- package/dist/components/image.d.ts +44 -0
- package/dist/components/image.js +53 -0
- package/dist/components/indicator.d.ts +41 -0
- package/dist/components/indicator.js +65 -0
- package/dist/components/inline-edit.d.ts +45 -0
- package/dist/components/inline-edit.js +129 -0
- package/dist/components/input.d.ts +55 -0
- package/dist/components/input.js +186 -0
- package/dist/components/kbd.d.ts +15 -0
- package/dist/components/kbd.js +18 -0
- package/dist/components/list.d.ts +68 -0
- package/dist/components/list.js +180 -0
- package/dist/components/menu.d.ts +22 -0
- package/dist/components/menu.js +182 -0
- package/dist/components/menubar.d.ts +20 -0
- package/dist/components/menubar.js +120 -0
- package/dist/components/meter.d.ts +38 -0
- package/dist/components/meter.js +48 -0
- package/dist/components/nav.d.ts +91 -0
- package/dist/components/nav.js +228 -0
- package/dist/components/number-input.d.ts +26 -0
- package/dist/components/number-input.js +70 -0
- package/dist/components/pagination.d.ts +44 -0
- package/dist/components/pagination.js +94 -0
- package/dist/components/pin-input.d.ts +25 -0
- package/dist/components/pin-input.js +128 -0
- package/dist/components/popover.d.ts +23 -0
- package/dist/components/popover.js +140 -0
- package/dist/components/progress.d.ts +26 -0
- package/dist/components/progress.js +66 -0
- package/dist/components/pull-refresh.d.ts +41 -0
- package/dist/components/pull-refresh.js +101 -0
- package/dist/components/qr-code.d.ts +33 -0
- package/dist/components/qr-code.js +54 -0
- package/dist/components/radio-group.d.ts +37 -0
- package/dist/components/radio-group.js +82 -0
- package/dist/components/range-slider.d.ts +46 -0
- package/dist/components/range-slider.js +95 -0
- package/dist/components/rating.d.ts +38 -0
- package/dist/components/rating.js +80 -0
- package/dist/components/relative-time.d.ts +31 -0
- package/dist/components/relative-time.js +51 -0
- package/dist/components/scheduler.d.ts +84 -0
- package/dist/components/scheduler.js +187 -0
- package/dist/components/segmented.d.ts +58 -0
- package/dist/components/segmented.js +129 -0
- package/dist/components/select.d.ts +62 -0
- package/dist/components/select.js +140 -0
- package/dist/components/share-button.d.ts +37 -0
- package/dist/components/share-button.js +60 -0
- package/dist/components/signature.d.ts +54 -0
- package/dist/components/signature.js +152 -0
- package/dist/components/skeleton.d.ts +21 -0
- package/dist/components/skeleton.js +26 -0
- package/dist/components/slider.d.ts +31 -0
- package/dist/components/slider.js +80 -0
- package/dist/components/sortable.d.ts +22 -0
- package/dist/components/sortable.js +196 -0
- package/dist/components/sparkline.d.ts +28 -0
- package/dist/components/sparkline.js +46 -0
- package/dist/components/spinner.d.ts +16 -0
- package/dist/components/spinner.js +22 -0
- package/dist/components/splitter.d.ts +28 -0
- package/dist/components/splitter.js +89 -0
- package/dist/components/stat.d.ts +28 -0
- package/dist/components/stat.js +33 -0
- package/dist/components/steps.d.ts +53 -0
- package/dist/components/steps.js +91 -0
- package/dist/components/switch.d.ts +12 -0
- package/dist/components/switch.js +18 -0
- package/dist/components/table.d.ts +58 -0
- package/dist/components/table.js +96 -0
- package/dist/components/tabs.d.ts +62 -0
- package/dist/components/tabs.js +310 -0
- package/dist/components/tag.d.ts +32 -0
- package/dist/components/tag.js +58 -0
- package/dist/components/textarea.d.ts +25 -0
- package/dist/components/textarea.js +56 -0
- package/dist/components/theme-switch.d.ts +51 -0
- package/dist/components/theme-switch.js +85 -0
- package/dist/components/time-picker.d.ts +39 -0
- package/dist/components/time-picker.js +257 -0
- package/dist/components/timeline.d.ts +38 -0
- package/dist/components/timeline.js +56 -0
- package/dist/components/toaster.d.ts +25 -0
- package/dist/components/toaster.js +44 -0
- package/dist/components/toggle-group.d.ts +70 -0
- package/dist/components/toggle-group.js +172 -0
- package/dist/components/toolbar.d.ts +23 -0
- package/dist/components/toolbar.js +81 -0
- package/dist/components/tooltip.d.ts +18 -0
- package/dist/components/tooltip.js +92 -0
- package/dist/components/tour.d.ts +41 -0
- package/dist/components/tour.js +197 -0
- package/dist/components/transfer.d.ts +57 -0
- package/dist/components/transfer.js +161 -0
- package/dist/components/tree-select.d.ts +66 -0
- package/dist/components/tree-select.js +282 -0
- package/dist/components/tree.d.ts +129 -0
- package/dist/components/tree.js +427 -0
- package/dist/components/virtual-list.d.ts +41 -0
- package/dist/components/virtual-list.js +77 -0
- package/dist/confirm.d.ts +21 -0
- package/dist/confirm.js +69 -0
- package/dist/count.d.ts +5 -0
- package/dist/count.js +12 -0
- package/dist/data-table/icons.d.ts +8 -0
- package/dist/data-table/icons.js +10 -0
- package/dist/data-table/logic.d.ts +33 -0
- package/dist/data-table/logic.js +141 -0
- package/dist/data-table/strings.d.ts +37 -0
- package/dist/data-table/strings.js +36 -0
- package/dist/data-table/types.d.ts +76 -0
- package/dist/data-table/types.js +1 -0
- package/dist/define.d.ts +2 -0
- package/dist/define.js +2 -0
- package/dist/field-validity.d.ts +42 -0
- package/dist/field-validity.js +58 -0
- package/dist/floating.d.ts +13 -0
- package/dist/floating.js +65 -0
- package/dist/highlight.d.ts +11 -0
- package/dist/highlight.js +103 -0
- package/dist/id.d.ts +2 -0
- package/dist/id.js +3 -0
- package/dist/index.d.ts +102 -0
- package/dist/index.js +102 -0
- package/dist/manifest.d.ts +51 -0
- package/dist/manifest.js +11 -0
- package/dist/named-icon.d.ts +8 -0
- package/dist/named-icon.js +8 -0
- package/dist/patterns/account.d.ts +6 -0
- package/dist/patterns/account.js +137 -0
- package/dist/patterns/app.d.ts +7 -0
- package/dist/patterns/app.js +351 -0
- package/dist/patterns/commerce.d.ts +4 -0
- package/dist/patterns/commerce.js +200 -0
- package/dist/patterns/flows.d.ts +3 -0
- package/dist/patterns/flows.js +100 -0
- package/dist/patterns/index.d.ts +9 -0
- package/dist/patterns/index.js +29 -0
- package/dist/patterns/marketing.d.ts +4 -0
- package/dist/patterns/marketing.js +173 -0
- package/dist/patterns/more.d.ts +15 -0
- package/dist/patterns/more.js +581 -0
- package/dist/patterns/shell.d.ts +9 -0
- package/dist/patterns/shell.js +48 -0
- package/dist/patterns/types.d.ts +19 -0
- package/dist/patterns/types.js +1 -0
- package/dist/position.d.ts +2 -0
- package/dist/position.js +33 -0
- package/dist/prismora.standalone.js +5222 -0
- package/dist/prismora.standalone.js.map +199 -0
- package/dist/qr.d.ts +14 -0
- package/dist/qr.js +258 -0
- package/dist/register.d.ts +8 -0
- package/dist/register.js +21 -0
- package/dist/registry.d.ts +203 -0
- package/dist/registry.js +203 -0
- package/dist/remote.d.ts +58 -0
- package/dist/remote.js +130 -0
- package/dist/sheet.d.ts +34 -0
- package/dist/sheet.js +153 -0
- package/dist/styles/accordion.d.ts +2 -0
- package/dist/styles/accordion.js +3 -0
- package/dist/styles/alert.d.ts +2 -0
- package/dist/styles/alert.js +3 -0
- package/dist/styles/avatar.d.ts +2 -0
- package/dist/styles/avatar.js +3 -0
- package/dist/styles/badge.d.ts +2 -0
- package/dist/styles/badge.js +3 -0
- package/dist/styles/banner.d.ts +2 -0
- package/dist/styles/banner.js +3 -0
- package/dist/styles/breadcrumb.d.ts +2 -0
- package/dist/styles/breadcrumb.js +3 -0
- package/dist/styles/button.d.ts +2 -0
- package/dist/styles/button.js +3 -0
- package/dist/styles/calendar.d.ts +2 -0
- package/dist/styles/calendar.js +3 -0
- package/dist/styles/card.d.ts +2 -0
- package/dist/styles/card.js +3 -0
- package/dist/styles/carousel.d.ts +2 -0
- package/dist/styles/carousel.js +3 -0
- package/dist/styles/chart.d.ts +2 -0
- package/dist/styles/chart.js +3 -0
- package/dist/styles/chat.d.ts +2 -0
- package/dist/styles/chat.js +3 -0
- package/dist/styles/checkbox.d.ts +2 -0
- package/dist/styles/checkbox.js +3 -0
- package/dist/styles/color-picker.d.ts +2 -0
- package/dist/styles/color-picker.js +3 -0
- package/dist/styles/combobox.d.ts +2 -0
- package/dist/styles/combobox.js +3 -0
- package/dist/styles/command.d.ts +2 -0
- package/dist/styles/command.js +3 -0
- package/dist/styles/data-table.d.ts +2 -0
- package/dist/styles/data-table.js +3 -0
- package/dist/styles/description-list.d.ts +2 -0
- package/dist/styles/description-list.js +3 -0
- package/dist/styles/dialog.d.ts +2 -0
- package/dist/styles/dialog.js +3 -0
- package/dist/styles/drawer.d.ts +2 -0
- package/dist/styles/drawer.js +3 -0
- package/dist/styles/editor.d.ts +2 -0
- package/dist/styles/editor.js +3 -0
- package/dist/styles/empty-state.d.ts +2 -0
- package/dist/styles/empty-state.js +3 -0
- package/dist/styles/extras.d.ts +2 -0
- package/dist/styles/extras.js +3 -0
- package/dist/styles/field.d.ts +2 -0
- package/dist/styles/field.js +3 -0
- package/dist/styles/file-upload.d.ts +2 -0
- package/dist/styles/file-upload.js +3 -0
- package/dist/styles/foundation.d.ts +2 -0
- package/dist/styles/foundation.js +3 -0
- package/dist/styles/helpers.d.ts +2 -0
- package/dist/styles/helpers.js +3 -0
- package/dist/styles/icon.d.ts +2 -0
- package/dist/styles/icon.js +3 -0
- package/dist/styles/image.d.ts +2 -0
- package/dist/styles/image.js +3 -0
- package/dist/styles/indicator.d.ts +2 -0
- package/dist/styles/indicator.js +3 -0
- package/dist/styles/input.d.ts +2 -0
- package/dist/styles/input.js +3 -0
- package/dist/styles/kbd.d.ts +2 -0
- package/dist/styles/kbd.js +3 -0
- package/dist/styles/list.d.ts +2 -0
- package/dist/styles/list.js +3 -0
- package/dist/styles/listbox.d.ts +2 -0
- package/dist/styles/listbox.js +3 -0
- package/dist/styles/meter.d.ts +2 -0
- package/dist/styles/meter.js +3 -0
- package/dist/styles/nav.d.ts +2 -0
- package/dist/styles/nav.js +3 -0
- package/dist/styles/number-input.d.ts +2 -0
- package/dist/styles/number-input.js +3 -0
- package/dist/styles/overlay.d.ts +2 -0
- package/dist/styles/overlay.js +3 -0
- package/dist/styles/pagination.d.ts +2 -0
- package/dist/styles/pagination.js +3 -0
- package/dist/styles/pickers.d.ts +2 -0
- package/dist/styles/pickers.js +3 -0
- package/dist/styles/pin-input.d.ts +2 -0
- package/dist/styles/pin-input.js +3 -0
- package/dist/styles/popover.d.ts +2 -0
- package/dist/styles/popover.js +3 -0
- package/dist/styles/progress.d.ts +2 -0
- package/dist/styles/progress.js +3 -0
- package/dist/styles/pull-refresh.d.ts +2 -0
- package/dist/styles/pull-refresh.js +3 -0
- package/dist/styles/range-slider.d.ts +2 -0
- package/dist/styles/range-slider.js +3 -0
- package/dist/styles/rating.d.ts +2 -0
- package/dist/styles/rating.js +3 -0
- package/dist/styles/scheduler.d.ts +2 -0
- package/dist/styles/scheduler.js +3 -0
- package/dist/styles/segmented.d.ts +2 -0
- package/dist/styles/segmented.js +3 -0
- package/dist/styles/select.d.ts +2 -0
- package/dist/styles/select.js +3 -0
- package/dist/styles/separator.d.ts +2 -0
- package/dist/styles/separator.js +3 -0
- package/dist/styles/sheet.d.ts +2 -0
- package/dist/styles/sheet.js +3 -0
- package/dist/styles/skeleton.d.ts +2 -0
- package/dist/styles/skeleton.js +3 -0
- package/dist/styles/slider.d.ts +2 -0
- package/dist/styles/slider.js +3 -0
- package/dist/styles/sortable.d.ts +2 -0
- package/dist/styles/sortable.js +3 -0
- package/dist/styles/spinner.d.ts +2 -0
- package/dist/styles/spinner.js +3 -0
- package/dist/styles/splitter.d.ts +2 -0
- package/dist/styles/splitter.js +3 -0
- package/dist/styles/stat.d.ts +2 -0
- package/dist/styles/stat.js +3 -0
- package/dist/styles/steps.d.ts +2 -0
- package/dist/styles/steps.js +3 -0
- package/dist/styles/surface.d.ts +2 -0
- package/dist/styles/surface.js +3 -0
- package/dist/styles/switch.d.ts +2 -0
- package/dist/styles/switch.js +3 -0
- package/dist/styles/table.d.ts +2 -0
- package/dist/styles/table.js +3 -0
- package/dist/styles/tabs.d.ts +2 -0
- package/dist/styles/tabs.js +3 -0
- package/dist/styles/tag.d.ts +2 -0
- package/dist/styles/tag.js +3 -0
- package/dist/styles/time-picker.d.ts +2 -0
- package/dist/styles/time-picker.js +3 -0
- package/dist/styles/timeline.d.ts +2 -0
- package/dist/styles/timeline.js +3 -0
- package/dist/styles/toast.d.ts +2 -0
- package/dist/styles/toast.js +3 -0
- package/dist/styles/toggle.d.ts +2 -0
- package/dist/styles/toggle.js +3 -0
- package/dist/styles/toolbar.d.ts +2 -0
- package/dist/styles/toolbar.js +3 -0
- package/dist/styles/tooltip.d.ts +2 -0
- package/dist/styles/tooltip.js +3 -0
- package/dist/styles/tree.d.ts +2 -0
- package/dist/styles/tree.js +3 -0
- package/dist/table-core.d.ts +75 -0
- package/dist/table-core.js +205 -0
- package/dist/toast.d.ts +42 -0
- package/dist/toast.js +206 -0
- package/dist/top-layer.d.ts +4 -0
- package/dist/top-layer.js +33 -0
- package/package.json +101 -4
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { type PropertyDeclarations, type PropertyValues, type TemplateResult } from 'lit';
|
|
2
|
+
import { PmElement } from '../base.js';
|
|
3
|
+
import { type Row, type SortState } from '../table-core.js';
|
|
4
|
+
import { type Loader } from '../remote.js';
|
|
5
|
+
import { DATA_TABLE_STRINGS, type DataTableStrings } from '../data-table/strings.js';
|
|
6
|
+
import type { DataTableColumn, DataTableQuery, DataTableResult, DataTableState } from '../data-table/types.js';
|
|
7
|
+
import './pagination.js';
|
|
8
|
+
export type { Row, SortState, SortDirection } from '../table-core.js';
|
|
9
|
+
export type { DataTableColumn, DataTableQuery, DataTableResult, DataTableState, DataTableStrings };
|
|
10
|
+
/** Server loader: `async (query, { signal }) => rows | { rows, total }` (or any shape, with `rows-path` / `total-path`). */
|
|
11
|
+
export type DataTableLoader = Loader<DataTableQuery, unknown>;
|
|
12
|
+
export { DATA_TABLE_STRINGS };
|
|
13
|
+
/**
|
|
14
|
+
* Advanced data table for business apps: search, filters, sorting, frozen columns, selection, grouping, editing
|
|
15
|
+
* and export.
|
|
16
|
+
*
|
|
17
|
+
* Everything is optional and driven by column definitions:
|
|
18
|
+
* - **Find**: global search box (`searchable`), per-column filters (text, select, number ranges), multi-column sort
|
|
19
|
+
* (Shift+click adds a sort level).
|
|
20
|
+
* - **Columns**: freeze (`pin: 'start' | 'end'`), resize (drag or keyboard), reorder (drag headers or the column
|
|
21
|
+
* menu), show/hide (`column-picker`), header groups (`group`), and a per-column actions menu.
|
|
22
|
+
* - **Rows**: single or multi selection (Shift+click for ranges, "select all N" across pages), pinned rows that stay
|
|
23
|
+
* on top (`pinned-rows`), expandable detail rows (`expandable` + `renderDetail`), grouping with counts
|
|
24
|
+
* (`group-by`), merged cells (`merge` → rowspan, `colSpan` → colspan), inline editing.
|
|
25
|
+
* - **Data**: client-side paging or `manual` for server-side (events carry the full query), footer aggregates
|
|
26
|
+
* (sum/avg/min/max/count), Intl formatting by `type`, CSV export (`exportable` / `toCsv()`), infinite loading
|
|
27
|
+
* (`pm-end-reached`), saved views (`state`, `persist`).
|
|
28
|
+
* - **Use**: spreadsheet-style keyboard grid (arrows, Home/End, PageUp/Down, Enter/F2 to edit, Space to select),
|
|
29
|
+
* sticky header and footer, loading bar, labelled cards in narrow containers, every UI string replaceable.
|
|
30
|
+
* - **Content**: per column `render(row)` (text, DOM node or Lit template), light-DOM `<template data-cell="key">`
|
|
31
|
+
* with escaped `{{field}}` placeholders, `format(value, row)`, or Intl formatting by `type` (number, currency,
|
|
32
|
+
* percent, bytes, date, datetime, time, boolean) with `formatOptions` and `prefix`/`suffix`. Headers the same way:
|
|
33
|
+
* `renderHeader(col)` or `<template data-header="key">`; `label` stays the accessible and CSV name.
|
|
34
|
+
*
|
|
35
|
+
* Server-side data: set `src` to a URL (`src="/api/orders"`; the query goes in as `q`, `page`, `pageSize`, `sort`,
|
|
36
|
+
* `order`, `sorts` and `filter[key]` parameters, or as `{placeholders}` in the URL) and say where the rows and the
|
|
37
|
+
* total are in the JSON (`rows-path="data"`, `total-path="meta.total"`), or set the `loader` property to your own
|
|
38
|
+
* `async (query, { signal }) => ({ rows, total })`. `mapRow` formats each server row. Searching, sorting, filtering
|
|
39
|
+
* and paging then reload from the server (search debounced by `debounce`), superseded requests are cancelled, and
|
|
40
|
+
* loading and error (with Retry) states show. `reload()` fetches the current page again.
|
|
41
|
+
*
|
|
42
|
+
* Columns and rows can be properties or JSON attributes (`columns='[{"key":"name","label":"Name","sortable":true}]'`).
|
|
43
|
+
* For a light table without these features use `<pm-table>`.
|
|
44
|
+
* @tag pm-data-table
|
|
45
|
+
* @slot empty - Content when there are no rows.
|
|
46
|
+
* @slot toolbar - Extra content in the toolbar (filters, bulk actions).
|
|
47
|
+
* @fires pm-sort - detail: { key, direction, sorts }
|
|
48
|
+
* @fires pm-filter - Search or column filters changed. detail: { filter, filters }
|
|
49
|
+
* @fires pm-selection-change - detail: { keys, rows }
|
|
50
|
+
* @fires pm-page - detail: { page, pageSize }
|
|
51
|
+
* @fires pm-row-click - detail: { row, key }
|
|
52
|
+
* @fires pm-expand - detail: { row, key, expanded }
|
|
53
|
+
* @fires pm-cell-edit - Cancelable (call preventDefault to reject). detail: { row, key, value, previous }
|
|
54
|
+
* @fires pm-state-change - Column layout, sort or filters changed. detail: DataTableState
|
|
55
|
+
* @fires pm-load - Server rows arrived. detail: { query, rows, total }
|
|
56
|
+
* @fires pm-load-error - A server request failed. detail: { query, error }
|
|
57
|
+
* @fires pm-end-reached - Scrolled near the bottom (load more rows). detail: { rows }
|
|
58
|
+
* @example <pm-data-table label="Invoices" page-size="10" selectable searchable column-picker exportable></pm-data-table>
|
|
59
|
+
*/
|
|
60
|
+
export declare class PmDataTable<R extends Row = Row> extends PmElement {
|
|
61
|
+
#private;
|
|
62
|
+
static componentName: string;
|
|
63
|
+
static styles: import("lit").CSSResult[];
|
|
64
|
+
static properties: PropertyDeclarations;
|
|
65
|
+
/** Column definitions: key, label, type, sorting, filters, pinning, grouping, merging, editing and rendering. */
|
|
66
|
+
columns: DataTableColumn<R>[];
|
|
67
|
+
/** Row objects (or a JSON string). In `manual` mode, the current page from your server. */
|
|
68
|
+
rows: R[];
|
|
69
|
+
/** Accessible name (caption). */
|
|
70
|
+
label?: string;
|
|
71
|
+
/** Field that identifies a row (default "id", else its position). */
|
|
72
|
+
rowKey: string;
|
|
73
|
+
/** Show row checkboxes (see `selection` for single or multiple). */
|
|
74
|
+
selectable: boolean;
|
|
75
|
+
/** `multiple` (default, checkboxes) or `single` (radio buttons). */
|
|
76
|
+
selection?: 'single' | 'multiple';
|
|
77
|
+
/** Selected row keys. */
|
|
78
|
+
selected: Set<string>;
|
|
79
|
+
/** Sort levels, first wins. */
|
|
80
|
+
sorts: SortState[];
|
|
81
|
+
/** Global search text (matches any visible column, raw or formatted). */
|
|
82
|
+
filter?: string;
|
|
83
|
+
/** Column filters by key. */
|
|
84
|
+
filters: Record<string, string>;
|
|
85
|
+
/** Rows per page (0 = no paging). */
|
|
86
|
+
pageSize: number;
|
|
87
|
+
/** Current page, starting at 1. */
|
|
88
|
+
page: number;
|
|
89
|
+
/** Total rows on the server (with `manual`). */
|
|
90
|
+
total?: number;
|
|
91
|
+
/** Rows are already sorted, filtered and paged by the server: render them and emit events with the query. */
|
|
92
|
+
manual: boolean;
|
|
93
|
+
loading: boolean;
|
|
94
|
+
striped: boolean;
|
|
95
|
+
/** Narrow containers (< 36rem): `auto` shows rows as labelled cards; `never` keeps a horizontally scrolling table. */
|
|
96
|
+
stack?: 'auto' | 'never';
|
|
97
|
+
emptyText?: string;
|
|
98
|
+
/** Emit pm-row-click and show a pointer on rows. */
|
|
99
|
+
rowClickable: boolean;
|
|
100
|
+
/** Show a search box in the toolbar. */
|
|
101
|
+
searchable: boolean;
|
|
102
|
+
/** Show a Columns menu to show, hide and reset columns. */
|
|
103
|
+
columnPicker: boolean;
|
|
104
|
+
/** Show an Export CSV button. */
|
|
105
|
+
exportable: boolean;
|
|
106
|
+
/** Per-column actions menu in each header (default on; `column-menu="false"` to hide). */
|
|
107
|
+
columnMenu: boolean;
|
|
108
|
+
/** Group rows by this column key (collapsible group headers with counts). */
|
|
109
|
+
groupBy?: string;
|
|
110
|
+
/** Add a toggle that shows `renderDetail(row)` under the row. */
|
|
111
|
+
expandable: boolean;
|
|
112
|
+
renderDetail?: (row: R) => unknown;
|
|
113
|
+
/** Row keys pinned to the top (always visible, stay under the header while scrolling). */
|
|
114
|
+
pinnedRows: string[];
|
|
115
|
+
/** BCP 47 locale for number/date formatting. */
|
|
116
|
+
locale?: string;
|
|
117
|
+
/** Scroll inside the table past this height, e.g. "28rem" (sticky header and footer). */
|
|
118
|
+
maxHeight?: string;
|
|
119
|
+
/** Save the user's view (columns, sort, filters) in localStorage under this key. */
|
|
120
|
+
persist?: string;
|
|
121
|
+
/** Override UI text (see DATA_TABLE_STRINGS). */
|
|
122
|
+
strings: Partial<DataTableStrings>;
|
|
123
|
+
/** Rows-per-page choices shown in the footer, e.g. [10, 25, 50]. */
|
|
124
|
+
pageSizes?: number[];
|
|
125
|
+
/** Server URL for rows; the query is added as parameters (or fills `{placeholders}`). Response: JSON. Implies `manual`. */
|
|
126
|
+
src?: string;
|
|
127
|
+
/** Your own server loader (takes precedence over `src`). Implies `manual`. */
|
|
128
|
+
loader?: DataTableLoader;
|
|
129
|
+
/** Turn one server row into the row object the columns read. */
|
|
130
|
+
mapRow?: (item: unknown) => R;
|
|
131
|
+
/** Where the rows are in the response (dotted path; default: the response if it is an array, else `rows`, `data` or `items`). */
|
|
132
|
+
rowsPath?: string;
|
|
133
|
+
/** Where the total row count is in the response (dotted path; default `total`, then `count`). */
|
|
134
|
+
totalPath?: string;
|
|
135
|
+
/** Milliseconds to wait after typing in search or filters before asking the server. */
|
|
136
|
+
debounce: number;
|
|
137
|
+
/** The current server query (page, search, column filters, sorts). */
|
|
138
|
+
get query(): DataTableQuery;
|
|
139
|
+
/** Fetch the current page from the server again (with `src` / `loader`). */
|
|
140
|
+
reload(): void;
|
|
141
|
+
constructor();
|
|
142
|
+
/** First sort level (kept for single-sort code). */
|
|
143
|
+
get sort(): SortState | undefined;
|
|
144
|
+
set sort(v: SortState | undefined);
|
|
145
|
+
/** Visible columns in display order (start-pinned, then free, then end-pinned). */
|
|
146
|
+
get visibleColumns(): DataTableColumn<R>[];
|
|
147
|
+
/** Filtered and sorted rows (all pages; grouping order applied). */
|
|
148
|
+
get processedRows(): R[];
|
|
149
|
+
/** The user's current view; assign a saved one to restore it. */
|
|
150
|
+
get state(): DataTableState;
|
|
151
|
+
set state(s: Partial<DataTableState>);
|
|
152
|
+
/** Back to the column definitions (order, visibility, pins and widths). */
|
|
153
|
+
resetColumns(): void;
|
|
154
|
+
connectedCallback(): void;
|
|
155
|
+
disconnectedCallback(): void;
|
|
156
|
+
protected willUpdate(changed: PropertyValues<this>): void;
|
|
157
|
+
/** Select every row that matches the current search and filters (all pages). */
|
|
158
|
+
selectAllMatching(): void;
|
|
159
|
+
clearSelection(): void;
|
|
160
|
+
/** Move a column before (or after) another one. */
|
|
161
|
+
moveColumn(key: string, to: string, after?: boolean): void;
|
|
162
|
+
/** Freeze a column at an edge (`null` unpins). */
|
|
163
|
+
pinColumn(key: string, side: 'start' | 'end' | null): void;
|
|
164
|
+
/** Show or hide a column. */
|
|
165
|
+
setColumnVisible(key: string, visible: boolean): void;
|
|
166
|
+
/** Pin or unpin a row at the top. */
|
|
167
|
+
pinRow(key: string, pinned?: boolean): void;
|
|
168
|
+
/** Expand or collapse a row's detail. */
|
|
169
|
+
toggleRow(key: string, open?: boolean): void;
|
|
170
|
+
/** CSV of the visible columns for all filtered rows (or only selected ones). Formula-like text is neutralised. */
|
|
171
|
+
toCsv(opts?: {
|
|
172
|
+
selectedOnly?: boolean;
|
|
173
|
+
}): string;
|
|
174
|
+
/** Download `toCsv()` as a file. */
|
|
175
|
+
exportCsv(filename?: string, opts?: {
|
|
176
|
+
selectedOnly?: boolean;
|
|
177
|
+
}): void;
|
|
178
|
+
protected updated(changed: PropertyValues<this>): void;
|
|
179
|
+
render(): TemplateResult<1>;
|
|
180
|
+
}
|