@aquera/nile-elements 0.1.67-beta-2.5 → 0.1.67-beta-2.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/demo/index.html +182 -9
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +122 -100
- package/dist/nile-option/nile-option.cjs.js +1 -1
- package/dist/nile-option/nile-option.cjs.js.map +1 -1
- package/dist/nile-option/nile-option.esm.js +2 -2
- package/dist/nile-select/nile-select.cjs.js +1 -1
- package/dist/nile-select/nile-select.cjs.js.map +1 -1
- package/dist/nile-select/nile-select.esm.js +9 -9
- package/dist/nile-table-body/nile-table-body.cjs.js +1 -1
- package/dist/nile-table-body/nile-table-body.cjs.js.map +1 -1
- package/dist/nile-table-body/nile-table-body.esm.js +2 -2
- package/dist/nile-table-row/nile-table-row.cjs.js +1 -1
- package/dist/nile-table-row/nile-table-row.cjs.js.map +1 -1
- package/dist/nile-table-row/nile-table-row.css.cjs.js +1 -1
- package/dist/nile-table-row/nile-table-row.css.cjs.js.map +1 -1
- package/dist/nile-table-row/nile-table-row.css.esm.js +52 -0
- package/dist/nile-table-row/nile-table-row.esm.js +34 -6
- package/dist/src/index.d.ts +0 -1
- package/dist/src/index.js +0 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/nile-option/nile-option.d.ts +0 -1
- package/dist/src/nile-option/nile-option.js +0 -5
- package/dist/src/nile-option/nile-option.js.map +1 -1
- package/dist/src/nile-option-group/nile-option-group.interface.d.ts +1 -0
- package/dist/src/nile-option-group/nile-option-group.interface.js.map +1 -1
- package/dist/src/nile-option-group/nile-option-group.js +7 -7
- package/dist/src/nile-option-group/nile-option-group.js.map +1 -1
- package/dist/src/nile-select/nile-select.d.ts +0 -6
- package/dist/src/nile-select/nile-select.js +1 -59
- package/dist/src/nile-select/nile-select.js.map +1 -1
- package/dist/src/nile-table-body/nile-table-body.d.ts +1 -0
- package/dist/src/nile-table-body/nile-table-body.js +7 -0
- package/dist/src/nile-table-body/nile-table-body.js.map +1 -1
- package/dist/src/nile-table-row/nile-table-row.css.js +52 -0
- package/dist/src/nile-table-row/nile-table-row.css.js.map +1 -1
- package/dist/src/nile-table-row/nile-table-row.d.ts +10 -1
- package/dist/src/nile-table-row/nile-table-row.js +87 -9
- package/dist/src/nile-table-row/nile-table-row.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -4
- package/src/index.ts +1 -2
- package/src/nile-option/nile-option.ts +0 -3
- package/src/nile-select/nile-select.ts +2 -74
- package/src/nile-table-body/nile-table-body.ts +4 -0
- package/src/nile-table-row/nile-table-row.css.ts +52 -0
- package/src/nile-table-row/nile-table-row.ts +84 -5
- package/vscode-html-custom-data.json +25 -29
- package/src/nile-option-group/index.ts +0 -1
- package/src/nile-option-group/nile-option-group.css.ts +0 -60
- package/src/nile-option-group/nile-option-group.interface.ts +0 -24
- package/src/nile-option-group/nile-option-group.ts +0 -84
- package/src/nile-select/nile-select.interface.ts +0 -5
@@ -6,7 +6,7 @@
|
|
6
6
|
*/
|
7
7
|
import { __decorate } from "tslib";
|
8
8
|
import { html, } from 'lit';
|
9
|
-
import { customElement } from 'lit/decorators.js';
|
9
|
+
import { customElement, query, property } from 'lit/decorators.js';
|
10
10
|
import { styles } from './nile-table-row.css';
|
11
11
|
import NileElement from '../internal/nile-element';
|
12
12
|
/**
|
@@ -16,19 +16,37 @@ import NileElement from '../internal/nile-element';
|
|
16
16
|
*
|
17
17
|
*/
|
18
18
|
let NileTableRow = class NileTableRow extends NileElement {
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
constructor() {
|
20
|
+
/**
|
21
|
+
* The styles for TableRow
|
22
|
+
* @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`
|
23
|
+
*/
|
24
|
+
super(...arguments);
|
25
|
+
this.expandable = false;
|
26
|
+
this.expanded = false;
|
27
|
+
this.tableBodyHasExpandable = this.closest('nile-table-body');
|
28
|
+
/* #endregion */
|
29
|
+
}
|
23
30
|
static get styles() {
|
24
31
|
return [styles];
|
25
32
|
}
|
33
|
+
toggleExpand(e) {
|
34
|
+
this.expanded = !this.expanded;
|
35
|
+
this.dispatchEvent(new CustomEvent('nile-change', {
|
36
|
+
detail: { expanded: this.expanded },
|
37
|
+
bubbles: true,
|
38
|
+
composed: true,
|
39
|
+
}));
|
40
|
+
}
|
26
41
|
/* #endregion */
|
27
42
|
/* #region Methods */
|
28
43
|
/**
|
29
44
|
* Render method
|
30
45
|
* @slot This is a slot test
|
31
46
|
*/
|
47
|
+
firstUpdated() {
|
48
|
+
this._fallbackIcon = this.renderRoot?.querySelector('nile-icon') ?? null;
|
49
|
+
}
|
32
50
|
handleSortingAlter(event) {
|
33
51
|
const header_items = [
|
34
52
|
...this.querySelectorAll('nile-table-header-item'),
|
@@ -41,15 +59,75 @@ let NileTableRow = class NileTableRow extends NileElement {
|
|
41
59
|
}
|
42
60
|
}
|
43
61
|
}
|
62
|
+
updated(changedProperties) {
|
63
|
+
if (!changedProperties.has('expandable') || !this._iconSlot)
|
64
|
+
return;
|
65
|
+
const assigned = this._iconSlot.assignedElements();
|
66
|
+
const hasAssigned = assigned.length > 0;
|
67
|
+
const displayValue = this.expandable ? '' : 'none';
|
68
|
+
if (hasAssigned) {
|
69
|
+
for (const el of assigned) {
|
70
|
+
el.style.display = displayValue;
|
71
|
+
}
|
72
|
+
}
|
73
|
+
else if (this._fallbackIcon) {
|
74
|
+
this._fallbackIcon.style.display = displayValue;
|
75
|
+
}
|
76
|
+
}
|
44
77
|
render() {
|
78
|
+
if (!this.expandable && !this.tableBodyHasExpandable.expandableRows) {
|
79
|
+
return html `
|
80
|
+
<slot
|
81
|
+
part="nile-row"
|
82
|
+
@nile-click-sort="${this.handleSortingAlter}"
|
83
|
+
></slot>
|
84
|
+
`;
|
85
|
+
}
|
45
86
|
return html `
|
46
|
-
<
|
47
|
-
|
48
|
-
|
49
|
-
|
87
|
+
<div part="row-container" class="row-container">
|
88
|
+
<div
|
89
|
+
part="nile-row"
|
90
|
+
class="row expandable ${this.expanded ? 'expanded' : ''}"
|
91
|
+
@nile-click-sort="${this.handleSortingAlter}"
|
92
|
+
>
|
93
|
+
<slot
|
94
|
+
name="expandableIcon"
|
95
|
+
@click=${this.toggleExpand}
|
96
|
+
class="expand-icon"
|
97
|
+
part="expandable-icon"
|
98
|
+
>
|
99
|
+
<nile-icon
|
100
|
+
name="${this.expanded ? 'chevron-up' : 'chevron-down'}"
|
101
|
+
role="button"
|
102
|
+
size="10"
|
103
|
+
aria-label="${this.expanded ? 'Collapse row' : 'Expand row'}">
|
104
|
+
</nile-icon>
|
105
|
+
</slot>
|
106
|
+
<slot></slot>
|
107
|
+
</div>
|
108
|
+
|
109
|
+
${this.expanded && this.expandable
|
110
|
+
? html `
|
111
|
+
<div class="expanded-content" part="expanded-content">
|
112
|
+
<slot name="expanded"></slot>
|
113
|
+
</div>`
|
114
|
+
: null}
|
115
|
+
</div>
|
50
116
|
`;
|
51
117
|
}
|
52
118
|
};
|
119
|
+
__decorate([
|
120
|
+
property({ type: Boolean, reflect: true, attribute: true })
|
121
|
+
], NileTableRow.prototype, "expandable", void 0);
|
122
|
+
__decorate([
|
123
|
+
property({ type: Boolean, reflect: true, attribute: true })
|
124
|
+
], NileTableRow.prototype, "expanded", void 0);
|
125
|
+
__decorate([
|
126
|
+
query('slot[name="expanded"]')
|
127
|
+
], NileTableRow.prototype, "_expandedSlot", void 0);
|
128
|
+
__decorate([
|
129
|
+
query('slot[name="expandableIcon"]')
|
130
|
+
], NileTableRow.prototype, "_iconSlot", void 0);
|
53
131
|
NileTableRow = __decorate([
|
54
132
|
customElement('nile-table-row')
|
55
133
|
], NileTableRow);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-table-row.js","sourceRoot":"","sources":["../../../src/nile-table-row/nile-table-row.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAEL,IAA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ImB,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE;8BACnC,IAAI,CAAC,kBAAkB;;;;eAItC,IAAI,CAAC,YAAY;;;;;sBAKV,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,cAAc;;;4BAGvC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,YAAY;;;;;;UAM/D,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,UAAU;YAChC,CAAC,CAAC,IAAI,CAAA;;;qBAGK;YACX,CAAC,CAAC,IAAI;;KAEX,CAAC;IACJ,CAAC;CAEF,CAAA;AA/G8D;IAA5D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAG,SAAS,EAAE,IAAI,EAAC,CAAC;gDAAoB;AAEnB;IAA5D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;8CAAkB;AAGvE;IADN,KAAK,CAAC,uBAAuB,CAAC;mDACQ;AAGhC;IADP,KAAK,CAAC,6BAA6B,CAAC;+CACD;AAjBxB,YAAY;IADxB,aAAa,CAAC,gBAAgB,CAAC;GACnB,YAAY,CAwHxB;;AAED,eAAe,YAAY,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n LitElement,\n html,\n CSSResultArray,\n TemplateResult,\n PropertyValues,\n} from 'lit';\nimport { customElement, query, property } from 'lit/decorators.js';\nimport { styles } from './nile-table-row.css';\nimport NileElement from '../internal/nile-element';\n\n/**\n *nile-table-row component.\n *\n * @tag nile-table-row\n *\n */\n@customElement('nile-table-row')\nexport class NileTableRow extends NileElement {\n /**\n * The styles for TableRow\n * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n */\n\n public static get styles(): CSSResultArray {\n return [styles];\n }\n @property({ type: Boolean, reflect: true , attribute: true}) expandable = false;\n\n @property({ type: Boolean, reflect: true, attribute: true }) expanded = false;\n\n @query('slot[name=\"expanded\"]')\n\tprivate _expandedSlot!: HTMLSlotElement;\n\t\n\t@query('slot[name=\"expandableIcon\"]')\n\tprivate _iconSlot!: HTMLSlotElement;\n\n\tprivate tableBodyHasExpandable: any = this.closest('nile-table-body');\n\n\tprivate _fallbackIcon?: HTMLElement | null;\n\n private toggleExpand(e: MouseEvent): void {\n this.expanded = !this.expanded;\n this.dispatchEvent(new CustomEvent('nile-change', {\n detail: { expanded: this.expanded },\n bubbles: true,\n composed: true,\n }));\n }\n\n\n /* #endregion */\n\n /* #region Methods */\n\n /**\n * Render method\n * @slot This is a slot test\n */\n\n\tprotected firstUpdated(): void {\n\t\tthis._fallbackIcon = this.renderRoot?.querySelector('nile-icon') ?? null;\n\t}\n\n private handleSortingAlter(event: CustomEvent) {\n const header_items: any = [\n ...this.querySelectorAll('nile-table-header-item'),\n ];\n for (let i = 0; i < header_items.length; i++) {\n const header = header_items[i];\n const haveIcon = header.textContent == event.detail.value.curr_sort_string;\n if (!haveIcon) {\n header.sorting_ct = 0;\n }\n }\n }\n\n\tprotected updated(changedProperties: PropertyValues): void {\n\t\tif (!changedProperties.has('expandable') || !this._iconSlot) return;\n\n\t\tconst assigned = this._iconSlot.assignedElements();\n\t\tconst hasAssigned = assigned.length > 0;\n\t\tconst displayValue = this.expandable ? '' : 'none';\n\n\t\tif (hasAssigned) {\n\t\t\tfor (const el of assigned) {\n\t\t\t\t(el as HTMLElement).style.display = displayValue;\n\t\t\t}\n\t\t} else if (this._fallbackIcon) {\n\t\t\tthis._fallbackIcon.style.display = displayValue;\n\t\t}\n\t}\n\n public render(): TemplateResult {\n \n\t\tif (!this.expandable && !this.tableBodyHasExpandable.expandableRows) {\n return html`\n <slot\n part=\"nile-row\"\n @nile-click-sort=\"${this.handleSortingAlter}\"\n ></slot>\n `;\n }\n \n \n return html`\n <div part=\"row-container\" class=\"row-container\">\n <div\n part=\"nile-row\"\n class=\"row expandable ${this.expanded ? 'expanded' : ''}\"\n @nile-click-sort=\"${this.handleSortingAlter}\"\n >\n <slot\n\t\t\t\t\t\tname=\"expandableIcon\"\n\t\t\t\t\t\t@click=${this.toggleExpand} \n\t\t\t\t\t\tclass=\"expand-icon\" \n\t\t\t\t\t\tpart=\"expandable-icon\"\n\t\t\t\t\t>\n <nile-icon\n name=\"${this.expanded ? 'chevron-up' : 'chevron-down'}\"\n role=\"button\"\n size=\"10\"\n aria-label=\"${this.expanded ? 'Collapse row' : 'Expand row'}\">\n </nile-icon>\n </slot>\n <slot></slot>\n </div>\n \n ${this.expanded && this.expandable\n ? html`\n <div class=\"expanded-content\" part=\"expanded-content\">\n <slot name=\"expanded\"></slot>\n </div>`\n : null}\n </div>\n `;\n }\n /* #endregion */\n}\n\nexport default NileTableRow;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-table-row': NileTableRow;\n }\n}\n"]}
|