@zywave/zui-table 4.0.0-pre.1
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/README.md +27 -0
- package/demo/index.html +435 -0
- package/dist/css/zui-table.fouc.css +1 -0
- package/dist/custom-elements.json +405 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/zui-table-cell-css.d.ts +1 -0
- package/dist/zui-table-cell-css.js +3 -0
- package/dist/zui-table-cell-css.js.map +1 -0
- package/dist/zui-table-cell.d.ts +21 -0
- package/dist/zui-table-cell.js +43 -0
- package/dist/zui-table-cell.js.map +1 -0
- package/dist/zui-table-css.d.ts +1 -0
- package/dist/zui-table-css.js +3 -0
- package/dist/zui-table-css.js.map +1 -0
- package/dist/zui-table-footer-css.d.ts +1 -0
- package/dist/zui-table-footer-css.js +3 -0
- package/dist/zui-table-footer-css.js.map +1 -0
- package/dist/zui-table-footer.d.ts +17 -0
- package/dist/zui-table-footer.js +22 -0
- package/dist/zui-table-footer.js.map +1 -0
- package/dist/zui-table-row-css.d.ts +1 -0
- package/dist/zui-table-row-css.js +3 -0
- package/dist/zui-table-row-css.js.map +1 -0
- package/dist/zui-table-row.d.ts +31 -0
- package/dist/zui-table-row.js +52 -0
- package/dist/zui-table-row.js.map +1 -0
- package/dist/zui-table-topbar-css.d.ts +1 -0
- package/dist/zui-table-topbar-css.js +3 -0
- package/dist/zui-table-topbar-css.js.map +1 -0
- package/dist/zui-table-topbar.d.ts +17 -0
- package/dist/zui-table-topbar.js +24 -0
- package/dist/zui-table-topbar.js.map +1 -0
- package/dist/zui-table.d.ts +45 -0
- package/dist/zui-table.js +96 -0
- package/dist/zui-table.js.map +1 -0
- package/lab.html +467 -0
- package/package.json +37 -0
- package/src/css/zui-table.fouc.scss +137 -0
- package/src/index.ts +5 -0
- package/src/zui-table-cell-css.js +3 -0
- package/src/zui-table-cell.scss +5 -0
- package/src/zui-table-cell.ts +41 -0
- package/src/zui-table-css.js +3 -0
- package/src/zui-table-footer-css.js +3 -0
- package/src/zui-table-footer.scss +12 -0
- package/src/zui-table-footer.ts +30 -0
- package/src/zui-table-row-css.js +3 -0
- package/src/zui-table-row.scss +25 -0
- package/src/zui-table-row.ts +49 -0
- package/src/zui-table-topbar-css.js +3 -0
- package/src/zui-table-topbar.scss +40 -0
- package/src/zui-table-topbar.ts +32 -0
- package/src/zui-table.scss +39 -0
- package/src/zui-table.ts +93 -0
- package/test/zui-table.test.ts +129 -0
- package/tsconfig.build.json +10 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { ZuiBaseElement } from '@zywave/zui-base';
|
|
8
|
+
import { html } from 'lit';
|
|
9
|
+
import { property } from 'lit/decorators.js';
|
|
10
|
+
import { style } from './zui-table-row-css.js';
|
|
11
|
+
/**
|
|
12
|
+
* @element zui-table-row
|
|
13
|
+
*
|
|
14
|
+
* @slot - Default slot; `<zui-table-cell>`s are declared here
|
|
15
|
+
*
|
|
16
|
+
* @attr {boolean} header - Set table header row
|
|
17
|
+
* @attr {boolean} summary - Set table summary row
|
|
18
|
+
* @prop {boolean} header - Set table header row
|
|
19
|
+
* @prop {boolean} summary - Set table summary row
|
|
20
|
+
*
|
|
21
|
+
* @cssprop [--zui-table-summary-background-color=var(--zui-gray-600)] - Set the table summary background color
|
|
22
|
+
* @cssprop [--zui-table-summary-text-color=#fff] - Set the the table summary text color
|
|
23
|
+
*/
|
|
24
|
+
export class ZuiTableRowElement extends ZuiBaseElement {
|
|
25
|
+
constructor() {
|
|
26
|
+
super(...arguments);
|
|
27
|
+
/**
|
|
28
|
+
* property to declare the first row as the table header row
|
|
29
|
+
*/
|
|
30
|
+
this.header = false;
|
|
31
|
+
/**
|
|
32
|
+
* property to declare a summary row; typically the last row in zui-table before zui-table-footer
|
|
33
|
+
*/
|
|
34
|
+
this.summary = false;
|
|
35
|
+
}
|
|
36
|
+
static get styles() {
|
|
37
|
+
return [super.styles, style];
|
|
38
|
+
}
|
|
39
|
+
render() {
|
|
40
|
+
return html `<div role="row">
|
|
41
|
+
<slot></slot>
|
|
42
|
+
</div>`;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
__decorate([
|
|
46
|
+
property({ type: Boolean, reflect: true })
|
|
47
|
+
], ZuiTableRowElement.prototype, "header", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
property({ type: Boolean, reflect: true })
|
|
50
|
+
], ZuiTableRowElement.prototype, "summary", void 0);
|
|
51
|
+
window.customElements.define('zui-table-row', ZuiTableRowElement);
|
|
52
|
+
//# sourceMappingURL=zui-table-row.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zui-table-row.js","sourceRoot":"","sources":["../src/zui-table-row.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAE/C;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,kBAAmB,SAAQ,cAAc;IAAtD;;QACE;;WAEG;QAEH,WAAM,GAAG,KAAK,CAAC;QAEf;;WAEG;QAEH,YAAO,GAAG,KAAK,CAAC;IAWlB,CAAC;IATC,MAAM,KAAK,MAAM;QACf,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA;;WAEJ,CAAC;IACV,CAAC;CACF;AAjBC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;kDAC5B;AAMf;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;mDAC3B;AAalB,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import { ZuiBaseElement } from '@zywave/zui-base';\nimport { html } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { style } from './zui-table-row-css.js';\n\n/**\n * @element zui-table-row\n *\n * @slot - Default slot; `<zui-table-cell>`s are declared here\n *\n * @attr {boolean} header - Set table header row\n * @attr {boolean} summary - Set table summary row\n * @prop {boolean} header - Set table header row\n * @prop {boolean} summary - Set table summary row\n *\n * @cssprop [--zui-table-summary-background-color=var(--zui-gray-600)] - Set the table summary background color\n * @cssprop [--zui-table-summary-text-color=#fff] - Set the the table summary text color\n */\nexport class ZuiTableRowElement extends ZuiBaseElement {\n /**\n * property to declare the first row as the table header row\n */\n @property({ type: Boolean, reflect: true })\n header = false;\n\n /**\n * property to declare a summary row; typically the last row in zui-table before zui-table-footer\n */\n @property({ type: Boolean, reflect: true })\n summary = false;\n\n static get styles() {\n return [super.styles, style];\n }\n\n render() {\n return html`<div role=\"row\">\n <slot></slot>\n </div>`;\n }\n}\n\nwindow.customElements.define('zui-table-row', ZuiTableRowElement);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'zui-table-row': ZuiTableRowElement;\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const style: import("lit").CSSResult;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const style = css `.topbar{display:flex;width:100%;min-height:3.75rem;align-items:center;padding:.625rem 1.25rem;background-color:var(--zui-gray-25)}.content{display:flex;flex:1;align-items:center}.content ::slotted(zui-search){--zui-search-border-color: var(--zui-gray-50)}.counter{flex-shrink:0;margin-left:auto;padding-left:.625rem;font-size:.75rem;color:var(--zui-gray-400)}.action{margin-left:.625rem}.action ::slotted(zui-button:not(:first-of-type)){margin-left:.625rem}slot[name=action]{display:flex}`;
|
|
3
|
+
//# sourceMappingURL=zui-table-topbar-css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zui-table-topbar-css.js","sourceRoot":"","sources":["../src/zui-table-topbar-css.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA,0eAA0e,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const style = css`.topbar{display:flex;width:100%;min-height:3.75rem;align-items:center;padding:.625rem 1.25rem;background-color:var(--zui-gray-25)}.content{display:flex;flex:1;align-items:center}.content ::slotted(zui-search){--zui-search-border-color: var(--zui-gray-50)}.counter{flex-shrink:0;margin-left:auto;padding-left:.625rem;font-size:.75rem;color:var(--zui-gray-400)}.action{margin-left:.625rem}.action ::slotted(zui-button:not(:first-of-type)){margin-left:.625rem}slot[name=action]{display:flex}`;\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ZuiBaseElement } from '@zywave/zui-base';
|
|
2
|
+
/**
|
|
3
|
+
* @element zui-table-topbar
|
|
4
|
+
*
|
|
5
|
+
* @slot - Default slot; table cell content goes here
|
|
6
|
+
* @slot counter - Total number of results from table goes here
|
|
7
|
+
* @slot action - Action(s) that affect the whole table goes here
|
|
8
|
+
*/
|
|
9
|
+
export declare class ZuiTableTopbarElement extends ZuiBaseElement {
|
|
10
|
+
static get styles(): (import("lit").CSSResult | import("lit").CSSResultArray)[];
|
|
11
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
12
|
+
}
|
|
13
|
+
declare global {
|
|
14
|
+
interface HTMLElementTagNameMap {
|
|
15
|
+
'zui-table-topbar': ZuiTableTopbarElement;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ZuiBaseElement } from '@zywave/zui-base';
|
|
2
|
+
import { html } from 'lit';
|
|
3
|
+
import { style } from './zui-table-topbar-css.js';
|
|
4
|
+
/**
|
|
5
|
+
* @element zui-table-topbar
|
|
6
|
+
*
|
|
7
|
+
* @slot - Default slot; table cell content goes here
|
|
8
|
+
* @slot counter - Total number of results from table goes here
|
|
9
|
+
* @slot action - Action(s) that affect the whole table goes here
|
|
10
|
+
*/
|
|
11
|
+
export class ZuiTableTopbarElement extends ZuiBaseElement {
|
|
12
|
+
static get styles() {
|
|
13
|
+
return [super.styles, style];
|
|
14
|
+
}
|
|
15
|
+
render() {
|
|
16
|
+
return html `<div class="topbar">
|
|
17
|
+
<div class="content"><slot></slot></div>
|
|
18
|
+
<div class="counter"><slot name="counter"></slot></div>
|
|
19
|
+
<div class="action"><slot name="action"></slot></div>
|
|
20
|
+
</div>`;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
window.customElements.define('zui-table-topbar', ZuiTableTopbarElement);
|
|
24
|
+
//# sourceMappingURL=zui-table-topbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zui-table-topbar.js","sourceRoot":"","sources":["../src/zui-table-topbar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAElD;;;;;;GAMG;AACH,MAAM,OAAO,qBAAsB,SAAQ,cAAc;IACvD,MAAM,KAAK,MAAM;QACf,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA;;;;WAIJ,CAAC;IACV,CAAC;CACF;AAED,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["import { ZuiBaseElement } from '@zywave/zui-base';\nimport { html } from 'lit';\nimport { style } from './zui-table-topbar-css.js';\n\n/**\n * @element zui-table-topbar\n *\n * @slot - Default slot; table cell content goes here\n * @slot counter - Total number of results from table goes here\n * @slot action - Action(s) that affect the whole table goes here\n */\nexport class ZuiTableTopbarElement extends ZuiBaseElement {\n static get styles() {\n return [super.styles, style];\n }\n\n render() {\n return html`<div class=\"topbar\">\n <div class=\"content\"><slot></slot></div>\n <div class=\"counter\"><slot name=\"counter\"></slot></div>\n <div class=\"action\"><slot name=\"action\"></slot></div>\n </div>`;\n }\n}\n\nwindow.customElements.define('zui-table-topbar', ZuiTableTopbarElement);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'zui-table-topbar': ZuiTableTopbarElement;\n }\n}\n"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ZuiBaseElement } from '@zywave/zui-base';
|
|
2
|
+
/**
|
|
3
|
+
* @element zui-table
|
|
4
|
+
*
|
|
5
|
+
* @slot - Default slot; all table content will appear here, such as table rows
|
|
6
|
+
* @slot no-results-message - Customize the no results message that is shown when `<zui-table>` has the attribute `no-results`: `<zui-table no-results>`
|
|
7
|
+
* @slot footer - Only for `<zui-table-footer>`. When there is a `<zui-table-footer>` present inside `<zui-table>`, it will be auto-assigned to this slot in order to place it outside of the rendered table for styling purposes.
|
|
8
|
+
*
|
|
9
|
+
* @attr {number} columns - Amount of columns to show in the table
|
|
10
|
+
* @attr {boolean} banded - Style option to alternate row background colors
|
|
11
|
+
* @attr {boolean} no-results - To show or hide no results message when there are no results
|
|
12
|
+
* @prop {number} columns - Amount of columns to show in the table
|
|
13
|
+
* @prop {boolean} banded - Style option to alternate row background colors
|
|
14
|
+
* @prop {boolean} noResults - To show or hide no results message when there are no results
|
|
15
|
+
*
|
|
16
|
+
* @cssprop [--zui-table-cell-padding=13px 20px] - Override cell padding
|
|
17
|
+
* @cssprop [--zui-table-summary-background-color=var(--zui-gray-600)] - Set the table summary background color
|
|
18
|
+
* @cssprop [--zui-table-summary-text-color=#fff] - Set the the table summary text color
|
|
19
|
+
* @cssprop [--zui-table-footer-margin=10px] - Margin between the table and footer of the table
|
|
20
|
+
*/
|
|
21
|
+
export declare class ZuiTableElement extends ZuiBaseElement {
|
|
22
|
+
#private;
|
|
23
|
+
/**
|
|
24
|
+
* property to display number of columns
|
|
25
|
+
*/
|
|
26
|
+
columns: string;
|
|
27
|
+
/**
|
|
28
|
+
* property to apply alternating background colors to table rows
|
|
29
|
+
*/
|
|
30
|
+
banded: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* property to show or hide no results message when there are no results in the table
|
|
33
|
+
*/
|
|
34
|
+
noResults: boolean;
|
|
35
|
+
private _slotEl;
|
|
36
|
+
private get _footer();
|
|
37
|
+
static get styles(): (import("lit").CSSResult | import("lit").CSSResultArray)[];
|
|
38
|
+
firstUpdated(): void;
|
|
39
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
40
|
+
}
|
|
41
|
+
declare global {
|
|
42
|
+
interface HTMLElementTagNameMap {
|
|
43
|
+
'zui-table': ZuiTableElement;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _ZuiTableElement_instances, _ZuiTableElement_renderNoResultsView, _ZuiTableElement_reassignFooter;
|
|
13
|
+
import { ZuiBaseElement } from '@zywave/zui-base';
|
|
14
|
+
import { html } from 'lit';
|
|
15
|
+
import { property, query } from 'lit/decorators.js';
|
|
16
|
+
import { style } from './zui-table-css.js';
|
|
17
|
+
import { styleMap } from 'lit/directives/style-map.js';
|
|
18
|
+
import { findAssignedElement } from '@zywave/zui-base/dist/utils/find-assigned-element.js';
|
|
19
|
+
/**
|
|
20
|
+
* @element zui-table
|
|
21
|
+
*
|
|
22
|
+
* @slot - Default slot; all table content will appear here, such as table rows
|
|
23
|
+
* @slot no-results-message - Customize the no results message that is shown when `<zui-table>` has the attribute `no-results`: `<zui-table no-results>`
|
|
24
|
+
* @slot footer - Only for `<zui-table-footer>`. When there is a `<zui-table-footer>` present inside `<zui-table>`, it will be auto-assigned to this slot in order to place it outside of the rendered table for styling purposes.
|
|
25
|
+
*
|
|
26
|
+
* @attr {number} columns - Amount of columns to show in the table
|
|
27
|
+
* @attr {boolean} banded - Style option to alternate row background colors
|
|
28
|
+
* @attr {boolean} no-results - To show or hide no results message when there are no results
|
|
29
|
+
* @prop {number} columns - Amount of columns to show in the table
|
|
30
|
+
* @prop {boolean} banded - Style option to alternate row background colors
|
|
31
|
+
* @prop {boolean} noResults - To show or hide no results message when there are no results
|
|
32
|
+
*
|
|
33
|
+
* @cssprop [--zui-table-cell-padding=13px 20px] - Override cell padding
|
|
34
|
+
* @cssprop [--zui-table-summary-background-color=var(--zui-gray-600)] - Set the table summary background color
|
|
35
|
+
* @cssprop [--zui-table-summary-text-color=#fff] - Set the the table summary text color
|
|
36
|
+
* @cssprop [--zui-table-footer-margin=10px] - Margin between the table and footer of the table
|
|
37
|
+
*/
|
|
38
|
+
export class ZuiTableElement extends ZuiBaseElement {
|
|
39
|
+
constructor() {
|
|
40
|
+
super(...arguments);
|
|
41
|
+
_ZuiTableElement_instances.add(this);
|
|
42
|
+
/**
|
|
43
|
+
* property to display number of columns
|
|
44
|
+
*/
|
|
45
|
+
this.columns = '1';
|
|
46
|
+
/**
|
|
47
|
+
* property to apply alternating background colors to table rows
|
|
48
|
+
*/
|
|
49
|
+
this.banded = false;
|
|
50
|
+
// TODO: add divided prop so all table cells will have 1px border
|
|
51
|
+
/**
|
|
52
|
+
* property to show or hide no results message when there are no results in the table
|
|
53
|
+
*/
|
|
54
|
+
this.noResults = false;
|
|
55
|
+
}
|
|
56
|
+
get _footer() {
|
|
57
|
+
return findAssignedElement(this._slotEl, 'zui-table-footer');
|
|
58
|
+
}
|
|
59
|
+
static get styles() {
|
|
60
|
+
return [super.styles, style];
|
|
61
|
+
}
|
|
62
|
+
firstUpdated() {
|
|
63
|
+
__classPrivateFieldGet(this, _ZuiTableElement_instances, "m", _ZuiTableElement_reassignFooter).call(this);
|
|
64
|
+
}
|
|
65
|
+
render() {
|
|
66
|
+
const columnsCssPropVal = {
|
|
67
|
+
'--zui-table-columns': this.columns,
|
|
68
|
+
};
|
|
69
|
+
return html `<div role="table" class="table" style="${styleMap(columnsCssPropVal)}">
|
|
70
|
+
<slot></slot>
|
|
71
|
+
${this.noResults ? __classPrivateFieldGet(this, _ZuiTableElement_instances, "m", _ZuiTableElement_renderNoResultsView).call(this) : ``}</div
|
|
72
|
+
>
|
|
73
|
+
<div><slot name="footer"></slot></div>`;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
_ZuiTableElement_instances = new WeakSet(), _ZuiTableElement_renderNoResultsView = function _ZuiTableElement_renderNoResultsView() {
|
|
77
|
+
return html `<div class="no-results"><slot name="no-results-message"></slot></div>`;
|
|
78
|
+
}, _ZuiTableElement_reassignFooter = function _ZuiTableElement_reassignFooter() {
|
|
79
|
+
if (this._footer) {
|
|
80
|
+
this._footer.setAttribute('slot', 'footer');
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
__decorate([
|
|
84
|
+
property({ type: String, reflect: true })
|
|
85
|
+
], ZuiTableElement.prototype, "columns", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
property({ type: Boolean, reflect: true })
|
|
88
|
+
], ZuiTableElement.prototype, "banded", void 0);
|
|
89
|
+
__decorate([
|
|
90
|
+
property({ type: Boolean, reflect: true, attribute: 'no-results' })
|
|
91
|
+
], ZuiTableElement.prototype, "noResults", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
query('slot')
|
|
94
|
+
], ZuiTableElement.prototype, "_slotEl", void 0);
|
|
95
|
+
window.customElements.define('zui-table', ZuiTableElement);
|
|
96
|
+
//# sourceMappingURL=zui-table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zui-table.js","sourceRoot":"","sources":["../src/zui-table.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sDAAsD,CAAC;AAE3F;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,OAAO,eAAgB,SAAQ,cAAc;IAAnD;;;QACE;;WAEG;QAEH,YAAO,GAAG,GAAG,CAAC;QAEd;;WAEG;QAEH,WAAM,GAAG,KAAK,CAAC;QAEf,iEAAiE;QAEjE;;WAEG;QAEH,cAAS,GAAG,KAAK,CAAC;IAsCpB,CAAC;IAjCC,IAAY,OAAO;QACjB,OAAO,mBAAmB,CAAC,IAAI,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;IAC/D,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED,YAAY;QACV,uBAAA,IAAI,mEAAgB,MAApB,IAAI,CAAkB,CAAC;IACzB,CAAC;IAED,MAAM;QACJ,MAAM,iBAAiB,GAAG;YACxB,qBAAqB,EAAE,IAAI,CAAC,OAAO;SACpC,CAAC;QAEF,OAAO,IAAI,CAAA,0CAA0C,QAAQ,CAAC,iBAAiB,CAAC;;UAE1E,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,uBAAA,IAAI,wEAAqB,MAAzB,IAAI,CAAuB,CAAC,CAAC,CAAC,EAAE;;6CAEd,CAAC;IAC5C,CAAC;CAWF;;IARG,OAAO,IAAI,CAAA,uEAAuE,CAAC;AACrF,CAAC;IAGC,IAAI,IAAI,CAAC,OAAO,EAAE;QAChB,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;KAC7C;AACH,CAAC;AAnDD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;gDAC5B;AAMd;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CAC5B;AAQf;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;kDAClD;AAGlB;IADC,KAAK,CAAC,MAAM,CAAC;gDACmB;AAqCnC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC","sourcesContent":["import { ZuiBaseElement } from '@zywave/zui-base';\nimport { html } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { style } from './zui-table-css.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport { findAssignedElement } from '@zywave/zui-base/dist/utils/find-assigned-element.js';\n\n/**\n * @element zui-table\n *\n * @slot - Default slot; all table content will appear here, such as table rows\n * @slot no-results-message - Customize the no results message that is shown when `<zui-table>` has the attribute `no-results`: `<zui-table no-results>`\n * @slot footer - Only for `<zui-table-footer>`. When there is a `<zui-table-footer>` present inside `<zui-table>`, it will be auto-assigned to this slot in order to place it outside of the rendered table for styling purposes.\n *\n * @attr {number} columns - Amount of columns to show in the table\n * @attr {boolean} banded - Style option to alternate row background colors\n * @attr {boolean} no-results - To show or hide no results message when there are no results\n * @prop {number} columns - Amount of columns to show in the table\n * @prop {boolean} banded - Style option to alternate row background colors\n * @prop {boolean} noResults - To show or hide no results message when there are no results\n *\n * @cssprop [--zui-table-cell-padding=13px 20px] - Override cell padding\n * @cssprop [--zui-table-summary-background-color=var(--zui-gray-600)] - Set the table summary background color\n * @cssprop [--zui-table-summary-text-color=#fff] - Set the the table summary text color\n * @cssprop [--zui-table-footer-margin=10px] - Margin between the table and footer of the table\n */\n\nexport class ZuiTableElement extends ZuiBaseElement {\n /**\n * property to display number of columns\n */\n @property({ type: String, reflect: true })\n columns = '1';\n\n /**\n * property to apply alternating background colors to table rows\n */\n @property({ type: Boolean, reflect: true })\n banded = false;\n\n // TODO: add divided prop so all table cells will have 1px border\n\n /**\n * property to show or hide no results message when there are no results in the table\n */\n @property({ type: Boolean, reflect: true, attribute: 'no-results' })\n noResults = false;\n\n @query('slot')\n private _slotEl: HTMLSlotElement;\n\n private get _footer() {\n return findAssignedElement(this._slotEl, 'zui-table-footer');\n }\n\n static get styles() {\n return [super.styles, style];\n }\n\n firstUpdated() {\n this.#reassignFooter();\n }\n\n render() {\n const columnsCssPropVal = {\n '--zui-table-columns': this.columns,\n };\n\n return html`<div role=\"table\" class=\"table\" style=\"${styleMap(columnsCssPropVal)}\">\n <slot></slot>\n ${this.noResults ? this.#renderNoResultsView() : ``}</div\n >\n <div><slot name=\"footer\"></slot></div>`;\n }\n\n #renderNoResultsView() {\n return html`<div class=\"no-results\"><slot name=\"no-results-message\"></slot></div>`;\n }\n\n #reassignFooter() {\n if (this._footer) {\n this._footer.setAttribute('slot', 'footer');\n }\n }\n}\n\nwindow.customElements.define('zui-table', ZuiTableElement);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'zui-table': ZuiTableElement;\n }\n}\n"]}
|