@revolist/revogrid 4.1.0-next.39 → 4.1.0-next.42
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/custom-element/index.js +50 -16
- package/dist/cjs/revo-grid_11.cjs.entry.js +50 -16
- package/dist/collection/components/header/revogr-header.d.ts +1 -0
- package/dist/collection/components/header/revogr-header.js +25 -0
- package/dist/collection/components/revoGrid/revo-grid.d.ts +2 -0
- package/dist/collection/components/revoGrid/revo-grid.js +22 -1
- package/dist/collection/components.d.ts +2 -0
- package/dist/collection/plugins/filter/conditions/string/contains.js +3 -0
- package/dist/collection/plugins/filter/filter.plugin.d.ts +3 -1
- package/dist/collection/plugins/filter/filter.plugin.js +35 -14
- package/dist/collection/services/dimension.provider.js +1 -1
- package/dist/esm/revo-grid_11.entry.js +51 -17
- package/dist/revo-grid/revo-grid_11.entry.js +1 -1
- package/dist/types/components/header/revogr-header.d.ts +1 -0
- package/dist/types/components/revoGrid/revo-grid.d.ts +2 -0
- package/dist/types/components.d.ts +2 -0
- package/dist/types/plugins/filter/filter.plugin.d.ts +3 -1
- package/package.json +1 -1
package/custom-element/index.js
CHANGED
|
@@ -22020,7 +22020,7 @@ class DimensionProvider {
|
|
|
22020
22020
|
return { y, x };
|
|
22021
22021
|
}
|
|
22022
22022
|
setColumns(type, sizes, noVirtual = false) {
|
|
22023
|
-
this.
|
|
22023
|
+
this.setDimensionSize(type, sizes);
|
|
22024
22024
|
if (noVirtual) {
|
|
22025
22025
|
this.setNoVirtual(type);
|
|
22026
22026
|
}
|
|
@@ -22707,6 +22707,9 @@ const beginsWith = (value, extra) => {
|
|
|
22707
22707
|
beginsWith.extra = 'input';
|
|
22708
22708
|
|
|
22709
22709
|
const contains = (value, extra) => {
|
|
22710
|
+
if (!extra) {
|
|
22711
|
+
return true;
|
|
22712
|
+
}
|
|
22710
22713
|
if (!value) {
|
|
22711
22714
|
return false;
|
|
22712
22715
|
}
|
|
@@ -22762,6 +22765,7 @@ const filterTypes = {
|
|
|
22762
22765
|
};
|
|
22763
22766
|
|
|
22764
22767
|
const FILTER_TRIMMED_TYPE = 'filter';
|
|
22768
|
+
const FILTER_CONFIG_CHANGED_EVENT = 'filterconfigchanged';
|
|
22765
22769
|
class FilterPlugin extends BasePlugin {
|
|
22766
22770
|
constructor(revogrid, uiid, config) {
|
|
22767
22771
|
super(revogrid);
|
|
@@ -22770,6 +22774,7 @@ class FilterPlugin extends BasePlugin {
|
|
|
22770
22774
|
this.possibleFilters = Object.assign({}, filterTypes);
|
|
22771
22775
|
this.possibleFilterNames = Object.assign({}, filterNames);
|
|
22772
22776
|
this.possibleFilterEntities = Object.assign({}, filterEntities);
|
|
22777
|
+
this.filterProp = FILTER_PROP;
|
|
22773
22778
|
if (config) {
|
|
22774
22779
|
this.initConfig(config);
|
|
22775
22780
|
}
|
|
@@ -22780,15 +22785,23 @@ class FilterPlugin extends BasePlugin {
|
|
|
22780
22785
|
}
|
|
22781
22786
|
};
|
|
22782
22787
|
this.addEventListener('headerclick', headerclick);
|
|
22788
|
+
this.addEventListener(FILTER_CONFIG_CHANGED_EVENT, ({ detail }) => {
|
|
22789
|
+
if (!detail) {
|
|
22790
|
+
this.clearFiltering();
|
|
22791
|
+
return;
|
|
22792
|
+
}
|
|
22793
|
+
if (typeof detail === 'object') {
|
|
22794
|
+
this.initConfig(detail);
|
|
22795
|
+
}
|
|
22796
|
+
aftersourceset();
|
|
22797
|
+
});
|
|
22783
22798
|
this.addEventListener('aftersourceset', aftersourceset);
|
|
22799
|
+
this.addEventListener('filter', ({ detail }) => this.onFilterChange(detail));
|
|
22784
22800
|
this.revogrid.registerVNode([
|
|
22785
22801
|
h("revogr-filter-panel", { uuid: `filter-${uiid}`, filterNames: this.possibleFilterNames, filterEntities: this.possibleFilterEntities, onFilterChange: e => this.onFilterChange(e.detail), ref: e => (this.pop = e) }),
|
|
22786
22802
|
]);
|
|
22787
22803
|
}
|
|
22788
22804
|
initConfig(config) {
|
|
22789
|
-
if (config.collection) {
|
|
22790
|
-
this.filterCollection = Object.assign({}, config.collection);
|
|
22791
|
-
}
|
|
22792
22805
|
if (config.customFilters) {
|
|
22793
22806
|
for (let cType in config.customFilters) {
|
|
22794
22807
|
const cFilter = config.customFilters[cType];
|
|
@@ -22800,6 +22813,9 @@ class FilterPlugin extends BasePlugin {
|
|
|
22800
22813
|
this.possibleFilterNames[cType] = cFilter.name;
|
|
22801
22814
|
}
|
|
22802
22815
|
}
|
|
22816
|
+
if (config.filterProp) {
|
|
22817
|
+
this.filterProp = config.filterProp;
|
|
22818
|
+
}
|
|
22803
22819
|
/**
|
|
22804
22820
|
* which filters has to be included/excluded
|
|
22805
22821
|
* convinient way to exclude system filters
|
|
@@ -22818,6 +22834,17 @@ class FilterPlugin extends BasePlugin {
|
|
|
22818
22834
|
this.possibleFilters = filters;
|
|
22819
22835
|
}
|
|
22820
22836
|
}
|
|
22837
|
+
if (config.collection) {
|
|
22838
|
+
this.filterCollection = lodash.reduce(config.collection, (result, item, prop) => {
|
|
22839
|
+
if (this.possibleFilterEntities[item.type]) {
|
|
22840
|
+
result[prop] = item;
|
|
22841
|
+
}
|
|
22842
|
+
else {
|
|
22843
|
+
console.warn(`${item.type} type is not found.`);
|
|
22844
|
+
}
|
|
22845
|
+
return result;
|
|
22846
|
+
}, {});
|
|
22847
|
+
}
|
|
22821
22848
|
}
|
|
22822
22849
|
async headerclick(e) {
|
|
22823
22850
|
var _a;
|
|
@@ -22881,9 +22908,7 @@ class FilterPlugin extends BasePlugin {
|
|
|
22881
22908
|
delete this.filterCollection[prop];
|
|
22882
22909
|
}
|
|
22883
22910
|
else {
|
|
22884
|
-
const filter = this.possibleFilterEntities[type];
|
|
22885
22911
|
this.filterCollection[prop] = {
|
|
22886
|
-
filter,
|
|
22887
22912
|
value,
|
|
22888
22913
|
type,
|
|
22889
22914
|
};
|
|
@@ -22900,13 +22925,13 @@ class FilterPlugin extends BasePlugin {
|
|
|
22900
22925
|
columns.forEach(rgCol => {
|
|
22901
22926
|
const column = Object.assign({}, rgCol);
|
|
22902
22927
|
const hasFilter = collection[column.prop];
|
|
22903
|
-
if (column[
|
|
22904
|
-
delete column[
|
|
22928
|
+
if (column[this.filterProp] && !hasFilter) {
|
|
22929
|
+
delete column[this.filterProp];
|
|
22905
22930
|
columnsToUpdate.push(column);
|
|
22906
22931
|
}
|
|
22907
|
-
if (!column[
|
|
22932
|
+
if (!column[this.filterProp] && hasFilter) {
|
|
22908
22933
|
columnsToUpdate.push(column);
|
|
22909
|
-
column[
|
|
22934
|
+
column[this.filterProp] = true;
|
|
22910
22935
|
}
|
|
22911
22936
|
});
|
|
22912
22937
|
const itemsToFilter = this.getRowFilter(items, collection);
|
|
@@ -22936,11 +22961,9 @@ class FilterPlugin extends BasePlugin {
|
|
|
22936
22961
|
this.doFiltering(detail.collection, detail.source, detail.columns);
|
|
22937
22962
|
}
|
|
22938
22963
|
async getData() {
|
|
22939
|
-
const source = await this.revogrid.getSource();
|
|
22940
|
-
const columns = await this.revogrid.getColumns();
|
|
22941
22964
|
return {
|
|
22942
|
-
source,
|
|
22943
|
-
columns,
|
|
22965
|
+
source: await this.revogrid.getSource(),
|
|
22966
|
+
columns: await this.revogrid.getColumns(),
|
|
22944
22967
|
};
|
|
22945
22968
|
}
|
|
22946
22969
|
getRowFilter(rows, collection) {
|
|
@@ -22948,7 +22971,7 @@ class FilterPlugin extends BasePlugin {
|
|
|
22948
22971
|
rows.forEach((model, rowIndex) => {
|
|
22949
22972
|
for (const prop in collection) {
|
|
22950
22973
|
const filterItem = collection[prop];
|
|
22951
|
-
const filter = filterItem.
|
|
22974
|
+
const filter = this.possibleFilterEntities[filterItem.type];
|
|
22952
22975
|
if (!filter(model[prop], filterItem.value)) {
|
|
22953
22976
|
trimmed[rowIndex] = true;
|
|
22954
22977
|
}
|
|
@@ -25098,6 +25121,7 @@ const RevoGridComponent = class extends HTMLElement {
|
|
|
25098
25121
|
this.beforeeditstart = createEvent(this, "beforeeditstart", 7);
|
|
25099
25122
|
this.aftercolumnresize = createEvent(this, "aftercolumnresize", 7);
|
|
25100
25123
|
this.beforerowdefinition = createEvent(this, "beforerowdefinition", 7);
|
|
25124
|
+
this.filterconfigchanged = createEvent(this, "filterconfigchanged", 7);
|
|
25101
25125
|
/**
|
|
25102
25126
|
* Defines how many rows/columns should be rendered outside visible area.
|
|
25103
25127
|
*/
|
|
@@ -25565,6 +25589,9 @@ const RevoGridComponent = class extends HTMLElement {
|
|
|
25565
25589
|
this.internalPlugins.splice(index, 1);
|
|
25566
25590
|
}
|
|
25567
25591
|
}
|
|
25592
|
+
applyFilter(cfg) {
|
|
25593
|
+
this.filterconfigchanged.emit(cfg);
|
|
25594
|
+
}
|
|
25568
25595
|
dataSourceApply(source = [], type = 'rgRow') {
|
|
25569
25596
|
const beforesourceset = this.beforeAnySource.emit({
|
|
25570
25597
|
type,
|
|
@@ -25682,7 +25709,8 @@ const RevoGridComponent = class extends HTMLElement {
|
|
|
25682
25709
|
"rowDefinitions": ["rowDefChanged"],
|
|
25683
25710
|
"trimmedRows": ["trimmedRowsChanged"],
|
|
25684
25711
|
"grouping": ["groupingChanged"],
|
|
25685
|
-
"stretch": ["applyStretch"]
|
|
25712
|
+
"stretch": ["applyStretch"],
|
|
25713
|
+
"filter": ["applyFilter"]
|
|
25686
25714
|
}; }
|
|
25687
25715
|
static get style() { return revoGridStyleCss; }
|
|
25688
25716
|
};
|
|
@@ -27229,11 +27257,17 @@ const RevogrHeaderComponent = class extends HTMLElement {
|
|
|
27229
27257
|
this.__registerHost();
|
|
27230
27258
|
this.initialHeaderClick = createEvent(this, "initialHeaderClick", 7);
|
|
27231
27259
|
this.headerresize = createEvent(this, "headerresize", 7);
|
|
27260
|
+
this.beforeResize = createEvent(this, "before-resize", 7);
|
|
27232
27261
|
this.headerdblClick = createEvent(this, "headerdblClick", 7);
|
|
27233
27262
|
this.parent = '';
|
|
27234
27263
|
this.groupingDepth = 0;
|
|
27235
27264
|
}
|
|
27236
27265
|
onResize({ width }, index) {
|
|
27266
|
+
const col = this.colData[index];
|
|
27267
|
+
const event = this.beforeResize.emit([Object.assign(Object.assign({}, col), { size: width || undefined })]);
|
|
27268
|
+
if (event.defaultPrevented) {
|
|
27269
|
+
return;
|
|
27270
|
+
}
|
|
27237
27271
|
this.headerresize.emit({ [index]: width || 0 });
|
|
27238
27272
|
}
|
|
27239
27273
|
onResizeGroup(changedX, startIndex, endIndex) {
|
|
@@ -22012,7 +22012,7 @@ class DimensionProvider {
|
|
|
22012
22012
|
return { y, x };
|
|
22013
22013
|
}
|
|
22014
22014
|
setColumns(type, sizes, noVirtual = false) {
|
|
22015
|
-
this.
|
|
22015
|
+
this.setDimensionSize(type, sizes);
|
|
22016
22016
|
if (noVirtual) {
|
|
22017
22017
|
this.setNoVirtual(type);
|
|
22018
22018
|
}
|
|
@@ -22679,6 +22679,9 @@ const beginsWith = (value, extra) => {
|
|
|
22679
22679
|
beginsWith.extra = 'input';
|
|
22680
22680
|
|
|
22681
22681
|
const contains = (value, extra) => {
|
|
22682
|
+
if (!extra) {
|
|
22683
|
+
return true;
|
|
22684
|
+
}
|
|
22682
22685
|
if (!value) {
|
|
22683
22686
|
return false;
|
|
22684
22687
|
}
|
|
@@ -22734,6 +22737,7 @@ const filterTypes = {
|
|
|
22734
22737
|
};
|
|
22735
22738
|
|
|
22736
22739
|
const FILTER_TRIMMED_TYPE = 'filter';
|
|
22740
|
+
const FILTER_CONFIG_CHANGED_EVENT = 'filterconfigchanged';
|
|
22737
22741
|
class FilterPlugin extends BasePlugin {
|
|
22738
22742
|
constructor(revogrid, uiid, config) {
|
|
22739
22743
|
super(revogrid);
|
|
@@ -22742,6 +22746,7 @@ class FilterPlugin extends BasePlugin {
|
|
|
22742
22746
|
this.possibleFilters = Object.assign({}, filterTypes);
|
|
22743
22747
|
this.possibleFilterNames = Object.assign({}, filterNames);
|
|
22744
22748
|
this.possibleFilterEntities = Object.assign({}, filterEntities);
|
|
22749
|
+
this.filterProp = filter_button.FILTER_PROP;
|
|
22745
22750
|
if (config) {
|
|
22746
22751
|
this.initConfig(config);
|
|
22747
22752
|
}
|
|
@@ -22752,15 +22757,23 @@ class FilterPlugin extends BasePlugin {
|
|
|
22752
22757
|
}
|
|
22753
22758
|
};
|
|
22754
22759
|
this.addEventListener('headerclick', headerclick);
|
|
22760
|
+
this.addEventListener(FILTER_CONFIG_CHANGED_EVENT, ({ detail }) => {
|
|
22761
|
+
if (!detail) {
|
|
22762
|
+
this.clearFiltering();
|
|
22763
|
+
return;
|
|
22764
|
+
}
|
|
22765
|
+
if (typeof detail === 'object') {
|
|
22766
|
+
this.initConfig(detail);
|
|
22767
|
+
}
|
|
22768
|
+
aftersourceset();
|
|
22769
|
+
});
|
|
22755
22770
|
this.addEventListener('aftersourceset', aftersourceset);
|
|
22771
|
+
this.addEventListener('filter', ({ detail }) => this.onFilterChange(detail));
|
|
22756
22772
|
this.revogrid.registerVNode([
|
|
22757
22773
|
index.h("revogr-filter-panel", { uuid: `filter-${uiid}`, filterNames: this.possibleFilterNames, filterEntities: this.possibleFilterEntities, onFilterChange: e => this.onFilterChange(e.detail), ref: e => (this.pop = e) }),
|
|
22758
22774
|
]);
|
|
22759
22775
|
}
|
|
22760
22776
|
initConfig(config) {
|
|
22761
|
-
if (config.collection) {
|
|
22762
|
-
this.filterCollection = Object.assign({}, config.collection);
|
|
22763
|
-
}
|
|
22764
22777
|
if (config.customFilters) {
|
|
22765
22778
|
for (let cType in config.customFilters) {
|
|
22766
22779
|
const cFilter = config.customFilters[cType];
|
|
@@ -22772,6 +22785,9 @@ class FilterPlugin extends BasePlugin {
|
|
|
22772
22785
|
this.possibleFilterNames[cType] = cFilter.name;
|
|
22773
22786
|
}
|
|
22774
22787
|
}
|
|
22788
|
+
if (config.filterProp) {
|
|
22789
|
+
this.filterProp = config.filterProp;
|
|
22790
|
+
}
|
|
22775
22791
|
/**
|
|
22776
22792
|
* which filters has to be included/excluded
|
|
22777
22793
|
* convinient way to exclude system filters
|
|
@@ -22790,6 +22806,17 @@ class FilterPlugin extends BasePlugin {
|
|
|
22790
22806
|
this.possibleFilters = filters;
|
|
22791
22807
|
}
|
|
22792
22808
|
}
|
|
22809
|
+
if (config.collection) {
|
|
22810
|
+
this.filterCollection = lodash.reduce(config.collection, (result, item, prop) => {
|
|
22811
|
+
if (this.possibleFilterEntities[item.type]) {
|
|
22812
|
+
result[prop] = item;
|
|
22813
|
+
}
|
|
22814
|
+
else {
|
|
22815
|
+
console.warn(`${item.type} type is not found.`);
|
|
22816
|
+
}
|
|
22817
|
+
return result;
|
|
22818
|
+
}, {});
|
|
22819
|
+
}
|
|
22793
22820
|
}
|
|
22794
22821
|
async headerclick(e) {
|
|
22795
22822
|
var _a;
|
|
@@ -22853,9 +22880,7 @@ class FilterPlugin extends BasePlugin {
|
|
|
22853
22880
|
delete this.filterCollection[prop];
|
|
22854
22881
|
}
|
|
22855
22882
|
else {
|
|
22856
|
-
const filter = this.possibleFilterEntities[type];
|
|
22857
22883
|
this.filterCollection[prop] = {
|
|
22858
|
-
filter,
|
|
22859
22884
|
value,
|
|
22860
22885
|
type,
|
|
22861
22886
|
};
|
|
@@ -22872,13 +22897,13 @@ class FilterPlugin extends BasePlugin {
|
|
|
22872
22897
|
columns.forEach(rgCol => {
|
|
22873
22898
|
const column = Object.assign({}, rgCol);
|
|
22874
22899
|
const hasFilter = collection[column.prop];
|
|
22875
|
-
if (column[
|
|
22876
|
-
delete column[
|
|
22900
|
+
if (column[this.filterProp] && !hasFilter) {
|
|
22901
|
+
delete column[this.filterProp];
|
|
22877
22902
|
columnsToUpdate.push(column);
|
|
22878
22903
|
}
|
|
22879
|
-
if (!column[
|
|
22904
|
+
if (!column[this.filterProp] && hasFilter) {
|
|
22880
22905
|
columnsToUpdate.push(column);
|
|
22881
|
-
column[
|
|
22906
|
+
column[this.filterProp] = true;
|
|
22882
22907
|
}
|
|
22883
22908
|
});
|
|
22884
22909
|
const itemsToFilter = this.getRowFilter(items, collection);
|
|
@@ -22908,11 +22933,9 @@ class FilterPlugin extends BasePlugin {
|
|
|
22908
22933
|
this.doFiltering(detail.collection, detail.source, detail.columns);
|
|
22909
22934
|
}
|
|
22910
22935
|
async getData() {
|
|
22911
|
-
const source = await this.revogrid.getSource();
|
|
22912
|
-
const columns = await this.revogrid.getColumns();
|
|
22913
22936
|
return {
|
|
22914
|
-
source,
|
|
22915
|
-
columns,
|
|
22937
|
+
source: await this.revogrid.getSource(),
|
|
22938
|
+
columns: await this.revogrid.getColumns(),
|
|
22916
22939
|
};
|
|
22917
22940
|
}
|
|
22918
22941
|
getRowFilter(rows, collection) {
|
|
@@ -22920,7 +22943,7 @@ class FilterPlugin extends BasePlugin {
|
|
|
22920
22943
|
rows.forEach((model, rowIndex) => {
|
|
22921
22944
|
for (const prop in collection) {
|
|
22922
22945
|
const filterItem = collection[prop];
|
|
22923
|
-
const filter = filterItem.
|
|
22946
|
+
const filter = this.possibleFilterEntities[filterItem.type];
|
|
22924
22947
|
if (!filter(model[prop], filterItem.value)) {
|
|
22925
22948
|
trimmed[rowIndex] = true;
|
|
22926
22949
|
}
|
|
@@ -25069,6 +25092,7 @@ const RevoGridComponent = class {
|
|
|
25069
25092
|
this.beforeeditstart = index.createEvent(this, "beforeeditstart", 7);
|
|
25070
25093
|
this.aftercolumnresize = index.createEvent(this, "aftercolumnresize", 7);
|
|
25071
25094
|
this.beforerowdefinition = index.createEvent(this, "beforerowdefinition", 7);
|
|
25095
|
+
this.filterconfigchanged = index.createEvent(this, "filterconfigchanged", 7);
|
|
25072
25096
|
/**
|
|
25073
25097
|
* Defines how many rows/columns should be rendered outside visible area.
|
|
25074
25098
|
*/
|
|
@@ -25536,6 +25560,9 @@ const RevoGridComponent = class {
|
|
|
25536
25560
|
this.internalPlugins.splice(index, 1);
|
|
25537
25561
|
}
|
|
25538
25562
|
}
|
|
25563
|
+
applyFilter(cfg) {
|
|
25564
|
+
this.filterconfigchanged.emit(cfg);
|
|
25565
|
+
}
|
|
25539
25566
|
dataSourceApply(source = [], type = 'rgRow') {
|
|
25540
25567
|
const beforesourceset = this.beforeAnySource.emit({
|
|
25541
25568
|
type,
|
|
@@ -25653,7 +25680,8 @@ const RevoGridComponent = class {
|
|
|
25653
25680
|
"rowDefinitions": ["rowDefChanged"],
|
|
25654
25681
|
"trimmedRows": ["trimmedRowsChanged"],
|
|
25655
25682
|
"grouping": ["groupingChanged"],
|
|
25656
|
-
"stretch": ["applyStretch"]
|
|
25683
|
+
"stretch": ["applyStretch"],
|
|
25684
|
+
"filter": ["applyFilter"]
|
|
25657
25685
|
}; }
|
|
25658
25686
|
};
|
|
25659
25687
|
RevoGridComponent.style = revoGridStyleCss;
|
|
@@ -27026,11 +27054,17 @@ const RevogrHeaderComponent = class {
|
|
|
27026
27054
|
index.registerInstance(this, hostRef);
|
|
27027
27055
|
this.initialHeaderClick = index.createEvent(this, "initialHeaderClick", 7);
|
|
27028
27056
|
this.headerresize = index.createEvent(this, "headerresize", 7);
|
|
27057
|
+
this.beforeResize = index.createEvent(this, "before-resize", 7);
|
|
27029
27058
|
this.headerdblClick = index.createEvent(this, "headerdblClick", 7);
|
|
27030
27059
|
this.parent = '';
|
|
27031
27060
|
this.groupingDepth = 0;
|
|
27032
27061
|
}
|
|
27033
27062
|
onResize({ width }, index) {
|
|
27063
|
+
const col = this.colData[index];
|
|
27064
|
+
const event = this.beforeResize.emit([Object.assign(Object.assign({}, col), { size: width || undefined })]);
|
|
27065
|
+
if (event.defaultPrevented) {
|
|
27066
|
+
return;
|
|
27067
|
+
}
|
|
27034
27068
|
this.headerresize.emit({ [index]: width || 0 });
|
|
27035
27069
|
}
|
|
27036
27070
|
onResizeGroup(changedX, startIndex, endIndex) {
|
|
@@ -16,6 +16,7 @@ export declare class RevogrHeaderComponent {
|
|
|
16
16
|
type: string;
|
|
17
17
|
initialHeaderClick: EventEmitter<RevoGrid.InitialHeaderClick>;
|
|
18
18
|
headerresize: EventEmitter<RevoGrid.ViewSettingSizeProp>;
|
|
19
|
+
beforeResize: EventEmitter<RevoGrid.ColumnRegular[]>;
|
|
19
20
|
headerdblClick: EventEmitter<RevoGrid.InitialHeaderClick>;
|
|
20
21
|
private onResize;
|
|
21
22
|
private onResizeGroup;
|
|
@@ -9,6 +9,11 @@ export class RevogrHeaderComponent {
|
|
|
9
9
|
this.groupingDepth = 0;
|
|
10
10
|
}
|
|
11
11
|
onResize({ width }, index) {
|
|
12
|
+
const col = this.colData[index];
|
|
13
|
+
const event = this.beforeResize.emit([Object.assign(Object.assign({}, col), { size: width || undefined })]);
|
|
14
|
+
if (event.defaultPrevented) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
12
17
|
this.headerresize.emit({ [index]: width || 0 });
|
|
13
18
|
}
|
|
14
19
|
onResizeGroup(changedX, startIndex, endIndex) {
|
|
@@ -298,6 +303,26 @@ export class RevogrHeaderComponent {
|
|
|
298
303
|
}
|
|
299
304
|
}
|
|
300
305
|
}
|
|
306
|
+
}, {
|
|
307
|
+
"method": "beforeResize",
|
|
308
|
+
"name": "before-resize",
|
|
309
|
+
"bubbles": true,
|
|
310
|
+
"cancelable": true,
|
|
311
|
+
"composed": true,
|
|
312
|
+
"docs": {
|
|
313
|
+
"tags": [],
|
|
314
|
+
"text": ""
|
|
315
|
+
},
|
|
316
|
+
"complexType": {
|
|
317
|
+
"original": "RevoGrid.ColumnRegular[]",
|
|
318
|
+
"resolved": "ColumnRegular[]",
|
|
319
|
+
"references": {
|
|
320
|
+
"RevoGrid": {
|
|
321
|
+
"location": "import",
|
|
322
|
+
"path": "../../interfaces"
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
301
326
|
}, {
|
|
302
327
|
"method": "headerdblClick",
|
|
303
328
|
"name": "headerdblClick",
|
|
@@ -294,6 +294,7 @@ export declare class RevoGridComponent {
|
|
|
294
294
|
vals: any;
|
|
295
295
|
oldVals: any;
|
|
296
296
|
}>;
|
|
297
|
+
filterconfigchanged: EventEmitter;
|
|
297
298
|
/**
|
|
298
299
|
* Refreshes data viewport.
|
|
299
300
|
* Can be specific part as rgRow or pinned rgRow or 'all' by default.
|
|
@@ -423,6 +424,7 @@ export declare class RevoGridComponent {
|
|
|
423
424
|
* Stretch Plugin Apply
|
|
424
425
|
*/
|
|
425
426
|
applyStretch(isStretch: boolean | string): void;
|
|
427
|
+
applyFilter(cfg: boolean | ColumnFilterConfig): void;
|
|
426
428
|
private dataSourceApply;
|
|
427
429
|
connectedCallback(): void;
|
|
428
430
|
disconnectedCallback(): void;
|
|
@@ -490,6 +490,9 @@ export class RevoGridComponent {
|
|
|
490
490
|
this.internalPlugins.splice(index, 1);
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
|
+
applyFilter(cfg) {
|
|
494
|
+
this.filterconfigchanged.emit(cfg);
|
|
495
|
+
}
|
|
493
496
|
dataSourceApply(source = [], type = 'rgRow') {
|
|
494
497
|
const beforesourceset = this.beforeAnySource.emit({
|
|
495
498
|
type,
|
|
@@ -1009,7 +1012,7 @@ export class RevoGridComponent {
|
|
|
1009
1012
|
"mutable": false,
|
|
1010
1013
|
"complexType": {
|
|
1011
1014
|
"original": "boolean | ColumnFilterConfig",
|
|
1012
|
-
"resolved": "boolean | { collection?: FilterCollection; include?: string[]; customFilters?: Record<string, CustomFilter>; }",
|
|
1015
|
+
"resolved": "boolean | { collection?: FilterCollection; include?: string[]; customFilters?: Record<string, CustomFilter>; filterProp?: string; }",
|
|
1013
1016
|
"references": {
|
|
1014
1017
|
"ColumnFilterConfig": {
|
|
1015
1018
|
"location": "import",
|
|
@@ -1679,6 +1682,21 @@ export class RevoGridComponent {
|
|
|
1679
1682
|
"resolved": "{ vals: any; oldVals: any; }",
|
|
1680
1683
|
"references": {}
|
|
1681
1684
|
}
|
|
1685
|
+
}, {
|
|
1686
|
+
"method": "filterconfigchanged",
|
|
1687
|
+
"name": "filterconfigchanged",
|
|
1688
|
+
"bubbles": true,
|
|
1689
|
+
"cancelable": true,
|
|
1690
|
+
"composed": true,
|
|
1691
|
+
"docs": {
|
|
1692
|
+
"tags": [],
|
|
1693
|
+
"text": ""
|
|
1694
|
+
},
|
|
1695
|
+
"complexType": {
|
|
1696
|
+
"original": "any",
|
|
1697
|
+
"resolved": "any",
|
|
1698
|
+
"references": {}
|
|
1699
|
+
}
|
|
1682
1700
|
}]; }
|
|
1683
1701
|
static get methods() { return {
|
|
1684
1702
|
"refresh": {
|
|
@@ -2242,6 +2260,9 @@ export class RevoGridComponent {
|
|
|
2242
2260
|
}, {
|
|
2243
2261
|
"propName": "stretch",
|
|
2244
2262
|
"methodName": "applyStretch"
|
|
2263
|
+
}, {
|
|
2264
|
+
"propName": "filter",
|
|
2265
|
+
"methodName": "applyFilter"
|
|
2245
2266
|
}]; }
|
|
2246
2267
|
static get listeners() { return [{
|
|
2247
2268
|
"name": "internalRowDragStart",
|
|
@@ -599,6 +599,7 @@ declare namespace LocalJSX {
|
|
|
599
599
|
* contentsizechanged event. Triggered when new content size applied. Not including header size Event is not returning size To get actual size use getContentSize after event triggered
|
|
600
600
|
*/
|
|
601
601
|
"onContentsizechanged"?: (event: CustomEvent<RevoGrid.MultiDimensionType>) => void;
|
|
602
|
+
"onFilterconfigchanged"?: (event: CustomEvent<any>) => void;
|
|
602
603
|
/**
|
|
603
604
|
* On header click.
|
|
604
605
|
*/
|
|
@@ -733,6 +734,7 @@ declare namespace LocalJSX {
|
|
|
733
734
|
"dimensionCol"?: Observable<RevoGrid.DimensionSettingsState>;
|
|
734
735
|
"groupingDepth"?: number;
|
|
735
736
|
"groups"?: Groups;
|
|
737
|
+
"onBefore-resize"?: (event: CustomEvent<RevoGrid.ColumnRegular[]>) => void;
|
|
736
738
|
"onHeaderdblClick"?: (event: CustomEvent<RevoGrid.InitialHeaderClick>) => void;
|
|
737
739
|
"onHeaderresize"?: (event: CustomEvent<RevoGrid.ViewSettingSizeProp>) => void;
|
|
738
740
|
"onInitialHeaderClick"?: (event: CustomEvent<RevoGrid.InitialHeaderClick>) => void;
|
|
@@ -20,14 +20,15 @@ export declare type ColumnFilterConfig = {
|
|
|
20
20
|
collection?: FilterCollection;
|
|
21
21
|
include?: string[];
|
|
22
22
|
customFilters?: Record<string, CustomFilter>;
|
|
23
|
+
filterProp?: string;
|
|
23
24
|
};
|
|
24
25
|
declare type FilterCollectionItem = {
|
|
25
|
-
filter: LogicFunction;
|
|
26
26
|
type: FilterType;
|
|
27
27
|
value?: any;
|
|
28
28
|
};
|
|
29
29
|
export declare type FilterCollection = Record<RevoGrid.ColumnProp, FilterCollectionItem>;
|
|
30
30
|
export declare const FILTER_TRIMMED_TYPE = "filter";
|
|
31
|
+
export declare const FILTER_CONFIG_CHANGED_EVENT = "filterconfigchanged";
|
|
31
32
|
export default class FilterPlugin extends BasePlugin {
|
|
32
33
|
protected revogrid: HTMLRevoGridElement;
|
|
33
34
|
private pop;
|
|
@@ -35,6 +36,7 @@ export default class FilterPlugin extends BasePlugin {
|
|
|
35
36
|
private possibleFilters;
|
|
36
37
|
private possibleFilterNames;
|
|
37
38
|
private possibleFilterEntities;
|
|
39
|
+
private filterProp;
|
|
38
40
|
constructor(revogrid: HTMLRevoGridElement, uiid: string, config?: ColumnFilterConfig);
|
|
39
41
|
private initConfig;
|
|
40
42
|
private headerclick;
|
|
@@ -2,7 +2,9 @@ import { h } from '@stencil/core';
|
|
|
2
2
|
import BasePlugin from '../basePlugin';
|
|
3
3
|
import { FILTER_PROP, isFilterBtn } from './filter.button';
|
|
4
4
|
import { filterEntities, filterNames, filterTypes } from './filter.service';
|
|
5
|
+
import { reduce } from 'lodash';
|
|
5
6
|
export const FILTER_TRIMMED_TYPE = 'filter';
|
|
7
|
+
export const FILTER_CONFIG_CHANGED_EVENT = 'filterconfigchanged';
|
|
6
8
|
export default class FilterPlugin extends BasePlugin {
|
|
7
9
|
constructor(revogrid, uiid, config) {
|
|
8
10
|
super(revogrid);
|
|
@@ -11,6 +13,7 @@ export default class FilterPlugin extends BasePlugin {
|
|
|
11
13
|
this.possibleFilters = Object.assign({}, filterTypes);
|
|
12
14
|
this.possibleFilterNames = Object.assign({}, filterNames);
|
|
13
15
|
this.possibleFilterEntities = Object.assign({}, filterEntities);
|
|
16
|
+
this.filterProp = FILTER_PROP;
|
|
14
17
|
if (config) {
|
|
15
18
|
this.initConfig(config);
|
|
16
19
|
}
|
|
@@ -21,15 +24,23 @@ export default class FilterPlugin extends BasePlugin {
|
|
|
21
24
|
}
|
|
22
25
|
};
|
|
23
26
|
this.addEventListener('headerclick', headerclick);
|
|
27
|
+
this.addEventListener(FILTER_CONFIG_CHANGED_EVENT, ({ detail }) => {
|
|
28
|
+
if (!detail) {
|
|
29
|
+
this.clearFiltering();
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (typeof detail === 'object') {
|
|
33
|
+
this.initConfig(detail);
|
|
34
|
+
}
|
|
35
|
+
aftersourceset();
|
|
36
|
+
});
|
|
24
37
|
this.addEventListener('aftersourceset', aftersourceset);
|
|
38
|
+
this.addEventListener('filter', ({ detail }) => this.onFilterChange(detail));
|
|
25
39
|
this.revogrid.registerVNode([
|
|
26
40
|
h("revogr-filter-panel", { uuid: `filter-${uiid}`, filterNames: this.possibleFilterNames, filterEntities: this.possibleFilterEntities, onFilterChange: e => this.onFilterChange(e.detail), ref: e => (this.pop = e) }),
|
|
27
41
|
]);
|
|
28
42
|
}
|
|
29
43
|
initConfig(config) {
|
|
30
|
-
if (config.collection) {
|
|
31
|
-
this.filterCollection = Object.assign({}, config.collection);
|
|
32
|
-
}
|
|
33
44
|
if (config.customFilters) {
|
|
34
45
|
for (let cType in config.customFilters) {
|
|
35
46
|
const cFilter = config.customFilters[cType];
|
|
@@ -41,6 +52,9 @@ export default class FilterPlugin extends BasePlugin {
|
|
|
41
52
|
this.possibleFilterNames[cType] = cFilter.name;
|
|
42
53
|
}
|
|
43
54
|
}
|
|
55
|
+
if (config.filterProp) {
|
|
56
|
+
this.filterProp = config.filterProp;
|
|
57
|
+
}
|
|
44
58
|
/**
|
|
45
59
|
* which filters has to be included/excluded
|
|
46
60
|
* convinient way to exclude system filters
|
|
@@ -59,6 +73,17 @@ export default class FilterPlugin extends BasePlugin {
|
|
|
59
73
|
this.possibleFilters = filters;
|
|
60
74
|
}
|
|
61
75
|
}
|
|
76
|
+
if (config.collection) {
|
|
77
|
+
this.filterCollection = reduce(config.collection, (result, item, prop) => {
|
|
78
|
+
if (this.possibleFilterEntities[item.type]) {
|
|
79
|
+
result[prop] = item;
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
console.warn(`${item.type} type is not found.`);
|
|
83
|
+
}
|
|
84
|
+
return result;
|
|
85
|
+
}, {});
|
|
86
|
+
}
|
|
62
87
|
}
|
|
63
88
|
async headerclick(e) {
|
|
64
89
|
var _a;
|
|
@@ -122,9 +147,7 @@ export default class FilterPlugin extends BasePlugin {
|
|
|
122
147
|
delete this.filterCollection[prop];
|
|
123
148
|
}
|
|
124
149
|
else {
|
|
125
|
-
const filter = this.possibleFilterEntities[type];
|
|
126
150
|
this.filterCollection[prop] = {
|
|
127
|
-
filter,
|
|
128
151
|
value,
|
|
129
152
|
type,
|
|
130
153
|
};
|
|
@@ -141,13 +164,13 @@ export default class FilterPlugin extends BasePlugin {
|
|
|
141
164
|
columns.forEach(rgCol => {
|
|
142
165
|
const column = Object.assign({}, rgCol);
|
|
143
166
|
const hasFilter = collection[column.prop];
|
|
144
|
-
if (column[
|
|
145
|
-
delete column[
|
|
167
|
+
if (column[this.filterProp] && !hasFilter) {
|
|
168
|
+
delete column[this.filterProp];
|
|
146
169
|
columnsToUpdate.push(column);
|
|
147
170
|
}
|
|
148
|
-
if (!column[
|
|
171
|
+
if (!column[this.filterProp] && hasFilter) {
|
|
149
172
|
columnsToUpdate.push(column);
|
|
150
|
-
column[
|
|
173
|
+
column[this.filterProp] = true;
|
|
151
174
|
}
|
|
152
175
|
});
|
|
153
176
|
const itemsToFilter = this.getRowFilter(items, collection);
|
|
@@ -177,11 +200,9 @@ export default class FilterPlugin extends BasePlugin {
|
|
|
177
200
|
this.doFiltering(detail.collection, detail.source, detail.columns);
|
|
178
201
|
}
|
|
179
202
|
async getData() {
|
|
180
|
-
const source = await this.revogrid.getSource();
|
|
181
|
-
const columns = await this.revogrid.getColumns();
|
|
182
203
|
return {
|
|
183
|
-
source,
|
|
184
|
-
columns,
|
|
204
|
+
source: await this.revogrid.getSource(),
|
|
205
|
+
columns: await this.revogrid.getColumns(),
|
|
185
206
|
};
|
|
186
207
|
}
|
|
187
208
|
getRowFilter(rows, collection) {
|
|
@@ -189,7 +210,7 @@ export default class FilterPlugin extends BasePlugin {
|
|
|
189
210
|
rows.forEach((model, rowIndex) => {
|
|
190
211
|
for (const prop in collection) {
|
|
191
212
|
const filterItem = collection[prop];
|
|
192
|
-
const filter = filterItem.
|
|
213
|
+
const filter = this.possibleFilterEntities[filterItem.type];
|
|
193
214
|
if (!filter(model[prop], filterItem.value)) {
|
|
194
215
|
trimmed[rowIndex] = true;
|
|
195
216
|
}
|