@zeedhi/teknisa-components-common 1.96.2 → 1.97.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.
@@ -2222,6 +2222,7 @@ class TekGrid extends GridEditable {
2222
2222
  this.toolbarSlotProps = false;
2223
2223
  this.editNewRowsOnly = false;
2224
2224
  this.showCheckboxAllFilter = Config.gridShowCheckboxAllFilter || false;
2225
+ this.defaultFilter = {};
2225
2226
  this.defaultLazy = false;
2226
2227
  this.groups = [];
2227
2228
  this.summary = {};
@@ -2253,6 +2254,7 @@ class TekGrid extends GridEditable {
2253
2254
  this.groupsOpened = this.getInitValue('groupsOpened', props.groupsOpened, this.groupsOpened);
2254
2255
  this.showSummaryTotal = this.getInitValue('showSummaryTotal', props.showSummaryTotal, this.showSummaryTotal);
2255
2256
  this.showCheckboxAllFilter = this.getInitValue('showCheckboxAllFilter', props.showCheckboxAllFilter, this.showCheckboxAllFilter);
2257
+ this.defaultFilter = this.getInitValue('defaultFilter', props.defaultFilter, this.defaultFilter);
2256
2258
  this.editNewRowsOnly = this.getInitValue('editNewRowsOnly', props.editNewRowsOnly, this.editNewRowsOnly);
2257
2259
  this.mainGrid = this.getInitValue('mainGrid', props.mainGrid, this.mainGrid);
2258
2260
  this.actions = props.actions || this.actions;
@@ -2342,7 +2344,7 @@ class TekGrid extends GridEditable {
2342
2344
  const dynamicFilter = this.datasource.dynamicFilter[column.name];
2343
2345
  return dynamicFilter && dynamicFilter.length > 0;
2344
2346
  }
2345
- return this.datasource.filter[column.name];
2347
+ return this.datasource.filter[column.name] && this.datasource.filter[column.name].length > 0;
2346
2348
  }
2347
2349
  buildReportGroups() {
2348
2350
  return this.columns
@@ -2956,9 +2958,10 @@ class TekGridFilterButton extends Button {
2956
2958
  const { datasource } = this.grid;
2957
2959
  if (datasource instanceof TekRestDatasource || datasource instanceof TekMemoryDatasource) {
2958
2960
  const { dynamicFilter } = datasource;
2959
- Object.keys(dynamicFilter).forEach((column) => {
2960
- if (dynamicFilter[column] && dynamicFilter[column].length > 0) {
2961
- dynamicFilter[column].forEach((filterItem, index) => {
2961
+ const newDynamicFilter = Object.assign(Object.assign({}, this.grid.defaultFilter), dynamicFilter);
2962
+ Object.keys(newDynamicFilter).forEach((column) => {
2963
+ if (newDynamicFilter[column] && newDynamicFilter[column].length > 0) {
2964
+ newDynamicFilter[column].forEach((filterItem, index) => {
2962
2965
  const relation = filterItem.relation || 'AND';
2963
2966
  const operation = filterItem.operation || 'CONTAINS';
2964
2967
  const compName = `${this.grid.name}-filter-${relation}-${operation}-${column}-${index}`;
@@ -2989,11 +2992,12 @@ class TekGridFilterButton extends Button {
2989
2992
  }
2990
2993
  else {
2991
2994
  const { filter } = datasource;
2992
- Object.keys(filter).forEach((item) => {
2993
- if (filter[item]) {
2995
+ const newFilter = Object.assign(Object.assign({}, this.grid.defaultFilter), filter);
2996
+ Object.keys(newFilter).forEach((item) => {
2997
+ if (newFilter[item]) {
2994
2998
  const compName = `${this.grid.name}-filter-AND-CONTAINS-${item}-0`;
2995
2999
  changedCompNames.push(compName);
2996
- component.value[compName] = filter[item];
3000
+ component.value[compName] = newFilter[item];
2997
3001
  }
2998
3002
  });
2999
3003
  }
@@ -3585,6 +3589,7 @@ class TekTreeGrid extends TreeGridEditable {
3585
3589
  ];
3586
3590
  this.toolbarSlotProps = false;
3587
3591
  this.showCheckboxAllFilter = false;
3592
+ this.defaultFilter = {};
3588
3593
  this.title = this.getInitValue('title', props.title, this.title);
3589
3594
  this.addButton = this.getInitValue('addButton', props.addButton, this.addButton);
3590
3595
  this.deleteButton = this.getInitValue('deleteButton', props.deleteButton, this.deleteButton);
@@ -3601,6 +3606,7 @@ class TekTreeGrid extends TreeGridEditable {
3601
3606
  this.showReload = this.getInitValue('showReload', props.showReload, this.showReload);
3602
3607
  this.exportConfig = this.getInitValue('exportConfig', props.exportConfig, this.exportConfig);
3603
3608
  this.showCheckboxAllFilter = this.getInitValue('showCheckboxAllFilter', props.showCheckboxAllFilter, this.showCheckboxAllFilter);
3609
+ this.defaultFilter = this.getInitValue('defaultFilter', props.defaultFilter, this.defaultFilter);
3604
3610
  this.exportActions = props.exportActions || this.exportActions;
3605
3611
  this.actions = props.actions || this.actions;
3606
3612
  this.toolbarSlotProps = props.toolbarSlot !== undefined;
@@ -2226,6 +2226,7 @@
2226
2226
  this.toolbarSlotProps = false;
2227
2227
  this.editNewRowsOnly = false;
2228
2228
  this.showCheckboxAllFilter = core.Config.gridShowCheckboxAllFilter || false;
2229
+ this.defaultFilter = {};
2229
2230
  this.defaultLazy = false;
2230
2231
  this.groups = [];
2231
2232
  this.summary = {};
@@ -2257,6 +2258,7 @@
2257
2258
  this.groupsOpened = this.getInitValue('groupsOpened', props.groupsOpened, this.groupsOpened);
2258
2259
  this.showSummaryTotal = this.getInitValue('showSummaryTotal', props.showSummaryTotal, this.showSummaryTotal);
2259
2260
  this.showCheckboxAllFilter = this.getInitValue('showCheckboxAllFilter', props.showCheckboxAllFilter, this.showCheckboxAllFilter);
2261
+ this.defaultFilter = this.getInitValue('defaultFilter', props.defaultFilter, this.defaultFilter);
2260
2262
  this.editNewRowsOnly = this.getInitValue('editNewRowsOnly', props.editNewRowsOnly, this.editNewRowsOnly);
2261
2263
  this.mainGrid = this.getInitValue('mainGrid', props.mainGrid, this.mainGrid);
2262
2264
  this.actions = props.actions || this.actions;
@@ -2346,7 +2348,7 @@
2346
2348
  const dynamicFilter = this.datasource.dynamicFilter[column.name];
2347
2349
  return dynamicFilter && dynamicFilter.length > 0;
2348
2350
  }
2349
- return this.datasource.filter[column.name];
2351
+ return this.datasource.filter[column.name] && this.datasource.filter[column.name].length > 0;
2350
2352
  }
2351
2353
  buildReportGroups() {
2352
2354
  return this.columns
@@ -2960,9 +2962,10 @@
2960
2962
  const { datasource } = this.grid;
2961
2963
  if (datasource instanceof TekRestDatasource || datasource instanceof TekMemoryDatasource) {
2962
2964
  const { dynamicFilter } = datasource;
2963
- Object.keys(dynamicFilter).forEach((column) => {
2964
- if (dynamicFilter[column] && dynamicFilter[column].length > 0) {
2965
- dynamicFilter[column].forEach((filterItem, index) => {
2965
+ const newDynamicFilter = Object.assign(Object.assign({}, this.grid.defaultFilter), dynamicFilter);
2966
+ Object.keys(newDynamicFilter).forEach((column) => {
2967
+ if (newDynamicFilter[column] && newDynamicFilter[column].length > 0) {
2968
+ newDynamicFilter[column].forEach((filterItem, index) => {
2966
2969
  const relation = filterItem.relation || 'AND';
2967
2970
  const operation = filterItem.operation || 'CONTAINS';
2968
2971
  const compName = `${this.grid.name}-filter-${relation}-${operation}-${column}-${index}`;
@@ -2993,11 +2996,12 @@
2993
2996
  }
2994
2997
  else {
2995
2998
  const { filter } = datasource;
2996
- Object.keys(filter).forEach((item) => {
2997
- if (filter[item]) {
2999
+ const newFilter = Object.assign(Object.assign({}, this.grid.defaultFilter), filter);
3000
+ Object.keys(newFilter).forEach((item) => {
3001
+ if (newFilter[item]) {
2998
3002
  const compName = `${this.grid.name}-filter-AND-CONTAINS-${item}-0`;
2999
3003
  changedCompNames.push(compName);
3000
- component.value[compName] = filter[item];
3004
+ component.value[compName] = newFilter[item];
3001
3005
  }
3002
3006
  });
3003
3007
  }
@@ -3589,6 +3593,7 @@
3589
3593
  ];
3590
3594
  this.toolbarSlotProps = false;
3591
3595
  this.showCheckboxAllFilter = false;
3596
+ this.defaultFilter = {};
3592
3597
  this.title = this.getInitValue('title', props.title, this.title);
3593
3598
  this.addButton = this.getInitValue('addButton', props.addButton, this.addButton);
3594
3599
  this.deleteButton = this.getInitValue('deleteButton', props.deleteButton, this.deleteButton);
@@ -3605,6 +3610,7 @@
3605
3610
  this.showReload = this.getInitValue('showReload', props.showReload, this.showReload);
3606
3611
  this.exportConfig = this.getInitValue('exportConfig', props.exportConfig, this.exportConfig);
3607
3612
  this.showCheckboxAllFilter = this.getInitValue('showCheckboxAllFilter', props.showCheckboxAllFilter, this.showCheckboxAllFilter);
3613
+ this.defaultFilter = this.getInitValue('defaultFilter', props.defaultFilter, this.defaultFilter);
3608
3614
  this.exportActions = props.exportActions || this.exportActions;
3609
3615
  this.actions = props.actions || this.actions;
3610
3616
  this.toolbarSlotProps = props.toolbarSlot !== undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/teknisa-components-common",
3
- "version": "1.96.2",
3
+ "version": "1.97.0",
4
4
  "description": "Teknisa Components Common",
5
5
  "author": "Zeedhi <zeedhi@teknisa.com>",
6
6
  "license": "ISC",
@@ -18,8 +18,8 @@
18
18
  "watch": "npm run build -- -w"
19
19
  },
20
20
  "dependencies": {
21
- "@zeedhi/zd-drag-grid-common": "*",
22
- "@zeedhi/zd-user-info-common": "*",
21
+ "@zeedhi/zd-drag-grid-common": "<=1.0.6",
22
+ "@zeedhi/zd-user-info-common": "^1.3.2",
23
23
  "lodash.debounce": "4.0.*",
24
24
  "lodash.get": "4.4.*",
25
25
  "lodash.merge": "4.6.*"
@@ -30,7 +30,7 @@
30
30
  "@types/lodash.merge": "4.6.*"
31
31
  },
32
32
  "peerDependencies": {
33
- "@zeedhi/core": "*"
33
+ "@zeedhi/core": "~1.97.0"
34
34
  },
35
- "gitHead": "23195c214009cb263eb404224929e8acfd63ed3c"
35
+ "gitHead": "97190b2ae31761e5474dae76eca0d3874144b4f5"
36
36
  }
@@ -73,6 +73,7 @@ export declare class TekGrid extends GridEditable implements ITekGrid {
73
73
  editNewRowsOnly: boolean;
74
74
  protected keyShortcutKeyMapping: any;
75
75
  showCheckboxAllFilter: boolean;
76
+ defaultFilter: IDictionary;
76
77
  /**
77
78
  * TekGrid class constructor
78
79
  * @param props TekGrid properties
@@ -89,7 +90,7 @@ export declare class TekGrid extends GridEditable implements ITekGrid {
89
90
  * @param columns Grid columns parameter
90
91
  */
91
92
  protected getColumns(columns: ITekGridColumn[]): TekGridColumn[];
92
- columnHasFilterData(column: TekGridColumn): any;
93
+ columnHasFilterData(column: TekGridColumn): boolean;
93
94
  private buildReportGroups;
94
95
  private buildReportAggregations;
95
96
  getReport(type: string, portrait?: boolean, rowObj?: any): Promise<Window | null>;
@@ -60,6 +60,7 @@ export interface ITekGrid extends IGridEditable {
60
60
  layoutOptions?: TekGridLayoutOptions;
61
61
  mainGrid?: boolean;
62
62
  showCheckboxAllFilter?: boolean;
63
+ defaultFilter?: IDictionary;
63
64
  }
64
65
  export declare type MultiOptionParams = {
65
66
  iconName: string;
@@ -1,4 +1,5 @@
1
1
  import { IComponentRender, ITreeGridEditable } from '@zeedhi/common';
2
+ import { IDictionary } from '@zeedhi/core';
2
3
  import { ITekGridColumn, ITekGridEvents, ITekGridExportConfig, TekGridLayoutOptions, IModalFilterProps } from '..';
3
4
  export interface ITekTreeGrid extends ITreeGridEditable {
4
5
  actions?: IComponentRender[];
@@ -22,4 +23,5 @@ export interface ITekTreeGrid extends ITreeGridEditable {
22
23
  exportActions?: IComponentRender[];
23
24
  layoutOptions?: TekGridLayoutOptions;
24
25
  showCheckboxAllFilter?: boolean;
26
+ defaultFilter?: IDictionary;
25
27
  }
@@ -63,6 +63,7 @@ export declare class TekTreeGrid extends TreeGridEditable implements ITekTreeGri
63
63
  filterRelationsDatasource: Datasource;
64
64
  filterOperationsDatasource: Datasource;
65
65
  showCheckboxAllFilter: boolean;
66
+ defaultFilter: IDictionary;
66
67
  /**
67
68
  * TekTreeGrid class constructor
68
69
  * @param props TekTreeGrid properties