shirkasoft-ui-components 1.3.13 → 1.3.15
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 +38 -6
- package/fesm2022/shirkasoft-ui-components-modal.mjs +13 -2
- package/fesm2022/shirkasoft-ui-components-modal.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-table.mjs +68 -36
- package/fesm2022/shirkasoft-ui-components-table.mjs.map +1 -1
- package/package.json +1 -1
- package/types/shirkasoft-ui-components-modal.d.ts +9 -0
- package/types/shirkasoft-ui-components-table.d.ts +63 -17
package/package.json
CHANGED
|
@@ -26,6 +26,13 @@ interface ModalConfig {
|
|
|
26
26
|
cancelLabel?: string;
|
|
27
27
|
/** Optional callback invoked when the modal closes. */
|
|
28
28
|
onClose?: () => void;
|
|
29
|
+
/**
|
|
30
|
+
* Optional callback invoked when the modal is accepted, with the payload of
|
|
31
|
+
* the dynamic component: the value emitted by its `submitSuccess` output or,
|
|
32
|
+
* when it emits nothing, the raw value of its `form`. Omit it to keep the
|
|
33
|
+
* previous behaviour.
|
|
34
|
+
*/
|
|
35
|
+
onAccept?: (payload: any) => void;
|
|
29
36
|
}
|
|
30
37
|
/**
|
|
31
38
|
* Global modal manager. Opens modals on a stack, exposing reactive access to
|
|
@@ -113,6 +120,8 @@ declare class ModalComponent {
|
|
|
113
120
|
private subscribeToOutput;
|
|
114
121
|
/** Finalizes the submit flow, accepting the modal on success. */
|
|
115
122
|
private handleSubmit;
|
|
123
|
+
/** Raw value of the dynamic component's form, or undefined when it has none. */
|
|
124
|
+
private getFormValue;
|
|
116
125
|
/** Closes the modal, calling the dynamic component's `handleCancel` if any. */
|
|
117
126
|
closeModal(): void;
|
|
118
127
|
/** Performs the actual close sequence and cleanup. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
-
import { LucideFunnelX, LucideCircleCheck, LucideCircleX, LucideTrash2 } from '@lucide/angular';
|
|
2
|
+
import { LucideFunnelX, LucideCircleCheck, LucideCircleX, LucideTrash2, LucideCircleAlert } from '@lucide/angular';
|
|
3
3
|
import { TagSeverity } from 'shirkasoft-ui-components/tag';
|
|
4
4
|
|
|
5
5
|
/** Match modes available in the column filter menu. */
|
|
@@ -77,11 +77,18 @@ interface Column {
|
|
|
77
77
|
template?: 'text' | 'tag' | 'progress' | 'boolean' | 'date' | 'currency';
|
|
78
78
|
/**
|
|
79
79
|
* Marks the field as mandatory: with the table's `validateRequired`, rows
|
|
80
|
-
* where it is empty are
|
|
80
|
+
* where it is empty are flagged and the cell shows "Falta <header>".
|
|
81
|
+
* Pass a function to make it conditional per row/payload, e.g.
|
|
82
|
+
* `(row) => row.tipo === 'empresa'` (only mandatory for companies).
|
|
81
83
|
*/
|
|
82
|
-
required?: boolean;
|
|
84
|
+
required?: boolean | ((row: any) => boolean);
|
|
83
85
|
/** Text shown in an empty required cell (default "Falta <header>"). */
|
|
84
86
|
missingMessage?: string;
|
|
87
|
+
/**
|
|
88
|
+
* How a missing value of this column is shown: `'error'` (red, mandatory)
|
|
89
|
+
* or `'warning'` (amber, informative). Defaults to the table's `missingAsError`.
|
|
90
|
+
*/
|
|
91
|
+
missingSeverity?: MissingSeverity;
|
|
85
92
|
/** Custom rule to decide whether the value is missing (default: empty value). */
|
|
86
93
|
isMissing?: (row: any) => boolean;
|
|
87
94
|
/** Angular date format for `template: 'date'` (default `'dd/MM/yyyy'`). */
|
|
@@ -139,6 +146,24 @@ interface FilterChangeEvent {
|
|
|
139
146
|
[key: string]: ColumnFilterState;
|
|
140
147
|
};
|
|
141
148
|
}
|
|
149
|
+
/** Severity of a missing value: mandatory (error) or informative (warning). */
|
|
150
|
+
type MissingSeverity = 'error' | 'warning';
|
|
151
|
+
/** A missing field reported by `validateRow`. */
|
|
152
|
+
interface MissingField {
|
|
153
|
+
field: string;
|
|
154
|
+
header: string;
|
|
155
|
+
severity: MissingSeverity;
|
|
156
|
+
}
|
|
157
|
+
/** A required column, as checked by the validation. */
|
|
158
|
+
interface MissingRequirement {
|
|
159
|
+
field: string;
|
|
160
|
+
header: string;
|
|
161
|
+
/** `true`, or a condition deciding whether the field is mandatory for a row. */
|
|
162
|
+
required: true | ((row: any) => boolean);
|
|
163
|
+
isMissing?: (row: any) => boolean;
|
|
164
|
+
/** The required column. */
|
|
165
|
+
column: Column;
|
|
166
|
+
}
|
|
142
167
|
/** Internal filter kind (`exact` is a `text` filter). */
|
|
143
168
|
type FilterKind = 'text' | 'numeric' | 'date' | 'select' | 'multiselect' | 'boolean' | 'range';
|
|
144
169
|
/**
|
|
@@ -161,6 +186,7 @@ declare class TableComponent {
|
|
|
161
186
|
yes: typeof LucideCircleCheck;
|
|
162
187
|
no: typeof LucideCircleX;
|
|
163
188
|
trash: typeof LucideTrash2;
|
|
189
|
+
error: typeof LucideCircleAlert;
|
|
164
190
|
};
|
|
165
191
|
/**
|
|
166
192
|
* Minimum width applied to each column (except `actions`, which keeps its
|
|
@@ -233,10 +259,15 @@ declare class TableComponent {
|
|
|
233
259
|
*/
|
|
234
260
|
resizableColumns: _angular_core.InputSignal<boolean>;
|
|
235
261
|
/**
|
|
236
|
-
* Highlights rows where a `required` column is empty
|
|
237
|
-
*
|
|
262
|
+
* Highlights the rows where a `required` column is empty (red for errors,
|
|
263
|
+
* amber for warnings) and writes "Falta <header>" in the empty cell.
|
|
238
264
|
*/
|
|
239
265
|
validateRequired: _angular_core.InputSignal<boolean>;
|
|
266
|
+
/**
|
|
267
|
+
* Default severity of missing cells: errors (red) when true, warnings
|
|
268
|
+
* (amber) when false. Each column can override it with `missingSeverity`.
|
|
269
|
+
*/
|
|
270
|
+
missingAsError: _angular_core.InputSignal<boolean>;
|
|
240
271
|
/**
|
|
241
272
|
* Column widths (px) keyed by field. Two-way bindable via
|
|
242
273
|
* `[(columnWidths)]` to restore/save them yourself.
|
|
@@ -343,24 +374,39 @@ declare class TableComponent {
|
|
|
343
374
|
visibleBulkActions: _angular_core.Signal<BulkAction[]>;
|
|
344
375
|
/** Number of rendered columns, including the selection column. */
|
|
345
376
|
totalColspan: _angular_core.Signal<number>;
|
|
346
|
-
/**
|
|
347
|
-
private
|
|
377
|
+
/** Every `required` column, active or not. */
|
|
378
|
+
private allRequirements;
|
|
379
|
+
/** Requirements checked on screen (empty when `validateRequired` is off). */
|
|
380
|
+
private activeRequirements;
|
|
348
381
|
/** Whether a value counts as missing: null, undefined, blank text or empty array. */
|
|
349
382
|
private isEmptyValue;
|
|
350
|
-
|
|
351
|
-
|
|
383
|
+
/**
|
|
384
|
+
* Whether the requirement fails for a row: its condition (when `required`
|
|
385
|
+
* is a function) must apply, and then the value must be missing.
|
|
386
|
+
*/
|
|
387
|
+
private requirementMissing;
|
|
388
|
+
/** Missing requirements of each displayed row (cached per render). */
|
|
352
389
|
private missingByRow;
|
|
353
390
|
/** Required columns that are empty in the row. */
|
|
354
|
-
missingFields(row: any):
|
|
355
|
-
/** Whether a cell is a required
|
|
391
|
+
missingFields(row: any): MissingRequirement[];
|
|
392
|
+
/** Whether a cell is a required column without value. */
|
|
356
393
|
isCellMissing(col: Column, row: any): boolean;
|
|
357
394
|
/**
|
|
358
|
-
*
|
|
359
|
-
* the
|
|
395
|
+
* Checks an object (e.g. the payload returned by a modal) against the
|
|
396
|
+
* `required` columns, returning the ones it's missing (empty = complete). Works even when `validateRequired` is off, so it can
|
|
397
|
+
* be used before adding the row.
|
|
398
|
+
*/
|
|
399
|
+
validateRow(row: any): MissingField[];
|
|
400
|
+
/**
|
|
401
|
+
* Severity of a row: `'error'` when a mandatory (error) field is missing,
|
|
402
|
+
* `'warning'` when only informative fields are missing, `null` when complete.
|
|
360
403
|
*/
|
|
361
|
-
|
|
404
|
+
rowSeverity(row: any): MissingSeverity | null;
|
|
405
|
+
/** Severity of a column's missing value (its own, or the table default). */
|
|
406
|
+
severityOf(col: Column): MissingSeverity;
|
|
407
|
+
/** Icon of a missing cell: error circle or warning triangle. */
|
|
408
|
+
protected missingIconFor(col: Column): any;
|
|
362
409
|
protected missingCellMessage(col: Column): string;
|
|
363
|
-
protected missingRowMessage(missing: Column[]): string;
|
|
364
410
|
/** Total records: server-provided in server mode, locally computed otherwise. */
|
|
365
411
|
effectiveTotalRecords: _angular_core.Signal<number>;
|
|
366
412
|
/**
|
|
@@ -653,8 +699,8 @@ declare class TableComponent {
|
|
|
653
699
|
/** Closes the column filter menu with Escape. */
|
|
654
700
|
onEscape(): void;
|
|
655
701
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TableComponent, never>;
|
|
656
|
-
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; }; "globalFilterFields": { "alias": "globalFilterFields"; "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; }; "showGridlines": { "alias": "showGridlines"; "required": false; "isSignal": true; }; "resizableColumns": { "alias": "resizableColumns"; "required": false; "isSignal": true; }; "validateRequired": { "alias": "validateRequired"; "required": false; "isSignal": true; }; "columnWidths": { "alias": "columnWidths"; "required": false; "isSignal": true; }; "stateKey": { "alias": "stateKey"; "required": false; "isSignal": true; }; "stateStorage": { "alias": "stateStorage"; "required": false; "isSignal": true; }; "rowHover": { "alias": "rowHover"; "required": false; "isSignal": true; }; "showClearButton": { "alias": "showClearButton"; "required": false; "isSignal": true; }; "showPageReport": { "alias": "showPageReport"; "required": false; "isSignal": true; }; "showRowsPerPage": { "alias": "showRowsPerPage"; "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; }; }, { "columnWidths": "columnWidthsChange"; "selection": "selectionChange"; "refresh": "refresh"; "pageChange": "pageChange"; "filterChange": "filterChange"; "searchChange": "searchChange"; "filterClick": "filterClick"; "columnResize": "columnResize"; }, never, never, true, never>;
|
|
702
|
+
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; }; "globalFilterFields": { "alias": "globalFilterFields"; "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; }; "showGridlines": { "alias": "showGridlines"; "required": false; "isSignal": true; }; "resizableColumns": { "alias": "resizableColumns"; "required": false; "isSignal": true; }; "validateRequired": { "alias": "validateRequired"; "required": false; "isSignal": true; }; "missingAsError": { "alias": "missingAsError"; "required": false; "isSignal": true; }; "columnWidths": { "alias": "columnWidths"; "required": false; "isSignal": true; }; "stateKey": { "alias": "stateKey"; "required": false; "isSignal": true; }; "stateStorage": { "alias": "stateStorage"; "required": false; "isSignal": true; }; "rowHover": { "alias": "rowHover"; "required": false; "isSignal": true; }; "showClearButton": { "alias": "showClearButton"; "required": false; "isSignal": true; }; "showPageReport": { "alias": "showPageReport"; "required": false; "isSignal": true; }; "showRowsPerPage": { "alias": "showRowsPerPage"; "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; }; }, { "columnWidths": "columnWidthsChange"; "selection": "selectionChange"; "refresh": "refresh"; "pageChange": "pageChange"; "filterChange": "filterChange"; "searchChange": "searchChange"; "filterClick": "filterClick"; "columnResize": "columnResize"; }, never, never, true, never>;
|
|
657
703
|
}
|
|
658
704
|
|
|
659
705
|
export { TableComponent };
|
|
660
|
-
export type { BulkAction, Column, ColumnFilterState, ColumnFilterType, FilterChangeEvent, FilterMatchMode, FilterOperator, FilterOption, FilterRule, PageChangeEvent, RowAction, TableAction };
|
|
706
|
+
export type { BulkAction, Column, ColumnFilterState, ColumnFilterType, FilterChangeEvent, FilterMatchMode, FilterOperator, FilterOption, FilterRule, MissingField, MissingRequirement, MissingSeverity, PageChangeEvent, RowAction, TableAction };
|