shirkasoft-ui-components 1.3.8 → 1.3.10
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 +60 -14
- package/fesm2022/shirkasoft-ui-components-button.mjs +2 -2
- package/fesm2022/shirkasoft-ui-components-button.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-confirm-dialog.mjs +2 -2
- package/fesm2022/shirkasoft-ui-components-confirm-dialog.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-date-picker.mjs +206 -15
- package/fesm2022/shirkasoft-ui-components-date-picker.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-file-upload.mjs +2 -2
- package/fesm2022/shirkasoft-ui-components-file-upload.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-loading.mjs +2 -2
- package/fesm2022/shirkasoft-ui-components-loading.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-modal.mjs +2 -2
- package/fesm2022/shirkasoft-ui-components-modal.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-notification.mjs +2 -2
- package/fesm2022/shirkasoft-ui-components-notification.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-price-input.mjs +37 -2
- package/fesm2022/shirkasoft-ui-components-price-input.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-select.mjs +15 -5
- package/fesm2022/shirkasoft-ui-components-select.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-table.mjs +200 -13
- package/fesm2022/shirkasoft-ui-components-table.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-tabs.mjs +7 -12
- package/fesm2022/shirkasoft-ui-components-tabs.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-tag.mjs +3 -3
- package/fesm2022/shirkasoft-ui-components-tag.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-text-field.mjs +2 -2
- package/fesm2022/shirkasoft-ui-components-text-field.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-toggle.mjs +61 -24
- package/fesm2022/shirkasoft-ui-components-toggle.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-utils.mjs +62 -1
- package/fesm2022/shirkasoft-ui-components-utils.mjs.map +1 -1
- package/package.json +1 -1
- package/src/theme.css +89 -0
- package/types/shirkasoft-ui-components-date-picker.d.ts +42 -2
- package/types/shirkasoft-ui-components-price-input.d.ts +10 -0
- package/types/shirkasoft-ui-components-select.d.ts +2 -0
- package/types/shirkasoft-ui-components-table.d.ts +86 -9
- package/types/shirkasoft-ui-components-toggle.d.ts +7 -1
- package/types/shirkasoft-ui-components-utils.d.ts +44 -1
|
@@ -39,6 +39,14 @@ interface RowAction {
|
|
|
39
39
|
isVisible?: (rowData: any) => boolean;
|
|
40
40
|
isDisabled?: (rowData: any) => boolean;
|
|
41
41
|
}
|
|
42
|
+
interface BulkAction {
|
|
43
|
+
label: string;
|
|
44
|
+
icon?: string | any;
|
|
45
|
+
onClick: (selectedRows: any[]) => void;
|
|
46
|
+
class?: string;
|
|
47
|
+
isVisible?: (selectedRows: any[]) => boolean;
|
|
48
|
+
isDisabled?: (selectedRows: any[]) => boolean;
|
|
49
|
+
}
|
|
42
50
|
interface PageChangeEvent {
|
|
43
51
|
first: number;
|
|
44
52
|
rows: number;
|
|
@@ -50,16 +58,13 @@ interface FilterChangeEvent {
|
|
|
50
58
|
[key: string]: any;
|
|
51
59
|
};
|
|
52
60
|
}
|
|
53
|
-
/**
|
|
54
|
-
* Shirkasoft UI Components.
|
|
55
|
-
* Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).
|
|
56
|
-
* Belongs to Shirkasoft.
|
|
57
|
-
*/
|
|
58
61
|
/**
|
|
59
62
|
* Data table with sorting, column filters, global search, pagination,
|
|
60
63
|
* row/header actions, tag cells and optional server-side mode.
|
|
61
64
|
*/
|
|
62
65
|
declare class TableComponent {
|
|
66
|
+
/** Unique id prefix so several tables on the same page don't share element ids. */
|
|
67
|
+
protected readonly uid: string;
|
|
63
68
|
private fb;
|
|
64
69
|
private cdr;
|
|
65
70
|
private transloco;
|
|
@@ -124,6 +129,19 @@ declare class TableComponent {
|
|
|
124
129
|
}[]>;
|
|
125
130
|
/** Currently active filter chip value. */
|
|
126
131
|
activeFilter: _angular_core.InputSignal<string>;
|
|
132
|
+
/** Whether to render the leading checkbox column for multi-row selection. */
|
|
133
|
+
selectable: _angular_core.InputSignal<boolean>;
|
|
134
|
+
/**
|
|
135
|
+
* Field used to identify rows in the selection (keeps it stable across
|
|
136
|
+
* pages and data reloads). Falls back to the row reference when missing.
|
|
137
|
+
*/
|
|
138
|
+
dataKey: _angular_core.InputSignal<string>;
|
|
139
|
+
/** Optional predicate to disable the checkbox of specific rows. */
|
|
140
|
+
isRowSelectable: _angular_core.InputSignal<((row: any) => boolean) | undefined>;
|
|
141
|
+
/** Actions shown in the header while at least one row is selected. */
|
|
142
|
+
bulkActions: _angular_core.InputSignal<BulkAction[]>;
|
|
143
|
+
/** Selected rows. Supports two-way binding via `[(selection)]`. */
|
|
144
|
+
selection: _angular_core.ModelSignal<any[]>;
|
|
127
145
|
/** Emits when the user clicks the refresh button. */
|
|
128
146
|
refresh: _angular_core.OutputEmitterRef<void>;
|
|
129
147
|
/** Emits page changes (server-side mode) with first/rows/page info. */
|
|
@@ -175,6 +193,20 @@ declare class TableComponent {
|
|
|
175
193
|
private columnFilterSubscriptions;
|
|
176
194
|
/** Columns array with the leading `actions` column when row actions exist. */
|
|
177
195
|
columnsWithActions: _angular_core.Signal<Column[]>;
|
|
196
|
+
/** Keys of the selected rows, for O(1) lookups in the template. */
|
|
197
|
+
private selectedKeys;
|
|
198
|
+
/** Whether non-empty data has been received (see the selection pruning effect). */
|
|
199
|
+
private hasReceivedData;
|
|
200
|
+
/** Selectable rows of the current page. */
|
|
201
|
+
protected selectablePageRows: _angular_core.Signal<any[]>;
|
|
202
|
+
/** Whether every selectable row of the current page is selected. */
|
|
203
|
+
allPageSelected: _angular_core.Signal<boolean>;
|
|
204
|
+
/** Whether only part of the current page is selected (header checkbox indeterminate). */
|
|
205
|
+
somePageSelected: _angular_core.Signal<boolean>;
|
|
206
|
+
/** Visible bulk actions for the current selection. */
|
|
207
|
+
visibleBulkActions: _angular_core.Signal<BulkAction[]>;
|
|
208
|
+
/** Number of rendered columns, including the selection column. */
|
|
209
|
+
totalColspan: _angular_core.Signal<number>;
|
|
178
210
|
/** Total records: server-provided in server mode, locally computed otherwise. */
|
|
179
211
|
effectiveTotalRecords: _angular_core.Signal<number>;
|
|
180
212
|
/**
|
|
@@ -208,6 +240,31 @@ declare class TableComponent {
|
|
|
208
240
|
private applyColumnFilters;
|
|
209
241
|
/** Slices the filtered rows for the current page. */
|
|
210
242
|
private updateDisplayedData;
|
|
243
|
+
/** Identity used for a row inside the selection. */
|
|
244
|
+
private getSelectionKey;
|
|
245
|
+
/** Whether the row's checkbox is enabled. */
|
|
246
|
+
canSelectRow(row: any): boolean;
|
|
247
|
+
/** Whether the row is currently selected. */
|
|
248
|
+
isRowSelected(row: any): boolean;
|
|
249
|
+
/** Selects/deselects a single row. */
|
|
250
|
+
toggleRowSelection(row: any): void;
|
|
251
|
+
/**
|
|
252
|
+
* Header checkbox: selects every selectable row of the current page or,
|
|
253
|
+
* when all of them are already selected, removes them from the selection.
|
|
254
|
+
* Rows selected on other pages are kept.
|
|
255
|
+
*/
|
|
256
|
+
toggleSelectAllPage(): void;
|
|
257
|
+
/** Clears the whole selection. */
|
|
258
|
+
clearSelection(): void;
|
|
259
|
+
/** Runs a bulk action with the current selection. */
|
|
260
|
+
runBulkAction(action: BulkAction): void;
|
|
261
|
+
/** Whether a bulk action is disabled for the current selection. */
|
|
262
|
+
isBulkActionDisabled(action: BulkAction): boolean;
|
|
263
|
+
/**
|
|
264
|
+
* Drops selected rows that no longer exist in the data (client mode, e.g.
|
|
265
|
+
* after a bulk delete) and refreshes kept rows with their new references.
|
|
266
|
+
*/
|
|
267
|
+
private pruneSelection;
|
|
211
268
|
/** Emits the filter chip clicked in the template. */
|
|
212
269
|
onFilterClick(value: string): void;
|
|
213
270
|
/** Toggles the sort direction of a column (first click sorts ascending). */
|
|
@@ -221,8 +278,26 @@ declare class TableComponent {
|
|
|
221
278
|
onSearchInput(value: string): void;
|
|
222
279
|
/** Clears a column filter value and hides its input. */
|
|
223
280
|
clearFilter(field: string): void;
|
|
224
|
-
/**
|
|
225
|
-
|
|
281
|
+
/** Width (px) of the column filter popup, used to keep it inside the viewport. */
|
|
282
|
+
private readonly FILTER_POPUP_WIDTH;
|
|
283
|
+
/** Viewport position of the open column filter popup. */
|
|
284
|
+
filterPopupPosition: _angular_core.WritableSignal<{
|
|
285
|
+
top: number;
|
|
286
|
+
left: number;
|
|
287
|
+
}>;
|
|
288
|
+
/** Filter button the open popup is anchored to, and its scroll/resize listener cleanup. */
|
|
289
|
+
private filterAnchor;
|
|
290
|
+
private filterListenersCleanup;
|
|
291
|
+
/**
|
|
292
|
+
* Toggles a column filter popup. Only one popup is open at a time. The
|
|
293
|
+
* popup uses `position: fixed` anchored to the filter button, so the
|
|
294
|
+
* header cell (`overflow: hidden`) and the scroll wrapper can't clip it.
|
|
295
|
+
*/
|
|
296
|
+
toggleFilter(field: string, event?: Event): void;
|
|
297
|
+
/** Closes every column filter popup (values are kept). */
|
|
298
|
+
closeFilters(): void;
|
|
299
|
+
/** Places the filter popup under its button, clamped to the viewport. */
|
|
300
|
+
private updateFilterPopupPosition;
|
|
226
301
|
/**
|
|
227
302
|
* Whether a column filter is non-empty. Avoids treating the number 0 as
|
|
228
303
|
* "no value".
|
|
@@ -307,9 +382,11 @@ declare class TableComponent {
|
|
|
307
382
|
private getRowKey;
|
|
308
383
|
/** Closes all open action dropdowns when clicking anywhere on the document. */
|
|
309
384
|
onDocumentClick(): void;
|
|
385
|
+
/** Closes the column filter popup with Escape. */
|
|
386
|
+
onEscape(): void;
|
|
310
387
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TableComponent, never>;
|
|
311
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<TableComponent, "shk-table", never, { "data": { "alias": "data"; "required": false; "isSignal": true; }; "columns": { "alias": "columns"; "required": false; "isSignal": true; }; "rowsPerPage": { "alias": "rowsPerPage"; "required": false; "isSignal": true; }; "rowsPerPageOptions": { "alias": "rowsPerPageOptions"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "showActionRow": { "alias": "showActionRow"; "required": false; "isSignal": true; }; "customTemplates": { "alias": "customTemplates"; "required": false; "isSignal": true; }; "headerActions": { "alias": "headerActions"; "required": false; "isSignal": true; }; "rowActions": { "alias": "rowActions"; "required": false; "isSignal": true; }; "hasShadow": { "alias": "hasShadow"; "required": false; "isSignal": true; }; "defaultSortField": { "alias": "defaultSortField"; "required": false; "isSignal": true; }; "defaultSortOrder": { "alias": "defaultSortOrder"; "required": false; "isSignal": true; }; "showSearch": { "alias": "showSearch"; "required": false; "isSignal": true; }; "searchPlaceholder": { "alias": "searchPlaceholder"; "required": false; "isSignal": true; }; "emptyMessage": { "alias": "emptyMessage"; "required": false; "isSignal": true; }; "serverSide": { "alias": "serverSide"; "required": false; "isSignal": true; }; "totalRecords": { "alias": "totalRecords"; "required": false; "isSignal": true; }; "filters": { "alias": "filters"; "required": false; "isSignal": true; }; "activeFilter": { "alias": "activeFilter"; "required": false; "isSignal": true; }; }, { "refresh": "refresh"; "pageChange": "pageChange"; "filterChange": "filterChange"; "searchChange": "searchChange"; "filterClick": "filterClick"; }, never, never, true, never>;
|
|
388
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<TableComponent, "shk-table", never, { "data": { "alias": "data"; "required": false; "isSignal": true; }; "columns": { "alias": "columns"; "required": false; "isSignal": true; }; "rowsPerPage": { "alias": "rowsPerPage"; "required": false; "isSignal": true; }; "rowsPerPageOptions": { "alias": "rowsPerPageOptions"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "showActionRow": { "alias": "showActionRow"; "required": false; "isSignal": true; }; "customTemplates": { "alias": "customTemplates"; "required": false; "isSignal": true; }; "headerActions": { "alias": "headerActions"; "required": false; "isSignal": true; }; "rowActions": { "alias": "rowActions"; "required": false; "isSignal": true; }; "hasShadow": { "alias": "hasShadow"; "required": false; "isSignal": true; }; "defaultSortField": { "alias": "defaultSortField"; "required": false; "isSignal": true; }; "defaultSortOrder": { "alias": "defaultSortOrder"; "required": false; "isSignal": true; }; "showSearch": { "alias": "showSearch"; "required": false; "isSignal": true; }; "searchPlaceholder": { "alias": "searchPlaceholder"; "required": false; "isSignal": true; }; "emptyMessage": { "alias": "emptyMessage"; "required": false; "isSignal": true; }; "serverSide": { "alias": "serverSide"; "required": false; "isSignal": true; }; "totalRecords": { "alias": "totalRecords"; "required": false; "isSignal": true; }; "filters": { "alias": "filters"; "required": false; "isSignal": true; }; "activeFilter": { "alias": "activeFilter"; "required": false; "isSignal": true; }; "selectable": { "alias": "selectable"; "required": false; "isSignal": true; }; "dataKey": { "alias": "dataKey"; "required": false; "isSignal": true; }; "isRowSelectable": { "alias": "isRowSelectable"; "required": false; "isSignal": true; }; "bulkActions": { "alias": "bulkActions"; "required": false; "isSignal": true; }; "selection": { "alias": "selection"; "required": false; "isSignal": true; }; }, { "selection": "selectionChange"; "refresh": "refresh"; "pageChange": "pageChange"; "filterChange": "filterChange"; "searchChange": "searchChange"; "filterClick": "filterClick"; }, never, never, true, never>;
|
|
312
389
|
}
|
|
313
390
|
|
|
314
391
|
export { TableComponent };
|
|
315
|
-
export type { Column, FilterChangeEvent, PageChangeEvent, RowAction, TableAction };
|
|
392
|
+
export type { BulkAction, Column, FilterChangeEvent, PageChangeEvent, RowAction, TableAction };
|
|
@@ -19,10 +19,14 @@ declare class ToggleComponent implements ControlValueAccessor {
|
|
|
19
19
|
checked: _angular_core.InputSignal<boolean | undefined>;
|
|
20
20
|
/** Emitted with the new value when the user toggles the control. */
|
|
21
21
|
checkedChange: _angular_core.OutputEmitterRef<boolean>;
|
|
22
|
+
/** Disables the control (also settable through reactive forms). */
|
|
23
|
+
disabled: _angular_core.InputSignal<boolean>;
|
|
22
24
|
/** Internal controlled/reactive value. */
|
|
23
25
|
_value: _angular_core.WritableSignal<boolean>;
|
|
24
26
|
/** Reactive disabled state. */
|
|
25
27
|
_disabled: _angular_core.WritableSignal<boolean>;
|
|
28
|
+
/** Disabled through the `disabled` input or the form control. */
|
|
29
|
+
isDisabled: _angular_core.Signal<boolean>;
|
|
26
30
|
/** Callback notified with the new value on change (ControlValueAccessor). */
|
|
27
31
|
private onChange;
|
|
28
32
|
/** Callback notified when the control loses focus or is touched. */
|
|
@@ -40,9 +44,11 @@ declare class ToggleComponent implements ControlValueAccessor {
|
|
|
40
44
|
* Inverts the current value (unless disabled), notifies the form control,
|
|
41
45
|
* marks the control as touched and emits `checkedChange`.
|
|
42
46
|
*/
|
|
47
|
+
/** Space/Enter toggles the focused switch or checkbox. */
|
|
48
|
+
onKeydown(event: KeyboardEvent): void;
|
|
43
49
|
toggle(): void;
|
|
44
50
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ToggleComponent, never>;
|
|
45
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ToggleComponent, "shk-toggle", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "mode": { "alias": "mode"; "required": false; "isSignal": true; }; "checked": { "alias": "checked"; "required": false; "isSignal": true; }; }, { "checkedChange": "checkedChange"; }, never, never, true, never>;
|
|
51
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ToggleComponent, "shk-toggle", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "mode": { "alias": "mode"; "required": false; "isSignal": true; }; "checked": { "alias": "checked"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, { "checkedChange": "checkedChange"; }, never, never, true, never>;
|
|
46
52
|
}
|
|
47
53
|
|
|
48
54
|
export { ToggleComponent };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
|
|
1
3
|
/** Maps the icon names used across the library to their Lucide component. */
|
|
2
4
|
declare const ICONS: Record<string, any>;
|
|
3
5
|
/**
|
|
@@ -6,4 +8,45 @@ declare const ICONS: Record<string, any>;
|
|
|
6
8
|
*/
|
|
7
9
|
declare function getIcon(icon?: any, fallback?: any): any;
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Shirkasoft UI Components.
|
|
13
|
+
* Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).
|
|
14
|
+
* Belongs to Shirkasoft.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Moves a floating element (dropdown panel, popup, overlay) to `document.body`
|
|
18
|
+
* so it always renders above the rest of the page.
|
|
19
|
+
*
|
|
20
|
+
* `position: fixed` + a high `z-index` is not enough on its own: an ancestor
|
|
21
|
+
* with `transform`, `filter`, `backdrop-filter`, `contain`, or its own stacking
|
|
22
|
+
* context (`z-index` + `position`, `sticky`, `opacity < 1`...) traps the element
|
|
23
|
+
* inside it. Rendering it as a direct child of `body` avoids all of that.
|
|
24
|
+
*
|
|
25
|
+
* The element keeps being managed by Angular (bindings and listeners keep
|
|
26
|
+
* working, and Angular removes it with `node.remove()` when it is hidden).
|
|
27
|
+
* If the anchor lives inside a `.dark` container, the class is copied onto the
|
|
28
|
+
* element so the dark theme (CSS variables, Tailwind `dark:` variants and
|
|
29
|
+
* component `.dark .x` rules) still applies once it is outside the host.
|
|
30
|
+
*
|
|
31
|
+
* Returns a function that removes the element from the DOM; call it when the
|
|
32
|
+
* owner component is destroyed so the element does not stay orphaned in `body`.
|
|
33
|
+
*/
|
|
34
|
+
declare function portalToBody(element: HTMLElement, anchor?: HTMLElement | null): () => void;
|
|
35
|
+
/**
|
|
36
|
+
* Renders the host element in `document.body` (see `portalToBody`) once it is
|
|
37
|
+
* rendered, and removes it when the element or its owner is destroyed.
|
|
38
|
+
*
|
|
39
|
+
* ```html
|
|
40
|
+
* @if (isOpen()) {
|
|
41
|
+
* <div shkPortal class="fixed z-[9999]" [style.top.px]="top">...</div>
|
|
42
|
+
* }
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
declare class PortalDirective {
|
|
46
|
+
private readonly el;
|
|
47
|
+
constructor();
|
|
48
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PortalDirective, never>;
|
|
49
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<PortalDirective, "[shkPortal]", never, {}, {}, never, never, true, never>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { ICONS, PortalDirective, getIcon, portalToBody };
|