@aquera/nile-elements 1.7.5 → 1.7.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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Webcomponent nile-elements following open-wc recommendations",
4
4
  "license": "MIT",
5
5
  "author": "nile-elements",
6
- "version": "1.7.5",
6
+ "version": "1.7.6",
7
7
  "main": "dist/src/index.js",
8
8
  "type": "module",
9
9
  "module": "dist/src/index.js",
@@ -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:not(:has(*)) {
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-bottom: 8px;
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: hidden;
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;
@@ -180,6 +184,14 @@ export class NileDetail extends NileElement {
180
184
 
181
185
  @state() private _selectedSet: Set<string> = new Set();
182
186
 
187
+ @state() private _showSelectedOnly = false;
188
+
189
+ @property({ attribute: 'show-selected-toggle', type: Boolean, reflect: true }) showSelectedToggle = false;
190
+
191
+ @property({ attribute: 'selected-only-label', type: String }) selectedOnlyLabel = 'Selected';
192
+
193
+ @property({ attribute: 'show-all-label', type: String }) showAllLabel = 'Show all';
194
+
183
195
  private _restoreDefaults: string[] | null = null;
184
196
 
185
197
  private _gridResizeObserver: ResizeObserver | null = null;
@@ -510,9 +522,13 @@ export class NileDetail extends NileElement {
510
522
  }
511
523
 
512
524
  if (c.labels) {
513
- if (c.labels.restore !== undefined) this.restoreLabel = c.labels.restore;
514
- if (c.labels.clear !== undefined) this.clearLabel = c.labels.clear;
525
+ if (c.labels.restore !== undefined) this.restoreLabel = c.labels.restore;
526
+ if (c.labels.clear !== undefined) this.clearLabel = c.labels.clear;
527
+ if (c.labels.selectedOnly !== undefined) this.selectedOnlyLabel = c.labels.selectedOnly;
528
+ if (c.labels.showAll !== undefined) this.showAllLabel = c.labels.showAll;
515
529
  }
530
+
531
+ if (c.showSelectedToggle !== undefined) this.showSelectedToggle = c.showSelectedToggle;
516
532
  }
517
533
 
518
534
  private _syncSelectedFromProperty() {
@@ -575,14 +591,27 @@ export class NileDetail extends NileElement {
575
591
  }
576
592
 
577
593
  private get _filteredItems(): SelectionItem[] {
578
- if (this.disableLocalSearch) return this.items;
594
+ let source: SelectionItem[] = this.items;
595
+
596
+ if (this._showSelectedOnly) {
597
+ source = source.filter(item => this._selectedSet.has(this._getItemValue(item)));
598
+ }
599
+
600
+ if (this.disableLocalSearch) return source;
579
601
  const q = this._searchTerm.trim().toLowerCase();
580
- if (!q) return this.items;
581
- return this.items.filter(item =>
602
+ if (!q) return source;
603
+ return source.filter(item =>
582
604
  this._getItemSearchText(item).toLowerCase().includes(q)
583
605
  );
584
606
  }
585
607
 
608
+ private _onToggleSelectedOnly(event: Event) {
609
+ event.preventDefault();
610
+ const next = !this._showSelectedOnly;
611
+ if (next && this._selectedSet.size === 0) return;
612
+ this._showSelectedOnly = next;
613
+ }
614
+
586
615
  private _selectableValues(): string[] {
587
616
  const source: SelectionItem[] = this._isInfiniteMode
588
617
  ? (Array.from(this._pageCache.values()).flat() as SelectionItem[])
@@ -675,6 +704,7 @@ export class NileDetail extends NileElement {
675
704
  private _onClear(event: Event) {
676
705
  event.preventDefault();
677
706
  this._selectedSet = new Set();
707
+ this._showSelectedOnly = false;
678
708
  this._emitSelectionChange();
679
709
  }
680
710
 
@@ -761,21 +791,38 @@ export class NileDetail extends NileElement {
761
791
 
762
792
  return html`
763
793
  <div part="selection-toolbar" class="detail__selection-toolbar">
764
- <nile-input
765
- part="search"
766
- class="detail__selection-search"
767
- placeholder=${this.searchPlaceholder}
768
- clearable
769
- .value=${this._searchTerm}
770
- @nile-input=${this._onSearchInput}
771
- @nile-clear=${this._onSearchClear}
772
- >
773
- <nile-icon slot="prefix" name="search" library="system"></nile-icon>
774
- </nile-input>
775
- <div part="selection-actions" class="detail__selection-actions">
794
+ <slot name="tooblar-actions-prefix"></slot>
795
+ <slot name="toolbar-search" class="detail__selection-search-slot">
796
+ <nile-input
797
+ part="search"
798
+ class="detail__selection-search"
799
+ placeholder=${this.searchPlaceholder}
800
+ clearable
801
+ .value=${this._searchTerm}
802
+ @nile-input=${this._onSearchInput}
803
+ @nile-clear=${this._onSearchClear}
804
+ >
805
+ <nile-icon slot="prefix" name="search" library="system"></nile-icon>
806
+ </nile-input>
807
+ </slot>
808
+ <slot name="toolbar-actions" class="detail__selection-actions">
809
+ ${this.showSelectedToggle
810
+ ? html`
811
+ <nile-link
812
+ href="#"
813
+ variant="subtle"
814
+ class="detail__selected-toggle"
815
+ @click=${this._onToggleSelectedOnly}
816
+ >
817
+ <nile-icon slot="prefix" name="filter" library="system"></nile-icon>
818
+ ${this._showSelectedOnly ? this.showAllLabel : this.selectedOnlyLabel}
819
+ </nile-link>
820
+ `
821
+ : nothing}
776
822
  <nile-link href="#" variant="subtle" @click=${this._onRestore}>${this.restoreLabel}</nile-link>
777
823
  <nile-link href="#" variant="subtle" @click=${this._onClear}>${this.clearLabel}</nile-link>
778
- </div>
824
+ </slot>
825
+ <slot name="tooblar-actions-suffix"></slot>
779
826
  </div>
780
827
  <div
781
828
  part="selection-grid"
@@ -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 * `_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; }>`} - "