@zeedhi/common 1.60.0 → 1.62.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.
@@ -4439,6 +4439,8 @@ class Footer extends ComponentRender {
4439
4439
  }
4440
4440
  }
4441
4441
 
4442
+ class ResponseClass extends Response {
4443
+ }
4442
4444
  /**
4443
4445
  * Base class for Frame component.
4444
4446
  */
@@ -4571,7 +4573,7 @@ class Frame extends ComponentRender {
4571
4573
  [this.headerName]: time,
4572
4574
  });
4573
4575
  const stringData = JSON.stringify(metadata);
4574
- const responseObj = new Response(stringData, { headers });
4576
+ const responseObj = new ResponseClass(stringData, { headers });
4575
4577
  cache.put(url, responseObj);
4576
4578
  }
4577
4579
  /**
@@ -5439,6 +5441,28 @@ class Grid extends Iterable {
5439
5441
  });
5440
5442
  }
5441
5443
  }
5444
+ selectAll(isSelected) {
5445
+ if (this.selectable) {
5446
+ if (isSelected) {
5447
+ this.datasource.data.forEach((row) => {
5448
+ if (!this.callDisableSelection(row)) {
5449
+ const key = row[this.datasource.uniqueKey];
5450
+ if (key && this.selectedRows.indexOf(row) === -1) {
5451
+ this.selectedRows.push(row);
5452
+ }
5453
+ }
5454
+ });
5455
+ }
5456
+ else {
5457
+ this.datasource.data.forEach((row) => {
5458
+ const index = this.selectedRows.indexOf(row);
5459
+ if (index > -1) {
5460
+ this.selectedRows.splice(index, 1);
5461
+ }
5462
+ });
5463
+ }
5464
+ }
5465
+ }
5442
5466
  navigateUp() {
5443
5467
  const { uniqueKey, currentRow } = this.datasource;
5444
5468
  const rowIndex = this.datasource.data.findIndex((row) => row[uniqueKey] === currentRow[uniqueKey]);
@@ -7535,6 +7559,10 @@ class Login extends ComponentRender {
7535
7559
  * Image displayed in the card.
7536
7560
  */
7537
7561
  this.poweredByImageCard = '';
7562
+ /**
7563
+ * If form is flat
7564
+ */
7565
+ this.flatForm = false;
7538
7566
  /**
7539
7567
  * Buttons displayed in the bottom of the card.
7540
7568
  */
@@ -7548,6 +7576,7 @@ class Login extends ComponentRender {
7548
7576
  this.logoMessage = this.getInitValue('logoMessage', props.logoMessage, this.logoMessage);
7549
7577
  this.poweredByImage = this.getInitValue('poweredByImage', props.poweredByImage, this.poweredByImage);
7550
7578
  this.poweredByImageCard = this.getInitValue('poweredByImageCard', props.poweredByImageCard, this.poweredByImageCard);
7579
+ this.flatForm = this.getInitValue('flatForm', props.flatForm, this.flatForm);
7551
7580
  this.socialLogin = props.socialLogin || this.socialLogin;
7552
7581
  this.createAccessors();
7553
7582
  }
@@ -10983,6 +11012,8 @@ class Tree extends ComponentRender {
10983
11012
  this.checkedField = this.getInitValue('checkedField', props.checkedField, this.checkedField);
10984
11013
  this.openLevelOnLoad = this.getInitValue('openLevelOnLoad', props.openLevelOnLoad, this.openLevelOnLoad);
10985
11014
  this.checkbox = this.getInitValue('checkbox', props.checkbox, this.checkbox);
11015
+ this.height = this.getInitValue('height', props.height, this.height);
11016
+ this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
10986
11017
  this.disableCheckbox = this.getInitValue('disableCheckbox', props.disableCheckbox, this.disableCheckbox);
10987
11018
  this.afterTitleSlot = props.afterTitleSlot || this.afterTitleSlot;
10988
11019
  this.toolbarSlot = props.toolbarSlot || this.toolbarSlot;
@@ -13124,7 +13155,7 @@ class Report {
13124
13155
  }
13125
13156
  throw new Error(`Invalid report type: ${type}`);
13126
13157
  }
13127
- getReport(type, portrait = true, rowObj) {
13158
+ getReport(type, portrait = true, rowObj, beforeReportEvent) {
13128
13159
  var _a;
13129
13160
  return __awaiter(this, void 0, void 0, function* () {
13130
13161
  const data = (_a = this.data) !== null && _a !== void 0 ? _a : yield this.getData();
@@ -13148,26 +13179,22 @@ class Report {
13148
13179
  dataset = reportType.buildDataset(data, formattedColumns);
13149
13180
  }
13150
13181
  const filter = '[]';
13151
- let row = {};
13182
+ let row = {
13183
+ dataSet: JSON.parse(dataset),
13184
+ filter: JSON.parse(filter),
13185
+ metaData: JSON.parse(metadataObj),
13186
+ };
13152
13187
  if (rowObj) {
13153
- row = merge({
13154
- dataSet: JSON.parse(dataset),
13155
- filter: JSON.parse(filter),
13156
- metaData: JSON.parse(metadataObj),
13157
- }, rowObj);
13158
- row = {
13159
- dataSet: JSON.stringify(row.dataSet),
13160
- filter: JSON.stringify(row.filter),
13161
- metaData: JSON.stringify(row.metaData),
13162
- };
13188
+ row = merge(row, rowObj);
13163
13189
  }
13164
- else {
13165
- row = {
13166
- dataSet: dataset,
13167
- filter,
13168
- metaData: metadataObj,
13169
- };
13190
+ if (beforeReportEvent) {
13191
+ row = yield beforeReportEvent(row);
13170
13192
  }
13193
+ row = {
13194
+ dataSet: JSON.stringify(row.dataSet),
13195
+ filter: JSON.stringify(row.filter),
13196
+ metaData: JSON.stringify(row.metaData),
13197
+ };
13171
13198
  const url = new URL(route, this.endPoint).href;
13172
13199
  const response = yield Http.post(url, {
13173
13200
  origin,
@@ -4446,6 +4446,8 @@
4446
4446
  }
4447
4447
  }
4448
4448
 
4449
+ class ResponseClass extends Response {
4450
+ }
4449
4451
  /**
4450
4452
  * Base class for Frame component.
4451
4453
  */
@@ -4578,7 +4580,7 @@
4578
4580
  [this.headerName]: time,
4579
4581
  });
4580
4582
  const stringData = JSON.stringify(metadata);
4581
- const responseObj = new Response(stringData, { headers });
4583
+ const responseObj = new ResponseClass(stringData, { headers });
4582
4584
  cache.put(url, responseObj);
4583
4585
  }
4584
4586
  /**
@@ -5446,6 +5448,28 @@
5446
5448
  });
5447
5449
  }
5448
5450
  }
5451
+ selectAll(isSelected) {
5452
+ if (this.selectable) {
5453
+ if (isSelected) {
5454
+ this.datasource.data.forEach((row) => {
5455
+ if (!this.callDisableSelection(row)) {
5456
+ const key = row[this.datasource.uniqueKey];
5457
+ if (key && this.selectedRows.indexOf(row) === -1) {
5458
+ this.selectedRows.push(row);
5459
+ }
5460
+ }
5461
+ });
5462
+ }
5463
+ else {
5464
+ this.datasource.data.forEach((row) => {
5465
+ const index = this.selectedRows.indexOf(row);
5466
+ if (index > -1) {
5467
+ this.selectedRows.splice(index, 1);
5468
+ }
5469
+ });
5470
+ }
5471
+ }
5472
+ }
5449
5473
  navigateUp() {
5450
5474
  const { uniqueKey, currentRow } = this.datasource;
5451
5475
  const rowIndex = this.datasource.data.findIndex((row) => row[uniqueKey] === currentRow[uniqueKey]);
@@ -7542,6 +7566,10 @@
7542
7566
  * Image displayed in the card.
7543
7567
  */
7544
7568
  this.poweredByImageCard = '';
7569
+ /**
7570
+ * If form is flat
7571
+ */
7572
+ this.flatForm = false;
7545
7573
  /**
7546
7574
  * Buttons displayed in the bottom of the card.
7547
7575
  */
@@ -7555,6 +7583,7 @@
7555
7583
  this.logoMessage = this.getInitValue('logoMessage', props.logoMessage, this.logoMessage);
7556
7584
  this.poweredByImage = this.getInitValue('poweredByImage', props.poweredByImage, this.poweredByImage);
7557
7585
  this.poweredByImageCard = this.getInitValue('poweredByImageCard', props.poweredByImageCard, this.poweredByImageCard);
7586
+ this.flatForm = this.getInitValue('flatForm', props.flatForm, this.flatForm);
7558
7587
  this.socialLogin = props.socialLogin || this.socialLogin;
7559
7588
  this.createAccessors();
7560
7589
  }
@@ -10990,6 +11019,8 @@
10990
11019
  this.checkedField = this.getInitValue('checkedField', props.checkedField, this.checkedField);
10991
11020
  this.openLevelOnLoad = this.getInitValue('openLevelOnLoad', props.openLevelOnLoad, this.openLevelOnLoad);
10992
11021
  this.checkbox = this.getInitValue('checkbox', props.checkbox, this.checkbox);
11022
+ this.height = this.getInitValue('height', props.height, this.height);
11023
+ this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
10993
11024
  this.disableCheckbox = this.getInitValue('disableCheckbox', props.disableCheckbox, this.disableCheckbox);
10994
11025
  this.afterTitleSlot = props.afterTitleSlot || this.afterTitleSlot;
10995
11026
  this.toolbarSlot = props.toolbarSlot || this.toolbarSlot;
@@ -13131,7 +13162,7 @@
13131
13162
  }
13132
13163
  throw new Error(`Invalid report type: ${type}`);
13133
13164
  }
13134
- getReport(type, portrait = true, rowObj) {
13165
+ getReport(type, portrait = true, rowObj, beforeReportEvent) {
13135
13166
  var _a;
13136
13167
  return __awaiter(this, void 0, void 0, function* () {
13137
13168
  const data = (_a = this.data) !== null && _a !== void 0 ? _a : yield this.getData();
@@ -13155,26 +13186,22 @@
13155
13186
  dataset = reportType.buildDataset(data, formattedColumns);
13156
13187
  }
13157
13188
  const filter = '[]';
13158
- let row = {};
13189
+ let row = {
13190
+ dataSet: JSON.parse(dataset),
13191
+ filter: JSON.parse(filter),
13192
+ metaData: JSON.parse(metadataObj),
13193
+ };
13159
13194
  if (rowObj) {
13160
- row = merge__default["default"]({
13161
- dataSet: JSON.parse(dataset),
13162
- filter: JSON.parse(filter),
13163
- metaData: JSON.parse(metadataObj),
13164
- }, rowObj);
13165
- row = {
13166
- dataSet: JSON.stringify(row.dataSet),
13167
- filter: JSON.stringify(row.filter),
13168
- metaData: JSON.stringify(row.metaData),
13169
- };
13195
+ row = merge__default["default"](row, rowObj);
13170
13196
  }
13171
- else {
13172
- row = {
13173
- dataSet: dataset,
13174
- filter,
13175
- metaData: metadataObj,
13176
- };
13197
+ if (beforeReportEvent) {
13198
+ row = yield beforeReportEvent(row);
13177
13199
  }
13200
+ row = {
13201
+ dataSet: JSON.stringify(row.dataSet),
13202
+ filter: JSON.stringify(row.filter),
13203
+ metaData: JSON.stringify(row.metaData),
13204
+ };
13178
13205
  const url = new URL(route, this.endPoint).href;
13179
13206
  const response = yield core.Http.post(url, {
13180
13207
  origin,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/common",
3
- "version": "1.60.0",
3
+ "version": "1.62.0",
4
4
  "description": "Zeedhi Common",
5
5
  "author": "Zeedhi <zeedhi@teknisa.com>",
6
6
  "license": "ISC",
@@ -39,5 +39,5 @@
39
39
  "lodash.times": "^4.3.2",
40
40
  "mockdate": "^3.0.2"
41
41
  },
42
- "gitHead": "70326c57b4ab9d895495ee1a05045060a09cc41a"
42
+ "gitHead": "ac9406efae2559cdcba913d4a1545906927b0b62"
43
43
  }
@@ -169,6 +169,7 @@ export declare class Grid extends Iterable implements IGrid {
169
169
  * @param element DOM Element
170
170
  */
171
171
  selectAllClick(isSelected: boolean, event: Event, element: any): void;
172
+ selectAll(isSelected: boolean): void;
172
173
  protected navigateUp(): void;
173
174
  protected navigateDown(): void;
174
175
  protected navigatePageUp(): void;
@@ -16,6 +16,7 @@ export interface ILogin extends IComponentRender {
16
16
  poweredByImage?: string;
17
17
  poweredByImageCard?: string;
18
18
  socialLogin?: IComponentRender[];
19
+ flatForm?: boolean;
19
20
  }
20
21
  export interface ILoginButton extends IButton {
21
22
  authUrl?: string;
@@ -42,6 +42,10 @@ export declare class Login extends ComponentRender implements ILogin {
42
42
  * Image displayed in the card.
43
43
  */
44
44
  poweredByImageCard: string;
45
+ /**
46
+ * If form is flat
47
+ */
48
+ flatForm: boolean;
45
49
  /**
46
50
  * Buttons displayed in the bottom of the card.
47
51
  */
@@ -57,6 +57,8 @@ export interface ITree extends IComponentRender {
57
57
  toolbarSlot?: IComponentRender[];
58
58
  titleSlot?: ITreeConditionComponent[];
59
59
  events?: ITreeEvents;
60
+ height?: string | number;
61
+ maxHeight?: string | number;
60
62
  datasource?: IDatasource;
61
63
  parentField?: string;
62
64
  titleField?: string;
@@ -25,6 +25,14 @@ export declare class Tree extends ComponentRender implements ITree {
25
25
  * Components that will be rendered on toolbar slot
26
26
  */
27
27
  toolbarSlot: IComponentRender[];
28
+ /**
29
+ * Tree fixed height
30
+ */
31
+ height: string | number;
32
+ /**
33
+ * Tree max height
34
+ */
35
+ maxHeight: string | number;
28
36
  /**
29
37
  * Components that will be rendered on title slot
30
38
  */
@@ -6,3 +6,10 @@ export interface IReport {
6
6
  fileEndPoint: string;
7
7
  getReport(type: string, portrait: boolean): Promise<string>;
8
8
  }
9
+ export interface IBeforeReportParam {
10
+ dataSet: any;
11
+ filter: any;
12
+ metaData: any;
13
+ [key: string]: any;
14
+ }
15
+ export declare type IBeforeReportEvent = (param: IBeforeReportParam) => Promise<IBeforeReportParam>;
@@ -1,6 +1,6 @@
1
1
  import { IDictionary } from '@zeedhi/core';
2
2
  import { Iterable } from '../../components';
3
- import { IReport } from './interfaces';
3
+ import { IBeforeReportEvent, IReport } from './interfaces';
4
4
  export declare class Report implements IReport {
5
5
  iterable: Iterable;
6
6
  title: string;
@@ -10,6 +10,6 @@ export declare class Report implements IReport {
10
10
  constructor(iterable: Iterable, title: string);
11
11
  private getData;
12
12
  private getReportType;
13
- getReport(type: string, portrait?: boolean, rowObj?: any): Promise<string>;
13
+ getReport(type: string, portrait?: boolean, rowObj?: any, beforeReportEvent?: IBeforeReportEvent): Promise<string>;
14
14
  private removeColumns;
15
15
  }