pict-section-recordset 1.0.0 → 1.0.2
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/.vscode/launch.json +46 -0
- package/debug/Harness.js +0 -7
- package/example_applications/ServeExamples.js +1 -1
- package/example_applications/mocks/book-edit-view.html +145 -0
- package/example_applications/mocks/book-read-view.html +139 -0
- package/example_applications/mocks/list-view.html +125 -0
- package/example_applications/simple_entity/Simple-RecordSet-Application.js +33 -27
- package/example_applications/simple_entity/html/index.html +3 -3
- package/package.json +12 -8
- package/source/Pict-Section-RecordSet.js +6 -2
- package/source/application/Pict-Application-RecordSet.js +23 -4
- package/source/providers/RecordSet-RecordProvider-Base.js +217 -0
- package/source/providers/RecordSet-RecordProvider-MeadowEndpoints.js +339 -0
- package/source/providers/RecordSet-Router.js +64 -0
- package/source/services/RecordsSet-MetaController.js +268 -0
- package/source/views/RecordSet-Filter.js +91 -0
- package/source/views/RecordSet-RecordBaseView.js +84 -0
- package/source/views/RecordsSet-MacroView.js +63 -0
- package/source/views/dashboard/RecordSet-Dashboard-HeaderDashboard.js +63 -0
- package/source/views/dashboard/RecordSet-Dashboard-RecordSetDashboard.js +63 -0
- package/source/views/dashboard/RecordSet-Dashboard-TabBarDashboard.js +63 -0
- package/source/views/dashboard/RecordSet-Dashboard.js +63 -0
- package/source/views/edit/RecordSet-Edit-HeaderEdit.js +63 -0
- package/source/views/edit/RecordSet-Edit-RecordEdit.js +63 -0
- package/source/views/edit/RecordSet-Edit-RecordEditControls.js +63 -0
- package/source/views/edit/RecordSet-Edit-RecordEditExtra.js +63 -0
- package/source/views/edit/RecordSet-Edit-TabBarEdit.js +63 -0
- package/source/views/edit/RecordSet-Edit.js +63 -0
- package/source/views/list/RecordSet-List-HeaderList.js +63 -0
- package/source/views/list/RecordSet-List-PaginationBottom.js +67 -0
- package/source/views/list/RecordSet-List-PaginationTop.js +127 -0
- package/source/views/list/RecordSet-List-RecordList.js +79 -0
- package/source/views/list/RecordSet-List-RecordListEntry.js +86 -0
- package/source/views/list/RecordSet-List-RecordListHeader.js +77 -0
- package/source/views/list/RecordSet-List-Title.js +66 -0
- package/source/views/list/RecordSet-List.js +310 -0
- package/source/views/read/RecordSet-Read-HeaderRead.js +63 -0
- package/source/views/read/RecordSet-Read-RecordRead.js +63 -0
- package/source/views/read/RecordSet-Read-RecordReadExtra.js +63 -0
- package/source/views/read/RecordSet-Read-TabBarRead.js +63 -0
- package/source/views/read/RecordSet-Read.js +162 -0
- package/test/PictSectionRecordSet-Basic_tests.js +6 -2
- package/test/PictSectionRecordSet-RecordProvider-Meadow_tests.js +203 -0
- package/tsconfig.build.json +16 -0
- package/tsconfig.json +1 -1
- package/types/Pict-Section-RecordSet.d.ts +9 -1
- package/types/application/Pict-Application-RecordSet.d.ts +5 -5
- package/types/application/Pict-Application-RecordSet.d.ts.map +1 -1
- package/types/providers/RecordSet-RecordProvider-Base.d.ts +207 -0
- package/types/providers/RecordSet-RecordProvider-Base.d.ts.map +1 -1
- package/types/providers/RecordSet-RecordProvider-MeadowEndpoints.d.ts +100 -0
- package/types/providers/RecordSet-RecordProvider-MeadowEndpoints.d.ts.map +1 -0
- package/types/providers/RecordSet-Router.d.ts +36 -0
- package/types/providers/RecordSet-Router.d.ts.map +1 -0
- package/types/services/RecordsSet-MetaController.d.ts +36 -0
- package/types/services/RecordsSet-MetaController.d.ts.map +1 -0
- package/types/views/RecordSet-Filter.d.ts +34 -0
- package/types/views/RecordSet-Filter.d.ts.map +1 -0
- package/types/views/RecordSet-RecordBaseView.d.ts +49 -0
- package/types/views/RecordSet-RecordBaseView.d.ts.map +1 -0
- package/types/views/RecordsSet-MacroView.d.ts +34 -0
- package/types/views/RecordsSet-MacroView.d.ts.map +1 -0
- package/types/views/dashboard/RecordSet-Dashboard-HeaderDashboard.d.ts +34 -0
- package/types/views/dashboard/RecordSet-Dashboard-HeaderDashboard.d.ts.map +1 -0
- package/types/views/dashboard/RecordSet-Dashboard-RecordSetDashboard.d.ts +34 -0
- package/types/views/dashboard/RecordSet-Dashboard-RecordSetDashboard.d.ts.map +1 -0
- package/types/views/dashboard/RecordSet-Dashboard-TabBarDashboard.d.ts +34 -0
- package/types/views/dashboard/RecordSet-Dashboard-TabBarDashboard.d.ts.map +1 -0
- package/types/views/dashboard/RecordSet-Dashboard.d.ts +33 -0
- package/types/views/dashboard/RecordSet-Dashboard.d.ts.map +1 -0
- package/types/views/edit/RecordSet-Edit-HeaderEdit.d.ts +34 -0
- package/types/views/edit/RecordSet-Edit-HeaderEdit.d.ts.map +1 -0
- package/types/views/edit/RecordSet-Edit-RecordEdit.d.ts +34 -0
- package/types/views/edit/RecordSet-Edit-RecordEdit.d.ts.map +1 -0
- package/types/views/edit/RecordSet-Edit-RecordEditControls.d.ts +34 -0
- package/types/views/edit/RecordSet-Edit-RecordEditControls.d.ts.map +1 -0
- package/types/views/edit/RecordSet-Edit-RecordEditExtra.d.ts +34 -0
- package/types/views/edit/RecordSet-Edit-RecordEditExtra.d.ts.map +1 -0
- package/types/views/edit/RecordSet-Edit-TabBarEdit.d.ts +34 -0
- package/types/views/edit/RecordSet-Edit-TabBarEdit.d.ts.map +1 -0
- package/types/views/edit/RecordSet-Edit.d.ts +33 -0
- package/types/views/edit/RecordSet-Edit.d.ts.map +1 -0
- package/types/views/list/RecordSet-List-HeaderList.d.ts +34 -0
- package/types/views/list/RecordSet-List-HeaderList.d.ts.map +1 -0
- package/types/views/list/RecordSet-List-PaginationBottom.d.ts +34 -0
- package/types/views/list/RecordSet-List-PaginationBottom.d.ts.map +1 -0
- package/types/views/list/RecordSet-List-PaginationTop.d.ts +34 -0
- package/types/views/list/RecordSet-List-PaginationTop.d.ts.map +1 -0
- package/types/views/list/RecordSet-List-RecordList.d.ts +34 -0
- package/types/views/list/RecordSet-List-RecordList.d.ts.map +1 -0
- package/types/views/list/RecordSet-List-RecordListEntry.d.ts +34 -0
- package/types/views/list/RecordSet-List-RecordListEntry.d.ts.map +1 -0
- package/types/views/list/RecordSet-List-RecordListHeader.d.ts +34 -0
- package/types/views/list/RecordSet-List-RecordListHeader.d.ts.map +1 -0
- package/types/views/list/RecordSet-List-Title.d.ts +34 -0
- package/types/views/list/RecordSet-List-Title.d.ts.map +1 -0
- package/types/views/list/RecordSet-List.d.ts +47 -0
- package/types/views/list/RecordSet-List.d.ts.map +1 -0
- package/types/views/read/RecordSet-Read-HeaderRead.d.ts +34 -0
- package/types/views/read/RecordSet-Read-HeaderRead.d.ts.map +1 -0
- package/types/views/read/RecordSet-Read-RecordRead.d.ts +34 -0
- package/types/views/read/RecordSet-Read-RecordRead.d.ts.map +1 -0
- package/types/views/read/RecordSet-Read-RecordReadExtra.d.ts +34 -0
- package/types/views/read/RecordSet-Read-RecordReadExtra.d.ts.map +1 -0
- package/types/views/read/RecordSet-Read-TabBarRead.d.ts +34 -0
- package/types/views/read/RecordSet-Read-TabBarRead.d.ts.map +1 -0
- package/types/views/read/RecordSet-Read.d.ts +44 -0
- package/types/views/read/RecordSet-Read.d.ts.map +1 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
const libPictView = require('pict-view');
|
|
2
|
+
|
|
3
|
+
const _DEFAULT_CONFIGURATION_Read_RecordRead = (
|
|
4
|
+
{
|
|
5
|
+
ViewIdentifier: 'PRSP-Read-RecordRead',
|
|
6
|
+
|
|
7
|
+
DefaultRenderable: 'PRSP_Renderable_RecordRead',
|
|
8
|
+
DefaultDestinationAddress: '#PRSP_RecordRead_Container',
|
|
9
|
+
DefaultTemplateRecordAddress: false,
|
|
10
|
+
|
|
11
|
+
// If this is set to true, when the App initializes this will.
|
|
12
|
+
// While the App initializes, initialize will be called.
|
|
13
|
+
AutoInitialize: false,
|
|
14
|
+
AutoInitializeOrdinal: 0,
|
|
15
|
+
|
|
16
|
+
// If this is set to true, when the App autorenders (on load) this will.
|
|
17
|
+
// After the App initializes, render will be called.
|
|
18
|
+
AutoRender: false,
|
|
19
|
+
AutoRenderOrdinal: 0,
|
|
20
|
+
|
|
21
|
+
AutoSolveWithApp: false,
|
|
22
|
+
AutoSolveOrdinal: 0,
|
|
23
|
+
|
|
24
|
+
CSS: false,
|
|
25
|
+
CSSPriority: 500,
|
|
26
|
+
|
|
27
|
+
Templates:
|
|
28
|
+
[
|
|
29
|
+
{
|
|
30
|
+
Hash: 'PRSP-Read-RecordRead-Template',
|
|
31
|
+
Template: /*html*/`
|
|
32
|
+
<!-- DefaultPackage pict view template: [PRSP-Read-RecordRead-Template] -->
|
|
33
|
+
<!-- DefaultPackage end view template: [PRSP-Read-RecordRead-Template] -->
|
|
34
|
+
`
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
|
|
38
|
+
Renderables:
|
|
39
|
+
[
|
|
40
|
+
{
|
|
41
|
+
RenderableHash: 'PRSP_Renderable_RecordRead',
|
|
42
|
+
TemplateHash: 'PRSP-Read-RecordRead-Template',
|
|
43
|
+
DestinationAddress: '#PRSP_RecordRead_Container',
|
|
44
|
+
RenderMethod: 'replace'
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
|
|
48
|
+
Manifests: {}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
class viewRecordSetReadRecordRead extends libPictView
|
|
52
|
+
{
|
|
53
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
54
|
+
{
|
|
55
|
+
let tmpOptions = Object.assign({}, _DEFAULT_CONFIGURATION_Read_RecordRead, pOptions);
|
|
56
|
+
super(pFable, tmpOptions, pServiceHash);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
module.exports = viewRecordSetReadRecordRead;
|
|
61
|
+
|
|
62
|
+
module.exports.default_configuration = _DEFAULT_CONFIGURATION_Read_RecordRead;
|
|
63
|
+
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
const libPictView = require('pict-view');
|
|
2
|
+
|
|
3
|
+
const _DEFAULT_CONFIGURATION_Read_RecordReadExtra = (
|
|
4
|
+
{
|
|
5
|
+
ViewIdentifier: 'PRSP-Read-RecordReadExtra',
|
|
6
|
+
|
|
7
|
+
DefaultRenderable: 'PRSP_Renderable_RecordReadExtra',
|
|
8
|
+
DefaultDestinationAddress: '#PRSP_RecordReadExtra_Container',
|
|
9
|
+
DefaultTemplateRecordAddress: false,
|
|
10
|
+
|
|
11
|
+
// If this is set to true, when the App initializes this will.
|
|
12
|
+
// While the App initializes, initialize will be called.
|
|
13
|
+
AutoInitialize: false,
|
|
14
|
+
AutoInitializeOrdinal: 0,
|
|
15
|
+
|
|
16
|
+
// If this is set to true, when the App autorenders (on load) this will.
|
|
17
|
+
// After the App initializes, render will be called.
|
|
18
|
+
AutoRender: false,
|
|
19
|
+
AutoRenderOrdinal: 0,
|
|
20
|
+
|
|
21
|
+
AutoSolveWithApp: false,
|
|
22
|
+
AutoSolveOrdinal: 0,
|
|
23
|
+
|
|
24
|
+
CSS: false,
|
|
25
|
+
CSSPriority: 500,
|
|
26
|
+
|
|
27
|
+
Templates:
|
|
28
|
+
[
|
|
29
|
+
{
|
|
30
|
+
Hash: 'PRSP-Read-RecordReadExtra-Template',
|
|
31
|
+
Template: /*html*/`
|
|
32
|
+
<!-- DefaultPackage pict view template: [PRSP-Read-RecordReadExtra-Template] -->
|
|
33
|
+
<!-- DefaultPackage end view template: [PRSP-Read-RecordReadExtra-Template] -->
|
|
34
|
+
`
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
|
|
38
|
+
Renderables:
|
|
39
|
+
[
|
|
40
|
+
{
|
|
41
|
+
RenderableHash: 'PRSP_Renderable_RecordReadExtra',
|
|
42
|
+
TemplateHash: 'PRSP-Read-RecordReadExtra-Template',
|
|
43
|
+
DestinationAddress: '#PRSP_RecordReadExtra_Container',
|
|
44
|
+
RenderMethod: 'replace'
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
|
|
48
|
+
Manifests: {}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
class viewRecordSetReadRecordReadExtra extends libPictView
|
|
52
|
+
{
|
|
53
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
54
|
+
{
|
|
55
|
+
let tmpOptions = Object.assign({}, _DEFAULT_CONFIGURATION_Read_RecordReadExtra, pOptions);
|
|
56
|
+
super(pFable, tmpOptions, pServiceHash);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
module.exports = viewRecordSetReadRecordReadExtra;
|
|
61
|
+
|
|
62
|
+
module.exports.default_configuration = _DEFAULT_CONFIGURATION_Read_RecordReadExtra;
|
|
63
|
+
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
const libPictView = require('pict-view');
|
|
2
|
+
|
|
3
|
+
const _DEFAULT_CONFIGURATION_Read_TabBarRead = (
|
|
4
|
+
{
|
|
5
|
+
ViewIdentifier: 'PRSP-Read-TabBarRead',
|
|
6
|
+
|
|
7
|
+
DefaultRenderable: 'PRSP_Renderable_TabBarRead',
|
|
8
|
+
DefaultDestinationAddress: '#PRSP_TabBarRead_Container',
|
|
9
|
+
DefaultTemplateRecordAddress: false,
|
|
10
|
+
|
|
11
|
+
// If this is set to true, when the App initializes this will.
|
|
12
|
+
// While the App initializes, initialize will be called.
|
|
13
|
+
AutoInitialize: false,
|
|
14
|
+
AutoInitializeOrdinal: 0,
|
|
15
|
+
|
|
16
|
+
// If this is set to true, when the App autorenders (on load) this will.
|
|
17
|
+
// After the App initializes, render will be called.
|
|
18
|
+
AutoRender: false,
|
|
19
|
+
AutoRenderOrdinal: 0,
|
|
20
|
+
|
|
21
|
+
AutoSolveWithApp: false,
|
|
22
|
+
AutoSolveOrdinal: 0,
|
|
23
|
+
|
|
24
|
+
CSS: false,
|
|
25
|
+
CSSPriority: 500,
|
|
26
|
+
|
|
27
|
+
Templates:
|
|
28
|
+
[
|
|
29
|
+
{
|
|
30
|
+
Hash: 'PRSP-Read-TabBarRead-Template',
|
|
31
|
+
Template: /*html*/`
|
|
32
|
+
<!-- DefaultPackage pict view template: [PRSP-Read-TabBarRead-Template] -->
|
|
33
|
+
<!-- DefaultPackage end view template: [PRSP-Read-TabBarRead-Template] -->
|
|
34
|
+
`
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
|
|
38
|
+
Renderables:
|
|
39
|
+
[
|
|
40
|
+
{
|
|
41
|
+
RenderableHash: 'PRSP_Renderable_TabBarRead',
|
|
42
|
+
TemplateHash: 'PRSP-Read-TabBarRead-Template',
|
|
43
|
+
DestinationAddress: '#PRSP_TabBarRead_Container',
|
|
44
|
+
RenderMethod: 'replace'
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
|
|
48
|
+
Manifests: {}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
class viewRecordSetReadTabBarRead extends libPictView
|
|
52
|
+
{
|
|
53
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
54
|
+
{
|
|
55
|
+
let tmpOptions = Object.assign({}, _DEFAULT_CONFIGURATION_Read_TabBarRead, pOptions);
|
|
56
|
+
super(pFable, tmpOptions, pServiceHash);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
module.exports = viewRecordSetReadTabBarRead;
|
|
61
|
+
|
|
62
|
+
module.exports.default_configuration = _DEFAULT_CONFIGURATION_Read_TabBarRead;
|
|
63
|
+
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
const libPictRecordSetRecordView = require('../RecordSet-RecordBaseView.js');
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const viewHeaderRead = require('./RecordSet-Read-HeaderRead.js');
|
|
5
|
+
const viewRecordRead = require('./RecordSet-Read-RecordRead.js');
|
|
6
|
+
const viewRecordReadExtra = require('./RecordSet-Read-RecordReadExtra.js');
|
|
7
|
+
const viewTabBarRead = require('./RecordSet-Read-TabBarRead.js');
|
|
8
|
+
|
|
9
|
+
const _DEFAULT_CONFIGURATION__Read = (
|
|
10
|
+
{
|
|
11
|
+
ViewIdentifier: 'PRSP-Read',
|
|
12
|
+
|
|
13
|
+
DefaultRenderable: 'PRSP_Renderable_Read',
|
|
14
|
+
DefaultDestinationAddress: '#PRSP_Read_Container',
|
|
15
|
+
DefaultTemplateRecordAddress: false,
|
|
16
|
+
|
|
17
|
+
// If this is set to true, when the App initializes this will.
|
|
18
|
+
// While the App initializes, initialize will be called.
|
|
19
|
+
AutoInitialize: false,
|
|
20
|
+
AutoInitializeOrdinal: 0,
|
|
21
|
+
|
|
22
|
+
// If this is set to true, when the App autorenders (on load) this will.
|
|
23
|
+
// After the App initializes, render will be called.
|
|
24
|
+
AutoRender: false,
|
|
25
|
+
AutoRenderOrdinal: 0,
|
|
26
|
+
|
|
27
|
+
AutoSolveWithApp: false,
|
|
28
|
+
AutoSolveOrdinal: 0,
|
|
29
|
+
|
|
30
|
+
CSS: false,
|
|
31
|
+
CSSPriority: 500,
|
|
32
|
+
|
|
33
|
+
Templates:
|
|
34
|
+
[
|
|
35
|
+
{
|
|
36
|
+
Hash: 'PRSP-Read-Template',
|
|
37
|
+
Template: /*html*/`
|
|
38
|
+
<!-- DefaultPackage pict view template: [PRSP-Read-Template] -->
|
|
39
|
+
<!-- DefaultPackage end view template: [PRSP-Read-Template] -->
|
|
40
|
+
`
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
|
|
44
|
+
Renderables:
|
|
45
|
+
[
|
|
46
|
+
{
|
|
47
|
+
RenderableHash: 'PRSP_Renderable_Read',
|
|
48
|
+
TemplateHash: 'PRSP-Read-Template',
|
|
49
|
+
DestinationAddress: '#PRSP_Read_Container',
|
|
50
|
+
RenderMethod: 'replace'
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
|
|
54
|
+
Manifests: {}
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
class viewRecordSetRead extends libPictRecordSetRecordView
|
|
58
|
+
{
|
|
59
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
60
|
+
{
|
|
61
|
+
let tmpOptions = Object.assign({}, _DEFAULT_CONFIGURATION__Read, pOptions);
|
|
62
|
+
super(pFable, tmpOptions, pServiceHash);
|
|
63
|
+
|
|
64
|
+
this.childViews = {
|
|
65
|
+
headerList: null,
|
|
66
|
+
title: null,
|
|
67
|
+
paginationTop: null,
|
|
68
|
+
recordList: null,
|
|
69
|
+
recordListHeader: null,
|
|
70
|
+
recordListEntry: null,
|
|
71
|
+
paginationBottom: null
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
onBeforeRenderRead(pRecordReadData)
|
|
76
|
+
{
|
|
77
|
+
return pRecordReadData;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async renderRead(pRecordConfiguration, pProviderHash, pFilterString, pOffset, pPageSize)
|
|
81
|
+
{
|
|
82
|
+
// Get the records
|
|
83
|
+
if (!(pProviderHash in this.pict.providers))
|
|
84
|
+
{
|
|
85
|
+
this.pict.log.error(`RecordSetRead: No provider found for ${pProviderHash} in ${pRecordConfiguration.RecordSet}. Read Render failed.`);
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
let tmpRecordReadData =
|
|
90
|
+
{
|
|
91
|
+
"RecordSet": pRecordConfiguration.RecordSet,
|
|
92
|
+
|
|
93
|
+
"RecordConfiguration": pRecordConfiguration,
|
|
94
|
+
|
|
95
|
+
"RenderDestination": this.options.DefaultDestinationAddress,
|
|
96
|
+
|
|
97
|
+
"Record": false,
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// If the record configuration does not have a GUID, try to infer one from the RecordSet name
|
|
101
|
+
if (!tmpRecordReadData.RecordConfiguration.GUIDAddress)
|
|
102
|
+
{
|
|
103
|
+
// So this will be something like "GUIDBook" or "GUIDAuthor"
|
|
104
|
+
tmpRecordReadData.RecordConfiguration.GUIDAddress = `GUID${pRecordConfiguration.RecordSet}`;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
tmpRecordReadData.Records = await this.pict.providers[pProviderHash].getRecords({Offset:tmpRecordReadData.Offset, PageSize:tmpRecordReadData.PageSize});
|
|
108
|
+
tmpRecordReadData.TotalRecordCount = await this.pict.providers[pProviderHash].getRecordSetCount({Offset:tmpRecordReadData.Offset, PageSize:tmpRecordReadData.PageSize});
|
|
109
|
+
tmpRecordReadData.RecordSchema = this.pict.providers[pProviderHash].recordSchema;
|
|
110
|
+
|
|
111
|
+
tmpRecordReadData = this.onBeforeRenderRead(tmpRecordReadData);
|
|
112
|
+
|
|
113
|
+
// If there isn't a title template passed in as part of the configuration,, create one.
|
|
114
|
+
if (!tmpRecordReadData.RecordConfiguration.TitleTemplate)
|
|
115
|
+
{
|
|
116
|
+
// This dynamically grabs the guid address and tries to pull it from the record
|
|
117
|
+
tmpRecordReadData.RecordConfiguration.TitleTemplate = `{~D:Record.RecordSet~} GUID [{~D:Record.Record.${tmpRecordReadData.RecordConfiguration.GUIDAddress}}] `;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
this.renderAsync('PRSP_Renderable_Read', tmpRecordReadData.RenderDestination, tmpRecordReadData,
|
|
122
|
+
function (pError)
|
|
123
|
+
{
|
|
124
|
+
if (pError)
|
|
125
|
+
{
|
|
126
|
+
this.pict.log.error(`RecordSetRead: Error rendering read ${pError}`, tmpRecordReadData);
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (this.pict.LogNoisiness > 0)
|
|
131
|
+
{
|
|
132
|
+
this.pict.log.info(`RecordSetRead: Rendered read ${tmpRecordReadData.RecordSet} with ${tmpRecordReadData.RecordConfiguration.GUIDAddress} []`, tmpRecordReadData);
|
|
133
|
+
}
|
|
134
|
+
else
|
|
135
|
+
{
|
|
136
|
+
this.pict.log.info(`RecordSetRead: Rendered read ${tmpRecordReadData.RecordSet} with ${tmpRecordReadData.RecordConfiguration.GUIDAddress} []`);
|
|
137
|
+
}
|
|
138
|
+
return true;
|
|
139
|
+
}.bind(this));
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
onInitialize()
|
|
143
|
+
{
|
|
144
|
+
this.childViews.headerRead = this.pict.addView('PRSP-Read-HeaderRead', viewHeaderRead.default_configuration, viewHeaderRead);
|
|
145
|
+
this.childViews.recordRead = this.pict.addView('PRSP-Read-RecordRead', viewRecordRead.default_configuration, viewRecordRead);
|
|
146
|
+
this.childViews.recordReadExtra = this.pict.addView('PRSP-Read-RecordReadExtra', viewRecordReadExtra.default_configuration, viewRecordReadExtra);
|
|
147
|
+
this.childViews.tabBarRead = this.pict.addView('PRSP-Read-TabBarRead', viewTabBarRead.default_configuration, viewTabBarRead);
|
|
148
|
+
|
|
149
|
+
// // Initialize the subviews
|
|
150
|
+
this.childViews.headerRead.initialize();
|
|
151
|
+
this.childViews.recordRead.initialize();
|
|
152
|
+
this.childViews.recordReadExtra.initialize();
|
|
153
|
+
this.childViews.tabBarRead.initialize();
|
|
154
|
+
|
|
155
|
+
return super.onInitialize();
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
module.exports = viewRecordSetRead;
|
|
160
|
+
|
|
161
|
+
module.exports.default_configuration = _DEFAULT_CONFIGURATION__Read;
|
|
162
|
+
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
// This is temporary, but enables unit tests
|
|
7
|
-
const libBrowserEnv = require('browser-env')
|
|
7
|
+
const libBrowserEnv = require('browser-env');
|
|
8
8
|
libBrowserEnv();
|
|
9
9
|
|
|
10
10
|
const libPictView = require('pict-view');
|
|
@@ -74,6 +74,10 @@ suite
|
|
|
74
74
|
Expect(_Application).to.be.an('object', 'Application should be an object.');
|
|
75
75
|
Expect(_Application).to.be.an.instanceof(libPictSectionRecordSet.PictRecordSetApplication, 'Application should be an instance of PictRecordSetApplication.');
|
|
76
76
|
|
|
77
|
+
_Application.testDone = fDone;
|
|
78
|
+
|
|
79
|
+
_Application.initialize();
|
|
80
|
+
|
|
77
81
|
|
|
78
82
|
// let _PictSectionRecordSet = _Pict.addView(tmpViewHash, tmpViewConfiguration, libPictSectionRecordSet);
|
|
79
83
|
|
|
@@ -87,7 +91,7 @@ suite
|
|
|
87
91
|
// Expect(_PictSectionRecordSet._Package).to.be.an('object', 'Should have a _Package object.');
|
|
88
92
|
// Expect(_PictSectionRecordSet._Package.name).to.equal('pict-section-recordset', '_Package.package.name should be set.');
|
|
89
93
|
|
|
90
|
-
return fDone();
|
|
94
|
+
// return fDone();
|
|
91
95
|
}
|
|
92
96
|
);
|
|
93
97
|
});
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Unit tests for PictSectionRecordSet Basic
|
|
3
|
+
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// This is temporary, but enables unit tests
|
|
7
|
+
const libBrowserEnv = require('browser-env');
|
|
8
|
+
libBrowserEnv();
|
|
9
|
+
|
|
10
|
+
const libPictApplication = require('pict-application');
|
|
11
|
+
const libPictView = require('pict-view');
|
|
12
|
+
|
|
13
|
+
const Chai = require('chai');
|
|
14
|
+
const Expect = Chai.expect;
|
|
15
|
+
|
|
16
|
+
const libPict = require('pict');
|
|
17
|
+
|
|
18
|
+
const libPictSectionRecordSet = require('../source/Pict-Section-RecordSet.js');
|
|
19
|
+
|
|
20
|
+
class DoNothingApplication extends libPictApplication
|
|
21
|
+
{
|
|
22
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
23
|
+
{
|
|
24
|
+
pOptions.AutoRenderMainViewportViewAfterInitialize = false;
|
|
25
|
+
pOptions.AutoRenderViewsAfterInitialize = false;
|
|
26
|
+
super(pFable, pOptions, pServiceHash);
|
|
27
|
+
|
|
28
|
+
let resolveFunc;
|
|
29
|
+
/** @type {Promise & { resolve?: () => void }} */
|
|
30
|
+
this._initialized = new Promise(function (resolve)
|
|
31
|
+
{
|
|
32
|
+
resolveFunc = resolve;
|
|
33
|
+
});
|
|
34
|
+
this._initialized.resolve = resolveFunc;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
get iniitalized()
|
|
38
|
+
{
|
|
39
|
+
return this._initialized;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
onAfterInitialize()
|
|
43
|
+
{
|
|
44
|
+
this._initialized.resolve();
|
|
45
|
+
return super.onAfterInitialize();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
class DoNothingView extends libPictView
|
|
50
|
+
{
|
|
51
|
+
constructor(pPict, pOptions)
|
|
52
|
+
{
|
|
53
|
+
super(pPict, pOptions);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
suite
|
|
58
|
+
(
|
|
59
|
+
'PictSectionRecordSet RecordProvider MeadowEndpoints Tests',
|
|
60
|
+
() =>
|
|
61
|
+
{
|
|
62
|
+
setup(() => { });
|
|
63
|
+
|
|
64
|
+
suite
|
|
65
|
+
(
|
|
66
|
+
'Basic Basic Tests',
|
|
67
|
+
() =>
|
|
68
|
+
{
|
|
69
|
+
let _Pict;
|
|
70
|
+
setup(async () =>
|
|
71
|
+
{
|
|
72
|
+
_Pict = new libPict();
|
|
73
|
+
_Pict.LogNoisiness = 2;
|
|
74
|
+
let _PictEnvironment = new libPict.EnvironmentObject(_Pict);
|
|
75
|
+
|
|
76
|
+
let _Application = new DoNothingApplication(_Pict, {});
|
|
77
|
+
_Pict.addProvider('BooksProvider', { Entity: 'Book', URLPrefix: 'http://localhost:8086/1.0/' }, require('../source/providers/RecordSet-RecordProvider-MeadowEndpoints.js'));
|
|
78
|
+
await new Promise((resolve, reject) => _Application.initializeAsync((error) =>
|
|
79
|
+
{
|
|
80
|
+
if (error)
|
|
81
|
+
{
|
|
82
|
+
return reject(error);
|
|
83
|
+
}
|
|
84
|
+
resolve();
|
|
85
|
+
}));
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test('getRecord by ID', async () =>
|
|
89
|
+
{
|
|
90
|
+
const book = await _Pict.providers.BooksProvider.getRecord(1);
|
|
91
|
+
Expect(book).to.be.an('object', 'Book should be an object.');
|
|
92
|
+
Expect(book).to.have.property('IDBook', 1, 'Book should have an id of 1.');
|
|
93
|
+
Expect(book).to.have.property('GUIDBook', 'ca811611-59c9-4b4a-9864-df5145f7785d', 'Book should have a guid of "ca811611-59c9-4b4a-9864-df5145f7785d".');
|
|
94
|
+
Expect(book.Title).to.equal('Angels & Demons', 'Book should have a title of "Angels & Demons".');
|
|
95
|
+
}); // ca811611-59c9-4b4a-9864-df5145f7785d
|
|
96
|
+
|
|
97
|
+
test('getRecord by GUID', async () =>
|
|
98
|
+
{
|
|
99
|
+
const book = await _Pict.providers.BooksProvider.getRecord('ca811611-59c9-4b4a-9864-df5145f7785d');
|
|
100
|
+
Expect(book).to.be.an('object', 'Book should be an object.');
|
|
101
|
+
Expect(book).to.have.property('IDBook', 1, 'Book should have an id of 1.');
|
|
102
|
+
Expect(book).to.have.property('GUIDBook', 'ca811611-59c9-4b4a-9864-df5145f7785d', 'Book should have a guid of "ca811611-59c9-4b4a-9864-df5145f7785d".');
|
|
103
|
+
Expect(book.Title).to.equal('Angels & Demons', 'Book should have a title of "Angels & Demons".');
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
test('getRecords with no options', async () =>
|
|
107
|
+
{
|
|
108
|
+
const { Records: books } = await _Pict.providers.BooksProvider.getRecords({ });
|
|
109
|
+
Expect(books).to.be.an('array', 'Books should be an array.');
|
|
110
|
+
Expect(books.length).to.equal(250, 'Books should have one record.');
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
test('getRecords with pagination', async () =>
|
|
114
|
+
{
|
|
115
|
+
const { Records: books } = await _Pict.providers.BooksProvider.getRecords({ Offset: 1, PageSize: 1 });
|
|
116
|
+
Expect(books).to.be.an('array', 'Books should be an array.');
|
|
117
|
+
Expect(books.length).to.equal(1, 'Books should have one record.');
|
|
118
|
+
const book = books[0];
|
|
119
|
+
Expect(book).to.be.an('object', 'Book should be an object.');
|
|
120
|
+
Expect(book).to.have.property('IDBook', 2, 'Book should have an id of 2.');
|
|
121
|
+
Expect(book).to.have.property('GUIDBook', 'c854b3f1-539a-47fa-acca-c1b90629c220', 'Book should have a guid of "c854b3f1-539a-47fa-acca-c1b90629c220".');
|
|
122
|
+
Expect(book.Title).to.equal(`Harry Potter and the Philosopher's Stone`, `Book should have a title of "Harry Potter and the Philosopher's Stone".`);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
test('getRecords with filter', async () =>
|
|
126
|
+
{
|
|
127
|
+
const { Records: books } = await _Pict.providers.BooksProvider.getRecords({ FilterString: 'FBV~ISBN~GE~804139024~FSF~ISBN~ASC~0' });
|
|
128
|
+
Expect(books).to.be.an('array', 'Books should be an array.');
|
|
129
|
+
const book = books[0];
|
|
130
|
+
Expect(book).to.be.an('object', 'Book should be an object.');
|
|
131
|
+
Expect(book.ISBN).to.equal('804139024', 'Book should have an ISBN of "804139024".');
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
test('getRecordSetCount', async () =>
|
|
135
|
+
{
|
|
136
|
+
const { Count: count } = await _Pict.providers.BooksProvider.getRecordSetCount({ });
|
|
137
|
+
Expect(count).to.be.greaterThan(0, 'Count should be greater than 0.');
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
test('getRecordSetCount with filter', async () =>
|
|
141
|
+
{
|
|
142
|
+
const { Count: count } = await _Pict.providers.BooksProvider.getRecordSetCount({ FilterString: 'FBV~ISBN~GE~804139024~FSF~ISBN~ASC~0' });
|
|
143
|
+
Expect(count).to.be.greaterThan(0, 'Count should be greater than 0.');
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
test('getRecordSetCount with filter to one record', async () =>
|
|
147
|
+
{
|
|
148
|
+
const { Count: count } = await _Pict.providers.BooksProvider.getRecordSetCount({ FilterString: 'FBV~ISBN~EQ~804139024' });
|
|
149
|
+
Expect(count).to.equal(1, 'Count should be equal to 1.');
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
test('getRecordsInline with no options', async () =>
|
|
153
|
+
{
|
|
154
|
+
const { Records: books } = await _Pict.providers.BooksProvider.getRecordsInline();
|
|
155
|
+
Expect(books).to.be.an('array', 'Books should be an array.');
|
|
156
|
+
Expect(books.length).to.equal(250, 'Books should have one record.');
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
test('getRecordsInline with pagination', async () =>
|
|
160
|
+
{
|
|
161
|
+
const { Records: books } = await _Pict.providers.BooksProvider.getRecordsInline('', 1, 1);
|
|
162
|
+
Expect(books).to.be.an('array', 'Books should be an array.');
|
|
163
|
+
Expect(books.length).to.equal(1, 'Books should have one record.');
|
|
164
|
+
const book = books[0];
|
|
165
|
+
Expect(book).to.be.an('object', 'Book should be an object.');
|
|
166
|
+
Expect(book).to.have.property('IDBook', 2, 'Book should have an id of 2.');
|
|
167
|
+
Expect(book).to.have.property('GUIDBook', 'c854b3f1-539a-47fa-acca-c1b90629c220', 'Book should have a guid of "c854b3f1-539a-47fa-acca-c1b90629c220".');
|
|
168
|
+
Expect(book.Title).to.equal(`Harry Potter and the Philosopher's Stone`, `Book should have a title of "Harry Potter and the Philosopher's Stone".`);
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
test('getRecordsInline with filter', async () =>
|
|
172
|
+
{
|
|
173
|
+
const { Records: books } = await _Pict.providers.BooksProvider.getRecordsInline('FBV~ISBN~GE~804139024~FSF~ISBN~ASC~0');
|
|
174
|
+
Expect(books).to.be.an('array', 'Books should be an array.');
|
|
175
|
+
const book = books[0];
|
|
176
|
+
Expect(book).to.be.an('object', 'Book should be an object.');
|
|
177
|
+
Expect(book.ISBN).to.equal('804139024', 'Book should have an ISBN of "804139024".');
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
test('createRecord and deleteRecord', async () =>
|
|
181
|
+
{
|
|
182
|
+
const book = await _Pict.providers.BooksProvider.createRecord({ Title: 'Test Book', ISBN: '1234567890' });
|
|
183
|
+
Expect(book).to.be.an('object', 'Book should be an object.');
|
|
184
|
+
Expect(book.IDBook).to.be.greaterThan(0, 'Book should have an id greater than 0.');
|
|
185
|
+
book.Title = 'Test Book 2';
|
|
186
|
+
const updartedBook = await _Pict.providers.BooksProvider.updateRecord(book);
|
|
187
|
+
Expect(updartedBook).to.be.an('object', 'Book should be an object.');
|
|
188
|
+
Expect(updartedBook.IDBook).to.equal(book.IDBook, 'Book should have the same id.');
|
|
189
|
+
Expect(updartedBook.Title).to.equal('Test Book 2', 'Book should have a title of "Test Book 2".');
|
|
190
|
+
await _Pict.providers.BooksProvider.deleteRecord(book);
|
|
191
|
+
const existenceCheck = await _Pict.providers.BooksProvider.getRecord(book.IDBook);
|
|
192
|
+
Expect(existenceCheck.Error).to.equal('Record not Found');
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
test('recordSchema', async () =>
|
|
196
|
+
{
|
|
197
|
+
const schema = await _Pict.providers.BooksProvider.recordSchema;
|
|
198
|
+
Expect(schema).to.be.an('object', 'Schema should be an object.');
|
|
199
|
+
Expect(Object.keys(schema).length).to.be.greaterThan(0, 'Schema should have properties.');
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"include": ["source"],
|
|
3
|
+
"compilerOptions":
|
|
4
|
+
{
|
|
5
|
+
"target": "es2019",
|
|
6
|
+
"esModuleInterop": true,
|
|
7
|
+
"allowJs": true,
|
|
8
|
+
"checkJs": true,
|
|
9
|
+
"declaration": true,
|
|
10
|
+
"emitDeclarationOnly": true,
|
|
11
|
+
"outDir": "types",
|
|
12
|
+
"declarationMap": true,
|
|
13
|
+
"module": "commonjs",
|
|
14
|
+
"resolveJsonModule": true
|
|
15
|
+
}
|
|
16
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
declare const _exports:
|
|
1
|
+
declare const _exports: {
|
|
2
|
+
new (pFable: any, pOptions: any, pServiceHash: any): import("./services/RecordsSet-MetaController.js");
|
|
3
|
+
default_configuration: {
|
|
4
|
+
DefaultMeadowURLPrefix: string;
|
|
5
|
+
};
|
|
6
|
+
PictRecordSetApplication: typeof import("./application/Pict-Application-RecordSet.js");
|
|
7
|
+
RecordSetProviderBase: typeof import("./providers/RecordSet-RecordProvider-Base.js");
|
|
8
|
+
RecordSetProviderMeadowEndpoints: typeof import("./providers/RecordSet-RecordProvider-MeadowEndpoints.js");
|
|
9
|
+
};
|
|
2
10
|
export = _exports;
|
|
3
11
|
//# sourceMappingURL=Pict-Section-RecordSet.d.ts.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export =
|
|
1
|
+
export = PictSectionRecordSetApplication;
|
|
2
2
|
/**
|
|
3
|
-
* Represents a
|
|
3
|
+
* Represents a PictSectionRecordSetApplication.
|
|
4
4
|
*
|
|
5
|
-
* This is the automagic controller for a
|
|
5
|
+
* This is the automagic controller for a dynamic record set application.
|
|
6
6
|
*
|
|
7
7
|
* @class
|
|
8
8
|
* @extends libPictApplication
|
|
9
9
|
*/
|
|
10
|
-
declare class
|
|
10
|
+
declare class PictSectionRecordSetApplication extends libPictApplication {
|
|
11
11
|
constructor(pFable: any, pOptions: any, pServiceHash: any);
|
|
12
12
|
}
|
|
13
|
-
declare namespace
|
|
13
|
+
declare namespace PictSectionRecordSetApplication {
|
|
14
14
|
export { default_configuration };
|
|
15
15
|
}
|
|
16
16
|
import libPictApplication = require("pict-application");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pict-Application-RecordSet.d.ts","sourceRoot":"","sources":["../../source/application/Pict-Application-RecordSet.js"],"names":[],"mappings":";AAIA;;;;;;;GAOG;AACH;IAEC,2DAQC;
|
|
1
|
+
{"version":3,"file":"Pict-Application-RecordSet.d.ts","sourceRoot":"","sources":["../../source/application/Pict-Application-RecordSet.js"],"names":[],"mappings":";AAIA;;;;;;;GAOG;AACH;IAEC,2DAQC;CAoBD"}
|