pict-section-recordset 1.0.24 → 1.0.27
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/example_applications/simple_entity/Simple-RecordSet-Application.js +172 -111
- package/package.json +7 -7
- package/source/application/Pict-Application-RecordSet.js +8 -0
- package/source/providers/RecordSet-Link-Manager.js +2 -2
- package/source/providers/RecordSet-RecordProvider-Base.js +9 -2
- package/source/providers/RecordSet-RecordProvider-MeadowEndpoints.js +116 -14
- package/source/services/RecordsSet-MetaController.js +41 -19
- package/source/templates/Pict-Template-FilterInstanceViews.js +222 -0
- package/source/templates/Pict-Template-FilterView.js +4 -2
- package/source/views/RecordSet-Filters.js +449 -0
- package/source/views/dashboard/RecordSet-Dashboard.js +65 -8
- package/source/views/filters/RecordSet-Filter-Base-Range.js +38 -0
- package/source/views/filters/RecordSet-Filter-Base.js +88 -0
- package/source/views/filters/RecordSet-Filter-DateMatch.js +56 -0
- package/source/views/filters/RecordSet-Filter-DateRange.js +75 -0
- package/source/views/filters/RecordSet-Filter-ExternalJoinDateMatch.js +55 -0
- package/source/views/filters/RecordSet-Filter-ExternalJoinDateRange.js +57 -0
- package/source/views/filters/RecordSet-Filter-ExternalJoinNumericMatch.js +54 -0
- package/source/views/filters/RecordSet-Filter-ExternalJoinNumericRange.js +57 -0
- package/source/views/filters/RecordSet-Filter-ExternalJoinStringMatch.js +45 -0
- package/source/views/filters/RecordSet-Filter-ExternalJoinStringRange.js +46 -0
- package/source/views/filters/RecordSet-Filter-InternalJoinDateMatch.js +55 -0
- package/source/views/filters/RecordSet-Filter-InternalJoinDateRange.js +57 -0
- package/source/views/filters/RecordSet-Filter-InternalJoinNumericMatch.js +55 -0
- package/source/views/filters/RecordSet-Filter-InternalJoinNumericRange.js +57 -0
- package/source/views/filters/RecordSet-Filter-InternalJoinStringMatch.js +45 -0
- package/source/views/filters/RecordSet-Filter-InternalJoinStringRange.js +46 -0
- package/source/views/filters/RecordSet-Filter-NumericMatch.js +55 -0
- package/source/views/filters/RecordSet-Filter-NumericRange.js +57 -0
- package/source/views/filters/RecordSet-Filter-StringMatch.js +45 -0
- package/source/views/filters/RecordSet-Filter-StringRange.js +46 -0
- package/source/views/filters/index.js +27 -0
- package/source/views/list/RecordSet-List.js +44 -6
- package/test/PictSectionRecordSet-RecordProvider-Meadow_tests.js +11 -0
- package/types/application/Pict-Application-RecordSet.d.ts.map +1 -1
- package/types/providers/RecordSet-DynamicRecordsetSolver.d.ts +6 -6
- package/types/providers/RecordSet-DynamicRecordsetSolver.d.ts.map +1 -1
- package/types/providers/RecordSet-Link-Manager.d.ts +3 -3
- package/types/providers/RecordSet-RecordProvider-Base.d.ts +9 -0
- package/types/providers/RecordSet-RecordProvider-Base.d.ts.map +1 -1
- package/types/providers/RecordSet-RecordProvider-MeadowEndpoints.d.ts +30 -4
- package/types/providers/RecordSet-RecordProvider-MeadowEndpoints.d.ts.map +1 -1
- package/types/services/RecordsSet-MetaController.d.ts +2 -2
- package/types/services/RecordsSet-MetaController.d.ts.map +1 -1
- package/types/templates/Pict-Template-FilterInstanceViews.d.ts +19 -0
- package/types/templates/Pict-Template-FilterInstanceViews.d.ts.map +1 -0
- package/types/templates/Pict-Template-FilterView.d.ts.map +1 -1
- package/types/views/RecordSet-Filters.d.ts +84 -0
- package/types/views/RecordSet-Filters.d.ts.map +1 -0
- package/types/views/dashboard/RecordSet-Dashboard.d.ts +4 -2
- package/types/views/dashboard/RecordSet-Dashboard.d.ts.map +1 -1
- package/types/views/filters/RecordSet-Filter-Base-Range.d.ts +5 -0
- package/types/views/filters/RecordSet-Filter-Base-Range.d.ts.map +1 -0
- package/types/views/filters/RecordSet-Filter-Base.d.ts +29 -0
- package/types/views/filters/RecordSet-Filter-Base.d.ts.map +1 -0
- package/types/views/filters/RecordSet-Filter-DateMatch.d.ts +9 -0
- package/types/views/filters/RecordSet-Filter-DateMatch.d.ts.map +1 -0
- package/types/views/filters/RecordSet-Filter-DateRange.d.ts +9 -0
- package/types/views/filters/RecordSet-Filter-DateRange.d.ts.map +1 -0
- package/types/views/filters/RecordSet-Filter-ExternalJoinDateMatch.d.ts +9 -0
- package/types/views/filters/RecordSet-Filter-ExternalJoinDateMatch.d.ts.map +1 -0
- package/types/views/filters/RecordSet-Filter-ExternalJoinDateRange.d.ts +9 -0
- package/types/views/filters/RecordSet-Filter-ExternalJoinDateRange.d.ts.map +1 -0
- package/types/views/filters/RecordSet-Filter-ExternalJoinNumericMatch.d.ts +9 -0
- package/types/views/filters/RecordSet-Filter-ExternalJoinNumericMatch.d.ts.map +1 -0
- package/types/views/filters/RecordSet-Filter-ExternalJoinNumericRange.d.ts +9 -0
- package/types/views/filters/RecordSet-Filter-ExternalJoinNumericRange.d.ts.map +1 -0
- package/types/views/filters/RecordSet-Filter-ExternalJoinStringMatch.d.ts +9 -0
- package/types/views/filters/RecordSet-Filter-ExternalJoinStringMatch.d.ts.map +1 -0
- package/types/views/filters/RecordSet-Filter-ExternalJoinStringRange.d.ts +9 -0
- package/types/views/filters/RecordSet-Filter-ExternalJoinStringRange.d.ts.map +1 -0
- package/types/views/filters/RecordSet-Filter-InternalJoinDateMatch.d.ts +9 -0
- package/types/views/filters/RecordSet-Filter-InternalJoinDateMatch.d.ts.map +1 -0
- package/types/views/filters/RecordSet-Filter-InternalJoinDateRange.d.ts +9 -0
- package/types/views/filters/RecordSet-Filter-InternalJoinDateRange.d.ts.map +1 -0
- package/types/views/filters/RecordSet-Filter-InternalJoinNumericMatch.d.ts +9 -0
- package/types/views/filters/RecordSet-Filter-InternalJoinNumericMatch.d.ts.map +1 -0
- package/types/views/filters/RecordSet-Filter-InternalJoinNumericRange.d.ts +9 -0
- package/types/views/filters/RecordSet-Filter-InternalJoinNumericRange.d.ts.map +1 -0
- package/types/views/filters/RecordSet-Filter-InternalJoinStringMatch.d.ts +9 -0
- package/types/views/filters/RecordSet-Filter-InternalJoinStringMatch.d.ts.map +1 -0
- package/types/views/filters/RecordSet-Filter-InternalJoinStringRange.d.ts +9 -0
- package/types/views/filters/RecordSet-Filter-InternalJoinStringRange.d.ts.map +1 -0
- package/types/views/filters/RecordSet-Filter-NumericMatch.d.ts +9 -0
- package/types/views/filters/RecordSet-Filter-NumericMatch.d.ts.map +1 -0
- package/types/views/filters/RecordSet-Filter-NumericRange.d.ts +9 -0
- package/types/views/filters/RecordSet-Filter-NumericRange.d.ts.map +1 -0
- package/types/views/filters/RecordSet-Filter-StringMatch.d.ts +9 -0
- package/types/views/filters/RecordSet-Filter-StringMatch.d.ts.map +1 -0
- package/types/views/filters/RecordSet-Filter-StringRange.d.ts +9 -0
- package/types/views/filters/RecordSet-Filter-StringRange.d.ts.map +1 -0
- package/types/views/filters/index.d.ts +20 -0
- package/types/views/filters/index.d.ts.map +1 -0
- package/types/views/list/RecordSet-List.d.ts +12 -2
- package/types/views/list/RecordSet-List.d.ts.map +1 -1
- package/source/views/RecordSet-Filter.js +0 -159
- package/types/views/RecordSet-Filter.d.ts +0 -39
- package/types/views/RecordSet-Filter.d.ts.map +0 -1
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
const libPictRecordSet = require('../../source/Pict-Section-RecordSet.js');
|
|
2
|
-
//const libPictSectionForm = require('pict-section-recordset');
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
class SimpleApplication extends libPictRecordSet.PictRecordSetApplication
|
|
4
|
+
{
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
module.exports = SimpleApplication;
|
|
5
8
|
|
|
6
9
|
module.exports.default_configuration.pict_configuration = (
|
|
7
10
|
{
|
|
@@ -175,133 +178,191 @@ module.exports.default_configuration.pict_configuration = (
|
|
|
175
178
|
},
|
|
176
179
|
}
|
|
177
180
|
},
|
|
178
|
-
"
|
|
181
|
+
"Filters":
|
|
182
|
+
{
|
|
183
|
+
"ExternalJoinBookByAuthor":
|
|
184
|
+
{
|
|
185
|
+
"Type": "ExternalJoinStringMatch",
|
|
186
|
+
"ExternalFilterByColumns": [ "Name" ],
|
|
187
|
+
|
|
188
|
+
"CoreConnectionColumn": "IDBook",
|
|
189
|
+
|
|
190
|
+
"JoinTable": "BookAuthorJoin",
|
|
191
|
+
"JoinTableExternalConnectionColumn": "IDAuthor",
|
|
192
|
+
"JoinTableCoreConnectionColumn": "IDBook",
|
|
193
|
+
|
|
194
|
+
"ExternalFilterByTable": "Author",
|
|
195
|
+
"ExternalFilterByTableConnectionColumn": "IDAuthor"
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
"FilterCriteria":
|
|
199
|
+
{
|
|
200
|
+
"FilterRecordsetByBookAndCreateDate":
|
|
179
201
|
[
|
|
180
202
|
{
|
|
181
|
-
"
|
|
203
|
+
"FilterDefinitionHash": "ExternalJoinBookByAuthor",
|
|
204
|
+
"FilterByColumn": "IDBook"
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"Type": "DateRange",
|
|
208
|
+
"FilterByColumn": "CreateDate"
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"Type": "StringMatch",
|
|
212
|
+
"FilterByColumn": "Genre"
|
|
213
|
+
}
|
|
214
|
+
],
|
|
215
|
+
"FilterRecordsetByTitle":
|
|
216
|
+
[
|
|
217
|
+
{
|
|
218
|
+
"Type": "StringMatch",
|
|
219
|
+
"FilterByColumn": "Title"
|
|
220
|
+
},
|
|
221
|
+
]
|
|
222
|
+
},
|
|
182
223
|
|
|
183
|
-
|
|
184
|
-
|
|
224
|
+
"DefaultRecordSetConfigurations":
|
|
225
|
+
[
|
|
226
|
+
{
|
|
227
|
+
"RecordSet": "Book",
|
|
185
228
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
229
|
+
"RecordSetType": "MeadowEndpoint", // Could be "Custom" which would require a provider to already be created for the record set.
|
|
230
|
+
"RecordSetMeadowEntity": "Book", // This leverages the /Schema endpoint to get the record set columns.
|
|
231
|
+
|
|
232
|
+
"RecordSetListColumns": [
|
|
233
|
+
{
|
|
234
|
+
"Key": "Title",
|
|
235
|
+
"DisplayName": "Title"
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"Key": "Genre",
|
|
239
|
+
"DisplayName": "Genre"
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"Key": "ISBN",
|
|
243
|
+
"DisplayName": "Int'l SBN"
|
|
244
|
+
}
|
|
245
|
+
],
|
|
246
|
+
|
|
247
|
+
"FilterExperiences":
|
|
248
|
+
{
|
|
249
|
+
"FilterByAuthorAndCreateDate":
|
|
250
|
+
{
|
|
251
|
+
"Ordinal": 1,
|
|
252
|
+
"FilterCriteriaHash": "FilterRecordsetByBookAndCreateDate",
|
|
253
|
+
"Default": true
|
|
254
|
+
},
|
|
255
|
+
"FilterByTitle":
|
|
256
|
+
{
|
|
257
|
+
"Ordinal": 2,
|
|
258
|
+
"FilterCriteriaHash": "FilterRecordsetByTitle"
|
|
259
|
+
}
|
|
260
|
+
},
|
|
200
261
|
|
|
201
|
-
|
|
262
|
+
"RecordSetListManifestOnly": false,
|
|
202
263
|
|
|
203
|
-
|
|
204
|
-
|
|
264
|
+
"RecordSetListManifests": [ "Bestsellers", "Underdogs", "NewReleases" ],
|
|
265
|
+
"RecordSetDashboardManifests": [ "Bestsellers" ],
|
|
205
266
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
267
|
+
"RecordSetListHasExtraColumns": true,
|
|
268
|
+
"RecordSetListExtraColumnsHeaderTemplate": "<th style=\"border-bottom: 1px solid #ccc; padding: 5px; background-color: #f2f2f2; color: #333;\">Cover</th>",
|
|
269
|
+
"RecordSetListExtraColumnRowTemplate": "<td><img src=\"{~D:Record.Data.ImageURL~}\"></td>",
|
|
209
270
|
|
|
210
|
-
|
|
271
|
+
"SearchFields": [ "Title" ],
|
|
211
272
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
273
|
+
"RecordSetFilterURLTemplate-Default": "/PSRS/{~D:Record.RecordSet~}/List/FilteredTo/{~D:Record.FilterString~}",
|
|
274
|
+
"RecordSetFilterURLTemplate-List": "/PSRS/{~D:Record.RecordSet~}/List/FilteredTo/{~D:Record.FilterString~}",
|
|
275
|
+
"RecordSetFilterURLTemplate-Dashboard": "/PSRS/{~D:Record.RecordSet~}/Dashboard/FilteredTo/{~D:Record.FilterString~}",
|
|
215
276
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
277
|
+
"RecordSetURLPrefix": "/1.0/"
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
"RecordSet": "BookstoreInventory",
|
|
281
|
+
"Title": "Bookstore Inventory",
|
|
221
282
|
|
|
222
|
-
|
|
223
|
-
|
|
283
|
+
"RecordSetType": "MeadowEndpoint", // Could be "Custom" which would require a provider to already be created for the record set.
|
|
284
|
+
"RecordSetMeadowEntity": "Book", // This leverages the /Schema endpoint to get the record set columns.
|
|
224
285
|
|
|
225
|
-
|
|
286
|
+
"RecordSetListManifestOnly": true,
|
|
226
287
|
|
|
227
|
-
|
|
288
|
+
"RecordSetDashboardManifests": [ "Bestsellers", "Underdogs", "NewReleases" ],
|
|
228
289
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
290
|
+
"RecordDecorationConfiguration":
|
|
291
|
+
[
|
|
292
|
+
{
|
|
293
|
+
"Entity": "BookAuthorJoin",
|
|
294
|
+
"Filter": "FBL~IDBook~INN~{~PJU:,^IDBook^Record.State.CoreEntityRecordSubset~}",
|
|
295
|
+
"Destination": "State.BookAuthorJoins"
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
"Entity": "Author",
|
|
299
|
+
"Filter": "FBL~IDAuthor~INN~{~PJU:,^IDAuthor^Record.State.BookAuthorJoins~}",
|
|
300
|
+
"Destination": "State.Authors"
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
"Type": "MapJoin",
|
|
304
|
+
"DestinationRecordSetAddress": "State.CoreEntityRecordSubset",
|
|
305
|
+
"DestinationJoinValue": "IDBook",
|
|
306
|
+
"JoinJoinValueLHS": "IDBook",
|
|
307
|
+
"Joins": "State.BookAuthorJoins",
|
|
308
|
+
"JoinJoinValueRHS": "IDAuthor",
|
|
309
|
+
"JoinRecordSetAddress": "State.Authors",
|
|
310
|
+
"JoinValue": "IDAuthor",
|
|
311
|
+
"RecordDestinationAddress": "Authors"
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
"Entity": "BookAuthorJoin",
|
|
315
|
+
"Filter": "FBL~IDAuthor~INN~{~PJU:,^IDAuthor^Record.State.Authors~}",
|
|
316
|
+
"Destination": "State.BookAuthorJoinsRev"
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
"Entity": "Book",
|
|
320
|
+
"Filter": "FBL~IDBook~INN~{~PJU:,^IDBook^Record.State.BookAuthorJoinsRev~}",
|
|
321
|
+
"Destination": "State.BooksForAuthors"
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
"Type": "MapJoin",
|
|
325
|
+
"DestinationRecordSetAddress": "State.Authors",
|
|
326
|
+
"DestinationJoinValue": "IDAuthor",
|
|
327
|
+
"JoinJoinValueLHS": "IDAuthor",
|
|
328
|
+
"Joins": "State.BookAuthorJoinsRev",
|
|
329
|
+
"JoinJoinValueRHS": "IDBook",
|
|
330
|
+
"JoinRecordSetAddress": "State.BooksForAuthors",
|
|
331
|
+
"JoinValue": "IDBook",
|
|
332
|
+
"RecordDestinationAddress": "Books"
|
|
333
|
+
}
|
|
334
|
+
],
|
|
335
|
+
"AvailableVerbs": [ "Dashboard" ],
|
|
275
336
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
337
|
+
"RecordSetListHasExtraColumns": true,
|
|
338
|
+
"RecordSetListExtraColumnsHeaderTemplate": "<th style=\"border-bottom: 1px solid #ccc; padding: 5px; background-color: #f2f2f2; color: #333;\">Cover</th>",
|
|
339
|
+
"RecordSetListExtraColumnRowTemplate": "<td><img src=\"{~D:Record.Data.ImageURL~}\"></td>",
|
|
279
340
|
|
|
280
|
-
|
|
341
|
+
"SearchFields": [ "Title" ],
|
|
281
342
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
343
|
+
"RecordSetFilterURLTemplate-Default": "/PSRS/{~D:Record.RecordSet~}/List/FilteredTo/{~D:Record.FilterString~}",
|
|
344
|
+
"RecordSetFilterURLTemplate-List": "/PSRS/{~D:Record.RecordSet~}/List/FilteredTo/{~D:Record.FilterString~}",
|
|
345
|
+
"RecordSetFilterURLTemplate-Dashboard": "/PSRS/{~D:Record.RecordSet~}/Dashboard/FilteredTo/{~D:Record.FilterString~}",
|
|
346
|
+
//TODO: something like this to reduce boilerplate
|
|
347
|
+
"RecordSetFilterURLTemplate-Dashboard-Specific": "/PSRS/{~D:Record.RecordSet~}/SpecificDashboard/$$DASHBOARD_HASH$$/FilteredTo/{~D:Record.FilterString~}",
|
|
348
|
+
"RecordSetFilterURLTemplate-Dashboard-Bestsellers": "/PSRS/{~D:Record.RecordSet~}/SpecificDashboard/Bestsellers/FilteredTo/{~D:Record.FilterString~}",
|
|
349
|
+
"RecordSetFilterURLTemplate-Dashboard-Underdogs": "/PSRS/{~D:Record.RecordSet~}/SpecificDashboard/Underdogs/FilteredTo/{~D:Record.FilterString~}",
|
|
350
|
+
"RecordSetFilterURLTemplate-Dashboard-NewReleases": "/PSRS/{~D:Record.RecordSet~}/SpecificDashboard/NewReleases/FilteredTo/{~D:Record.FilterString~}",
|
|
290
351
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
352
|
+
"RecordSetURLPrefix": "/1.0/"
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
"RecordSet": "Author",
|
|
295
356
|
|
|
296
|
-
|
|
297
|
-
|
|
357
|
+
"RecordSetType": "MeadowEndpoint",
|
|
358
|
+
"RecordSetMeadowEntity": "Author",
|
|
298
359
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
360
|
+
"RecordSetURLPrefix": "/1.0/"
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
"RecordSet": "RandomizedValues",
|
|
303
364
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
365
|
+
"RecordSetType": "Custom" // This means the `PS-RSP-RandomizedValues` provider will be checked for to get records.
|
|
366
|
+
}
|
|
367
|
+
]
|
|
368
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pict-section-recordset",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.27",
|
|
4
4
|
"description": "Pict dynamic record set management views",
|
|
5
5
|
"main": "source/Pict-Section-RecordSet.js",
|
|
6
6
|
"directories": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"coverage": "npx nyc --reporter=lcov --reporter=text-lcov npx mocha -- -u tdd -R spec",
|
|
21
21
|
"build": "npx quack build",
|
|
22
22
|
"test": "npx mocha -u tdd -R spec",
|
|
23
|
-
"lint": "eslint source
|
|
23
|
+
"lint": "eslint source",
|
|
24
24
|
"types": "tsc -p tsconfig.build.json"
|
|
25
25
|
},
|
|
26
26
|
"types": "types/Pict-Section-RecordSet.d.ts",
|
|
@@ -33,19 +33,19 @@
|
|
|
33
33
|
"browser-env": "^3.3.0",
|
|
34
34
|
"eslint": "^9.28.0",
|
|
35
35
|
"jquery": "^3.7.1",
|
|
36
|
-
"pict": "^1.0.
|
|
36
|
+
"pict": "^1.0.288",
|
|
37
37
|
"pict-application": "^1.0.27",
|
|
38
38
|
"pict-service-commandlineutility": "^1.0.15",
|
|
39
|
-
"quackage": "^1.0.
|
|
39
|
+
"quackage": "^1.0.42",
|
|
40
40
|
"typescript": "^5.8.3"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"fable-serviceproviderbase": "^3.0.15",
|
|
44
44
|
"pict-provider": "^1.0.6",
|
|
45
45
|
"pict-router": "^1.0.4",
|
|
46
|
-
"pict-section-form": "^1.0.
|
|
47
|
-
"pict-template": "^1.0.
|
|
48
|
-
"pict-view": "^1.0.
|
|
46
|
+
"pict-section-form": "^1.0.106",
|
|
47
|
+
"pict-template": "^1.0.12",
|
|
48
|
+
"pict-view": "^1.0.62"
|
|
49
49
|
},
|
|
50
50
|
"mocha": {
|
|
51
51
|
"diff": true,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
const libPictApplication = require('pict-application');
|
|
2
|
+
const libPictSectionForm = require('pict-section-form');
|
|
2
3
|
|
|
3
4
|
const libPictSectionRecordSet = require('../Pict-Section-RecordSet.js');
|
|
4
5
|
const libDynamicSolver = require('../providers/RecordSet-DynamicRecordsetSolver.js');
|
|
6
|
+
const libPictDynamicFormDependencyManager = require('pict-section-form').PictDynamicFormDependencyManager;
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* Represents a PictSectionRecordSetApplication.
|
|
@@ -21,7 +23,13 @@ class PictSectionRecordSetApplication extends libPictApplication
|
|
|
21
23
|
this.pict;
|
|
22
24
|
// Add the pict recordset meta controller service
|
|
23
25
|
this.pict.addServiceType('PictSectionRecordSet', libPictSectionRecordSet);
|
|
26
|
+
//FIXME: this is probably wrong, but needed for now?
|
|
27
|
+
this.pict.addServiceType('PictSectionForm', libPictSectionForm);
|
|
28
|
+
|
|
24
29
|
this.fable.addProviderSingleton('DynamicRecordsetSolver', libDynamicSolver.default_configuration, libDynamicSolver);
|
|
30
|
+
|
|
31
|
+
// add the dependencies for dynamic controls
|
|
32
|
+
this.fable.addAndInstantiateSingletonService('PictDynamicFormDependencyManager', libPictDynamicFormDependencyManager.default_configuration, libPictDynamicFormDependencyManager);
|
|
25
33
|
}
|
|
26
34
|
|
|
27
35
|
onInitialize()
|
|
@@ -9,7 +9,7 @@ const _DEFAULT_PROVIDER_CONFIGURATION =
|
|
|
9
9
|
AutoInitializeOrdinal: 0
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
class
|
|
12
|
+
class PictRecordSetLinkManager extends libPictProvider
|
|
13
13
|
{
|
|
14
14
|
constructor(pFable, pOptions, pServiceHash)
|
|
15
15
|
{
|
|
@@ -49,5 +49,5 @@ class PictRecordSetRouter extends libPictProvider
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
module.exports =
|
|
52
|
+
module.exports = PictRecordSetLinkManager;
|
|
53
53
|
module.exports.default_configuration = _DEFAULT_PROVIDER_CONFIGURATION;
|
|
@@ -52,7 +52,7 @@ class RecordSetProviderBase extends libPictProvider
|
|
|
52
52
|
{
|
|
53
53
|
/**
|
|
54
54
|
* Creates an instance of RecordSetProvider.
|
|
55
|
-
* @param {import('
|
|
55
|
+
* @param {import('pict')} pFable - The Fable object.
|
|
56
56
|
* @param {Record<string, any>} [pOptions] - Custom options for the provider.
|
|
57
57
|
* @param {string} [pServiceHash] - The service hash.
|
|
58
58
|
*/
|
|
@@ -64,7 +64,7 @@ class RecordSetProviderBase extends libPictProvider
|
|
|
64
64
|
|
|
65
65
|
/** @type {Record<string, any>} */
|
|
66
66
|
this.options;
|
|
67
|
-
/** @type {import('
|
|
67
|
+
/** @type {import('pict')} */
|
|
68
68
|
this.fable;
|
|
69
69
|
/** @type {import('pict')} */
|
|
70
70
|
this.pict;
|
|
@@ -92,6 +92,13 @@ class RecordSetProviderBase extends libPictProvider
|
|
|
92
92
|
return { };
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
/*
|
|
96
|
+
get availableFilters()
|
|
97
|
+
{
|
|
98
|
+
return { IDBook: [ 'NumericMatch', 'NumericRange', 'ExternalJoinBookByAuthor' ], Title: [ 'StringMatch', 'StringRange' ] };
|
|
99
|
+
}
|
|
100
|
+
*/
|
|
101
|
+
|
|
95
102
|
/**
|
|
96
103
|
* Read records from the provider.
|
|
97
104
|
*
|
|
@@ -14,7 +14,7 @@ class MeadowEndpointsRecordSetProvider extends libRecordSetProviderBase
|
|
|
14
14
|
{
|
|
15
15
|
/**
|
|
16
16
|
* Creates an instance of RecordSetProvider.
|
|
17
|
-
* @param {import('
|
|
17
|
+
* @param {import('pict')} pFable - The Fable object.
|
|
18
18
|
* @param {Record<string, any>} [pOptions] - Custom options for the provider.
|
|
19
19
|
* @param {string} [pServiceHash] - The service hash.
|
|
20
20
|
*/
|
|
@@ -24,8 +24,6 @@ class MeadowEndpointsRecordSetProvider extends libRecordSetProviderBase
|
|
|
24
24
|
|
|
25
25
|
/** @type {Record<string, any>} */
|
|
26
26
|
this.options;
|
|
27
|
-
/** @type {import('fable')} */
|
|
28
|
-
this.fable;
|
|
29
27
|
/** @type {import('pict') & {
|
|
30
28
|
* log: any,
|
|
31
29
|
* services:
|
|
@@ -37,6 +35,7 @@ class MeadowEndpointsRecordSetProvider extends libRecordSetProviderBase
|
|
|
37
35
|
* PictSectionRecordSet: InstanceType<import('../Pict-Section-RecordSet.js')>
|
|
38
36
|
* }} */
|
|
39
37
|
this.pict;
|
|
38
|
+
this.fable = this.pict;
|
|
40
39
|
/** @type {string} */
|
|
41
40
|
this.Hash;
|
|
42
41
|
/** @type {string} */
|
|
@@ -44,6 +43,10 @@ class MeadowEndpointsRecordSetProvider extends libRecordSetProviderBase
|
|
|
44
43
|
//TODO: make this typedef better
|
|
45
44
|
/** @type {Record<string, any>} */
|
|
46
45
|
this._Schema = { };
|
|
46
|
+
/** @type {Record<string, Record<string, any>>} */
|
|
47
|
+
this._Experiences = { };
|
|
48
|
+
/** @type {Record<string, Record<string, any>>} */
|
|
49
|
+
this._FiltersByField = { };
|
|
47
50
|
}
|
|
48
51
|
|
|
49
52
|
/** @return {import('pict/types/source/Pict-Meadow-EntityProvider.js')} */
|
|
@@ -59,11 +62,6 @@ class MeadowEndpointsRecordSetProvider extends libRecordSetProviderBase
|
|
|
59
62
|
return this._EntityProvider;
|
|
60
63
|
}
|
|
61
64
|
|
|
62
|
-
/**
|
|
63
|
-
* @typedef {(error?: Error, result?: T) => void} RecordSetCallback
|
|
64
|
-
* @template T = Record<string, any>
|
|
65
|
-
*/
|
|
66
|
-
|
|
67
65
|
/**
|
|
68
66
|
* Get a record by its ID or GUID.
|
|
69
67
|
*
|
|
@@ -129,6 +127,25 @@ class MeadowEndpointsRecordSetProvider extends libRecordSetProviderBase
|
|
|
129
127
|
});
|
|
130
128
|
}
|
|
131
129
|
|
|
130
|
+
_prepareFilterState(pEntity, pOptions, pFilterExperienceResultAddress = 'Records')
|
|
131
|
+
{
|
|
132
|
+
const tmpClauses = [].concat(this.pict.Bundle._ActiveFilterState?.[pOptions.Entity || this.options.Entity]?.FilterClauses || []);
|
|
133
|
+
const tmpExperience = Object.assign({}, this.pict.Bundle._ActiveFilterState?.[pOptions.Entity || this.options.Entity]?.Experience || {});
|
|
134
|
+
if (!tmpExperience.ResultDestinationAddress)
|
|
135
|
+
{
|
|
136
|
+
tmpExperience.ResultDestinationAddress = `Bundle._ActiveFilterState[\`${this.options.RecordSet}\`].${pFilterExperienceResultAddress}`;
|
|
137
|
+
}
|
|
138
|
+
if (!tmpExperience.Entity)
|
|
139
|
+
{
|
|
140
|
+
tmpExperience.Entity = pEntity;
|
|
141
|
+
}
|
|
142
|
+
if (pOptions.FilterString && typeof pOptions.FilterString === 'string' && pOptions.FilterString.trim().length > 0)
|
|
143
|
+
{
|
|
144
|
+
tmpClauses.push({ Type: 'RawFilter', Value: pOptions.FilterString });
|
|
145
|
+
}
|
|
146
|
+
return [ tmpClauses, tmpExperience ];
|
|
147
|
+
}
|
|
148
|
+
|
|
132
149
|
/**
|
|
133
150
|
* Read records from the provider.
|
|
134
151
|
*
|
|
@@ -148,15 +165,16 @@ class MeadowEndpointsRecordSetProvider extends libRecordSetProviderBase
|
|
|
148
165
|
}
|
|
149
166
|
return new Promise((resolve, reject) =>
|
|
150
167
|
{
|
|
151
|
-
|
|
152
|
-
this.
|
|
168
|
+
const [ tmpClauses, tmpExperience ] = this._prepareFilterState(tmpEntity, pOptions);
|
|
169
|
+
this.pict.providers.FilterManager.loadRecordPageByFilter(tmpClauses, tmpExperience, pOptions.Offset || 0, pOptions.PageSize || 250, (pError) =>
|
|
153
170
|
{
|
|
154
171
|
if (pError)
|
|
155
172
|
{
|
|
156
173
|
return reject(pError);
|
|
157
174
|
}
|
|
158
|
-
resolve({ Records:
|
|
175
|
+
resolve({ Records: this.pict.resolveStateFromAddress(tmpExperience.ResultDestinationAddress), Facets: { } });
|
|
159
176
|
});
|
|
177
|
+
// using a space here, otherwise you get a `//` in the URL which breaks some stuff
|
|
160
178
|
});
|
|
161
179
|
}
|
|
162
180
|
|
|
@@ -192,13 +210,14 @@ class MeadowEndpointsRecordSetProvider extends libRecordSetProviderBase
|
|
|
192
210
|
//TODO: lite support / other variants?
|
|
193
211
|
return new Promise((resolve, reject) =>
|
|
194
212
|
{
|
|
195
|
-
this.
|
|
213
|
+
const [ tmpClauses, tmpExperience ] = this._prepareFilterState(tmpEntity, pOptions, 'Count');
|
|
214
|
+
this.pict.providers.FilterManager.countRecordsByFilter(tmpClauses, tmpExperience, (pError) =>
|
|
196
215
|
{
|
|
197
216
|
if (pError)
|
|
198
217
|
{
|
|
199
218
|
return reject(pError);
|
|
200
219
|
}
|
|
201
|
-
resolve({ Count:
|
|
220
|
+
resolve({ Count: this.pict.resolveStateFromAddress(tmpExperience.ResultDestinationAddress) });
|
|
202
221
|
});
|
|
203
222
|
});
|
|
204
223
|
}
|
|
@@ -331,6 +350,89 @@ class MeadowEndpointsRecordSetProvider extends libRecordSetProviderBase
|
|
|
331
350
|
* @param {(error?: Error) => void} fCallback - The callback function.
|
|
332
351
|
*/
|
|
333
352
|
onInitializeAsync(fCallback)
|
|
353
|
+
{
|
|
354
|
+
super.onInitializeAsync((pError) =>
|
|
355
|
+
{
|
|
356
|
+
if (this.options.FilterExperiences && typeof this.options.FilterExperiences === 'object' && !Array.isArray(this.options.FilterExperiences))
|
|
357
|
+
{
|
|
358
|
+
this.pict.Bundle._ActiveFilterState = this.pict.Bundle._ActiveFilterState || {};
|
|
359
|
+
this.pict.Bundle._ActiveFilterState[this.options.RecordSet] = this.pict.Bundle._ActiveFilterState[this.options.RecordSet] || {};
|
|
360
|
+
const tmpEntityFilterState = this.pict.Bundle._ActiveFilterState[this.options.RecordSet];
|
|
361
|
+
tmpEntityFilterState.Experience = tmpEntityFilterState.Experience || {};
|
|
362
|
+
for (const tmpKey of Object.keys(this.options.FilterExperiences))
|
|
363
|
+
{
|
|
364
|
+
const tmpExperience = this.options.FilterExperiences[tmpKey];
|
|
365
|
+
if (!tmpExperience.FilterCriteriaHash && !Array.isArray(tmpExperience.FilterClauses))
|
|
366
|
+
{
|
|
367
|
+
this.log.warn(`Filter experience ${tmpKey} has invalid Criteria`, { Experience: tmpExperience });
|
|
368
|
+
continue;
|
|
369
|
+
}
|
|
370
|
+
if (tmpExperience.FilterCriteriaHash)
|
|
371
|
+
{
|
|
372
|
+
// load from hash
|
|
373
|
+
const tmpClauses = this.pict.providers.FilterManager.getFilterCriteria(tmpExperience.FilterCriteriaHash);
|
|
374
|
+
if (!tmpClauses)
|
|
375
|
+
{
|
|
376
|
+
this.pict.log.warn(`Filter experience ${tmpKey} filter criteria hash ${tmpExperience.FilterCriteriaHash} not found`, { Experience: tmpExperience });
|
|
377
|
+
continue;
|
|
378
|
+
}
|
|
379
|
+
//TODO: handle Ordinal / generate if missing
|
|
380
|
+
this._Experiences[tmpKey] = JSON.parse(JSON.stringify(tmpExperience));
|
|
381
|
+
this._Experiences[tmpKey].FilterClauses = JSON.parse(JSON.stringify(tmpClauses));
|
|
382
|
+
for (const tmpClause of this._Experiences[tmpKey].FilterClauses)
|
|
383
|
+
{
|
|
384
|
+
tmpClause.FilterCriteriaHash = tmpExperience.FilterCriteriaHash;
|
|
385
|
+
if (!tmpClause.FilterByColumn && !tmpClause.CoreConnectionColumn && !tmpClause.JoinInternalConnectionColumn)
|
|
386
|
+
{
|
|
387
|
+
this.log.warn(`Filter experience ${tmpKey} clause does not have filter by column configured`, { Clause: tmpClause });
|
|
388
|
+
continue;
|
|
389
|
+
}
|
|
390
|
+
if (tmpClause.FilterDefinitionHash)
|
|
391
|
+
{
|
|
392
|
+
const tmpFilter = this.pict.providers.FilterManager.getFilter(tmpClause.FilterDefinitionHash);
|
|
393
|
+
if (!tmpFilter)
|
|
394
|
+
{
|
|
395
|
+
this.pict.log.warn(`Filter experience ${tmpKey} filter criteria hash ${tmpClause.FilterDefinitionHash} not found`, { Experience: tmpExperience });
|
|
396
|
+
continue;
|
|
397
|
+
}
|
|
398
|
+
Object.assign(tmpClause, tmpFilter); //TODO: is there a risk of leakage here?
|
|
399
|
+
if (tmpClause.FilterByColumn && typeof tmpClause.Type === 'string')
|
|
400
|
+
{
|
|
401
|
+
if (tmpClause.Type.startsWith('InternalJoin'))
|
|
402
|
+
{
|
|
403
|
+
tmpClause.JoinInternalConnectionColumn = tmpClause.FilterByColumn;
|
|
404
|
+
}
|
|
405
|
+
else if (tmpClause.Type.startsWith('ExternalJoin'))
|
|
406
|
+
{
|
|
407
|
+
tmpClause.CoreConnectionColumn = tmpClause.FilterByColumn;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
if (tmpExperience.Default && !tmpEntityFilterState.FilterClauses)
|
|
413
|
+
{
|
|
414
|
+
tmpEntityFilterState.FilterClauses = JSON.parse(JSON.stringify(this._Experiences[tmpKey].FilterClauses));
|
|
415
|
+
}
|
|
416
|
+
continue;
|
|
417
|
+
}
|
|
418
|
+
this._Experiences[tmpKey] = JSON.parse(JSON.stringify(tmpExperience));
|
|
419
|
+
if (tmpExperience.Default && !tmpEntityFilterState.FilterClauses)
|
|
420
|
+
{
|
|
421
|
+
tmpEntityFilterState.FilterClauses = JSON.parse(JSON.stringify(tmpExperience.FilterClauses));
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
this.initializeEntitySchema(() =>
|
|
426
|
+
{
|
|
427
|
+
return fCallback(pError);
|
|
428
|
+
});
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* @param {(error?: Error) => void} fCallback - The callback function.
|
|
434
|
+
*/
|
|
435
|
+
initializeEntitySchema(fCallback)
|
|
334
436
|
{
|
|
335
437
|
this.fable.log.info('Initializing RecordSetProvider-MeadowEndpoints');
|
|
336
438
|
const checkSession = this.pict.services.PictSectionRecordSet ? this.pict.services.PictSectionRecordSet.checkSession.bind(this.pict.services.PictSectionRecordSet) : async () => true;
|
|
@@ -361,7 +463,7 @@ class MeadowEndpointsRecordSetProvider extends libRecordSetProviderBase
|
|
|
361
463
|
{
|
|
362
464
|
if (!this._Schema)
|
|
363
465
|
{
|
|
364
|
-
await new Promise((resolve, reject) => this.
|
|
466
|
+
await new Promise((resolve, reject) => this.initializeEntitySchema((pError) =>
|
|
365
467
|
{
|
|
366
468
|
if (pError)
|
|
367
469
|
{
|