pict-section-recordset 1.9.2 → 1.9.4

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.4",
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
  }
@@ -709,12 +709,18 @@ class ViewRecordSetSUBSETFilters extends libPictView
709
709
  {
710
710
  tmpProvider.upsertQuickFilterClauseValue(pField, pClauseKey, (pValue === undefined || pValue === null) ? '' : String(pValue).trim());
711
711
  }
712
- this.handleSearch(null, pRecordSet, pViewContext);
712
+ // Stage the clause into the active filter state but DON'T fetch — the
713
+ // user explicitly clicks Apply / Search to commit. Avoids two URL fetches
714
+ // (one stale, one not) when adjacent inputs change in quick succession
715
+ // (e.g. the From / To dates of a DateRange both fire `change` events
716
+ // within ~50ms — the GE-only fetch finishes after the GE+LE fetch and
717
+ // overwrites the recordset state with stale data).
713
718
  }
714
719
 
715
720
  /**
716
- * Apply a date-range quick filter: set one bound (`start`/`end`) of the field's DateRange clause
717
- * (removed when both bounds clear), then run the search.
721
+ * Stage one bound (`start`/`end`) of a field's DateRange quick-filter clause.
722
+ * Doesn't fire the search that waits for the user to click Apply / Search,
723
+ * so the From and To inputs change once each without racing the fetch.
718
724
  *
719
725
  * @param {string} pRecordSet @param {string} pViewContext @param {string} pField @param {string} pClauseKey @param {'start'|'end'} pWhich @param {string} pValue
720
726
  */
@@ -726,12 +732,11 @@ class ViewRecordSetSUBSETFilters extends libPictView
726
732
  {
727
733
  tmpProvider.upsertQuickFilterDateRange(pField, pClauseKey, pWhich, (pValue === undefined || pValue === null) ? '' : pValue);
728
734
  }
729
- this.handleSearch(null, pRecordSet, pViewContext);
730
735
  }
731
736
 
732
737
  /**
733
- * Apply an entity quick filter: set the field's entity clause to the picked value (removed when
734
- * cleared), then run the search. Called from the quick-bar picker's OnChange.
738
+ * Stage a field's entity quick-filter selection. Doesn't fire the search
739
+ * commit happens on Apply / Search.
735
740
  *
736
741
  * @param {string} pRecordSet @param {string} pViewContext @param {string} pField @param {string} pClauseKey @param {any} pValue
737
742
  */
@@ -743,7 +748,6 @@ class ViewRecordSetSUBSETFilters extends libPictView
743
748
  {
744
749
  tmpProvider.upsertQuickFilterEntity(pField, pClauseKey, pValue);
745
750
  }
746
- this.handleSearch(null, pRecordSet, pViewContext);
747
751
  }
748
752
 
749
753
  /**