@api-client/ui 0.1.1 → 0.1.3
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/build/src/bindings/base/IoThread.d.ts +2 -2
- package/build/src/bindings/base/IoThread.d.ts.map +1 -1
- package/build/src/bindings/base/IoThread.js +4 -4
- package/build/src/bindings/base/IoThread.js.map +1 -1
- package/build/src/bindings/base/PlatformBindings.js +2 -2
- package/build/src/bindings/base/PlatformBindings.js.map +1 -1
- package/build/src/core/Activity.d.ts +3 -3
- package/build/src/core/Activity.d.ts.map +1 -1
- package/build/src/core/Activity.js +8 -7
- package/build/src/core/Activity.js.map +1 -1
- package/build/src/core/ActivityManager.d.ts +9 -0
- package/build/src/core/ActivityManager.d.ts.map +1 -1
- package/build/src/core/ActivityManager.js +57 -12
- package/build/src/core/ActivityManager.js.map +1 -1
- package/build/src/core/Application.d.ts +1 -0
- package/build/src/core/Application.d.ts.map +1 -1
- package/build/src/core/Application.js +3 -0
- package/build/src/core/Application.js.map +1 -1
- package/build/src/core/Fragment.d.ts +9 -3
- package/build/src/core/Fragment.d.ts.map +1 -1
- package/build/src/core/Fragment.js +17 -8
- package/build/src/core/Fragment.js.map +1 -1
- package/build/src/core/FragmentManager.d.ts +17 -0
- package/build/src/core/FragmentManager.d.ts.map +1 -1
- package/build/src/core/FragmentManager.js +58 -2
- package/build/src/core/FragmentManager.js.map +1 -1
- package/build/src/core/renderer/Renderer.d.ts +4 -1
- package/build/src/core/renderer/Renderer.d.ts.map +1 -1
- package/build/src/core/renderer/Renderer.js +3 -0
- package/build/src/core/renderer/Renderer.js.map +1 -1
- package/build/src/elements/data-table/DataTable.d.ts +7 -0
- package/build/src/elements/data-table/DataTable.d.ts.map +1 -1
- package/build/src/elements/data-table/DataTable.js +8 -0
- package/build/src/elements/data-table/DataTable.js.map +1 -1
- package/package.json +1 -1
- package/src/bindings/base/IoThread.ts +7 -7
- package/src/bindings/base/PlatformBindings.ts +3 -3
- package/src/core/Activity.ts +8 -7
- package/src/core/ActivityManager.ts +58 -12
- package/src/core/Application.ts +4 -0
- package/src/core/Fragment.ts +18 -8
- package/src/core/FragmentManager.ts +61 -3
- package/src/core/renderer/Renderer.ts +4 -1
- package/src/elements/data-table/DataTable.ts +7 -0
- package/test/core/activity.spec.ts +235 -2
- package/test/core/activity_manager.spec.ts +544 -0
- package/test/core/application.spec.ts +218 -0
- package/test/core/fragment.spec.ts +472 -0
- package/test/core/fragment_manager.spec.ts +404 -0
- package/web-test-runner.config.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTable.js","sourceRoot":"","sources":["../../../../src/elements/data-table/DataTable.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAkC,MAAM,KAAK,CAAA;AAC/E,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AACtD,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AAGxD,OAAO,4BAA4B,CAAA;AACnC,OAAO,4BAA4B,CAAA;AACnC,OAAO,iCAAiC,CAAA;AACxC,OAAO,sCAAsC,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AA0ExD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiGG;IACmB,SAAS;sBAA2B,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAA9C,SAA4B,SAAQ,WAAU;;;iCAIjE,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qCAU1B,QAAQ,CAAC,EAAE,IAAI,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AC7B,IAAI,CAAC,aAAa,EAAE,CAAC;gBACnB,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;YAC5B,CAAC;YACD,IAAI,QAAyD,CAAA;YAC7D,IAAI,QAAQ,EAAE,CAAC;gBACb,QAAQ,GAAG,IAAI,CAAC,aAAa,KAAK,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,YAAY,CAAA;YACtE,CAAC;iBAAM,IAAI,UAAU,EAAE,CAAC;gBACtB,QAAQ,GAAG,MAAM,CAAA;YACnB,CAAC;YACD,OAAO,IAAI,CAAA;;;eAGA,QAAQ,CAAC,WAAW,CAAC;QAC5B,QAAQ,CAAC,IAAI,CAAC;mBACH,SAAS,CAAC,QAAQ,CAAC;mBACnB,SAAS,CAAC,IAAI,CAAC;;kBAEhB,GAAG;kBACH,SAAS,CAAC,KAAK,CAAC;uBACX,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;oBAC9C,SAAS,CAAC,SAAS,CAAC;;;gCAGR,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK;;UAElD,OAAO;UACP,UAAU,IAAI,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAA,kDAAkD,QAAQ,YAAY,CAAC,CAAC,CAAC,OAAO;;WAE5G,CAAA;QACT,CAAC;;;SA7xBmB,SAAS","sourcesContent":["/* eslint-disable max-len */\nimport { html, LitElement, nothing, PropertyValues, TemplateResult } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\nimport { ref, createRef } from 'lit/directives/ref.js'\nimport { dataAttr } from '../../directives/data-attr.js'\nimport { LiveData } from '../../reactive/LiveData.js'\n\nimport '@material/web/icon/icon.js'\nimport '@material/web/menu/menu.js'\nimport '@material/web/menu/menu-item.js'\nimport '@material/web/focus/md-focus-ring.js'\nimport { ifDefined } from 'lit/directives/if-defined.js'\n\n/**\n * Options for rendering a table cell.\n */\nexport interface CellRenderOptions {\n /**\n * CSS classes to apply to the cell.\n */\n classes?: string[]\n /**\n * Data attributes to add to the cell (e.g., `data-id=\"my-id\"`).\n */\n data?: Record<string, string | number | boolean>\n /**\n * The value of the aria-label to render on the cell.\n */\n ariaLabel?: string\n /**\n * Used with interactive elements within the cell.\n * The content of the cell should have exactly one element\n * with the `tabindex=-1`. The table will automatically\n * focus on that element when activated.\n */\n delegateFocus?: boolean\n /**\n * Used for accessibility. Should be set on the cell that represents\n * the name for the row, like, a person name or a file name.\n */\n isPrimary?: boolean\n}\n\n/**\n * Options for rendering a table header cell. Extends CellRenderOptions.\n */\nexport interface HeaderCellRenderOptions extends CellRenderOptions {\n /**\n * The name of the sort property.\n */\n sort?: string\n}\n\nexport interface CellPosition {\n /**\n * The index of the selected row\n */\n row: number\n /**\n * The index of the selected cell\n */\n col: number\n\n /**\n * Whether the logic should ignore setting up focus.\n * This is used when tracking cell selection when using a pointer device.\n */\n ignoreFocus?: boolean\n}\n\nexport interface EventCellInfo {\n /**\n * The cell element.\n */\n cell: HTMLElement\n /**\n * The column index\n */\n col: number\n /**\n * The **table** row index (not items)\n */\n row: number\n}\n\n/**\n * A versatile and accessible data table web component.\n *\n * The `DataTable` component provides a highly customizable and accessible way to display tabular data.\n * It offers features such as:\n *\n * - **Accessibility:** Built with ARIA roles and attributes for screen reader compatibility and keyboard navigation.\n * - **Customizable Cells:** Allows complete control over the content and rendering of each cell in the table.\n * - **Header Customization:** Provides flexibility in defining and rendering table headers, including sorting.\n * - **Selection:** Supports single, multiple, or no selection of rows.\n * - **Activation:** Enables the activation of rows (e.g., via double-click or Enter/Space key).\n * - **Infinite Scrolling:** Supports \"load more\" functionality (infinite scroll) using a sentinel element.\n * - **Sorting:** Allows sorting of data by clicking on sortable header cells.\n * - **Keyboard Navigation:** Full keyboard support for navigating through the table.\n * - **Empty State:** Customizable content to display when the table has no data.\n * - **Focus Management:** Properly manages focus for both keyboard and pointer interactions.\n *\n * @slot empty - Optional. Content to display when the table is empty (i.e., `items` is an empty array).\n * Defaults to a message saying \"No data to display.\"\n *\n * @fires select - Dispatched when the selection changes.\n * - `detail`: An object with a `selectedItems` property, containing an array of the currently selected items.\n * - Example: `{ selectedItems: [item1, item2] }`\n *\n * @fires activate - Dispatched when a row is activated (e.g., double-clicked or Enter/Space pressed).\n * - `detail`: The data item that was activated.\n * - Example: `item1`\n *\n * @fires scrollend - Dispatched when the user scrolls to the bottom of the table (when the `overflow` property is true).\n * - No event detail.\n *\n * @fires sort - Dispatched when the user clicks on a sortable header to change the sorting.\n * - `detail`: An object with `column` and `direction` properties.\n * - `column`: The name of the column being sorted.\n * - `direction`: The sort direction, either \"asc\" (ascending) or \"desc\" (descending).\n * - Example: `{ column: \"name\", direction: \"asc\" }`\n *\n * @csspart table - The underlying `<table>` element.\n * @csspart cell - Individual `<td>` and `<th>` elements.\n * @csspart header-cell - Individual `<th>` elements.\n *\n * @cssprop --md-focus-ring-shape-start-start - The start-start corner shape for the focus ring.\n * @cssprop --md-focus-ring-shape-start-end - The start-end corner shape for the focus ring.\n * @cssprop --md-focus-ring-shape-end-end - The end-end corner shape for the focus ring.\n * @cssprop --md-focus-ring-shape-end-start - The end-start corner shape for the focus ring.\n * @cssprop --md-sys-typescale-label-large-font - The font family for label large.\n * @cssprop --md-sys-typescale-label-large-size - The font size for label large.\n * @cssprop --md-sys-typescale-label-large-tracking - The letter spacing for label large.\n * @cssprop --md-sys-typescale-label-large-height - The line height for label large.\n * @cssprop --md-sys-typescale-label-large-weight - The font weight for label large.\n * @cssprop --md-sys-color-outline-variant - The outline variant color.\n * @cssprop --md-sys-color-secondary-container - The secondary container color.\n * @cssprop --md-icon-size - The size of the icons.\n * @cssprop --md-sys-typescale-title-small-font - The font family for title small.\n * @cssprop --md-sys-typescale-title-small-weight - The font weight for title small.\n * @cssprop --md-sys-typescale-title-small-size - The font size for title small.\n * @cssprop --md-sys-typescale-title-small-tracking - The letter spacing for title small.\n * @cssprop --md-sys-typescale-title-small-height - The line height for title small.\n * @cssprop --md-sys-typescale-body-medium-font - The font family for body medium.\n * @cssprop --md-sys-typescale-body-medium-weight - The font weight for body medium.\n * @cssprop --md-sys-typescale-body-medium-size - The font size for body medium.\n * @cssprop --md-sys-typescale-body-medium-tracking - The letter spacing for body medium.\n * @cssprop --md-sys-typescale-body-medium-height - The line height for body medium.\n *\n * @typeParam T The type of data items in the table.\n *\n * @example\n * ```html\n * <data-table\n * .items=\"${myItems}\"\n * selection=\"multi\"\n * @select=\"${handleSelect}\"\n * @activate=\"${handleActivate}\"\n * @scrollend=\"${handleScrollEnd}\"\n * @sort=\"${handleSort}\"\n * overflow\n * >\n * <p slot=\"empty\">No items to display at this time.</p>\n * </data-table>\n * ```\n *\n * @example\n * ```typescript\n * // Inside a subclass of DataTable.\n * // Rendering a name cell.\n * #nameCell(item: MyItem, row: number, col: number): TemplateResult {\n * return this.renderCell(item.name, row, col, { isPrimary: true });\n * }\n *\n * // Rendering a header cell.\n * override renderHeader(): TemplateResult[] {\n * return [\n * this.renderHeaderCell('Name', 0, { sort: 'name' }),\n * this.renderHeaderCell('Value', 1, { sort: 'value' }),\n * ];\n * }\n * ```\n */\nexport abstract class DataTable<T extends object> extends LitElement {\n /**\n * The data items to display in the table.\n */\n @property({ type: Object }) accessor items: LiveData<T[]> | undefined\n\n /**\n * The selection mode. Can be \"none\", \"single\", or \"multi\".\n * - `none`: No selection is allowed.\n * - `single`: Only one item can be selected at a time.\n * - `multi`: Multiple items can be selected.\n * @attribute\n * @default \"none\"\n */\n @property({ type: String, reflect: true }) accessor selection: 'none' | 'single' | 'multi' = 'none'\n\n /**\n * The currently selected items.\n * @default []\n */\n @property({ type: Array }) accessor selectedItems: T[] = []\n\n /**\n * The ARIA label for the table. Used for accessibility.\n * @attribute\n * @default \"Data table\"\n */\n @property({ type: String, reflect: true }) override accessor ariaLabel = 'Data table'\n\n /**\n * Enables double-click and Enter/Space key activation of table items.\n * When `true`, items can be activated by:\n * - Double-clicking the item.\n * - Focusing on the item and pressing Enter or Space.\n * The `activate` event is dispatched when an item is activated.\n * @attribute\n * @default false\n */\n @property({ type: Boolean }) accessor active = false\n\n /**\n * Enables the \"load more\" functionality when the user scrolls to the bottom of the table.\n * When `true`, a sentinel element is added to the bottom of the table. When the sentinel\n * becomes visible, the `scrollend` event is dispatched.\n * This is commonly used for infinite scrolling or lazy loading of data.\n * @attribute\n * @default false\n */\n @property({ type: Boolean, reflect: true }) accessor overflow = false\n\n /**\n * The name of the property to sort the table by. If set, the table will\n * automatically indicate the sortable header.\n * @default undefined\n */\n @property({ type: String }) accessor sort: string | undefined\n\n @property({ type: String }) accessor sortDirection: 'asc' | 'desc' | undefined\n\n protected lastSelectedIndex = -1\n\n protected observer?: IntersectionObserver\n\n protected sentinel = createRef<HTMLElement>()\n\n /**\n * The current focus position.\n * It is used to support keyboard navigation.\n *\n * Initially we always allow to focus on the first cell, which\n * should be the first header cell. The keyboard navigation will\n * take over.\n */\n @state() accessor position: CellPosition = { row: 0, col: 0 }\n\n constructor() {\n super()\n this.handleLiveData = this.handleLiveData.bind(this)\n }\n\n override connectedCallback(): void {\n super.connectedCallback()\n if (this.overflow) {\n // Only create the observer if overflow is enabled\n this.createObserver()\n }\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback()\n this.observer?.disconnect()\n this.observer = undefined\n }\n\n override firstUpdated(): void {\n if (this.overflow) {\n this.createObserver()\n }\n }\n\n protected override willUpdate(cp: PropertyValues<this>): void {\n if (cp.has('items')) {\n this.lastSelectedIndex = -1\n this.revalidateSelection()\n }\n }\n\n protected override updated(cp: PropertyValues<this>): void {\n if (cp.has('position')) {\n const { row, col, ignoreFocus = false } = this.position\n if (!ignoreFocus) {\n const cell = this.shadowRoot?.querySelector(`[data-row=\"${row}\"][data-col=\"${col}\"]`) as HTMLElement | null\n if (cell) {\n cell.focus()\n }\n }\n }\n if (cp.has('items')) {\n const old = cp.get('items')\n if (old) {\n old.removeEventListener('update', this.handleLiveData)\n }\n if (this.items) {\n this.items.addEventListener('update', this.handleLiveData)\n }\n }\n }\n\n handleLiveData(): void {\n this.requestUpdate()\n }\n\n /**\n * @internal\n * @description Creates and configures an `IntersectionObserver` to detect when the sentinel element is visible,\n * indicating the user has scrolled to the bottom of the table.\n *\n * This method sets up the observer to watch the sentinel element. When the sentinel intersects with the component's viewport,\n * it triggers the `scrollend` event.\n *\n * This function is used when `overflow` is set to true.\n *\n * @returns void\n */\n protected createObserver(): void {\n const { sentinel } = this\n if (!sentinel.value) {\n return\n }\n\n const options: IntersectionObserverInit = {\n root: this, // Observe within the component's viewport\n rootMargin: '0px', // No margin\n threshold: 0.0, // Trigger when the sentinel is 0% visible (at the very bottom)\n }\n\n this.observer = new IntersectionObserver(this.handleIntersection, options)\n this.observer.observe(sentinel.value) // Observe the sentinel.\n }\n\n protected revalidateSelection(): void {\n const { items, selectedItems = [] } = this\n if (!items || selectedItems.length === 0) {\n return\n }\n const filteredSelectedItems = selectedItems.filter((selectedItem) =>\n items.value.some((item) => item === selectedItem)\n )\n if (filteredSelectedItems.length !== selectedItems.length) {\n this.selectedItems = filteredSelectedItems\n this.dispatchEvent(\n new CustomEvent('select', {\n detail: { selectedItems: this.selectedItems },\n })\n )\n }\n }\n\n /**\n * @internal\n * @description Handles the intersection of the sentinel element with the viewport.\n *\n * This method is the callback function for the `IntersectionObserver`. When the sentinel becomes visible,\n * it dispatches the `scrollend` event to signal that the user has reached the bottom of the table.\n *\n * @param entries - An array of IntersectionObserverEntry objects.\n * @returns void\n */\n handleIntersection: IntersectionObserverCallback = (entries): void => {\n if (entries.some((entry) => entry.isIntersecting)) {\n this.dispatchEvent(new CustomEvent('scrollend'))\n }\n }\n\n /**\n * @internal\n * @description Extracts information about a cell from an event.\n *\n * This method analyzes the event's composed path to identify the clicked or focused cell (either `<td>` or `<th>`).\n * It returns the cell element, its column index, and its row index.\n * It is also capable of detecting if the user focused on an interactive element within a cell.\n *\n * @param e - The event object (typically a MouseEvent or KeyboardEvent).\n * @returns An object containing the cell element, column index, and row index, or `undefined` if the target is not a cell.\n */\n protected infoFromEvent(e: Event): EventCellInfo | undefined {\n const path = e.composedPath()\n let cell: HTMLElement | undefined\n for (const current of path.values()) {\n const element = current as Element\n if (element.nodeType !== Node.ELEMENT_NODE) {\n continue\n }\n const isTarget = ['TD', 'TH'].includes(element.nodeName)\n if (!isTarget && element.hasAttribute('tabindex')) {\n // It means that the user focusing on an interactive element\n // within a cell and we should abandon whatever we do right now.\n return\n }\n if (isTarget) {\n cell = element as HTMLElement\n break\n }\n }\n if (!cell) {\n return\n }\n const col = Number(cell.dataset.col)\n const row = Number(cell.dataset.row)\n if (isNaN(col) || isNaN(row)) {\n return\n }\n return { cell, col, row }\n }\n\n /**\n * @internal\n * @description Gets the number of columns and rows of the table.\n *\n * @returns An object with `cols` and `rows` properties indicating the number of columns and rows.\n */\n protected getSize(): { cols: number; rows: number } {\n const result = { cols: 0, rows: 0 }\n const table = this.shadowRoot?.querySelector('table')\n if (!table) {\n return result\n }\n const row = table.querySelector('tr')\n if (!row) {\n return result\n }\n const columns = row.querySelectorAll('th, td')\n result.cols = columns.length ? columns.length - 1 : 0\n const rows = table.rows\n result.rows = rows.length ? rows.length - 1 : 0\n return result\n }\n\n /**\n * @internal\n * @description Get the element containing the cell data.\n *\n * @param col - The column index of the cell.\n * @param row - The row index of the cell.\n * @returns An object with the cell element and `delegateFocus` flag, or `undefined` if the cell does not exist.\n */\n protected getCellInfo(col: number, row: number): { cell: HTMLElement; delegateFocus: boolean } | undefined {\n const cell = this.shadowRoot?.querySelector(`[data-col=\"${col}\"][data-row=\"${row}\"]`) as HTMLElement | null\n if (!cell) {\n return\n }\n const delegateFocus = cell.dataset.delegate === 'true'\n return { cell, delegateFocus }\n }\n\n /**\n * @internal\n * @description Delegates the focus to a specific interactive element within a cell.\n *\n * This method is used when the cell is configured to handle its own focus management (i.e., `delegateFocus` is `true`).\n *\n * @param parent - The parent element (the cell) containing the interactive element.\n * @returns void\n */\n protected delegateFocus(parent: HTMLElement): void {\n const delegate = parent.querySelector('[tabindex]') as HTMLElement | null\n if (delegate) {\n delegate.focus()\n }\n }\n\n /**\n * @internal\n * @description Moves the focus to the specified cell.\n *\n * This method updates the component's internal `position` state and then focuses on the corresponding cell.\n * If the cell has the `delegateFocus` property, it delegates the focus to the first interactive element inside of the cell.\n *\n * @param col - The column index of the cell to focus on.\n * @param row - The row index of the cell to focus on.\n * @returns void\n */\n protected moveFocusTo(col: number, row: number): void {\n const cell = this.getCellInfo(col, row)\n if (!cell) {\n return\n }\n this.position = { row, col }\n if (cell.delegateFocus) {\n this.position.ignoreFocus = true\n this.delegateFocus(cell.cell)\n }\n }\n\n /**\n * @internal\n * @description Handles keyboard navigation within the table.\n *\n * This method processes keyboard events to move the focus between cells. It supports arrow keys, Page Up/Down, Home/End, Enter and Space.\n * - ArrowRight: Moves focus to the next cell to the right.\n * - ArrowLeft: Moves focus to the next cell to the left.\n * - ArrowDown: Moves focus to the cell below.\n * - ArrowUp: Moves focus to the cell above.\n * - PageUp: Moves focus to the first row.\n * - PageDown: Moves focus to the last row.\n * - Home: Moves focus to the first cell of the current row (Ctrl+Home moves to the first cell of the first row).\n * - End: Moves focus to the last cell of the current row (Ctrl+End moves to the last cell of the last row).\n * - Enter: Activates the current row.\n * - Space: Manages selection.\n *\n * @param e - The KeyboardEvent object.\n * @returns void\n */\n protected handleKeyDown(e: KeyboardEvent) {\n if (e.defaultPrevented) {\n return\n }\n const info = this.infoFromEvent(e)\n if (!info) {\n // This also makes sure that when we are focusing on an element\n // within a `delegateFocus` cell, we won't interfere with its events.\n return\n }\n const { code } = e\n const { position } = this\n const size = this.getSize()\n if (code === 'ArrowRight') {\n e.preventDefault()\n if (position.col < size.cols) {\n this.moveFocusTo(position.col + 1, position.row)\n }\n } else if (code === 'ArrowLeft') {\n e.preventDefault()\n if (position.col > 0) {\n this.moveFocusTo(position.col - 1, position.row)\n }\n } else if (code === 'ArrowDown') {\n e.preventDefault()\n if (position.row < size.rows) {\n this.moveFocusTo(position.col, position.row + 1)\n }\n } else if (code === 'ArrowUp') {\n e.preventDefault()\n if (position.row > 0) {\n this.moveFocusTo(position.col, position.row - 1)\n }\n } else if (code === 'PageUp') {\n e.preventDefault()\n if (position.row > 1) {\n this.moveFocusTo(position.col, 1)\n }\n } else if (code === 'PageDown') {\n e.preventDefault()\n if (position.row < size.rows) {\n this.moveFocusTo(position.col, size.rows)\n }\n } else if (code === 'Home') {\n e.preventDefault()\n if (!e.ctrlKey && position.col > 0) {\n this.moveFocusTo(0, position.row)\n } else if (e.ctrlKey && (position.row > 1 || position.col > 0)) {\n this.moveFocusTo(0, 1)\n }\n } else if (code === 'End') {\n e.preventDefault()\n if (!e.ctrlKey && position.col < size.cols) {\n this.moveFocusTo(size.cols, position.row)\n } else if (e.ctrlKey && position.row < size.rows) {\n this.moveFocusTo(size.cols, size.rows)\n }\n } else if (code === 'Enter') {\n e.preventDefault()\n this.activateFromCellInfo(info)\n } else if (code === 'Space') {\n e.preventDefault()\n this.manageSelectionFromEvent(info, e)\n }\n }\n\n /**\n * @internal\n * @description Handles mouse click events on the table.\n *\n * @param e - The MouseEvent object.\n * @returns void\n */\n protected handleClick(e: MouseEvent): void {\n if (e.detail === 3) {\n return\n }\n const info = this.infoFromEvent(e)\n if (!info) {\n return\n }\n if (e.detail === 2) {\n this.activateFromCellInfo(info)\n } else {\n this.manageSelectionFromEvent(info, e)\n }\n }\n\n /**\n * @internal\n * @description Manages the selection state based on a mouse or keyboard event.\n *\n * This method determines the row and column from the event target and updates the `selectedItems` array accordingly.\n * It supports single, multiple and no selection based on the `selection` property. It also supports shift-click.\n *\n * @param info - The cell info.\n * @param e - The MouseEvent or KeyboardEvent object.\n * @returns void\n */\n protected manageSelectionFromEvent(info: EventCellInfo, e: MouseEvent | KeyboardEvent): void {\n if (!this.items) {\n return\n }\n const { row, col } = info\n const index = row - 1\n if (info.row === 0) {\n // Handle sort.\n this.sortFrom(info.cell)\n this.position = { row, col }\n return\n }\n const item = this.items.value[index]\n if (!item) {\n return\n }\n\n const isMultiSelect = this.selection === 'multi'\n if (isMultiSelect && (e.metaKey || e.ctrlKey)) {\n this.toggleSelection(item, 'add')\n } else if (isMultiSelect && e.shiftKey) {\n this.handleShiftClick(index, item)\n } else {\n this.toggleSelection(item, 'replace')\n this.lastSelectedIndex = index\n }\n // This won't cause the focus ring to be rendered because the cell\n // won't hey the `tabindex=0`, which is OK with pointer device navigation,\n // but it will keep track of the last cell in case the keyboard navigation starts.\n this.position = { row, col }\n }\n\n /**\n * @internal\n * @description Handles shift-click for range selection.\n *\n * When shift-clicking a row, it will select all the items between the last selected item and the clicked item.\n *\n * @param clickedIndex - The index of the clicked item.\n * @param item - The clicked item.\n * @returns void\n */\n protected handleShiftClick(clickedIndex: number, item: T) {\n if (!this.items) {\n return\n }\n if (this.lastSelectedIndex === -1) {\n // If no previous selection, just select the clicked item.\n this.toggleSelection(item)\n this.lastSelectedIndex = clickedIndex\n return\n }\n const startIndex = Math.min(this.lastSelectedIndex, clickedIndex)\n const endIndex = Math.max(this.lastSelectedIndex, clickedIndex)\n const newSelectedItems = this.items.value.slice(startIndex, endIndex + 1)\n this.selectedItems = newSelectedItems as T[]\n this.dispatchEvent(new CustomEvent('select', { detail: { selectedItems: this.selectedItems } }))\n }\n\n /**\n * @internal\n * @description Activates the row associated with the given event.\n *\n * This method is called when a row is double-clicked or when the Enter/Space key is pressed while a row is focused.\n *\n * @param e - The Event object.\n * @returns void\n */\n protected activateFromCellInfo(info: EventCellInfo): void {\n if (!this.items) {\n return\n }\n if (info.row === 0) {\n // Handle sort.\n this.sortFrom(info.cell)\n return\n }\n const item = this.items.value[info.row - 1]\n if (!item) {\n return\n }\n this.dispatchEvent(new CustomEvent('activate', { detail: item }))\n }\n\n /**\n * @internal\n * @description Handles sorting logic based on the clicked column header.\n *\n * This method updates the `sort` and `sortDirection` properties and dispatches the `sort` event.\n *\n * @param column - The header cell element.\n * @returns void\n */\n protected sortFrom(column: HTMLElement): void {\n const sort = column.dataset.sort\n if (!sort) {\n return\n }\n if (this.sort === sort) {\n this.sortDirection = this.sortDirection === 'asc' ? 'desc' : 'asc'\n } else {\n this.sort = sort\n this.sortDirection = 'asc'\n }\n this.dispatchEvent(\n new CustomEvent('sort', {\n detail: {\n column: this.sort,\n direction: this.sortDirection,\n },\n })\n )\n }\n\n /**\n * @public\n * @description Checks if an item is currently selected.\n *\n * @param item - The item to check.\n * @returns `true` if the item is selected, `false` otherwise.\n */\n isSelected(item: T): boolean {\n return this.selectedItems.includes(item)\n }\n\n /**\n * @public\n * @description Toggles the selection state of an item.\n *\n * This method adds or removes an item from the `selectedItems` array.\n *\n * @param item - The item to toggle selection for.\n * @param mode - The selection mode, either 'replace' or 'add' (defaults to 'replace').\n * @returns void\n */\n toggleSelection(item: T, mode: 'replace' | 'add' = 'replace') {\n if (this.selection === 'none') {\n return\n }\n\n if (this.selection === 'single') {\n this.selectedItems = [item]\n } else {\n // multi-select\n const index = this.selectedItems.indexOf(item)\n if (mode === 'replace') {\n this.selectedItems = [item]\n } else if (index === -1) {\n this.selectedItems = [...this.selectedItems, item]\n } else {\n this.selectedItems = this.selectedItems.filter((i) => i !== item)\n }\n }\n\n this.dispatchEvent(new CustomEvent('select', { detail: { selectedItems: this.selectedItems } }))\n }\n\n /**\n * @internal\n * @description Renders the table.\n *\n * @returns A `TemplateResult` for rendering.\n */\n override render(): TemplateResult {\n if (!this.items || !this.items.value.length) {\n return this.renderEmpty()\n }\n const isMulti = this.selection === 'multi'\n return html`\n <table\n part=\"table\"\n role=\"grid\"\n aria-multiselectable=\"${ifDefined(isMulti ? 'true' : undefined)}\"\n aria-label=\"${this.ariaLabel}\"\n @keydown=\"${this.handleKeyDown}\"\n @click=\"${this.handleClick}\"\n >\n <thead>\n <tr role=\"row\">\n ${this.renderHeader()}\n </tr>\n </thead>\n <tbody>\n ${this.items.value.map((item, index) => this.renderRow(item, index))}\n </tbody>\n </table>\n ${this.overflow ? html`<div class=\"scroll-sentinel\" ${ref(this.sentinel)}></div>` : nothing}\n `\n }\n\n /**\n * @internal\n * @description Renders the empty state of the table.\n *\n * @returns A `TemplateResult` for rendering.\n */\n renderEmpty(): TemplateResult {\n return html`\n <slot name=\"empty\">\n <p role=\"status\" class=\"empty\">No data to display.</p>\n </slot>\n `\n }\n\n /**\n * @internal\n * @description Renders the table header cells. Must be implemented by subclasses.\n *\n * @returns An array of `TemplateResult` objects representing the header cells.\n */\n abstract renderHeader(): TemplateResult[]\n\n /**\n * @internal\n * @description Renders the cells for a given row item. Must be implemented by subclasses.\n *\n * @param item The data item for the row.\n * @param index The index that should be passed back to the rendering function. This is not the item index.\n * @returns An array of `TemplateResult` objects representing the cells for the row.\n */\n abstract renderRowValues(item: T, index: number): TemplateResult[]\n\n /**\n * @internal\n * @description Renders a single row in the table.\n *\n * @param item - The data item for the row.\n * @param index - The index of the row.\n * @returns A `TemplateResult` for rendering.\n */\n protected renderRow(item: T, index: number): TemplateResult {\n const rowClasses = {\n selected: this.isSelected(item as T),\n }\n\n return html`\n <tr\n role=\"row\"\n aria-selected=\"${this.isSelected(item as T) ? 'true' : 'false'}\"\n data-index=\"${index}\"\n class=\"${classMap(rowClasses)}\"\n >\n ${this.renderRowValues(item, index + 1)}\n </tr>\n `\n }\n\n /**\n * @internal\n * A helper method to render a standard table cell.\n *\n * @param content The content of the cell.\n * @param row The 0-based row index of the rendered cell\n * @param col The 0-based column index of the rendered cell\n * @param opts Options for rendering the cell (classes, icon, data attributes).\n * @returns A `TemplateResult` representing the rendered cell.\n */\n protected renderCell(content: unknown, row: number, col: number, opts: CellRenderOptions = {}): TemplateResult {\n const { position } = this\n const { data = {}, classes = [], ariaLabel, delegateFocus = false, isPrimary = false } = opts\n const cellClasses: Record<string, boolean> = { 'grid-cell': true }\n classes?.forEach((c) => (cellClasses[c] = true))\n const isFocused = position?.col === col && position?.row === row\n let index: number | undefined\n if (!delegateFocus) {\n index = isFocused ? 0 : -1\n }\n const ring = !delegateFocus\n ? html`<md-focus-ring .inward=\"${this.overflow ? true : false}\"></md-focus-ring>`\n : nothing\n if (isPrimary) {\n // Lit does not allow dynamic element names so I decided to make a copy.\n return html`\n <th\n role=\"gridcell\"\n class=\"${classMap(cellClasses)}\"\n ${dataAttr(data)}\n aria-label=\"${ifDefined(ariaLabel)}\"\n tabindex=\"${ifDefined(index)}\"\n data-delegate=\"${ifDefined(delegateFocus ? true : undefined)}\"\n data-row=\"${row}\"\n data-col=\"${col}\"\n scope=\"row\"\n part=\"cell\"\n >\n ${ring}\n <div class=\"cell-content\">${content}</div>\n </th>\n `\n }\n return html`\n <td\n role=\"gridcell\"\n class=\"${classMap(cellClasses)}\"\n ${dataAttr(data)}\n aria-label=\"${ifDefined(ariaLabel)}\"\n tabindex=\"${ifDefined(index)}\"\n data-delegate=\"${ifDefined(delegateFocus ? true : undefined)}\"\n data-row=\"${row}\"\n data-col=\"${col}\"\n part=\"cell\"\n >\n ${ring}\n <div class=\"cell-content\">${content}</div>\n </td>\n `\n }\n\n /**\n * @internal\n * @description Returns the name of the icon to use for sorting indication.\n *\n * @returns The name of the Material Icon to use (either \"arrow_upward\" or \"arrow_downward\").\n */\n get sortIconName(): string {\n return this.sortDirection === 'asc' ? 'arrow_upward' : 'arrow_downward'\n }\n\n /**\n * @internal\n * A helper method to render a table header cell.\n *\n * @param content The content of the header cell.\n * @param opts Options for rendering the header cell (classes, data attributes).\n * @returns A `TemplateResult` representing the rendered header cell.\n */\n protected renderHeaderCell(content: unknown, col: number, opts: HeaderCellRenderOptions = {}): TemplateResult {\n const { position } = this\n const { data = {}, classes = [], sort, delegateFocus = false, ariaLabel } = opts\n const cellClasses: Record<string, boolean> = { 'grid-header': true }\n classes?.forEach((c) => (cellClasses[c] = true))\n const isSortable = !!sort\n const isSorted = this.sort === sort\n const sortIcon = isSorted ? this.sortIconName : undefined\n const isFocused = position?.col === col && position?.row === 0\n let index: number | undefined\n if (!delegateFocus) {\n index = isFocused ? 0 : -1\n }\n let ariaSort: 'ascending' | 'descending' | 'none' | undefined\n if (isSorted) {\n ariaSort = this.sortDirection === 'asc' ? 'ascending' : 'descending'\n } else if (isSortable) {\n ariaSort = 'none'\n }\n return html`<th\n role=\"columnheader\"\n scope=\"col\"\n class=\"${classMap(cellClasses)}\"\n ${dataAttr(data)}\n aria-sort=\"${ifDefined(ariaSort)}\"\n data-sort=\"${ifDefined(sort)}\"\n data-row=\"0\"\n data-col=\"${col}\"\n tabindex=\"${ifDefined(index)}\"\n data-delegate=\"${ifDefined(delegateFocus ? true : undefined)}\"\n aria-label=\"${ifDefined(ariaLabel)}\"\n part=\"header-cell\"\n >\n <md-focus-ring .inward=\"${this.overflow ? true : false}\"></md-focus-ring>\n <div class=\"cell-content\">\n ${content}\n ${isSortable && sortIcon ? html`<md-icon class=\"sort-icon\" role=\"presentation\">${sortIcon}</md-icon>` : nothing}\n </div>\n </th> `\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"DataTable.js","sourceRoot":"","sources":["../../../../src/elements/data-table/DataTable.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAkC,MAAM,KAAK,CAAA;AAC/E,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AACtD,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AAGxD,OAAO,4BAA4B,CAAA;AACnC,OAAO,4BAA4B,CAAA;AACnC,OAAO,iCAAiC,CAAA;AACxC,OAAO,sCAAsC,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AA0ExD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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othing, PropertyValues, TemplateResult } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\nimport { ref, createRef } from 'lit/directives/ref.js'\nimport { dataAttr } from '../../directives/data-attr.js'\nimport { LiveData } from '../../reactive/LiveData.js'\n\nimport '@material/web/icon/icon.js'\nimport '@material/web/menu/menu.js'\nimport '@material/web/menu/menu-item.js'\nimport '@material/web/focus/md-focus-ring.js'\nimport { ifDefined } from 'lit/directives/if-defined.js'\n\n/**\n * Options for rendering a table cell.\n */\nexport interface CellRenderOptions {\n /**\n * CSS classes to apply to the cell.\n */\n classes?: string[]\n /**\n * Data attributes to add to the cell (e.g., `data-id=\"my-id\"`).\n */\n data?: Record<string, string | number | boolean>\n /**\n * The value of the aria-label to render on the cell.\n */\n ariaLabel?: string\n /**\n * Used with interactive elements within the cell.\n * The content of the cell should have exactly one element\n * with the `tabindex=-1`. The table will automatically\n * focus on that element when activated.\n */\n delegateFocus?: boolean\n /**\n * Used for accessibility. Should be set on the cell that represents\n * the name for the row, like, a person name or a file name.\n */\n isPrimary?: boolean\n}\n\n/**\n * Options for rendering a table header cell. Extends CellRenderOptions.\n */\nexport interface HeaderCellRenderOptions extends CellRenderOptions {\n /**\n * The name of the sort property.\n */\n sort?: string\n}\n\nexport interface CellPosition {\n /**\n * The index of the selected row\n */\n row: number\n /**\n * The index of the selected cell\n */\n col: number\n\n /**\n * Whether the logic should ignore setting up focus.\n * This is used when tracking cell selection when using a pointer device.\n */\n ignoreFocus?: boolean\n}\n\nexport interface EventCellInfo {\n /**\n * The cell element.\n */\n cell: HTMLElement\n /**\n * The column index\n */\n col: number\n /**\n * The **table** row index (not items)\n */\n row: number\n}\n\n/**\n * A versatile and accessible data table web component.\n *\n * The `DataTable` component provides a highly customizable and accessible way to display tabular data.\n * It offers features such as:\n *\n * - **Accessibility:** Built with ARIA roles and attributes for screen reader compatibility and keyboard navigation.\n * - **Customizable Cells:** Allows complete control over the content and rendering of each cell in the table.\n * - **Header Customization:** Provides flexibility in defining and rendering table headers, including sorting.\n * - **Selection:** Supports single, multiple, or no selection of rows.\n * - **Activation:** Enables the activation of rows (e.g., via double-click or Enter/Space key).\n * - **Infinite Scrolling:** Supports \"load more\" functionality (infinite scroll) using a sentinel element.\n * - **Sorting:** Allows sorting of data by clicking on sortable header cells.\n * - **Keyboard Navigation:** Full keyboard support for navigating through the table.\n * - **Empty State:** Customizable content to display when the table has no data.\n * - **Focus Management:** Properly manages focus for both keyboard and pointer interactions.\n *\n * @slot empty - Optional. Content to display when the table is empty (i.e., `items` is an empty array).\n * Defaults to a message saying \"No data to display.\"\n *\n * @fires select - Dispatched when the selection changes.\n * - `detail`: An object with a `selectedItems` property, containing an array of the currently selected items.\n * - Example: `{ selectedItems: [item1, item2] }`\n *\n * @fires activate - Dispatched when a row is activated (e.g., double-clicked or Enter/Space pressed).\n * - `detail`: The data item that was activated.\n * - Example: `item1`\n *\n * @fires scrollend - Dispatched when the user scrolls to the bottom of the table (when the `overflow` property is true).\n * - No event detail.\n *\n * @fires sort - Dispatched when the user clicks on a sortable header to change the sorting.\n * - `detail`: An object with `column` and `direction` properties.\n * - `column`: The name of the column being sorted.\n * - `direction`: The sort direction, either \"asc\" (ascending) or \"desc\" (descending).\n * - Example: `{ column: \"name\", direction: \"asc\" }`\n *\n * @csspart table - The underlying `<table>` element.\n * @csspart cell - Individual `<td>` and `<th>` elements.\n * @csspart header-cell - Individual `<th>` elements.\n *\n * @cssprop --md-focus-ring-shape-start-start - The start-start corner shape for the focus ring.\n * @cssprop --md-focus-ring-shape-start-end - The start-end corner shape for the focus ring.\n * @cssprop --md-focus-ring-shape-end-end - The end-end corner shape for the focus ring.\n * @cssprop --md-focus-ring-shape-end-start - The end-start corner shape for the focus ring.\n * @cssprop --md-sys-typescale-label-large-font - The font family for label large.\n * @cssprop --md-sys-typescale-label-large-size - The font size for label large.\n * @cssprop --md-sys-typescale-label-large-tracking - The letter spacing for label large.\n * @cssprop --md-sys-typescale-label-large-height - The line height for label large.\n * @cssprop --md-sys-typescale-label-large-weight - The font weight for label large.\n * @cssprop --md-sys-color-outline-variant - The outline variant color.\n * @cssprop --md-sys-color-secondary-container - The secondary container color.\n * @cssprop --md-icon-size - The size of the icons.\n * @cssprop --md-sys-typescale-title-small-font - The font family for title small.\n * @cssprop --md-sys-typescale-title-small-weight - The font weight for title small.\n * @cssprop --md-sys-typescale-title-small-size - The font size for title small.\n * @cssprop --md-sys-typescale-title-small-tracking - The letter spacing for title small.\n * @cssprop --md-sys-typescale-title-small-height - The line height for title small.\n * @cssprop --md-sys-typescale-body-medium-font - The font family for body medium.\n * @cssprop --md-sys-typescale-body-medium-weight - The font weight for body medium.\n * @cssprop --md-sys-typescale-body-medium-size - The font size for body medium.\n * @cssprop --md-sys-typescale-body-medium-tracking - The letter spacing for body medium.\n * @cssprop --md-sys-typescale-body-medium-height - The line height for body medium.\n *\n * @typeParam T The type of data items in the table.\n *\n * @example\n * ```html\n * <data-table\n * .items=\"${myItems}\"\n * selection=\"multi\"\n * @select=\"${handleSelect}\"\n * @activate=\"${handleActivate}\"\n * @scrollend=\"${handleScrollEnd}\"\n * @sort=\"${handleSort}\"\n * overflow\n * >\n * <p slot=\"empty\">No items to display at this time.</p>\n * </data-table>\n * ```\n *\n * @example\n * ```typescript\n * // Inside a subclass of DataTable.\n * // Rendering a name cell.\n * #nameCell(item: MyItem, row: number, col: number): TemplateResult {\n * return this.renderCell(item.name, row, col, { isPrimary: true });\n * }\n *\n * // Rendering a header cell.\n * override renderHeader(): TemplateResult[] {\n * return [\n * this.renderHeaderCell('Name', 0, { sort: 'name' }),\n * this.renderHeaderCell('Value', 1, { sort: 'value' }),\n * ];\n * }\n * ```\n */\nexport abstract class DataTable<T extends object> extends LitElement {\n /**\n * The data items to display in the table.\n */\n @property({ type: Object }) accessor items: LiveData<T[]> | undefined\n\n /**\n * The selection mode. Can be \"none\", \"single\", or \"multi\".\n * - `none`: No selection is allowed.\n * - `single`: Only one item can be selected at a time.\n * - `multi`: Multiple items can be selected.\n * @attribute\n * @default \"none\"\n */\n @property({ type: String, reflect: true }) accessor selection: 'none' | 'single' | 'multi' = 'none'\n\n /**\n * The currently selected items.\n * @default []\n */\n @property({ type: Array }) accessor selectedItems: T[] = []\n\n /**\n * The ARIA label for the table. Used for accessibility.\n * @attribute\n * @default \"Data table\"\n */\n @property({ type: String, reflect: true }) override accessor ariaLabel = 'Data table'\n\n /**\n * Enables double-click and Enter/Space key activation of table items.\n * When `true`, items can be activated by:\n * - Double-clicking the item.\n * - Focusing on the item and pressing Enter or Space.\n * The `activate` event is dispatched when an item is activated.\n * @attribute\n * @default false\n */\n @property({ type: Boolean }) accessor active = false\n\n /**\n * Enables the \"load more\" functionality when the user scrolls to the bottom of the table.\n * When `true`, a sentinel element is added to the bottom of the table. When the sentinel\n * becomes visible, the `scrollend` event is dispatched.\n * This is commonly used for infinite scrolling or lazy loading of data.\n * @attribute\n * @default false\n */\n @property({ type: Boolean, reflect: true }) accessor overflow = false\n\n /**\n * The name of the property to sort the table by. If set, the table will\n * automatically indicate the sortable header.\n * @attribute\n * @default undefined\n */\n @property({ type: String }) accessor sort: string | undefined\n\n /**\n * The direction of the sort. Can be \"asc\" (ascending) or \"desc\" (descending).\n * If `sort` is set, this property will be used to determine the sort direction.\n * @attribute\n * @default undefined\n */\n @property({ type: String }) accessor sortDirection: 'asc' | 'desc' | undefined\n\n protected lastSelectedIndex = -1\n\n protected observer?: IntersectionObserver\n\n protected sentinel = createRef<HTMLElement>()\n\n /**\n * The current focus position.\n * It is used to support keyboard navigation.\n *\n * Initially we always allow to focus on the first cell, which\n * should be the first header cell. The keyboard navigation will\n * take over.\n */\n @state() accessor position: CellPosition = { row: 0, col: 0 }\n\n constructor() {\n super()\n this.handleLiveData = this.handleLiveData.bind(this)\n }\n\n override connectedCallback(): void {\n super.connectedCallback()\n if (this.overflow) {\n // Only create the observer if overflow is enabled\n this.createObserver()\n }\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback()\n this.observer?.disconnect()\n this.observer = undefined\n }\n\n override firstUpdated(): void {\n if (this.overflow) {\n this.createObserver()\n }\n }\n\n protected override willUpdate(cp: PropertyValues<this>): void {\n if (cp.has('items')) {\n this.lastSelectedIndex = -1\n this.revalidateSelection()\n }\n }\n\n protected override updated(cp: PropertyValues<this>): void {\n if (cp.has('position')) {\n const { row, col, ignoreFocus = false } = this.position\n if (!ignoreFocus) {\n const cell = this.shadowRoot?.querySelector(`[data-row=\"${row}\"][data-col=\"${col}\"]`) as HTMLElement | null\n if (cell) {\n cell.focus()\n }\n }\n }\n if (cp.has('items')) {\n const old = cp.get('items')\n if (old) {\n old.removeEventListener('update', this.handleLiveData)\n }\n if (this.items) {\n this.items.addEventListener('update', this.handleLiveData)\n }\n }\n }\n\n handleLiveData(): void {\n this.requestUpdate()\n }\n\n /**\n * @internal\n * @description Creates and configures an `IntersectionObserver` to detect when the sentinel element is visible,\n * indicating the user has scrolled to the bottom of the table.\n *\n * This method sets up the observer to watch the sentinel element. When the sentinel intersects with the component's viewport,\n * it triggers the `scrollend` event.\n *\n * This function is used when `overflow` is set to true.\n *\n * @returns void\n */\n protected createObserver(): void {\n const { sentinel } = this\n if (!sentinel.value) {\n return\n }\n\n const options: IntersectionObserverInit = {\n root: this, // Observe within the component's viewport\n rootMargin: '0px', // No margin\n threshold: 0.0, // Trigger when the sentinel is 0% visible (at the very bottom)\n }\n\n this.observer = new IntersectionObserver(this.handleIntersection, options)\n this.observer.observe(sentinel.value) // Observe the sentinel.\n }\n\n protected revalidateSelection(): void {\n const { items, selectedItems = [] } = this\n if (!items || selectedItems.length === 0) {\n return\n }\n const filteredSelectedItems = selectedItems.filter((selectedItem) =>\n items.value.some((item) => item === selectedItem)\n )\n if (filteredSelectedItems.length !== selectedItems.length) {\n this.selectedItems = filteredSelectedItems\n this.dispatchEvent(\n new CustomEvent('select', {\n detail: { selectedItems: this.selectedItems },\n })\n )\n }\n }\n\n /**\n * @internal\n * @description Handles the intersection of the sentinel element with the viewport.\n *\n * This method is the callback function for the `IntersectionObserver`. When the sentinel becomes visible,\n * it dispatches the `scrollend` event to signal that the user has reached the bottom of the table.\n *\n * @param entries - An array of IntersectionObserverEntry objects.\n * @returns void\n */\n handleIntersection: IntersectionObserverCallback = (entries): void => {\n if (entries.some((entry) => entry.isIntersecting)) {\n this.dispatchEvent(new CustomEvent('scrollend'))\n }\n }\n\n /**\n * @internal\n * @description Extracts information about a cell from an event.\n *\n * This method analyzes the event's composed path to identify the clicked or focused cell (either `<td>` or `<th>`).\n * It returns the cell element, its column index, and its row index.\n * It is also capable of detecting if the user focused on an interactive element within a cell.\n *\n * @param e - The event object (typically a MouseEvent or KeyboardEvent).\n * @returns An object containing the cell element, column index, and row index, or `undefined` if the target is not a cell.\n */\n protected infoFromEvent(e: Event): EventCellInfo | undefined {\n const path = e.composedPath()\n let cell: HTMLElement | undefined\n for (const current of path.values()) {\n const element = current as Element\n if (element.nodeType !== Node.ELEMENT_NODE) {\n continue\n }\n const isTarget = ['TD', 'TH'].includes(element.nodeName)\n if (!isTarget && element.hasAttribute('tabindex')) {\n // It means that the user focusing on an interactive element\n // within a cell and we should abandon whatever we do right now.\n return\n }\n if (isTarget) {\n cell = element as HTMLElement\n break\n }\n }\n if (!cell) {\n return\n }\n const col = Number(cell.dataset.col)\n const row = Number(cell.dataset.row)\n if (isNaN(col) || isNaN(row)) {\n return\n }\n return { cell, col, row }\n }\n\n /**\n * @internal\n * @description Gets the number of columns and rows of the table.\n *\n * @returns An object with `cols` and `rows` properties indicating the number of columns and rows.\n */\n protected getSize(): { cols: number; rows: number } {\n const result = { cols: 0, rows: 0 }\n const table = this.shadowRoot?.querySelector('table')\n if (!table) {\n return result\n }\n const row = table.querySelector('tr')\n if (!row) {\n return result\n }\n const columns = row.querySelectorAll('th, td')\n result.cols = columns.length ? columns.length - 1 : 0\n const rows = table.rows\n result.rows = rows.length ? rows.length - 1 : 0\n return result\n }\n\n /**\n * @internal\n * @description Get the element containing the cell data.\n *\n * @param col - The column index of the cell.\n * @param row - The row index of the cell.\n * @returns An object with the cell element and `delegateFocus` flag, or `undefined` if the cell does not exist.\n */\n protected getCellInfo(col: number, row: number): { cell: HTMLElement; delegateFocus: boolean } | undefined {\n const cell = this.shadowRoot?.querySelector(`[data-col=\"${col}\"][data-row=\"${row}\"]`) as HTMLElement | null\n if (!cell) {\n return\n }\n const delegateFocus = cell.dataset.delegate === 'true'\n return { cell, delegateFocus }\n }\n\n /**\n * @internal\n * @description Delegates the focus to a specific interactive element within a cell.\n *\n * This method is used when the cell is configured to handle its own focus management (i.e., `delegateFocus` is `true`).\n *\n * @param parent - The parent element (the cell) containing the interactive element.\n * @returns void\n */\n protected delegateFocus(parent: HTMLElement): void {\n const delegate = parent.querySelector('[tabindex]') as HTMLElement | null\n if (delegate) {\n delegate.focus()\n }\n }\n\n /**\n * @internal\n * @description Moves the focus to the specified cell.\n *\n * This method updates the component's internal `position` state and then focuses on the corresponding cell.\n * If the cell has the `delegateFocus` property, it delegates the focus to the first interactive element inside of the cell.\n *\n * @param col - The column index of the cell to focus on.\n * @param row - The row index of the cell to focus on.\n * @returns void\n */\n protected moveFocusTo(col: number, row: number): void {\n const cell = this.getCellInfo(col, row)\n if (!cell) {\n return\n }\n this.position = { row, col }\n if (cell.delegateFocus) {\n this.position.ignoreFocus = true\n this.delegateFocus(cell.cell)\n }\n }\n\n /**\n * @internal\n * @description Handles keyboard navigation within the table.\n *\n * This method processes keyboard events to move the focus between cells. It supports arrow keys, Page Up/Down, Home/End, Enter and Space.\n * - ArrowRight: Moves focus to the next cell to the right.\n * - ArrowLeft: Moves focus to the next cell to the left.\n * - ArrowDown: Moves focus to the cell below.\n * - ArrowUp: Moves focus to the cell above.\n * - PageUp: Moves focus to the first row.\n * - PageDown: Moves focus to the last row.\n * - Home: Moves focus to the first cell of the current row (Ctrl+Home moves to the first cell of the first row).\n * - End: Moves focus to the last cell of the current row (Ctrl+End moves to the last cell of the last row).\n * - Enter: Activates the current row.\n * - Space: Manages selection.\n *\n * @param e - The KeyboardEvent object.\n * @returns void\n */\n protected handleKeyDown(e: KeyboardEvent) {\n if (e.defaultPrevented) {\n return\n }\n const info = this.infoFromEvent(e)\n if (!info) {\n // This also makes sure that when we are focusing on an element\n // within a `delegateFocus` cell, we won't interfere with its events.\n return\n }\n const { code } = e\n const { position } = this\n const size = this.getSize()\n if (code === 'ArrowRight') {\n e.preventDefault()\n if (position.col < size.cols) {\n this.moveFocusTo(position.col + 1, position.row)\n }\n } else if (code === 'ArrowLeft') {\n e.preventDefault()\n if (position.col > 0) {\n this.moveFocusTo(position.col - 1, position.row)\n }\n } else if (code === 'ArrowDown') {\n e.preventDefault()\n if (position.row < size.rows) {\n this.moveFocusTo(position.col, position.row + 1)\n }\n } else if (code === 'ArrowUp') {\n e.preventDefault()\n if (position.row > 0) {\n this.moveFocusTo(position.col, position.row - 1)\n }\n } else if (code === 'PageUp') {\n e.preventDefault()\n if (position.row > 1) {\n this.moveFocusTo(position.col, 1)\n }\n } else if (code === 'PageDown') {\n e.preventDefault()\n if (position.row < size.rows) {\n this.moveFocusTo(position.col, size.rows)\n }\n } else if (code === 'Home') {\n e.preventDefault()\n if (!e.ctrlKey && position.col > 0) {\n this.moveFocusTo(0, position.row)\n } else if (e.ctrlKey && (position.row > 1 || position.col > 0)) {\n this.moveFocusTo(0, 1)\n }\n } else if (code === 'End') {\n e.preventDefault()\n if (!e.ctrlKey && position.col < size.cols) {\n this.moveFocusTo(size.cols, position.row)\n } else if (e.ctrlKey && position.row < size.rows) {\n this.moveFocusTo(size.cols, size.rows)\n }\n } else if (code === 'Enter') {\n e.preventDefault()\n this.activateFromCellInfo(info)\n } else if (code === 'Space') {\n e.preventDefault()\n this.manageSelectionFromEvent(info, e)\n }\n }\n\n /**\n * @internal\n * @description Handles mouse click events on the table.\n *\n * @param e - The MouseEvent object.\n * @returns void\n */\n protected handleClick(e: MouseEvent): void {\n if (e.detail === 3) {\n return\n }\n const info = this.infoFromEvent(e)\n if (!info) {\n return\n }\n if (e.detail === 2) {\n this.activateFromCellInfo(info)\n } else {\n this.manageSelectionFromEvent(info, e)\n }\n }\n\n /**\n * @internal\n * @description Manages the selection state based on a mouse or keyboard event.\n *\n * This method determines the row and column from the event target and updates the `selectedItems` array accordingly.\n * It supports single, multiple and no selection based on the `selection` property. It also supports shift-click.\n *\n * @param info - The cell info.\n * @param e - The MouseEvent or KeyboardEvent object.\n * @returns void\n */\n protected manageSelectionFromEvent(info: EventCellInfo, e: MouseEvent | KeyboardEvent): void {\n if (!this.items) {\n return\n }\n const { row, col } = info\n const index = row - 1\n if (info.row === 0) {\n // Handle sort.\n this.sortFrom(info.cell)\n this.position = { row, col }\n return\n }\n const item = this.items.value[index]\n if (!item) {\n return\n }\n\n const isMultiSelect = this.selection === 'multi'\n if (isMultiSelect && (e.metaKey || e.ctrlKey)) {\n this.toggleSelection(item, 'add')\n } else if (isMultiSelect && e.shiftKey) {\n this.handleShiftClick(index, item)\n } else {\n this.toggleSelection(item, 'replace')\n this.lastSelectedIndex = index\n }\n // This won't cause the focus ring to be rendered because the cell\n // won't hey the `tabindex=0`, which is OK with pointer device navigation,\n // but it will keep track of the last cell in case the keyboard navigation starts.\n this.position = { row, col }\n }\n\n /**\n * @internal\n * @description Handles shift-click for range selection.\n *\n * When shift-clicking a row, it will select all the items between the last selected item and the clicked item.\n *\n * @param clickedIndex - The index of the clicked item.\n * @param item - The clicked item.\n * @returns void\n */\n protected handleShiftClick(clickedIndex: number, item: T) {\n if (!this.items) {\n return\n }\n if (this.lastSelectedIndex === -1) {\n // If no previous selection, just select the clicked item.\n this.toggleSelection(item)\n this.lastSelectedIndex = clickedIndex\n return\n }\n const startIndex = Math.min(this.lastSelectedIndex, clickedIndex)\n const endIndex = Math.max(this.lastSelectedIndex, clickedIndex)\n const newSelectedItems = this.items.value.slice(startIndex, endIndex + 1)\n this.selectedItems = newSelectedItems as T[]\n this.dispatchEvent(new CustomEvent('select', { detail: { selectedItems: this.selectedItems } }))\n }\n\n /**\n * @internal\n * @description Activates the row associated with the given event.\n *\n * This method is called when a row is double-clicked or when the Enter/Space key is pressed while a row is focused.\n *\n * @param e - The Event object.\n * @returns void\n */\n protected activateFromCellInfo(info: EventCellInfo): void {\n if (!this.items) {\n return\n }\n if (info.row === 0) {\n // Handle sort.\n this.sortFrom(info.cell)\n return\n }\n const item = this.items.value[info.row - 1]\n if (!item) {\n return\n }\n this.dispatchEvent(new CustomEvent('activate', { detail: item }))\n }\n\n /**\n * @internal\n * @description Handles sorting logic based on the clicked column header.\n *\n * This method updates the `sort` and `sortDirection` properties and dispatches the `sort` event.\n *\n * @param column - The header cell element.\n * @returns void\n */\n protected sortFrom(column: HTMLElement): void {\n const sort = column.dataset.sort\n if (!sort) {\n return\n }\n if (this.sort === sort) {\n this.sortDirection = this.sortDirection === 'asc' ? 'desc' : 'asc'\n } else {\n this.sort = sort\n this.sortDirection = 'asc'\n }\n this.dispatchEvent(\n new CustomEvent('sort', {\n detail: {\n column: this.sort,\n direction: this.sortDirection,\n },\n })\n )\n }\n\n /**\n * @public\n * @description Checks if an item is currently selected.\n *\n * @param item - The item to check.\n * @returns `true` if the item is selected, `false` otherwise.\n */\n isSelected(item: T): boolean {\n return this.selectedItems.includes(item)\n }\n\n /**\n * @public\n * @description Toggles the selection state of an item.\n *\n * This method adds or removes an item from the `selectedItems` array.\n *\n * @param item - The item to toggle selection for.\n * @param mode - The selection mode, either 'replace' or 'add' (defaults to 'replace').\n * @returns void\n */\n toggleSelection(item: T, mode: 'replace' | 'add' = 'replace') {\n if (this.selection === 'none') {\n return\n }\n\n if (this.selection === 'single') {\n this.selectedItems = [item]\n } else {\n // multi-select\n const index = this.selectedItems.indexOf(item)\n if (mode === 'replace') {\n this.selectedItems = [item]\n } else if (index === -1) {\n this.selectedItems = [...this.selectedItems, item]\n } else {\n this.selectedItems = this.selectedItems.filter((i) => i !== item)\n }\n }\n\n this.dispatchEvent(new CustomEvent('select', { detail: { selectedItems: this.selectedItems } }))\n }\n\n /**\n * @internal\n * @description Renders the table.\n *\n * @returns A `TemplateResult` for rendering.\n */\n override render(): TemplateResult {\n if (!this.items || !this.items.value.length) {\n return this.renderEmpty()\n }\n const isMulti = this.selection === 'multi'\n return html`\n <table\n part=\"table\"\n role=\"grid\"\n aria-multiselectable=\"${ifDefined(isMulti ? 'true' : undefined)}\"\n aria-label=\"${this.ariaLabel}\"\n @keydown=\"${this.handleKeyDown}\"\n @click=\"${this.handleClick}\"\n >\n <thead>\n <tr role=\"row\">\n ${this.renderHeader()}\n </tr>\n </thead>\n <tbody>\n ${this.items.value.map((item, index) => this.renderRow(item, index))}\n </tbody>\n </table>\n ${this.overflow ? html`<div class=\"scroll-sentinel\" ${ref(this.sentinel)}></div>` : nothing}\n `\n }\n\n /**\n * @internal\n * @description Renders the empty state of the table.\n *\n * @returns A `TemplateResult` for rendering.\n */\n renderEmpty(): TemplateResult {\n return html`\n <slot name=\"empty\">\n <p role=\"status\" class=\"empty\">No data to display.</p>\n </slot>\n `\n }\n\n /**\n * @internal\n * @description Renders the table header cells. Must be implemented by subclasses.\n *\n * @returns An array of `TemplateResult` objects representing the header cells.\n */\n abstract renderHeader(): TemplateResult[]\n\n /**\n * @internal\n * @description Renders the cells for a given row item. Must be implemented by subclasses.\n *\n * @param item The data item for the row.\n * @param index The index that should be passed back to the rendering function. This is not the item index.\n * @returns An array of `TemplateResult` objects representing the cells for the row.\n */\n abstract renderRowValues(item: T, index: number): TemplateResult[]\n\n /**\n * @internal\n * @description Renders a single row in the table.\n *\n * @param item - The data item for the row.\n * @param index - The index of the row.\n * @returns A `TemplateResult` for rendering.\n */\n protected renderRow(item: T, index: number): TemplateResult {\n const rowClasses = {\n selected: this.isSelected(item as T),\n }\n\n return html`\n <tr\n role=\"row\"\n aria-selected=\"${this.isSelected(item as T) ? 'true' : 'false'}\"\n data-index=\"${index}\"\n class=\"${classMap(rowClasses)}\"\n >\n ${this.renderRowValues(item, index + 1)}\n </tr>\n `\n }\n\n /**\n * @internal\n * A helper method to render a standard table cell.\n *\n * @param content The content of the cell.\n * @param row The 0-based row index of the rendered cell\n * @param col The 0-based column index of the rendered cell\n * @param opts Options for rendering the cell (classes, icon, data attributes).\n * @returns A `TemplateResult` representing the rendered cell.\n */\n protected renderCell(content: unknown, row: number, col: number, opts: CellRenderOptions = {}): TemplateResult {\n const { position } = this\n const { data = {}, classes = [], ariaLabel, delegateFocus = false, isPrimary = false } = opts\n const cellClasses: Record<string, boolean> = { 'grid-cell': true }\n classes?.forEach((c) => (cellClasses[c] = true))\n const isFocused = position?.col === col && position?.row === row\n let index: number | undefined\n if (!delegateFocus) {\n index = isFocused ? 0 : -1\n }\n const ring = !delegateFocus\n ? html`<md-focus-ring .inward=\"${this.overflow ? true : false}\"></md-focus-ring>`\n : nothing\n if (isPrimary) {\n // Lit does not allow dynamic element names so I decided to make a copy.\n return html`\n <th\n role=\"gridcell\"\n class=\"${classMap(cellClasses)}\"\n ${dataAttr(data)}\n aria-label=\"${ifDefined(ariaLabel)}\"\n tabindex=\"${ifDefined(index)}\"\n data-delegate=\"${ifDefined(delegateFocus ? true : undefined)}\"\n data-row=\"${row}\"\n data-col=\"${col}\"\n scope=\"row\"\n part=\"cell\"\n >\n ${ring}\n <div class=\"cell-content\">${content}</div>\n </th>\n `\n }\n return html`\n <td\n role=\"gridcell\"\n class=\"${classMap(cellClasses)}\"\n ${dataAttr(data)}\n aria-label=\"${ifDefined(ariaLabel)}\"\n tabindex=\"${ifDefined(index)}\"\n data-delegate=\"${ifDefined(delegateFocus ? true : undefined)}\"\n data-row=\"${row}\"\n data-col=\"${col}\"\n part=\"cell\"\n >\n ${ring}\n <div class=\"cell-content\">${content}</div>\n </td>\n `\n }\n\n /**\n * @internal\n * @description Returns the name of the icon to use for sorting indication.\n *\n * @returns The name of the Material Icon to use (either \"arrow_upward\" or \"arrow_downward\").\n */\n get sortIconName(): string {\n return this.sortDirection === 'asc' ? 'arrow_upward' : 'arrow_downward'\n }\n\n /**\n * @internal\n * A helper method to render a table header cell.\n *\n * @param content The content of the header cell.\n * @param opts Options for rendering the header cell (classes, data attributes).\n * @returns A `TemplateResult` representing the rendered header cell.\n */\n protected renderHeaderCell(content: unknown, col: number, opts: HeaderCellRenderOptions = {}): TemplateResult {\n const { position } = this\n const { data = {}, classes = [], sort, delegateFocus = false, ariaLabel } = opts\n const cellClasses: Record<string, boolean> = { 'grid-header': true }\n classes?.forEach((c) => (cellClasses[c] = true))\n const isSortable = !!sort\n const isSorted = this.sort === sort\n const sortIcon = isSorted ? this.sortIconName : undefined\n const isFocused = position?.col === col && position?.row === 0\n let index: number | undefined\n if (!delegateFocus) {\n index = isFocused ? 0 : -1\n }\n let ariaSort: 'ascending' | 'descending' | 'none' | undefined\n if (isSorted) {\n ariaSort = this.sortDirection === 'asc' ? 'ascending' : 'descending'\n } else if (isSortable) {\n ariaSort = 'none'\n }\n return html`<th\n role=\"columnheader\"\n scope=\"col\"\n class=\"${classMap(cellClasses)}\"\n ${dataAttr(data)}\n aria-sort=\"${ifDefined(ariaSort)}\"\n data-sort=\"${ifDefined(sort)}\"\n data-row=\"0\"\n data-col=\"${col}\"\n tabindex=\"${ifDefined(index)}\"\n data-delegate=\"${ifDefined(delegateFocus ? true : undefined)}\"\n aria-label=\"${ifDefined(ariaLabel)}\"\n part=\"header-cell\"\n >\n <md-focus-ring .inward=\"${this.overflow ? true : false}\"></md-focus-ring>\n <div class=\"cell-content\">\n ${content}\n ${isSortable && sortIcon ? html`<md-icon class=\"sort-icon\" role=\"presentation\">${sortIcon}</md-icon>` : nothing}\n </div>\n </th> `\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
/* eslint-disable no-console */
|
|
3
|
-
import {
|
|
3
|
+
import { Exception } from '@api-client/core/exceptions/exception.js'
|
|
4
4
|
import { type IoEvent, type IoCommand, type IoNotification } from './PlatformBindings.js'
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -40,9 +40,9 @@ export abstract class IoThread {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
if (typeof fn !== 'string' || !fn) {
|
|
43
|
-
const err = new
|
|
43
|
+
const err = new Exception(
|
|
44
44
|
'Invalid message received on the io-channel. The second argument must be a function name to call.',
|
|
45
|
-
400
|
|
45
|
+
{ status: 400 }
|
|
46
46
|
)
|
|
47
47
|
this.notifyError(id, err)
|
|
48
48
|
console.warn(err.message)
|
|
@@ -53,9 +53,9 @@ export abstract class IoThread {
|
|
|
53
53
|
const isFunction = typeof callable === 'function'
|
|
54
54
|
|
|
55
55
|
if (!isFunction) {
|
|
56
|
-
const err = new
|
|
56
|
+
const err = new Exception(
|
|
57
57
|
`Invalid message received on the io-channel. The function "${fn}" is either not implemented or invalid.`,
|
|
58
|
-
400
|
|
58
|
+
{ status: 400 }
|
|
59
59
|
)
|
|
60
60
|
this.notifyError(id, err)
|
|
61
61
|
console.warn(err.message)
|
|
@@ -65,7 +65,7 @@ export abstract class IoThread {
|
|
|
65
65
|
this.call(callable, id, args)
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
protected notifyError(id: number, error:
|
|
68
|
+
protected notifyError(id: number, error: Exception): void {
|
|
69
69
|
const event: IoEvent = {
|
|
70
70
|
kind: 'IO#Event',
|
|
71
71
|
id,
|
|
@@ -114,7 +114,7 @@ export abstract class IoThread {
|
|
|
114
114
|
} catch (e) {
|
|
115
115
|
event.type = 'error'
|
|
116
116
|
event.message = (e as Error).message
|
|
117
|
-
if ((e as
|
|
117
|
+
if ((e as Exception).status) {
|
|
118
118
|
event.result = e
|
|
119
119
|
}
|
|
120
120
|
this.postMessage(event)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-unsafe-function-type */
|
|
2
|
-
import {
|
|
2
|
+
import { Exception, type ExceptionSchema } from '@api-client/core/exceptions/exception.js'
|
|
3
3
|
import { Events } from '../../events/Events.js'
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -185,9 +185,9 @@ export abstract class PlatformBindings {
|
|
|
185
185
|
if (type === 'result') {
|
|
186
186
|
info.resolve(result)
|
|
187
187
|
} else if (type === 'error') {
|
|
188
|
-
const apiErr = result as
|
|
188
|
+
const apiErr = result as ExceptionSchema | undefined
|
|
189
189
|
if (apiErr && apiErr.code) {
|
|
190
|
-
info.reject(
|
|
190
|
+
info.reject(Exception.fromRawException(apiErr, 'Unknown exception'))
|
|
191
191
|
} else {
|
|
192
192
|
info.reject(new Error(message))
|
|
193
193
|
}
|
package/src/core/Activity.ts
CHANGED
|
@@ -143,6 +143,7 @@ export class Activity extends EventTarget {
|
|
|
143
143
|
*/
|
|
144
144
|
onDestroy(): void | Promise<void> {
|
|
145
145
|
this.dispatchEvent(new CustomEvent('activity:destroy', { detail: null }))
|
|
146
|
+
this.manager.onDestroy()
|
|
146
147
|
}
|
|
147
148
|
|
|
148
149
|
/**
|
|
@@ -199,18 +200,18 @@ export class Activity extends EventTarget {
|
|
|
199
200
|
* @param key The name of the fragment
|
|
200
201
|
* @param fragment The fragment to register.
|
|
201
202
|
*/
|
|
202
|
-
addFragment(key: string, fragment: Fragment, data?: unknown): void {
|
|
203
|
-
this.manager.attachFragment(key, fragment, this, data)
|
|
203
|
+
async addFragment(key: string, fragment: Fragment, data?: unknown): Promise<void> {
|
|
204
|
+
await this.manager.attachFragment(key, fragment, this, data)
|
|
204
205
|
}
|
|
205
206
|
|
|
206
|
-
showFragment(key: string, root?: HTMLElement): void {
|
|
207
|
-
this.manager.showFragment(key, root)
|
|
207
|
+
async showFragment(key: string, root?: HTMLElement): Promise<void> {
|
|
208
|
+
await this.manager.showFragment(key, root)
|
|
208
209
|
}
|
|
209
210
|
|
|
210
|
-
hideFragment(key: string): void {
|
|
211
|
+
async hideFragment(key: string): Promise<void> {
|
|
211
212
|
const fragment = this.manager.findFragment(key)
|
|
212
213
|
if (fragment) {
|
|
213
|
-
this.manager.hideFragment(fragment)
|
|
214
|
+
await this.manager.hideFragment(fragment)
|
|
214
215
|
}
|
|
215
216
|
}
|
|
216
217
|
|
|
@@ -322,7 +323,7 @@ export class Activity extends EventTarget {
|
|
|
322
323
|
const info = event.detail as ActivityWithResultDetail
|
|
323
324
|
await this.startActivityForResult(info.intent)
|
|
324
325
|
} else if (event.type === EventTypes.Intent.startActivity) {
|
|
325
|
-
this.startActivity(event.detail.intent)
|
|
326
|
+
await this.startActivity(event.detail.intent)
|
|
326
327
|
} else {
|
|
327
328
|
throw new Error(`Unrecognized intent event: ${event.type}`)
|
|
328
329
|
}
|
|
@@ -239,21 +239,21 @@ export class ActivityManager {
|
|
|
239
239
|
async startActivityForResult(intent: Intent, requestCode: number): Promise<void> {
|
|
240
240
|
intent.requestCode = requestCode
|
|
241
241
|
const byReference = (intent.flags ?? 0) & IntentFlags.ByReference
|
|
242
|
-
const
|
|
242
|
+
const shallowCopy = { ...intent }
|
|
243
|
+
const data = shallowCopy.data
|
|
243
244
|
if (byReference) {
|
|
244
|
-
delete
|
|
245
|
+
delete shallowCopy.data
|
|
245
246
|
}
|
|
246
|
-
const
|
|
247
|
-
if (data &&
|
|
248
|
-
|
|
247
|
+
const deepCopy = structuredClone(shallowCopy)
|
|
248
|
+
if (data && byReference) {
|
|
249
|
+
deepCopy.data = data
|
|
249
250
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
intent.flags = intent.flags & IntentFlags.ForResult
|
|
251
|
+
if (deepCopy.flags) {
|
|
252
|
+
deepCopy.flags = deepCopy.flags | IntentFlags.ForResult
|
|
253
253
|
} else {
|
|
254
|
-
|
|
254
|
+
deepCopy.flags = IntentFlags.ForResult
|
|
255
255
|
}
|
|
256
|
-
await this.startActivity(
|
|
256
|
+
await this.startActivity(deepCopy)
|
|
257
257
|
}
|
|
258
258
|
|
|
259
259
|
isDestroyed(activity: Activity): boolean {
|
|
@@ -264,6 +264,7 @@ export class ActivityManager {
|
|
|
264
264
|
* @param activity The activity to finish.
|
|
265
265
|
*/
|
|
266
266
|
async finishActivity(activity: Activity): Promise<void> {
|
|
267
|
+
this.setupStyles(undefined, activity)
|
|
267
268
|
const isModal = this.modalActivityStack.some((entry) => entry.activity === activity)
|
|
268
269
|
const stack = isModal ? this.modalActivityStack : this.activityStack
|
|
269
270
|
const index = stack.findIndex((entry) => entry.activity === activity)
|
|
@@ -340,6 +341,38 @@ export class ActivityManager {
|
|
|
340
341
|
return this.currentActivity
|
|
341
342
|
}
|
|
342
343
|
|
|
344
|
+
/**
|
|
345
|
+
* Sets the styles for the current activity.
|
|
346
|
+
* This method adds or removes CSS classes based on the activity's class name
|
|
347
|
+
* and action, allowing for dynamic styling based on the active activity.
|
|
348
|
+
* @param activity The activity to set styles for.
|
|
349
|
+
* If not provided, it will not set any styles.
|
|
350
|
+
* If the activity is the same as the current one, it does nothing.
|
|
351
|
+
*/
|
|
352
|
+
setupStyles(activity?: Activity, oldActivity?: Activity): void {
|
|
353
|
+
if (activity === oldActivity) {
|
|
354
|
+
return
|
|
355
|
+
}
|
|
356
|
+
const root = document?.documentElement
|
|
357
|
+
if (!root) {
|
|
358
|
+
return
|
|
359
|
+
}
|
|
360
|
+
if (oldActivity) {
|
|
361
|
+
const ctor = oldActivity.constructor as typeof Activity
|
|
362
|
+
root.classList.remove(ctor.name.toLowerCase())
|
|
363
|
+
if (ctor.action) {
|
|
364
|
+
root.classList.remove(ctor.action.replace(/\//g, '-'))
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
if (activity) {
|
|
368
|
+
const ctor = activity.constructor as typeof Activity
|
|
369
|
+
root.classList.add(ctor.name.toLowerCase())
|
|
370
|
+
if (ctor.action) {
|
|
371
|
+
root.classList.add(ctor.action.replace(/\//g, '-'))
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
|
|
343
376
|
/**
|
|
344
377
|
* A helper method to handle the transition between activities, ensuring
|
|
345
378
|
* lifecycle methods are called in the correct order (pause the previous activity,
|
|
@@ -348,10 +381,13 @@ export class ActivityManager {
|
|
|
348
381
|
* @param activity The activity to bring to the foreground.
|
|
349
382
|
*/
|
|
350
383
|
private async updateCurrentActivity(activity: Activity, isModal: boolean): Promise<void> {
|
|
384
|
+
this.setupStyles(activity, this.currentActivity)
|
|
351
385
|
if (
|
|
352
386
|
this.currentActivity &&
|
|
353
387
|
this.currentActivity !== activity &&
|
|
354
|
-
this.currentActivity.state !== ActivityState.Destroyed
|
|
388
|
+
this.currentActivity.state !== ActivityState.Destroyed &&
|
|
389
|
+
// Make sure we don't pause the current activity if it's already paused.
|
|
390
|
+
this.currentActivity.state !== ActivityState.Paused
|
|
355
391
|
) {
|
|
356
392
|
await this.currentActivity.onPause()
|
|
357
393
|
this.currentActivity.state = ActivityState.Paused
|
|
@@ -395,7 +431,17 @@ export class ActivityManager {
|
|
|
395
431
|
// the activity finished and the manager already took care of this situation.
|
|
396
432
|
return
|
|
397
433
|
}
|
|
398
|
-
|
|
434
|
+
await activity.onStart()
|
|
435
|
+
if (this.isDestroyed(activity)) {
|
|
436
|
+
return
|
|
437
|
+
}
|
|
438
|
+
activity.state = ActivityState.Started
|
|
439
|
+
await activity.onResume()
|
|
440
|
+
if (this.isDestroyed(activity)) {
|
|
441
|
+
return
|
|
442
|
+
}
|
|
443
|
+
activity.state = ActivityState.Resumed
|
|
444
|
+
activity.requestUpdate()
|
|
399
445
|
}
|
|
400
446
|
if (!isModal) {
|
|
401
447
|
// With a modal activity, it renders directly to the `<body>` and renders outside
|
package/src/core/Application.ts
CHANGED
package/src/core/Fragment.ts
CHANGED
|
@@ -57,6 +57,15 @@ export class Fragment extends EventTarget {
|
|
|
57
57
|
this.#renderer = new FragmentRenderer(this)
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
/**
|
|
61
|
+
* When implemented, this method returns the class name to be used as a root class for the fragment.
|
|
62
|
+
* This class name can be used to apply styles or identify the fragment in the DOM.
|
|
63
|
+
* @returns The class name to be used as a root class for the fragment.
|
|
64
|
+
*/
|
|
65
|
+
public rootClass(): string | undefined {
|
|
66
|
+
return undefined
|
|
67
|
+
}
|
|
68
|
+
|
|
60
69
|
/**
|
|
61
70
|
* @see {@link ./Renderer.js}
|
|
62
71
|
*/
|
|
@@ -126,6 +135,7 @@ export class Fragment extends EventTarget {
|
|
|
126
135
|
*/
|
|
127
136
|
onDestroy(): void | Promise<void> {
|
|
128
137
|
this.dispatchEvent(new CustomEvent('fragment:destroy', { detail: null }))
|
|
138
|
+
this.fragmentManager.onDestroy()
|
|
129
139
|
}
|
|
130
140
|
|
|
131
141
|
/**
|
|
@@ -182,19 +192,19 @@ export class Fragment extends EventTarget {
|
|
|
182
192
|
* @param key The name of the fragment.
|
|
183
193
|
* @param fragment The fragment to add.
|
|
184
194
|
*/
|
|
185
|
-
addChild(key: string, fragment: Fragment, data?: unknown): void {
|
|
195
|
+
async addChild(key: string, fragment: Fragment, data?: unknown): Promise<void> {
|
|
186
196
|
this.children.set(key, fragment)
|
|
187
|
-
this.fragmentManager.attachFragment(key, fragment, this, data)
|
|
197
|
+
await this.fragmentManager.attachFragment(key, fragment, this, data)
|
|
188
198
|
}
|
|
189
199
|
|
|
190
200
|
/**
|
|
191
201
|
* Removes a fragment from this fragment.
|
|
192
202
|
* @param key The name of the fragment to remove.
|
|
193
203
|
*/
|
|
194
|
-
removeChild(key: string): void {
|
|
204
|
+
async removeChild(key: string): Promise<void> {
|
|
195
205
|
const child = this.children.get(key)
|
|
196
206
|
if (child) {
|
|
197
|
-
this.fragmentManager.detachFragment(key)
|
|
207
|
+
await this.fragmentManager.detachFragment(key)
|
|
198
208
|
this.children.delete(key)
|
|
199
209
|
}
|
|
200
210
|
}
|
|
@@ -261,7 +271,7 @@ export class Fragment extends EventTarget {
|
|
|
261
271
|
return
|
|
262
272
|
}
|
|
263
273
|
for (const fragment of children.values()) {
|
|
264
|
-
if (fragment.
|
|
274
|
+
if (fragment.hasRequestCode(requestCode)) {
|
|
265
275
|
fragment.onActivityResult(requestCode, resultCode, intent)
|
|
266
276
|
return
|
|
267
277
|
}
|
|
@@ -273,9 +283,9 @@ export class Fragment extends EventTarget {
|
|
|
273
283
|
}
|
|
274
284
|
}
|
|
275
285
|
|
|
276
|
-
|
|
286
|
+
hasRequestCode(requestCode: number): boolean {
|
|
277
287
|
for (const fragment of this.children.values()) {
|
|
278
|
-
if (fragment.
|
|
288
|
+
if (fragment.hasRequestCode(requestCode)) {
|
|
279
289
|
return true
|
|
280
290
|
}
|
|
281
291
|
}
|
|
@@ -311,7 +321,7 @@ export class Fragment extends EventTarget {
|
|
|
311
321
|
onResult: info.onResult,
|
|
312
322
|
})
|
|
313
323
|
} else if (event.type === EventTypes.Intent.startActivity) {
|
|
314
|
-
activity.startActivity(event.detail.intent)
|
|
324
|
+
await activity.startActivity(event.detail.intent)
|
|
315
325
|
} else {
|
|
316
326
|
throw new Error(`Unrecognized intent event: ${event.type}`)
|
|
317
327
|
}
|