ngx-techlify-core 22.2.0 → 22.3.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.2.0",
3
+ "version": "22.3.0",
4
4
  "peerDependencies": {
5
5
  "@angular/common": ">=22",
6
6
  "@angular/core": ">=22",
@@ -15,7 +15,8 @@
15
15
  "@angular/cdk": ">=22",
16
16
  "rxjs": ">=7.8.1",
17
17
  "zone.js": ">=0.15.0",
18
- "ngx-infinite-scroll": ">=22.0.0"
18
+ "ngx-infinite-scroll": ">=22.0.0",
19
+ "angular-google-charts": ">=16.0.0"
19
20
  },
20
21
  "dependencies": {
21
22
  "bootstrap": "5.2",
@@ -58,6 +58,7 @@ import * as i3$1 from "ngx-editor";
58
58
  import { Editor, Toolbar } from "ngx-editor";
59
59
  import { NgxSpinnerService } from "ngx-spinner";
60
60
  import * as i3 from "@angular/cdk/overlay";
61
+ import { ChartType } from "angular-google-charts";
61
62
  export declare class ActionPopup {
62
63
  name: string;
63
64
  title: string;
@@ -6261,4 +6262,168 @@ export declare class DatetimeLocalDirective implements ControlValueAccessor {
6261
6262
  };
6262
6263
  }, {}, never, never, true, never>;
6263
6264
  }
6265
+ /** A column of aggregated data: the x column, then a column per series value and aggregate */
6266
+ export interface AggregateColumn {
6267
+ key: string;
6268
+ label: string;
6269
+ type: 'text' | 'date' | 'number';
6270
+ interval?: string | number;
6271
+ }
6272
+ /** Aggregated data, as returned by an aggregate endpoint, i.e. api/employee-data/aggregate */
6273
+ export interface AggregateData {
6274
+ columns: AggregateColumn[];
6275
+ rows: any[][];
6276
+ totals: {
6277
+ [columnKey: string]: number;
6278
+ };
6279
+ }
6280
+ /**
6281
+ * Loads aggregated data from an endpoint and displays it as a google chart
6282
+ *
6283
+ * The x, series, y and filters are sent as the request params, see ModelDataController in laravel-core.
6284
+ * A custom endpoint can be used instead, i.e. for a calculation the generic aggregation can't do,
6285
+ * as long as it returns the same AggregateData format
6286
+ *
6287
+ * Needs provideGoogleCharts() in the app providers, so all charts share the one script loader
6288
+ *
6289
+ * @example
6290
+ * <app-techlify-chart title="Employees per Branch" url="api/employee-data/aggregate" [filters]="filters"
6291
+ * x="branch.title" series="gender.title" y="count"></app-techlify-chart>
6292
+ */
6293
+ export declare class TechlifyChartComponent implements OnChanges {
6294
+ /** Endpoint returning AggregateData */
6295
+ url: string;
6296
+ /** Filters of the model, i.e. { branch_ids: [1, 2], date_from: '2024-01-01' }. Arrays are sent comma separated */
6297
+ filters: {
6298
+ [key: string]: any;
6299
+ };
6300
+ /** Field to group by, on the x-axis: a column, i.e. join_date, or relation.column, i.e. branch.title */
6301
+ x: string;
6302
+ /** Date fields: day|week|month|quarter|year, number fields: the bucket size, i.e. 10 for age ranges */
6303
+ xInterval: string | number;
6304
+ /** moment format for date x values, defaults by the interval */
6305
+ xFormat: string;
6306
+ /** Field to split each group by, as a line/bar per value */
6307
+ series: string;
6308
+ /** Aggregates: count, or <sum|avg|min|max>:<number field> */
6309
+ y: string | string[];
6310
+ /** Show running totals along x */
6311
+ cumulative: boolean;
6312
+ /** Any other request params, i.e. for a custom endpoint */
6313
+ params: {
6314
+ [key: string]: any;
6315
+ };
6316
+ /** Chart type, i.e. ColumnChart, LineChart or PieChart */
6317
+ type: `${ChartType}`;
6318
+ title: string;
6319
+ subtitle: string;
6320
+ /** Google chart options, merged over the defaults */
6321
+ chartOptions: any;
6322
+ /** Colors of specific series by label, i.e. { Male: '#05A9F4' }. Others keep the chart's default colors */
6323
+ colors: {
6324
+ [label: string]: string;
6325
+ };
6326
+ /** Emits the loaded data, i.e. to show the totals */
6327
+ loaded: EventEmitter<AggregateData>;
6328
+ data: AggregateData;
6329
+ chartColumns: any[];
6330
+ chartData: any[][];
6331
+ options: any;
6332
+ isLoading: boolean;
6333
+ hasError: boolean;
6334
+ private readonly http;
6335
+ private readonly requestHelperService;
6336
+ private readonly changeDetector;
6337
+ private readonly load$;
6338
+ private lastRequest;
6339
+ constructor();
6340
+ /** The type as google chart's enum, as the type input also accepts its value, i.e. type="LineChart" */
6341
+ get chartType(): ChartType;
6342
+ /**
6343
+ * Reload when the request changes, otherwise only redraw, i.e. when the chart options change
6344
+ */
6345
+ ngOnChanges(): void;
6346
+ /**
6347
+ * Returns the request params, without unset values, formatted as list filters, i.e. arrays comma separated
6348
+ */
6349
+ getParams(): {
6350
+ [key: string]: any;
6351
+ };
6352
+ /**
6353
+ * Converts the data into the google chart's columns, rows and options
6354
+ */
6355
+ render(): void;
6356
+ /**
6357
+ * Returns a random hex color
6358
+ */
6359
+ generateColor(): string;
6360
+ /**
6361
+ * Returns the x value as displayed, formatting dates and number ranges
6362
+ *
6363
+ * @param value x value of a row
6364
+ * @param column the x column
6365
+ */
6366
+ formatX(value: any, column: AggregateColumn): string;
6367
+ static ɵfac: i0.ɵɵFactoryDeclaration<TechlifyChartComponent, never>;
6368
+ static ɵcmp: i0.ɵɵComponentDeclaration<TechlifyChartComponent, "app-techlify-chart", never, {
6369
+ "url": {
6370
+ "alias": "url";
6371
+ "required": true;
6372
+ };
6373
+ "filters": {
6374
+ "alias": "filters";
6375
+ "required": false;
6376
+ };
6377
+ "x": {
6378
+ "alias": "x";
6379
+ "required": false;
6380
+ };
6381
+ "xInterval": {
6382
+ "alias": "xInterval";
6383
+ "required": false;
6384
+ };
6385
+ "xFormat": {
6386
+ "alias": "xFormat";
6387
+ "required": false;
6388
+ };
6389
+ "series": {
6390
+ "alias": "series";
6391
+ "required": false;
6392
+ };
6393
+ "y": {
6394
+ "alias": "y";
6395
+ "required": false;
6396
+ };
6397
+ "cumulative": {
6398
+ "alias": "cumulative";
6399
+ "required": false;
6400
+ };
6401
+ "params": {
6402
+ "alias": "params";
6403
+ "required": false;
6404
+ };
6405
+ "type": {
6406
+ "alias": "type";
6407
+ "required": false;
6408
+ };
6409
+ "title": {
6410
+ "alias": "title";
6411
+ "required": false;
6412
+ };
6413
+ "subtitle": {
6414
+ "alias": "subtitle";
6415
+ "required": false;
6416
+ };
6417
+ "chartOptions": {
6418
+ "alias": "chartOptions";
6419
+ "required": false;
6420
+ };
6421
+ "colors": {
6422
+ "alias": "colors";
6423
+ "required": false;
6424
+ };
6425
+ }, {
6426
+ "loaded": "loaded";
6427
+ }, never, ["*"], true, never>;
6428
+ }
6264
6429
  export { EntityFileListModule as EntityFilesViewAllModule };