cavalion-vcl 1.1.43 → 1.1.44

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/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ### 2022/01/03 - 1.1.44
2
+
3
+ * Adding `context` parameter to Array:onFilterObject-event, which can be used as a cache for a specific filter context (updateFilter-call)
4
+ * Introducing List.prototype.**valueByColumnAndRow** - used to obtain the value that will be rendered (useful for inline filtering)
5
+
1
6
  ### 2021/12/29 - 1.1.43
2
7
 
3
8
  - Styling glassy-overlays with text-shadow
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cavalion-vcl",
3
- "version": "1.1.43",
3
+ "version": "1.1.44",
4
4
  "description": "Visual Component Library for vcl-comps",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/data/Array.js CHANGED
@@ -185,11 +185,11 @@ define(function(require) {
185
185
 
186
186
  updateFilter: function(notify) {
187
187
  if(this._onFilterObject !== null && this._array !== null) {
188
- var arr = [];
188
+ var arr = [], context = {};
189
189
  this._arr = this._array;
190
190
  for(var i = 0; i < this._array.length; ++i) {
191
191
  var obj = this._array[i];
192
- if(this.fire("onFilterObject", [obj, i, this]) !== true) {
192
+ if(this.fire("onFilterObject", [obj, i, context]) !== true) {
193
193
  arr.push(obj);
194
194
  }
195
195
  }
@@ -340,7 +340,7 @@ define(function(require) {
340
340
  "onFilterObject": {
341
341
  type: Type.FUNCTION,
342
342
  editorInfo: {
343
- defaultValue: "(function(object, index) {\n\t//return {true} to exclude item from exposed array\n})"
343
+ defaultValue: "(function(object, index, context) {\n\t//return {true} to exclude item from exposed array\n})"
344
344
  }
345
345
  },
346
346
  "onGetAttributeValue": {
package/src/ui/List.js CHANGED
@@ -580,6 +580,15 @@ define(function(require) {
580
580
  }
581
581
  return null;
582
582
  },
583
+ getColumnByName: function(name) {
584
+ for(var i = 0, l = this._columns.length; i < l; ++i) {
585
+ var c = this._columns[i];
586
+ if(c._custom === false && c._name === name) {
587
+ return c;
588
+ }
589
+ }
590
+ return null;
591
+ },
583
592
  insertColumn: function(column, index) {
584
593
  this._columns.push(column);
585
594
  column._list = this;
@@ -814,28 +823,32 @@ define(function(require) {
814
823
  oncolumndrop: function() {
815
824
  return this.fire("onColumnDropped", arguments);
816
825
  },
817
-
826
+
827
+ valueByColumnAndRow(column, row) {
828
+ var value, orgValue;
829
+ if(column._attribute !== "") {
830
+ orgValue = (value = this._source.getAttributeValue(column._attribute, row));
831
+ }
832
+ if(column._wantsNullValues || (value !== null && value !== undefined)) {
833
+ if(column._displayFormat !== "") {
834
+ value = String.format(column._displayFormat, value);
835
+ }
836
+ if(column._onGetValue !== null) {
837
+ value = column.fire("onGetValue", [value, row, this._source]);
838
+ }
839
+ if(this._onColumnGetValue !== null) {
840
+ value = this.fire("onColumnGetValue", [column, value, row, this._source]);
841
+ }
842
+ if(this._formatDates === true && this.isDate(value)) {
843
+ value = this.formatDate(value);
844
+ }
845
+ }
846
+ return value;
847
+ },
818
848
  groupByColumn(column) {
819
849
  var r = {};
820
850
  this._source.getObjects().forEach((obj, row) => {
821
- var value, orgValue;
822
- if(column._attribute !== "") {
823
- orgValue = (value = this._source.getAttributeValue(column._attribute, row));
824
- }
825
- if(column._wantsNullValues || (value !== null && value !== undefined)) {
826
- if(column._displayFormat !== "") {
827
- value = String.format(column._displayFormat, value);
828
- }
829
- if(column._onGetValue !== null) {
830
- value = column.fire("onGetValue", [value, row, this._source]);
831
- }
832
- if(this._onColumnGetValue !== null) {
833
- value = this.fire("onColumnGetValue", [column, value, row, this._source]);
834
- }
835
- if(this._formatDates === true && this.isDate(value)) {
836
- value = this.formatDate(value);
837
- }
838
- }
851
+ var value = this.getValueByColumnAndRow(column, row);
839
852
  (r[value] = r[value] || []).push(obj);
840
853
  });
841
854
  return r;