pict-section-form 1.3.14 → 1.3.16

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 (80) hide show
  1. package/docs/Injection_Conformance.md +137 -0
  2. package/docs/Providers.md +12 -7
  3. package/docs/_sidebar.md +3 -0
  4. package/docs/input_providers/016-facet-filter.md +106 -0
  5. package/docs/input_providers/README.md +1 -0
  6. package/example_applications/README.md +6 -0
  7. package/example_applications/facet_filter/.quackage.json +9 -0
  8. package/example_applications/facet_filter/Facet-Filter-Application.js +210 -0
  9. package/example_applications/facet_filter/Facet-Filter-Server.js +233 -0
  10. package/example_applications/facet_filter/Facet-Filter-Smoke-Runner.js +101 -0
  11. package/example_applications/facet_filter/FacetFilterData.json +44 -0
  12. package/example_applications/facet_filter/README-FacetFilter.md +70 -0
  13. package/example_applications/facet_filter/html/Facet-Filter-Smoke.js +128 -0
  14. package/example_applications/facet_filter/html/index.html +74 -0
  15. package/example_applications/facet_filter/package.json +27 -0
  16. package/example_applications/nested_distill_sandbox/Sandbox-Driver-Headlight.js +17 -0
  17. package/example_applications/nested_distill_sandbox/Sandbox-Driver.js +369 -0
  18. package/example_applications/nested_distill_sandbox/Sandbox-Runner.js +372 -0
  19. package/example_applications/nested_distill_sandbox/approaches/A1-tabular-trigger-group.js +67 -0
  20. package/example_applications/nested_distill_sandbox/approaches/A3-crossmap-selectoptionsrefresh.js +61 -0
  21. package/example_applications/nested_distill_sandbox/approaches/A4-graph-solvers-flat-list.js +53 -0
  22. package/example_applications/nested_distill_sandbox/approaches/A5-facet-filter.js +75 -0
  23. package/example_applications/nested_distill_sandbox/approaches/A5b-facet-filter-symmetric.js +15 -0
  24. package/example_applications/nested_distill_sandbox/approaches/A5h-facet-filter-headlight-picker.js +15 -0
  25. package/example_applications/nested_distill_sandbox/approaches/R0-original-jmf-manifest-headlight.js +27 -0
  26. package/example_applications/nested_distill_sandbox/approaches/R1-real-jmf-manifest-headlight.js +136 -0
  27. package/example_applications/nested_distill_sandbox/approaches/_Common.js +344 -0
  28. package/example_applications/nested_distill_sandbox/approaches/_Scenarios.js +262 -0
  29. package/package.json +6 -5
  30. package/source/providers/Pict-Provider-DynamicFormSolverBehaviors.js +73 -5
  31. package/source/providers/Pict-Provider-DynamicSolver.js +22 -2
  32. package/source/providers/Pict-Provider-ListDistilling.js +266 -1
  33. package/source/providers/Pict-Provider-MetaLists.js +16 -2
  34. package/source/providers/inputs/Pict-Provider-Input-FacetFilter.js +232 -0
  35. package/source/providers/inputs/Pict-Provider-Input-Select.js +41 -1
  36. package/source/views/Pict-View-Form-Metacontroller.js +690 -93
  37. package/test/Pict-Provider-DynamicFormSolverBehaviors-OrdinalScope_tests.js +105 -0
  38. package/test/Pict-Provider-ListDistilling-Facet_tests.js +375 -0
  39. package/test/Pict-View-Form-Metacontroller-DistinctManifest_tests.js +410 -0
  40. package/test/PictSectionForm-Injection-Conformance_tests.js +762 -0
  41. package/test/browser/Injection-Conformance-Differential-Scenario.js +346 -0
  42. package/test/browser/Injection-Conformance-EdgeCase-Scenario.js +168 -0
  43. package/test/browser/Injection-Conformance-Harness-Driver.js +538 -0
  44. package/test/browser/Injection-Conformance-Harness-Runner.js +487 -0
  45. package/test/browser/Injection-Conformance-Reconstitution-Scenario.js +191 -0
  46. package/test/browser/Injection-Conformance-Standalone-Scenario.js +114 -0
  47. package/test/fixtures/injection/Injection-Fixture-Cases.js +204 -0
  48. package/test/fixtures/injection/Injection-Fixture-Manifest.json +381 -0
  49. package/types/source/providers/Pict-Provider-DynamicFormSolverBehaviors.d.ts +110 -1
  50. package/types/source/providers/Pict-Provider-DynamicFormSolverBehaviors.d.ts.map +1 -1
  51. package/types/source/providers/Pict-Provider-DynamicSolver.d.ts.map +1 -1
  52. package/types/source/providers/Pict-Provider-DynamicTabularData.d.ts +17 -1
  53. package/types/source/providers/Pict-Provider-DynamicTabularData.d.ts.map +1 -1
  54. package/types/source/providers/Pict-Provider-InputExtension.d.ts +31 -0
  55. package/types/source/providers/Pict-Provider-InputExtension.d.ts.map +1 -1
  56. package/types/source/providers/Pict-Provider-ListDistilling.d.ts +90 -1
  57. package/types/source/providers/Pict-Provider-ListDistilling.d.ts.map +1 -1
  58. package/types/source/providers/Pict-Provider-MetaLists.d.ts.map +1 -1
  59. package/types/source/providers/inputs/Pict-Provider-Input-Chart-CSS.d.ts +16 -0
  60. package/types/source/providers/inputs/Pict-Provider-Input-Chart-CSS.d.ts.map +1 -0
  61. package/types/source/providers/inputs/Pict-Provider-Input-Chart.d.ts +47 -0
  62. package/types/source/providers/inputs/Pict-Provider-Input-Chart.d.ts.map +1 -1
  63. package/types/source/providers/inputs/Pict-Provider-Input-Diagram.d.ts +86 -0
  64. package/types/source/providers/inputs/Pict-Provider-Input-Diagram.d.ts.map +1 -1
  65. package/types/source/providers/inputs/Pict-Provider-Input-FacetFilter.d.ts +103 -0
  66. package/types/source/providers/inputs/Pict-Provider-Input-FacetFilter.d.ts.map +1 -0
  67. package/types/source/providers/inputs/Pict-Provider-Input-ObjectEditor.d.ts +128 -0
  68. package/types/source/providers/inputs/Pict-Provider-Input-ObjectEditor.d.ts.map +1 -0
  69. package/types/source/providers/inputs/Pict-Provider-Input-PreciseNumber.d.ts.map +1 -1
  70. package/types/source/providers/inputs/Pict-Provider-Input-Select.d.ts +12 -0
  71. package/types/source/providers/inputs/Pict-Provider-Input-Select.d.ts.map +1 -1
  72. package/types/source/providers/inputs/Pict-Provider-Input-TabGroupSelector.d.ts +10 -1
  73. package/types/source/providers/inputs/Pict-Provider-Input-TabGroupSelector.d.ts.map +1 -1
  74. package/types/source/providers/inputs/Pict-Provider-Input-TabSectionSelector.d.ts +10 -1
  75. package/types/source/providers/inputs/Pict-Provider-Input-TabSectionSelector.d.ts.map +1 -1
  76. package/types/source/providers/layouts/Pict-Layout-Tabular.d.ts +76 -4
  77. package/types/source/providers/layouts/Pict-Layout-Tabular.d.ts.map +1 -1
  78. package/types/source/views/Pict-View-DynamicForm.d.ts.map +1 -1
  79. package/types/source/views/Pict-View-Form-Metacontroller.d.ts +63 -2
  80. package/types/source/views/Pict-View-Form-Metacontroller.d.ts.map +1 -1
@@ -0,0 +1,262 @@
1
+ /*
2
+ The user stories every approach is scored on. An approach declares which behaviours it claims
3
+ (pCapabilities); a check for a behaviour it does not claim is reported as [known], not [fail].
4
+ */
5
+
6
+ const libCommon = require('./_Common.js');
7
+
8
+ const SUMMARY_ADDRESS = `${libCommon.MARSHAL_ROOT}.FormulaData.AggregateBlendGsb`;
9
+
10
+ /**
11
+ * @param {Record<string, any>} pFixtures
12
+ * @param {Record<string, boolean>} pCapabilities
13
+ * @param {Array<string>} pSelectColumns
14
+ * @return {Array<Record<string, any>>}
15
+ */
16
+ function scenarios(pFixtures, pCapabilities, pSelectColumns)
17
+ {
18
+ const tmpCan = (pKey) => (pCapabilities[pKey] === false) ? false : undefined;
19
+ const tmpState = pFixtures.StateGraph;
20
+ const tmpAllPits = libCommon.distinctStrings(tmpState.map((pRow) => pRow.PitNumber));
21
+ const tmpProductA = pFixtures.UniquePitProduct;
22
+ const tmpProductB = pFixtures.ProductElsewhere;
23
+ const tmpProductC = tmpState.find((pRow) => (pRow.Gsb !== undefined) && (pRow.IDProduct !== tmpProductA.IDProduct) && (pRow.IDProduct !== tmpProductB.IDProduct) && (pRow.Site !== tmpProductA.Site) && (pRow.Site !== tmpProductB.Site));
24
+ const tmpHasSelect = (pColumn) => pSelectColumns.indexOf(pColumn) >= 0;
25
+ const fRowMatches = (pRow, pProduct) => pRow && (String(pRow.Data.Material) === String(pProduct.IDProduct)) && (pRow.Data.Site === pProduct.Site) && (String(pRow.Data.PitNumber) === String(pProduct.PitNumber)) && ((pProduct.Gsb === undefined) ? ((pRow.Data.Gsb === undefined) || (pRow.Data.Gsb === '')) : (Number(pRow.Data.Gsb) === Number(pProduct.Gsb)));
26
+ const fSummaryHas = (pSnapshot, pProduct) => (pProduct.Gsb === undefined) || (String(pSnapshot.Probe[SUMMARY_ADDRESS] || '').split(',').indexOf(String(pProduct.Gsb)) >= 0);
27
+ const fIntegrity = (pResults, pGraph) => libCommon.integrityChecks(pResults, pGraph, pSelectColumns, tmpCan('Integrity'));
28
+
29
+ const tmpScenarios = [];
30
+
31
+ tmpScenarios.push(
32
+ {
33
+ Name: 'product-first',
34
+ Script:
35
+ [
36
+ { Action: 'choose', Row: 1, Column: 'Material', Value: String(tmpProductB.IDProduct), SettleMs: 0, Label: 'choose product' },
37
+ { Action: 'snapshot', Label: 'immediate' },
38
+ { Action: 'wait', Ms: 600 },
39
+ { Action: 'snapshot', Label: 'settled' },
40
+ ],
41
+ checks: (pResults, pFixtures2, pGraph) =>
42
+ {
43
+ const tmpImmediate = libCommon.snapshot(pResults, 'immediate');
44
+ const tmpSettled = libCommon.snapshot(pResults, 'settled');
45
+ return (
46
+ [
47
+ libCommon.check('choosing a product fills its Site, Pit and Gsb into that row', fRowMatches(tmpSettled.Rows[1], tmpProductB), tmpSettled.Rows[1].Data, tmpCan('AutofillFromProduct')),
48
+ libCommon.check('the fill is in place in the same solve (no lag)', fRowMatches(tmpImmediate.Rows[1], tmpProductB), tmpImmediate.Rows[1].Data, tmpCan('NoLag')),
49
+ libCommon.check('the form-level summary sees the new row values in the same solve', fSummaryHas(tmpImmediate, tmpProductB), tmpImmediate.Probe, tmpCan('NoLag')),
50
+ libCommon.check('the summary is right once settled', fSummaryHas(tmpSettled, tmpProductB), tmpSettled.Probe, tmpCan('AutofillFromProduct')),
51
+ libCommon.check('other rows are untouched', [ 0, 2, 3 ].every((pIndex) => !tmpSettled.Rows[pIndex].Data.Material && !tmpSettled.Rows[pIndex].Data.Site), [ 0, 2, 3 ].map((pIndex) => tmpSettled.Rows[pIndex].Data), tmpCan('RowIsolation')),
52
+ ].concat(fIntegrity(pResults, pGraph)));
53
+ }
54
+ });
55
+
56
+ if (tmpHasSelect('Site'))
57
+ {
58
+ tmpScenarios.push(
59
+ {
60
+ Name: 'site-first',
61
+ Script:
62
+ [
63
+ { Action: 'choose', Row: 0, Column: 'Site', Value: pFixtures.MultiPitSite, Label: 'choose site' },
64
+ { Action: 'snapshot', Label: 'site' },
65
+ { Action: 'choose', Row: 0, Column: 'PitNumber', Value: pFixtures.UniquePit, Label: 'choose pit' },
66
+ { Action: 'snapshot', Label: 'pit' },
67
+ ],
68
+ checks: (pResults, pFixtures2, pGraph) =>
69
+ {
70
+ const tmpSite = libCommon.snapshot(pResults, 'site');
71
+ const tmpPit = libCommon.snapshot(pResults, 'pit');
72
+ const tmpProductsAtSite = libCommon.matching(tmpState, { Site: pFixtures.MultiPitSite }).map((pRow) => pRow.IDProduct);
73
+ return (
74
+ [
75
+ libCommon.check('the Pit list narrows to the pits at the chosen Site', libCommon.sameSet(tmpSite.Rows[0].Options.PitNumber, pFixtures.PitsOfMultiPitSite), { Offered: tmpSite.Rows[0].Options.PitNumber, Expected: pFixtures.PitsOfMultiPitSite }, tmpCan('NarrowByRow')),
76
+ libCommon.check('the Product list narrows to the products at the chosen Site', libCommon.sameSet(tmpSite.Rows[0].Options.Material, tmpProductsAtSite), { Offered: (tmpSite.Rows[0].Options.Material || []).length, Expected: tmpProductsAtSite.length }, tmpCan('NarrowByRow')),
77
+ libCommon.check('another row\'s Pit list is not narrowed by this row', libCommon.sameSet(tmpSite.Rows[1].Options.PitNumber, tmpAllPits), { Offered: (tmpSite.Rows[1].Options.PitNumber || []).length, Expected: tmpAllPits.length }, tmpCan('RowIsolation')),
78
+ libCommon.check('a Pit with exactly one product at that Site fills the product', fRowMatches(tmpPit.Rows[0], tmpProductA), tmpPit.Rows[0].Data, tmpCan('AutofillUnique')),
79
+ libCommon.check('the summary sees the filled product in the same solve', fSummaryHas(tmpPit, tmpProductA), tmpPit.Probe, tmpCan('AutofillUnique')),
80
+ ].concat(fIntegrity(pResults, pGraph)));
81
+ }
82
+ });
83
+ }
84
+
85
+ if (tmpHasSelect('Site') && pFixtures.MultiProductPit)
86
+ {
87
+ tmpScenarios.push(
88
+ {
89
+ Name: 'pit-with-several-products',
90
+ Script:
91
+ [
92
+ { Action: 'choose', Row: 2, Column: 'PitNumber', Value: pFixtures.MultiProductPit, Label: 'choose pit' },
93
+ { Action: 'snapshot', Label: 'pit' },
94
+ ],
95
+ checks: (pResults, pFixtures2, pGraph) =>
96
+ {
97
+ const tmpPit = libCommon.snapshot(pResults, 'pit');
98
+ const tmpProducts = libCommon.matching(tmpState, { PitNumber: pFixtures.MultiProductPit });
99
+ const tmpSites = libCommon.distinctStrings(tmpProducts.map((pRow) => pRow.Site));
100
+ return (
101
+ [
102
+ libCommon.check('an ambiguous Pit leaves the product blank', !tmpPit.Rows[2].Data.Material, tmpPit.Rows[2].Data, tmpCan('AutofillUnique')),
103
+ libCommon.check('the Product list narrows to that Pit\'s products', libCommon.sameSet(tmpPit.Rows[2].Options.Material, tmpProducts.map((pRow) => pRow.IDProduct)), { Offered: (tmpPit.Rows[2].Options.Material || []).length, Expected: tmpProducts.length }, tmpCan('NarrowByRow')),
104
+ libCommon.check((tmpSites.length === 1) ? 'a Pit found at exactly one Site fills the Site' : 'a Pit found at several Sites leaves the Site blank', (tmpSites.length === 1) ? (tmpPit.Rows[2].Data.Site === tmpSites[0]) : !tmpPit.Rows[2].Data.Site, tmpPit.Rows[2].Data, tmpCan('AutofillUnique')),
105
+ ].concat(fIntegrity(pResults, pGraph)));
106
+ }
107
+ });
108
+ }
109
+
110
+ tmpScenarios.push(
111
+ {
112
+ Name: 'change-site-after-product',
113
+ Script: tmpHasSelect('Site') ?
114
+ [
115
+ { Action: 'choose', Row: 0, Column: 'Material', Value: String(tmpProductA.IDProduct), Label: 'choose product' },
116
+ { Action: 'wait', Ms: 400 },
117
+ { Action: 'choose', Row: 0, Column: 'Site', Value: pFixtures.OtherSite, Label: 'change site' },
118
+ { Action: 'wait', Ms: 400 },
119
+ { Action: 'snapshot', Label: 'changed' },
120
+ ] :
121
+ [
122
+ { Action: 'choose', Row: 0, Column: 'Material', Value: String(tmpProductA.IDProduct), Label: 'choose product' },
123
+ { Action: 'wait', Ms: 400 },
124
+ { Action: 'choose', Row: 0, Column: 'Material', Value: String(tmpProductB.IDProduct), Label: 'change product' },
125
+ { Action: 'wait', Ms: 400 },
126
+ { Action: 'snapshot', Label: 'changed' },
127
+ ],
128
+ checks: (pResults, pFixtures2, pGraph) =>
129
+ {
130
+ const tmpChanged = libCommon.snapshot(pResults, 'changed');
131
+ const tmpRow = tmpChanged.Rows[0].Data;
132
+ const tmpChecks = [];
133
+ if (tmpHasSelect('Site'))
134
+ {
135
+ tmpChecks.push(libCommon.check('changing the Site keeps the new Site and drops the product that is not there', (tmpRow.Site === pFixtures.OtherSite) && (!tmpRow.Material || (libCommon.matching(tmpState, { Site: tmpRow.Site, IDProduct: tmpRow.Material }).length > 0)), tmpRow, tmpCan('ClearOnChange')));
136
+ }
137
+ else
138
+ {
139
+ tmpChecks.push(libCommon.check('changing the product re-derives Site, Pit and Gsb', fRowMatches(tmpChanged.Rows[0], tmpProductB), tmpRow, tmpCan('AutofillFromProduct')));
140
+ }
141
+ return tmpChecks.concat(fIntegrity(pResults, pGraph));
142
+ }
143
+ });
144
+
145
+ tmpScenarios.push(
146
+ {
147
+ Name: 'delete-row',
148
+ Script:
149
+ [
150
+ { Action: 'addRow' },
151
+ { Action: 'wait', Ms: 100 },
152
+ { Action: 'choose', Row: 0, Column: 'Material', Value: String(tmpProductA.IDProduct) },
153
+ { Action: 'wait', Ms: 400 },
154
+ { Action: 'choose', Row: 1, Column: 'Material', Value: String(tmpProductB.IDProduct) },
155
+ { Action: 'wait', Ms: 400 },
156
+ { Action: 'choose', Row: 2, Column: 'Material', Value: String(tmpProductC.IDProduct) },
157
+ { Action: 'wait', Ms: 400 },
158
+ { Action: 'deleteRow', Row: 0 },
159
+ { Action: 'wait', Ms: 200 },
160
+ { Action: 'snapshot', Label: 'deleted' },
161
+ { Action: 'choose', Row: 2, Column: 'Material', Value: String(tmpProductA.IDProduct), Label: 'choose after delete' },
162
+ { Action: 'wait', Ms: 600 },
163
+ { Action: 'snapshot', Label: 'after' },
164
+ ],
165
+ checks: (pResults, pFixtures2, pGraph) =>
166
+ {
167
+ const tmpDeleted = libCommon.snapshot(pResults, 'deleted');
168
+ const tmpAfter = libCommon.snapshot(pResults, 'after');
169
+ return (
170
+ [
171
+ libCommon.check('rows shift up intact after a delete', fRowMatches(tmpDeleted.Rows[0], tmpProductB) && fRowMatches(tmpDeleted.Rows[1], tmpProductC), tmpDeleted.Rows.map((pRow) => pRow.Data), tmpCan('AutofillFromProduct')),
172
+ libCommon.check('a pick after the delete fills the row it was made in', fRowMatches(tmpAfter.Rows[2], tmpProductA), tmpAfter.Rows[2].Data, tmpCan('RowIdentity')),
173
+ libCommon.check('...and leaves the other rows alone', fRowMatches(tmpAfter.Rows[0], tmpProductB) && fRowMatches(tmpAfter.Rows[1], tmpProductC), [ tmpAfter.Rows[0].Data, tmpAfter.Rows[1].Data ], tmpCan('RowIdentity')),
174
+ ].concat(fIntegrity(pResults, pGraph)));
175
+ }
176
+ });
177
+
178
+ if (pFixtures.ExpiredProduct)
179
+ {
180
+ const tmpExpired = pFixtures.ExpiredProduct;
181
+ const tmpSavedRows =
182
+ [
183
+ { Material: String(tmpExpired.IDProduct), Site: tmpExpired.Metadata.Current.Site, PitNumber: tmpExpired.Metadata.PitNumber, BlendPct: '40.0', Gsb: '2.500', DesignYear: 2019 },
184
+ { Material: String(tmpProductB.IDProduct), Site: tmpProductB.Site, PitNumber: tmpProductB.PitNumber, BlendPct: '60.0' },
185
+ {}, {},
186
+ ];
187
+ tmpScenarios.push(
188
+ {
189
+ Name: 'saved-document-with-expired-product',
190
+ AppData: libCommon.appData(tmpSavedRows),
191
+ Script:
192
+ [
193
+ { Action: 'snapshot', Label: 'opened' },
194
+ { Action: 'choose', Row: 2, Column: 'Material', Value: String(tmpProductA.IDProduct), Label: 'edit another row' },
195
+ { Action: 'wait', Ms: 600 },
196
+ { Action: 'snapshot', Label: 'edited' },
197
+ ],
198
+ checks: (pResults, pFixtures2, pGraph) =>
199
+ {
200
+ const tmpOpened = libCommon.snapshot(pResults, 'opened');
201
+ const tmpEdited = libCommon.snapshot(pResults, 'edited');
202
+ const tmpRow = tmpEdited.Rows[0];
203
+ return (
204
+ [
205
+ libCommon.check('the expired product still shows on the saved row', !tmpHasSelect('Material') || (String(tmpOpened.Rows[0].Shown.Material) === String(tmpExpired.IDProduct)), tmpOpened.Rows[0], tmpCan('SavedValues')),
206
+ libCommon.check('the saved row keeps its product, Site and Pit after other edits', (String(tmpRow.Data.Material) === String(tmpExpired.IDProduct)) && (tmpRow.Data.Site === tmpExpired.Metadata.Current.Site), tmpRow.Data, tmpCan('SavedValues')),
207
+ libCommon.check('values carried at save time are kept, not re-derived from today\'s catalog', (String(tmpRow.Data.Gsb) === '2.500') && (String(tmpRow.Data.DesignYear) === '2019'), tmpRow.Data, tmpCan('SnapshotCarry')),
208
+ ].concat(fIntegrity(pResults, pGraph)));
209
+ }
210
+ });
211
+ }
212
+
213
+ tmpScenarios.push(
214
+ {
215
+ Name: 'clear-product',
216
+ Script:
217
+ [
218
+ { Action: 'choose', Row: 0, Column: 'Material', Value: String(tmpProductA.IDProduct) },
219
+ { Action: 'wait', Ms: 400 },
220
+ { Action: 'choose', Row: 0, Column: 'Material', Value: '', Label: 'clear product' },
221
+ { Action: 'wait', Ms: 400 },
222
+ { Action: 'snapshot', Label: 'cleared' },
223
+ ],
224
+ checks: (pResults, pFixtures2, pGraph) =>
225
+ {
226
+ const tmpRow = libCommon.snapshot(pResults, 'cleared').Rows[0].Data;
227
+ return (
228
+ [
229
+ libCommon.check('a cleared product stays cleared', !tmpRow.Material, tmpRow, tmpCan('Clear')),
230
+ libCommon.check('...and its carried values go with it', !tmpRow.Gsb && !tmpRow.DesignYear && !tmpRow.Producer, tmpRow, tmpCan('Clear')),
231
+ ].concat(fIntegrity(pResults, pGraph)));
232
+ }
233
+ });
234
+
235
+ tmpScenarios.push(
236
+ {
237
+ Name: 'add-row',
238
+ Script:
239
+ [
240
+ { Action: 'addRow' },
241
+ { Action: 'wait', Ms: 200 },
242
+ { Action: 'snapshot', Label: 'added' },
243
+ { Action: 'choose', Row: 4, Column: 'Material', Value: String(tmpProductB.IDProduct) },
244
+ { Action: 'wait', Ms: 600 },
245
+ { Action: 'snapshot', Label: 'filled' },
246
+ ],
247
+ checks: (pResults, pFixtures2, pGraph) =>
248
+ {
249
+ const tmpAdded = libCommon.snapshot(pResults, 'added');
250
+ const tmpFilled = libCommon.snapshot(pResults, 'filled');
251
+ return (
252
+ [
253
+ libCommon.check('a new row offers the state\'s products', (tmpAdded.Rows[4] && (tmpAdded.Rows[4].Options.Material || []).length) >= tmpState.length, tmpAdded.Rows[4] && (tmpAdded.Rows[4].Options.Material || []).length, tmpCan('AddRow')),
254
+ libCommon.check('a new row fills like any other', fRowMatches(tmpFilled.Rows[4], tmpProductB), tmpFilled.Rows[4] && tmpFilled.Rows[4].Data, tmpCan('AddRow')),
255
+ ].concat(fIntegrity(pResults, pGraph)));
256
+ }
257
+ });
258
+
259
+ return tmpScenarios;
260
+ }
261
+
262
+ module.exports = { scenarios, SUMMARY_ADDRESS };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pict-section-form",
3
- "version": "1.3.14",
3
+ "version": "1.3.16",
4
4
  "description": "Pict dynamic forms",
5
5
  "main": "source/Pict-Section-Form.js",
6
6
  "directories": {
@@ -20,6 +20,7 @@
20
20
  "coverage": "npx quack coverage",
21
21
  "build": "npx quack build",
22
22
  "test": "npx quack test",
23
+ "test:injection": "node test/browser/Injection-Conformance-Harness-Runner.js",
23
24
  "lint": "eslint source/**",
24
25
  "types": "tsc -p ./tsconfig.build.json",
25
26
  "check": "tsc -p ./tsconfig.json --noEmit",
@@ -38,7 +39,7 @@
38
39
  "browser-env": "^3.3.0",
39
40
  "eslint": "^9.39.2",
40
41
  "jquery": "^4.0.0",
41
- "pict": "^1.0.387",
42
+ "pict": "^1.0.401",
42
43
  "pict-application": "^1.0.34",
43
44
  "pict-docuserve": "^1.4.19",
44
45
  "pict-service-commandlineutility": "^1.0.20",
@@ -51,10 +52,10 @@
51
52
  "fable-serviceproviderbase": "^3.0.19",
52
53
  "marked": "^4.3.0",
53
54
  "pict-provider": "^1.0.13",
54
- "pict-section-excalidraw": "^1.0.3",
55
- "pict-section-markdowneditor": "^1.0.19",
55
+ "pict-section-excalidraw": "^1.0.6",
56
+ "pict-section-markdowneditor": "^1.0.21",
56
57
  "pict-section-objecteditor": "^1.0.3",
57
- "pict-section-tuigrid": "^1.0.31",
58
+ "pict-section-tuigrid": "^1.0.32",
58
59
  "pict-template": "^1.0.15",
59
60
  "pict-view": "^1.0.68"
60
61
  },
@@ -70,6 +70,13 @@ class PictDynamicFormsSolverBehaviors extends libPictProvider
70
70
  + ' td.pict-tabular-column-highlight, th.pict-tabular-column-highlight { background-color: var(--pict-tabular-highlight-color, #FFF3CD) !important; }';
71
71
 
72
72
  this.solverOrdinalMap = {};
73
+ // An injected copy gating an ordinal must not gate the same ordinal in a sibling copy, so a gate set
74
+ // while solving a copy is recorded against that copy. A gate set by the form itself stays global,
75
+ // which is what a form that gates its own ordinals has always relied on.
76
+ /** @type {Record<string, Record<string, boolean>>} */
77
+ this.scopedSolverOrdinalMap = {};
78
+ /** @type {string} */
79
+ this.activeSolverScope = '';
73
80
 
74
81
  this.setCSSSnippets();
75
82
  }
@@ -286,13 +293,64 @@ class PictDynamicFormsSolverBehaviors extends libPictProvider
286
293
  return pArray.sort();
287
294
  }
288
295
 
296
+ /**
297
+ * The copy a view belongs to: the salt createDistinctManifest appended to its section hash, or an empty
298
+ * string for a section the form declares itself.
299
+ *
300
+ * @param {any} pView - A dynamic form view.
301
+ *
302
+ * @return {string} The scope gates set while solving that view are recorded against.
303
+ */
304
+ getViewSolverScope(pView)
305
+ {
306
+ const tmpSection = pView ? pView.sectionDefinition : undefined;
307
+ if (!tmpSection || !tmpSection.OriginalHash || !tmpSection.Hash || (tmpSection.Hash === tmpSection.OriginalHash))
308
+ {
309
+ return '';
310
+ }
311
+ return tmpSection.Hash.substring(tmpSection.OriginalHash.length + 1);
312
+ }
313
+
314
+ /**
315
+ * Records which copy's solvers are running, so a gate one of them sets lands on that copy.
316
+ *
317
+ * @param {string} pScope - A scope from getViewSolverScope.
318
+ *
319
+ * @return {string} The scope that was active before, to restore afterwards.
320
+ */
321
+ setActiveSolverScope(pScope)
322
+ {
323
+ const tmpPreviousScope = this.activeSolverScope;
324
+ this.activeSolverScope = pScope || '';
325
+ return tmpPreviousScope;
326
+ }
327
+
328
+ /**
329
+ * @param {number|string} pSolverOrdinal
330
+ * @param {boolean} pEnabled
331
+ */
332
+ writeSolverOrdinalGate(pSolverOrdinal, pEnabled)
333
+ {
334
+ const tmpOrdinalKey = `ORD-${pSolverOrdinal}`;
335
+ if (!this.activeSolverScope)
336
+ {
337
+ this.solverOrdinalMap[tmpOrdinalKey] = pEnabled;
338
+ return;
339
+ }
340
+ if (!this.scopedSolverOrdinalMap[this.activeSolverScope])
341
+ {
342
+ this.scopedSolverOrdinalMap[this.activeSolverScope] = {};
343
+ }
344
+ this.scopedSolverOrdinalMap[this.activeSolverScope][tmpOrdinalKey] = pEnabled;
345
+ }
346
+
289
347
  /**
290
348
  * @param {number|string} pSolverOrdinal
291
349
  * @param {boolean|string|number} pEnabled
292
350
  */
293
351
  setSolverOrdinalEnabled(pSolverOrdinal, pEnabled)
294
352
  {
295
- this.solverOrdinalMap[`ORD-${pSolverOrdinal}`] = pEnabled == true || pEnabled == '1';
353
+ this.writeSolverOrdinalGate(pSolverOrdinal, pEnabled == true || pEnabled == '1');
296
354
  }
297
355
 
298
356
  /**
@@ -300,7 +358,7 @@ class PictDynamicFormsSolverBehaviors extends libPictProvider
300
358
  */
301
359
  enableSolverOrdinal(pSolverOrdinal)
302
360
  {
303
- this.solverOrdinalMap[`ORD-${pSolverOrdinal}`] = true;
361
+ this.writeSolverOrdinalGate(pSolverOrdinal, true);
304
362
  }
305
363
 
306
364
  /**
@@ -308,18 +366,28 @@ class PictDynamicFormsSolverBehaviors extends libPictProvider
308
366
  */
309
367
  disableSolverOrdinal(pSolverOrdinal)
310
368
  {
311
- this.solverOrdinalMap[`ORD-${pSolverOrdinal}`] = false;
369
+ this.writeSolverOrdinalGate(pSolverOrdinal, false);
312
370
  }
313
371
 
314
372
  /**
315
373
  * @param {number|string} pSolveOrdinal
374
+ * @param {string} [pScope] - The copy being solved; without one only the form's own gates apply.
316
375
  *
317
376
  * @return {boolean}
318
377
  */
319
- checkSolverOrdinalEnabled(pSolveOrdinal)
378
+ checkSolverOrdinalEnabled(pSolveOrdinal, pScope)
320
379
  {
321
380
  let tmpOrdinalKey = `ORD-${pSolveOrdinal}`;
322
- return (!(tmpOrdinalKey in this.solverOrdinalMap)) || (this.solverOrdinalMap[tmpOrdinalKey] === true);
381
+ if ((tmpOrdinalKey in this.solverOrdinalMap) && (this.solverOrdinalMap[tmpOrdinalKey] !== true))
382
+ {
383
+ return false;
384
+ }
385
+ const tmpScopedGates = pScope ? this.scopedSolverOrdinalMap[pScope] : undefined;
386
+ if (tmpScopedGates && (tmpOrdinalKey in tmpScopedGates) && (tmpScopedGates[tmpOrdinalKey] !== true))
387
+ {
388
+ return false;
389
+ }
390
+ return true;
323
391
  }
324
392
 
325
393
  getSectionSelector(pSectionFormID)
@@ -20,6 +20,7 @@ const libInputTemplatedEntityLookup = require('./inputs/Pict-Provider-Input-Temp
20
20
  const libInputChart = require('./inputs/Pict-Provider-Input-Chart.js');
21
21
  const libInputTabularTriggerGroup = require('./inputs/Pict-Provider-Input-TabularTriggerGroup.js');
22
22
  const libInputObjectEditor = require('./inputs/Pict-Provider-Input-ObjectEditor.js');
23
+ const libInputFacetFilter = require('./inputs/Pict-Provider-Input-FacetFilter.js');
23
24
 
24
25
  /** @type {Record<string, any>} */
25
26
  const _DefaultProviderConfiguration = (
@@ -84,6 +85,7 @@ class PictDynamicSolver extends libPictProvider
84
85
  this.pict.addProviderSingleton('Pict-Input-Chart', libInputChart.default_configuration, libInputChart);
85
86
  this.pict.addProviderSingleton('Pict-Input-TabularTriggerGroup', libInputTabularTriggerGroup.default_configuration, libInputTabularTriggerGroup);
86
87
  this.pict.addProviderSingleton('Pict-Input-ObjectEditor', libInputObjectEditor.default_configuration, libInputObjectEditor);
88
+ this.pict.addProviderSingleton('Pict-Input-FacetFilter', libInputFacetFilter.default_configuration, libInputFacetFilter);
87
89
  }
88
90
 
89
91
  logSolveOutcome(pSolveOutcome)
@@ -307,10 +309,13 @@ class PictDynamicSolver extends libPictProvider
307
309
  this.log.trace(`DynamicSolver [${this.UUID}]::[${this.Hash}] [${pReason}] Solving ordinal ${tmpOrdinalKeys[i]}`);
308
310
  }
309
311
  let tmpOrdinalContainer = tmpOrdinalsToSolve[tmpOrdinalKeys[i]];
310
- let tmpExecuteOrdinal = this.pict.providers.DynamicFormSolverBehaviors.checkSolverOrdinalEnabled(tmpOrdinalKeys[i]);
312
+ const tmpAdhocScope = this.pict.providers.DynamicFormSolverBehaviors.getViewSolverScope(pView);
313
+ let tmpExecuteOrdinal = this.pict.providers.DynamicFormSolverBehaviors.checkSolverOrdinalEnabled(tmpOrdinalKeys[i], tmpAdhocScope);
311
314
  if (tmpExecuteOrdinal)
312
315
  {
316
+ const tmpPreviousScope = this.pict.providers.DynamicFormSolverBehaviors.setActiveSolverScope(tmpAdhocScope);
313
317
  this.executeAdhocSolvers(pView, tmpOrdinalContainer.AdhocSolvers, pReason, Number(tmpOrdinalKeys[i]), tmpSolveOutcome.SolverResultsMap);
318
+ this.pict.providers.DynamicFormSolverBehaviors.setActiveSolverScope(tmpPreviousScope);
314
319
  }
315
320
  }
316
321
 
@@ -399,6 +404,12 @@ class PictDynamicSolver extends libPictProvider
399
404
  {
400
405
  continue;
401
406
  }
407
+ const tmpGroupScope = this.pict.providers.DynamicFormSolverBehaviors.getViewSolverScope(tmpView);
408
+ if (tmpGroupScope && !this.pict.providers.DynamicFormSolverBehaviors.checkSolverOrdinalEnabled(tmpSolver.Ordinal, tmpGroupScope))
409
+ {
410
+ continue;
411
+ }
412
+ this.pict.providers.DynamicFormSolverBehaviors.setActiveSolverScope(tmpGroupScope);
402
413
 
403
414
  if (pPreventSolverCycles && tmpSolver.Expression.match(this._RunSolversRegex))
404
415
  {
@@ -449,6 +460,7 @@ class PictDynamicSolver extends libPictProvider
449
460
  tmpSolverReultsMap.ExecutedSolvers.push(tmpSolver);
450
461
  tmpSolver.EndTimeStamp = Date.now();
451
462
  }
463
+ this.pict.providers.DynamicFormSolverBehaviors.setActiveSolverScope('');
452
464
  }
453
465
 
454
466
  /**
@@ -472,6 +484,13 @@ class PictDynamicSolver extends libPictProvider
472
484
  {
473
485
  continue;
474
486
  }
487
+ // A gate an injected copy set applies to that copy's solvers, not to a sibling's at the same ordinal.
488
+ const tmpSectionScope = this.pict.providers.DynamicFormSolverBehaviors.getViewSolverScope(tmpView);
489
+ if (tmpSectionScope && !this.pict.providers.DynamicFormSolverBehaviors.checkSolverOrdinalEnabled(tmpSolver.Ordinal, tmpSectionScope))
490
+ {
491
+ continue;
492
+ }
493
+ this.pict.providers.DynamicFormSolverBehaviors.setActiveSolverScope(tmpSectionScope);
475
494
 
476
495
  if (pPreventSolverCycles && tmpSolver.Expression.match(this._RunSolversRegex))
477
496
  {
@@ -499,6 +518,7 @@ class PictDynamicSolver extends libPictProvider
499
518
  tmpSolverReultsMap.ExecutedSolvers.push(tmpSolver);
500
519
  tmpSolver.EndTimeStamp = +new Date();
501
520
  }
521
+ this.pict.providers.DynamicFormSolverBehaviors.setActiveSolverScope('');
502
522
  }
503
523
 
504
524
  /**
@@ -569,7 +589,7 @@ class PictDynamicSolver extends libPictProvider
569
589
  {
570
590
  this.pict.log.trace(`Running validation solver ordinal ${tmpSolver.Ordinal} [${tmpSolver.Expression}]`);
571
591
  }
572
- this.pict.ExpressionParser.solve(tmpSolver.Expression, tmpMarshalDestination, pSolverResultsMap, this.pict.manifest, this.pict.AppData);
592
+ this.pict.ExpressionParser.solve(tmpSolver.Expression, tmpMarshalDestination, pSolverResultsMap, this.pict.manifest, tmpMarshalDestination);
573
593
  }
574
594
  }
575
595