pict-section-recordset 1.0.24 → 1.0.26
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 +170 -110
- 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,13 @@
|
|
|
1
|
+
const { ajax } = require('jquery');
|
|
1
2
|
const libPictRecordSet = require('../../source/Pict-Section-RecordSet.js');
|
|
2
3
|
//const libPictSectionForm = require('pict-section-recordset');
|
|
4
|
+
const libPictRecordSetLocalDateRangeFilterView = require('../../source/views/filters/RecordSet-Filter-DateRange.js');
|
|
3
5
|
|
|
4
|
-
|
|
6
|
+
class SimpleApplication extends libPictRecordSet.PictRecordSetApplication
|
|
7
|
+
{
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
module.exports = SimpleApplication;
|
|
5
11
|
|
|
6
12
|
module.exports.default_configuration.pict_configuration = (
|
|
7
13
|
{
|
|
@@ -175,133 +181,187 @@ module.exports.default_configuration.pict_configuration = (
|
|
|
175
181
|
},
|
|
176
182
|
}
|
|
177
183
|
},
|
|
178
|
-
"
|
|
184
|
+
"Filters":
|
|
185
|
+
{
|
|
186
|
+
"ExternalJoinBookByAuthor":
|
|
187
|
+
{
|
|
188
|
+
"Type": "ExternalJoinStringMatch",
|
|
189
|
+
"ExternalFilterByColumns": [ "Name" ],
|
|
190
|
+
|
|
191
|
+
"CoreConnectionColumn": "IDBook",
|
|
192
|
+
|
|
193
|
+
"JoinTable": "BookAuthorJoin",
|
|
194
|
+
"JoinTableExternalConnectionColumn": "IDAuthor",
|
|
195
|
+
"JoinTableCoreConnectionColumn": "IDBook",
|
|
196
|
+
|
|
197
|
+
"ExternalFilterByTable": "Author",
|
|
198
|
+
"ExternalFilterByTableConnectionColumn": "IDAuthor"
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
"FilterCriteria":
|
|
202
|
+
{
|
|
203
|
+
"FilterRecordsetByBookAndCreateDate":
|
|
179
204
|
[
|
|
180
205
|
{
|
|
181
|
-
"
|
|
206
|
+
"FilterDefinitionHash": "ExternalJoinBookByAuthor",
|
|
207
|
+
"FilterByColumn": "IDBook"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"Type": "DateRange",
|
|
211
|
+
"FilterByColumn": "CreateDate"
|
|
212
|
+
}
|
|
213
|
+
],
|
|
214
|
+
"FilterRecordsetByTitle":
|
|
215
|
+
[
|
|
216
|
+
{
|
|
217
|
+
"Type": "StringMatch",
|
|
218
|
+
"FilterByColumn": "Title"
|
|
219
|
+
},
|
|
220
|
+
]
|
|
221
|
+
},
|
|
222
|
+
|
|
223
|
+
"DefaultRecordSetConfigurations":
|
|
224
|
+
[
|
|
225
|
+
{
|
|
226
|
+
"RecordSet": "Book",
|
|
182
227
|
|
|
183
|
-
|
|
184
|
-
|
|
228
|
+
"RecordSetType": "MeadowEndpoint", // Could be "Custom" which would require a provider to already be created for the record set.
|
|
229
|
+
"RecordSetMeadowEntity": "Book", // This leverages the /Schema endpoint to get the record set columns.
|
|
185
230
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
231
|
+
"RecordSetListColumns": [
|
|
232
|
+
{
|
|
233
|
+
"Key": "Title",
|
|
234
|
+
"DisplayName": "Title"
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
"Key": "Genre",
|
|
238
|
+
"DisplayName": "Genre"
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
"Key": "ISBN",
|
|
242
|
+
"DisplayName": "Int'l SBN"
|
|
243
|
+
}
|
|
244
|
+
],
|
|
245
|
+
|
|
246
|
+
"FilterExperiences":
|
|
247
|
+
{
|
|
248
|
+
"FilterByAuthorAndCreateDate":
|
|
249
|
+
{
|
|
250
|
+
"Ordinal": 1,
|
|
251
|
+
"FilterCriteriaHash": "FilterRecordsetByBookAndCreateDate",
|
|
252
|
+
"Default": true
|
|
253
|
+
},
|
|
254
|
+
"FilterByTitle":
|
|
255
|
+
{
|
|
256
|
+
"Ordinal": 2,
|
|
257
|
+
"FilterCriteriaHash": "FilterRecordsetByTitle"
|
|
258
|
+
}
|
|
259
|
+
},
|
|
200
260
|
|
|
201
|
-
|
|
261
|
+
"RecordSetListManifestOnly": false,
|
|
202
262
|
|
|
203
|
-
|
|
204
|
-
|
|
263
|
+
"RecordSetListManifests": [ "Bestsellers", "Underdogs", "NewReleases" ],
|
|
264
|
+
"RecordSetDashboardManifests": [ "Bestsellers" ],
|
|
205
265
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
266
|
+
"RecordSetListHasExtraColumns": true,
|
|
267
|
+
"RecordSetListExtraColumnsHeaderTemplate": "<th style=\"border-bottom: 1px solid #ccc; padding: 5px; background-color: #f2f2f2; color: #333;\">Cover</th>",
|
|
268
|
+
"RecordSetListExtraColumnRowTemplate": "<td><img src=\"{~D:Record.Data.ImageURL~}\"></td>",
|
|
209
269
|
|
|
210
|
-
|
|
270
|
+
"SearchFields": [ "Title" ],
|
|
211
271
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
272
|
+
"RecordSetFilterURLTemplate-Default": "/PSRS/{~D:Record.RecordSet~}/List/FilteredTo/{~D:Record.FilterString~}",
|
|
273
|
+
"RecordSetFilterURLTemplate-List": "/PSRS/{~D:Record.RecordSet~}/List/FilteredTo/{~D:Record.FilterString~}",
|
|
274
|
+
"RecordSetFilterURLTemplate-Dashboard": "/PSRS/{~D:Record.RecordSet~}/Dashboard/FilteredTo/{~D:Record.FilterString~}",
|
|
215
275
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
276
|
+
"RecordSetURLPrefix": "/1.0/"
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
"RecordSet": "BookstoreInventory",
|
|
280
|
+
"Title": "Bookstore Inventory",
|
|
221
281
|
|
|
222
|
-
|
|
223
|
-
|
|
282
|
+
"RecordSetType": "MeadowEndpoint", // Could be "Custom" which would require a provider to already be created for the record set.
|
|
283
|
+
"RecordSetMeadowEntity": "Book", // This leverages the /Schema endpoint to get the record set columns.
|
|
224
284
|
|
|
225
|
-
|
|
285
|
+
"RecordSetListManifestOnly": true,
|
|
226
286
|
|
|
227
|
-
|
|
287
|
+
"RecordSetDashboardManifests": [ "Bestsellers", "Underdogs", "NewReleases" ],
|
|
228
288
|
|
|
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
|
-
|
|
289
|
+
"RecordDecorationConfiguration":
|
|
290
|
+
[
|
|
291
|
+
{
|
|
292
|
+
"Entity": "BookAuthorJoin",
|
|
293
|
+
"Filter": "FBL~IDBook~INN~{~PJU:,^IDBook^Record.State.CoreEntityRecordSubset~}",
|
|
294
|
+
"Destination": "State.BookAuthorJoins"
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
"Entity": "Author",
|
|
298
|
+
"Filter": "FBL~IDAuthor~INN~{~PJU:,^IDAuthor^Record.State.BookAuthorJoins~}",
|
|
299
|
+
"Destination": "State.Authors"
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
"Type": "MapJoin",
|
|
303
|
+
"DestinationRecordSetAddress": "State.CoreEntityRecordSubset",
|
|
304
|
+
"DestinationJoinValue": "IDBook",
|
|
305
|
+
"JoinJoinValueLHS": "IDBook",
|
|
306
|
+
"Joins": "State.BookAuthorJoins",
|
|
307
|
+
"JoinJoinValueRHS": "IDAuthor",
|
|
308
|
+
"JoinRecordSetAddress": "State.Authors",
|
|
309
|
+
"JoinValue": "IDAuthor",
|
|
310
|
+
"RecordDestinationAddress": "Authors"
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
"Entity": "BookAuthorJoin",
|
|
314
|
+
"Filter": "FBL~IDAuthor~INN~{~PJU:,^IDAuthor^Record.State.Authors~}",
|
|
315
|
+
"Destination": "State.BookAuthorJoinsRev"
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
"Entity": "Book",
|
|
319
|
+
"Filter": "FBL~IDBook~INN~{~PJU:,^IDBook^Record.State.BookAuthorJoinsRev~}",
|
|
320
|
+
"Destination": "State.BooksForAuthors"
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
"Type": "MapJoin",
|
|
324
|
+
"DestinationRecordSetAddress": "State.Authors",
|
|
325
|
+
"DestinationJoinValue": "IDAuthor",
|
|
326
|
+
"JoinJoinValueLHS": "IDAuthor",
|
|
327
|
+
"Joins": "State.BookAuthorJoinsRev",
|
|
328
|
+
"JoinJoinValueRHS": "IDBook",
|
|
329
|
+
"JoinRecordSetAddress": "State.BooksForAuthors",
|
|
330
|
+
"JoinValue": "IDBook",
|
|
331
|
+
"RecordDestinationAddress": "Books"
|
|
332
|
+
}
|
|
333
|
+
],
|
|
334
|
+
"AvailableVerbs": [ "Dashboard" ],
|
|
275
335
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
336
|
+
"RecordSetListHasExtraColumns": true,
|
|
337
|
+
"RecordSetListExtraColumnsHeaderTemplate": "<th style=\"border-bottom: 1px solid #ccc; padding: 5px; background-color: #f2f2f2; color: #333;\">Cover</th>",
|
|
338
|
+
"RecordSetListExtraColumnRowTemplate": "<td><img src=\"{~D:Record.Data.ImageURL~}\"></td>",
|
|
279
339
|
|
|
280
|
-
|
|
340
|
+
"SearchFields": [ "Title" ],
|
|
281
341
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
342
|
+
"RecordSetFilterURLTemplate-Default": "/PSRS/{~D:Record.RecordSet~}/List/FilteredTo/{~D:Record.FilterString~}",
|
|
343
|
+
"RecordSetFilterURLTemplate-List": "/PSRS/{~D:Record.RecordSet~}/List/FilteredTo/{~D:Record.FilterString~}",
|
|
344
|
+
"RecordSetFilterURLTemplate-Dashboard": "/PSRS/{~D:Record.RecordSet~}/Dashboard/FilteredTo/{~D:Record.FilterString~}",
|
|
345
|
+
//TODO: something like this to reduce boilerplate
|
|
346
|
+
"RecordSetFilterURLTemplate-Dashboard-Specific": "/PSRS/{~D:Record.RecordSet~}/SpecificDashboard/$$DASHBOARD_HASH$$/FilteredTo/{~D:Record.FilterString~}",
|
|
347
|
+
"RecordSetFilterURLTemplate-Dashboard-Bestsellers": "/PSRS/{~D:Record.RecordSet~}/SpecificDashboard/Bestsellers/FilteredTo/{~D:Record.FilterString~}",
|
|
348
|
+
"RecordSetFilterURLTemplate-Dashboard-Underdogs": "/PSRS/{~D:Record.RecordSet~}/SpecificDashboard/Underdogs/FilteredTo/{~D:Record.FilterString~}",
|
|
349
|
+
"RecordSetFilterURLTemplate-Dashboard-NewReleases": "/PSRS/{~D:Record.RecordSet~}/SpecificDashboard/NewReleases/FilteredTo/{~D:Record.FilterString~}",
|
|
290
350
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
351
|
+
"RecordSetURLPrefix": "/1.0/"
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
"RecordSet": "Author",
|
|
295
355
|
|
|
296
|
-
|
|
297
|
-
|
|
356
|
+
"RecordSetType": "MeadowEndpoint",
|
|
357
|
+
"RecordSetMeadowEntity": "Author",
|
|
298
358
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
359
|
+
"RecordSetURLPrefix": "/1.0/"
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
"RecordSet": "RandomizedValues",
|
|
303
363
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
364
|
+
"RecordSetType": "Custom" // This means the `PS-RSP-RandomizedValues` provider will be checked for to get records.
|
|
365
|
+
}
|
|
366
|
+
]
|
|
367
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pict-section-recordset",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.26",
|
|
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.284",
|
|
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
|
{
|