@oicl/openbridge-webcomponents-full-bundle 2.0.0-next.148 → 2.0.0-next.150
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/bundle/openbridge-webcomponents.bundle.js +4561 -3882
- package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
- package/custom-elements.json +535 -21
- package/dist/components/alert-list-details-experimental/alert-list-details-experimental.css.js +94 -0
- package/dist/components/alert-list-details-experimental/alert-list-details-experimental.css.js.map +1 -0
- package/dist/components/alert-list-details-experimental/alert-list-details-experimental.d.ts +72 -0
- package/dist/components/alert-list-details-experimental/alert-list-details-experimental.d.ts.map +1 -0
- package/dist/components/alert-list-details-experimental/alert-list-details-experimental.js +396 -0
- package/dist/components/alert-list-details-experimental/alert-list-details-experimental.js.map +1 -0
- package/dist/components/icon-button/icon-button.d.ts +3 -0
- package/dist/components/icon-button/icon-button.d.ts.map +1 -1
- package/dist/components/icon-button/icon-button.js +6 -0
- package/dist/components/icon-button/icon-button.js.map +1 -1
- package/dist/components/table/table.css.js +43 -0
- package/dist/components/table/table.css.js.map +1 -1
- package/dist/components/table/table.d.ts +31 -1
- package/dist/components/table/table.d.ts.map +1 -1
- package/dist/components/table/table.js +124 -11
- package/dist/components/table/table.js.map +1 -1
- package/dist/components/top-bar/top-bar.d.ts.map +1 -1
- package/dist/components/top-bar/top-bar.js +8 -0
- package/dist/components/top-bar/top-bar.js.map +1 -1
- package/dist/generated/locales/es-419.d.ts +11 -1
- package/dist/generated/locales/es-419.d.ts.map +1 -1
- package/dist/generated/locales/es-419.js +11 -1
- package/dist/generated/locales/es-419.js.map +1 -1
- package/dist/generated/locales/fi-FI.d.ts +11 -1
- package/dist/generated/locales/fi-FI.d.ts.map +1 -1
- package/dist/generated/locales/fi-FI.js +11 -1
- package/dist/generated/locales/fi-FI.js.map +1 -1
- package/dist/integration-systems/integration-bar/integration-bar.d.ts +8 -8
- package/dist/integration-systems/integration-bar/integration-bar.d.ts.map +1 -1
- package/dist/integration-systems/integration-bar/integration-bar.js +13 -1
- package/dist/integration-systems/integration-bar/integration-bar.js.map +1 -1
- package/dist/integration-systems/integration-bar-dropdown/integration-bar-dropdown.d.ts +72 -7
- package/dist/integration-systems/integration-bar-dropdown/integration-bar-dropdown.d.ts.map +1 -1
- package/dist/integration-systems/integration-bar-dropdown/integration-bar-dropdown.js +99 -41
- package/dist/integration-systems/integration-bar-dropdown/integration-bar-dropdown.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/src/components/alert-list-details-experimental/alert-list-details-experimental.css +70 -0
- package/src/components/alert-list-details-experimental/alert-list-details-experimental.stories.ts +510 -0
- package/src/components/alert-list-details-experimental/alert-list-details-experimental.ts +457 -0
- package/src/components/icon-button/icon-button.spec.ts +52 -0
- package/src/components/icon-button/icon-button.ts +7 -0
- package/src/components/table/table.css +42 -0
- package/src/components/table/table.stories.ts +279 -0
- package/src/components/table/table.ts +177 -13
- package/src/components/top-bar/top-bar.ts +10 -0
- package/src/generated/locales/es-419.ts +11 -1
- package/src/generated/locales/fi-FI.ts +11 -1
- package/src/integration-systems/integration-bar/integration-bar.ts +21 -9
- package/src/integration-systems/integration-bar-dropdown/integration-bar-dropdown.stories.ts +70 -3
- package/src/integration-systems/integration-bar-dropdown/integration-bar-dropdown.ts +138 -52
- package/src/types.ts +6 -4
|
@@ -2,6 +2,7 @@ import { unsafeCSS, LitElement, nothing, html } from "lit";
|
|
|
2
2
|
import { property } from "lit/decorators.js";
|
|
3
3
|
import iconStyle from "./icon-button.css.js";
|
|
4
4
|
import { classMap } from "lit/directives/class-map.js";
|
|
5
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
5
6
|
import { customElement } from "../../decorator.js";
|
|
6
7
|
import { degToRad } from "../../svghelpers/math.js";
|
|
7
8
|
var __defProp = Object.defineProperty;
|
|
@@ -34,6 +35,7 @@ let ObcIconButton = class extends LitElement {
|
|
|
34
35
|
this.progress = void 0;
|
|
35
36
|
this.hasLabel = false;
|
|
36
37
|
this.showDivider = true;
|
|
38
|
+
this.ariaLabel = null;
|
|
37
39
|
}
|
|
38
40
|
get progressSpinner() {
|
|
39
41
|
if (this.progress === void 0) {
|
|
@@ -104,6 +106,7 @@ let ObcIconButton = class extends LitElement {
|
|
|
104
106
|
"hide-divider": !this.showDivider
|
|
105
107
|
})}
|
|
106
108
|
?disabled=${this.disabled}
|
|
109
|
+
aria-label=${ifDefined(this.ariaLabel ?? void 0)}
|
|
107
110
|
part="wrapper"
|
|
108
111
|
>
|
|
109
112
|
${this.progress !== void 0 ? this.progressSpinner : nothing}
|
|
@@ -150,6 +153,9 @@ __decorateClass([
|
|
|
150
153
|
__decorateClass([
|
|
151
154
|
property({ type: Boolean, attribute: false })
|
|
152
155
|
], ObcIconButton.prototype, "showDivider", 2);
|
|
156
|
+
__decorateClass([
|
|
157
|
+
property({ type: String, attribute: "aria-label" })
|
|
158
|
+
], ObcIconButton.prototype, "ariaLabel", 2);
|
|
153
159
|
ObcIconButton = __decorateClass([
|
|
154
160
|
customElement("obc-icon-button")
|
|
155
161
|
], ObcIconButton);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon-button.js","sources":["../../../src/components/icon-button/icon-button.ts"],"sourcesContent":["import {LitElement, html, nothing, unsafeCSS} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport iconStyle from './icon-button.css?inline';\nimport {classMap} from 'lit/directives/class-map.js';\nimport {customElement} from '../../decorator.js';\nimport {degToRad} from '../../svghelpers/math.js';\n\n/**\n * The available visual variants for `<obc-icon-button>`.\n * - `normal`: Standard appearance for most use cases.\n * - `raised`: Adds elevation/shadow for prominence.\n * - `flat`: Minimal, backgroundless style for subtle actions.\n * - `integration`: For use in Integration Bar components\n */\nexport enum IconButtonVariant {\n normal = 'normal',\n raised = 'raised',\n flat = 'flat',\n integration = 'integration',\n}\n\n/**\n * `<obc-icon-button>` – An icon-only or icon-with-label button for quick actions.\n *\n * Provides a compact, visually prominent button that displays an icon (and optionally a label) for triggering actions. Commonly used for toolbars, navigation, or contextual actions where space is limited and a recognizable icon can represent the function.\n *\n * Appears as a circular or rounded button with configurable visual styles, supporting progress indication and various layout adaptations.\n *\n * ## Features\n * - **Variants:**\n * - `normal` (default): Standard appearance for most use cases.\n * - `raised`: Adds elevation/shadow for prominence.\n * - `flat`: Minimal, backgroundless style for subtle actions.\n * - `integration`: For use in Integration Bar components\n * - **Progress Indicator:**\n * - Shows a circular progress spinner overlay when the `progress` property is set (0–100). Useful for indicating loading or ongoing actions.\n * - **Label Support:**\n * - Optionally displays a text label below the icon when `hasLabel` is true and content is provided in the `label` slot.\n * - **Corner Alignment:**\n * - `cornerLeft` and `cornerRight` adjust the button's border radius and alignment for seamless placement at the start or end of a container.\n * - **Active State:**\n * - `activated` visually highlights the button as selected or toggled.\n * - `activeColor` applies an accent color for emphasis.\n * - **Wide Mode:**\n * - `wide` increases the button's width for easier touch targets or visual balance.\n * - **Disabled State:**\n * - `disabled` prevents interaction and visually dims the button.\n *\n * ## Usage Guidelines\n * - Use `obc-icon-button` for actions represented by icons, such as toolbars, navigation, or quick-access commands.\n * - Add a label (with `hasLabel` and the `label` slot) when clarity is needed or when icons alone may not be universally understood.\n * - Use the progress indicator for actions that take time, such as uploads or background processes.\n * - Prefer the `normal` variant for most cases; use `raised` to draw attention, and `flat` for less prominent or inline actions.\n * - For grouped or edge-aligned layouts, use `cornerLeft` or `cornerRight` to visually merge with container edges.\n * - Avoid using icon buttons for destructive or critical actions unless paired with clear feedback.\n * - **TODO(designer):** Clarify recommended icon sizes and when to use label vs. icon-only.\n *\n * ## Slots\n * | Slot Name | Renders When... | Purpose |\n * |-----------|---------------------|----------------------------------------------|\n * | (default) | Always | The icon to display (e.g., `<obi-search>`) |\n * | label | If `hasLabel` is set | Optional label text below the icon |\n *\n * ## Events\n * - Emits a standard `click` event (`onClick` handler in framework wrappers) when activated.\n *\n * ## Best Practices\n * - Ensure icons are clear and universally recognizable.\n * - For accessibility, provide an `aria-label` or descriptive label for the button's action.\n * - When using the progress indicator, avoid showing it for very short actions to prevent visual flicker.\n *\n * ## Example:\n * ```\n * <obc-icon-button variant=\"normal\">\n * <obi-search></obi-search>\n * </obc-icon-button>\n *\n * <obc-icon-button variant=\"normal\" hasLabel>\n * <obi-arrow></obi-arrow>\n * <span slot=\"label\">Next</span>\n * </obc-icon-button>\n * ```\n *\n * @property activated - Whether the button is in an activated (selected/toggled) state.\n * Visually highlights the button to indicate selection.\n * @property cornerLeft - If true, aligns the button to the left edge and removes left border radius.\n * Useful for grouping or edge-aligned layouts.\n * @property cornerRight - If true, aligns the button to the right edge and removes right border radius.\n * Useful for grouping or edge-aligned layouts.\n * @property activeColor - Applies an accent color to the button for emphasis.\n * Used to visually distinguish active or important actions.\n * @property wide - Increases the button's width for larger touch targets or visual balance.\n * @property disabled - Disables the button, preventing user interaction and dimming its appearance.\n * @property progress - Shows a circular progress indicator overlay when set (0–100).\n * Use to indicate ongoing actions or loading states.\n * If undefined, no progress indicator is shown.\n * @property hasLabel - If true, displays a label below the icon using the `label` slot.\n * @property showDivider - If false, and cornerLeft or cornerRight is true, the divider is not shown.\n * @slot - Icon slot (default): Place an icon such as <obi-search> here.\n * @slot label - Optional label shown below the icon when `hasLabel` is true.\n * @fires click - Fired when the button is clicked (if not disabled).\n * @stable\n */\n@customElement('obc-icon-button')\nexport class ObcIconButton extends LitElement {\n /**\n * Visual style of the button.\n * - `normal`: Standard appearance (default).\n * - `raised`: Elevated with shadow.\n * - `flat`: Minimal, backgroundless style.\n */\n @property({type: String}) variant: IconButtonVariant =\n IconButtonVariant.normal;\n\n @property({type: Boolean}) activated = false;\n\n @property({type: Boolean}) cornerLeft = false;\n\n @property({type: Boolean}) cornerRight = false;\n\n @property({type: Boolean}) activeColor = false;\n\n @property({type: Boolean}) wide = false;\n\n @property({type: Boolean}) disabled = false;\n\n @property({type: Number}) progress: undefined | number = undefined;\n\n @property({type: Boolean}) hasLabel: boolean = false;\n\n @property({type: Boolean, attribute: false}) showDivider = true;\n\n get progressSpinner() {\n if (this.progress === undefined) {\n return nothing;\n }\n if (this.progress === 100) {\n return html`<div class=\"progress-spinner\">\n <svg\n width=\"40\"\n height=\"40\"\n viewBox=\"0 0 40 40\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle\n cx=\"20\"\n cy=\"20\"\n r=\"18\"\n stroke=\"#325B9A\"\n stroke-width=\"4\"\n fill=\"none\"\n />\n </svg>\n </div>`;\n }\n const angleRad = degToRad(this.progress * 0.95 * 3.6);\n const x = 20 + 18 * Math.sin(angleRad);\n const y = 20 - 18 * Math.cos(angleRad);\n const largeArcFlag = angleRad > Math.PI ? 1 : 0;\n return html`<div class=\"progress-spinner\">\n <svg\n width=\"40\"\n height=\"40\"\n viewBox=\"0 0 40 40\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle\n cx=\"20\"\n cy=\"20\"\n r=\"18\"\n stroke=\"var(--container-backdrop-color)\"\n stroke-width=\"4\"\n fill=\"none\"\n />\n <path\n d=\"M18 2 A18 18 0 ${largeArcFlag} 1 ${x} ${y}\"\n stroke=\"var(--instrument-enhanced-secondary-color)\"\n stroke-width=\"4\"\n stroke-linecap=\"round\"\n />\n </svg>\n </div>`;\n }\n\n override render() {\n return html`\n <button\n class=${classMap({\n wrapper: true,\n ['variant-' + this.variant]: true,\n activated: this.activated,\n 'corner-left': this.cornerLeft,\n 'corner-right': this.cornerRight,\n 'active-color': this.activeColor,\n 'has-label': this.hasLabel,\n wide: this.wide,\n progress: this.progress !== undefined,\n 'hide-divider': !this.showDivider,\n })}\n ?disabled=${this.disabled}\n part=\"wrapper\"\n >\n ${this.progress !== undefined ? this.progressSpinner : nothing}\n <div class=\"visible-wrapper\" part=\"visible-wrapper\">\n <div class=\"icon\" part=\"icon\">\n <slot></slot>\n </div>\n </div>\n ${this.hasLabel\n ? html`<div class=\"label\" part=\"label\">\n <slot name=\"label\"></slot>\n </div>`\n : nothing}\n </button>\n `;\n }\n\n static override styles = unsafeCSS(iconStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-icon-button': ObcIconButton;\n }\n}\n"],"names":["IconButtonVariant"],"mappings":";;;;;;;;;;;;;;;;AAcO,IAAK,sCAAAA,uBAAL;AACLA,qBAAA,QAAA,IAAS;AACTA,qBAAA,QAAA,IAAS;AACTA,qBAAA,MAAA,IAAO;AACPA,qBAAA,aAAA,IAAc;AAJJ,SAAAA;AAAA,GAAA,qBAAA,CAAA,CAAA;AA0FL,IAAM,gBAAN,cAA4B,WAAW;AAAA,EAAvC,cAAA;AAAA,UAAA,GAAA,SAAA;AAOqB,SAAA,UACxB;AAEyB,SAAA,YAAY;AAEZ,SAAA,aAAa;AAEb,SAAA,cAAc;AAEd,SAAA,cAAc;AAEd,SAAA,OAAO;AAEP,SAAA,WAAW;AAEZ,SAAA,WAA+B;AAE9B,SAAA,WAAoB;AAEF,SAAA,cAAc;AAAA,EAAA;AAAA,EAE3D,IAAI,kBAAkB;AACpB,QAAI,KAAK,aAAa,QAAW;AAC/B,aAAO;AAAA,IACT;AACA,QAAI,KAAK,aAAa,KAAK;AACzB,aAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAkBT;AACA,UAAM,WAAW,SAAS,KAAK,WAAW,OAAO,GAAG;AACpD,UAAM,IAAI,KAAK,KAAK,KAAK,IAAI,QAAQ;AACrC,UAAM,IAAI,KAAK,KAAK,KAAK,IAAI,QAAQ;AACrC,UAAM,eAAe,WAAW,KAAK,KAAK,IAAI;AAC9C,WAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAiBmB,YAAY,MAAM,CAAC,I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A,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GApBd,cAoBgB,WAAA,YAAA,CAAA;AAED,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GAtBb,cAsBe,WAAA,YAAA,CAAA;AAEC,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GAxBd,cAwBgB,WAAA,YAAA,CAAA;AAEkB,gBAAA;AAAA,EAA5C,SAAS,EAAC,MAAM,SAAS,WAAW,OAAM;AAAA,GA1BhC,cA0BkC,WAAA,eAAA,CAAA;AA1BlC,gBAAN,gBAAA;AAAA,EADN,cAAc,iBAAiB;AAAA,GACnB,aAAA;"}
|
|
1
|
+
{"version":3,"file":"icon-button.js","sources":["../../../src/components/icon-button/icon-button.ts"],"sourcesContent":["import {LitElement, html, nothing, unsafeCSS} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport iconStyle from './icon-button.css?inline';\nimport {classMap} from 'lit/directives/class-map.js';\nimport {ifDefined} from 'lit/directives/if-defined.js';\nimport {customElement} from '../../decorator.js';\nimport {degToRad} from '../../svghelpers/math.js';\n\n/**\n * The available visual variants for `<obc-icon-button>`.\n * - `normal`: Standard appearance for most use cases.\n * - `raised`: Adds elevation/shadow for prominence.\n * - `flat`: Minimal, backgroundless style for subtle actions.\n * - `integration`: For use in Integration Bar components\n */\nexport enum IconButtonVariant {\n normal = 'normal',\n raised = 'raised',\n flat = 'flat',\n integration = 'integration',\n}\n\n/**\n * `<obc-icon-button>` – An icon-only or icon-with-label button for quick actions.\n *\n * Provides a compact, visually prominent button that displays an icon (and optionally a label) for triggering actions. Commonly used for toolbars, navigation, or contextual actions where space is limited and a recognizable icon can represent the function.\n *\n * Appears as a circular or rounded button with configurable visual styles, supporting progress indication and various layout adaptations.\n *\n * ## Features\n * - **Variants:**\n * - `normal` (default): Standard appearance for most use cases.\n * - `raised`: Adds elevation/shadow for prominence.\n * - `flat`: Minimal, backgroundless style for subtle actions.\n * - `integration`: For use in Integration Bar components\n * - **Progress Indicator:**\n * - Shows a circular progress spinner overlay when the `progress` property is set (0–100). Useful for indicating loading or ongoing actions.\n * - **Label Support:**\n * - Optionally displays a text label below the icon when `hasLabel` is true and content is provided in the `label` slot.\n * - **Corner Alignment:**\n * - `cornerLeft` and `cornerRight` adjust the button's border radius and alignment for seamless placement at the start or end of a container.\n * - **Active State:**\n * - `activated` visually highlights the button as selected or toggled.\n * - `activeColor` applies an accent color for emphasis.\n * - **Wide Mode:**\n * - `wide` increases the button's width for easier touch targets or visual balance.\n * - **Disabled State:**\n * - `disabled` prevents interaction and visually dims the button.\n *\n * ## Usage Guidelines\n * - Use `obc-icon-button` for actions represented by icons, such as toolbars, navigation, or quick-access commands.\n * - Add a label (with `hasLabel` and the `label` slot) when clarity is needed or when icons alone may not be universally understood.\n * - Use the progress indicator for actions that take time, such as uploads or background processes.\n * - Prefer the `normal` variant for most cases; use `raised` to draw attention, and `flat` for less prominent or inline actions.\n * - For grouped or edge-aligned layouts, use `cornerLeft` or `cornerRight` to visually merge with container edges.\n * - Avoid using icon buttons for destructive or critical actions unless paired with clear feedback.\n * - **TODO(designer):** Clarify recommended icon sizes and when to use label vs. icon-only.\n *\n * ## Slots\n * | Slot Name | Renders When... | Purpose |\n * |-----------|---------------------|----------------------------------------------|\n * | (default) | Always | The icon to display (e.g., `<obi-search>`) |\n * | label | If `hasLabel` is set | Optional label text below the icon |\n *\n * ## Events\n * - Emits a standard `click` event (`onClick` handler in framework wrappers) when activated.\n *\n * ## Best Practices\n * - Ensure icons are clear and universally recognizable.\n * - For accessibility, provide an `aria-label` or descriptive label for the button's action.\n * - When using the progress indicator, avoid showing it for very short actions to prevent visual flicker.\n *\n * ## Example:\n * ```\n * <obc-icon-button variant=\"normal\">\n * <obi-search></obi-search>\n * </obc-icon-button>\n *\n * <obc-icon-button variant=\"normal\" hasLabel>\n * <obi-arrow></obi-arrow>\n * <span slot=\"label\">Next</span>\n * </obc-icon-button>\n * ```\n *\n * @property activated - Whether the button is in an activated (selected/toggled) state.\n * Visually highlights the button to indicate selection.\n * @property cornerLeft - If true, aligns the button to the left edge and removes left border radius.\n * Useful for grouping or edge-aligned layouts.\n * @property cornerRight - If true, aligns the button to the right edge and removes right border radius.\n * Useful for grouping or edge-aligned layouts.\n * @property activeColor - Applies an accent color to the button for emphasis.\n * Used to visually distinguish active or important actions.\n * @property wide - Increases the button's width for larger touch targets or visual balance.\n * @property disabled - Disables the button, preventing user interaction and dimming its appearance.\n * @property progress - Shows a circular progress indicator overlay when set (0–100).\n * Use to indicate ongoing actions or loading states.\n * If undefined, no progress indicator is shown.\n * @property hasLabel - If true, displays a label below the icon using the `label` slot.\n * @property showDivider - If false, and cornerLeft or cornerRight is true, the divider is not shown.\n * @property ariaLabel - Accessible name forwarded to the inner `<button>`, mapped to the `aria-label` attribute. `aria-labelledby` is not supported: ID references cannot cross the shadow boundary.\n * @slot - Icon slot (default): Place an icon such as <obi-search> here.\n * @slot label - Optional label shown below the icon when `hasLabel` is true.\n * @fires click - Fired when the button is clicked (if not disabled).\n * @stable\n */\n@customElement('obc-icon-button')\nexport class ObcIconButton extends LitElement {\n /**\n * Visual style of the button.\n * - `normal`: Standard appearance (default).\n * - `raised`: Elevated with shadow.\n * - `flat`: Minimal, backgroundless style.\n */\n @property({type: String}) variant: IconButtonVariant =\n IconButtonVariant.normal;\n\n @property({type: Boolean}) activated = false;\n\n @property({type: Boolean}) cornerLeft = false;\n\n @property({type: Boolean}) cornerRight = false;\n\n @property({type: Boolean}) activeColor = false;\n\n @property({type: Boolean}) wide = false;\n\n @property({type: Boolean}) disabled = false;\n\n @property({type: Number}) progress: undefined | number = undefined;\n\n @property({type: Boolean}) hasLabel: boolean = false;\n\n @property({type: Boolean, attribute: false}) showDivider = true;\n\n // Reactive so a consumer swapping the name (Play → Pause) re-renders the shadow button.\n @property({type: String, attribute: 'aria-label'})\n override ariaLabel: string | null = null;\n\n get progressSpinner() {\n if (this.progress === undefined) {\n return nothing;\n }\n if (this.progress === 100) {\n return html`<div class=\"progress-spinner\">\n <svg\n width=\"40\"\n height=\"40\"\n viewBox=\"0 0 40 40\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle\n cx=\"20\"\n cy=\"20\"\n r=\"18\"\n stroke=\"#325B9A\"\n stroke-width=\"4\"\n fill=\"none\"\n />\n </svg>\n </div>`;\n }\n const angleRad = degToRad(this.progress * 0.95 * 3.6);\n const x = 20 + 18 * Math.sin(angleRad);\n const y = 20 - 18 * Math.cos(angleRad);\n const largeArcFlag = angleRad > Math.PI ? 1 : 0;\n return html`<div class=\"progress-spinner\">\n <svg\n width=\"40\"\n height=\"40\"\n viewBox=\"0 0 40 40\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle\n cx=\"20\"\n cy=\"20\"\n r=\"18\"\n stroke=\"var(--container-backdrop-color)\"\n stroke-width=\"4\"\n fill=\"none\"\n />\n <path\n d=\"M18 2 A18 18 0 ${largeArcFlag} 1 ${x} ${y}\"\n stroke=\"var(--instrument-enhanced-secondary-color)\"\n stroke-width=\"4\"\n stroke-linecap=\"round\"\n />\n </svg>\n </div>`;\n }\n\n override render() {\n return html`\n <button\n class=${classMap({\n wrapper: true,\n ['variant-' + this.variant]: true,\n activated: this.activated,\n 'corner-left': this.cornerLeft,\n 'corner-right': this.cornerRight,\n 'active-color': this.activeColor,\n 'has-label': this.hasLabel,\n wide: this.wide,\n progress: this.progress !== undefined,\n 'hide-divider': !this.showDivider,\n })}\n ?disabled=${this.disabled}\n aria-label=${ifDefined(this.ariaLabel ?? undefined)}\n part=\"wrapper\"\n >\n ${this.progress !== undefined ? this.progressSpinner : nothing}\n <div class=\"visible-wrapper\" part=\"visible-wrapper\">\n <div class=\"icon\" part=\"icon\">\n <slot></slot>\n </div>\n </div>\n ${this.hasLabel\n ? html`<div class=\"label\" part=\"label\">\n <slot name=\"label\"></slot>\n </div>`\n : nothing}\n </button>\n `;\n }\n\n static override styles = unsafeCSS(iconStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-icon-button': ObcIconButton;\n }\n}\n"],"names":["IconButtonVariant"],"mappings":";;;;;;;;;;;;;;;;;AAeO,IAAK,sCAAAA,uBAAL;AACLA,qBAAA,QAAA,IAAS;AACTA,qBAAA,QAAA,IAAS;AACTA,qBAAA,MAAA,IAAO;AACPA,qBAAA,aAAA,IAAc;AAJJ,SAAAA;AAAA,GAAA,qBAAA,CAAA,CAAA;AA2FL,IAAM,gBAAN,cAA4B,WAAW;AAAA,EAAvC,cAAA;AAAA,UAAA,GAAA,SAAA;AAOqB,SAAA,UACxB;AAEyB,SAAA,YAAY;AAEZ,SAAA,aAAa;AAEb,SAAA,cAAc;AAEd,SAAA,cAAc;AAEd,SAAA,OAAO;AAEP,SAAA,WAAW;AAEZ,SAAA,WAA+B;AAE9B,SAAA,WAAoB;AAEF,SAAA,cAAc;AAI3D,SAAS,YAA2B;AAAA,EAAA;AAAA,EAEpC,IAAI,kBAAkB;AACpB,QAAI,KAAK,aAAa,QAAW;AAC/B,aAAO;AAAA,IACT;AACA,QAAI,KAAK,aAAa,KAAK;AACzB,aAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAkBT;AACA,UAAM,WAAW,SAAS,KAAK,WAAW,OAAO,GAAG;AACpD,UAAM,IAAI,KAAK,KAAK,KAAK,IAAI,QAAQ;AACrC,UAAM,IAAI,KAAK,KAAK,KAAK,IAAI,QAAQ;AACrC,UAAM,eAAe,WAAW,KAAK,KAAK,IAAI;AAC9C,WAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAiBmB,YAAY,MAAM,CAAC,IAAI,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GApBd,cAoBgB,WAAA,YAAA,CAAA;AAED,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GAtBb,cAsBe,WAAA,YAAA,CAAA;AAEC,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GAxBd,cAwBgB,WAAA,YAAA,CAAA;AAEkB,gBAAA;AAAA,EAA5C,SAAS,EAAC,MAAM,SAAS,WAAW,OAAM;AAAA,GA1BhC,cA0BkC,WAAA,eAAA,CAAA;AAIpC,gBAAA;AAAA,EADR,SAAS,EAAC,MAAM,QAAQ,WAAW,cAAa;AAAA,GA7BtC,cA8BF,WAAA,aAAA,CAAA;AA9BE,gBAAN,gBAAA;AAAA,EADN,cAAc,iBAAiB;AAAA,GACnB,aAAA;"}
|
|
@@ -424,6 +424,49 @@ const compentStyle = css`* {
|
|
|
424
424
|
flex-shrink: 0;
|
|
425
425
|
}
|
|
426
426
|
|
|
427
|
+
/* ---- Hierarchy ---- */
|
|
428
|
+
|
|
429
|
+
/*
|
|
430
|
+
* Indent gutter for a hierarchical row. One step per level plus one for
|
|
431
|
+
* the chevron itself, so a leaf and a group at the same level align.
|
|
432
|
+
*/
|
|
433
|
+
|
|
434
|
+
:is(:is(.grid-container .grid-row) .grid-cell) .row-expander {
|
|
435
|
+
--row-indent-step: var(
|
|
436
|
+
--menu-navigation-components-table-item-icon-size
|
|
437
|
+
);
|
|
438
|
+
/* Depth of this row; the row's inline style overrides it. */
|
|
439
|
+
--row-level: 0;
|
|
440
|
+
display: flex;
|
|
441
|
+
align-items: center;
|
|
442
|
+
justify-content: flex-end;
|
|
443
|
+
flex-shrink: 0;
|
|
444
|
+
align-self: stretch;
|
|
445
|
+
width: calc((var(--row-level) + 1) * var(--row-indent-step));
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
:is(:is(.grid-container .grid-row) .grid-cell) .row-expander .chevron {
|
|
449
|
+
display: flex;
|
|
450
|
+
align-items: center;
|
|
451
|
+
justify-content: center;
|
|
452
|
+
/* Pointer target floor, and the gutter is only one step wide. */
|
|
453
|
+
min-width: var(--row-indent-step);
|
|
454
|
+
min-height: var(--row-indent-step);
|
|
455
|
+
align-self: stretch;
|
|
456
|
+
color: var(--on-flat-neutral-color);
|
|
457
|
+
transition: transform 100ms ease-in-out;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
:is(:is(.grid-container .grid-row) .grid-cell) .row-expander .chevron.expanded {
|
|
461
|
+
transform: rotate(90deg);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
@media (prefers-reduced-motion: reduce) {
|
|
465
|
+
:is(:is(.grid-container .grid-row) .grid-cell) .row-expander .chevron {
|
|
466
|
+
transition: none;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
|
|
427
470
|
.large-icon:is(:is(.grid-container .grid-row) .grid-cell) .icon {
|
|
428
471
|
min-width: var(--menu-navigation-components-table-item-icon-size-large);
|
|
429
472
|
min-height: var(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"table.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -5,6 +5,7 @@ import { TagColor } from '../tag/tag.js';
|
|
|
5
5
|
import { ExternalScaleSide, FillMode, FrameStyle, InstrumentState, Priority, ScaleType } from '../../building-blocks/bar-horizontal/bar-horizontal.js';
|
|
6
6
|
import '../table-header-item/table-header-item.js';
|
|
7
7
|
import '../button/button.js';
|
|
8
|
+
import '../../icons/icon-chevron-right-google.js';
|
|
8
9
|
import '../../building-blocks/bar-horizontal/bar-horizontal.js';
|
|
9
10
|
export declare enum ObcTableCellType {
|
|
10
11
|
Regular = "regular",
|
|
@@ -95,7 +96,11 @@ export type ObcTableCellData = ObcTableCellDataRegular | ObcTableCellDataButton
|
|
|
95
96
|
export interface ObcTableRow {
|
|
96
97
|
selected?: boolean;
|
|
97
98
|
id: string;
|
|
98
|
-
|
|
99
|
+
parentId?: string;
|
|
100
|
+
level?: number;
|
|
101
|
+
expandable?: boolean;
|
|
102
|
+
expanded?: boolean;
|
|
103
|
+
[key: string]: ObcTableCellData | boolean | undefined | string | number;
|
|
99
104
|
}
|
|
100
105
|
export interface ObcTableColumnUnsortable<T extends ObcTableCellData, S extends ObcTableRow> {
|
|
101
106
|
label: string;
|
|
@@ -134,6 +139,10 @@ export type ObcTableSelectionChangeEvent = CustomEvent<{
|
|
|
134
139
|
export type ObcTableRowClickEvent = CustomEvent<{
|
|
135
140
|
row: ObcTableRow;
|
|
136
141
|
}>;
|
|
142
|
+
export type ObcTableExpandToggleEvent = CustomEvent<{
|
|
143
|
+
rowId: string;
|
|
144
|
+
expanded: boolean;
|
|
145
|
+
}>;
|
|
137
146
|
/**
|
|
138
147
|
* `<obc-table>` renders tabular data with configurable columns and cell types.
|
|
139
148
|
*
|
|
@@ -146,11 +155,17 @@ export type ObcTableRowClickEvent = CustomEvent<{
|
|
|
146
155
|
* - Cell rendering variants: `checkbox`, `tag`, `horizontal-bar`, and `button` cell types.
|
|
147
156
|
* - Visual variants: `rowDivider`, `striped`, `narrowHeader`, and `showHeader`.
|
|
148
157
|
* - Sorting support for sortable columns via column definitions.
|
|
158
|
+
* - Hierarchical rows via `parentId`, `level`, `expandable` and `expanded`.
|
|
149
159
|
*
|
|
150
160
|
* Usage Guidelines
|
|
151
161
|
* - Controlled selection: pass `selectedRowIds` and update it on `selection-change`.
|
|
152
162
|
* - Uncontrolled selection: pass `defaultSelectedRowIds` and listen to `selection-change`.
|
|
153
163
|
* - Use `selectAllAriaLabel` to customize the header checkbox accessibility label.
|
|
164
|
+
* - Hierarchy is controlled, and flat: pass only the rows that are currently
|
|
165
|
+
* visible, each with the `parentId` of its parent row, and drop a collapsed
|
|
166
|
+
* group's descendants from `data` on `expand-toggle`. The table draws the
|
|
167
|
+
* indent and the chevron, keeps each sibling set sorted within its parent,
|
|
168
|
+
* and owns no expansion state of its own.
|
|
154
169
|
*
|
|
155
170
|
* Slots/Content
|
|
156
171
|
* - This component does not expose public slots. Provide content via `data` and `columns`.
|
|
@@ -161,6 +176,15 @@ export type ObcTableRowClickEvent = CustomEvent<{
|
|
|
161
176
|
* - `cell-checkbox-change` fires when a checkbox cell changes.
|
|
162
177
|
* - `cell-tag-click` fires when a tag inside a cell is clicked.
|
|
163
178
|
* - `selection-change` fires when row selection changes (source: `row` or `header`).
|
|
179
|
+
* - `expand-toggle` fires when a group row's chevron or expand key is used.
|
|
180
|
+
*
|
|
181
|
+
* Accessibility
|
|
182
|
+
* A table with hierarchical rows renders as a
|
|
183
|
+
* [treegrid](https://www.w3.org/WAI/ARIA/apg/patterns/treegrid/): rows carry
|
|
184
|
+
* `aria-level`, and group rows `aria-expanded`. Right expands a collapsed
|
|
185
|
+
* group, Left collapses an expanded one or moves to the parent row. Cell-level
|
|
186
|
+
* arrow navigation, which the full pattern also specifies, is out of scope —
|
|
187
|
+
* arrow keys move between rows, matching the flat table.
|
|
164
188
|
*
|
|
165
189
|
* Best Practices
|
|
166
190
|
* - Keep column `key` values stable across renders to avoid selection or sorting resets.
|
|
@@ -187,6 +211,7 @@ export type ObcTableRowClickEvent = CustomEvent<{
|
|
|
187
211
|
* @fires {ObcTableCellCheckboxChangeEvent} cell-checkbox-change - Fired when a cell checkbox is changed.
|
|
188
212
|
* @fires {ObcTableCellTagClickEvent} cell-tag-click - Fired when a tag inside a cell is clicked.
|
|
189
213
|
* @fires {ObcTableSelectionChangeEvent} selection-change - Fired when row selection changes.
|
|
214
|
+
* @fires {ObcTableExpandToggleEvent} expand-toggle - Fired when a group row is expanded or collapsed.
|
|
190
215
|
* @beta
|
|
191
216
|
*/
|
|
192
217
|
export declare class ObcTable extends LitElement {
|
|
@@ -204,14 +229,19 @@ export declare class ObcTable extends LitElement {
|
|
|
204
229
|
private _sortDirection;
|
|
205
230
|
private _selectedRowIds;
|
|
206
231
|
private _previousPositions;
|
|
232
|
+
private get hasHierarchy();
|
|
233
|
+
private sortWithinSiblings;
|
|
207
234
|
get sortedData(): ObcTableRow[];
|
|
208
235
|
private _handleSortClick;
|
|
209
236
|
private _handleRowClick;
|
|
237
|
+
private _handleExpandToggle;
|
|
238
|
+
private _renderRowExpander;
|
|
210
239
|
private _focusFirstRow;
|
|
211
240
|
private _focusLeftHeaderItem;
|
|
212
241
|
private _focusHeaderByIndex;
|
|
213
242
|
private _handleHeaderKeyDown;
|
|
214
243
|
private _handleRowKeyDown;
|
|
244
|
+
private _handleRowExpandKey;
|
|
215
245
|
private _getAllPositions;
|
|
216
246
|
private _animateRowChanges;
|
|
217
247
|
private _hasRenderedRows;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/components/table/table.ts"],"names":[],"mappings":"AAA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AU,kBAqCb;IAED,OAAO,CAAC,gBAAgB;IAexB,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,mBAAmB;IAW3B,OAAO,CAAC,kBAAkB;IAyB1B,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,oBAAoB;IAI5B,OAAO,CAAC,mBAAmB;IAc3B,OAAO,CAAC,oBAAoB;IAqC5B,OAAO,CAAC,iBAAiB;IA+DzB,OAAO,CAAC,mBAAmB;IA+B3B,OAAO,CAAC,gBAAgB;IAiCxB,OAAO,CAAC,kBAAkB;IA0B1B,OAAO,CAAC,gBAAgB,CAAS;IAExB,UAAU,CAAC,iBAAiB,EAAE,cAAc;IAwC5C,OAAO,CAAC,iBAAiB,EAAE,cAAc;IA8BlD,OAAO,CAAC,gBAAgB;IAKf,MAAM;IAkPR,iBAAiB,IAAI,MAAM,EAAE;IA0BpC,OAAO,CAAC,sBAAsB;IAa9B,OAAO,CAAC,mBAAmB;IAc3B,OAAO,CAAC,yBAAyB;IAqBjC,OAAO,CAAC,oBAAoB;IAI5B,OAAO,CAAC,mBAAmB;IAW3B,OAAO,CAAC,oBAAoB;IAgB5B,OAAO,CAAC,qBAAqB;IAY7B,OAAO,CAAC,mBAAmB;IAU3B,OAAO,CAAC,mBAAmB;IAQ3B,OAAO,CAAC,WAAW;IA6MnB,OAAgB,MAAM,0BAA2B;CAClD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,QAAQ,CAAC;KACvB;CACF"}
|
|
@@ -5,6 +5,7 @@ import { property, state } from "lit/decorators.js";
|
|
|
5
5
|
import { ObcTableHeaderItemType } from "../table-header-item/table-header-item.js";
|
|
6
6
|
import { classMap } from "lit/directives/class-map.js";
|
|
7
7
|
import "../button/button.js";
|
|
8
|
+
import "../../icons/icon-chevron-right-google.js";
|
|
8
9
|
import { CheckboxStatus } from "../checkbox/checkbox.js";
|
|
9
10
|
import { TagColor } from "../tag/tag.js";
|
|
10
11
|
import "../../building-blocks/bar-horizontal/bar-horizontal.js";
|
|
@@ -54,6 +55,41 @@ let ObcTable = class extends LitElement {
|
|
|
54
55
|
this._previousPositions = [];
|
|
55
56
|
this._hasRenderedRows = false;
|
|
56
57
|
}
|
|
58
|
+
get hasHierarchy() {
|
|
59
|
+
return this.data.some(
|
|
60
|
+
(row) => row.parentId !== void 0 || (row.level ?? 0) > 0 || row.expandable === true
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
sortWithinSiblings(rows, compare) {
|
|
64
|
+
const ids = new Set(rows.map((row) => row.id));
|
|
65
|
+
const childrenByParent = /* @__PURE__ */ new Map();
|
|
66
|
+
const roots = [];
|
|
67
|
+
for (const row of rows) {
|
|
68
|
+
const parentId = row.parentId;
|
|
69
|
+
if (parentId !== void 0 && parentId !== row.id && ids.has(parentId)) {
|
|
70
|
+
const siblings = childrenByParent.get(parentId) ?? [];
|
|
71
|
+
siblings.push(row);
|
|
72
|
+
childrenByParent.set(parentId, siblings);
|
|
73
|
+
} else {
|
|
74
|
+
roots.push(row);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const sorted = [];
|
|
78
|
+
const visited = /* @__PURE__ */ new Set();
|
|
79
|
+
const visit = (siblings) => {
|
|
80
|
+
for (const row of [...siblings].sort(compare)) {
|
|
81
|
+
if (visited.has(row.id)) {
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
visited.add(row.id);
|
|
85
|
+
sorted.push(row);
|
|
86
|
+
visit(childrenByParent.get(row.id) ?? []);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
visit(roots);
|
|
90
|
+
visit(rows.filter((row) => !visited.has(row.id)));
|
|
91
|
+
return sorted;
|
|
92
|
+
}
|
|
57
93
|
get sortedData() {
|
|
58
94
|
if (this._sortByColumnIdx === void 0) {
|
|
59
95
|
return this.data;
|
|
@@ -64,8 +100,7 @@ let ObcTable = class extends LitElement {
|
|
|
64
100
|
return this.data;
|
|
65
101
|
}
|
|
66
102
|
const sortDirection = this._sortDirection;
|
|
67
|
-
const
|
|
68
|
-
sortedData.sort((a, b) => {
|
|
103
|
+
const compare = (a, b) => {
|
|
69
104
|
const aValue = a[sortByColumn.key];
|
|
70
105
|
const bValue = b[sortByColumn.key];
|
|
71
106
|
if (sortDirection === "asc") {
|
|
@@ -83,7 +118,12 @@ let ObcTable = class extends LitElement {
|
|
|
83
118
|
a
|
|
84
119
|
);
|
|
85
120
|
}
|
|
86
|
-
}
|
|
121
|
+
};
|
|
122
|
+
if (this.hasHierarchy) {
|
|
123
|
+
return this.sortWithinSiblings(this.data, compare);
|
|
124
|
+
}
|
|
125
|
+
const sortedData = [...this.data];
|
|
126
|
+
sortedData.sort(compare);
|
|
87
127
|
return sortedData;
|
|
88
128
|
}
|
|
89
129
|
_handleSortClick(column) {
|
|
@@ -103,6 +143,38 @@ let ObcTable = class extends LitElement {
|
|
|
103
143
|
new CustomEvent("row-click", { detail: { row } })
|
|
104
144
|
);
|
|
105
145
|
}
|
|
146
|
+
_handleExpandToggle(row, expanded) {
|
|
147
|
+
if (!row.expandable) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
this.dispatchEvent(
|
|
151
|
+
new CustomEvent("expand-toggle", {
|
|
152
|
+
detail: { rowId: row.id, expanded }
|
|
153
|
+
})
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
_renderRowExpander(row) {
|
|
157
|
+
if (!this.hasHierarchy) {
|
|
158
|
+
return nothing;
|
|
159
|
+
}
|
|
160
|
+
const level = row.level ?? 0;
|
|
161
|
+
return html`<span
|
|
162
|
+
class="row-expander"
|
|
163
|
+
style="--row-level: ${level}"
|
|
164
|
+
aria-hidden="true"
|
|
165
|
+
>
|
|
166
|
+
${row.expandable ? html`<span
|
|
167
|
+
class=${classMap({ chevron: true, expanded: row.expanded ?? false })}
|
|
168
|
+
@click=${(event) => {
|
|
169
|
+
event.preventDefault();
|
|
170
|
+
event.stopPropagation();
|
|
171
|
+
this._handleExpandToggle(row, !(row.expanded ?? false));
|
|
172
|
+
}}
|
|
173
|
+
>
|
|
174
|
+
<obi-chevron-right-google></obi-chevron-right-google>
|
|
175
|
+
</span>` : nothing}
|
|
176
|
+
</span>`;
|
|
177
|
+
}
|
|
106
178
|
_focusFirstRow() {
|
|
107
179
|
const firstRow = this.renderRoot.querySelector(
|
|
108
180
|
'button[role="row"].grid-row'
|
|
@@ -153,6 +225,9 @@ let ObcTable = class extends LitElement {
|
|
|
153
225
|
}
|
|
154
226
|
_handleRowKeyDown(event) {
|
|
155
227
|
const key = event.key;
|
|
228
|
+
if (this.hasHierarchy && (key === "ArrowRight" || key === "ArrowLeft") && this._handleRowExpandKey(event, key)) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
156
231
|
if (key !== "ArrowDown" && key !== "ArrowUp" && key !== "Home" && key !== "End") {
|
|
157
232
|
return;
|
|
158
233
|
}
|
|
@@ -195,6 +270,31 @@ let ObcTable = class extends LitElement {
|
|
|
195
270
|
event.stopPropagation();
|
|
196
271
|
}
|
|
197
272
|
}
|
|
273
|
+
_handleRowExpandKey(event, key) {
|
|
274
|
+
const target = event.currentTarget;
|
|
275
|
+
const rowId = target?.dataset.rowId;
|
|
276
|
+
const row = this.sortedData.find((candidate) => candidate.id === rowId);
|
|
277
|
+
if (!row) return false;
|
|
278
|
+
const expanded = row.expanded ?? false;
|
|
279
|
+
if (key === "ArrowRight" && row.expandable && !expanded) {
|
|
280
|
+
this._handleExpandToggle(row, true);
|
|
281
|
+
} else if (key === "ArrowLeft" && row.expandable && expanded) {
|
|
282
|
+
this._handleExpandToggle(row, false);
|
|
283
|
+
} else if (key === "ArrowLeft") {
|
|
284
|
+
const parent = this.renderRoot.querySelector(
|
|
285
|
+
`button[role="row"].grid-row[data-row-id="${CSS.escape(
|
|
286
|
+
row.parentId ?? ""
|
|
287
|
+
)}"]`
|
|
288
|
+
);
|
|
289
|
+
if (!parent) return false;
|
|
290
|
+
parent.focus();
|
|
291
|
+
} else {
|
|
292
|
+
return false;
|
|
293
|
+
}
|
|
294
|
+
event.preventDefault();
|
|
295
|
+
event.stopPropagation();
|
|
296
|
+
return true;
|
|
297
|
+
}
|
|
198
298
|
_getAllPositions() {
|
|
199
299
|
const rows = Array.from(
|
|
200
300
|
this.renderRoot.querySelectorAll(
|
|
@@ -313,7 +413,7 @@ let ObcTable = class extends LitElement {
|
|
|
313
413
|
--grid-columns-rest: ${selectionColumnCount};
|
|
314
414
|
--selection-column-width: var(--menu-navigation-components-table-item-touch-target-size);
|
|
315
415
|
"
|
|
316
|
-
role
|
|
416
|
+
role=${this.hasHierarchy ? "treegrid" : "table"}
|
|
317
417
|
>
|
|
318
418
|
${this.showHeader ? html`
|
|
319
419
|
<div class="grid-header" role="row">
|
|
@@ -410,8 +510,15 @@ let ObcTable = class extends LitElement {
|
|
|
410
510
|
data-row-id=${row.id}
|
|
411
511
|
style="grid-row: ${rowIndex + 1}"
|
|
412
512
|
part="row"
|
|
513
|
+
aria-level=${ifDefined(
|
|
514
|
+
this.hasHierarchy ? (row.level ?? 0) + 1 : void 0
|
|
515
|
+
)}
|
|
516
|
+
aria-expanded=${ifDefined(
|
|
517
|
+
row.expandable ? row.expanded ?? false : void 0
|
|
518
|
+
)}
|
|
413
519
|
>
|
|
414
|
-
${map(effectiveColumns, (col) => {
|
|
520
|
+
${map(effectiveColumns, (col, colIndex) => {
|
|
521
|
+
const expander = colIndex === (this.selectable ? 1 : 0) ? this._renderRowExpander(row) : nothing;
|
|
415
522
|
if (this.selectable && col.key === "__selection__") {
|
|
416
523
|
const checked = this._selectedRowIds.has(row.id);
|
|
417
524
|
return html`<div
|
|
@@ -432,7 +539,9 @@ let ObcTable = class extends LitElement {
|
|
|
432
539
|
}
|
|
433
540
|
const value = row[col.key];
|
|
434
541
|
if (value === void 0) {
|
|
435
|
-
return html`<div class="grid-cell" role="cell"
|
|
542
|
+
return html`<div class="grid-cell" role="cell">
|
|
543
|
+
${expander}
|
|
544
|
+
</div>`;
|
|
436
545
|
}
|
|
437
546
|
if (col.renderCell) {
|
|
438
547
|
return html`<div
|
|
@@ -440,7 +549,7 @@ let ObcTable = class extends LitElement {
|
|
|
440
549
|
role="cell"
|
|
441
550
|
part=${ifDefined(value.cssPart)}
|
|
442
551
|
>
|
|
443
|
-
${col.renderCell(
|
|
552
|
+
${expander}${col.renderCell(
|
|
444
553
|
value,
|
|
445
554
|
row,
|
|
446
555
|
row.id
|
|
@@ -450,7 +559,8 @@ let ObcTable = class extends LitElement {
|
|
|
450
559
|
return this._renderCell(
|
|
451
560
|
value,
|
|
452
561
|
row,
|
|
453
|
-
col
|
|
562
|
+
col,
|
|
563
|
+
expander
|
|
454
564
|
);
|
|
455
565
|
}
|
|
456
566
|
})}
|
|
@@ -568,7 +678,7 @@ let ObcTable = class extends LitElement {
|
|
|
568
678
|
const nextSelection = status === CheckboxStatus.checked ? /* @__PURE__ */ new Set() : new Set(rowIds);
|
|
569
679
|
this._applySelectionChange(nextSelection, "header");
|
|
570
680
|
}
|
|
571
|
-
_renderCell(value, row, column) {
|
|
681
|
+
_renderCell(value, row, column, expander = nothing) {
|
|
572
682
|
if (value.type === "regular") {
|
|
573
683
|
return html`<div
|
|
574
684
|
class=${classMap({
|
|
@@ -584,7 +694,7 @@ let ObcTable = class extends LitElement {
|
|
|
584
694
|
role="cell"
|
|
585
695
|
part=${ifDefined(cssPart(value, "cell"))}
|
|
586
696
|
>
|
|
587
|
-
${value.icon3 ? html`<span class="icon" part=${ifDefined(cssPart(value, "icon3"))}
|
|
697
|
+
${expander}${value.icon3 ? html`<span class="icon" part=${ifDefined(cssPart(value, "icon3"))}
|
|
588
698
|
>${value.icon3}</span
|
|
589
699
|
>` : nothing}
|
|
590
700
|
${value.icon2 ? html`<span class="icon" part=${ifDefined(cssPart(value, "icon2"))}
|
|
@@ -605,6 +715,7 @@ let ObcTable = class extends LitElement {
|
|
|
605
715
|
class="grid-cell button ${column.dividerRight ? "divider-right" : ""}"
|
|
606
716
|
role="cell"
|
|
607
717
|
>
|
|
718
|
+
${expander}
|
|
608
719
|
<obc-button
|
|
609
720
|
variant="normal"
|
|
610
721
|
fullWidth
|
|
@@ -636,6 +747,7 @@ let ObcTable = class extends LitElement {
|
|
|
636
747
|
role="cell"
|
|
637
748
|
part=${ifDefined(cssPart(value, "cell"))}
|
|
638
749
|
>
|
|
750
|
+
${expander}
|
|
639
751
|
<obc-checkbox
|
|
640
752
|
.status=${value.status ?? CheckboxStatus.unchecked}
|
|
641
753
|
.disabled=${value.disabled ?? false}
|
|
@@ -676,7 +788,7 @@ let ObcTable = class extends LitElement {
|
|
|
676
788
|
role="cell"
|
|
677
789
|
part=${ifDefined(cssPart(value, "cell"))}
|
|
678
790
|
>
|
|
679
|
-
${visibleTags.map((tag) => {
|
|
791
|
+
${expander}${visibleTags.map((tag) => {
|
|
680
792
|
const hasIcon = tag.hasIcon ?? tag.icon !== void 0;
|
|
681
793
|
return html`<obc-tag
|
|
682
794
|
.label=${tag.label}
|
|
@@ -711,6 +823,7 @@ let ObcTable = class extends LitElement {
|
|
|
711
823
|
role="cell"
|
|
712
824
|
part=${ifDefined(cssPart(value, "cell"))}
|
|
713
825
|
>
|
|
826
|
+
${expander}
|
|
714
827
|
<obc-bar-horizontal
|
|
715
828
|
.minValue=${value.minValue ?? 0}
|
|
716
829
|
.maxValue=${value.maxValue ?? 100}
|