@aquera/nile-elements 1.7.5 → 1.7.7
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 +6 -0
- package/dist/index.js +61 -19
- package/dist/nile-detail/nile-detail.cjs.js +1 -1
- package/dist/nile-detail/nile-detail.cjs.js.map +1 -1
- package/dist/nile-detail/nile-detail.css.cjs.js +1 -1
- package/dist/nile-detail/nile-detail.css.cjs.js.map +1 -1
- package/dist/nile-detail/nile-detail.css.esm.js +25 -2
- package/dist/nile-detail/nile-detail.esm.js +48 -29
- package/dist/src/nile-detail/nile-detail.css.js +25 -2
- package/dist/src/nile-detail/nile-detail.css.js.map +1 -1
- package/dist/src/nile-detail/nile-detail.d.ts +10 -0
- package/dist/src/nile-detail/nile-detail.js +90 -17
- package/dist/src/nile-detail/nile-detail.js.map +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/nile-detail/nile-detail.css.ts +25 -2
- package/src/nile-detail/nile-detail.ts +85 -19
- package/vscode-html-custom-data.json +14 -1
package/package.json
CHANGED
|
@@ -149,6 +149,11 @@ export const styles = css`
|
|
|
149
149
|
padding: var(--nile-spacing-xl, var(--ng-spacing-xl));
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
+
.detail__content--empty {
|
|
153
|
+
display: none;
|
|
154
|
+
padding: 0;
|
|
155
|
+
}
|
|
156
|
+
|
|
152
157
|
/* ── Selection variant ──────────────────────────────────────────────────── */
|
|
153
158
|
|
|
154
159
|
.detail__selection-label {
|
|
@@ -193,6 +198,23 @@ export const styles = css`
|
|
|
193
198
|
min-width: 0;
|
|
194
199
|
}
|
|
195
200
|
|
|
201
|
+
.detail__selection-search-slot {
|
|
202
|
+
display: flex;
|
|
203
|
+
flex: 1;
|
|
204
|
+
min-width: 0;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.detail__selection-search-slot::slotted(*) {
|
|
208
|
+
flex: 1;
|
|
209
|
+
min-width: 0;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.detail__selected-toggle {
|
|
213
|
+
display: inline-flex;
|
|
214
|
+
align-items: center;
|
|
215
|
+
gap: 6px;
|
|
216
|
+
}
|
|
217
|
+
|
|
196
218
|
.detail__selection-actions {
|
|
197
219
|
display: flex;
|
|
198
220
|
align-items: center;
|
|
@@ -206,7 +228,7 @@ export const styles = css`
|
|
|
206
228
|
gap: 8px 24px;
|
|
207
229
|
overflow-x: auto;
|
|
208
230
|
overflow-y: hidden;
|
|
209
|
-
padding
|
|
231
|
+
padding: 4px 4px 8px;
|
|
210
232
|
scroll-snap-type: x proximity;
|
|
211
233
|
}
|
|
212
234
|
|
|
@@ -253,7 +275,8 @@ export const styles = css`
|
|
|
253
275
|
min-width: 0;
|
|
254
276
|
display: block;
|
|
255
277
|
max-width: 100%;
|
|
256
|
-
overflow:
|
|
278
|
+
overflow: visible;
|
|
279
|
+
padding-left: 4px;
|
|
257
280
|
}
|
|
258
281
|
|
|
259
282
|
.detail__selection-checkbox {
|
|
@@ -98,8 +98,12 @@ export interface NileDetailSelectionConfig {
|
|
|
98
98
|
labels?: {
|
|
99
99
|
restore?: string;
|
|
100
100
|
clear?: string;
|
|
101
|
+
selectedOnly?: string;
|
|
102
|
+
showAll?: string;
|
|
101
103
|
};
|
|
102
104
|
|
|
105
|
+
showSelectedToggle?: boolean;
|
|
106
|
+
|
|
103
107
|
// Inherited / passthrough
|
|
104
108
|
open?: boolean;
|
|
105
109
|
disabled?: boolean;
|
|
@@ -176,10 +180,20 @@ export class NileDetail extends NileElement {
|
|
|
176
180
|
|
|
177
181
|
@state() private _detailOpen = false;
|
|
178
182
|
|
|
183
|
+
@state() private _hasSlottedContent = false;
|
|
184
|
+
|
|
179
185
|
@state() private _searchTerm = '';
|
|
180
186
|
|
|
181
187
|
@state() private _selectedSet: Set<string> = new Set();
|
|
182
188
|
|
|
189
|
+
@state() private _showSelectedOnly = false;
|
|
190
|
+
|
|
191
|
+
@property({ attribute: 'show-selected-toggle', type: Boolean, reflect: true }) showSelectedToggle = false;
|
|
192
|
+
|
|
193
|
+
@property({ attribute: 'selected-only-label', type: String }) selectedOnlyLabel = 'Selected';
|
|
194
|
+
|
|
195
|
+
@property({ attribute: 'show-all-label', type: String }) showAllLabel = 'Show all';
|
|
196
|
+
|
|
183
197
|
private _restoreDefaults: string[] | null = null;
|
|
184
198
|
|
|
185
199
|
private _gridResizeObserver: ResizeObserver | null = null;
|
|
@@ -510,9 +524,13 @@ export class NileDetail extends NileElement {
|
|
|
510
524
|
}
|
|
511
525
|
|
|
512
526
|
if (c.labels) {
|
|
513
|
-
if (c.labels.restore
|
|
514
|
-
if (c.labels.clear
|
|
527
|
+
if (c.labels.restore !== undefined) this.restoreLabel = c.labels.restore;
|
|
528
|
+
if (c.labels.clear !== undefined) this.clearLabel = c.labels.clear;
|
|
529
|
+
if (c.labels.selectedOnly !== undefined) this.selectedOnlyLabel = c.labels.selectedOnly;
|
|
530
|
+
if (c.labels.showAll !== undefined) this.showAllLabel = c.labels.showAll;
|
|
515
531
|
}
|
|
532
|
+
|
|
533
|
+
if (c.showSelectedToggle !== undefined) this.showSelectedToggle = c.showSelectedToggle;
|
|
516
534
|
}
|
|
517
535
|
|
|
518
536
|
private _syncSelectedFromProperty() {
|
|
@@ -575,14 +593,27 @@ export class NileDetail extends NileElement {
|
|
|
575
593
|
}
|
|
576
594
|
|
|
577
595
|
private get _filteredItems(): SelectionItem[] {
|
|
578
|
-
|
|
596
|
+
let source: SelectionItem[] = this.items;
|
|
597
|
+
|
|
598
|
+
if (this._showSelectedOnly) {
|
|
599
|
+
source = source.filter(item => this._selectedSet.has(this._getItemValue(item)));
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
if (this.disableLocalSearch) return source;
|
|
579
603
|
const q = this._searchTerm.trim().toLowerCase();
|
|
580
|
-
if (!q) return
|
|
581
|
-
return
|
|
604
|
+
if (!q) return source;
|
|
605
|
+
return source.filter(item =>
|
|
582
606
|
this._getItemSearchText(item).toLowerCase().includes(q)
|
|
583
607
|
);
|
|
584
608
|
}
|
|
585
609
|
|
|
610
|
+
private _onToggleSelectedOnly(event: Event) {
|
|
611
|
+
event.preventDefault();
|
|
612
|
+
const next = !this._showSelectedOnly;
|
|
613
|
+
if (next && this._selectedSet.size === 0) return;
|
|
614
|
+
this._showSelectedOnly = next;
|
|
615
|
+
}
|
|
616
|
+
|
|
586
617
|
private _selectableValues(): string[] {
|
|
587
618
|
const source: SelectionItem[] = this._isInfiniteMode
|
|
588
619
|
? (Array.from(this._pageCache.values()).flat() as SelectionItem[])
|
|
@@ -675,9 +706,20 @@ export class NileDetail extends NileElement {
|
|
|
675
706
|
private _onClear(event: Event) {
|
|
676
707
|
event.preventDefault();
|
|
677
708
|
this._selectedSet = new Set();
|
|
709
|
+
this._showSelectedOnly = false;
|
|
678
710
|
this._emitSelectionChange();
|
|
679
711
|
}
|
|
680
712
|
|
|
713
|
+
private _handleDefaultSlotChange(event: Event) {
|
|
714
|
+
const slot = event.target as HTMLSlotElement;
|
|
715
|
+
const nodes = slot.assignedNodes({ flatten: true });
|
|
716
|
+
this._hasSlottedContent = nodes.some(node => {
|
|
717
|
+
if (node.nodeType === Node.ELEMENT_NODE) return true;
|
|
718
|
+
if (node.nodeType === Node.TEXT_NODE) return !!(node.textContent && node.textContent.trim());
|
|
719
|
+
return false;
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
|
|
681
723
|
private _stopHeaderToggle(event: Event) {
|
|
682
724
|
event.stopPropagation();
|
|
683
725
|
}
|
|
@@ -761,21 +803,38 @@ export class NileDetail extends NileElement {
|
|
|
761
803
|
|
|
762
804
|
return html`
|
|
763
805
|
<div part="selection-toolbar" class="detail__selection-toolbar">
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
806
|
+
<slot name="tooblar-actions-prefix"></slot>
|
|
807
|
+
<slot name="toolbar-search" class="detail__selection-search-slot">
|
|
808
|
+
<nile-input
|
|
809
|
+
part="search"
|
|
810
|
+
class="detail__selection-search"
|
|
811
|
+
placeholder=${this.searchPlaceholder}
|
|
812
|
+
clearable
|
|
813
|
+
.value=${this._searchTerm}
|
|
814
|
+
@nile-input=${this._onSearchInput}
|
|
815
|
+
@nile-clear=${this._onSearchClear}
|
|
816
|
+
>
|
|
817
|
+
<nile-icon slot="prefix" name="search" library="system"></nile-icon>
|
|
818
|
+
</nile-input>
|
|
819
|
+
</slot>
|
|
820
|
+
<slot name="toolbar-actions" class="detail__selection-actions">
|
|
821
|
+
${this.showSelectedToggle
|
|
822
|
+
? html`
|
|
823
|
+
<nile-link
|
|
824
|
+
href="#"
|
|
825
|
+
variant="subtle"
|
|
826
|
+
class="detail__selected-toggle"
|
|
827
|
+
@click=${this._onToggleSelectedOnly}
|
|
828
|
+
>
|
|
829
|
+
<nile-icon slot="prefix" name="filter" library="system"></nile-icon>
|
|
830
|
+
${this._showSelectedOnly ? this.showAllLabel : this.selectedOnlyLabel}
|
|
831
|
+
</nile-link>
|
|
832
|
+
`
|
|
833
|
+
: nothing}
|
|
776
834
|
<nile-link href="#" variant="subtle" @click=${this._onRestore}>${this.restoreLabel}</nile-link>
|
|
777
835
|
<nile-link href="#" variant="subtle" @click=${this._onClear}>${this.clearLabel}</nile-link>
|
|
778
|
-
</
|
|
836
|
+
</slot>
|
|
837
|
+
<slot name="tooblar-actions-suffix"></slot>
|
|
779
838
|
</div>
|
|
780
839
|
<div
|
|
781
840
|
part="selection-grid"
|
|
@@ -996,7 +1055,14 @@ export class NileDetail extends NileElement {
|
|
|
996
1055
|
${isSelection
|
|
997
1056
|
? html`<div part="selection-content" class="detail__selection-content">${this._renderSelectionBody()}</div>`
|
|
998
1057
|
: ''}
|
|
999
|
-
<slot
|
|
1058
|
+
<slot
|
|
1059
|
+
id="content"
|
|
1060
|
+
class=${classMap({
|
|
1061
|
+
'detail__content': true,
|
|
1062
|
+
'detail__content--empty': !this._hasSlottedContent,
|
|
1063
|
+
})}
|
|
1064
|
+
@slotchange=${this._handleDefaultSlotChange}
|
|
1065
|
+
></slot>
|
|
1000
1066
|
</div>
|
|
1001
1067
|
</details>
|
|
1002
1068
|
`;
|
|
@@ -1808,7 +1808,7 @@
|
|
|
1808
1808
|
},
|
|
1809
1809
|
{
|
|
1810
1810
|
"name": "nile-detail",
|
|
1811
|
-
"description": "Events:\n\n * `nile-page-load` {`CustomEvent<{ pageIndex: number; offset: number; limit: number; rows: any; }>`} - \n\n * `nile-page-error` {`CustomEvent<{ pageIndex: number; offset: number; limit: number; error: any; }>`} - \n\n * `nile-change` {`CustomEvent<{ selected: string[]; }>`} - \n\n * `nile-search` {`CustomEvent<{ value: string; }>`} - \n\nAttributes:\n\n * `open` {`boolean`} - \n\n * `heading` {`string`} - \n\n * `description` {`string`} - \n\n * `expandIconPlacement` {`\"left\" | \"right\"`} - \n\n * `disabled` {`boolean`} - \n\n * `variant` {`NileDetailVariant`} - \n\n * `allow-html-label` {`boolean`} - \n\n * `disable-local-search` {`boolean`} - \n\n * `total-count` {`number | undefined`} - \n\n * `page-size` {`number`} - \n\n * `placeholder-label` {`string`} - \n\n * `search-placeholder` {`string`} - \n\n * `items-label` {`string`} - \n\n * `restore-label` {`string`} - \n\n * `clear-label` {`string`} - \n\n * `grid-rows` {`number`} - \n\n * `grid-columns` {`number`} - \n\n * `min-column-width` {`string`} - \n\n * `lane-height` {`number`} - \n\n * `orientation` {`\"vertical\" | \"horizontal\" | \"both\"`} - \n\n * `max-height` {`string`} - \n\n * `matrix-columns` {`number`} - \n\n * `virtualize` {`boolean`} - \n\n * `virtualize-threshold` {`number`} - \n\n * `overscan` {`number`} - \n\nProperties:\n\n * `styles` - \n\n * `detail` {`HTMLDetailsElement`} - \n\n * `header` {`HTMLElement`} - \n\n * `body` {`HTMLElement`} - \n\n * `open` {`boolean`} - \n\n * `heading` {`string`} - \n\n * `description` {`string`} - \n\n * `expandIconPlacement` {`\"left\" | \"right\"`} - \n\n * `disabled` {`boolean`} - \n\n * `variant` {`NileDetailVariant`} - \n\n * `items` {`SelectionItem[]`} - \n\n * `selected` {`string[]`} - \n\n * `renderItemConfig` {`NileDetailRenderItemConfig | undefined`} - \n\n * `allowHtmlLabel` {`boolean`} - \n\n * `disableLocalSearch` {`boolean`} - \n\n * `totalCount` {`number | undefined`} - \n\n * `pageSize` {`number`} - \n\n * `fetchPage` - \n\n * `placeholderLabel` {`string`} - \n\n * `config` {`NileDetailSelectionConfig | undefined`} - \n\n * `searchPlaceholder` {`string`} - \n\n * `itemsLabel` {`string`} - \n\n * `restoreLabel` {`string`} - \n\n * `clearLabel` {`string`} - \n\n * `gridRows` {`number`} - \n\n * `gridColumns` {`number`} - \n\n * `minColumnWidth` {`string`} - \n\n * `laneHeight` {`number`} - \n\n * `orientation` {`\"vertical\" | \"horizontal\" | \"both\"`} - \n\n * `maxHeight` {`string`} - \n\n * `matrixColumns` {`number`} - \n\n * `virtualize` {`boolean`} - \n\n * `virtualizeThreshold` {`number`} - \n\n * `overscan` {`number`} - \n\n * `_detailOpen` {`boolean`} - \n\n * `_searchTerm` {`string`} - \n\n * `_selectedSet` {`Set<string>`} - \n\n * `_restoreDefaults` {`string[] | null`} - \n\n * `_gridResizeObserver` - \n\n * `_virtCtrl` - \n\n * `_rowVirtCtrl` - \n\n * `_colVirtCtrl` - \n\n * `_pageCache` - \n\n * `_pendingPages` - \n\n * `_isInfiniteMode` {`boolean`} - \n\n * `_isVirtualized` {`boolean`} - \n\n * `_columnWidthPx` {`number`} - \n\n * `_filteredItems` {`SelectionItem[]`} - \n\n * `_allChecked` {`boolean`} - \n\n * `_indeterminate` {`boolean`} - \n\n * `_countLabel` {`string`} - \n\n * `_summaryLabel` {`string`} - \n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
|
|
1811
|
+
"description": "Events:\n\n * `nile-page-load` {`CustomEvent<{ pageIndex: number; offset: number; limit: number; rows: any; }>`} - \n\n * `nile-page-error` {`CustomEvent<{ pageIndex: number; offset: number; limit: number; error: any; }>`} - \n\n * `nile-change` {`CustomEvent<{ selected: string[]; }>`} - \n\n * `nile-search` {`CustomEvent<{ value: string; }>`} - \n\nAttributes:\n\n * `open` {`boolean`} - \n\n * `heading` {`string`} - \n\n * `description` {`string`} - \n\n * `expandIconPlacement` {`\"left\" | \"right\"`} - \n\n * `disabled` {`boolean`} - \n\n * `variant` {`NileDetailVariant`} - \n\n * `allow-html-label` {`boolean`} - \n\n * `disable-local-search` {`boolean`} - \n\n * `total-count` {`number | undefined`} - \n\n * `page-size` {`number`} - \n\n * `placeholder-label` {`string`} - \n\n * `search-placeholder` {`string`} - \n\n * `items-label` {`string`} - \n\n * `restore-label` {`string`} - \n\n * `clear-label` {`string`} - \n\n * `grid-rows` {`number`} - \n\n * `grid-columns` {`number`} - \n\n * `min-column-width` {`string`} - \n\n * `lane-height` {`number`} - \n\n * `orientation` {`\"vertical\" | \"horizontal\" | \"both\"`} - \n\n * `max-height` {`string`} - \n\n * `matrix-columns` {`number`} - \n\n * `virtualize` {`boolean`} - \n\n * `virtualize-threshold` {`number`} - \n\n * `overscan` {`number`} - \n\n * `show-selected-toggle` {`boolean`} - \n\n * `selected-only-label` {`string`} - \n\n * `show-all-label` {`string`} - \n\nProperties:\n\n * `styles` - \n\n * `detail` {`HTMLDetailsElement`} - \n\n * `header` {`HTMLElement`} - \n\n * `body` {`HTMLElement`} - \n\n * `open` {`boolean`} - \n\n * `heading` {`string`} - \n\n * `description` {`string`} - \n\n * `expandIconPlacement` {`\"left\" | \"right\"`} - \n\n * `disabled` {`boolean`} - \n\n * `variant` {`NileDetailVariant`} - \n\n * `items` {`SelectionItem[]`} - \n\n * `selected` {`string[]`} - \n\n * `renderItemConfig` {`NileDetailRenderItemConfig | undefined`} - \n\n * `allowHtmlLabel` {`boolean`} - \n\n * `disableLocalSearch` {`boolean`} - \n\n * `totalCount` {`number | undefined`} - \n\n * `pageSize` {`number`} - \n\n * `fetchPage` - \n\n * `placeholderLabel` {`string`} - \n\n * `config` {`NileDetailSelectionConfig | undefined`} - \n\n * `searchPlaceholder` {`string`} - \n\n * `itemsLabel` {`string`} - \n\n * `restoreLabel` {`string`} - \n\n * `clearLabel` {`string`} - \n\n * `gridRows` {`number`} - \n\n * `gridColumns` {`number`} - \n\n * `minColumnWidth` {`string`} - \n\n * `laneHeight` {`number`} - \n\n * `orientation` {`\"vertical\" | \"horizontal\" | \"both\"`} - \n\n * `maxHeight` {`string`} - \n\n * `matrixColumns` {`number`} - \n\n * `virtualize` {`boolean`} - \n\n * `virtualizeThreshold` {`number`} - \n\n * `overscan` {`number`} - \n\n * `_detailOpen` {`boolean`} - \n\n * `_hasSlottedContent` {`boolean`} - \n\n * `_searchTerm` {`string`} - \n\n * `_selectedSet` {`Set<string>`} - \n\n * `_showSelectedOnly` {`boolean`} - \n\n * `showSelectedToggle` {`boolean`} - \n\n * `selectedOnlyLabel` {`string`} - \n\n * `showAllLabel` {`string`} - \n\n * `_restoreDefaults` {`string[] | null`} - \n\n * `_gridResizeObserver` - \n\n * `_virtCtrl` - \n\n * `_rowVirtCtrl` - \n\n * `_colVirtCtrl` - \n\n * `_pageCache` - \n\n * `_pendingPages` - \n\n * `_isInfiniteMode` {`boolean`} - \n\n * `_isVirtualized` {`boolean`} - \n\n * `_columnWidthPx` {`number`} - \n\n * `_filteredItems` {`SelectionItem[]`} - \n\n * `_allChecked` {`boolean`} - \n\n * `_indeterminate` {`boolean`} - \n\n * `_countLabel` {`string`} - \n\n * `_summaryLabel` {`string`} - \n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
|
|
1812
1812
|
"attributes": [
|
|
1813
1813
|
{
|
|
1814
1814
|
"name": "open",
|
|
@@ -1943,6 +1943,19 @@
|
|
|
1943
1943
|
"name": "overscan",
|
|
1944
1944
|
"description": "`overscan` {`number`} - \n\nProperty: overscan\n\nDefault: 4"
|
|
1945
1945
|
},
|
|
1946
|
+
{
|
|
1947
|
+
"name": "show-selected-toggle",
|
|
1948
|
+
"description": "`show-selected-toggle` {`boolean`} - \n\nProperty: showSelectedToggle\n\nDefault: false",
|
|
1949
|
+
"valueSet": "v"
|
|
1950
|
+
},
|
|
1951
|
+
{
|
|
1952
|
+
"name": "selected-only-label",
|
|
1953
|
+
"description": "`selected-only-label` {`string`} - \n\nProperty: selectedOnlyLabel\n\nDefault: Selected"
|
|
1954
|
+
},
|
|
1955
|
+
{
|
|
1956
|
+
"name": "show-all-label",
|
|
1957
|
+
"description": "`show-all-label` {`string`} - \n\nProperty: showAllLabel\n\nDefault: Show all"
|
|
1958
|
+
},
|
|
1946
1959
|
{
|
|
1947
1960
|
"name": "onnile-page-load",
|
|
1948
1961
|
"description": "`nile-page-load` {`CustomEvent<{ pageIndex: number; offset: number; limit: number; rows: any; }>`} - "
|