@ncino/web-components 2.2.0-preview.4 → 2.2.0-preview.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/table/gator/table.gator.js +22 -12
- package/dist/components/table/index.js +1 -1
- package/dist/components/table/table.js +1 -1
- package/dist/types/components/table/gator/table.gator.d.ts +4 -1
- package/dist/types/components/table/gator/table.gator.test.d.ts +0 -0
- package/dist/types/components/table/table.d.ts +3 -2
- package/package.json +1 -1
- package/web-types.json +25 -5
|
@@ -1,23 +1,33 @@
|
|
|
1
|
-
import{a
|
|
2
|
-
<table role="grid" aria-labelledby="${this.tableAriaLabelledBy}">
|
|
3
|
-
${
|
|
1
|
+
import{a,x as l}from"../../../assets/index-chunk2.js";import{t as p}from"../../../assets/index-chunk3.js";import{p as h}from"../../../assets/index-chunk5.js";import{s as n}from"../../../assets/index-chunk6.js";import{N as b}from"../table.js";import"../../checkbox/checkbox.gator.js";import"../../../assets/index-chunk.js";import"../../../utils/components/testable-lit-element/testable-lit-element.js";import"../../../utils/string-utils.js";import"../../../utils/lightdom-utils.js";import"../../icon/gator/icon.gator.js";import"../../icon/gator/templates/arrow-left.js";import"../../icon/icon-registry.js";import"../../icon/gator/templates/arrow-right.js";import"../../icon/gator/templates/calendar.js";import"../../icon/gator/templates/check-circle.js";import"../../icon/gator/templates/check.js";import"../../icon/gator/templates/checkbox.js";import"../../icon/gator/templates/checkbox-selected.js";import"../../icon/gator/templates/chevron-down.js";import"../../icon/gator/templates/chevron-left.js";import"../../icon/gator/templates/chevron-right.js";import"../../icon/gator/templates/chevron-up.js";import"../../icon/gator/templates/dashboard.js";import"../../icon/gator/templates/exit.js";import"../../icon/gator/templates/exit-circle.js";import"../../icon/gator/templates/eye-crossed.js";import"../../icon/gator/templates/info.js";import"../../icon/gator/templates/link.js";import"../../icon/gator/templates/overflow-menu.js";import"../../icon/gator/templates/percent.js";import"../../icon/gator/templates/picture.js";import"../../icon/gator/templates/shield-lock.js";import"../../icon/gator/templates/radio.js";import"../../icon/gator/templates/radio-selected.js";import"../../icon/gator/templates/restricted.js";import"../../icon/gator/templates/settings.js";import"../../icon/gator/templates/warning.js";const g=":host{--ngc-table-header-background-color: #ececec;--ngc-table-header-border-bottom-color: #ececec}",m=":host{display:block;overflow:auto}.gator-table{font-family:var(--ngc-font-family-body),sans-serif;border-spacing:0;width:100%}.gator-table thead>tr{height:56px}.gator-table tbody>tr,.gator-table tfoot>tr{height:48px}.gator-table th{top:0;position:sticky;z-index:100;min-height:56px;background:var(--ngc-table-header-background-color, #ececec);text-align:left}.gator-table [dir=rtl] th.mat-header-cell{text-align:right}.gator-table td{padding:0;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:var(--ngc-table-header-border-bottom-color, #ececec)}.gator-table th:first-of-type,.gator-table td:first-of-type{padding-left:24px}.gator-table [dir=rtl] th:first-of-type,.gator-table [dir=rtl] td:first-of-type{padding-left:0;padding-right:24px}.gator-table th:last-of-type,.gator-table td:last-of-type{padding-right:24px}.gator-table [dir=rtl] th:last-of-type,.gator-table [dir=rtl] td:last-of-type{padding-right:0;padding-left:24px}";var f=Object.defineProperty,u=Object.getOwnPropertyDescriptor,y=(e,t,r,o)=>{for(var i=o>1?void 0:o?u(t,r):t,s=e.length-1,d;s>=0;s--)(d=e[s])&&(i=(o?d(t,r,i):d(i))||i);return o&&i&&f(t,r,i),i};let c=class extends b{constructor(){super(...arguments),this.selectedRows=[]}renderWrapper(e,t){return l`
|
|
2
|
+
<table class="gator-table" role="grid" aria-labelledby="${this.tableAriaLabelledBy}">
|
|
3
|
+
${e} ${t}
|
|
4
4
|
</table>
|
|
5
|
-
`}getTableHeader(
|
|
5
|
+
`}getTableHeader(e){const t=e.map(this.getTableHeaderColumn);return this.selectable&&t.unshift(l`<th role="gridcell">
|
|
6
|
+
<ngc-checkbox
|
|
7
|
+
?selected="${this.selectedRows.length===this.data.length}"
|
|
8
|
+
@change="${r=>this.handleSelectAll(r)}"
|
|
9
|
+
></ngc-checkbox>
|
|
10
|
+
</th>`),l`
|
|
6
11
|
<thead role="rowgroup">
|
|
7
12
|
<tr role="row">
|
|
8
|
-
${
|
|
13
|
+
${t}
|
|
9
14
|
</tr>
|
|
10
15
|
</thead>
|
|
11
|
-
`}
|
|
16
|
+
`}handleSelectAll(e){e.detail.selected?(this.selectedRows=[...this.data],this.data.forEach(t=>{t.selected=e.detail.selected})):(this.selectedRows=[],this.data.forEach(t=>{t.selected=!1})),this.dispatchEvent(new CustomEvent("selectall",{bubbles:!0,detail:{selectedRows:this.selectedRows}})),this.requestUpdate()}getTableHeaderColumn(e){return l`<th>${e.name}</th>`}getTableBody(e,t){const r=t.map(o=>this.getTableBodyRow(o,e));return l`
|
|
12
17
|
<tbody role="rowgroup">
|
|
13
|
-
${
|
|
18
|
+
${r}
|
|
14
19
|
</tbody>
|
|
15
|
-
`}getTableBodyRow(t
|
|
20
|
+
`}getTableBodyRow(e,t){const r=t.map(o=>this.getTableBodyCell(e,o));return this.selectable&&r.unshift(l`<td role="gridcell">
|
|
21
|
+
<ngc-checkbox
|
|
22
|
+
?selected="${e.selected}"
|
|
23
|
+
@change="${o=>this.handleTableBodyRowSelected(o,e)}"
|
|
24
|
+
></ngc-checkbox>
|
|
25
|
+
</td>`),l`
|
|
16
26
|
<tr role="row">
|
|
17
|
-
${
|
|
27
|
+
${r}
|
|
18
28
|
</tr>
|
|
19
|
-
`}
|
|
29
|
+
`}handleTableBodyRowSelected(e,t){e.detail.selected?this.selectedRows.push(t):this.selectedRows=this.selectedRows.filter(r=>r!==t),this.dispatchEvent(new CustomEvent("rowselected",{bubbles:!0,detail:{data:t,selectedRows:this.selectedRows}}))}getTableBodyCell(e,t){return l`
|
|
20
30
|
<td role="gridcell">
|
|
21
|
-
${this.getValueForCell(t
|
|
31
|
+
${this.getValueForCell(e,t)}
|
|
22
32
|
</td>
|
|
23
|
-
`}getValueForCell(t
|
|
33
|
+
`}getValueForCell(e,t){return typeof t.valueGetter=="function"?l`${t.valueGetter(e)}`:e[t.field]}render(){return this.columnDefinitions?this.renderWrapper(this.getTableHeader(this.columnDefinitions),this.getTableBody(this.columnDefinitions,this.data)):null}};c.styles=[a(n),a(h),a(g),a(m)];c=y([p("ngc-table")],c);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./gator/table.gator.js";import"../../assets/index-chunk2.js";import"../../assets/index-chunk3.js";import"./table.js";import"../../assets/index-chunk.js";
|
|
1
|
+
import"./gator/table.gator.js";import"../../assets/index-chunk2.js";import"../../assets/index-chunk3.js";import"../../assets/index-chunk5.js";import"../../assets/index-chunk6.js";import"./table.js";import"../../assets/index-chunk.js";import"../../utils/components/testable-lit-element/testable-lit-element.js";import"../checkbox/checkbox.gator.js";import"../../utils/string-utils.js";import"../../utils/lightdom-utils.js";import"../icon/gator/icon.gator.js";import"../icon/gator/templates/arrow-left.js";import"../icon/icon-registry.js";import"../icon/gator/templates/arrow-right.js";import"../icon/gator/templates/calendar.js";import"../icon/gator/templates/check-circle.js";import"../icon/gator/templates/check.js";import"../icon/gator/templates/checkbox.js";import"../icon/gator/templates/checkbox-selected.js";import"../icon/gator/templates/chevron-down.js";import"../icon/gator/templates/chevron-left.js";import"../icon/gator/templates/chevron-right.js";import"../icon/gator/templates/chevron-up.js";import"../icon/gator/templates/dashboard.js";import"../icon/gator/templates/exit.js";import"../icon/gator/templates/exit-circle.js";import"../icon/gator/templates/eye-crossed.js";import"../icon/gator/templates/info.js";import"../icon/gator/templates/link.js";import"../icon/gator/templates/overflow-menu.js";import"../icon/gator/templates/percent.js";import"../icon/gator/templates/picture.js";import"../icon/gator/templates/shield-lock.js";import"../icon/gator/templates/radio.js";import"../icon/gator/templates/radio-selected.js";import"../icon/gator/templates/restricted.js";import"../icon/gator/templates/settings.js";import"../icon/gator/templates/warning.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{n as t}from"../../assets/index-chunk.js";import{T as p}from"../../utils/components/testable-lit-element/testable-lit-element.js";import"../../assets/index-chunk2.js";var b=Object.defineProperty,a=(r,o,n,f)=>{for(var e=void 0,i=r.length-1,s;i>=0;i--)(s=r[i])&&(e=s(o,n,e)||e);return e&&b(o,n,e),e};class l extends p{constructor(){super(...arguments),this.columnDefinitions=[],this.data=[],this.tableAriaLabelledBy=null,this.selectable=!1}}a([t({type:Object,attribute:"column-definitions"})],l.prototype,"columnDefinitions");a([t({type:Object})],l.prototype,"data");a([t({type:String,attribute:"table-aria-labelledby"})],l.prototype,"tableAriaLabelledBy");a([t({type:Boolean})],l.prototype,"selectable");export{l as N};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { NjcTable } from '../table.ts';
|
|
1
|
+
import { NjcTable, RowData } from '../table.ts';
|
|
2
2
|
export declare class NgcTable extends NjcTable {
|
|
3
3
|
static styles: import('lit').CSSResult[];
|
|
4
|
+
selectedRows: RowData[];
|
|
4
5
|
renderWrapper(header: unknown, body: unknown): import('lit').TemplateResult<1>;
|
|
5
6
|
private getTableHeader;
|
|
7
|
+
handleSelectAll(event: CustomEvent): void;
|
|
6
8
|
private getTableHeaderColumn;
|
|
7
9
|
private getTableBody;
|
|
8
10
|
private getTableBodyRow;
|
|
11
|
+
handleTableBodyRowSelected(event: CustomEvent, rowData: RowData): void;
|
|
9
12
|
private getTableBodyCell;
|
|
10
13
|
private getValueForCell;
|
|
11
14
|
render(): import('lit').TemplateResult<1> | null;
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TestableLitElement } from '../../utils/components/testable-lit-element/testable-lit-element.ts';
|
|
2
2
|
export interface ColumnDefinition {
|
|
3
3
|
id?: string;
|
|
4
4
|
field: string;
|
|
@@ -8,8 +8,9 @@ export interface ColumnDefinition {
|
|
|
8
8
|
export interface RowData {
|
|
9
9
|
[key: string]: any;
|
|
10
10
|
}
|
|
11
|
-
export declare class NjcTable extends
|
|
11
|
+
export declare class NjcTable extends TestableLitElement {
|
|
12
12
|
columnDefinitions: ColumnDefinition[];
|
|
13
13
|
data: RowData[];
|
|
14
14
|
tableAriaLabelledBy: string | null;
|
|
15
|
+
selectable: boolean;
|
|
15
16
|
}
|
package/package.json
CHANGED
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
|
|
3
3
|
"name": "@ncino/web-components",
|
|
4
|
-
"version": "2.2.0-preview.
|
|
4
|
+
"version": "2.2.0-preview.5",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -3657,7 +3657,7 @@
|
|
|
3657
3657
|
},
|
|
3658
3658
|
{
|
|
3659
3659
|
"name": "ngc-table",
|
|
3660
|
-
"description": "\n---\n",
|
|
3660
|
+
"description": "\n---\n\n\n### **Events:**\n - **selectall**\n- **rowselected**",
|
|
3661
3661
|
"doc-url": "",
|
|
3662
3662
|
"attributes": [
|
|
3663
3663
|
{
|
|
@@ -3671,16 +3671,36 @@
|
|
|
3671
3671
|
{
|
|
3672
3672
|
"name": "table-aria-labelledby",
|
|
3673
3673
|
"value": { "type": "string | null", "default": "null" }
|
|
3674
|
+
},
|
|
3675
|
+
{
|
|
3676
|
+
"name": "selectable",
|
|
3677
|
+
"value": { "type": "boolean", "default": "false" }
|
|
3678
|
+
},
|
|
3679
|
+
{
|
|
3680
|
+
"name": "data-testid",
|
|
3681
|
+
"value": { "type": "string | undefined", "default": "undefined" }
|
|
3674
3682
|
}
|
|
3675
3683
|
],
|
|
3676
|
-
"events": [
|
|
3684
|
+
"events": [
|
|
3685
|
+
{ "name": "selectall", "type": "CustomEvent" },
|
|
3686
|
+
{ "name": "rowselected", "type": "CustomEvent" }
|
|
3687
|
+
],
|
|
3677
3688
|
"js": {
|
|
3678
3689
|
"properties": [
|
|
3690
|
+
{ "name": "selectedRows", "type": "RowData[]" },
|
|
3679
3691
|
{ "name": "columnDefinitions", "type": "ColumnDefinition[]" },
|
|
3680
3692
|
{ "name": "data", "type": "RowData[]" },
|
|
3681
|
-
{ "name": "tableAriaLabelledBy", "type": "string | null" }
|
|
3693
|
+
{ "name": "tableAriaLabelledBy", "type": "string | null" },
|
|
3694
|
+
{ "name": "selectable", "type": "boolean" },
|
|
3695
|
+
{ "name": "dataTestid", "type": "string | undefined" },
|
|
3696
|
+
{ "name": "labelDataTestid" },
|
|
3697
|
+
{ "name": "helpTextDataTestid" },
|
|
3698
|
+
{ "name": "errorMessageDataTestid" }
|
|
3682
3699
|
],
|
|
3683
|
-
"events": [
|
|
3700
|
+
"events": [
|
|
3701
|
+
{ "name": "selectall", "type": "CustomEvent" },
|
|
3702
|
+
{ "name": "rowselected", "type": "CustomEvent" }
|
|
3703
|
+
]
|
|
3684
3704
|
}
|
|
3685
3705
|
},
|
|
3686
3706
|
{
|