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,79 @@
|
|
|
1
|
+
const libPictView = require('pict-view');
|
|
2
|
+
|
|
3
|
+
const _DEFAULT_CONFIGURATION_List_RecordList = (
|
|
4
|
+
{
|
|
5
|
+
ViewIdentifier: 'PRSP-List-RecordList',
|
|
6
|
+
|
|
7
|
+
DefaultRenderable: 'PRSP_Renderable_RecordList',
|
|
8
|
+
DefaultDestinationAddress: '#PRSP_RecordList_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-List-RecordList-Template',
|
|
31
|
+
Template: /*html*/`
|
|
32
|
+
<!-- DefaultPackage pict view template: [PRSP-List-RecordList-Template] -->
|
|
33
|
+
<section id="PRSP_List_Container">
|
|
34
|
+
{~T:PRSP-List-RecordList-Template-Table~}
|
|
35
|
+
</section>
|
|
36
|
+
<!-- DefaultPackage end view template: [PRSP-List-RecordList-Template] -->
|
|
37
|
+
`
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
Hash: 'PRSP-List-RecordList-Template-Table',
|
|
41
|
+
Template: /*html*/`
|
|
42
|
+
<!-- DefaultPackage pict view template: [PRSP-List-RecordList-Template-Table] -->
|
|
43
|
+
<table id="PRSP_List_Table" tablespacing="0" cellpadding="0" cellspacing="0" style="width: 100%; border-collapse: collapse; margin-bottom: 20px;">
|
|
44
|
+
<thead>{~T:PRSP-List-RecordListHeader-Template~}</thead>
|
|
45
|
+
<tbody id="PRSP_RecordList_Container_Entries">
|
|
46
|
+
{~T:PRSP-List-RecordListEntry-Template~}
|
|
47
|
+
</tbody>
|
|
48
|
+
</table>
|
|
49
|
+
<!-- DefaultPackage end view template: [PRSP-List-RecordList-Template-Table] -->
|
|
50
|
+
`
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
|
|
54
|
+
Renderables:
|
|
55
|
+
[
|
|
56
|
+
{
|
|
57
|
+
RenderableHash: 'PRSP_Renderable_RecordList',
|
|
58
|
+
TemplateHash: 'PRSP-List-RecordList-Template',
|
|
59
|
+
DestinationAddress: '#PRSP_RecordList_Container',
|
|
60
|
+
RenderMethod: 'replace'
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
|
|
64
|
+
Manifests: {}
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
class viewRecordSetListRecordList extends libPictView
|
|
68
|
+
{
|
|
69
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
70
|
+
{
|
|
71
|
+
let tmpOptions = Object.assign({}, _DEFAULT_CONFIGURATION_List_RecordList, pOptions);
|
|
72
|
+
super(pFable, tmpOptions, pServiceHash);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
module.exports = viewRecordSetListRecordList;
|
|
77
|
+
|
|
78
|
+
module.exports.default_configuration = _DEFAULT_CONFIGURATION_List_RecordList;
|
|
79
|
+
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
const libPictView = require('pict-view');
|
|
2
|
+
|
|
3
|
+
const _DEFAULT_CONFIGURATION_List_RecordListEntry = (
|
|
4
|
+
{
|
|
5
|
+
ViewIdentifier: 'PRSP-List-RecordListEntry',
|
|
6
|
+
|
|
7
|
+
DefaultRenderable: 'PRSP_Renderable_RecordListEntry',
|
|
8
|
+
DefaultDestinationAddress: '#PRSP_RecordListEntry_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-List-RecordListEntry-Template',
|
|
31
|
+
Template: /*html*/`
|
|
32
|
+
{~TSWP:PRSP-List-RecordListEntry-Template-Row:Record.Records.Records:Record~}
|
|
33
|
+
`
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
Hash: 'PRSP-List-RecordListEntry-Template-Row',
|
|
37
|
+
Template: /*html*/`
|
|
38
|
+
<!-- DefaultPackage pict view template: [PRSP-List-RecordListEntry-Template] -->
|
|
39
|
+
<tr>
|
|
40
|
+
{~TSWP:PRSP-List-RecordListEntry-Template-Row-Cell:Record.Payload.TableCells:Record.Data~}
|
|
41
|
+
</tr>
|
|
42
|
+
<!-- DefaultPackage end view template: [PRSP-List-RecordListEntry-Template] -->
|
|
43
|
+
`
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
Hash: 'PRSP-List-RecordListEntry-Template-Row-Cell',
|
|
47
|
+
Template: /*html*/`
|
|
48
|
+
<td style="border-bottom: 1px solid #ccc; padding: 5px;">
|
|
49
|
+
{~DVBK:Record.Payload:Record.Data.Key~}
|
|
50
|
+
</td>
|
|
51
|
+
`
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
Hash: 'PRSP-List-RecordListEntry-Template-Entry-Cell-Datum',
|
|
55
|
+
Template: /*html*/`
|
|
56
|
+
<!-- DefaultPackage pict view template: [PRSP-List-RecordListEntry-Template-Entry-Cell-Datum] -->
|
|
57
|
+
`
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
|
|
61
|
+
Renderables:
|
|
62
|
+
[
|
|
63
|
+
{
|
|
64
|
+
RenderableHash: 'PRSP_Renderable_RecordListEntry',
|
|
65
|
+
TemplateHash: 'PRSP-List-RecordListEntry-Template',
|
|
66
|
+
DestinationAddress: '#PRSP_RecordListEntry_Container',
|
|
67
|
+
RenderMethod: 'replace'
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
|
|
71
|
+
Manifests: {}
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
class viewRecordSetListRecordListEntry extends libPictView
|
|
75
|
+
{
|
|
76
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
77
|
+
{
|
|
78
|
+
let tmpOptions = Object.assign({}, _DEFAULT_CONFIGURATION_List_RecordListEntry, pOptions);
|
|
79
|
+
super(pFable, tmpOptions, pServiceHash);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
module.exports = viewRecordSetListRecordListEntry;
|
|
84
|
+
|
|
85
|
+
module.exports.default_configuration = _DEFAULT_CONFIGURATION_List_RecordListEntry;
|
|
86
|
+
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
const libPictView = require('pict-view');
|
|
2
|
+
|
|
3
|
+
const _DEFAULT_CONFIGURATION_List_RecordListHeader = (
|
|
4
|
+
{
|
|
5
|
+
ViewIdentifier: 'PRSP-List-RecordListHeader',
|
|
6
|
+
|
|
7
|
+
DefaultRenderable: 'PRSP_Renderable_RecordListHeader',
|
|
8
|
+
DefaultDestinationAddress: '#PRSP_RecordListHeader_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-List-RecordListHeader-Template',
|
|
31
|
+
Template: /*html*/`
|
|
32
|
+
<!-- DefaultPackage pict view template: [PRSP-List-RecordListHeader-Template] -->
|
|
33
|
+
<tr>
|
|
34
|
+
{~TS:PRSP-List-RecordListHeader-Template-Header:Record.TableCells~}
|
|
35
|
+
{~T:PRSP-List-RecordListHeader-Template-Extra-Header~}
|
|
36
|
+
</tr>
|
|
37
|
+
<!-- DefaultPackage end view template: [PRSP-List-RecordListHeader-Template] -->
|
|
38
|
+
`
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
Hash: 'PRSP-List-RecordListHeader-Template-Header',
|
|
42
|
+
Template: /*html*/`
|
|
43
|
+
<!-- DefaultPackage pict view template: [PRSP-List-RecordListHeader-Template-Header] -->
|
|
44
|
+
<th style="border-bottom: 1px solid #ccc; padding: 5px; background-color: #f2f2f2; color: #333;">
|
|
45
|
+
{~D:Record.DisplayName~}
|
|
46
|
+
</th>
|
|
47
|
+
<!-- DefaultPackage end view template: [PRSP-List-RecordListHeader-Template-Header] -->
|
|
48
|
+
`
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
|
|
52
|
+
Renderables:
|
|
53
|
+
[
|
|
54
|
+
{
|
|
55
|
+
RenderableHash: 'PRSP_Renderable_RecordListHeader',
|
|
56
|
+
TemplateHash: 'PRSP-List-RecordListHeader-Template',
|
|
57
|
+
DestinationAddress: '#PRSP_RecordListHeader_Container',
|
|
58
|
+
RenderMethod: 'replace'
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
|
|
62
|
+
Manifests: {}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
class viewRecordSetListRecordListHeader extends libPictView
|
|
66
|
+
{
|
|
67
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
68
|
+
{
|
|
69
|
+
let tmpOptions = Object.assign({}, _DEFAULT_CONFIGURATION_List_RecordListHeader, pOptions);
|
|
70
|
+
super(pFable, tmpOptions, pServiceHash);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
module.exports = viewRecordSetListRecordListHeader;
|
|
75
|
+
|
|
76
|
+
module.exports.default_configuration = _DEFAULT_CONFIGURATION_List_RecordListHeader;
|
|
77
|
+
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
const libPictView = require('pict-view');
|
|
2
|
+
|
|
3
|
+
const _DEFAULT_CONFIGURATION_List_Title = (
|
|
4
|
+
{
|
|
5
|
+
ViewIdentifier: 'PRSP-List-Title',
|
|
6
|
+
|
|
7
|
+
DefaultRenderable: 'PRSP_Renderable_Title',
|
|
8
|
+
DefaultDestinationAddress: '#PRSP_Title_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-List-Title-Template',
|
|
31
|
+
Template: /*html*/`
|
|
32
|
+
<!-- DefaultPackage pict view template: [PRSP-List-Title-Template] -->
|
|
33
|
+
<header id="PRSP_Title_Container">
|
|
34
|
+
<h1 id="PRSP_Title">{~D:Record.Title~}</h1>
|
|
35
|
+
<h2 id="PRSP_Subtitle">{~D:Record.Subtitle~}</h2>
|
|
36
|
+
</header>
|
|
37
|
+
<!-- DefaultPackage end view template: [PRSP-List-Title-Template] -->
|
|
38
|
+
`
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
|
|
42
|
+
Renderables:
|
|
43
|
+
[
|
|
44
|
+
{
|
|
45
|
+
RenderableHash: 'PRSP_Renderable_Title',
|
|
46
|
+
TemplateHash: 'PRSP-List-Title-Template',
|
|
47
|
+
DestinationAddress: '#PRSP_Title_Container',
|
|
48
|
+
RenderMethod: 'replace'
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
|
|
52
|
+
Manifests: {}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
class viewRecordSetListTitle extends libPictView
|
|
56
|
+
{
|
|
57
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
58
|
+
{
|
|
59
|
+
let tmpOptions = Object.assign({}, _DEFAULT_CONFIGURATION_List_Title, pOptions);
|
|
60
|
+
super(pFable, tmpOptions, pServiceHash);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
module.exports = viewRecordSetListTitle;
|
|
65
|
+
|
|
66
|
+
module.exports.default_configuration = _DEFAULT_CONFIGURATION_List_Title;
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
const libPictRecordSetRecordView = require('../RecordSet-RecordBaseView.js');
|
|
2
|
+
|
|
3
|
+
const viewHeaderList = require('./RecordSet-List-HeaderList.js');
|
|
4
|
+
const viewTitle = require('./RecordSet-List-Title.js');
|
|
5
|
+
const viewPaginationTop = require('./RecordSet-List-PaginationTop.js');
|
|
6
|
+
const viewRecordList = require('./RecordSet-List-RecordList.js');
|
|
7
|
+
const viewRecordListHeader = require('./RecordSet-List-RecordListHeader.js');
|
|
8
|
+
const viewRecordListEntry = require('./RecordSet-List-RecordListEntry.js');
|
|
9
|
+
const viewPaginationBottom = require('./RecordSet-List-PaginationBottom.js');
|
|
10
|
+
|
|
11
|
+
const _DEFAULT_CONFIGURATION__List = (
|
|
12
|
+
{
|
|
13
|
+
ViewIdentifier: 'PRSP-List',
|
|
14
|
+
|
|
15
|
+
DefaultRenderable: 'PRSP_Renderable_List',
|
|
16
|
+
DefaultDestinationAddress: '#PRSP_List_Container',
|
|
17
|
+
DefaultTemplateRecordAddress: false,
|
|
18
|
+
|
|
19
|
+
// If this is set to true, when the App initializes this will.
|
|
20
|
+
// While the App initializes, initialize will be called.
|
|
21
|
+
AutoInitialize: false,
|
|
22
|
+
AutoInitializeOrdinal: 0,
|
|
23
|
+
|
|
24
|
+
// If this is set to true, when the App autorenders (on load) this will.
|
|
25
|
+
// After the App initializes, render will be called.
|
|
26
|
+
AutoRender: false,
|
|
27
|
+
AutoRenderOrdinal: 0,
|
|
28
|
+
|
|
29
|
+
AutoSolveWithApp: false,
|
|
30
|
+
AutoSolveOrdinal: 0,
|
|
31
|
+
|
|
32
|
+
CSS: false,
|
|
33
|
+
CSSPriority: 500,
|
|
34
|
+
|
|
35
|
+
Templates:
|
|
36
|
+
[
|
|
37
|
+
{
|
|
38
|
+
Hash: 'PRSP-List-Template',
|
|
39
|
+
Template: /*html*/`
|
|
40
|
+
<!-- DefaultPackage pict view template: [PRSP-List-Template] -->
|
|
41
|
+
<section id="PRSP_List_Container">
|
|
42
|
+
{~V:PRSP-List-Title~}
|
|
43
|
+
{~V:PRSP-List-HeaderList~}
|
|
44
|
+
{~V:PRSP-List-PaginationTop~}
|
|
45
|
+
{~V:PRSP-List-RecordList~}
|
|
46
|
+
{~V:PRSP-List-PaginationBottom~}
|
|
47
|
+
</section>
|
|
48
|
+
<!-- DefaultPackage end view template: [PRSP-List-Template] -->
|
|
49
|
+
`
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
Hash: 'PRSP-List-Template-Record',
|
|
53
|
+
Template: /*html*/`
|
|
54
|
+
<!-- DefaultPackage end view template: [PRSP-List-Template] -->
|
|
55
|
+
`
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
|
|
59
|
+
Renderables:
|
|
60
|
+
[
|
|
61
|
+
{
|
|
62
|
+
RenderableHash: 'PRSP_Renderable_List',
|
|
63
|
+
TemplateHash: 'PRSP-List-Template',
|
|
64
|
+
DestinationAddress: '#PRSP_List_Container',
|
|
65
|
+
RenderMethod: 'replace'
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
|
|
69
|
+
Manifests: {}
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
class viewRecordSetList extends libPictRecordSetRecordView
|
|
73
|
+
{
|
|
74
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
75
|
+
{
|
|
76
|
+
let tmpOptions = Object.assign({}, _DEFAULT_CONFIGURATION__List, pOptions);
|
|
77
|
+
super(pFable, tmpOptions, pServiceHash);
|
|
78
|
+
|
|
79
|
+
this.childViews = {
|
|
80
|
+
headerList: null,
|
|
81
|
+
title: null,
|
|
82
|
+
paginationTop: null,
|
|
83
|
+
recordList: null,
|
|
84
|
+
recordListHeader: null,
|
|
85
|
+
recordListEntry: null,
|
|
86
|
+
paginationBottom: null
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
handleRecordSetListRoute(pRoutePayload)
|
|
91
|
+
{
|
|
92
|
+
if (typeof(pRoutePayload) != 'object')
|
|
93
|
+
{
|
|
94
|
+
throw new Error(`Pict RecordSet List view route handler called with invalid route payload.`);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
//_Pict.PictSectionRecordSet.recordSetProviderConfigurations['Book'], 'RSP-Provider-Book'
|
|
98
|
+
// FIXME: Not in love with this but good enough to start.
|
|
99
|
+
// FIXME: Typescript mumbo jumbo
|
|
100
|
+
// if (!('PictSectionRecordSet' in this.pict))
|
|
101
|
+
// {
|
|
102
|
+
// return false;
|
|
103
|
+
// }
|
|
104
|
+
const tmpProviderConfiguration = this.pict.PictSectionRecordSet.recordSetProviderConfigurations[pRoutePayload.data.RecordSet];
|
|
105
|
+
const tmpProviderHash = `RSP-Provider-${pRoutePayload.data.RecordSet}`;
|
|
106
|
+
|
|
107
|
+
const tmpFilterString = pRoutePayload.data.FilterString ? pRoutePayload.data.FilterString : '';
|
|
108
|
+
|
|
109
|
+
const tmpOffset = pRoutePayload.data.Offset ? pRoutePayload.data.Offset : 0;
|
|
110
|
+
const tmpPageSize = pRoutePayload.data.PageSize ? pRoutePayload.data.PageSize : 100;
|
|
111
|
+
|
|
112
|
+
return this.renderList(tmpProviderConfiguration, tmpProviderHash, tmpFilterString, tmpOffset, tmpPageSize);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
addRoutes(pPictRouter)
|
|
116
|
+
{
|
|
117
|
+
pPictRouter.addRoute('/PSRS/:RecordSet/List/FilteredTo/:FilterString/:Offset/:PageSize', this.handleRecordSetListRoute.bind(this));
|
|
118
|
+
pPictRouter.addRoute('/PSRS/:RecordSet/List/:Offset/:PageSize', this.handleRecordSetListRoute.bind(this));
|
|
119
|
+
pPictRouter.addRoute('/PSRS/:RecordSet/List/:Offset', this.handleRecordSetListRoute.bind(this));
|
|
120
|
+
pPictRouter.addRoute('/PSRS/:RecordSet/List', this.handleRecordSetListRoute.bind(this));
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
onBeforeRenderList(pRecordListData)
|
|
125
|
+
{
|
|
126
|
+
// Put code here to preprocess columns into other data parts.
|
|
127
|
+
this.formatDisplayData(pRecordListData);
|
|
128
|
+
|
|
129
|
+
return pRecordListData;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
formatDisplayData(pRecordListData)
|
|
133
|
+
{
|
|
134
|
+
pRecordListData.TableCells = [];
|
|
135
|
+
const tmpEntity = pRecordListData.RecordSetConfiguration.Entity;
|
|
136
|
+
this.excludedByDefaultCells = [
|
|
137
|
+
'ID' + tmpEntity,
|
|
138
|
+
'GUID' + tmpEntity,
|
|
139
|
+
'CreateDate',
|
|
140
|
+
'CreatingIDUser',
|
|
141
|
+
'DeleteDate',
|
|
142
|
+
'Deleted',
|
|
143
|
+
'DeletingIDUser',
|
|
144
|
+
'UpdateDate',
|
|
145
|
+
'UpdatingIDUser',
|
|
146
|
+
];
|
|
147
|
+
|
|
148
|
+
const tmpSchema = pRecordListData.RecordSchema;
|
|
149
|
+
const tmpProperties = tmpSchema?.properties;
|
|
150
|
+
// loop throught the schema and add the columns to the tableCells
|
|
151
|
+
for (const tmpColumn in tmpProperties)
|
|
152
|
+
{
|
|
153
|
+
if (tmpProperties.hasOwnProperty(tmpColumn))
|
|
154
|
+
{
|
|
155
|
+
// Check if the column is excluded by the default list of columns (or is not a GUID/ID)
|
|
156
|
+
if (this.excludedByDefaultCells.includes(tmpColumn) === false)
|
|
157
|
+
{
|
|
158
|
+
pRecordListData.TableCells.push({
|
|
159
|
+
'Key': tmpColumn,
|
|
160
|
+
'DisplayName': tmpProperties?.[tmpColumn].title || tmpColumn,
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return pRecordListData;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
async renderList(pRecordSetConfiguration, pProviderHash, pFilterString, pOffset, pPageSize)
|
|
169
|
+
{
|
|
170
|
+
// Get the records
|
|
171
|
+
if (!(pProviderHash in this.pict.providers))
|
|
172
|
+
{
|
|
173
|
+
this.pict.log.error(`RecordSetList: No provider found for ${pProviderHash} in ${pRecordSetConfiguration.RecordSet}. List Render failed.`);
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
let tmpRecordListData =
|
|
178
|
+
{
|
|
179
|
+
"Title": pRecordSetConfiguration.RecordSet,
|
|
180
|
+
|
|
181
|
+
"RecordSet": pRecordSetConfiguration.RecordSet,
|
|
182
|
+
"RecordSetConfiguration": pRecordSetConfiguration,
|
|
183
|
+
|
|
184
|
+
"RenderDestination": this.options.DefaultDestinationAddress,
|
|
185
|
+
|
|
186
|
+
"FilterString": pFilterString || false,
|
|
187
|
+
|
|
188
|
+
"Records": { "Records": [] },
|
|
189
|
+
"TotalRecordCount": { "Count": -1 },
|
|
190
|
+
|
|
191
|
+
"Offset": pOffset || 0,
|
|
192
|
+
"PageSize": pPageSize || 100,
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
// TODO: There are still problems with the way these have nested data. Discuss how we might move that around
|
|
196
|
+
// Fetch the records
|
|
197
|
+
tmpRecordListData.Records = await this.pict.providers[pProviderHash].getRecords(tmpRecordListData);
|
|
198
|
+
// Get the total record count
|
|
199
|
+
tmpRecordListData.TotalRecordCount = await this.pict.providers[pProviderHash].getRecordSetCount(tmpRecordListData);
|
|
200
|
+
// Get the record schema
|
|
201
|
+
tmpRecordListData.RecordSchema = this.pict.providers[pProviderHash].recordSchema;
|
|
202
|
+
|
|
203
|
+
// Get the "page end record number" for the current page (e.g. for messaging like Record 700 to 800 of 75,000)
|
|
204
|
+
tmpRecordListData.PageEnd = parseInt(tmpRecordListData.Offset) + tmpRecordListData.Records.Records.length;
|
|
205
|
+
|
|
206
|
+
// Compute the number of pages total
|
|
207
|
+
tmpRecordListData.PageCount = Math.ceil(tmpRecordListData.TotalRecordCount.Count / tmpRecordListData.PageSize);
|
|
208
|
+
|
|
209
|
+
// Generate each page's links.
|
|
210
|
+
// TODO: This is fast and cool; any reason not to?
|
|
211
|
+
tmpRecordListData.PageLinks = [];
|
|
212
|
+
for (let i = 0; i < tmpRecordListData.PageCount; i++)
|
|
213
|
+
{
|
|
214
|
+
if (tmpRecordListData.FilterString)
|
|
215
|
+
{
|
|
216
|
+
tmpRecordListData.PageLinks.push(
|
|
217
|
+
{
|
|
218
|
+
Page: i+1,
|
|
219
|
+
URL:`#/PSRS/${tmpRecordListData.RecordSet}/List/FilteredTo/${tmpRecordListData.FilterString}/${i * tmpRecordListData.PageSize}/${tmpRecordListData.PageSize}`
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
else
|
|
223
|
+
{
|
|
224
|
+
tmpRecordListData.PageLinks.push(
|
|
225
|
+
{
|
|
226
|
+
Page: i+1,
|
|
227
|
+
URL:`#/PSRS/${tmpRecordListData.RecordSet}/List/${i * tmpRecordListData.PageSize}/${tmpRecordListData.PageSize}`
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
// Get "bookmarks" as references to the array of page links.
|
|
232
|
+
tmpRecordListData.PageLinkBookmarks = (
|
|
233
|
+
{
|
|
234
|
+
Current: Math.floor(tmpRecordListData.Offset / tmpRecordListData.PageSize)
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
//FIXME: short-term workaround to not blow up the tempplate rendering with way too many links
|
|
238
|
+
const linkRangeStart = Math.max(0, tmpRecordListData.PageLinkBookmarks.Current - 10);
|
|
239
|
+
const linkRangeEnd = Math.min(tmpRecordListData.PageLinks.length - 1, tmpRecordListData.PageLinkBookmarks.Current + 10);
|
|
240
|
+
tmpRecordListData.PageLinksLimited = tmpRecordListData.PageLinks.slice(linkRangeStart, linkRangeEnd);
|
|
241
|
+
|
|
242
|
+
tmpRecordListData.PageLinkBookmarks.Previous = tmpRecordListData.PageLinkBookmarks.Current - 1;
|
|
243
|
+
tmpRecordListData.PageLinkBookmarks.Next = tmpRecordListData.PageLinkBookmarks.Current + 1;
|
|
244
|
+
if (tmpRecordListData.PageLinkBookmarks.Previous < 0)
|
|
245
|
+
{
|
|
246
|
+
tmpRecordListData.PageLinkBookmarks.Previous = false;
|
|
247
|
+
}
|
|
248
|
+
else
|
|
249
|
+
{
|
|
250
|
+
tmpRecordListData.PageLinkBookmarks.PreviousLink = tmpRecordListData.PageLinks[tmpRecordListData.PageLinkBookmarks.Previous];
|
|
251
|
+
}
|
|
252
|
+
if (tmpRecordListData.PageLinkBookmarks.Next >= tmpRecordListData.PageLinks.length)
|
|
253
|
+
{
|
|
254
|
+
tmpRecordListData.PageLinkBookmarks.Next = false;
|
|
255
|
+
}
|
|
256
|
+
else
|
|
257
|
+
{
|
|
258
|
+
tmpRecordListData.PageLinkBookmarks.NextLink = tmpRecordListData.PageLinks[tmpRecordListData.PageLinkBookmarks.Next];
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
tmpRecordListData = this.onBeforeRenderList(tmpRecordListData);
|
|
262
|
+
|
|
263
|
+
this.renderAsync('PRSP_Renderable_List', tmpRecordListData.RenderDestination, tmpRecordListData,
|
|
264
|
+
function (pError)
|
|
265
|
+
{
|
|
266
|
+
if (pError)
|
|
267
|
+
{
|
|
268
|
+
this.pict.log.error(`RecordSetList: Error rendering list ${pError}`, tmpRecordListData);
|
|
269
|
+
return false;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
if (this.pict.LogNoisiness > 0)
|
|
273
|
+
{
|
|
274
|
+
this.pict.log.info(`RecordSetList: Rendered list ${tmpRecordListData.RecordSet} with ${tmpRecordListData.Records.Records.length} records.`, tmpRecordListData);
|
|
275
|
+
}
|
|
276
|
+
else
|
|
277
|
+
{
|
|
278
|
+
this.pict.log.info(`RecordSetList: Rendered list ${tmpRecordListData.RecordSet} with ${tmpRecordListData.Records.Records.length} records.`);
|
|
279
|
+
}
|
|
280
|
+
return true;
|
|
281
|
+
}.bind(this));
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
onInitialize()
|
|
285
|
+
{
|
|
286
|
+
this.childViews.headerList = this.pict.addView('PRSP-List-HeaderList', viewHeaderList.default_configuration, viewHeaderList);
|
|
287
|
+
this.childViews.title = this.pict.addView('PRSP-List-Title', viewTitle.default_configuration, viewTitle);
|
|
288
|
+
this.childViews.paginationTop = this.pict.addView('PRSP-List-PaginationTop', viewPaginationTop.default_configuration, viewPaginationTop);
|
|
289
|
+
this.childViews.recordList = this.pict.addView('PRSP-List-RecordList', viewRecordList.default_configuration, viewRecordList);
|
|
290
|
+
this.childViews.recordListHeader = this.pict.addView('PRSP-List-RecordListHeader', viewRecordListHeader.default_configuration, viewRecordListHeader);
|
|
291
|
+
this.childViews.recordListEntry = this.pict.addView('PRSP-List-RecordListEntry', viewRecordListEntry.default_configuration, viewRecordListEntry);
|
|
292
|
+
this.childViews.paginationBottom = this.pict.addView('PRSP-List-PaginationBottom', viewPaginationBottom.default_configuration, viewPaginationBottom);
|
|
293
|
+
|
|
294
|
+
// Initialize the subviews
|
|
295
|
+
this.childViews.headerList.initialize();
|
|
296
|
+
this.childViews.title.initialize();
|
|
297
|
+
this.childViews.paginationTop.initialize();
|
|
298
|
+
this.childViews.recordList.initialize();
|
|
299
|
+
this.childViews.recordListHeader.initialize();
|
|
300
|
+
this.childViews.recordListEntry.initialize();
|
|
301
|
+
this.childViews.paginationBottom.initialize();
|
|
302
|
+
|
|
303
|
+
return super.onInitialize();
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
module.exports = viewRecordSetList;
|
|
308
|
+
|
|
309
|
+
module.exports.default_configuration = _DEFAULT_CONFIGURATION__List;
|
|
310
|
+
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
const libPictView = require('pict-view');
|
|
2
|
+
|
|
3
|
+
const _DEFAULT_CONFIGURATION_Read_HeaderRead = (
|
|
4
|
+
{
|
|
5
|
+
ViewIdentifier: 'PRSP-Read-HeaderRead',
|
|
6
|
+
|
|
7
|
+
DefaultRenderable: 'PRSP_Renderable_HeaderRead',
|
|
8
|
+
DefaultDestinationAddress: '#PRSP_HeaderRead_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-HeaderRead-Template',
|
|
31
|
+
Template: /*html*/`
|
|
32
|
+
<!-- DefaultPackage pict view template: [PRSP-Read-HeaderRead-Template] -->
|
|
33
|
+
<!-- DefaultPackage end view template: [PRSP-Read-HeaderRead-Template] -->
|
|
34
|
+
`
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
|
|
38
|
+
Renderables:
|
|
39
|
+
[
|
|
40
|
+
{
|
|
41
|
+
RenderableHash: 'PRSP_Renderable_HeaderRead',
|
|
42
|
+
TemplateHash: 'PRSP-Read-HeaderRead-Template',
|
|
43
|
+
DestinationAddress: '#PRSP_HeaderRead_Container',
|
|
44
|
+
RenderMethod: 'replace'
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
|
|
48
|
+
Manifests: {}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
class viewRecordSetReadHeaderRead extends libPictView
|
|
52
|
+
{
|
|
53
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
54
|
+
{
|
|
55
|
+
let tmpOptions = Object.assign({}, _DEFAULT_CONFIGURATION_Read_HeaderRead, pOptions);
|
|
56
|
+
super(pFable, tmpOptions, pServiceHash);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
module.exports = viewRecordSetReadHeaderRead;
|
|
61
|
+
|
|
62
|
+
module.exports.default_configuration = _DEFAULT_CONFIGURATION_Read_HeaderRead;
|
|
63
|
+
|