ngx-techlify-core 22.4.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,34 +1,29 @@
1
1
  {
2
2
  "name": "ngx-techlify-core",
3
- "version": "22.4.0",
3
+ "version": "22.8.0",
4
4
  "peerDependencies": {
5
5
  "@angular/common": ">=22",
6
6
  "@angular/core": ">=22",
7
- "@angular/animations": ">=22",
8
- "@angular/compiler": ">=22",
9
7
  "@angular/forms": ">=22",
10
8
  "@angular/platform-browser": ">=22",
11
- "@angular/platform-browser-dynamic": ">=22",
12
9
  "@angular/router": ">=22",
13
10
  "@angular/service-worker": ">=22",
14
11
  "@angular/material": ">=22",
15
12
  "@angular/cdk": ">=22",
16
13
  "rxjs": ">=7.8.1",
17
- "zone.js": ">=0.15.0",
18
14
  "ngx-infinite-scroll": ">=22.0.0",
19
15
  "angular-google-charts": ">=16.0.0"
20
16
  },
21
17
  "dependencies": {
22
- "bootstrap": "5.2",
18
+ "@fortawesome/fontawesome-free": "^6.7.2",
19
+ "bootstrap": "^5.3.8",
23
20
  "tslib": "^2.0.0",
24
- "material-design-icons-iconfont": "^6.1.0",
25
21
  "ngx-doc-viewer": "^15.0.0",
26
22
  "@ngneat/until-destroy": "^9.2.3",
27
23
  "jsondiffpatch": "^0.5.0",
28
24
  "xlsx": "^0.18.5",
29
25
  "ngx-editor": "^18.0.0",
30
26
  "moment": "^2.29.4",
31
- "ngx-toastr": "^18.0.0",
32
27
  "ngx-permissions": "^19.0.0"
33
28
  },
34
29
  "module": "fesm2022/ngx-techlify-core.mjs",
@@ -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';
@@ -5228,9 +5228,10 @@ export declare class NumberSelectorComponent implements ControlValueAccessor, Ma
5228
5228
  static nextId: number;
5229
5229
  readonly min: import("@angular/core").InputSignalWithTransform<number, unknown>;
5230
5230
  readonly max: import("@angular/core").InputSignalWithTransform<number, unknown>;
5231
+ readonly multiple: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
5231
5232
  placeholder: string;
5232
5233
  required: boolean;
5233
- readonly selected: import("@angular/core").WritableSignal<number>;
5234
+ readonly selected: import("@angular/core").WritableSignal<number | number[]>;
5234
5235
  readonly items: import("@angular/core").Signal<number[]>;
5235
5236
  stateChanges: Subject<void>;
5236
5237
  controlType: string;
@@ -5249,11 +5250,11 @@ export declare class NumberSelectorComponent implements ControlValueAccessor, Ma
5249
5250
  constructor(_focusMonitor: FocusMonitor, _elementRef: ElementRef<HTMLElement>, ngControl: NgControl);
5250
5251
  setDescribedByIds(ids: string[]): void;
5251
5252
  onContainerClick(event: MouseEvent): void;
5252
- writeValue(data: number | null): void;
5253
+ writeValue(data: number | string | null): void;
5253
5254
  registerOnChange(fn: any): void;
5254
5255
  registerOnTouched(fn: any): void;
5255
5256
  setDisabledState(isDisabled: boolean): void;
5256
- handleChange(data: number | null): void;
5257
+ handleChange(data: number | number[] | null): void;
5257
5258
  ngOnDestroy(): void;
5258
5259
  static ɵfac: i0.ɵɵFactoryDeclaration<NumberSelectorComponent, [null, null, {
5259
5260
  optional: true;
@@ -5270,6 +5271,11 @@ export declare class NumberSelectorComponent implements ControlValueAccessor, Ma
5270
5271
  "required": false;
5271
5272
  "isSignal": true;
5272
5273
  };
5274
+ "multiple": {
5275
+ "alias": "multiple";
5276
+ "required": false;
5277
+ "isSignal": true;
5278
+ };
5273
5279
  "placeholder": {
5274
5280
  "alias": "placeholder";
5275
5281
  "required": false;
@@ -5281,6 +5287,67 @@ export declare class NumberSelectorComponent implements ControlValueAccessor, Ma
5281
5287
  }, {}, never, never, true, never>;
5282
5288
  static ngAcceptInputType_required: unknown;
5283
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
+ }
5284
5351
  export declare class CountryService extends TechlifyService {
5285
5352
  protected http: HttpService;
5286
5353
  private countries?;
@@ -6310,6 +6377,16 @@ export interface AggregateData {
6310
6377
  [columnKey: string]: number;
6311
6378
  };
6312
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
+ }
6313
6390
  /**
6314
6391
  * Loads aggregated data from an endpoint and displays it as a google chart
6315
6392
  *
@@ -6356,9 +6433,21 @@ export declare class TechlifyChartComponent implements OnChanges {
6356
6433
  colors: {
6357
6434
  [label: string]: string;
6358
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>;
6359
6442
  /** Emits the loaded data, i.e. to show the totals */
6360
6443
  loaded: EventEmitter<AggregateData>;
6361
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;
6362
6451
  chartColumns: any[];
6363
6452
  chartData: any[][];
6364
6453
  options: any;
@@ -6372,6 +6461,12 @@ export declare class TechlifyChartComponent implements OnChanges {
6372
6461
  constructor();
6373
6462
  /** The type as google chart's enum, as the type input also accepts its value, i.e. type="LineChart" */
6374
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;
6375
6470
  /**
6376
6471
  * Reload when the request changes, otherwise only redraw, i.e. when the chart options change
6377
6472
  */
@@ -6383,9 +6478,16 @@ export declare class TechlifyChartComponent implements OnChanges {
6383
6478
  [key: string]: any;
6384
6479
  };
6385
6480
  /**
6386
- * 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
6387
6482
  */
6388
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;
6389
6491
  /**
6390
6492
  * Returns a random hex color
6391
6493
  */
@@ -6455,7 +6557,16 @@ export declare class TechlifyChartComponent implements OnChanges {
6455
6557
  "alias": "colors";
6456
6558
  "required": false;
6457
6559
  };
6560
+ "view": {
6561
+ "alias": "view";
6562
+ "required": false;
6563
+ };
6564
+ "showViewSelector": {
6565
+ "alias": "showViewSelector";
6566
+ "required": false;
6567
+ };
6458
6568
  }, {
6569
+ "viewChange": "viewChange";
6459
6570
  "loaded": "loaded";
6460
6571
  }, never, ["*"], true, never>;
6461
6572
  }