eru-grid 0.0.37 → 0.0.39

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eru-grid",
3
- "version": "0.0.37",
3
+ "version": "0.0.39",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^21.1.2",
6
6
  "@angular/core": "^21.1.2",
@@ -69,6 +69,26 @@ interface GridFeatures {
69
69
  actionColumnPosition?: 'before' | 'after';
70
70
  designMode?: boolean;
71
71
  groupBar?: boolean;
72
+ excel_download?: boolean;
73
+ response_key?: string;
74
+ header_fill_color?: string[];
75
+ header_fill_type?: string;
76
+ header_fill_pattern?: number;
77
+ header_font_family?: string;
78
+ header_font_size?: number;
79
+ header_font_bold?: boolean;
80
+ header_border_type?: string;
81
+ header_border_color?: string;
82
+ header_border_style?: number;
83
+ data_fill_color?: string[];
84
+ data_fill_type?: string;
85
+ data_fill_pattern?: number;
86
+ data_font_family?: string;
87
+ data_font_size?: number;
88
+ data_font_bold?: boolean;
89
+ data_border_type?: string;
90
+ data_border_color?: string;
91
+ data_border_style?: number;
72
92
  wrapHeaders?: boolean;
73
93
  headerRowHeight?: number;
74
94
  dataRowHeight?: number;
@@ -79,6 +99,64 @@ interface GridFeatures {
79
99
  boardColumnMinWidth?: number;
80
100
  boardColumnHeight?: number;
81
101
  }
102
+ interface ExcelDownloadPayload {
103
+ columns: Record<string, {
104
+ headers: Record<string, {
105
+ max_width: number;
106
+ sub_total: boolean;
107
+ header_label: string;
108
+ header_name: string;
109
+ }>;
110
+ }>;
111
+ excel_styles: Record<string, {
112
+ header_style: {
113
+ fill: {
114
+ color: string[];
115
+ type: string;
116
+ pattern: number;
117
+ };
118
+ font: {
119
+ family: string;
120
+ size: number;
121
+ bold: boolean;
122
+ };
123
+ border: [{
124
+ type: string;
125
+ color: string;
126
+ style: number;
127
+ }];
128
+ };
129
+ data_style: {
130
+ fill: {
131
+ color: string[];
132
+ type: string;
133
+ pattern: number;
134
+ };
135
+ font: {
136
+ family: string;
137
+ size: number;
138
+ bold: boolean;
139
+ };
140
+ border: [{
141
+ type: string;
142
+ color: string;
143
+ style: number;
144
+ }];
145
+ };
146
+ }>;
147
+ }
148
+ /**
149
+ * Descriptor enqueued by the grid when the excel-download icon is clicked.
150
+ * Consumers listen to EruGridStore.excelDownloadRequest() the same way they
151
+ * already listen to requestQueue()/dynamicDataRequest() — same
152
+ * enqueue/drain/remove pattern, not a one-off output event — and remove the
153
+ * request via EruGridStore.removeExcelDownloadRequest(id) once the file has
154
+ * been fetched and downloaded.
155
+ */
156
+ interface ExcelDownloadRequest extends ExcelDownloadPayload {
157
+ id: number;
158
+ timestamp: number;
159
+ }
82
160
  interface GridStyles {
83
161
  subTotalStyle?: 'bold' | 'italic' | 'highlighted';
84
162
  grandTotalStyle?: 'bold' | 'italic' | 'highlighted';
@@ -608,6 +686,7 @@ declare class EruGridStore {
608
686
  private readonly _sortColumns;
609
687
  private readonly _dataRequest;
610
688
  private readonly _requestQueue;
689
+ private readonly _excelDownloadRequest;
611
690
  private readonly _selectedDesignColumn;
612
691
  readonly selectedDesignColumn: _angular_core.Signal<string | null>;
613
692
  private readonly _columnDesignUpdate;
@@ -645,6 +724,7 @@ declare class EruGridStore {
645
724
  readonly dataRequest: _angular_core.Signal<RowDataRequest | null>;
646
725
  readonly dynamicDataRequest: _angular_core.Signal<DynamicDataRequest[] | null>;
647
726
  readonly dynamicData: _angular_core.Signal<Map<string, any> | null>;
727
+ readonly excelDownloadRequest: _angular_core.Signal<ExcelDownloadRequest[]>;
648
728
  readonly selectedRows: _angular_core.Signal<Row[]>;
649
729
  readonly totalSelectedCount: _angular_core.Signal<number>;
650
730
  readonly hasSelection: _angular_core.Signal<boolean>;
@@ -676,6 +756,14 @@ declare class EruGridStore {
676
756
  reorderColumns(fromIndex: number, toIndex: number): void;
677
757
  updateColumnRequired(columnName: string, required: boolean): void;
678
758
  updateColumnMeta(columnName: string, patch: Partial<Field>): void;
759
+ /**
760
+ * Apply metadata resolved from a mapped entity field. Unlike
761
+ * updateColumnMeta this does NOT emit a columnMetaPatch, so the consumer
762
+ * never persists the resolved values — only the mapping itself
763
+ * (entity_name / field_name) is stored, and the data model stays the single
764
+ * source of truth on every reload.
765
+ */
766
+ applyResolvedColumnMeta(columnName: string, patch: Partial<Field>): void;
679
767
  selectDesignColumn(columnName: string | null): void;
680
768
  updateColumnWidth(columnName: string, field_size: number): void;
681
769
  setCellValueChange(change: CellValueChange): void;
@@ -781,6 +869,16 @@ declare class EruGridStore {
781
869
  * Clear all requests from queue
782
870
  */
783
871
  clearRequestQueue(): void;
872
+ /**
873
+ * Enqueue an excel-download request (called by the grid component when the
874
+ * excel-download icon is clicked).
875
+ */
876
+ addExcelDownloadRequest(request: ExcelDownloadRequest): void;
877
+ /**
878
+ * Remove an excel-download request from the queue (called by the consumer
879
+ * once it has fetched and downloaded the file for that request).
880
+ */
881
+ removeExcelDownloadRequest(id: number): void;
784
882
  /**
785
883
  * Clear the data request signal (called by consumer after handling)
786
884
  */
@@ -1033,7 +1131,17 @@ declare class EruGridComponent implements OnInit, AfterViewInit, OnDestroy {
1033
1131
  * Default: 0 (cards stacked flush).
1034
1132
  */
1035
1133
  boardCardGap: number;
1036
- /** Total slot size per board card = card height + gap. Drives CDK itemSize. */
1134
+ /**
1135
+ * Gutter in pixels between a board card and the edge of its slot, applied
1136
+ * equally on all four sides. It sits outside the card, so the column surface
1137
+ * shows through it. Added around boardCardHeight rather than taken out of it,
1138
+ * so the card still renders at exactly the height that was configured.
1139
+ * Default: 8.
1140
+ */
1141
+ boardCardPadding: number;
1142
+ /** Outer size of a board card slot = card height + the gutter on both sides. */
1143
+ get boardCardOuterHeight(): number;
1144
+ /** Total slot size per board card = outer height + gap. Drives CDK itemSize. */
1037
1145
  get boardCardSlot(): number;
1038
1146
  /**
1039
1147
  * Fires when a user clicks a row (table mode) or card (board mode).
@@ -1046,6 +1154,18 @@ declare class EruGridComponent implements OnInit, AfterViewInit, OnDestroy {
1046
1154
  group?: RowGroup;
1047
1155
  }>;
1048
1156
  emitRowSelect(row: Row, mode: 'table' | 'board', group?: RowGroup): void;
1157
+ /**
1158
+ * Fires when the user clicks the excel download icon (shown when
1159
+ * `config.excel_download` is enabled). Enqueues an ExcelDownloadRequest
1160
+ * onto gridStore.excelDownloadRequest() — the same enqueue/drain/remove
1161
+ * pattern already used for row-data pagination (requestQueue) and cell
1162
+ * option-lists (dynamicDataRequest) — rather than a one-off output event.
1163
+ * The consumer's effect drains the queue, performs its own entity/query
1164
+ * fetch (the library never makes HTTP calls itself), and removes the
1165
+ * request via gridStore.removeExcelDownloadRequest(id) once done.
1166
+ */
1167
+ onExcelDownloadClick(event: Event): void;
1168
+ private buildExcelDownloadPayload;
1049
1169
  /** Whether a board card is the active (last-clicked) one. Compared by row
1050
1170
  * reference so it works for entity and query data alike. */
1051
1171
  isBoardCardActive(row: Row): boolean;
@@ -1080,6 +1200,7 @@ declare class EruGridComponent implements OnInit, AfterViewInit, OnDestroy {
1080
1200
  isSortable: _angular_core.Signal<boolean>;
1081
1201
  showSortBar: _angular_core.Signal<boolean>;
1082
1202
  showGroupBar: _angular_core.Signal<boolean>;
1203
+ showExcelDownload: _angular_core.Signal<boolean>;
1083
1204
  wrapHeaders: _angular_core.Signal<boolean>;
1084
1205
  headerRowHeight: _angular_core.Signal<number>;
1085
1206
  dataRowHeight: _angular_core.Signal<number>;
@@ -1225,8 +1346,30 @@ declare class EruGridComponent implements OnInit, AfterViewInit, OnDestroy {
1225
1346
  /** Add a field from dropdown — defaults to asc */
1226
1347
  onBoardSortFieldSelect(column: Field): void;
1227
1348
  onBoardSortClear(): void;
1349
+ /**
1350
+ * Attributes a mapped column inherits from its data-model field. Only keys
1351
+ * the field actually defines are returned, so a sparse field never blanks
1352
+ * out what the column already has.
1353
+ */
1354
+ private buildMappedColumnPatch;
1228
1355
  /** Get the field name used for grouping */
1229
1356
  groupByField: _angular_core.Signal<string | null>;
1357
+ /**
1358
+ * Column config of the group-by field. Taken from the store's raw columns
1359
+ * rather than displayColumns, which deliberately drops the grouped column.
1360
+ * Board column headers need it to render the group value through the same
1361
+ * cell renderer a data cell would use, so the datatype formats itself.
1362
+ */
1363
+ readonly groupByColumn: _angular_core.Signal<Field | null>;
1364
+ /** True when the grouped field carries its own colour-coded values. */
1365
+ readonly isGroupByColorCoded: _angular_core.Signal<boolean>;
1366
+ /**
1367
+ * Accent colour for a board column, resolved from the grouped field's own
1368
+ * value list (status open/close entries, or tag options). Null when the
1369
+ * field is not colour-coded or the value has no colour, so the column keeps
1370
+ * its default chrome.
1371
+ */
1372
+ boardGroupColor(group: RowGroup): string | null;
1230
1373
  /** Toggle sort direction on the group field (asc ↔ desc, never remove) */
1231
1374
  onGroupSortToggle(event: Event, direction: 'asc' | 'desc'): void;
1232
1375
  /**
@@ -1367,7 +1510,7 @@ declare class EruGridComponent implements OnInit, AfterViewInit, OnDestroy {
1367
1510
  requestBoardRowsForGroup(group: RowGroup): void;
1368
1511
  loadBoardAll(): void;
1369
1512
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<EruGridComponent, never>;
1370
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<EruGridComponent, "eru-grid", never, { "gridConfig": { "alias": "gridConfig"; "required": false; }; "boardCardTemplate": { "alias": "boardCardTemplate"; "required": false; }; "boardCardHeight": { "alias": "boardCardHeight"; "required": false; }; "boardCardGap": { "alias": "boardCardGap"; "required": false; }; }, { "rowSelect": "rowSelect"; }, never, never, true, never>;
1513
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<EruGridComponent, "eru-grid", never, { "gridConfig": { "alias": "gridConfig"; "required": false; }; "boardCardTemplate": { "alias": "boardCardTemplate"; "required": false; }; "boardCardHeight": { "alias": "boardCardHeight"; "required": false; }; "boardCardGap": { "alias": "boardCardGap"; "required": false; }; "boardCardPadding": { "alias": "boardCardPadding"; "required": false; }; }, { "rowSelect": "rowSelect"; }, never, never, true, never>;
1371
1514
  }
1372
1515
  interface GroupItem {
1373
1516
  type: 'header' | 'row' | 'table-header' | 'row-place-holder' | 'ghost-loading';
@@ -2307,4 +2450,4 @@ declare class ThemeToggleComponent {
2307
2450
  }
2308
2451
 
2309
2452
  export { AttachmentComponent, CheckboxComponent, ColumnConstraintsService, CurrencyComponent, CustomVirtualScrollStrategy, DATA_TYPES, DateComponent, DatetimeComponent, DurationComponent, EmailComponent, EruGridComponent, EruGridService, EruGridStore, LocationComponent, MATERIAL_MODULES, MATERIAL_PROVIDERS, NumberComponent, PRESET_CONFIG_DEFAULTS, PRESET_MANAGED_FIELDS, PeopleComponent, PhoneComponent, PriorityComponent, ProgressComponent, RatingComponent, SelectComponent, StatusComponent, TagComponent, TextareaComponent, TextboxComponent, ThemeService, ThemeToggleComponent, WebsiteComponent };
2310
- export type { ActionClick, AggregationFunction, AttachmentConfig, BoardCardContext, CellValueChange, ColumnReorder, ColumnResize, ColumnWidthConstraints, CurrencyValidationResult, DataTypes, Drilldown, DurationValue, DynamicDataRequest, EmailValidationResult, Field, GridConfiguration, GridFeatures, GridMode, GridPreset, GridStyles, GridTokens, GroupItem$1 as GroupItem, LocationConfig, LocationValidationResult, NumberValidationResult, PeopleOption, PivotColumnGroupState, PivotColumnHeader, PivotConfiguration, PivotHeaderStructure, PivotMetadata, PivotResult, PivotRow, RatingConfig, Row, RowDataRequest, RowDataResponse, RowGrandTotal, RowGroup, TextareaValidationResult, TextboxValidationResult, Theme, WebsiteValidationResult };
2453
+ export type { ActionClick, AggregationFunction, AttachmentConfig, BoardCardContext, CellValueChange, ColumnReorder, ColumnResize, ColumnWidthConstraints, CurrencyValidationResult, DataTypes, Drilldown, DurationValue, DynamicDataRequest, EmailValidationResult, ExcelDownloadPayload, ExcelDownloadRequest, Field, GridConfiguration, GridFeatures, GridMode, GridPreset, GridStyles, GridTokens, GroupItem$1 as GroupItem, LocationConfig, LocationValidationResult, NumberValidationResult, PeopleOption, PivotColumnGroupState, PivotColumnHeader, PivotConfiguration, PivotHeaderStructure, PivotMetadata, PivotResult, PivotRow, RatingConfig, Row, RowDataRequest, RowDataResponse, RowGrandTotal, RowGroup, TextareaValidationResult, TextboxValidationResult, Theme, WebsiteValidationResult };