@carbon/web-components 2.38.0 → 2.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +643 -88
- package/dist/ai-label.min.js +1 -1
- package/dist/data-table.min.js +53 -42
- package/dist/date-picker.min.js +1 -1
- package/dist/feature-flags.min.js +1 -1
- package/dist/fluid-text-input.min.js +28 -0
- package/dist/menu-button.min.js +1 -1
- package/dist/modal.min.js +8 -8
- package/dist/notification.min.js +5 -3
- package/dist/number-input.min.js +1 -1
- package/dist/pagination.min.js +1 -1
- package/dist/password-input.min.js +1 -1
- package/dist/radio-button.min.js +4 -3
- package/dist/{search-5sjwuFeV.js → search-DRY-RtlJ.js} +1 -1
- package/dist/search.min.js +1 -1
- package/dist/{select-N1IlMFgF.js → select-Z7wZH7hh.js} +1 -1
- package/dist/select.min.js +1 -1
- package/dist/slug.min.js +1 -1
- package/dist/tabs.min.js +9 -8
- package/dist/{text-input-FSx1F405.js → text-input-B80oQMaX.js} +42 -36
- package/dist/text-input.min.js +2 -2
- package/dist/textarea.min.js +1 -1
- package/dist/toggle-tip.min.js +1 -1
- package/dist/toggle.min.js +1 -1
- package/es/components/ai-label/ai-label.scss.js +1 -1
- package/es/components/data-table/data-table.scss.js +1 -1
- package/es/components/data-table/table-batch-actions.d.ts +16 -1
- package/es/components/data-table/table-batch-actions.js +43 -5
- package/es/components/data-table/table-batch-actions.js.map +1 -1
- package/es/components/data-table/table-row.js +16 -9
- package/es/components/data-table/table-row.js.map +1 -1
- package/es/components/data-table/table.js +9 -2
- package/es/components/data-table/table.js.map +1 -1
- package/es/components/fluid-text-input/fluid-text-input-skeleton.d.ts +17 -0
- package/es/components/fluid-text-input/fluid-text-input-skeleton.js +38 -0
- package/es/components/fluid-text-input/fluid-text-input-skeleton.js.map +1 -0
- package/es/components/fluid-text-input/fluid-text-input.d.ts +19 -0
- package/es/components/fluid-text-input/fluid-text-input.js +49 -0
- package/es/components/fluid-text-input/fluid-text-input.js.map +1 -0
- package/es/components/fluid-text-input/fluid-text-input.scss.js +13 -0
- package/es/components/fluid-text-input/fluid-text-input.scss.js.map +1 -0
- package/es/components/fluid-text-input/index.d.ts +8 -0
- package/es/components/fluid-text-input/index.js +10 -0
- package/es/components/fluid-text-input/index.js.map +1 -0
- package/es/components/menu-button/defs.d.ts +4 -0
- package/es/components/menu-button/defs.js +4 -0
- package/es/components/menu-button/defs.js.map +1 -1
- package/es/components/modal/modal.scss.js +1 -1
- package/es/components/notification/toast-notification.js +7 -3
- package/es/components/notification/toast-notification.js.map +1 -1
- package/es/components/radio-button/radio-button-group.d.ts +4 -0
- package/es/components/radio-button/radio-button-group.js +22 -2
- package/es/components/radio-button/radio-button-group.js.map +1 -1
- package/es/components/radio-button/radio-button.d.ts +8 -0
- package/es/components/radio-button/radio-button.js +27 -0
- package/es/components/radio-button/radio-button.js.map +1 -1
- package/es/components/radio-button/radio-button.scss.js +1 -1
- package/es/components/slug/slug.scss.js +1 -1
- package/es/components/tabs/tab-skeleton.js +5 -1
- package/es/components/tabs/tab-skeleton.js.map +1 -1
- package/es/components/tabs/tabs-skeleton.d.ts +4 -0
- package/es/components/tabs/tabs-skeleton.js +11 -3
- package/es/components/tabs/tabs-skeleton.js.map +1 -1
- package/es/components/tabs/tabs.scss.js +1 -1
- package/es/components/text-input/text-input.d.ts +1 -0
- package/es/components/text-input/text-input.js +26 -11
- package/es/components/text-input/text-input.js.map +1 -1
- package/es/components/toggle/toggle.js +1 -1
- package/es/components/toggle/toggle.js.map +1 -1
- package/es/components/toggle/toggle.scss.js +1 -1
- package/es/components/toggle-tip/toggletip.scss.js +1 -1
- package/es/feature-flags/es/index.js +14 -0
- package/es/feature-flags/es/index.js.map +1 -1
- package/es-custom/components/ai-label/ai-label.scss.js +1 -1
- package/es-custom/components/data-table/data-table.scss.js +1 -1
- package/es-custom/components/data-table/table-batch-actions.d.ts +16 -1
- package/es-custom/components/data-table/table-batch-actions.js +43 -5
- package/es-custom/components/data-table/table-batch-actions.js.map +1 -1
- package/es-custom/components/data-table/table-row.js +16 -9
- package/es-custom/components/data-table/table-row.js.map +1 -1
- package/es-custom/components/data-table/table.js +9 -2
- package/es-custom/components/data-table/table.js.map +1 -1
- package/es-custom/components/fluid-text-input/fluid-text-input-skeleton.d.ts +17 -0
- package/es-custom/components/fluid-text-input/fluid-text-input-skeleton.js +38 -0
- package/es-custom/components/fluid-text-input/fluid-text-input-skeleton.js.map +1 -0
- package/es-custom/components/fluid-text-input/fluid-text-input.d.ts +19 -0
- package/es-custom/components/fluid-text-input/fluid-text-input.js +49 -0
- package/es-custom/components/fluid-text-input/fluid-text-input.js.map +1 -0
- package/es-custom/components/fluid-text-input/fluid-text-input.scss.js +13 -0
- package/es-custom/components/fluid-text-input/fluid-text-input.scss.js.map +1 -0
- package/es-custom/components/fluid-text-input/index.d.ts +8 -0
- package/es-custom/components/fluid-text-input/index.js +10 -0
- package/es-custom/components/fluid-text-input/index.js.map +1 -0
- package/es-custom/components/menu-button/defs.d.ts +4 -0
- package/es-custom/components/menu-button/defs.js +4 -0
- package/es-custom/components/menu-button/defs.js.map +1 -1
- package/es-custom/components/modal/modal.scss.js +1 -1
- package/es-custom/components/notification/toast-notification.js +7 -3
- package/es-custom/components/notification/toast-notification.js.map +1 -1
- package/es-custom/components/radio-button/radio-button-group.d.ts +4 -0
- package/es-custom/components/radio-button/radio-button-group.js +22 -2
- package/es-custom/components/radio-button/radio-button-group.js.map +1 -1
- package/es-custom/components/radio-button/radio-button.d.ts +8 -0
- package/es-custom/components/radio-button/radio-button.js +27 -0
- package/es-custom/components/radio-button/radio-button.js.map +1 -1
- package/es-custom/components/radio-button/radio-button.scss.js +1 -1
- package/es-custom/components/slug/slug.scss.js +1 -1
- package/es-custom/components/tabs/tab-skeleton.js +5 -1
- package/es-custom/components/tabs/tab-skeleton.js.map +1 -1
- package/es-custom/components/tabs/tabs-skeleton.d.ts +4 -0
- package/es-custom/components/tabs/tabs-skeleton.js +11 -3
- package/es-custom/components/tabs/tabs-skeleton.js.map +1 -1
- package/es-custom/components/tabs/tabs.scss.js +1 -1
- package/es-custom/components/text-input/text-input.d.ts +1 -0
- package/es-custom/components/text-input/text-input.js +26 -11
- package/es-custom/components/text-input/text-input.js.map +1 -1
- package/es-custom/components/toggle/toggle.js +1 -1
- package/es-custom/components/toggle/toggle.js.map +1 -1
- package/es-custom/components/toggle/toggle.scss.js +1 -1
- package/es-custom/components/toggle-tip/toggletip.scss.js +1 -1
- package/es-custom/feature-flags/es/index.js +14 -0
- package/es-custom/feature-flags/es/index.js.map +1 -1
- package/lib/components/data-table/table-batch-actions.d.ts +16 -1
- package/lib/components/fluid-text-input/fluid-text-input-skeleton.d.ts +17 -0
- package/lib/components/fluid-text-input/fluid-text-input.d.ts +19 -0
- package/lib/components/fluid-text-input/index.d.ts +8 -0
- package/lib/components/menu-button/defs.d.ts +4 -0
- package/lib/components/menu-button/defs.js +4 -0
- package/lib/components/menu-button/defs.js.map +1 -1
- package/lib/components/radio-button/radio-button-group.d.ts +4 -0
- package/lib/components/radio-button/radio-button.d.ts +8 -0
- package/lib/components/tabs/tabs-skeleton.d.ts +4 -0
- package/lib/components/text-input/text-input.d.ts +1 -0
- package/package.json +7 -7
- package/scss/components/data-table/_table-expandable.scss +49 -0
- package/scss/components/fluid-text-input/fluid-text-input.scss +25 -0
- package/scss/components/radio-button/radio-button.scss +2 -1
- package/scss/components/tabs/tabs.scss +50 -4
- package/scss/components/toggle/toggle.scss +11 -0
- package/telemetry.yml +5 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2019,
|
|
2
|
+
* Copyright IBM Corp. 2019, 2025
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -10,12 +10,17 @@ import { LitElement } from 'lit';
|
|
|
10
10
|
*
|
|
11
11
|
* @element cds-custom-table-batch-actions
|
|
12
12
|
* @fires cds-custom-table-batch-actions-cancel-clicked - The custom event fired after the Cancel button is clicked.
|
|
13
|
+
* @fires cds-custom-table-batch-actions-select-all-clicked - The custom event fired after the Select all button is clicked.
|
|
13
14
|
*/
|
|
14
15
|
declare class CDSTableBatchActions extends LitElement {
|
|
15
16
|
/**
|
|
16
17
|
* Handles `click` event on the Cancel button.
|
|
17
18
|
*/
|
|
18
19
|
private _handleCancel;
|
|
20
|
+
/**
|
|
21
|
+
* Handles `click` event on the Select all button.
|
|
22
|
+
*/
|
|
23
|
+
private _handleSelectAll;
|
|
19
24
|
/**
|
|
20
25
|
* `true` if this batch actions bar should be active.
|
|
21
26
|
*/
|
|
@@ -31,6 +36,12 @@ declare class CDSTableBatchActions extends LitElement {
|
|
|
31
36
|
* This number is used to derive the selection message.
|
|
32
37
|
*/
|
|
33
38
|
selectedRowsCount: number;
|
|
39
|
+
/**
|
|
40
|
+
* Numeric representation of the total number of items in a table.
|
|
41
|
+
* This number is used in the select all button text
|
|
42
|
+
* This property controls the rendering of the Select all button
|
|
43
|
+
*/
|
|
44
|
+
totalRowsCount: number;
|
|
34
45
|
/**
|
|
35
46
|
* The table size.
|
|
36
47
|
*/
|
|
@@ -48,6 +59,10 @@ declare class CDSTableBatchActions extends LitElement {
|
|
|
48
59
|
* The name of the custom event fired after the Cancel button is clicked.
|
|
49
60
|
*/
|
|
50
61
|
static get eventClickCancel(): string;
|
|
62
|
+
/**
|
|
63
|
+
* The name of the custom event fired after the Select all button is clicked.
|
|
64
|
+
*/
|
|
65
|
+
static get eventClickSelectAll(): string;
|
|
51
66
|
static styles: any;
|
|
52
67
|
}
|
|
53
68
|
export default CDSTableBatchActions;
|
|
@@ -6,25 +6,27 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { __decorate } from 'tslib';
|
|
9
|
-
import { LitElement, html } from 'lit';
|
|
9
|
+
import { LitElement, nothing, html } from 'lit';
|
|
10
10
|
import { property } from 'lit/decorators.js';
|
|
11
11
|
import { prefix } from '../../globals/settings.js';
|
|
12
12
|
import styles from './data-table.scss.js';
|
|
13
13
|
import { carbonElement } from '../../globals/decorators/carbon-element.js';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* Copyright IBM Corp. 2019,
|
|
16
|
+
* Copyright IBM Corp. 2019, 2025
|
|
17
17
|
*
|
|
18
18
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
19
19
|
* LICENSE file in the root directory of this source tree.
|
|
20
20
|
*/
|
|
21
|
+
var CDSTableBatchActions_1;
|
|
21
22
|
/**
|
|
22
23
|
* Table batch actions.
|
|
23
24
|
*
|
|
24
25
|
* @element cds-custom-table-batch-actions
|
|
25
26
|
* @fires cds-custom-table-batch-actions-cancel-clicked - The custom event fired after the Cancel button is clicked.
|
|
27
|
+
* @fires cds-custom-table-batch-actions-select-all-clicked - The custom event fired after the Select all button is clicked.
|
|
26
28
|
*/
|
|
27
|
-
let CDSTableBatchActions = class CDSTableBatchActions extends LitElement {
|
|
29
|
+
let CDSTableBatchActions = CDSTableBatchActions_1 = class CDSTableBatchActions extends LitElement {
|
|
28
30
|
constructor() {
|
|
29
31
|
super(...arguments);
|
|
30
32
|
/**
|
|
@@ -40,6 +42,12 @@ let CDSTableBatchActions = class CDSTableBatchActions extends LitElement {
|
|
|
40
42
|
* This number is used to derive the selection message.
|
|
41
43
|
*/
|
|
42
44
|
this.selectedRowsCount = 0;
|
|
45
|
+
/**
|
|
46
|
+
* Numeric representation of the total number of items in a table.
|
|
47
|
+
* This number is used in the select all button text
|
|
48
|
+
* This property controls the rendering of the Select all button
|
|
49
|
+
*/
|
|
50
|
+
this.totalRowsCount = 0;
|
|
43
51
|
/**
|
|
44
52
|
* The table size.
|
|
45
53
|
*/
|
|
@@ -53,6 +61,15 @@ let CDSTableBatchActions = class CDSTableBatchActions extends LitElement {
|
|
|
53
61
|
.constructor;
|
|
54
62
|
this.dispatchEvent(new CustomEvent(eventClickCancel, { bubbles: true, composed: true }));
|
|
55
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Handles `click` event on the Select all button.
|
|
66
|
+
*/
|
|
67
|
+
_handleSelectAll() {
|
|
68
|
+
this.dispatchEvent(new CustomEvent(CDSTableBatchActions_1.eventClickSelectAll, {
|
|
69
|
+
bubbles: true,
|
|
70
|
+
composed: true,
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
56
73
|
firstUpdated() {
|
|
57
74
|
this._updateButtons();
|
|
58
75
|
this._setupHoverListeners();
|
|
@@ -98,13 +115,25 @@ let CDSTableBatchActions = class CDSTableBatchActions extends LitElement {
|
|
|
98
115
|
});
|
|
99
116
|
}
|
|
100
117
|
render() {
|
|
101
|
-
const { formatSelectedItemsCount, selectedRowsCount, _handleCancel: handleCancel, size, } = this;
|
|
118
|
+
const { formatSelectedItemsCount, selectedRowsCount, totalRowsCount, _handleCancel: handleCancel, _handleSelectAll: handleSelectAll, size, } = this;
|
|
102
119
|
const buttonSize = size === 'xs' || size === 'sm' ? 'sm' : 'lg';
|
|
103
120
|
return html `
|
|
104
121
|
<div class="${prefix}--batch-summary">
|
|
105
122
|
<p class="${prefix}--batch-summary__para">
|
|
106
123
|
${formatSelectedItemsCount({ count: selectedRowsCount })}
|
|
107
124
|
</p>
|
|
125
|
+
${totalRowsCount > 0
|
|
126
|
+
? html `
|
|
127
|
+
<span class="${prefix}--batch-summary__divider">|</span>
|
|
128
|
+
<button
|
|
129
|
+
class="${prefix}--btn ${prefix}--btn--primary ${prefix}--batch-summary__select-all"
|
|
130
|
+
@click=${handleSelectAll}>
|
|
131
|
+
<slot name="select-all-button-content"
|
|
132
|
+
>Select all (${totalRowsCount})</slot
|
|
133
|
+
>
|
|
134
|
+
</button>
|
|
135
|
+
`
|
|
136
|
+
: nothing}
|
|
108
137
|
</div>
|
|
109
138
|
|
|
110
139
|
<div class="${prefix}--action-list">
|
|
@@ -132,6 +161,12 @@ let CDSTableBatchActions = class CDSTableBatchActions extends LitElement {
|
|
|
132
161
|
static get eventClickCancel() {
|
|
133
162
|
return `${prefix}-table-batch-actions-cancel-clicked`;
|
|
134
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* The name of the custom event fired after the Select all button is clicked.
|
|
166
|
+
*/
|
|
167
|
+
static get eventClickSelectAll() {
|
|
168
|
+
return `${prefix}-table-batch-actions-select-all-clicked`;
|
|
169
|
+
}
|
|
135
170
|
};
|
|
136
171
|
CDSTableBatchActions.styles = styles;
|
|
137
172
|
__decorate([
|
|
@@ -143,10 +178,13 @@ __decorate([
|
|
|
143
178
|
__decorate([
|
|
144
179
|
property({ type: Number, attribute: 'selected-rows-count' })
|
|
145
180
|
], CDSTableBatchActions.prototype, "selectedRowsCount", void 0);
|
|
181
|
+
__decorate([
|
|
182
|
+
property({ type: Number, attribute: 'total-rows-count' })
|
|
183
|
+
], CDSTableBatchActions.prototype, "totalRowsCount", void 0);
|
|
146
184
|
__decorate([
|
|
147
185
|
property({ reflect: true })
|
|
148
186
|
], CDSTableBatchActions.prototype, "size", void 0);
|
|
149
|
-
CDSTableBatchActions = __decorate([
|
|
187
|
+
CDSTableBatchActions = CDSTableBatchActions_1 = __decorate([
|
|
150
188
|
carbonElement(`${prefix}-table-batch-actions`)
|
|
151
189
|
], CDSTableBatchActions);
|
|
152
190
|
var CDSTableBatchActions$1 = CDSTableBatchActions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-batch-actions.js","sources":["../../../src/components/data-table/table-batch-actions.ts"],"sourcesContent":["/**\n * Copyright IBM Corp. 2019, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { LitElement, html } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { prefix } from '../../globals/settings';\nimport styles from './data-table.scss?lit';\nimport { carbonElement as customElement } from '../../globals/decorators/carbon-element';\n\n/**\n * Table batch actions.\n *\n * @element cds-custom-table-batch-actions\n * @fires cds-custom-table-batch-actions-cancel-clicked - The custom event fired after the Cancel button is clicked.\n */\n\n@customElement(`${prefix}-table-batch-actions`)\nclass CDSTableBatchActions extends LitElement {\n /**\n * Handles `click` event on the Cancel button.\n */\n private _handleCancel() {\n const { eventClickCancel } = this\n .constructor as typeof CDSTableBatchActions;\n this.dispatchEvent(\n new CustomEvent(eventClickCancel, { bubbles: true, composed: true })\n );\n }\n\n /**\n * `true` if this batch actions bar should be active.\n */\n @property({ type: Boolean, reflect: true })\n active = false;\n\n /**\n * The formatter for selected items. Should be changed upon the locale the UI is rendered with.\n */\n @property({ attribute: false })\n formatSelectedItemsCount = ({ count }) =>\n `${count} item${count <= 1 ? '' : 's'} selected`;\n\n /**\n * Numeric representation of the total number of items selected in a table.\n * This number is used to derive the selection message.\n */\n @property({ type: Number, attribute: 'selected-rows-count' })\n selectedRowsCount = 0;\n\n /**\n * The table size.\n */\n @property({ reflect: true })\n size = 'lg';\n\n firstUpdated() {\n this._updateButtons();\n this._setupHoverListeners();\n }\n\n private _setupHoverListeners() {\n const slot = this.shadowRoot?.querySelector('slot');\n const cancelButton = this.shadowRoot?.querySelector(\n `${prefix}-button.${prefix}--batch-summary__cancel`\n ) as HTMLElement;\n\n if (slot && cancelButton) {\n const setupListeners = () => {\n const buttons = slot.assignedElements();\n const lastButton = buttons[buttons.length - 1] as HTMLElement;\n\n if (lastButton) {\n const handleEnter = () => {\n cancelButton.style.setProperty('--divider-opacity', '0');\n };\n\n const handleLeave = () => {\n cancelButton.style.setProperty('--divider-opacity', '1');\n };\n\n lastButton.removeEventListener('mouseenter', handleEnter);\n lastButton.removeEventListener('mouseleave', handleLeave);\n\n lastButton.addEventListener('mouseenter', handleEnter);\n lastButton.addEventListener('mouseleave', handleLeave);\n }\n };\n\n setupListeners();\n slot.addEventListener('slotchange', setupListeners);\n }\n }\n\n updated(changedProperties) {\n if (changedProperties.has('active')) {\n this.setAttribute('tabindex', `${this.active ? '' : '-1'}`);\n }\n\n if (changedProperties.has('size')) {\n this._updateButtons();\n }\n }\n\n private _updateButtons() {\n this.querySelectorAll(\n (this.constructor as typeof CDSTableBatchActions).selectorButtons\n ).forEach((button) => {\n button.setAttribute('batch-action', '');\n const buttonSize = this.size === 'xs' || this.size === 'sm' ? 'sm' : 'lg';\n button.setAttribute('size', buttonSize);\n });\n }\n\n render() {\n const {\n formatSelectedItemsCount,\n selectedRowsCount,\n _handleCancel: handleCancel,\n size,\n } = this;\n\n const buttonSize = size === 'xs' || size === 'sm' ? 'sm' : 'lg';\n\n return html`\n <div class=\"${prefix}--batch-summary\">\n <p class=\"${prefix}--batch-summary__para\">\n ${formatSelectedItemsCount({ count: selectedRowsCount })}\n </p>\n </div>\n\n <div class=\"${prefix}--action-list\">\n <slot></slot>\n <cds-custom-button\n kind=\"primary\"\n size=\"${buttonSize}\"\n class=\"${prefix}--batch-summary__cancel\"\n batch-action\n @click=${handleCancel}>\n <slot name=\"cancel-button-content\">Cancel</slot>\n </cds-custom-button>\n </div>\n `;\n }\n\n /**\n * The CSS selector to find the action buttons.\n */\n static get selectorButtons() {\n return `${prefix}-button`;\n }\n\n /**\n * The name of the custom event fired after the Cancel button is clicked.\n */\n static get eventClickCancel() {\n return `${prefix}-table-batch-actions-cancel-clicked`;\n }\n\n static styles = styles;\n}\n\nexport default CDSTableBatchActions;\n"],"names":["customElement"],"mappings":";;;;;;;;;;;;;;AAAA;;;;;AAKG;AAQH;;;;;AAKG;AAGH,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,UAAU,CAAA;AAA7C,IAAA,WAAA,GAAA;;AAYE;;AAEG;QAEH,IAAM,CAAA,MAAA,GAAG,KAAK;AAEd;;AAEG;QAEH,IAAwB,CAAA,wBAAA,GAAG,CAAC,EAAE,KAAK,EAAE,KACnC,CAAA,EAAG,KAAK,CAAA,KAAA,EAAQ,KAAK,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,CAAA,SAAA,CAAW;AAElD;;;AAGG;QAEH,IAAiB,CAAA,iBAAA,GAAG,CAAC;AAErB;;AAEG;QAEH,IAAI,CAAA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+
{"version":3,"file":"table-batch-actions.js","sources":["../../../src/components/data-table/table-batch-actions.ts"],"sourcesContent":["/**\n * Copyright IBM Corp. 2019, 2025\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { LitElement, html, nothing } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { prefix } from '../../globals/settings';\nimport styles from './data-table.scss?lit';\nimport { carbonElement as customElement } from '../../globals/decorators/carbon-element';\n\n/**\n * Table batch actions.\n *\n * @element cds-custom-table-batch-actions\n * @fires cds-custom-table-batch-actions-cancel-clicked - The custom event fired after the Cancel button is clicked.\n * @fires cds-custom-table-batch-actions-select-all-clicked - The custom event fired after the Select all button is clicked.\n */\n\n@customElement(`${prefix}-table-batch-actions`)\nclass CDSTableBatchActions extends LitElement {\n /**\n * Handles `click` event on the Cancel button.\n */\n private _handleCancel() {\n const { eventClickCancel } = this\n .constructor as typeof CDSTableBatchActions;\n this.dispatchEvent(\n new CustomEvent(eventClickCancel, { bubbles: true, composed: true })\n );\n }\n\n /**\n * Handles `click` event on the Select all button.\n */\n private _handleSelectAll() {\n this.dispatchEvent(\n new CustomEvent(CDSTableBatchActions.eventClickSelectAll, {\n bubbles: true,\n composed: true,\n })\n );\n }\n\n /**\n * `true` if this batch actions bar should be active.\n */\n @property({ type: Boolean, reflect: true })\n active = false;\n\n /**\n * The formatter for selected items. Should be changed upon the locale the UI is rendered with.\n */\n @property({ attribute: false })\n formatSelectedItemsCount = ({ count }) =>\n `${count} item${count <= 1 ? '' : 's'} selected`;\n\n /**\n * Numeric representation of the total number of items selected in a table.\n * This number is used to derive the selection message.\n */\n @property({ type: Number, attribute: 'selected-rows-count' })\n selectedRowsCount = 0;\n\n /**\n * Numeric representation of the total number of items in a table.\n * This number is used in the select all button text\n * This property controls the rendering of the Select all button\n */\n @property({ type: Number, attribute: 'total-rows-count' })\n totalRowsCount = 0;\n\n /**\n * The table size.\n */\n @property({ reflect: true })\n size = 'lg';\n\n firstUpdated() {\n this._updateButtons();\n this._setupHoverListeners();\n }\n\n private _setupHoverListeners() {\n const slot = this.shadowRoot?.querySelector('slot');\n const cancelButton = this.shadowRoot?.querySelector(\n `${prefix}-button.${prefix}--batch-summary__cancel`\n ) as HTMLElement;\n\n if (slot && cancelButton) {\n const setupListeners = () => {\n const buttons = slot.assignedElements();\n const lastButton = buttons[buttons.length - 1] as HTMLElement;\n\n if (lastButton) {\n const handleEnter = () => {\n cancelButton.style.setProperty('--divider-opacity', '0');\n };\n\n const handleLeave = () => {\n cancelButton.style.setProperty('--divider-opacity', '1');\n };\n\n lastButton.removeEventListener('mouseenter', handleEnter);\n lastButton.removeEventListener('mouseleave', handleLeave);\n\n lastButton.addEventListener('mouseenter', handleEnter);\n lastButton.addEventListener('mouseleave', handleLeave);\n }\n };\n\n setupListeners();\n slot.addEventListener('slotchange', setupListeners);\n }\n }\n\n updated(changedProperties) {\n if (changedProperties.has('active')) {\n this.setAttribute('tabindex', `${this.active ? '' : '-1'}`);\n }\n\n if (changedProperties.has('size')) {\n this._updateButtons();\n }\n }\n\n private _updateButtons() {\n this.querySelectorAll(\n (this.constructor as typeof CDSTableBatchActions).selectorButtons\n ).forEach((button) => {\n button.setAttribute('batch-action', '');\n const buttonSize = this.size === 'xs' || this.size === 'sm' ? 'sm' : 'lg';\n button.setAttribute('size', buttonSize);\n });\n }\n\n render() {\n const {\n formatSelectedItemsCount,\n selectedRowsCount,\n totalRowsCount,\n _handleCancel: handleCancel,\n _handleSelectAll: handleSelectAll,\n size,\n } = this;\n\n const buttonSize = size === 'xs' || size === 'sm' ? 'sm' : 'lg';\n\n return html`\n <div class=\"${prefix}--batch-summary\">\n <p class=\"${prefix}--batch-summary__para\">\n ${formatSelectedItemsCount({ count: selectedRowsCount })}\n </p>\n ${totalRowsCount > 0\n ? html`\n <span class=\"${prefix}--batch-summary__divider\">|</span>\n <button\n class=\"${prefix}--btn ${prefix}--btn--primary ${prefix}--batch-summary__select-all\"\n @click=${handleSelectAll}>\n <slot name=\"select-all-button-content\"\n >Select all (${totalRowsCount})</slot\n >\n </button>\n `\n : nothing}\n </div>\n\n <div class=\"${prefix}--action-list\">\n <slot></slot>\n <cds-custom-button\n kind=\"primary\"\n size=\"${buttonSize}\"\n class=\"${prefix}--batch-summary__cancel\"\n batch-action\n @click=${handleCancel}>\n <slot name=\"cancel-button-content\">Cancel</slot>\n </cds-custom-button>\n </div>\n `;\n }\n\n /**\n * The CSS selector to find the action buttons.\n */\n static get selectorButtons() {\n return `${prefix}-button`;\n }\n\n /**\n * The name of the custom event fired after the Cancel button is clicked.\n */\n static get eventClickCancel() {\n return `${prefix}-table-batch-actions-cancel-clicked`;\n }\n\n /**\n * The name of the custom event fired after the Select all button is clicked.\n */\n static get eventClickSelectAll() {\n return `${prefix}-table-batch-actions-select-all-clicked`;\n }\n\n static styles = styles;\n}\n\nexport default CDSTableBatchActions;\n"],"names":["customElement"],"mappings":";;;;;;;;;;;;;;AAAA;;;;;AAKG;;AAQH;;;;;;AAMG;AAGH,IAAM,oBAAoB,GAAA,sBAAA,GAA1B,MAAM,oBAAqB,SAAQ,UAAU,CAAA;AAA7C,IAAA,WAAA,GAAA;;AAwBE;;AAEG;QAEH,IAAM,CAAA,MAAA,GAAG,KAAK;AAEd;;AAEG;QAEH,IAAwB,CAAA,wBAAA,GAAG,CAAC,EAAE,KAAK,EAAE,KACnC,CAAA,EAAG,KAAK,CAAA,KAAA,EAAQ,KAAK,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,CAAA,SAAA,CAAW;AAElD;;;AAGG;QAEH,IAAiB,CAAA,iBAAA,GAAG,CAAC;AAErB;;;;AAIG;QAEH,IAAc,CAAA,cAAA,GAAG,CAAC;AAElB;;AAEG;QAEH,IAAI,CAAA,IAAA,GAAG,IAAI;;AAvDX;;AAEG;IACK,aAAa,GAAA;AACnB,QAAA,MAAM,EAAE,gBAAgB,EAAE,GAAG;AAC1B,aAAA,WAA0C;AAC7C,QAAA,IAAI,CAAC,aAA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BAAqB,EAAE;AACtC,CAAA,EAAA,oBAAA,CAAA,SAAA,EAAA,mBAAA,EAAA,MAAA,CAAA;AAQtB,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,kBAAkB,EAAE;AACtC,CAAA,EAAA,oBAAA,CAAA,SAAA,EAAA,gBAAA,EAAA,MAAA,CAAA;AAMnB,UAAA,CAAA;AADC,IAAA,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE;AACf,CAAA,EAAA,oBAAA,CAAA,SAAA,EAAA,MAAA,EAAA,MAAA,CAAA;AAxDR,oBAAoB,GAAA,sBAAA,GAAA,UAAA,CAAA;AADzB,IAAAA,aAAa,CAAC,CAAA,EAAG,MAAM,CAAA,oBAAA,CAAsB;AACxC,CAAA,EAAA,oBAAoB,CAuLzB;AAED,6BAAe,oBAAoB;;;;"}
|
|
@@ -233,18 +233,22 @@ let CDSTableRow = class CDSTableRow extends HostListenerMixin(FocusMixin(LitElem
|
|
|
233
233
|
}
|
|
234
234
|
_renderExpandButton() {
|
|
235
235
|
const { _handleClickExpando: handleClickExpando } = this;
|
|
236
|
+
// Always use the same structure for consistency, but only render the button for expandable rows
|
|
236
237
|
return html `
|
|
237
238
|
<div class="${prefix}--table-expand">
|
|
238
239
|
<div>
|
|
239
240
|
<slot name="ai-label" @slotchange="${this._handleSlotChange}"></slot>
|
|
240
241
|
<slot name="slug" @slotchange="${this._handleSlotChange}"></slot>
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
242
|
+
${this.expandable
|
|
243
|
+
? html `<button
|
|
244
|
+
class="${prefix}--table-expand__button"
|
|
245
|
+
@click="${handleClickExpando}">
|
|
246
|
+
${iconLoader(ChevronRight16, {
|
|
247
|
+
class: `${prefix}--table-expand__svg`,
|
|
248
|
+
})}
|
|
249
|
+
</button>`
|
|
250
|
+
: html ` `}
|
|
251
|
+
<!-- Add non-breaking space for proper styling -->
|
|
248
252
|
</div>
|
|
249
253
|
</div>
|
|
250
254
|
`;
|
|
@@ -330,12 +334,15 @@ let CDSTableRow = class CDSTableRow extends HostListenerMixin(FocusMixin(LitElem
|
|
|
330
334
|
}
|
|
331
335
|
}
|
|
332
336
|
render() {
|
|
333
|
-
var _a;
|
|
337
|
+
var _a, _b;
|
|
334
338
|
if (this.selectionName) {
|
|
335
339
|
(_a = this.closest(this.constructor.selectorTable)) === null || _a === void 0 ? void 0 : _a.setAttribute('is-selectable', '');
|
|
336
340
|
}
|
|
341
|
+
// Always render the expand button container for consistent table structure
|
|
342
|
+
// The button itself will only be rendered if the row is expandable
|
|
343
|
+
const tableHasExpandableRows = (_b = this.closest(this.constructor.selectorTable)) === null || _b === void 0 ? void 0 : _b.hasAttribute('expandable');
|
|
337
344
|
return html `
|
|
338
|
-
${
|
|
345
|
+
${tableHasExpandableRows ? this._renderExpandButton() : ''}
|
|
339
346
|
${this._renderFirstCells()}
|
|
340
347
|
<slot></slot>
|
|
341
348
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-row.js","sources":["../../../src/components/data-table/table-row.ts"],"sourcesContent":["/**\n * Copyright IBM Corp. 2019, 2024\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { LitElement, html } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { prefix } from '../../globals/settings';\nimport ChevronRight16 from '@carbon/icons/es/chevron--right/16.js';\nimport { carbonElement as customElement } from '../../globals/decorators/carbon-element';\nimport FocusMixin from '../../globals/mixins/focus';\nimport styles from './data-table.scss?lit';\nimport '../checkbox';\nimport '../radio-button';\n\nimport HostListener from '../../globals/decorators/host-listener';\nimport HostListenerMixin from '../../globals/mixins/host-listener';\nimport CDSTableExpandedRow from './table-expanded-row';\nimport CDSTableCell from './table-cell';\nimport { iconLoader } from '../../globals/internal/icon-loader';\n\n/**\n * Data table row.\n *\n * @element cds-custom-table-row\n * @csspart selection-container The container of the checkbox.\n * @csspart selection The checkbox.\n * @fires cds-custom-table-row-change-selection\n * The custom event fired before this row is selected/unselected upon a user gesture.\n * Cancellation of this event stops the user-initiated change in selection.\n * @fires cds-custom-radio-button-changed\n * The name of the custom event fired after this radio button changes its checked state.\n * @fires cds-custom-checkbox-changed\n * The name of the custom event fired after this checkbox changes its checked state.\n * @fires cds-custom-table-row-expando-beingtoggled\n * The name of the custom event fired before the expanded state of this row is being toggled upon a user gesture.\n * Cancellation of this event stops the user-initiated action of toggling the expanded state.\n * @fires cds-custom-table-row-expando-toggled\n * The name of the custom event fired after the expanded state of this row is toggled upon a user gesture.\n */\n@customElement(`${prefix}-table-row`)\nclass CDSTableRow extends HostListenerMixin(FocusMixin(LitElement)) {\n /**\n * `true` if there is an AI Label.\n */\n protected _hasAILabel = false;\n\n /**\n * Handles `click` event on the radio button.\n *\n * @param event The event.\n */\n @HostListener('eventRadioChange')\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20071\n // @ts-ignore\n private _handleClickSelectionRadio(event: CustomEvent) {\n const { detail } = event;\n const selected = detail.checked;\n const init = {\n bubbles: true,\n cancelable: true,\n composed: true,\n detail: {\n selected,\n },\n };\n const constructor = this.constructor as typeof CDSTableRow;\n if (\n this.dispatchEvent(\n new CustomEvent(constructor.eventBeforeChangeSelection, init)\n )\n ) {\n this.selected = selected;\n const { selectorExpandedRow } = this.constructor as typeof CDSTableRow;\n\n if (this.nextElementSibling?.matches(selectorExpandedRow)) {\n (this.nextElementSibling as CDSTableExpandedRow).selected = selected;\n }\n }\n }\n\n /**\n * Handles `click` event on the check box.\n *\n * @param event The event.\n */\n @HostListener('eventCheckboxChange')\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20071\n // @ts-expect-error\n private _handleClickSelectionCheckbox(event: CustomEvent) {\n const { detail } = event;\n const selected = detail.checked;\n const init = {\n bubbles: true,\n cancelable: true,\n composed: true,\n detail: {\n selected,\n },\n };\n const constructor = this.constructor as typeof CDSTableRow;\n if (\n this.dispatchEvent(\n new CustomEvent(constructor.eventBeforeChangeSelection, init)\n )\n ) {\n this.selected = selected;\n const { selectorExpandedRow } = this.constructor as typeof CDSTableRow;\n\n if (this.nextElementSibling?.matches(selectorExpandedRow)) {\n (this.nextElementSibling as CDSTableExpandedRow).selected = selected;\n }\n }\n }\n\n /**\n * Handles `click` event on the expando button.\n */\n private _handleClickExpando() {\n this._handleUserInitiatedToggleExpando();\n }\n\n /**\n * Handles `mouseover`/`mouseout` event handler on this element.\n *\n * @param event The event.\n */\n @HostListener('mouseover')\n @HostListener('mouseout')\n // @ts-expect-error: The decorator refers to this method but TS thinks this method is not referred to\n private _handleMouseOverOut(event: MouseEvent) {\n const { selectorExpandedRow, selectorTableCellOverflowMenu } = this\n .constructor as typeof CDSTableRow;\n const { nextElementSibling } = this;\n if (nextElementSibling?.matches(selectorExpandedRow)) {\n (nextElementSibling as CDSTableExpandedRow).highlighted =\n event.type === 'mouseover';\n }\n if (this.overflowMenuOnHover) {\n const overflowMenu = this.querySelector(selectorTableCellOverflowMenu);\n const parentCell = overflowMenu?.parentElement;\n\n if (event.type === 'mouseout') {\n (parentCell as CDSTableCell).overflowMenuOnHover = true;\n } else {\n (parentCell as CDSTableCell).overflowMenuOnHover = false;\n }\n }\n }\n\n /**\n * Handles user-initiated toggle request of the expando button in this table row.\n *\n * @param expanded The new expanded state.\n */\n _handleUserInitiatedToggleExpando(expanded = !this.expanded) {\n const init = {\n bubbles: true,\n cancelable: true,\n composed: true,\n detail: {\n expanded,\n },\n };\n if (\n this.dispatchEvent(\n new CustomEvent(\n (this.constructor as typeof CDSTableRow).eventBeforeExpandoToggle,\n init\n )\n )\n ) {\n this.expanded = expanded;\n this.dispatchEvent(\n new CustomEvent(\n (this.constructor as typeof CDSTableRow).eventExpandoToggle,\n init\n )\n );\n }\n }\n\n protected _renderExpandButton() {\n const { _handleClickExpando: handleClickExpando } = this;\n return html`\n <div class=\"${prefix}--table-expand\">\n <div>\n <slot name=\"ai-label\" @slotchange=\"${this._handleSlotChange}\"></slot>\n <slot name=\"slug\" @slotchange=\"${this._handleSlotChange}\"></slot>\n <button\n class=\"${prefix}--table-expand__button\"\n @click=\"${handleClickExpando}\">\n ${iconLoader(ChevronRight16, {\n class: `${prefix}--table-expand__svg`,\n })}\n </button>\n </div>\n </div>\n `;\n }\n\n /**\n * Handles `slotchange` event.\n */\n protected _handleSlotChange({ target }: Event) {\n const hasContent = (target as HTMLSlotElement)\n .assignedNodes()\n .filter((elem) =>\n (elem as HTMLElement).matches !== undefined\n ? (elem as HTMLElement).matches(\n (this.constructor as typeof CDSTableRow).aiLabelItem\n ) ||\n (elem as HTMLElement).matches(\n (this.constructor as typeof CDSTableRow).slugItem\n )\n : false\n );\n if (hasContent.length > 0) {\n this._hasAILabel = Boolean(hasContent);\n (hasContent[0] as HTMLElement).setAttribute('size', 'mini');\n }\n this.requestUpdate();\n }\n\n /**\n * @returns The first set of table cells.\n */\n protected _renderFirstCells() {\n const {\n disabled,\n hideCheckbox,\n radio,\n selected,\n selectionLabel,\n selectionName,\n selectionValue,\n } = this;\n return !selectionName\n ? undefined\n : html`\n <div class=\"${prefix}--table-column-checkbox\">\n <div>\n <slot\n name=\"ai-label\"\n @slotchange=\"${this._handleSlotChange}\"></slot>\n <slot name=\"slug\" @slotchange=\"${this._handleSlotChange}\"></slot>\n ${radio\n ? html`<cds-custom-radio-button data-table></cds-custom-radio-button>`\n : html`<cds-custom-checkbox\n hide-label\n ?hide-checkbox=\"${hideCheckbox}\"\n label-text=\"${selectionLabel}\"\n name=${selectionName}\n data-table\n ?disabled=${disabled}\n ?checked=${selected}\n value=${selectionValue}></cds-custom-checkbox> `}\n </div>\n </div>\n `;\n }\n\n /**\n * `true` if this table should support batch expansion\n */\n @property({ type: Boolean, reflect: true, attribute: 'batch-expansion' })\n batchExpansion = false;\n\n /**\n * `true` if this table row should be disabled.\n */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /**\n * `true` if this table row is placed at an even position in parent `<cds-custom-table-body>`.\n * `<cds-custom-table-body>` sets this property, _only_ in zebra stripe mode.\n *\n * @private\n */\n @property({ type: Boolean, reflect: true })\n even = false;\n\n /**\n * `true` if this table row can be expanded to show content underneath\n *\n * @private\n */\n @property({ type: Boolean, reflect: true })\n expandable = false;\n\n /**\n * `true` when the table row expanded is showing\n *\n * @private\n */\n @property({ type: Boolean, reflect: true })\n expanded = false;\n\n /**\n * `true` if this table row should be filtered out.\n */\n @property({ type: Boolean, reflect: true })\n filtered = false;\n\n /**\n * Specify whether the checkbox should be present in the DOM,\n * but invisible and uninteractable.\n */\n @property({ type: Boolean, reflect: true, attribute: 'hide-checkbox' })\n hideCheckbox = false;\n\n /**\n * `true` if the table row should be highlighted.\n */\n @property({ type: Boolean, reflect: true })\n highlighted = false;\n\n /**\n * `true` if this table row is placed at an odd position in parent `<cds-custom-table-body>`.\n * `<cds-custom-table-body>` sets this property, _only_ in zebra stripe mode.\n *\n * @private\n */\n @property({ type: Boolean, reflect: true })\n odd = false;\n\n /**\n * Specify whether the overflow menu (if it exists) should be shown always, or only on hover\n */\n @property({\n type: Boolean,\n reflect: true,\n attribute: 'overflow-menu-on-hover',\n })\n overflowMenuOnHover = false;\n\n /**\n * Specify whether the control should be a radio button or inline checkbox\n *\n * @private\n */\n @property({ type: Boolean, reflect: true })\n radio = false;\n\n /**\n * `true` if this table row should be selected.\n */\n @property({ type: Boolean, reflect: true })\n selected = false;\n\n /**\n * The `aria-label` attribute for the `<label>` for selection.\n */\n @property({ attribute: 'selection-label' })\n selectionLabel = '';\n\n /**\n * The `name` attribute for the `<input>` for selection.\n * If present, this table row will be a selectable one.\n */\n @property({ attribute: 'selection-name' })\n selectionName = '';\n\n /**\n * The `value` attribute for the `<input>` for selection.\n */\n @property({ attribute: 'selection-value' })\n selectionValue = '';\n\n /**\n * TODO: Uncomment when Carbon fully implements sticky header\n * Specify whether the header should be sticky.\n * Still experimental: may not work with every combination of table props\n */\n // @property({ type: Boolean, reflect: true, attribute: 'sticky-header' })\n // stickyHeader = false;\n\n connectedCallback() {\n if (!this.hasAttribute('role')) {\n this.setAttribute('role', 'row');\n }\n super.connectedCallback();\n }\n\n updated(changedProperties) {\n if (changedProperties.has('expanded')) {\n const { selectorExpandedRow } = this.constructor as typeof CDSTableRow;\n const { expanded, nextElementSibling } = this;\n if (nextElementSibling?.matches(selectorExpandedRow)) {\n (nextElementSibling as CDSTableExpandedRow).expanded = expanded;\n }\n }\n\n if (changedProperties.has('highlighted')) {\n const { selectorExpandedRow } = this.constructor as typeof CDSTableRow;\n const { highlighted, nextElementSibling } = this;\n if (nextElementSibling?.matches(selectorExpandedRow)) {\n (nextElementSibling as CDSTableExpandedRow).highlighted = highlighted;\n }\n }\n\n if (this._hasAILabel) {\n this.setAttribute('ai-label', '');\n } else {\n this.removeAttribute('ai-label');\n }\n }\n\n render() {\n if (this.selectionName) {\n this.closest(\n (this.constructor as typeof CDSTableRow).selectorTable\n )?.setAttribute('is-selectable', '');\n }\n return html`\n ${this.expandable ? this._renderExpandButton() : ''}\n ${this._renderFirstCells()}\n <slot></slot>\n `;\n }\n\n /**\n * The name of the custom event fired after this radio button changes its checked state.\n */\n static get eventRadioChange() {\n return `${prefix}-radio-button-changed`;\n }\n\n /**\n * The name of the custom event fired after this radio button changes its checked state.\n */\n static get eventCheckboxChange() {\n return `${prefix}-checkbox-changed`;\n }\n\n /**\n * The name of the custom event fired before this row is selected/unselected upon a user gesture.\n * Cancellation of this event stops the user-initiated change in selection.\n */\n static get eventBeforeChangeSelection() {\n return `${prefix}-table-row-change-selection`;\n }\n\n /**\n * A selector that will return the parent table\n */\n static get selectorTable() {\n return `${prefix}-table`;\n }\n\n /**\n * The CSS selector to find the overflow menu on the table cell\n */\n static get selectorTableCellOverflowMenu() {\n return `${prefix}-table-cell ${prefix}-overflow-menu`;\n }\n\n /**\n * A selector that will return the corresponding expanded row.\n */\n static get selectorExpandedRow() {\n return `${prefix}-table-expanded-row`;\n }\n\n /**\n * A selector that will return the slug item.\n *\n * remove in v12\n */\n static get slugItem() {\n return `${prefix}-slug`;\n }\n\n /**\n * A selector that will return the AI Label item.\n */\n static get aiLabelItem() {\n return `${prefix}-ai-label`;\n }\n\n /**\n * The name of the custom event fired before the expanded state this row is being toggled upon a user gesture.\n * Cancellation of this event stops the user-initiated action of toggling the expanded state.\n */\n static get eventBeforeExpandoToggle() {\n return `${prefix}-table-row-expando-beingtoggled`;\n }\n\n /**\n * The name of the custom event fired after the expanded state this row is toggled upon a user gesture.\n */\n static get eventExpandoToggle() {\n return `${prefix}-table-row-expando-toggled`;\n }\n\n static styles = styles;\n}\n\nexport default CDSTableRow;\n"],"names":["customElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAKG;AAkBH;;;;;;;;;;;;;;;;;;AAkBG;AAEH,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,iBAAiB,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAA;AAAnE,IAAA,WAAA,GAAA;;AACE;;AAEG;QACO,IAAW,CAAA,WAAA,GAAG,KAAK;AAyN7B;;AAEG;QAEH,IAAc,CAAA,cAAA,GAAG,KAAK;AAEtB;;AAEG;QAEH,IAAQ,CAAA,QAAA,GAAG,KAAK;AAEhB;;;;;AAKG;QAEH,IAAI,CAAA,IAAA,GAAG,KAAK;AAEZ;;;;AAIG;QAEH,IAAU,CAAA,UAAA,GAAG,KAAK;AAElB;;;;AAIG;QAEH,IAAQ,CAAA,QAAA,GAAG,KAAK;AAEhB;;AAEG;QAEH,IAAQ,CAAA,QAAA,GAAG,KAAK;AAEhB;;;AAGG;QAEH,IAAY,CAAA,YAAA,GAAG,KAAK;AAEpB;;AAEG;QAEH,IAAW,CAAA,WAAA,GAAG,KAAK;AAEnB;;;;;AAKG;QAEH,IAAG,CAAA,GAAA,GAAG,KAAK;AAEX;;AAE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A,eAAA,EAAA,MAAA,CAAA;AAMnB,UAAA,CAAA;AADC,IAAA,QAAQ,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAE;AACtB,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,gBAAA,EAAA,MAAA,CAAA;AAvUhB,WAAW,GAAA,UAAA,CAAA;AADhB,IAAAA,aAAa,CAAC,CAAA,EAAG,MAAM,CAAA,UAAA,CAAY;AAC9B,CAAA,EAAA,WAAW,CAwchB;AAED,oBAAe,WAAW;;;;"}
|
|
1
|
+
{"version":3,"file":"table-row.js","sources":["../../../src/components/data-table/table-row.ts"],"sourcesContent":["/**\n * Copyright IBM Corp. 2019, 2024\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { LitElement, html } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { prefix } from '../../globals/settings';\nimport ChevronRight16 from '@carbon/icons/es/chevron--right/16.js';\nimport { carbonElement as customElement } from '../../globals/decorators/carbon-element';\nimport FocusMixin from '../../globals/mixins/focus';\nimport styles from './data-table.scss?lit';\nimport '../checkbox';\nimport '../radio-button';\n\nimport HostListener from '../../globals/decorators/host-listener';\nimport HostListenerMixin from '../../globals/mixins/host-listener';\nimport CDSTableExpandedRow from './table-expanded-row';\nimport CDSTableCell from './table-cell';\nimport { iconLoader } from '../../globals/internal/icon-loader';\n\n/**\n * Data table row.\n *\n * @element cds-custom-table-row\n * @csspart selection-container The container of the checkbox.\n * @csspart selection The checkbox.\n * @fires cds-custom-table-row-change-selection\n * The custom event fired before this row is selected/unselected upon a user gesture.\n * Cancellation of this event stops the user-initiated change in selection.\n * @fires cds-custom-radio-button-changed\n * The name of the custom event fired after this radio button changes its checked state.\n * @fires cds-custom-checkbox-changed\n * The name of the custom event fired after this checkbox changes its checked state.\n * @fires cds-custom-table-row-expando-beingtoggled\n * The name of the custom event fired before the expanded state of this row is being toggled upon a user gesture.\n * Cancellation of this event stops the user-initiated action of toggling the expanded state.\n * @fires cds-custom-table-row-expando-toggled\n * The name of the custom event fired after the expanded state of this row is toggled upon a user gesture.\n */\n@customElement(`${prefix}-table-row`)\nclass CDSTableRow extends HostListenerMixin(FocusMixin(LitElement)) {\n /**\n * `true` if there is an AI Label.\n */\n protected _hasAILabel = false;\n\n /**\n * Handles `click` event on the radio button.\n *\n * @param event The event.\n */\n @HostListener('eventRadioChange')\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20071\n // @ts-ignore\n private _handleClickSelectionRadio(event: CustomEvent) {\n const { detail } = event;\n const selected = detail.checked;\n const init = {\n bubbles: true,\n cancelable: true,\n composed: true,\n detail: {\n selected,\n },\n };\n const constructor = this.constructor as typeof CDSTableRow;\n if (\n this.dispatchEvent(\n new CustomEvent(constructor.eventBeforeChangeSelection, init)\n )\n ) {\n this.selected = selected;\n const { selectorExpandedRow } = this.constructor as typeof CDSTableRow;\n\n if (this.nextElementSibling?.matches(selectorExpandedRow)) {\n (this.nextElementSibling as CDSTableExpandedRow).selected = selected;\n }\n }\n }\n\n /**\n * Handles `click` event on the check box.\n *\n * @param event The event.\n */\n @HostListener('eventCheckboxChange')\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20071\n // @ts-expect-error\n private _handleClickSelectionCheckbox(event: CustomEvent) {\n const { detail } = event;\n const selected = detail.checked;\n const init = {\n bubbles: true,\n cancelable: true,\n composed: true,\n detail: {\n selected,\n },\n };\n const constructor = this.constructor as typeof CDSTableRow;\n if (\n this.dispatchEvent(\n new CustomEvent(constructor.eventBeforeChangeSelection, init)\n )\n ) {\n this.selected = selected;\n const { selectorExpandedRow } = this.constructor as typeof CDSTableRow;\n\n if (this.nextElementSibling?.matches(selectorExpandedRow)) {\n (this.nextElementSibling as CDSTableExpandedRow).selected = selected;\n }\n }\n }\n\n /**\n * Handles `click` event on the expando button.\n */\n private _handleClickExpando() {\n this._handleUserInitiatedToggleExpando();\n }\n\n /**\n * Handles `mouseover`/`mouseout` event handler on this element.\n *\n * @param event The event.\n */\n @HostListener('mouseover')\n @HostListener('mouseout')\n // @ts-expect-error: The decorator refers to this method but TS thinks this method is not referred to\n private _handleMouseOverOut(event: MouseEvent) {\n const { selectorExpandedRow, selectorTableCellOverflowMenu } = this\n .constructor as typeof CDSTableRow;\n const { nextElementSibling } = this;\n if (nextElementSibling?.matches(selectorExpandedRow)) {\n (nextElementSibling as CDSTableExpandedRow).highlighted =\n event.type === 'mouseover';\n }\n if (this.overflowMenuOnHover) {\n const overflowMenu = this.querySelector(selectorTableCellOverflowMenu);\n const parentCell = overflowMenu?.parentElement;\n\n if (event.type === 'mouseout') {\n (parentCell as CDSTableCell).overflowMenuOnHover = true;\n } else {\n (parentCell as CDSTableCell).overflowMenuOnHover = false;\n }\n }\n }\n\n /**\n * Handles user-initiated toggle request of the expando button in this table row.\n *\n * @param expanded The new expanded state.\n */\n _handleUserInitiatedToggleExpando(expanded = !this.expanded) {\n const init = {\n bubbles: true,\n cancelable: true,\n composed: true,\n detail: {\n expanded,\n },\n };\n if (\n this.dispatchEvent(\n new CustomEvent(\n (this.constructor as typeof CDSTableRow).eventBeforeExpandoToggle,\n init\n )\n )\n ) {\n this.expanded = expanded;\n this.dispatchEvent(\n new CustomEvent(\n (this.constructor as typeof CDSTableRow).eventExpandoToggle,\n init\n )\n );\n }\n }\n\n protected _renderExpandButton() {\n const { _handleClickExpando: handleClickExpando } = this;\n\n // Always use the same structure for consistency, but only render the button for expandable rows\n return html`\n <div class=\"${prefix}--table-expand\">\n <div>\n <slot name=\"ai-label\" @slotchange=\"${this._handleSlotChange}\"></slot>\n <slot name=\"slug\" @slotchange=\"${this._handleSlotChange}\"></slot>\n ${this.expandable\n ? html`<button\n class=\"${prefix}--table-expand__button\"\n @click=\"${handleClickExpando}\">\n ${iconLoader(ChevronRight16, {\n class: `${prefix}--table-expand__svg`,\n })}\n </button>`\n : html` `}\n <!-- Add non-breaking space for proper styling -->\n </div>\n </div>\n `;\n }\n\n /**\n * Handles `slotchange` event.\n */\n protected _handleSlotChange({ target }: Event) {\n const hasContent = (target as HTMLSlotElement)\n .assignedNodes()\n .filter((elem) =>\n (elem as HTMLElement).matches !== undefined\n ? (elem as HTMLElement).matches(\n (this.constructor as typeof CDSTableRow).aiLabelItem\n ) ||\n (elem as HTMLElement).matches(\n (this.constructor as typeof CDSTableRow).slugItem\n )\n : false\n );\n if (hasContent.length > 0) {\n this._hasAILabel = Boolean(hasContent);\n (hasContent[0] as HTMLElement).setAttribute('size', 'mini');\n }\n this.requestUpdate();\n }\n\n /**\n * @returns The first set of table cells.\n */\n protected _renderFirstCells() {\n const {\n disabled,\n hideCheckbox,\n radio,\n selected,\n selectionLabel,\n selectionName,\n selectionValue,\n } = this;\n return !selectionName\n ? undefined\n : html`\n <div class=\"${prefix}--table-column-checkbox\">\n <div>\n <slot\n name=\"ai-label\"\n @slotchange=\"${this._handleSlotChange}\"></slot>\n <slot name=\"slug\" @slotchange=\"${this._handleSlotChange}\"></slot>\n ${radio\n ? html`<cds-custom-radio-button data-table></cds-custom-radio-button>`\n : html`<cds-custom-checkbox\n hide-label\n ?hide-checkbox=\"${hideCheckbox}\"\n label-text=\"${selectionLabel}\"\n name=${selectionName}\n data-table\n ?disabled=${disabled}\n ?checked=${selected}\n value=${selectionValue}></cds-custom-checkbox> `}\n </div>\n </div>\n `;\n }\n\n /**\n * `true` if this table should support batch expansion\n */\n @property({ type: Boolean, reflect: true, attribute: 'batch-expansion' })\n batchExpansion = false;\n\n /**\n * `true` if this table row should be disabled.\n */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /**\n * `true` if this table row is placed at an even position in parent `<cds-custom-table-body>`.\n * `<cds-custom-table-body>` sets this property, _only_ in zebra stripe mode.\n *\n * @private\n */\n @property({ type: Boolean, reflect: true })\n even = false;\n\n /**\n * `true` if this table row can be expanded to show content underneath\n *\n * @private\n */\n @property({ type: Boolean, reflect: true })\n expandable = false;\n\n /**\n * `true` when the table row expanded is showing\n *\n * @private\n */\n @property({ type: Boolean, reflect: true })\n expanded = false;\n\n /**\n * `true` if this table row should be filtered out.\n */\n @property({ type: Boolean, reflect: true })\n filtered = false;\n\n /**\n * Specify whether the checkbox should be present in the DOM,\n * but invisible and uninteractable.\n */\n @property({ type: Boolean, reflect: true, attribute: 'hide-checkbox' })\n hideCheckbox = false;\n\n /**\n * `true` if the table row should be highlighted.\n */\n @property({ type: Boolean, reflect: true })\n highlighted = false;\n\n /**\n * `true` if this table row is placed at an odd position in parent `<cds-custom-table-body>`.\n * `<cds-custom-table-body>` sets this property, _only_ in zebra stripe mode.\n *\n * @private\n */\n @property({ type: Boolean, reflect: true })\n odd = false;\n\n /**\n * Specify whether the overflow menu (if it exists) should be shown always, or only on hover\n */\n @property({\n type: Boolean,\n reflect: true,\n attribute: 'overflow-menu-on-hover',\n })\n overflowMenuOnHover = false;\n\n /**\n * Specify whether the control should be a radio button or inline checkbox\n *\n * @private\n */\n @property({ type: Boolean, reflect: true })\n radio = false;\n\n /**\n * `true` if this table row should be selected.\n */\n @property({ type: Boolean, reflect: true })\n selected = false;\n\n /**\n * The `aria-label` attribute for the `<label>` for selection.\n */\n @property({ attribute: 'selection-label' })\n selectionLabel = '';\n\n /**\n * The `name` attribute for the `<input>` for selection.\n * If present, this table row will be a selectable one.\n */\n @property({ attribute: 'selection-name' })\n selectionName = '';\n\n /**\n * The `value` attribute for the `<input>` for selection.\n */\n @property({ attribute: 'selection-value' })\n selectionValue = '';\n\n /**\n * TODO: Uncomment when Carbon fully implements sticky header\n * Specify whether the header should be sticky.\n * Still experimental: may not work with every combination of table props\n */\n // @property({ type: Boolean, reflect: true, attribute: 'sticky-header' })\n // stickyHeader = false;\n\n connectedCallback() {\n if (!this.hasAttribute('role')) {\n this.setAttribute('role', 'row');\n }\n super.connectedCallback();\n }\n\n updated(changedProperties) {\n if (changedProperties.has('expanded')) {\n const { selectorExpandedRow } = this.constructor as typeof CDSTableRow;\n const { expanded, nextElementSibling } = this;\n if (nextElementSibling?.matches(selectorExpandedRow)) {\n (nextElementSibling as CDSTableExpandedRow).expanded = expanded;\n }\n }\n\n if (changedProperties.has('highlighted')) {\n const { selectorExpandedRow } = this.constructor as typeof CDSTableRow;\n const { highlighted, nextElementSibling } = this;\n if (nextElementSibling?.matches(selectorExpandedRow)) {\n (nextElementSibling as CDSTableExpandedRow).highlighted = highlighted;\n }\n }\n\n if (this._hasAILabel) {\n this.setAttribute('ai-label', '');\n } else {\n this.removeAttribute('ai-label');\n }\n }\n\n render() {\n if (this.selectionName) {\n this.closest(\n (this.constructor as typeof CDSTableRow).selectorTable\n )?.setAttribute('is-selectable', '');\n }\n\n // Always render the expand button container for consistent table structure\n // The button itself will only be rendered if the row is expandable\n const tableHasExpandableRows = this.closest(\n (this.constructor as typeof CDSTableRow).selectorTable\n )?.hasAttribute('expandable');\n\n return html`\n ${tableHasExpandableRows ? this._renderExpandButton() : ''}\n ${this._renderFirstCells()}\n <slot></slot>\n `;\n }\n\n /**\n * The name of the custom event fired after this radio button changes its checked state.\n */\n static get eventRadioChange() {\n return `${prefix}-radio-button-changed`;\n }\n\n /**\n * The name of the custom event fired after this radio button changes its checked state.\n */\n static get eventCheckboxChange() {\n return `${prefix}-checkbox-changed`;\n }\n\n /**\n * The name of the custom event fired before this row is selected/unselected upon a user gesture.\n * Cancellation of this event stops the user-initiated change in selection.\n */\n static get eventBeforeChangeSelection() {\n return `${prefix}-table-row-change-selection`;\n }\n\n /**\n * A selector that will return the parent table\n */\n static get selectorTable() {\n return `${prefix}-table`;\n }\n\n /**\n * The CSS selector to find the overflow menu on the table cell\n */\n static get selectorTableCellOverflowMenu() {\n return `${prefix}-table-cell ${prefix}-overflow-menu`;\n }\n\n /**\n * A selector that will return the corresponding expanded row.\n */\n static get selectorExpandedRow() {\n return `${prefix}-table-expanded-row`;\n }\n\n /**\n * A selector that will return the slug item.\n *\n * remove in v12\n */\n static get slugItem() {\n return `${prefix}-slug`;\n }\n\n /**\n * A selector that will return the AI Label item.\n */\n static get aiLabelItem() {\n return `${prefix}-ai-label`;\n }\n\n /**\n * The name of the custom event fired before the expanded state this row is being toggled upon a user gesture.\n * Cancellation of this event stops the user-initiated action of toggling the expanded state.\n */\n static get eventBeforeExpandoToggle() {\n return `${prefix}-table-row-expando-beingtoggled`;\n }\n\n /**\n * The name of the custom event fired after the expanded state this row is toggled upon a user gesture.\n */\n static get eventExpandoToggle() {\n return `${prefix}-table-row-expando-toggled`;\n }\n\n static styles = styles;\n}\n\nexport default CDSTableRow;\n"],"names":["customElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAKG;AAkBH;;;;;;;;;;;;;;;;;;AAkBG;AAEH,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,iBAAiB,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAA;AAAnE,IAAA,WAAA,GAAA;;AACE;;AAEG;QACO,IAAW,CAAA,WAAA,GAAG,KAAK;AA8N7B;;AAEG;QAEH,IAAc,CAAA,cAAA,GAAG,KAAK;AAEtB;;AAEG;QAEH,IAAQ,CAAA,QAAA,GAAG,KAAK;AAEhB;;;;;AAKG;QAEH,IAAI,CAAA,IAAA,GAAG,KAAK;AAEZ;;;;AAIG;QAEH,IAAU,CAAA,UAAA,GAAG,KAAK;AAElB;;;;AAIG;QAEH,IAAQ,CAAA,QAAA,GAAG,KAAK;AAEhB;;AAEG;QAEH,IAAQ,CAAA,QAAA,GAAG,KAAK;AAEhB;;;AAGG;QAEH,IAAY,CAAA,YAAA,GAAG,KAAK;AAEpB;;AAEG;QAEH,IAAW,CAAA,WAAA,GAAG,KAAK;AAEnB;;;;;AAKG;QAEH,IAAG,CAAA,GAAA,GAAG,KAAK;AAEX;;AAEG;QAMH,IAAmB,CAAA,mBAAA,GAAG,KAAK;AAE3B;;;;AAIG;QAEH,IAAK,CAAA,KAAA,GAAG,KAAK;AAEb;;AAEG;QAEH,IAAQ,CAAA,QAAA,GAAG,KAAK;AA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BAAA,EAAA,MAAA,CAAA;AAOpB,UAAA,CAAA;AADC,IAAA,QAAQ,CAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE;AACtB,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,eAAA,EAAA,MAAA,CAAA;AAMnB,UAAA,CAAA;AADC,IAAA,QAAQ,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAE;AACtB,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,gBAAA,EAAA,MAAA,CAAA;AA5UhB,WAAW,GAAA,UAAA,CAAA;AADhB,IAAAA,aAAa,CAAC,CAAA,EAAG,MAAM,CAAA,UAAA,CAAY;AAC9B,CAAA,EAAA,WAAW,CAodhB;AAED,oBAAe,WAAW;;;;"}
|
|
@@ -354,7 +354,10 @@ let CDSTable = class CDSTable extends HostListenerMixin(LitElement) {
|
|
|
354
354
|
rows.forEach((e) => {
|
|
355
355
|
const sortId = e.getAttribute('sort-id');
|
|
356
356
|
sortedWithExpanded.push(e);
|
|
357
|
-
|
|
357
|
+
// Only add the expanded row if it exists
|
|
358
|
+
if (mapping[sortId]) {
|
|
359
|
+
sortedWithExpanded.push(mapping[sortId]);
|
|
360
|
+
}
|
|
358
361
|
});
|
|
359
362
|
sortedWithExpanded.forEach((e) => {
|
|
360
363
|
this._tableBody.insertBefore(e, null);
|
|
@@ -455,8 +458,12 @@ let CDSTable = class CDSTable extends HostListenerMixin(LitElement) {
|
|
|
455
458
|
this.headerCount = this._tableHeaderRow.children.length;
|
|
456
459
|
}
|
|
457
460
|
updateExpandable() {
|
|
461
|
+
const { selectorTableExpandedRows } = this.constructor;
|
|
458
462
|
this._tableRows.forEach((e, index) => {
|
|
459
|
-
|
|
463
|
+
var _a;
|
|
464
|
+
// Only set expandable=true if this row has an expanded row following it
|
|
465
|
+
const hasExpandedRow = (_a = e.nextElementSibling) === null || _a === void 0 ? void 0 : _a.matches(selectorTableExpandedRows);
|
|
466
|
+
e.expandable = this.expandable && hasExpandedRow;
|
|
460
467
|
e.setAttribute('sort-id', index);
|
|
461
468
|
});
|
|
462
469
|
this._tableHeaderRow.expandable = this.expandable;
|