pict-section-recordset 1.9.2 → 1.9.3

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": "pict-section-recordset",
3
- "version": "1.9.2",
3
+ "version": "1.9.3",
4
4
  "description": "Pict dynamic record set management views",
5
5
  "main": "source/Pict-Section-RecordSet.js",
6
6
  "files": [
@@ -979,62 +979,87 @@ class MeadowEndpointsRecordSetProvider extends libRecordSetProviderBase
979
979
  for (const tmpFilterKey of Object.keys(this.pict.providers.FilterManager.filters))
980
980
  {
981
981
  const tmpFilterClause = this.pict.providers.FilterManager.filters[tmpFilterKey];
982
- if (tmpFilterClause.CoreConnectionColumn === this.getIDField())
982
+ // Two recognised host-declared filter shapes:
983
+ // (1) Foreign-key join — `CoreConnectionColumn` equals this recordset's
984
+ // PK (e.g. a Sample filter whose data flow joins on IDSample). Folded
985
+ // into `_FilterSchema[FilterKey]` for back-compat with the existing
986
+ // behaviour.
987
+ // (2) Plain column filter — declares `FilterByColumn` and wants to surface
988
+ // as the column's filter entry. Folded into
989
+ // `_FilterSchema[FilterByColumn]` so the Add Filter popover / Quick
990
+ // Filter resolver find it under the same slot the schema-derived
991
+ // entries use.
992
+ // Optional per-recordset scoping: when the filter clause declares a
993
+ // `RecordSet`, only fold into providers whose `options.RecordSet` matches.
994
+ // Lets a host register the same `FilterByColumn` under different definitions
995
+ // per dashboard without cross-pollination.
996
+ if (tmpFilterClause.RecordSet && tmpFilterClause.RecordSet !== this.options.RecordSet)
983
997
  {
984
- //FIXME: I don't think using filter key is right here
985
- let tmpFieldFilterSchema = this._FilterSchema[tmpFilterKey];
986
- if (!tmpFieldFilterSchema)
987
- {
988
- this._FilterSchema[tmpFilterKey] = tmpFieldFilterSchema = { };
989
- }
990
- if (!tmpFieldFilterSchema.FilterKey)
991
- {
992
- tmpFieldFilterSchema.FilterKey = tmpFilterKey;
993
- }
994
- if (!tmpFieldFilterSchema.RecordSet)
995
- {
996
- tmpFieldFilterSchema.RecordSet = this.options.RecordSet;
997
- }
998
- const tmpFieldHumanName = this.getHumanReadableFieldName(tmpFilterKey);
999
- if (tmpFilterClause.DisplayName)
1000
- {
1001
- tmpFieldFilterSchema.DisplayName = tmpFilterClause.DisplayName;
1002
- }
1003
- if (!tmpFieldFilterSchema.DisplayName)
1004
- {
1005
- tmpFieldFilterSchema.DisplayName = tmpFieldHumanName;
1006
- }
1007
- if (!tmpFieldFilterSchema.Description)
1008
- {
1009
- tmpFieldFilterSchema.Description = tmpFilterClause.Description || `Filter by ${tmpFieldFilterSchema.DisplayName}`;
1010
- }
1011
- if (!tmpFieldFilterSchema.HelpText)
1012
- {
1013
- tmpFieldFilterSchema.HelpText = tmpFilterClause.HelpText || `Filter by ${tmpFieldFilterSchema.DisplayName} for the ${this._getHumanReadableEntityName(this.options.Entity)} entity.`;
1014
- }
1015
- if (tmpFieldFilterSchema.Ordinal == null)
1016
- {
1017
- tmpFieldFilterSchema.Ordinal = tmpOrdinal;
1018
- }
1019
- if (!Array.isArray(tmpFieldFilterSchema.AvailableClauses))
1020
- {
1021
- tmpFieldFilterSchema.AvailableClauses = [];
1022
- }
1023
- tmpFieldFilterSchema.AvailableClauses.push(tmpFilterClause.ClauseName ? Object.assign(tmpFilterClause, { DisplayName: tmpFilterClause.ClauseName }) : tmpFilterClause);
1024
- if (!tmpFilterClause.FilterKey)
1025
- {
1026
- tmpFilterClause.FilterKey = tmpFilterKey;
1027
- }
1028
- if (!tmpFilterClause.ClauseKey)
1029
- {
1030
- tmpFilterClause.ClauseKey = tmpFilterKey;
1031
- }
1032
- if (!tmpFilterClause.DisplayName)
1033
- {
1034
- tmpFilterClause.DisplayName = tmpFieldHumanName;
1035
- }
1036
- tmpFilterClause.Ordinal = tmpFieldFilterSchema.AvailableClauses.length + 1;
998
+ continue;
999
+ }
1000
+ const tmpIsCoreConnection = (tmpFilterClause.CoreConnectionColumn === this.getIDField());
1001
+ const tmpHasFilterByColumn = !!tmpFilterClause.FilterByColumn;
1002
+ if (!tmpIsCoreConnection && !tmpHasFilterByColumn)
1003
+ {
1004
+ continue;
1005
+ }
1006
+ const tmpSlotKey = tmpIsCoreConnection ? tmpFilterKey : tmpFilterClause.FilterByColumn;
1007
+ if (this.ignoreFilterFields.includes(tmpSlotKey))
1008
+ {
1009
+ continue;
1010
+ }
1011
+ let tmpFieldFilterSchema = this._FilterSchema[tmpSlotKey];
1012
+ if (!tmpFieldFilterSchema)
1013
+ {
1014
+ this._FilterSchema[tmpSlotKey] = tmpFieldFilterSchema = { };
1015
+ }
1016
+ if (!tmpFieldFilterSchema.FilterKey)
1017
+ {
1018
+ tmpFieldFilterSchema.FilterKey = tmpSlotKey;
1019
+ }
1020
+ if (!tmpFieldFilterSchema.RecordSet)
1021
+ {
1022
+ tmpFieldFilterSchema.RecordSet = this.options.RecordSet;
1023
+ }
1024
+ const tmpFieldHumanName = this.getHumanReadableFieldName(tmpSlotKey);
1025
+ if (tmpFilterClause.DisplayName)
1026
+ {
1027
+ tmpFieldFilterSchema.DisplayName = tmpFilterClause.DisplayName;
1028
+ }
1029
+ if (!tmpFieldFilterSchema.DisplayName)
1030
+ {
1031
+ tmpFieldFilterSchema.DisplayName = tmpFieldHumanName;
1032
+ }
1033
+ if (!tmpFieldFilterSchema.Description)
1034
+ {
1035
+ tmpFieldFilterSchema.Description = tmpFilterClause.Description || `Filter by ${tmpFieldFilterSchema.DisplayName}`;
1036
+ }
1037
+ if (!tmpFieldFilterSchema.HelpText)
1038
+ {
1039
+ tmpFieldFilterSchema.HelpText = tmpFilterClause.HelpText || `Filter by ${tmpFieldFilterSchema.DisplayName} for the ${this._getHumanReadableEntityName(this.options.Entity)} entity.`;
1040
+ }
1041
+ if (tmpFieldFilterSchema.Ordinal == null)
1042
+ {
1043
+ tmpFieldFilterSchema.Ordinal = tmpOrdinal;
1044
+ }
1045
+ if (!Array.isArray(tmpFieldFilterSchema.AvailableClauses))
1046
+ {
1047
+ tmpFieldFilterSchema.AvailableClauses = [];
1048
+ }
1049
+ tmpFieldFilterSchema.AvailableClauses.push(tmpFilterClause.ClauseName ? Object.assign(tmpFilterClause, { DisplayName: tmpFilterClause.ClauseName }) : tmpFilterClause);
1050
+ if (!tmpFilterClause.FilterKey)
1051
+ {
1052
+ tmpFilterClause.FilterKey = tmpSlotKey;
1053
+ }
1054
+ if (!tmpFilterClause.ClauseKey)
1055
+ {
1056
+ tmpFilterClause.ClauseKey = tmpFilterKey;
1057
+ }
1058
+ if (!tmpFilterClause.DisplayName)
1059
+ {
1060
+ tmpFilterClause.DisplayName = tmpFieldHumanName;
1037
1061
  }
1062
+ tmpFilterClause.Ordinal = tmpFieldFilterSchema.AvailableClauses.length + 1;
1038
1063
  }
1039
1064
  }
1040
1065
  }