pict-section-recordset 1.6.0 → 1.7.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.
package/README.md
CHANGED
|
@@ -41,6 +41,8 @@ A curated, one-interaction filter bar at the top of the filter drawer — the ha
|
|
|
41
41
|
|
|
42
42
|
The control type is inferred from the field's clause (text for a string match, a from/to pair for a date range, a [pict-section-picker](https://github.com/fable-retold/pict-section-picker) for an entity reference). A quick clause lives in the same filter state as every other clause (tagged so the full clause list doesn't show it twice), and is removed when its value is cleared.
|
|
43
43
|
|
|
44
|
+
**Turning it off.** A single record set opts out with `QuickFilters: false`. To make quick filters **opt-in** across a whole app — only record sets with an explicit `QuickFilters` array show the bar — set the filter view's flag once: `pict.views['PRSP-Filters'].quickFiltersAutoDefault = false`.
|
|
45
|
+
|
|
44
46
|
## Related Packages
|
|
45
47
|
|
|
46
48
|
- [pict](https://github.com/fable-retold/pict) - MVC application framework
|
package/package.json
CHANGED
|
@@ -376,16 +376,23 @@ class RecordSetProviderBase extends libPictProvider
|
|
|
376
376
|
// so it serializes / applies / clears like any other clause — the drawer's clause list just skips it.
|
|
377
377
|
|
|
378
378
|
/**
|
|
379
|
-
* Resolve the quick-filter definitions for this record set:
|
|
380
|
-
*
|
|
381
|
-
*
|
|
382
|
-
*
|
|
379
|
+
* Resolve the quick-filter definitions for this record set. Precedence: a `QuickFilters` array config
|
|
380
|
+
* (curated) → those; `QuickFilters: false` → none (explicit per-record-set opt-out); otherwise clever
|
|
381
|
+
* defaults derived from the schema — UNLESS `pAllowCleverDefaults` is false (the host put quick filters
|
|
382
|
+
* in opt-in-only mode, so a record set shows the bar only when it sets an explicit `QuickFilters`
|
|
383
|
+
* array). Each definition resolves to a concrete clause descriptor from the field's `AvailableClauses`.
|
|
383
384
|
*
|
|
385
|
+
* @param {boolean} [pAllowCleverDefaults] - false → no clever defaults (opt-in only). Default true.
|
|
384
386
|
* @return {Array<{Field:string, Label:string, Control:string, ClauseKey:string}>}
|
|
385
387
|
*/
|
|
386
|
-
getQuickFilterDefinitions()
|
|
388
|
+
getQuickFilterDefinitions(pAllowCleverDefaults)
|
|
387
389
|
{
|
|
388
|
-
const
|
|
390
|
+
const tmpConfig = this.options.QuickFilters;
|
|
391
|
+
if (tmpConfig === false) { return []; }
|
|
392
|
+
let tmpEntries;
|
|
393
|
+
if (Array.isArray(tmpConfig)) { tmpEntries = tmpConfig; }
|
|
394
|
+
else if (pAllowCleverDefaults === false) { tmpEntries = []; }
|
|
395
|
+
else { tmpEntries = this._deriveDefaultQuickFilters(); }
|
|
389
396
|
const tmpDefinitions = [];
|
|
390
397
|
for (let i = 0; i < tmpEntries.length; i++)
|
|
391
398
|
{
|
|
@@ -619,8 +619,10 @@ class ViewRecordSetSUBSETFilters extends libPictView
|
|
|
619
619
|
return;
|
|
620
620
|
}
|
|
621
621
|
// Build one item per definition, populating exactly one control slot (text / date / entity).
|
|
622
|
+
// `quickFiltersAutoDefault` (host-settable, default on) gates the clever schema defaults: a host
|
|
623
|
+
// can set it false to make quick filters opt-in (only record sets with an explicit config show).
|
|
622
624
|
const tmpEntityMounts = [];
|
|
623
|
-
const tmpItems = tmpProvider.getQuickFilterDefinitions().map((pDefinition) =>
|
|
625
|
+
const tmpItems = tmpProvider.getQuickFilterDefinitions(this.quickFiltersAutoDefault).map((pDefinition) =>
|
|
624
626
|
{
|
|
625
627
|
const tmpBase = { Field: pDefinition.Field, ClauseKey: pDefinition.ClauseKey, Label: pDefinition.Label, RecordSet: pRecordSet, ViewContext: pViewContext };
|
|
626
628
|
const tmpItem = { Label: pDefinition.Label, TextSlot: [], DateSlot: [], EntitySlot: [] };
|