pict-section-recordset 1.0.1 → 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/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/simple_entity/Simple-RecordSet-Application.js +3 -3
- package/package.json +5 -4
- package/source/application/Pict-Application-RecordSet.js +12 -4
- package/source/providers/RecordSet-Router.js +64 -0
- package/source/services/RecordsSet-MetaController.js +89 -17
- package/source/views/RecordSet-RecordBaseView.js +84 -0
- package/source/views/RecordsSet-MacroView.js +63 -0
- package/source/views/dashboard/RecordSet-Dashboard.js +2 -2
- package/source/views/edit/RecordSet-Edit.js +2 -2
- package/source/views/list/RecordSet-List-PaginationBottom.js +42 -42
- package/source/views/list/RecordSet-List-PaginationTop.js +102 -90
- package/source/views/list/RecordSet-List-RecordList.js +3 -3
- package/source/views/list/RecordSet-List-RecordListEntry.js +15 -21
- package/source/views/list/RecordSet-List-RecordListHeader.js +3 -13
- package/source/views/list/RecordSet-List-Title.js +0 -1
- package/source/views/list/RecordSet-List.js +163 -20
- package/source/views/read/RecordSet-Read.js +150 -51
- package/test/PictSectionRecordSet-Basic_tests.js +5 -1
- package/test/PictSectionRecordSet-RecordProvider-Meadow_tests.js +1 -1
- package/types/Pict-Section-RecordSet.d.ts +5 -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-Router.d.ts +36 -0
- package/types/providers/RecordSet-Router.d.ts.map +1 -0
- package/types/services/RecordsSet-MetaController.d.ts +12 -6
- package/types/services/RecordsSet-MetaController.d.ts.map +1 -1
- 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 +33 -0
- package/types/views/RecordsSet-MacroView.d.ts.map +1 -1
- package/types/views/dashboard/RecordSet-Dashboard.d.ts +2 -3
- package/types/views/dashboard/RecordSet-Dashboard.d.ts.map +1 -1
- package/types/views/edit/RecordSet-Edit.d.ts +2 -3
- package/types/views/edit/RecordSet-Edit.d.ts.map +1 -1
- package/types/views/list/RecordSet-List-PaginationBottom.d.ts.map +1 -1
- package/types/views/list/RecordSet-List-PaginationTop.d.ts.map +1 -1
- package/types/views/list/RecordSet-List-RecordListEntry.d.ts.map +1 -1
- package/types/views/list/RecordSet-List-RecordListHeader.d.ts.map +1 -1
- package/types/views/list/RecordSet-List.d.ts +7 -3
- package/types/views/list/RecordSet-List.d.ts.map +1 -1
- package/types/views/read/RecordSet-Read.d.ts +13 -3
- package/types/views/read/RecordSet-Read.d.ts.map +1 -1
- /package/example_applications/{list_view/index.html → mocks/list-view.html} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const libPictRecordSetRecordView = require('../RecordSet-RecordBaseView.js');
|
|
2
2
|
|
|
3
3
|
const viewHeaderList = require('./RecordSet-List-HeaderList.js');
|
|
4
4
|
const viewTitle = require('./RecordSet-List-Title.js');
|
|
@@ -69,7 +69,7 @@ const _DEFAULT_CONFIGURATION__List = (
|
|
|
69
69
|
Manifests: {}
|
|
70
70
|
});
|
|
71
71
|
|
|
72
|
-
class viewRecordSetList extends
|
|
72
|
+
class viewRecordSetList extends libPictRecordSetRecordView
|
|
73
73
|
{
|
|
74
74
|
constructor(pFable, pOptions, pServiceHash)
|
|
75
75
|
{
|
|
@@ -87,6 +87,84 @@ class viewRecordSetList extends libPictView
|
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
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
|
+
|
|
90
168
|
async renderList(pRecordSetConfiguration, pProviderHash, pFilterString, pOffset, pPageSize)
|
|
91
169
|
{
|
|
92
170
|
// Get the records
|
|
@@ -96,43 +174,108 @@ class viewRecordSetList extends libPictView
|
|
|
96
174
|
return false;
|
|
97
175
|
}
|
|
98
176
|
|
|
99
|
-
let
|
|
100
|
-
|
|
101
|
-
|
|
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,
|
|
102
187
|
|
|
103
|
-
|
|
104
|
-
|
|
188
|
+
"Records": { "Records": [] },
|
|
189
|
+
"TotalRecordCount": { "Count": -1 },
|
|
105
190
|
|
|
106
|
-
|
|
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;
|
|
107
202
|
|
|
108
|
-
|
|
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;
|
|
109
205
|
|
|
110
|
-
|
|
111
|
-
|
|
206
|
+
// Compute the number of pages total
|
|
207
|
+
tmpRecordListData.PageCount = Math.ceil(tmpRecordListData.TotalRecordCount.Count / tmpRecordListData.PageSize);
|
|
112
208
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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
|
+
}
|
|
116
260
|
|
|
117
|
-
|
|
118
|
-
tmpResponse.TotalRecordCount = await this.pict.providers[pProviderHash].getRecordSetCount({Offset:tmpResponse.Offset, PageSize:tmpResponse.PageSize});
|
|
261
|
+
tmpRecordListData = this.onBeforeRenderList(tmpRecordListData);
|
|
119
262
|
|
|
120
|
-
this.renderAsync('PRSP_Renderable_List',
|
|
263
|
+
this.renderAsync('PRSP_Renderable_List', tmpRecordListData.RenderDestination, tmpRecordListData,
|
|
121
264
|
function (pError)
|
|
122
265
|
{
|
|
123
266
|
if (pError)
|
|
124
267
|
{
|
|
125
|
-
this.pict.log.error(`RecordSetList: Error rendering list ${pError}`,
|
|
268
|
+
this.pict.log.error(`RecordSetList: Error rendering list ${pError}`, tmpRecordListData);
|
|
126
269
|
return false;
|
|
127
270
|
}
|
|
128
271
|
|
|
129
272
|
if (this.pict.LogNoisiness > 0)
|
|
130
273
|
{
|
|
131
|
-
this.pict.log.info(`RecordSetList: Rendered list ${
|
|
274
|
+
this.pict.log.info(`RecordSetList: Rendered list ${tmpRecordListData.RecordSet} with ${tmpRecordListData.Records.Records.length} records.`, tmpRecordListData);
|
|
132
275
|
}
|
|
133
276
|
else
|
|
134
277
|
{
|
|
135
|
-
this.pict.log.info(`RecordSetList: Rendered list ${
|
|
278
|
+
this.pict.log.info(`RecordSetList: Rendered list ${tmpRecordListData.RecordSet} with ${tmpRecordListData.Records.Records.length} records.`);
|
|
136
279
|
}
|
|
137
280
|
return true;
|
|
138
281
|
}.bind(this));
|
|
@@ -1,60 +1,159 @@
|
|
|
1
|
-
const
|
|
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');
|
|
2
8
|
|
|
3
9
|
const _DEFAULT_CONFIGURATION__Read = (
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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*/`
|
|
32
38
|
<!-- DefaultPackage pict view template: [PRSP-Read-Template] -->
|
|
33
39
|
<!-- DefaultPackage end view template: [PRSP-Read-Template] -->
|
|
34
40
|
`
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
class viewRecordSetRead extends
|
|
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
|
|
52
58
|
{
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
+
}
|
|
58
157
|
}
|
|
59
158
|
|
|
60
159
|
module.exports = viewRecordSetRead;
|
|
@@ -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
|
});
|
|
@@ -74,7 +74,7 @@ suite
|
|
|
74
74
|
let _PictEnvironment = new libPict.EnvironmentObject(_Pict);
|
|
75
75
|
|
|
76
76
|
let _Application = new DoNothingApplication(_Pict, {});
|
|
77
|
-
_Pict.addProvider('BooksProvider', { Entity: 'Book', URLPrefix: 'http://
|
|
77
|
+
_Pict.addProvider('BooksProvider', { Entity: 'Book', URLPrefix: 'http://localhost:8086/1.0/' }, require('../source/providers/RecordSet-RecordProvider-MeadowEndpoints.js'));
|
|
78
78
|
await new Promise((resolve, reject) => _Application.initializeAsync((error) =>
|
|
79
79
|
{
|
|
80
80
|
if (error)
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
declare const _exports: {
|
|
2
2
|
new (pFable: any, pOptions: any, pServiceHash: any): import("./services/RecordsSet-MetaController.js");
|
|
3
|
-
default_configuration: {
|
|
3
|
+
default_configuration: {
|
|
4
|
+
DefaultMeadowURLPrefix: string;
|
|
5
|
+
};
|
|
4
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");
|
|
5
9
|
};
|
|
6
10
|
export = _exports;
|
|
7
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"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export = PictRecordSetRouter;
|
|
2
|
+
declare class PictRecordSetRouter {
|
|
3
|
+
constructor(pFable: any, pOptions: any, pServiceHash: any);
|
|
4
|
+
/** @type {Record<string, any>} */
|
|
5
|
+
options: Record<string, any>;
|
|
6
|
+
/** @type {import('pict') & { PictSectionRecordSet: InstanceType<import('../Pict-Section-RecordSet.js')> }} */
|
|
7
|
+
pict: import("pict") & {
|
|
8
|
+
PictSectionRecordSet: InstanceType<{
|
|
9
|
+
new (pFable: any, pOptions: any, pServiceHash: any): import("../services/RecordsSet-MetaController.js");
|
|
10
|
+
default_configuration: {
|
|
11
|
+
DefaultMeadowURLPrefix: string;
|
|
12
|
+
};
|
|
13
|
+
PictRecordSetApplication: typeof import("../application/Pict-Application-RecordSet.js");
|
|
14
|
+
RecordSetProviderBase: typeof import("./RecordSet-RecordProvider-Base.js");
|
|
15
|
+
RecordSetProviderMeadowEndpoints: typeof import("./RecordSet-RecordProvider-MeadowEndpoints.js");
|
|
16
|
+
}>;
|
|
17
|
+
};
|
|
18
|
+
pictRouter: any;
|
|
19
|
+
onInitialize(): any;
|
|
20
|
+
addRoutes(pRouter: any): void;
|
|
21
|
+
/**
|
|
22
|
+
* Navigate to a given route (set the browser URL string, add to history, trigger router)
|
|
23
|
+
*
|
|
24
|
+
* @param {string} pRoute - The route to navigate to
|
|
25
|
+
*/
|
|
26
|
+
navigate(pRoute: string): void;
|
|
27
|
+
}
|
|
28
|
+
declare namespace PictRecordSetRouter {
|
|
29
|
+
export { _DEFAULT_PROVIDER_CONFIGURATION as default_configuration };
|
|
30
|
+
}
|
|
31
|
+
declare namespace _DEFAULT_PROVIDER_CONFIGURATION {
|
|
32
|
+
let ProviderIdentifier: string;
|
|
33
|
+
let AutoInitialize: boolean;
|
|
34
|
+
let AutoInitializeOrdinal: number;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=RecordSet-Router.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecordSet-Router.d.ts","sourceRoot":"","sources":["../../source/providers/RecordSet-Router.js"],"names":[],"mappings":";AAWA;IAEC,2DAWC;IANA,kCAAkC;IAClC,SADW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAClB;IACZ,8GAA8G;IAC9G,MADW,OAAO,MAAM,CAAC,GAAG;QAAE,oBAAoB,EAAE,YAAY,CAAC;;;;;;;;SAAsC,CAAC,CAAA;KAAE,CACjG;IAET,gBAAsB;IAGvB,oBAWC;IAED,8BAUC;IAED;;;;OAIG;IACH,iBAFW,MAAM,QAKhB;CACD"}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
export = RecordSetMetacontroller;
|
|
2
2
|
declare class RecordSetMetacontroller {
|
|
3
3
|
constructor(pFable: any, pOptions: any, pServiceHash: any);
|
|
4
|
-
/** @type {import('pict') & { addView: (hash: string, options: any, prototype: any) => any }} */
|
|
5
|
-
pict: import("pict") & {
|
|
6
|
-
addView: (hash: string, options: any, prototype: any) => any;
|
|
7
|
-
};
|
|
8
4
|
/** @type {import('pict') & { addAndInstantiateSingletonService: (hash: string, options: any, prototype: any) => any }} */
|
|
9
5
|
fable: import("pict") & {
|
|
10
6
|
addAndInstantiateSingletonService: (hash: string, options: any, prototype: any) => any;
|
|
@@ -21,10 +17,20 @@ declare class RecordSetMetacontroller {
|
|
|
21
17
|
read: any;
|
|
22
18
|
dashboard: any;
|
|
23
19
|
};
|
|
20
|
+
recordSetProviders: {};
|
|
21
|
+
recordSetProviderConfigurations: {};
|
|
24
22
|
has_initialized: boolean;
|
|
25
|
-
|
|
23
|
+
loadRecordSetConfiguration(pRecordSetConfiguration: any): boolean;
|
|
24
|
+
loadRecordSetConfigurationArray(pRecordSetConfigurationArray: any): boolean;
|
|
25
|
+
loadRecordSetDynamcally(pRecordSet: any, pEntity: any, pDefaultFilter: any): any;
|
|
26
|
+
handleLoadDynamicRecordSetRoute(pRoutePayload: any): any;
|
|
27
|
+
addRoutes(pPictRouter: any): boolean;
|
|
28
|
+
initialize(): true | this;
|
|
26
29
|
}
|
|
27
30
|
declare namespace RecordSetMetacontroller {
|
|
28
|
-
|
|
31
|
+
export { _DEFAULT_CONFIGURATION as default_configuration };
|
|
32
|
+
}
|
|
33
|
+
declare namespace _DEFAULT_CONFIGURATION {
|
|
34
|
+
let DefaultMeadowURLPrefix: string;
|
|
29
35
|
}
|
|
30
36
|
//# sourceMappingURL=RecordsSet-MetaController.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecordsSet-MetaController.d.ts","sourceRoot":"","sources":["../../source/services/RecordsSet-MetaController.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"RecordsSet-MetaController.d.ts","sourceRoot":"","sources":["../../source/services/RecordsSet-MetaController.js"],"names":[],"mappings":";AAkBA;IAEC,2DAyBC;IApBA,0HAA0H;IAC1H,OADW,OAAO,MAAM,CAAC,GAAG;QAAE,iCAAiC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,KAAK,GAAG,CAAA;KAAE,CAC5G;IACV,kBAAkB;IAClB,KADW,GAAG,CACN;IACR,kBAAkB;IAClB,SADW,GAAG,CACF;IACZ,qBAAqB;IACrB,MADW,MAAM,CACR;IAET;;;;;MAKC;IAED,uBAA4B;IAC5B,oCAAyC;IAEzC,yBAA4B;IA6B7B,kEAiEC;IAED,4EAmBC;IAED,iFAyCC;IAED,yDAaC;IAED,qCAMC;IAED,0BAmCC;CACD"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export = viewPictSectionRecordSetViewBase;
|
|
2
|
+
declare class viewPictSectionRecordSetViewBase extends libPictView {
|
|
3
|
+
constructor(pFable: any, pOptions: any, pServiceHash: any);
|
|
4
|
+
/** @type {import('pict') & { log: any, instantiateServiceProviderWithoutRegistration: (hash: String) => any, PictSectionRecordSet: InstanceType<import('../Pict-Section-RecordSet.js') }} */
|
|
5
|
+
pict: import("pict") & {
|
|
6
|
+
log: any;
|
|
7
|
+
instantiateServiceProviderWithoutRegistration: (hash: string) => any;
|
|
8
|
+
PictSectionRecordSet: InstanceType<{
|
|
9
|
+
new (pFable: any, pOptions: any, pServiceHash: any): import("../services/RecordsSet-MetaController.js");
|
|
10
|
+
default_configuration: {
|
|
11
|
+
DefaultMeadowURLPrefix: string;
|
|
12
|
+
};
|
|
13
|
+
PictRecordSetApplication: typeof import("../application/Pict-Application-RecordSet.js");
|
|
14
|
+
RecordSetProviderBase: typeof import("../providers/RecordSet-RecordProvider-Base.js");
|
|
15
|
+
RecordSetProviderMeadowEndpoints: typeof import("../providers/RecordSet-RecordProvider-MeadowEndpoints.js");
|
|
16
|
+
}>;
|
|
17
|
+
};
|
|
18
|
+
addRoutes(pPictRouter: any): boolean;
|
|
19
|
+
}
|
|
20
|
+
declare namespace viewPictSectionRecordSetViewBase {
|
|
21
|
+
export { _DEFAULT_CONFIGURATION_Base_View as default_configuration };
|
|
22
|
+
}
|
|
23
|
+
import libPictView = require("pict-view");
|
|
24
|
+
declare namespace _DEFAULT_CONFIGURATION_Base_View {
|
|
25
|
+
let ViewIdentifier: string;
|
|
26
|
+
let DefaultRenderable: string;
|
|
27
|
+
let DefaultDestinationAddress: string;
|
|
28
|
+
let DefaultTemplateRecordAddress: boolean;
|
|
29
|
+
let AutoInitialize: boolean;
|
|
30
|
+
let AutoInitializeOrdinal: number;
|
|
31
|
+
let AutoRender: boolean;
|
|
32
|
+
let AutoRenderOrdinal: number;
|
|
33
|
+
let AutoSolveWithApp: boolean;
|
|
34
|
+
let AutoSolveOrdinal: number;
|
|
35
|
+
let CSS: boolean;
|
|
36
|
+
let CSSPriority: number;
|
|
37
|
+
let Templates: {
|
|
38
|
+
Hash: string;
|
|
39
|
+
Template: string;
|
|
40
|
+
}[];
|
|
41
|
+
let Renderables: {
|
|
42
|
+
RenderableHash: string;
|
|
43
|
+
TemplateHash: string;
|
|
44
|
+
DestinationAddress: string;
|
|
45
|
+
RenderMethod: string;
|
|
46
|
+
}[];
|
|
47
|
+
let Manifests: {};
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=RecordSet-RecordBaseView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecordSet-RecordBaseView.d.ts","sourceRoot":"","sources":["../../source/views/RecordSet-RecordBaseView.js"],"names":[],"mappings":";AA4DA;IAEC,2DAMC;IAFA,6LAA6L;IAC7L,MADW,OAAO,MAAM,CAAC,GAAG;QAAE,GAAG,EAAE,GAAG,CAAC;QAAC,6CAA6C,EAAE,CAAC,IAAI,QAAQ,KAAK,GAAG,CAAC;QAAC,oBAAoB,EAAE,YAAY,CAAC;;;;;;;;SAAsC,CAAA,CAAA;KAAE,CAChL;IAGV,qCAIC;CACD"}
|