ngx-techlify-core 22.6.0 → 22.8.0

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": "ngx-techlify-core",
3
- "version": "22.6.0",
3
+ "version": "22.8.0",
4
4
  "peerDependencies": {
5
5
  "@angular/common": ">=22",
6
6
  "@angular/core": ">=22",
@@ -15,6 +15,7 @@
15
15
  "angular-google-charts": ">=16.0.0"
16
16
  },
17
17
  "dependencies": {
18
+ "@fortawesome/fontawesome-free": "^6.7.2",
18
19
  "bootstrap": "^5.3.8",
19
20
  "tslib": "^2.0.0",
20
21
  "ngx-doc-viewer": "^15.0.0",
@@ -0,0 +1,186 @@
1
+ // =====================================================================
2
+ // List page layout — responsive, reusable structure for list screens
3
+ // Shipped with ngx-techlify-core (styles/list-page.scss), included via styles/index.
4
+ // =====================================================================
5
+ //
6
+ // Apply these classes to any list page following one of the two standard structures.
7
+ //
8
+ // A) Main column + side filter panel (e.g. employee list):
9
+ //
10
+ // <div class="list-page m-2 d-flex flex-row">
11
+ // <div class="list-page-main d-flex flex-column flex-grow-1">
12
+ // <mat-card class="list-page-header ..."> title, actions, spacer
13
+ // ...
14
+ // <app-techlify-icon name="filter" class="list-page-filter-toggle clickable"
15
+ // (click)="isFilterPanelOpen = !isFilterPanelOpen"></app-techlify-icon>
16
+ // <span class="flex-grow-1"></span>
17
+ // <div class="list-page-stats">...</div> optional stat pills
18
+ // </mat-card>
19
+ // <mat-card class="list-page-content ...">...table...</mat-card>
20
+ // </div>
21
+ // <div class="list-page-side side-panel ms-2" [class.is-open]="isFilterPanelOpen">
22
+ // <mat-card>
23
+ // <form class="list-page-filters d-flex flex-column">...</form>
24
+ // </mat-card>
25
+ // </div>
26
+ // </div>
27
+ //
28
+ // B) Filters inline in the header card, no side panel (e.g. payroll list):
29
+ //
30
+ // <div class="list-page d-flex flex-column m-2">
31
+ // <mat-card class="list-page-header d-flex">
32
+ // <div>title, actions, <app-techlify-icon name="filter" class="list-page-filter-toggle" ...></div>
33
+ // <span class="flex-grow-1"></span>
34
+ // <div class="list-page-header-filters" [class.is-open]="isFilterPanelOpen">
35
+ // <form class="list-page-filters d-flex flex-row">...</form>
36
+ // </div>
37
+ // </mat-card>
38
+ // <mat-card class="list-page-content">...table...</mat-card>
39
+ // </div>
40
+ //
41
+ // Desktop (>= $list-page-stack-breakpoint): unchanged.
42
+ // Below it:
43
+ // * the page stacks into one column: header -> filters -> everything else (DOM order)
44
+ // * filters (side panel or header row) are hidden until `.is-open` is set
45
+ // (the filter toggle appears)
46
+ // * filters flow into a responsive grid; fixed filter widths (fl-sm, fl-md) are released
47
+ // * the table scrolls horizontally inside its card instead of the page
48
+ // =====================================================================
49
+
50
+ // Bootstrap breakpoint mixins (media-breakpoint-up/down) only — no CSS is emitted.
51
+ // Resolved from the consuming app's node_modules (bootstrap is a dependency of this package).
52
+ @import "bootstrap/scss/functions";
53
+ @import "bootstrap/scss/variables";
54
+ @import "bootstrap/scss/mixins/breakpoints";
55
+
56
+ // Width below which the side panel moves under the header. Matches the
57
+ // header nav collapse (navbar-expand-lg) and the dashboard stacking point.
58
+ $list-page-stack-breakpoint: lg !default;
59
+
60
+ // Lets the main column shrink so wide tables scroll inside their card
61
+ // rather than pushing the whole page wider than the viewport
62
+ .list-page-main {
63
+ min-width: 0;
64
+ }
65
+
66
+ .list-page-content {
67
+ max-width: 100%;
68
+ }
69
+
70
+ // Filter toggle only exists in the stacked layout
71
+ .list-page-filter-toggle {
72
+ display: none !important;
73
+ }
74
+
75
+ @include media-breakpoint-down($list-page-stack-breakpoint) {
76
+ // Doubled class: bootstrap.min.css loads after styles.scss, so `.flex-row` would otherwise win
77
+ .list-page.list-page {
78
+ flex-direction: column !important;
79
+ }
80
+
81
+ // Dissolve the main column so header / side panel / content become siblings
82
+ // of .list-page and can be re-ordered
83
+ .list-page > .list-page-main {
84
+ display: contents !important;
85
+ }
86
+
87
+ // Header first, filters second; any other card keeps its DOM order after them
88
+ .list-page-header {
89
+ order: -2;
90
+ flex-wrap: wrap;
91
+ row-gap: 0.5rem;
92
+ }
93
+
94
+ .list-page > .list-page-side {
95
+ order: -1;
96
+ width: 100% !important;
97
+ min-width: 0 !important;
98
+ margin: 0.5rem 0 0 !important;
99
+
100
+ &:not(.is-open) {
101
+ display: none !important;
102
+ }
103
+ }
104
+
105
+ // Header filters drop onto their own full-width row inside the header card
106
+ .list-page-header-filters {
107
+ flex: 1 1 100%;
108
+ min-width: 0;
109
+
110
+ &:not(.is-open) {
111
+ display: none !important;
112
+ }
113
+ }
114
+
115
+ // Scroll wide tables inside the card (covers pages without their own scroll wrapper)
116
+ .list-page-content {
117
+ min-width: 0;
118
+ overflow-x: auto;
119
+ }
120
+
121
+ .list-page-filter-toggle {
122
+ display: inline-flex !important;
123
+ }
124
+
125
+ .list-page-filter-toggle.is-active {
126
+ color: var(--bs-primary, #0d6efd);
127
+ }
128
+
129
+ // Filters flow into as many columns as fit, instead of a single tall column
130
+ .list-page .list-page-filters {
131
+ display: grid !important;
132
+ grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
133
+ column-gap: 0.5rem !important;
134
+ align-items: start;
135
+
136
+ // Release fixed desktop widths such as fl-sm / fl-md
137
+ > * {
138
+ width: auto !important;
139
+ min-width: 0;
140
+ }
141
+
142
+ .mat-mdc-form-field {
143
+ width: 100% !important;
144
+ }
145
+ }
146
+
147
+ // Keep cells on one line so rows stay compact and the table scrolls horizontally
148
+ // inside its card. Add `.list-page-wrap` to a cell for long free text (e.g. address).
149
+ .list-page-content {
150
+ .mat-mdc-header-cell,
151
+ .mat-mdc-footer-cell,
152
+ .mat-mdc-cell:not(.list-page-wrap) {
153
+ white-space: nowrap;
154
+ }
155
+
156
+ .mat-mdc-cell.list-page-wrap {
157
+ min-width: 200px;
158
+ }
159
+
160
+ .mat-mdc-cell,
161
+ .mat-mdc-header-cell,
162
+ .mat-mdc-footer-cell {
163
+ padding-inline: 8px;
164
+ }
165
+ }
166
+ }
167
+
168
+ @include media-breakpoint-down(sm) {
169
+ .list-page .mat-mdc-card {
170
+ padding: 12px;
171
+ }
172
+
173
+ .list-page .list-page-content.mat-mdc-card {
174
+ padding: 0;
175
+ }
176
+
177
+ // Stat pills drop under the title and share the row equally
178
+ .list-page-stats {
179
+ flex: 1 1 100%;
180
+
181
+ > * {
182
+ flex: 1 1 0;
183
+ text-align: center;
184
+ }
185
+ }
186
+ }
package/styles/style.scss CHANGED
@@ -1,3 +1,4 @@
1
1
  // Entry point for all ngx-techlify-core styles
2
2
  @use './layout.scss';
3
3
  @use './html-elements.scss';
4
+ @use './list-page.scss';
@@ -5287,6 +5287,67 @@ export declare class NumberSelectorComponent implements ControlValueAccessor, Ma
5287
5287
  }, {}, never, never, true, never>;
5288
5288
  static ngAcceptInputType_required: unknown;
5289
5289
  }
5290
+ export interface PeriodOption<T = any> {
5291
+ value: T;
5292
+ label: string;
5293
+ }
5294
+ export declare const DEFAULT_PERIOD_OPTIONS: PeriodOption<string>[];
5295
+ export declare class TechlifyPeriodSelectorComponent implements ControlValueAccessor, MatFormFieldControl<any>, OnDestroy {
5296
+ static nextId: number;
5297
+ readonly options: import("@angular/core").InputSignal<(string | PeriodOption<any>)[]>;
5298
+ readonly placeholderInput: import("@angular/core").InputSignal<string>;
5299
+ readonly requiredInput: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
5300
+ readonly items: import("@angular/core").Signal<PeriodOption<any>[]>;
5301
+ readonly selected: import("@angular/core").WritableSignal<any>;
5302
+ readonly isDisabled: import("@angular/core").WritableSignal<boolean>;
5303
+ readonly isFocused: import("@angular/core").WritableSignal<boolean>;
5304
+ readonly ariaDescribedBy: import("@angular/core").WritableSignal<string>;
5305
+ readonly ngControl: NgControl;
5306
+ readonly stateChanges: Subject<void>;
5307
+ readonly controlType = "techlify-period-selector";
5308
+ readonly id: string;
5309
+ private readonly focusMonitor;
5310
+ private readonly elementRef;
5311
+ private readonly select;
5312
+ private onChange;
5313
+ private onTouched;
5314
+ get value(): any;
5315
+ get placeholder(): string;
5316
+ get required(): boolean;
5317
+ get disabled(): boolean;
5318
+ get focused(): boolean;
5319
+ get empty(): boolean;
5320
+ get shouldLabelFloat(): boolean;
5321
+ get errorState(): boolean;
5322
+ constructor();
5323
+ setDescribedByIds(ids: string[]): void;
5324
+ /** Clicking anywhere in the form field opens the options */
5325
+ onContainerClick(): void;
5326
+ writeValue(value: any): void;
5327
+ registerOnChange(fn: (value: any) => void): void;
5328
+ registerOnTouched(fn: () => void): void;
5329
+ setDisabledState(isDisabled: boolean): void;
5330
+ handleChange(value: any): void;
5331
+ ngOnDestroy(): void;
5332
+ static ɵfac: i0.ɵɵFactoryDeclaration<TechlifyPeriodSelectorComponent, never>;
5333
+ static ɵcmp: i0.ɵɵComponentDeclaration<TechlifyPeriodSelectorComponent, "techlify-period-selector", never, {
5334
+ "options": {
5335
+ "alias": "options";
5336
+ "required": false;
5337
+ "isSignal": true;
5338
+ };
5339
+ "placeholderInput": {
5340
+ "alias": "placeholder";
5341
+ "required": false;
5342
+ "isSignal": true;
5343
+ };
5344
+ "requiredInput": {
5345
+ "alias": "required";
5346
+ "required": false;
5347
+ "isSignal": true;
5348
+ };
5349
+ }, {}, never, never, true, never>;
5350
+ }
5290
5351
  export declare class CountryService extends TechlifyService {
5291
5352
  protected http: HttpService;
5292
5353
  private countries?;
@@ -6316,6 +6377,16 @@ export interface AggregateData {
6316
6377
  [columnKey: string]: number;
6317
6378
  };
6318
6379
  }
6380
+ /** Ways the chart's data can be displayed */
6381
+ export type TechlifyChartView = 'chart' | 'table';
6382
+ /** A column of the table view */
6383
+ export interface TechlifyChartTableColumn {
6384
+ id: string;
6385
+ label: string;
6386
+ isNumber: boolean;
6387
+ /** Total of a value column, null when there's no total */
6388
+ total: number | null;
6389
+ }
6319
6390
  /**
6320
6391
  * Loads aggregated data from an endpoint and displays it as a google chart
6321
6392
  *
@@ -6362,9 +6433,21 @@ export declare class TechlifyChartComponent implements OnChanges {
6362
6433
  colors: {
6363
6434
  [label: string]: string;
6364
6435
  };
6436
+ /** Display the data as a chart or a table, supports two way binding, i.e. [(view)]="view" */
6437
+ view: TechlifyChartView;
6438
+ /** Show the selector to switch between the chart and table views */
6439
+ showViewSelector: boolean;
6440
+ /** Emits the view when switched by the selector */
6441
+ viewChange: EventEmitter<TechlifyChartView>;
6365
6442
  /** Emits the loaded data, i.e. to show the totals */
6366
6443
  loaded: EventEmitter<AggregateData>;
6367
6444
  data: AggregateData;
6445
+ /** Columns, their def names and rows of the table view: the formatted x, then a value per column */
6446
+ tableColumns: TechlifyChartTableColumn[];
6447
+ displayedColumns: string[];
6448
+ tableData: any[][];
6449
+ /** Show a footer row of the totals, when the data has any */
6450
+ hasTotals: boolean;
6368
6451
  chartColumns: any[];
6369
6452
  chartData: any[][];
6370
6453
  options: any;
@@ -6378,6 +6461,12 @@ export declare class TechlifyChartComponent implements OnChanges {
6378
6461
  constructor();
6379
6462
  /** The type as google chart's enum, as the type input also accepts its value, i.e. type="LineChart" */
6380
6463
  get chartType(): ChartType;
6464
+ /**
6465
+ * Switches the view, i.e. from the view selector
6466
+ *
6467
+ * @param view the view to display
6468
+ */
6469
+ setView(view: TechlifyChartView): void;
6381
6470
  /**
6382
6471
  * Reload when the request changes, otherwise only redraw, i.e. when the chart options change
6383
6472
  */
@@ -6389,9 +6478,16 @@ export declare class TechlifyChartComponent implements OnChanges {
6389
6478
  [key: string]: any;
6390
6479
  };
6391
6480
  /**
6392
- * Converts the data into the google chart's columns, rows and options
6481
+ * Converts the data into the google chart's columns, rows and options, and the table view's
6393
6482
  */
6394
6483
  render(): void;
6484
+ /**
6485
+ * Converts the data into the table view's columns, rows and totals, the same data as the chart
6486
+ *
6487
+ * @param xColumn the x column
6488
+ * @param valueColumns a column per series value and aggregate
6489
+ */
6490
+ renderTable(xColumn: AggregateColumn, valueColumns: AggregateColumn[]): void;
6395
6491
  /**
6396
6492
  * Returns a random hex color
6397
6493
  */
@@ -6461,7 +6557,16 @@ export declare class TechlifyChartComponent implements OnChanges {
6461
6557
  "alias": "colors";
6462
6558
  "required": false;
6463
6559
  };
6560
+ "view": {
6561
+ "alias": "view";
6562
+ "required": false;
6563
+ };
6564
+ "showViewSelector": {
6565
+ "alias": "showViewSelector";
6566
+ "required": false;
6567
+ };
6464
6568
  }, {
6569
+ "viewChange": "viewChange";
6465
6570
  "loaded": "loaded";
6466
6571
  }, never, ["*"], true, never>;
6467
6572
  }