pict-section-recordset 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/example_applications/simple_entity/Simple-RecordSet-Application.js +19 -0
- package/package.json +1 -1
- package/source/services/RecordsSet-MetaController.js +27 -0
- package/source/views/list/RecordSet-List-RecordListEntry.js +13 -0
- package/source/views/list/RecordSet-List-RecordListHeader.js +12 -2
- package/source/views/list/RecordSet-List.js +11 -4
|
@@ -20,6 +20,25 @@ module.exports.default_configuration.pict_configuration = (
|
|
|
20
20
|
"RecordSetType": "MeadowEndpoint", // Could be "Custom" which would require a provider to already be created for the record set.
|
|
21
21
|
"RecordSetMeadowEntity": "Book", // This leverages the /Schema endpoint to get the record set columns.
|
|
22
22
|
|
|
23
|
+
"RecordSetListColumns": [
|
|
24
|
+
{
|
|
25
|
+
"Key": "Title",
|
|
26
|
+
"DisplayName": "Title"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"Key": "Genre",
|
|
30
|
+
"DisplayName": "Genre"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"Key": "ISBN",
|
|
34
|
+
"DisplayName": "Int'l SBN"
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
|
|
38
|
+
"RecordSetListHasExtraColumns": true,
|
|
39
|
+
"RecordSetListExtraColumnsHeaderTemplate": "<th style=\"border-bottom: 1px solid #ccc; padding: 5px; background-color: #f2f2f2; color: #333;\">Cover</th>",
|
|
40
|
+
"RecordSetListExtraColumnRowTemplate": "<td><img src=\"{~D:Record.Data.ImageURL~}\"></td>",
|
|
41
|
+
|
|
23
42
|
"RecordSetURLPrefix": "/1.0/"
|
|
24
43
|
},
|
|
25
44
|
{
|
package/package.json
CHANGED
|
@@ -44,6 +44,8 @@ class RecordSetMetacontroller extends libFableServiceProviderBase
|
|
|
44
44
|
this.recordSetProviders = {};
|
|
45
45
|
this.recordSetProviderConfigurations = {};
|
|
46
46
|
|
|
47
|
+
this.recordSetListConfigurations = {};
|
|
48
|
+
|
|
47
49
|
this.has_initialized = false;
|
|
48
50
|
}
|
|
49
51
|
|
|
@@ -86,6 +88,31 @@ class RecordSetMetacontroller extends libFableServiceProviderBase
|
|
|
86
88
|
return false;
|
|
87
89
|
}
|
|
88
90
|
|
|
91
|
+
let tmpExtraColumnHeaderTemplateHash = `RecordSet-List-ExtraColumnHeader-${pRecordSetConfiguration.RecordSet}`;
|
|
92
|
+
pRecordSetConfiguration.RecordSetListExtraColumnsHeaderTemplateHash = tmpExtraColumnHeaderTemplateHash;
|
|
93
|
+
let tmpExtraColumnRowTemplateHash = `RecordSet-List-ExtraColumnRow-${pRecordSetConfiguration.RecordSet}`;
|
|
94
|
+
pRecordSetConfiguration.RecordSetListExtraColumnRowTemplateHash = tmpExtraColumnRowTemplateHash;
|
|
95
|
+
if (pRecordSetConfiguration.RecordSetListHasExtraColumns)
|
|
96
|
+
{
|
|
97
|
+
let tmpRecordSetExtraColumnHeaderTemplate = pRecordSetConfiguration.RecordSetListExtraColumnsHeaderTemplate;
|
|
98
|
+
if (tmpRecordSetExtraColumnHeaderTemplate === undefined)
|
|
99
|
+
{
|
|
100
|
+
tmpRecordSetExtraColumnHeaderTemplate = '';
|
|
101
|
+
}
|
|
102
|
+
let tmpRecordSetExtraColumnRowTemplate = pRecordSetConfiguration.RecordSetListExtraColumnRowTemplate;
|
|
103
|
+
if (tmpRecordSetExtraColumnRowTemplate === undefined)
|
|
104
|
+
{
|
|
105
|
+
tmpRecordSetExtraColumnRowTemplate = '';
|
|
106
|
+
}
|
|
107
|
+
this.fable.TemplateProvider.addTemplate(tmpExtraColumnHeaderTemplateHash, tmpRecordSetExtraColumnHeaderTemplate);
|
|
108
|
+
this.fable.TemplateProvider.addTemplate(tmpExtraColumnRowTemplateHash, tmpRecordSetExtraColumnRowTemplate);
|
|
109
|
+
}
|
|
110
|
+
else
|
|
111
|
+
{
|
|
112
|
+
this.fable.TemplateProvider.addTemplate(tmpExtraColumnHeaderTemplateHash, '');
|
|
113
|
+
this.fable.TemplateProvider.addTemplate(tmpExtraColumnRowTemplateHash, '');
|
|
114
|
+
}
|
|
115
|
+
|
|
89
116
|
let tmpProvider = false;
|
|
90
117
|
|
|
91
118
|
const providerConfiguration = Object.assign({}, {Hash: `RSP-Provider-${pRecordSetConfiguration.RecordSet}`}, pRecordSetConfiguration);
|
|
@@ -39,10 +39,23 @@ const _DEFAULT_CONFIGURATION_List_RecordListEntry = (
|
|
|
39
39
|
<!-- DefaultPackage pict view template: [PRSP-List-RecordListEntry-Template] -->
|
|
40
40
|
<tr>
|
|
41
41
|
{~TSWP:PRSP-List-RecordListEntry-Template-Row-Cell:Record.Payload.TableCells:Record.Data~}
|
|
42
|
+
{~T:PRSP-List-RecordListHeader-Template-Extra-Row~}
|
|
42
43
|
{~T:PRSP-List-RecordListAction-Template-Cell~}
|
|
43
44
|
</tr>
|
|
44
45
|
<!-- DefaultPackage end view template: [PRSP-List-RecordListEntry-Template] -->
|
|
45
46
|
`
|
|
47
|
+
//
|
|
48
|
+
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
Hash: 'PRSP-List-RecordListHeader-Template-Extra-Row',
|
|
52
|
+
Template: /*html*/`
|
|
53
|
+
<!-- DefaultPackage pict view template: [PRSP-List-RecordListHeader-Template-Extra-Row] -->
|
|
54
|
+
{~TBR:Record.Payload.RecordSetConfiguration.RecordSetListExtraColumnRowTemplateHash~}
|
|
55
|
+
<!-- DefaultPackage end view template: [PRSP-List-RecordListHeader-Extra-Row] -->
|
|
56
|
+
`
|
|
57
|
+
// {~TBR:Record.Payload.RecordSetConfiguration.RecordSetListExtraColumnRowTemplateHash~}
|
|
58
|
+
|
|
46
59
|
},
|
|
47
60
|
{
|
|
48
61
|
Hash: 'PRSP-List-RecordListEntry-Template-Row-Cell',
|
|
@@ -47,15 +47,25 @@ const _DEFAULT_CONFIGURATION_List_RecordListHeader = (
|
|
|
47
47
|
</th>
|
|
48
48
|
<!-- DefaultPackage end view template: [PRSP-List-RecordListHeader-Template-Header] -->
|
|
49
49
|
`
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
Hash: 'PRSP-List-RecordListHeader-Template-Extra-Header',
|
|
53
|
+
Template: /*html*/`
|
|
54
|
+
<!-- DefaultPackage pict view template: [PRSP-List-RecordListHeader-Template-Extra-Header] -->
|
|
55
|
+
{~TBR:Record.RecordSetConfiguration.RecordSetListExtraColumnsHeaderTemplateHash~}
|
|
56
|
+
<!-- DefaultPackage end view template: [PRSP-List-RecordListHeader-Extra-Header] -->
|
|
57
|
+
`
|
|
58
|
+
// {~TBR:Record.RecordSetConfiguration.RecordSetListExtraColumnsHeaderTemplateHash~}
|
|
59
|
+
|
|
50
60
|
},
|
|
51
61
|
{
|
|
52
62
|
Hash: 'PRSP-List-RecordListActions-Template-Header',
|
|
53
63
|
Template: /*html*/`
|
|
54
|
-
<!-- DefaultPackage pict view template: [PRSP-List-
|
|
64
|
+
<!-- DefaultPackage pict view template: [PRSP-List-RecordListActions-Template-Header] -->
|
|
55
65
|
<th style="border-bottom: 1px solid #ccc; padding: 5px; background-color: #f2f2f2; color: #333;">
|
|
56
66
|
Actions
|
|
57
67
|
</th>
|
|
58
|
-
<!-- DefaultPackage end view template: [PRSP-List-
|
|
68
|
+
<!-- DefaultPackage end view template: [PRSP-List-RecordListActions-Template-Header] -->
|
|
59
69
|
`
|
|
60
70
|
},
|
|
61
71
|
],
|
|
@@ -123,13 +123,10 @@ class viewRecordSetList extends libPictRecordSetRecordView
|
|
|
123
123
|
|
|
124
124
|
onBeforeRenderList(pRecordListData)
|
|
125
125
|
{
|
|
126
|
-
// Put code here to preprocess columns into other data parts.
|
|
127
|
-
this.formatDisplayData(pRecordListData);
|
|
128
|
-
|
|
129
126
|
return pRecordListData;
|
|
130
127
|
}
|
|
131
128
|
|
|
132
|
-
|
|
129
|
+
dynamicallyGenerateColumns(pRecordListData)
|
|
133
130
|
{
|
|
134
131
|
pRecordListData.TableCells = [];
|
|
135
132
|
const tmpEntity = pRecordListData.RecordSetConfiguration.Entity;
|
|
@@ -261,6 +258,16 @@ class viewRecordSetList extends libPictRecordSetRecordView
|
|
|
261
258
|
tmpRecordListData.PageLinkBookmarks.NextLink = tmpRecordListData.PageLinks[tmpRecordListData.PageLinkBookmarks.Next];
|
|
262
259
|
}
|
|
263
260
|
|
|
261
|
+
// Put code here to preprocess columns into other data parts.
|
|
262
|
+
if (tmpRecordListData.RecordSetConfiguration.hasOwnProperty('RecordSetListColumns'))
|
|
263
|
+
{
|
|
264
|
+
tmpRecordListData.TableCells = tmpRecordListData.RecordSetConfiguration.RecordSetListColumns;
|
|
265
|
+
}
|
|
266
|
+
else
|
|
267
|
+
{
|
|
268
|
+
this.dynamicallyGenerateColumns(tmpRecordListData);
|
|
269
|
+
}
|
|
270
|
+
|
|
264
271
|
tmpRecordListData = this.onBeforeRenderList(tmpRecordListData);
|
|
265
272
|
|
|
266
273
|
this.renderAsync('PRSP_Renderable_List', tmpRecordListData.RenderDestination, tmpRecordListData,
|