@maro-tech/card 0.1.0 → 0.1.2
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/fesm2022/maro-tech-card.mjs +418 -1147
- package/fesm2022/maro-tech-card.mjs.map +1 -1
- package/package.json +4 -4
- package/types/maro-tech-card.d.ts +85 -157
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maro-tech/card",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@angular/cdk": "^21.2.0",
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
"@angular/core": "^21.2.0",
|
|
9
9
|
"@angular/forms": "^21.2.0",
|
|
10
10
|
"@angular/router": "^21.2.0",
|
|
11
|
-
"@maro-tech/core": "
|
|
12
|
-
"@maro-tech/form": "
|
|
13
|
-
"@maro-tech/table": "
|
|
11
|
+
"@maro-tech/core": "*",
|
|
12
|
+
"@maro-tech/form": "*",
|
|
13
|
+
"@maro-tech/table": "*",
|
|
14
14
|
"lucide-angular": "^0.577.0",
|
|
15
15
|
"rxjs": "~7.8.0"
|
|
16
16
|
},
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
-
import { InjectionToken, Type, OnChanges } from '@angular/core';
|
|
2
|
+
import { InjectionToken, Type, OnChanges, SimpleChanges } from '@angular/core';
|
|
3
3
|
import { Observable } from 'rxjs';
|
|
4
4
|
import { HttpParams } from '@angular/common/http';
|
|
5
5
|
import * as lucide_angular from 'lucide-angular';
|
|
6
6
|
import { UiSelectOption } from '@maro-tech/form';
|
|
7
|
-
import {
|
|
7
|
+
import { UiTableColumnConfig, UiTableResponse, UiTableFilter, UiTableRowAction } from '@maro-tech/table';
|
|
8
8
|
|
|
9
9
|
type ApiPluginMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
10
10
|
interface ApiPluginConfig {
|
|
@@ -13,6 +13,11 @@ interface ApiPluginConfig {
|
|
|
13
13
|
payload?: Record<string, unknown>;
|
|
14
14
|
[key: string]: unknown;
|
|
15
15
|
}
|
|
16
|
+
interface CardActionContext {
|
|
17
|
+
entity: string;
|
|
18
|
+
recordId?: string;
|
|
19
|
+
data?: Record<string, unknown> | null;
|
|
20
|
+
}
|
|
16
21
|
interface UiEntityCardAction {
|
|
17
22
|
id?: string;
|
|
18
23
|
label: string;
|
|
@@ -32,6 +37,7 @@ interface UiEntityCardAction {
|
|
|
32
37
|
payload?: Record<string, unknown>;
|
|
33
38
|
redirectEntity?: string;
|
|
34
39
|
condition?: string;
|
|
40
|
+
context?: CardActionContext;
|
|
35
41
|
}
|
|
36
42
|
interface UiEntityCardTab {
|
|
37
43
|
id: string;
|
|
@@ -44,12 +50,9 @@ interface UiEntityCardTab {
|
|
|
44
50
|
panels?: UiEntityCardTab[];
|
|
45
51
|
actions?: UiEntityCardAction[];
|
|
46
52
|
props?: Record<string, unknown> & {
|
|
47
|
-
imageUrls?: string[];
|
|
48
|
-
imageIds?: string[];
|
|
49
53
|
images?: string;
|
|
50
54
|
recordId?: string;
|
|
51
55
|
recordIdKey?: string;
|
|
52
|
-
imageBaseUrl?: string;
|
|
53
56
|
fields?: Array<Record<string, unknown>>;
|
|
54
57
|
warehouseId?: number | string;
|
|
55
58
|
[key: string]: unknown;
|
|
@@ -91,7 +94,6 @@ interface UiCardTabField {
|
|
|
91
94
|
value?: string | number | boolean | null | undefined;
|
|
92
95
|
type: 'text' | 'number' | 'boolean' | 'date' | 'datetime' | 'enum' | 'image';
|
|
93
96
|
enumMap?: Record<string, string>;
|
|
94
|
-
imageBaseUrl?: string;
|
|
95
97
|
}
|
|
96
98
|
interface UiCardTabConfig {
|
|
97
99
|
id: string;
|
|
@@ -105,35 +107,56 @@ interface UiCardTabConfig {
|
|
|
105
107
|
panels?: UiCardTabConfig[];
|
|
106
108
|
actions?: UiEntityCardAction[];
|
|
107
109
|
props?: {
|
|
108
|
-
imageUrls?: string[];
|
|
109
|
-
imageIds?: string[];
|
|
110
110
|
images?: string;
|
|
111
111
|
maxHeight?: number;
|
|
112
112
|
recordId?: string;
|
|
113
113
|
recordIdKey?: string;
|
|
114
|
-
imageBaseUrl?: string;
|
|
115
114
|
fields?: UiCardTabField[];
|
|
116
115
|
warehouseId?: number | string;
|
|
117
116
|
[key: string]: unknown;
|
|
118
117
|
};
|
|
119
118
|
}
|
|
120
119
|
|
|
120
|
+
type CardData = Record<string, unknown>;
|
|
121
|
+
type CardField = UiCardTabField;
|
|
122
|
+
type CardAction = UiEntityCardAction;
|
|
123
|
+
interface CardSection {
|
|
124
|
+
id: string;
|
|
125
|
+
title?: string;
|
|
126
|
+
header?: boolean;
|
|
127
|
+
col?: number;
|
|
128
|
+
layout?: UiCardLayoutInput;
|
|
129
|
+
component?: string;
|
|
130
|
+
html?: string;
|
|
131
|
+
props?: Record<string, unknown>;
|
|
132
|
+
actions?: CardAction[];
|
|
133
|
+
tabs?: CardSection[];
|
|
134
|
+
panels?: CardSection[];
|
|
135
|
+
}
|
|
136
|
+
type CardTab = CardSection;
|
|
137
|
+
interface CardConfig {
|
|
138
|
+
title: string;
|
|
139
|
+
layout?: UiCardLayoutInput;
|
|
140
|
+
actions?: CardAction[];
|
|
141
|
+
tabs: CardSection[];
|
|
142
|
+
data?: CardData | null;
|
|
143
|
+
}
|
|
144
|
+
interface CardPanelInput {
|
|
145
|
+
config: CardSection;
|
|
146
|
+
data: CardData | null;
|
|
147
|
+
}
|
|
148
|
+
declare function normalizeCardConfig<T extends CardConfig>(config: T): T;
|
|
149
|
+
declare function resolveCardConfig<T extends CardConfig>(config: T, data: CardData | null): T;
|
|
150
|
+
|
|
121
151
|
declare class CardComponent {
|
|
122
|
-
readonly entity: _angular_core.InputSignal<string>;
|
|
123
|
-
readonly recordId: _angular_core.InputSignal<string>;
|
|
124
152
|
readonly tabs: _angular_core.InputSignal<UiCardTabConfig[]>;
|
|
125
153
|
readonly data: _angular_core.InputSignal<Record<string, unknown> | null>;
|
|
126
154
|
readonly layout: _angular_core.InputSignal<UiCardLayoutInput>;
|
|
127
155
|
readonly embedded: _angular_core.InputSignal<boolean>;
|
|
128
156
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CardComponent, never>;
|
|
129
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CardComponent, "app-card", never, { "
|
|
157
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CardComponent, "app-card", never, { "tabs": { "alias": "tabs"; "required": false; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; "layout": { "alias": "layout"; "required": false; "isSignal": true; }; "embedded": { "alias": "embedded"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
130
158
|
}
|
|
131
159
|
|
|
132
|
-
interface CardActionContext {
|
|
133
|
-
entity: string;
|
|
134
|
-
recordId?: string;
|
|
135
|
-
data?: Record<string, unknown> | null;
|
|
136
|
-
}
|
|
137
160
|
declare const CARD_ACTION_REQUESTED = "card.action.requested";
|
|
138
161
|
declare const CARD_ACTION_STARTED = "card.action.started";
|
|
139
162
|
declare const CARD_ACTION_COMPLETED = "card.action.completed";
|
|
@@ -196,8 +219,6 @@ declare class CardSectionHeaderComponent {
|
|
|
196
219
|
readonly variant: _angular_core.InputSignal<"tabs" | "panels">;
|
|
197
220
|
readonly title: _angular_core.InputSignal<string>;
|
|
198
221
|
readonly actions: _angular_core.InputSignal<UiEntityCardAction[]>;
|
|
199
|
-
readonly entity: _angular_core.InputSignal<string>;
|
|
200
|
-
readonly recordId: _angular_core.InputSignal<string>;
|
|
201
222
|
readonly data: _angular_core.InputSignal<Record<string, unknown> | null>;
|
|
202
223
|
private readonly eventBus;
|
|
203
224
|
private readonly destroyRef;
|
|
@@ -208,7 +229,7 @@ declare class CardSectionHeaderComponent {
|
|
|
208
229
|
onActionClick(action: UiEntityCardAction): void;
|
|
209
230
|
private matchesContext;
|
|
210
231
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CardSectionHeaderComponent, never>;
|
|
211
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CardSectionHeaderComponent, "app-card-section-header", never, { "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "title": { "alias": "title"; "required": false; "isSignal": true; }; "actions": { "alias": "actions"; "required": false; "isSignal": true; }; "
|
|
232
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CardSectionHeaderComponent, "app-card-section-header", never, { "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "title": { "alias": "title"; "required": false; "isSignal": true; }; "actions": { "alias": "actions"; "required": false; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
212
233
|
}
|
|
213
234
|
|
|
214
235
|
declare class ImagesViewerComponent {
|
|
@@ -397,152 +418,59 @@ declare class HistoryTabComponent {
|
|
|
397
418
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<HistoryTabComponent, "app-history-tab", never, { "entity": { "alias": "entity"; "required": false; "isSignal": true; }; "primaryEntity": { "alias": "primaryEntity"; "required": false; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; "entityLabels": { "alias": "entityLabels"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
398
419
|
}
|
|
399
420
|
|
|
400
|
-
declare
|
|
401
|
-
|
|
402
|
-
declare const ACTION_PRINT = "ACTION_PRINT";
|
|
403
|
-
type ActionType = string;
|
|
404
|
-
declare const normalizeActionType: (value: string | null | undefined) => string | null;
|
|
405
|
-
declare class CardTableDataService {
|
|
406
|
-
private readonly http;
|
|
407
|
-
private readonly baseUrl;
|
|
408
|
-
getTableView(code: string, options: Record<string, unknown>): Observable<any>;
|
|
409
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CardTableDataService, never>;
|
|
410
|
-
static ɵprov: _angular_core.ɵɵInjectableDeclaration<CardTableDataService>;
|
|
411
|
-
}
|
|
412
|
-
declare class CardTableWarehouseService {
|
|
413
|
-
private readonly http;
|
|
414
|
-
private readonly baseUrl;
|
|
415
|
-
getWarehouses(): Observable<{
|
|
416
|
-
items: any[];
|
|
417
|
-
}>;
|
|
418
|
-
getWarehouseItems(id: string | number): Observable<any[]>;
|
|
419
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CardTableWarehouseService, never>;
|
|
420
|
-
static ɵprov: _angular_core.ɵɵInjectableDeclaration<CardTableWarehouseService>;
|
|
421
|
-
}
|
|
422
|
-
declare class CardTableBarcodeService {
|
|
423
|
-
printBarcode(options: {
|
|
424
|
-
barcode: string;
|
|
425
|
-
title: string;
|
|
426
|
-
}): void;
|
|
427
|
-
private escape;
|
|
428
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CardTableBarcodeService, never>;
|
|
429
|
-
static ɵprov: _angular_core.ɵɵInjectableDeclaration<CardTableBarcodeService>;
|
|
430
|
-
}
|
|
431
|
-
declare class CardTablePrintService {
|
|
432
|
-
openPrintWindow(): Window | null;
|
|
433
|
-
print(config: {
|
|
434
|
-
html: string;
|
|
435
|
-
title?: string;
|
|
436
|
-
}): boolean;
|
|
437
|
-
printInWindow(printWindow: Window, config: {
|
|
438
|
-
html: string;
|
|
439
|
-
title?: string;
|
|
440
|
-
}): boolean;
|
|
441
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CardTablePrintService, never>;
|
|
442
|
-
static ɵprov: _angular_core.ɵɵInjectableDeclaration<CardTablePrintService>;
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
type TableViewHeaderAction = any;
|
|
446
|
-
declare class CardTableComponent implements OnChanges {
|
|
447
|
-
tab: UiCardTabConfig;
|
|
421
|
+
declare class StandardTableComponent implements OnChanges {
|
|
422
|
+
config: UiCardTabConfig;
|
|
448
423
|
data: Record<string, unknown> | null;
|
|
449
|
-
private readonly
|
|
450
|
-
private readonly warehouseService;
|
|
451
|
-
private readonly barcodePrintService;
|
|
424
|
+
private readonly http;
|
|
452
425
|
private readonly eventBus;
|
|
453
|
-
private readonly
|
|
454
|
-
private readonly
|
|
455
|
-
private readonly
|
|
456
|
-
private readonly
|
|
457
|
-
private readonly
|
|
458
|
-
private readonly
|
|
459
|
-
private readonly
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
readonly
|
|
465
|
-
formId: string;
|
|
466
|
-
recordId: string;
|
|
467
|
-
initialValue: Record<string, unknown>;
|
|
468
|
-
} | null>;
|
|
426
|
+
private readonly columnsSignal;
|
|
427
|
+
private readonly rowsSignal;
|
|
428
|
+
private readonly paginationSignal;
|
|
429
|
+
private readonly headerActionsSignal;
|
|
430
|
+
private readonly loadingSignal;
|
|
431
|
+
private readonly errorSignal;
|
|
432
|
+
private readonly editableOptionsSignal;
|
|
433
|
+
readonly columns: _angular_core.Signal<UiTableColumnConfig[]>;
|
|
434
|
+
readonly rows: _angular_core.Signal<Record<string, unknown>[]>;
|
|
435
|
+
readonly headerActions: _angular_core.Signal<UiEntityCardAction[]>;
|
|
436
|
+
readonly isLoading: _angular_core.Signal<boolean>;
|
|
437
|
+
readonly error: _angular_core.Signal<string>;
|
|
469
438
|
readonly tableData: _angular_core.Signal<UiTableResponse<Record<string, unknown>>>;
|
|
470
|
-
private
|
|
439
|
+
private page;
|
|
471
440
|
private pageSize;
|
|
472
441
|
private sortField;
|
|
473
442
|
private sortDirection;
|
|
474
|
-
private
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
ngOnChanges(): void;
|
|
443
|
+
private sourceColumns;
|
|
444
|
+
constructor();
|
|
445
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
478
446
|
get disablePaging(): boolean;
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
get tableActions(): Array<{
|
|
482
|
-
id?: string;
|
|
483
|
-
label: string;
|
|
484
|
-
icon?: string;
|
|
485
|
-
variant?: 'primary' | 'ghost' | 'danger';
|
|
486
|
-
type?: ActionType;
|
|
487
|
-
component?: string;
|
|
488
|
-
formId?: string;
|
|
489
|
-
api?: string;
|
|
490
|
-
method?: 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';
|
|
491
|
-
title?: string;
|
|
492
|
-
text?: string;
|
|
493
|
-
submit?: boolean | string;
|
|
494
|
-
payload?: Record<string, unknown>;
|
|
495
|
-
size?: 'sm' | 'md' | 'lg';
|
|
496
|
-
}>;
|
|
497
|
-
get isTableLoading(): boolean;
|
|
498
|
-
get isTableActionRunning(): boolean;
|
|
499
|
-
get rowClickable(): boolean;
|
|
500
|
-
onTablePageChange(event: UiTableFilter): void;
|
|
501
|
-
onTableAction(event: {
|
|
447
|
+
onPageChange(event: UiTableFilter): void;
|
|
448
|
+
onAction(event: {
|
|
502
449
|
action: UiTableRowAction;
|
|
503
450
|
row: Record<string, unknown>;
|
|
504
451
|
}): void;
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
private
|
|
512
|
-
private
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
private
|
|
518
|
-
private
|
|
519
|
-
private
|
|
520
|
-
private
|
|
521
|
-
private
|
|
522
|
-
private
|
|
523
|
-
private
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
private saveEditableColumnChange;
|
|
527
|
-
private loadEditableColumnOptions;
|
|
528
|
-
private resolveEditableColumnsConfig;
|
|
529
|
-
private resolveEditableColumnPayload;
|
|
530
|
-
private resolveEditableColumnOptions;
|
|
531
|
-
private isEditEnabled;
|
|
532
|
-
private isDeleteEnabled;
|
|
533
|
-
private resolveTableSource;
|
|
534
|
-
private resolveTableFilters;
|
|
535
|
-
private resolveFiltersObject;
|
|
536
|
-
private resolveTemplatePayload;
|
|
537
|
-
private resolveTemplateString;
|
|
538
|
-
private resolveTemplateValue;
|
|
539
|
-
private resolvePageSize;
|
|
540
|
-
private resolveEditCondition;
|
|
541
|
-
private resolveEditableCondition;
|
|
542
|
-
private notify;
|
|
543
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CardTableComponent, never>;
|
|
544
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CardTableComponent, "app-card-table", never, { "tab": { "alias": "tab"; "required": true; }; "data": { "alias": "data"; "required": false; }; }, {}, never, never, true, never>;
|
|
452
|
+
onCellChange(event: {
|
|
453
|
+
column: UiTableColumnConfig;
|
|
454
|
+
row: Record<string, unknown>;
|
|
455
|
+
value: unknown;
|
|
456
|
+
}): void;
|
|
457
|
+
onHeaderAction(action: UiEntityCardAction): void;
|
|
458
|
+
private emitAction;
|
|
459
|
+
private load;
|
|
460
|
+
private setColumns;
|
|
461
|
+
private loadEditableOptions;
|
|
462
|
+
private rowsFrom;
|
|
463
|
+
private tableName;
|
|
464
|
+
private editableColumns;
|
|
465
|
+
private tableEndpoint;
|
|
466
|
+
private editEnabled;
|
|
467
|
+
private numberProp;
|
|
468
|
+
private resolveObject;
|
|
469
|
+
private resolve;
|
|
470
|
+
private resolveValue;
|
|
471
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<StandardTableComponent, never>;
|
|
472
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<StandardTableComponent, "app-card-table", never, { "config": { "alias": "config"; "required": true; }; "data": { "alias": "data"; "required": false; }; }, {}, never, never, true, never>;
|
|
545
473
|
}
|
|
546
474
|
|
|
547
|
-
export {
|
|
548
|
-
export type {
|
|
475
|
+
export { CARD_ACTION_COMPLETED, CARD_ACTION_FINISHED, CARD_ACTION_REQUESTED, CARD_ACTION_STARTED, CardComponent, CardCurrentUserService, CardDictionaryService, CardImageService, CardSectionHeaderComponent, DocumentsComponent, ENTITY_UPDATED, HistoryTabComponent, ImagesViewerComponent, StandardTableComponent, UI_CARD_API_BASE_URL, UI_CARD_TAB_REGISTRY, UI_ENTITY_CARD_HOST, UiEntityDocumentsService, cardApiParams, cardApiResourceUrl, normalizeCardConfig, resolveCardConfig };
|
|
476
|
+
export type { ApiPluginConfig, ApiPluginMethod, CardAction, CardActionContext, CardActionLifecycleEvent, CardActionRequestedEvent, CardConfig, CardData, CardDictionarySuggestItem, CardField, CardPanelInput, CardSection, CardTab, EntityUpdatedEvent, UiCardLayout, UiCardLayoutInput, UiCardTabComponent, UiCardTabConfig, UiCardTabField, UiCardTabRegistration, UiEntityCardAction, UiEntityCardHost, UiEntityCardResponse, UiEntityCardTab, UiEntityDocumentFile, UiEntityDocumentRecognitionStatus };
|