pict-section-form 1.3.15 → 1.3.17

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.
Files changed (35) hide show
  1. package/docs/Providers.md +12 -7
  2. package/docs/_sidebar.md +2 -0
  3. package/docs/input_providers/016-facet-filter.md +106 -0
  4. package/docs/input_providers/README.md +1 -0
  5. package/example_applications/README.md +6 -0
  6. package/example_applications/facet_filter/.quackage.json +9 -0
  7. package/example_applications/facet_filter/Facet-Filter-Application.js +210 -0
  8. package/example_applications/facet_filter/Facet-Filter-Server.js +233 -0
  9. package/example_applications/facet_filter/Facet-Filter-Smoke-Runner.js +101 -0
  10. package/example_applications/facet_filter/FacetFilterData.json +44 -0
  11. package/example_applications/facet_filter/README-FacetFilter.md +70 -0
  12. package/example_applications/facet_filter/html/Facet-Filter-Smoke.js +128 -0
  13. package/example_applications/facet_filter/html/index.html +74 -0
  14. package/example_applications/facet_filter/package.json +27 -0
  15. package/package.json +1 -1
  16. package/source/providers/Pict-Provider-DynamicSolver.js +2 -0
  17. package/source/providers/Pict-Provider-ListDistilling.js +266 -1
  18. package/source/providers/Pict-Provider-MetaLists.js +16 -2
  19. package/source/providers/inputs/Pict-Provider-Input-Chart-CSS.js +49 -0
  20. package/source/providers/inputs/Pict-Provider-Input-FacetFilter.js +232 -0
  21. package/source/providers/inputs/Pict-Provider-Input-Select.js +41 -1
  22. package/source/views/Pict-View-Form-Metacontroller.js +5 -3
  23. package/test/Pict-Provider-ListDistilling-Facet_tests.js +375 -0
  24. package/test/PictSectionForm-Injection-Conformance_tests.js +11 -0
  25. package/test/fixtures/injection/Injection-Fixture-Cases.js +1 -0
  26. package/test/fixtures/injection/Injection-Fixture-Manifest.json +15 -0
  27. package/types/source/providers/Pict-Provider-DynamicSolver.d.ts.map +1 -1
  28. package/types/source/providers/Pict-Provider-ListDistilling.d.ts +90 -1
  29. package/types/source/providers/Pict-Provider-ListDistilling.d.ts.map +1 -1
  30. package/types/source/providers/Pict-Provider-MetaLists.d.ts.map +1 -1
  31. package/types/source/providers/inputs/Pict-Provider-Input-FacetFilter.d.ts +103 -0
  32. package/types/source/providers/inputs/Pict-Provider-Input-FacetFilter.d.ts.map +1 -0
  33. package/types/source/providers/inputs/Pict-Provider-Input-Select.d.ts +12 -0
  34. package/types/source/providers/inputs/Pict-Provider-Input-Select.d.ts.map +1 -1
  35. package/types/source/views/Pict-View-Form-Metacontroller.d.ts.map +1 -1
@@ -138,10 +138,12 @@ class PictFormMetacontroller extends libPictViewClass
138
138
 
139
139
  gatherInitialBundle(fCallback)
140
140
  {
141
- if (this.manifestDescription && this.manifestDescription.InitialBundle)
141
+ // Runs before bootstrap has set manifestDescription, so fall back to the manifest bootstrap will use.
142
+ const tmpManifestDescription = this.manifestDescription || this.fable.settings.DefaultFormManifest;
143
+ if (tmpManifestDescription && Array.isArray(tmpManifestDescription.InitialBundle))
142
144
  {
143
- this.log.info(`Gathering initial bundle for ${this.manifestDescription.InitialBundle.length} entities.`);
144
- return this.pict.EntityProvider.gatherDataFromServer(this.manifestDescription.InitialBundle, (pError) =>
145
+ this.log.info(`Gathering initial bundle for ${tmpManifestDescription.InitialBundle.length} entities.`);
146
+ return this.pict.EntityProvider.gatherDataFromServer(tmpManifestDescription.InitialBundle, (pError) =>
145
147
  {
146
148
  // in case of an empty array, or all tasks being synchronous, wait for the next tick so we don't get event ordering problems
147
149
  setTimeout(() => fCallback(pError), 0);
@@ -0,0 +1,375 @@
1
+ /*
2
+ Facet ListFilterRules + the Pict-Input-FacetFilter provider: dropdowns in a tabular row that choose from
3
+ one shared join list, each narrowed by the others in the same row, kept consistent when one changes.
4
+ Also covers the global PickList source (ListSourceAddressGlobal) the facet lists are built from.
5
+ */
6
+
7
+ const libBrowserEnv = require('browser-env');
8
+ libBrowserEnv();
9
+
10
+ const Chai = require('chai');
11
+ const Expect = Chai.expect;
12
+
13
+ const libPict = require('pict');
14
+ const libPictSectionForm = require('../source/Pict-Section-Form.js');
15
+
16
+ const _Catalog =
17
+ [
18
+ { IDBook: 1, Genre: 'Mystery', Author: 'Christie', Language: 'EN', InPrintUntil: '2030-12-31T00:00:00.000Z' },
19
+ { IDBook: 2, Genre: 'Mystery', Author: 'Christie', Language: 'EN', InPrintUntil: '2030-12-31T00:00:00.000Z' },
20
+ { IDBook: 3, Genre: 'Mystery', Author: 'Simenon', Language: 'FR', InPrintUntil: '2020-06-30T00:00:00.000Z' },
21
+ { IDBook: 4, Genre: 'Science', Author: 'Sagan', Language: 'EN', InPrintUntil: '2025-01-01T00:00:00.000Z' },
22
+ { IDBook: 5, Genre: 'Poetry', Author: 'Christie', Language: 'EN', InPrintUntil: '2030-12-31T00:00:00.000Z' },
23
+ { IDBook: 6, Genre: 'Poetry', Author: 'Rilke', Language: 'DE', InPrintUntil: '2030-12-31T00:00:00.000Z' },
24
+ { IDBook: 7, Genre: 'History' },
25
+ ];
26
+
27
+ function facetRule(pJoinListValueAddress, pExtra)
28
+ {
29
+ return Object.assign({ FilterType: 'Facet', JoinListAddress: 'AppData.Catalog', JoinListAddressGlobal: true, JoinListValueAddress: pJoinListValueAddress }, pExtra || {});
30
+ }
31
+
32
+ function makeApplication(pRuleExtra, pRows)
33
+ {
34
+ const fColumn = (pKey, pPickList, pJoinListValueAddress) => (
35
+ {
36
+ Hash: `Shelf${pKey}`, Name: pKey, DataAddress: pKey, DataType: 'String', IsTabular: true,
37
+ PictForm:
38
+ {
39
+ Section: 'Library', Group: 'Shelf', InputType: 'Option', SelectOptionsPickList: pPickList,
40
+ ListFilterRules: [ facetRule(pJoinListValueAddress, pRuleExtra) ], Providers: [ 'Pict-Input-FacetFilter' ]
41
+ }
42
+ });
43
+ const tmpManifest =
44
+ {
45
+ Scope: 'FacetTestForm',
46
+ PickLists:
47
+ [
48
+ { Hash: 'Genres', ListAddress: 'Genres', ListSourceAddress: 'AppData.Catalog', ListSourceAddressGlobal: true, IDTemplate: '{~D:Record.Genre~}', TextTemplate: '{~D:Record.Genre~}', Unique: true, Sorted: true },
49
+ { Hash: 'Authors', ListAddress: 'Authors', ListSourceAddress: 'AppData.Catalog', ListSourceAddressGlobal: true, IDTemplate: '{~D:Record.Author~}', TextTemplate: '{~D:Record.Author~}', Unique: true, Sorted: true, SkipEmpty: true },
50
+ { Hash: 'Books', ListAddress: 'Books', ListSourceAddress: 'AppData.Catalog', ListSourceAddressGlobal: true, IDTemplate: '{~D:Record.IDBook~}', TextTemplate: 'Book {~D:Record.IDBook~}' },
51
+ ],
52
+ Descriptors: {},
53
+ Sections: [ { Hash: 'Library', Name: 'Library', Groups: [ { Hash: 'Shelf', Name: 'Shelf', Layout: 'Tabular', RecordSetAddress: 'Shelf', RecordManifest: 'ShelfRow' } ] } ],
54
+ ReferenceManifests:
55
+ {
56
+ ShelfRow:
57
+ {
58
+ Scope: 'ShelfRow',
59
+ Descriptors:
60
+ {
61
+ Genre: fColumn('Genre', 'Genres', 'Genre'),
62
+ Author: fColumn('Author', 'Authors', 'Author'),
63
+ Book: fColumn('Book', 'Books', 'IDBook'),
64
+ }
65
+ }
66
+ }
67
+ };
68
+ class TestApp extends libPictSectionForm.PictFormApplication
69
+ {
70
+ set testDone(fDone) { this._testDone = fDone; }
71
+ onAfterInitialize()
72
+ {
73
+ this._testDone && this._testDone();
74
+ }
75
+ }
76
+ TestApp.default_configuration = JSON.parse(JSON.stringify(libPictSectionForm.PictFormApplication.default_configuration));
77
+ TestApp.default_configuration.pict_configuration =
78
+ {
79
+ Product: 'FacetTest',
80
+ DefaultAppData: { Catalog: _Catalog, Shelf: pRows || [ {}, {} ] },
81
+ DefaultFormManifest: tmpManifest
82
+ };
83
+ return TestApp;
84
+ }
85
+
86
+ function bootstrap(pAppClass, fCheck, fDone)
87
+ {
88
+ const tmpPict = new libPict(pAppClass.default_configuration.pict_configuration);
89
+ tmpPict.LogNoisiness = 0;
90
+ tmpPict.addApplication('FacetTest', pAppClass.default_configuration, pAppClass);
91
+ tmpPict.PictApplication.testDone = () =>
92
+ {
93
+ try
94
+ {
95
+ // Rendering is what stamps each input's GroupIndex / Macro, which the row-scoped paths read.
96
+ document.body.innerHTML = '<div id="Pict-Form-Container"></div>';
97
+ tmpPict.views.PictFormMetacontroller.render();
98
+ const tmpView = tmpPict.views['PictSectionForm-Library'];
99
+ fCheck(tmpPict, tmpView);
100
+ fDone();
101
+ }
102
+ catch (pError)
103
+ {
104
+ fDone(pError);
105
+ }
106
+ };
107
+ tmpPict.PictApplication.initializeAsync(() => { });
108
+ }
109
+
110
+ /** @return {{ Input: any, InputIndex: number }} */
111
+ function column(pView, pKey)
112
+ {
113
+ const tmpAddresses = pView.getGroup(0).supportingManifest.elementAddresses;
114
+ const tmpIndex = tmpAddresses.indexOf(pKey);
115
+ return { Input: pView.getTabularRecordInput(0, tmpIndex), InputIndex: tmpIndex };
116
+ }
117
+
118
+ /** The ids a row's dropdown for pKey would offer. */
119
+ function offered(pPict, pView, pKey, pRowIndex)
120
+ {
121
+ const tmpColumn = column(pView, pKey);
122
+ const tmpList = pPict.providers.DynamicMetaLists.getList(tmpColumn.Input.PictForm.SelectOptionsPickList);
123
+ return pPict.providers.ListDistilling.filterList(pView, tmpColumn.Input, tmpList, pRowIndex).map((pEntry) => pEntry.id);
124
+ }
125
+
126
+ /** A user change: setDataTabularByHash writes the cell and runs the input's change providers, as dataChangedTabular does. */
127
+ function change(pPict, pView, pKey, pRowIndex, pValue)
128
+ {
129
+ pView.setDataTabularByHash(0, column(pView, pKey).Input.Hash, pRowIndex, pValue);
130
+ }
131
+
132
+ suite('ListDistilling Facet rules', () =>
133
+ {
134
+ test('a global PickList source reads application state rather than the form data', (fDone) =>
135
+ {
136
+ bootstrap(makeApplication(), (pPict) =>
137
+ {
138
+ Expect(pPict.providers.DynamicMetaLists.getList('Genres').map((pEntry) => pEntry.id)).to.deep.equal([ 'History', 'Mystery', 'Poetry', 'Science' ]);
139
+ Expect(pPict.providers.DynamicMetaLists.getList('Books').length).to.equal(7);
140
+ }, fDone);
141
+ });
142
+
143
+ test('with nothing chosen every value is offered (records missing a value are skipped)', (fDone) =>
144
+ {
145
+ bootstrap(makeApplication(), (pPict, pView) =>
146
+ {
147
+ Expect(offered(pPict, pView, 'Author', 0)).to.deep.equal([ 'Christie', 'Rilke', 'Sagan', 'Simenon' ]);
148
+ }, fDone);
149
+ });
150
+
151
+ test('a SkipEmpty PickList skips records without the value and does not log them', (fDone) =>
152
+ {
153
+ bootstrap(makeApplication(), (pPict) =>
154
+ {
155
+ const tmpErrors = [];
156
+ const tmpOriginalError = pPict.log.error;
157
+ pPict.log.error = (pMessage) => tmpErrors.push(pMessage);
158
+ pPict.providers.DynamicMetaLists.rebuildListByHash('Authors');
159
+ pPict.providers.DynamicMetaLists.rebuildListByHash('Genres');
160
+ pPict.log.error = tmpOriginalError;
161
+ Expect(pPict.providers.DynamicMetaLists.getList('Authors').length).to.equal(4);
162
+ Expect(tmpErrors.filter((pMessage) => String(pMessage).includes('[Authors]'))).to.deep.equal([]);
163
+ }, fDone);
164
+ });
165
+
166
+ test('a row\'s list is narrowed by the other choices in that row only', (fDone) =>
167
+ {
168
+ bootstrap(makeApplication(), (pPict, pView) =>
169
+ {
170
+ change(pPict, pView, 'Genre', 0, 'Mystery');
171
+ Expect(offered(pPict, pView, 'Author', 0)).to.deep.equal([ 'Christie', 'Simenon' ]);
172
+ Expect(offered(pPict, pView, 'Book', 0)).to.deep.equal([ '1', '2', '3' ]);
173
+ Expect(offered(pPict, pView, 'Author', 1)).to.deep.equal([ 'Christie', 'Rilke', 'Sagan', 'Simenon' ]);
174
+ }, fDone);
175
+ });
176
+
177
+ test('narrowing is joint: one join record must agree with every constraint', (fDone) =>
178
+ {
179
+ bootstrap(makeApplication({ AutoFillSingle: false }), (pPict, pView) =>
180
+ {
181
+ change(pPict, pView, 'Author', 0, 'Christie');
182
+ change(pPict, pView, 'Genre', 0, 'Poetry');
183
+ Expect(offered(pPict, pView, 'Book', 0)).to.deep.equal([ '5' ]);
184
+ }, fDone);
185
+ });
186
+
187
+ test('explicit Facets add constraints that are not columns of the row', (fDone) =>
188
+ {
189
+ bootstrap(makeApplication({ Facets: [ { JoinListValueAddress: 'Language', Value: 'EN' } ] }), (pPict, pView) =>
190
+ {
191
+ Expect(offered(pPict, pView, 'Author', 0)).to.deep.equal([ 'Christie', 'Sagan' ]);
192
+ }, fDone);
193
+ });
194
+
195
+ test('explicit Facets compare with an Operator; a bare date compares against the date part', (fDone) =>
196
+ {
197
+ bootstrap(makeApplication({ Facets: [ { JoinListValueAddress: 'InPrintUntil', Operator: 'GE', Value: '2025-01-01' } ] }), (pPict, pView) =>
198
+ {
199
+ Expect(offered(pPict, pView, 'Book', 0)).to.deep.equal([ '1', '2', '4', '5', '6' ]);
200
+ }, fDone);
201
+ });
202
+
203
+ test('a stored value outside the facets is still offered in its own row (KeepCurrentValue)', (fDone) =>
204
+ {
205
+ bootstrap(makeApplication({ Facets: [ { JoinListValueAddress: 'InPrintUntil', Operator: 'GE', Value: '2026-01-01' } ] }, [ { Book: '3' }, {} ]), (pPict, pView) =>
206
+ {
207
+ Expect(offered(pPict, pView, 'Book', 0)).to.include('3');
208
+ Expect(offered(pPict, pView, 'Book', 1)).to.not.include('3');
209
+ }, fDone);
210
+ });
211
+
212
+ test('KeepCurrentValue:false filters a stored value like any other', (fDone) =>
213
+ {
214
+ bootstrap(makeApplication({ KeepCurrentValue: false, Facets: [ { JoinListValueAddress: 'InPrintUntil', Operator: 'GE', Value: '2026-01-01' } ] }, [ { Book: '3' }, {} ]), (pPict, pView) =>
215
+ {
216
+ Expect(offered(pPict, pView, 'Book', 0)).to.not.include('3');
217
+ }, fDone);
218
+ });
219
+
220
+ test('NarrowBy Preceding narrows a list by the columns before it only', (fDone) =>
221
+ {
222
+ bootstrap(makeApplication({ NarrowBy: 'Preceding' }), (pPict, pView) =>
223
+ {
224
+ change(pPict, pView, 'Book', 0, '4');
225
+ Expect(offered(pPict, pView, 'Genre', 0)).to.deep.equal([ 'History', 'Mystery', 'Poetry', 'Science' ]);
226
+ Expect(offered(pPict, pView, 'Author', 0)).to.deep.equal([ 'Sagan' ]);
227
+ }, fDone);
228
+ });
229
+ });
230
+
231
+ suite('Pict-Input-FacetFilter', () =>
232
+ {
233
+ test('a value with exactly one consistent choice is filled in', (fDone) =>
234
+ {
235
+ bootstrap(makeApplication(), (pPict, pView) =>
236
+ {
237
+ change(pPict, pView, 'Book', 1, '4');
238
+ const tmpRow = pView.getTabularRecordData(0, 1);
239
+ Expect(tmpRow.Genre).to.equal('Science');
240
+ Expect(tmpRow.Author).to.equal('Sagan');
241
+ Expect(pView.getTabularRecordData(0, 0).Genre).to.equal(undefined);
242
+ }, fDone);
243
+ });
244
+
245
+ test('an ambiguous choice is left blank', (fDone) =>
246
+ {
247
+ bootstrap(makeApplication(), (pPict, pView) =>
248
+ {
249
+ change(pPict, pView, 'Author', 0, 'Christie');
250
+ const tmpRow = pView.getTabularRecordData(0, 0);
251
+ Expect(tmpRow.Genre || '').to.equal('');
252
+ Expect(tmpRow.Book || '').to.equal('');
253
+ }, fDone);
254
+ });
255
+
256
+ test('fills cascade until nothing is left to infer', (fDone) =>
257
+ {
258
+ bootstrap(makeApplication(), (pPict, pView) =>
259
+ {
260
+ change(pPict, pView, 'Author', 0, 'Simenon');
261
+ const tmpRow = pView.getTabularRecordData(0, 0);
262
+ Expect(tmpRow.Genre).to.equal('Mystery');
263
+ Expect(tmpRow.Book).to.equal('3');
264
+ }, fDone);
265
+ });
266
+
267
+ test('a change keeps the changed value and clears siblings it contradicts', (fDone) =>
268
+ {
269
+ bootstrap(makeApplication({ NarrowBy: 'Preceding' }), (pPict, pView) =>
270
+ {
271
+ change(pPict, pView, 'Book', 0, '4');
272
+ change(pPict, pView, 'Genre', 0, 'Poetry');
273
+ const tmpRow = pView.getTabularRecordData(0, 0);
274
+ Expect(tmpRow.Genre).to.equal('Poetry');
275
+ Expect(tmpRow.Author || '').to.equal('');
276
+ Expect(tmpRow.Book || '').to.equal('');
277
+ }, fDone);
278
+ });
279
+
280
+ test('a sibling still consistent with the change is kept', (fDone) =>
281
+ {
282
+ bootstrap(makeApplication({ NarrowBy: 'Preceding' }), (pPict, pView) =>
283
+ {
284
+ change(pPict, pView, 'Book', 0, '1');
285
+ change(pPict, pView, 'Genre', 0, 'Poetry');
286
+ const tmpRow = pView.getTabularRecordData(0, 0);
287
+ Expect(tmpRow.Author).to.equal('Christie');
288
+ Expect(tmpRow.Book).to.equal('5');
289
+ }, fDone);
290
+ });
291
+
292
+ test('ClearInvalid:false and AutoFillSingle:false leave siblings alone', (fDone) =>
293
+ {
294
+ bootstrap(makeApplication({ ClearInvalid: false, AutoFillSingle: false }), (pPict, pView) =>
295
+ {
296
+ change(pPict, pView, 'Book', 0, '4');
297
+ Expect(pView.getTabularRecordData(0, 0).Genre || '').to.equal('');
298
+ change(pPict, pView, 'Genre', 0, 'Poetry');
299
+ Expect(pView.getTabularRecordData(0, 0).Book).to.equal('4');
300
+ }, fDone);
301
+ });
302
+
303
+ test('CarryFields copies the identified record into the row on a change, and clears with it', (fDone) =>
304
+ {
305
+ bootstrap(makeApplication({ CarryFields: { Lang: 'Language' } }), (pPict, pView) =>
306
+ {
307
+ change(pPict, pView, 'Book', 0, '3');
308
+ Expect(pView.getTabularRecordData(0, 0).Lang).to.equal('FR');
309
+ change(pPict, pView, 'Book', 0, '');
310
+ Expect(pView.getTabularRecordData(0, 0).Lang).to.equal('');
311
+ }, fDone);
312
+ });
313
+
314
+ test('clearing a value the rest of the row still pins down stays cleared', (fDone) =>
315
+ {
316
+ bootstrap(makeApplication(), (pPict, pView) =>
317
+ {
318
+ change(pPict, pView, 'Book', 0, '4');
319
+ change(pPict, pView, 'Book', 0, '');
320
+ const tmpRow = pView.getTabularRecordData(0, 0);
321
+ Expect(tmpRow.Book).to.equal('');
322
+ Expect(tmpRow.Genre).to.equal('Science');
323
+ }, fDone);
324
+ });
325
+
326
+ test('CarryFields leaves a value it cannot pin to one record blank', (fDone) =>
327
+ {
328
+ bootstrap(makeApplication({ CarryFields: { Lang: 'Language' }, AutoFillSingle: false }), (pPict, pView) =>
329
+ {
330
+ change(pPict, pView, 'Author', 0, 'Christie');
331
+ Expect(pView.getTabularRecordData(0, 0).Lang).to.equal('');
332
+ }, fDone);
333
+ });
334
+
335
+ test('carried values on a saved row are kept when the form opens', (fDone) =>
336
+ {
337
+ bootstrap(makeApplication({ CarryFields: { Lang: 'Language' } }, [ { Genre: 'Mystery', Author: 'Simenon', Book: '3', Lang: 'saved' } ]), (pPict, pView) =>
338
+ {
339
+ Expect(pView.getTabularRecordData(0, 0).Lang).to.equal('saved');
340
+ }, fDone);
341
+ });
342
+
343
+ test('opening a form with saved values does not rewrite them', (fDone) =>
344
+ {
345
+ bootstrap(makeApplication(null, [ { Genre: 'Poetry', Author: 'Sagan', Book: '4' } ]), (pPict, pView) =>
346
+ {
347
+ Expect(pView.getTabularRecordData(0, 0)).to.deep.equal({ Genre: 'Poetry', Author: 'Sagan', Book: '4' });
348
+ }, fDone);
349
+ });
350
+ });
351
+
352
+ suite('Form-level InitialBundle from settings.DefaultFormManifest', () =>
353
+ {
354
+ test('runs before the form bootstraps, so form-level PickLists see its data', (fDone) =>
355
+ {
356
+ const tmpApp = makeApplication();
357
+ const tmpConfiguration = tmpApp.default_configuration.pict_configuration;
358
+ tmpConfiguration.DefaultFormManifest.InitialBundle =
359
+ [
360
+ {
361
+ Type: 'ProjectDataset',
362
+ InputRecordsetAddress: 'AppData.Catalog',
363
+ OutputRecordsetAddress: 'AppData.Projected',
364
+ RecordPrototypeAddress: 'OutputRecordset[]<<~?IDBook,==,{~D:InputRecord.IDBook~}?~>>',
365
+ RecordFieldMapping: { Default: { 'InputRecord.IDBook': 'OutputRecord.IDBook', 'InputRecord.Author': 'OutputRecord.Writer' } }
366
+ }
367
+ ];
368
+ tmpConfiguration.DefaultFormManifest.PickLists.push({ Hash: 'Writers', ListAddress: 'Writers', ListSourceAddress: 'AppData.Projected', ListSourceAddressGlobal: true, IDTemplate: '{~D:Record.Writer~}', TextTemplate: '{~D:Record.Writer~}', Unique: true, Sorted: true });
369
+ bootstrap(tmpApp, (pPict) =>
370
+ {
371
+ Expect(pPict.AppData.Projected.length).to.equal(7);
372
+ Expect(pPict.providers.DynamicMetaLists.getList('Writers').map((pEntry) => pEntry.id)).to.deep.equal([ 'Christie', 'Rilke', 'Sagan', 'Simenon' ]);
373
+ }, fDone);
374
+ });
375
+ });
@@ -444,6 +444,17 @@ suite('PictSectionForm injection conformance', () =>
444
444
  Expect(tmpColumn.PictForm.TabularTriggerGroup[0].TriggerGroupHash, 'a column trigger group is salted with the rest of the copy').to.equal('CrateRowTally_alpha');
445
445
  });
446
446
 
447
+ test('a Facet column\'s join list is shared application state, so injection leaves its rule alone', () =>
448
+ {
449
+ const tmpMetacontroller = buildMetacontroller(_Cases.MARSHAL_DESTINATION);
450
+ const tmpSalted = tmpMetacontroller.createDistinctManifest(_Fixture.InjectableManifest, 'alpha');
451
+ const tmpColumn = tmpSalted.ReferenceManifests.CrateRow.Descriptors.Bin;
452
+ Expect(tmpColumn.Hash).to.equal('Bin');
453
+ Expect(tmpColumn.PictForm.Providers).to.deep.equal([ 'Pict-Input-FacetFilter' ]);
454
+ Expect(tmpColumn.PictForm.ListFilterRules[0].JoinListAddress, 'the join list is global, not part of the copy').to.equal('AppData.BinCatalog');
455
+ Expect(tmpColumn.PictForm.ListFilterRules[0].JoinListValueAddress, 'addresses inside join records are untouched').to.equal('Bin');
456
+ });
457
+
447
458
  test('every input of the fixture is reachable by its salted hash', () =>
448
459
  {
449
460
  const tmpMetacontroller = buildMetacontroller(_Cases.MARSHAL_DESTINATION);
@@ -120,6 +120,7 @@ const INPUT_CASES =
120
120
  { Registry: 'Provider:Pict-Input-AutofillTriggerGroup', Hash: 'Source', Tier: 'browser', Marshals: true, Accepts: true, Value: 6, Note: 'the trigger fires on a real change event' },
121
121
  { Registry: 'Provider:Pict-Input-EntityBundleRequest', Hash: 'Bundled', Tier: 'expression', Marshals: false, Accepts: false, Note: 'gathers its bundle from a server; only its salted configuration is asserted' },
122
122
  { Registry: 'Provider:Pict-Input-TabularTriggerGroup', Hash: 'Tally', Tier: 'expression', Marshals: false, Accepts: false, Note: 'a record set column; its trigger group configuration is asserted on the salted manifest' },
123
+ { Registry: 'Provider:Pict-Input-FacetFilter', Hash: 'Bin', Tier: 'expression', Marshals: false, Accepts: false, Note: 'a record set column; its siblings are found by row, so only its Facet rule is asserted on the salted manifest' },
123
124
  ];
124
125
 
125
126
  // Registry entries with no fixture case, and why. Anything else missing fails the coverage suite.
@@ -358,6 +358,21 @@
358
358
  "Providers": [ "Pict-Input-TabularTriggerGroup" ],
359
359
  "TabularTriggerGroup": [ { "TriggerGroupHash": "CrateRowTally", "TriggerAllInputs": true, "PostSolvers": [ "TallyTotal = SUM(Rows[].Tally)" ] } ]
360
360
  }
361
+ },
362
+ "Bin":
363
+ {
364
+ "Name": "Bin",
365
+ "Hash": "Bin",
366
+ "DataType": "String",
367
+ "PictForm":
368
+ {
369
+ "Section": "Measure",
370
+ "Group": "RowsGroup",
371
+ "InputType": "Option",
372
+ "SelectOptions": [ { "id": "near", "text": "Near" }, { "id": "far", "text": "Far" } ],
373
+ "Providers": [ "Pict-Input-FacetFilter" ],
374
+ "ListFilterRules": [ { "FilterType": "Facet", "JoinListAddress": "AppData.BinCatalog", "JoinListAddressGlobal": true, "JoinListValueAddress": "Bin" } ]
375
+ }
361
376
  }
362
377
  }
363
378
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Pict-Provider-DynamicSolver.d.ts","sourceRoot":"","sources":["../../../source/providers/Pict-Provider-DynamicSolver.js"],"names":[],"mappings":";AAkCA;;GAEG;AACH;IAEC;;;;;;OAMG;IACH,oBAJW,OAAO,MAAM,CAAC,aACd,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,iBACnB,MAAM,EA0ChB;IAnCA,yDAAyD;IACzD,MADW,OAAO,MAAM,CAAC,GAAG;QAAE,gBAAgB,EAAE,GAAG,CAAA;KAAE,CAC5C;IACT,uHAAuH;IACvH,OADW,OAAO,MAAM,CAAC,GAAG;QAAE,qCAAqC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,GAAG,CAAC;QAAC,gBAAgB,EAAE,GAAG,CAAA;KAAE,CACzG;IAQV,yBAA0C;IA0B3C,0CAsBC;IAED;;;;;MAKE;IACF,qDAgBC;IAED;;;;;OAKG;IACH,oDA8CC;IAED;;;;;;OAMG;IACH,6BAJW,MAAM,YACN,OAAO,GACL,GAAG,CAyBf;IAED;;;;;;;;;OASG;IACH,qBALW,MAAM,GAAC,MAAM,cACb,OAAO,aACP,MAAM,GACJ,MAAM,GAAC,SAAS,CA8B5B;IAED,yEAAyE;IAEzE;;;;;;OAMG;IACH,sBAJW,OAAO,mCAAmC,CAAC,YAC3C,KAAK;iBANS,MAAM;oBAAc,MAAM;MAM3B,WACb,MAAM,QAsDhB;IADA;;;;;MAA4C;IAG7C;;;;;;;;;;;OAWG;IACH,2BAPW,OAAO,mCAAmC,CAAC,qBAC3C,KAAK,CAAC,MAAM,CAAC,WACb,MAAM,YACN,MAAM,iDAEN,OAAO,QAyCjB;IAED;;;;;;;;;OASG;IACH,wDAJW,MAAM,iDAEN,OAAO,QA2EjB;IAED;;;;;;;OAOG;IACH,gEAJW,MAAM,iDAEN,OAAO,QAkDjB;IAED;;;;;;OAMG;IACH,sDAHW,MAAM,gCA2BhB;IAED;;;;;OAKG;IACH,wEAFW,OAAO,QAiCjB;IAED;;;;;;;;OAQG;IACH,gCAJW,MAAM,yBAWhB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,yBANW,QAAM,MAAM,EAAE,yBACd,OAAO,GAGN,KAAK,CAAC,MAAM,CAAC,CAiGxB;IAFA;;;;;;MAAuC;CAGxC;;;;;AAtsBD,kCAAkC;AAClC,6CADW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAS3B"}
1
+ {"version":3,"file":"Pict-Provider-DynamicSolver.d.ts","sourceRoot":"","sources":["../../../source/providers/Pict-Provider-DynamicSolver.js"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AAM,MAAM,EAAE,yBACd,OAAO,GAGN,KAAK,CAAC,MAAM,CAAC,CAiGxB;IAFA;;;;;;MAAuC;CAGxC;;;;;AAvsBD,kCAAkC;AAClC,6CADW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAS3B"}
@@ -36,9 +36,98 @@ declare class PictListDistilling extends libPictProvider {
36
36
  * @param {Object} pView - The pict view the list is within
37
37
  * @param {*} pInput - The input within the dynamic forms view
38
38
  * @param {*} pList - The raw list of options to filter
39
+ * @param {number} [pRowIndex] - The tabular row the list is for; Facet rules read sibling values from this row
39
40
  * @returns
40
41
  */
41
- filterList(pView: any, pInput: any, pList: any): any;
42
+ filterList(pView: any, pInput: any, pList: any, pRowIndex?: number): any;
43
+ /**
44
+ * @param {Record<string, any>} pInput
45
+ * @return {Record<string, any>|null} the input's Facet rule, if it has one
46
+ */
47
+ getFacetRule(pInput: Record<string, any>): Record<string, any> | null;
48
+ /**
49
+ * @param {Object} pView
50
+ * @param {Record<string, any>} pRule
51
+ * @return {Array<any>} the join list a Facet rule distills, as an array
52
+ */
53
+ getFacetJoinList(pView: any, pRule: Record<string, any>): Array<any>;
54
+ /**
55
+ * Every input that shares a Facet rule's join list with pInput, in the same tabular row (or the same
56
+ * view, outside a table), with the value it currently holds. pInput itself is included.
57
+ *
58
+ * @param {Object} pView
59
+ * @param {Record<string, any>} pInput
60
+ * @param {number} [pRowIndex]
61
+ * @return {Array<{ Input: Record<string, any>, Rule: Record<string, any>, Value: any }>}
62
+ */
63
+ getFacetSiblings(pView: any, pInput: Record<string, any>, pRowIndex?: number): Array<{
64
+ Input: Record<string, any>;
65
+ Rule: Record<string, any>;
66
+ Value: any;
67
+ }>;
68
+ /**
69
+ * @param {any} pValue
70
+ * @return {boolean}
71
+ */
72
+ isEmptyFacetValue(pValue: any): boolean;
73
+ /**
74
+ * The values a Facet rule's dropdown offers: the allowed values (narrowed per the rule's NarrowBy), plus
75
+ * the input's own current value unless KeepCurrentValue is false, so a filter never hides what the row
76
+ * already stores (a saved choice that has since fallen out of scope still shows).
77
+ *
78
+ * @param {Object} pView
79
+ * @param {Record<string, any>} pInput
80
+ * @param {Record<string, any>} pRule - the input's Facet rule
81
+ * @param {number} [pRowIndex]
82
+ * @return {Set<string>}
83
+ */
84
+ getFacetOfferedValues(pView: any, pInput: Record<string, any>, pRule: Record<string, any>, pRowIndex?: number): Set<string>;
85
+ /**
86
+ * @param {any} pJoinValue - the value on the join record
87
+ * @param {string} pOperator - EQ (default), NE, LT, LE, GT or GE
88
+ * @param {string} pValue - the constraint value
89
+ * @return {boolean}
90
+ */
91
+ compareFacetValue(pJoinValue: any, pOperator: string, pValue: string): boolean;
92
+ /**
93
+ * The values a Facet rule's input may hold, given what its siblings hold: the distinct
94
+ * JoinListValueAddress values of the join records that agree with every constraining non-empty sibling
95
+ * value and every explicit facet. Empty siblings do not constrain.
96
+ *
97
+ * pNarrowBy picks the constraining siblings: 'All' (default) is every sibling; 'Preceding' is only the
98
+ * siblings before this input (column order in a table), so a list offers every value its upstream
99
+ * choices allow and picking one never needs a downstream value cleared first.
100
+ *
101
+ * @param {Object} pView
102
+ * @param {Record<string, any>} pInput
103
+ * @param {Record<string, any>} pRule - the input's Facet rule
104
+ * @param {number} [pRowIndex]
105
+ * @param {Array<{ Input: Record<string, any>, Rule: Record<string, any>, Value: any }>} [pSiblings] - precomputed siblings (values may be overridden by the caller)
106
+ * @param {string} [pNarrowBy] - 'All' or 'Preceding'
107
+ * @return {Set<string>}
108
+ */
109
+ getFacetAllowedValues(pView: any, pInput: Record<string, any>, pRule: Record<string, any>, pRowIndex?: number, pSiblings?: Array<{
110
+ Input: Record<string, any>;
111
+ Rule: Record<string, any>;
112
+ Value: any;
113
+ }>, pNarrowBy?: string): Set<string>;
114
+ /**
115
+ * The join records that agree with every constraining non-empty sibling value and every explicit facet;
116
+ * see getFacetAllowedValues for pNarrowBy. pInput's own value does not constrain.
117
+ *
118
+ * @param {Object} pView
119
+ * @param {Record<string, any>} pInput
120
+ * @param {Record<string, any>} pRule - the input's Facet rule
121
+ * @param {number} [pRowIndex]
122
+ * @param {Array<{ Input: Record<string, any>, Rule: Record<string, any>, Value: any }>} [pSiblings]
123
+ * @param {string} [pNarrowBy] - 'All' or 'Preceding'
124
+ * @return {Array<Record<string, any>>}
125
+ */
126
+ getFacetMatchingRecords(pView: any, pInput: Record<string, any>, pRule: Record<string, any>, pRowIndex?: number, pSiblings?: Array<{
127
+ Input: Record<string, any>;
128
+ Rule: Record<string, any>;
129
+ Value: any;
130
+ }>, pNarrowBy?: string): Array<Record<string, any>>;
42
131
  }
43
132
  declare namespace PictListDistilling {
44
133
  export { _DefaultProviderConfiguration as default_configuration };
@@ -1 +1 @@
1
- {"version":3,"file":"Pict-Provider-ListDistilling.d.ts","sourceRoot":"","sources":["../../../source/providers/Pict-Provider-ListDistilling.js"],"names":[],"mappings":";AAaA;;GAEG;AACH;IAYE,6BAA6B;IAC7B,MADW,OAAO,MAAM,CAAC,CAChB;IACT,6BAA6B;IAC7B,OADW,OAAO,MAAM,CAAC,CACf;IAuBX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA8BI;IACJ,+BAJY,GAAC,SACD,GAAC,OA6OZ;CACD;;;;;AA9TD,kCAAkC;AAClC,6CADW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAS3B"}
1
+ {"version":3,"file":"Pict-Provider-ListDistilling.d.ts","sourceRoot":"","sources":["../../../source/providers/Pict-Provider-ListDistilling.js"],"names":[],"mappings":";AAaA;;GAEG;AACH;IAYE,6BAA6B;IAC7B,MADW,OAAO,MAAM,CAAC,CAChB;IACT,6BAA6B;IAC7B,OADW,OAAO,MAAM,CAAC,CACf;IAuBX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA+BI;IACJ,+BALY,GAAC,SACD,GAAC,cACD,MAAM,OAuPjB;IAED;;;OAGG;IACH,qBAHW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAClB,MAAM,CAAC,MAAM,EAAE,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C,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAAC,KAAK,EAAE,GAAG,CAAA;KAAE,CAAC,cAC5E,MAAM,GACL,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAsCrC;CACD;;;;;AAvkBD,kCAAkC;AAClC,6CADW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAS3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"Pict-Provider-MetaLists.d.ts","sourceRoot":"","sources":["../../../source/providers/Pict-Provider-MetaLists.js"],"names":[],"mappings":";AAaA;;GAEG;AACH;IAcE,kBAAkB;IAClB,SADW,GAAG,CACF;IACZ,6QAA6Q;IAC7Q,MADW,OAAO,MAAM,CAAC,GAAG;QAAE,GAAG,EAAE,GAAG,CAAC;QAAC,6CAA6C,EAAE,CAAC,IAAI,QAAQ,KAAK,GAAG,CAAC;QAAC,qCAAqC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,GAAG,CAAC;QAAC,mBAAmB,EAAE,OAAO,8DAA8D,CAAC,CAAA;KAAE,CAChQ;IACT,6BAA6B;IAC7B,OADW,OAAO,MAAM,CAAC,CACf;IAQV,kBAAuB;IACvB,oBAAyB;IAE1B,2DAA2D;IAE3D;;;;;;;OAOG;IACH,mBALW,MAAM,mBAGJ,KAAK;YARE,MAAM;cAAQ,MAAM;MAQR,CAsB/B;IAED;;;;;OAKG;IACH,mBAHW,MAAM,GACJ,OAAO,CAKnB;IAED;;;OAGG;IACH,iDAsBC;IAED;;;;OAIG;IACH,6BAFW,MAAM,QAQhB;IAED;;;;OAIG;IACH,qCAwGC;CACD;;;;;AA9OD,kCAAkC;AAClC,6CADW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAS3B"}
1
+ {"version":3,"file":"Pict-Provider-MetaLists.d.ts","sourceRoot":"","sources":["../../../source/providers/Pict-Provider-MetaLists.js"],"names":[],"mappings":";AAaA;;GAEG;AACH;IAcE,kBAAkB;IAClB,SADW,GAAG,CACF;IACZ,6QAA6Q;IAC7Q,MADW,OAAO,MAAM,CAAC,GAAG;QAAE,GAAG,EAAE,GAAG,CAAC;QAAC,6CAA6C,EAAE,CAAC,IAAI,QAAQ,KAAK,GAAG,CAAC;QAAC,qCAAqC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,GAAG,CAAC;QAAC,mBAAmB,EAAE,OAAO,8DAA8D,CAAC,CAAA;KAAE,CAChQ;IACT,6BAA6B;IAC7B,OADW,OAAO,MAAM,CAAC,CACf;IAQV,kBAAuB;IACvB,oBAAyB;IAE1B,2DAA2D;IAE3D;;;;;;;OAOG;IACH,mBALW,MAAM,mBAGJ,KAAK;YARE,MAAM;cAAQ,MAAM;MAQR,CAsB/B;IAED;;;;;OAKG;IACH,mBAHW,MAAM,GACJ,OAAO,CAKnB;IAED;;;OAGG;IACH,iDAsBC;IAED;;;;OAIG;IACH,6BAFW,MAAM,QAQhB;IAED;;;;OAIG;IACH,qCAsHC;CACD;;;;;AA5PD,kCAAkC;AAClC,6CADW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAS3B"}