pict-section-recordset 1.0.14 → 1.0.16

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.
Files changed (120) hide show
  1. package/example_applications/simple_entity/Simple-RecordSet-Application.js +113 -0
  2. package/package.json +3 -3
  3. package/source/application/Pict-Application-RecordSet.js +1 -0
  4. package/source/providers/RecordSet-Link-Manager.js +2 -1
  5. package/source/providers/RecordSet-RecordProvider-Base.js +28 -0
  6. package/source/providers/RecordSet-RecordProvider-MeadowEndpoints.js +53 -3
  7. package/source/providers/RecordSet-Router.js +1 -0
  8. package/source/services/RecordsSet-MetaController.js +85 -1
  9. package/source/templates/Pict-Template-FilterView.js +172 -0
  10. package/source/views/RecordSet-Filter.js +47 -9
  11. package/source/views/RecordSet-RecordBaseView.js +1 -0
  12. package/source/views/RecordsSet-MacroView.js +1 -0
  13. package/source/views/dashboard/RecordSet-Dashboard-HeaderDashboard.js +18 -17
  14. package/source/views/dashboard/RecordSet-Dashboard-PaginationBottom.js +68 -0
  15. package/source/views/dashboard/RecordSet-Dashboard-PaginationTop.js +128 -0
  16. package/source/views/dashboard/RecordSet-Dashboard-RecordList.js +80 -0
  17. package/source/views/dashboard/RecordSet-Dashboard-RecordListEntry.js +121 -0
  18. package/source/views/dashboard/RecordSet-Dashboard-RecordListHeader.js +99 -0
  19. package/source/views/dashboard/RecordSet-Dashboard-TabBarDashboard.js +1 -0
  20. package/source/views/dashboard/RecordSet-Dashboard-Title.js +67 -0
  21. package/source/views/dashboard/RecordSet-Dashboard.js +355 -37
  22. package/source/views/edit/RecordSet-Edit-HeaderEdit.js +1 -0
  23. package/source/views/edit/RecordSet-Edit-RecordEdit.js +1 -0
  24. package/source/views/edit/RecordSet-Edit-RecordEditControls.js +1 -0
  25. package/source/views/edit/RecordSet-Edit-RecordEditExtra.js +1 -0
  26. package/source/views/edit/RecordSet-Edit-TabBarEdit.js +1 -0
  27. package/source/views/edit/RecordSet-Edit.js +1 -0
  28. package/source/views/list/RecordSet-List-HeaderList.js +1 -0
  29. package/source/views/list/RecordSet-List-PaginationBottom.js +1 -0
  30. package/source/views/list/RecordSet-List-PaginationTop.js +1 -0
  31. package/source/views/list/RecordSet-List-RecordList.js +1 -0
  32. package/source/views/list/RecordSet-List-RecordListEntry.js +1 -0
  33. package/source/views/list/RecordSet-List-RecordListHeader.js +1 -0
  34. package/source/views/list/RecordSet-List-Title.js +1 -0
  35. package/source/views/list/RecordSet-List.js +12 -34
  36. package/source/views/read/RecordSet-Read-HeaderRead.js +1 -0
  37. package/source/views/read/RecordSet-Read-RecordRead.js +1 -0
  38. package/source/views/read/RecordSet-Read-RecordReadExtra.js +1 -0
  39. package/source/views/read/RecordSet-Read-TabBarRead.js +1 -0
  40. package/source/views/read/RecordSet-Read.js +1 -0
  41. package/types/Pict-Section-RecordSet.d.ts +1 -3
  42. package/types/application/Pict-Application-RecordSet.d.ts +1 -7
  43. package/types/application/Pict-Application-RecordSet.d.ts.map +1 -1
  44. package/types/providers/RecordSet-Link-Manager.d.ts +2 -5
  45. package/types/providers/RecordSet-Link-Manager.d.ts.map +1 -1
  46. package/types/providers/RecordSet-RecordProvider-Base.d.ts +19 -0
  47. package/types/providers/RecordSet-RecordProvider-Base.d.ts.map +1 -1
  48. package/types/providers/RecordSet-RecordProvider-MeadowEndpoints.d.ts +38 -5
  49. package/types/providers/RecordSet-RecordProvider-MeadowEndpoints.d.ts.map +1 -1
  50. package/types/providers/RecordSet-Router.d.ts +3 -8
  51. package/types/providers/RecordSet-Router.d.ts.map +1 -1
  52. package/types/services/RecordsSet-MetaController.d.ts +20 -4
  53. package/types/services/RecordsSet-MetaController.d.ts.map +1 -1
  54. package/types/templates/Pict-Template-FilterView.d.ts +18 -0
  55. package/types/templates/Pict-Template-FilterView.d.ts.map +1 -0
  56. package/types/views/RecordSet-Filter.d.ts +30 -27
  57. package/types/views/RecordSet-Filter.d.ts.map +1 -1
  58. package/types/views/RecordSet-RecordBaseView.d.ts +3 -28
  59. package/types/views/RecordSet-RecordBaseView.d.ts.map +1 -1
  60. package/types/views/RecordsSet-MacroView.d.ts +2 -25
  61. package/types/views/RecordsSet-MacroView.d.ts.map +1 -1
  62. package/types/views/dashboard/RecordSet-Dashboard-HeaderDashboard.d.ts +6 -29
  63. package/types/views/dashboard/RecordSet-Dashboard-HeaderDashboard.d.ts.map +1 -1
  64. package/types/views/dashboard/RecordSet-Dashboard-PaginationBottom.d.ts +11 -0
  65. package/types/views/dashboard/RecordSet-Dashboard-PaginationBottom.d.ts.map +1 -0
  66. package/types/views/dashboard/RecordSet-Dashboard-PaginationTop.d.ts +11 -0
  67. package/types/views/dashboard/RecordSet-Dashboard-PaginationTop.d.ts.map +1 -0
  68. package/types/views/dashboard/RecordSet-Dashboard-RecordList.d.ts +11 -0
  69. package/types/views/dashboard/RecordSet-Dashboard-RecordList.d.ts.map +1 -0
  70. package/types/views/dashboard/RecordSet-Dashboard-RecordListEntry.d.ts +11 -0
  71. package/types/views/dashboard/RecordSet-Dashboard-RecordListEntry.d.ts.map +1 -0
  72. package/types/views/dashboard/RecordSet-Dashboard-RecordListHeader.d.ts +11 -0
  73. package/types/views/dashboard/RecordSet-Dashboard-RecordListHeader.d.ts.map +1 -0
  74. package/types/views/dashboard/RecordSet-Dashboard-RecordSetDashboard.d.ts +2 -25
  75. package/types/views/dashboard/RecordSet-Dashboard-RecordSetDashboard.d.ts.map +1 -1
  76. package/types/views/dashboard/RecordSet-Dashboard-TabBarDashboard.d.ts +2 -25
  77. package/types/views/dashboard/RecordSet-Dashboard-TabBarDashboard.d.ts.map +1 -1
  78. package/types/views/dashboard/RecordSet-Dashboard-Title.d.ts +11 -0
  79. package/types/views/dashboard/RecordSet-Dashboard-Title.d.ts.map +1 -0
  80. package/types/views/dashboard/RecordSet-Dashboard.d.ts +20 -25
  81. package/types/views/dashboard/RecordSet-Dashboard.d.ts.map +1 -1
  82. package/types/views/edit/RecordSet-Edit-HeaderEdit.d.ts +2 -25
  83. package/types/views/edit/RecordSet-Edit-HeaderEdit.d.ts.map +1 -1
  84. package/types/views/edit/RecordSet-Edit-RecordEdit.d.ts +2 -25
  85. package/types/views/edit/RecordSet-Edit-RecordEdit.d.ts.map +1 -1
  86. package/types/views/edit/RecordSet-Edit-RecordEditControls.d.ts +2 -25
  87. package/types/views/edit/RecordSet-Edit-RecordEditControls.d.ts.map +1 -1
  88. package/types/views/edit/RecordSet-Edit-RecordEditExtra.d.ts +2 -25
  89. package/types/views/edit/RecordSet-Edit-RecordEditExtra.d.ts.map +1 -1
  90. package/types/views/edit/RecordSet-Edit-TabBarEdit.d.ts +2 -25
  91. package/types/views/edit/RecordSet-Edit-TabBarEdit.d.ts.map +1 -1
  92. package/types/views/edit/RecordSet-Edit.d.ts +2 -25
  93. package/types/views/edit/RecordSet-Edit.d.ts.map +1 -1
  94. package/types/views/list/RecordSet-List-HeaderList.d.ts +2 -25
  95. package/types/views/list/RecordSet-List-HeaderList.d.ts.map +1 -1
  96. package/types/views/list/RecordSet-List-PaginationBottom.d.ts +2 -25
  97. package/types/views/list/RecordSet-List-PaginationBottom.d.ts.map +1 -1
  98. package/types/views/list/RecordSet-List-PaginationTop.d.ts +2 -25
  99. package/types/views/list/RecordSet-List-PaginationTop.d.ts.map +1 -1
  100. package/types/views/list/RecordSet-List-RecordList.d.ts +2 -25
  101. package/types/views/list/RecordSet-List-RecordList.d.ts.map +1 -1
  102. package/types/views/list/RecordSet-List-RecordListEntry.d.ts +2 -25
  103. package/types/views/list/RecordSet-List-RecordListEntry.d.ts.map +1 -1
  104. package/types/views/list/RecordSet-List-RecordListHeader.d.ts +2 -25
  105. package/types/views/list/RecordSet-List-RecordListHeader.d.ts.map +1 -1
  106. package/types/views/list/RecordSet-List-Title.d.ts +2 -25
  107. package/types/views/list/RecordSet-List-Title.d.ts.map +1 -1
  108. package/types/views/list/RecordSet-List.d.ts +2 -26
  109. package/types/views/list/RecordSet-List.d.ts.map +1 -1
  110. package/types/views/read/RecordSet-Read-HeaderRead.d.ts +2 -25
  111. package/types/views/read/RecordSet-Read-HeaderRead.d.ts.map +1 -1
  112. package/types/views/read/RecordSet-Read-RecordRead.d.ts +2 -25
  113. package/types/views/read/RecordSet-Read-RecordRead.d.ts.map +1 -1
  114. package/types/views/read/RecordSet-Read-RecordReadExtra.d.ts +2 -25
  115. package/types/views/read/RecordSet-Read-RecordReadExtra.d.ts.map +1 -1
  116. package/types/views/read/RecordSet-Read-TabBarRead.d.ts +2 -25
  117. package/types/views/read/RecordSet-Read-TabBarRead.d.ts.map +1 -1
  118. package/types/views/read/RecordSet-Read.d.ts +2 -25
  119. package/types/views/read/RecordSet-Read.d.ts.map +1 -1
  120. package/source/views/dashboard/RecordSet-Dashboard-RecordSetDashboard.js +0 -63
@@ -0,0 +1,67 @@
1
+ const libPictView = require('pict-view');
2
+
3
+ /** @type {Record<string, any>} */
4
+ const _DEFAULT_CONFIGURATION_List_Title =
5
+ {
6
+ ViewIdentifier: 'PRSP-Dashboard-Title',
7
+
8
+ DefaultRenderable: 'PRSP_Renderable_Title',
9
+ DefaultDestinationAddress: '#PRSP_Title_Container',
10
+ DefaultTemplateRecordAddress: false,
11
+
12
+ // If this is set to true, when the App initializes this will.
13
+ // While the App initializes, initialize will be called.
14
+ AutoInitialize: false,
15
+ AutoInitializeOrdinal: 0,
16
+
17
+ // If this is set to true, when the App autorenders (on load) this will.
18
+ // After the App initializes, render will be called.
19
+ AutoRender: false,
20
+ AutoRenderOrdinal: 0,
21
+
22
+ AutoSolveWithApp: false,
23
+ AutoSolveOrdinal: 0,
24
+
25
+ CSS: false,
26
+ CSSPriority: 500,
27
+
28
+ Templates:
29
+ [
30
+ {
31
+ Hash: 'PRSP-Dashboard-Title-Template',
32
+ Template: /*html*/`
33
+ <!-- DefaultPackage pict view template: [PRSP-Dashboard-Title-Template] -->
34
+ <header id="PRSP_Title_Container">
35
+ <h1 id="PRSP_Title">{~D:Record.Title~}</h1>
36
+ <h2 id="PRSP_Subtitle">{~D:Record.Subtitle~}</h2>
37
+ </header>
38
+ <!-- DefaultPackage end view template: [PRSP-Dashboard-Title-Template] -->
39
+ `
40
+ },
41
+ ],
42
+
43
+ Renderables:
44
+ [
45
+ {
46
+ RenderableHash: 'PRSP_Renderable_Title',
47
+ TemplateHash: 'PRSP-Dashboard-Title-Template',
48
+ DestinationAddress: '#PRSP_Title_Container',
49
+ RenderMethod: 'replace'
50
+ },
51
+ ],
52
+
53
+ Manifests: {},
54
+ };
55
+
56
+ class viewRecordSetListTitle extends libPictView
57
+ {
58
+ constructor(pFable, pOptions, pServiceHash)
59
+ {
60
+ let tmpOptions = Object.assign({}, _DEFAULT_CONFIGURATION_List_Title, pOptions);
61
+ super(pFable, tmpOptions, pServiceHash);
62
+ }
63
+ }
64
+
65
+ module.exports = viewRecordSetListTitle;
66
+
67
+ module.exports.default_configuration = _DEFAULT_CONFIGURATION_List_Title;
@@ -1,52 +1,80 @@
1
1
  const libPictRecordSetRecordView = require('../RecordSet-RecordBaseView.js');
2
2
 
3
- const _DEFAULT_CONFIGURATION__Dashboard =
4
- {
5
- ViewIdentifier: 'PRSP-Dashboard',
3
+ const viewHeaderDashboard = require('./RecordSet-Dashboard-HeaderDashboard.js');
4
+ const viewTitle = require('./RecordSet-Dashboard-Title.js');
5
+ const viewFilters = require('../RecordSet-Filter.js');
6
+ const viewPaginationTop = require('./RecordSet-Dashboard-PaginationTop.js');
7
+ const viewRecordList = require('./RecordSet-Dashboard-RecordList.js');
8
+ const viewRecordListHeader = require('./RecordSet-Dashboard-RecordListHeader.js');
9
+ const viewRecordListEntry = require('./RecordSet-Dashboard-RecordListEntry.js');
10
+ const viewPaginationBottom = require('./RecordSet-Dashboard-PaginationBottom.js');
6
11
 
7
- DefaultRenderable: 'PRSP_Renderable_Dashboard',
8
- DefaultDestinationAddress: '#PRSP_Dashboard_Container',
9
- DefaultTemplateRecordAddress: false,
12
+ /** @type {Record<string, any>} */
13
+ const _DEFAULT_CONFIGURATION__Dashboard = (
14
+ {
15
+ ViewIdentifier: 'PRSP-List',
10
16
 
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,
17
+ DefaultRenderable: 'PRSP_Renderable_List',
18
+ DefaultDestinationAddress: '#PRSP_Container',
19
+ DefaultTemplateRecordAddress: false,
15
20
 
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,
21
+ // If this is set to true, when the App initializes this will.
22
+ // While the App initializes, initialize will be called.
23
+ AutoInitialize: false,
24
+ AutoInitializeOrdinal: 0,
20
25
 
21
- AutoSolveWithApp: false,
22
- AutoSolveOrdinal: 0,
26
+ // If this is set to true, when the App autorenders (on load) this will.
27
+ // After the App initializes, render will be called.
28
+ AutoRender: false,
29
+ AutoRenderOrdinal: 0,
23
30
 
24
- CSS: false,
25
- CSSPriority: 500,
31
+ AutoSolveWithApp: false,
32
+ AutoSolveOrdinal: 0,
26
33
 
27
- Templates:
28
- [
29
- {
30
- Hash: 'PRSP-Dashboard-Template',
31
- Template: /*html*/`
34
+ CSS: false,
35
+ CSSPriority: 500,
36
+
37
+ Templates:
38
+ [
39
+ {
40
+ Hash: 'PRSP-Dashboard-Template',
41
+ Template: /*html*/`
32
42
  <!-- DefaultPackage pict view template: [PRSP-Dashboard-Template] -->
43
+ <section id="PRSP_List_Container">
44
+ {~V:PRSP-Dashboard-Title~}
45
+ {~V:PRSP-Dashboard-HeaderDashboard~}
46
+ {~FV:PRSP-Filters:Dashboard~}
47
+ {~V:PRSP-Dashboard-PaginationTop~}
48
+ {~V:PRSP-Dashboard-RecordList~}
49
+ {~V:PRSP-Dashboard-PaginationBottom~}
50
+ </section>
33
51
  <!-- DefaultPackage end view template: [PRSP-Dashboard-Template] -->
34
- `
35
- }
36
- ],
52
+ `
53
+ },
54
+ {
55
+ Hash: 'PRSP-Dashboard-Template-Record',
56
+ Template: /*html*/`
57
+ <!-- DefaultPackage end view template: [PRSP-Dashboard-Template] -->
58
+ `
59
+ },
60
+ {
61
+ Hash: 'PRSP-Dashboard-Filter-URL',
62
+ Template: /*html*/`#/PSRS/{~D:Record.Filter.RecordSet~}/DashboardFilteredTo/{~D:Record.Filter.FilterString~}`
63
+ }
64
+ ],
37
65
 
38
- Renderables:
39
- [
40
- {
41
- RenderableHash: 'PRSP_Renderable_Dashboard',
42
- TemplateHash: 'PRSP-Dashboard-Template',
43
- DestinationAddress: '#PRSP_Dashboard_Container',
44
- RenderMethod: 'replace'
45
- }
46
- ],
66
+ Renderables:
67
+ [
68
+ {
69
+ RenderableHash: 'PRSP_Renderable_List',
70
+ TemplateHash: 'PRSP-Dashboard-Template',
71
+ DestinationAddress: '#PRSP_Container',
72
+ RenderMethod: 'replace'
73
+ }
74
+ ],
47
75
 
48
- Manifests: {}
49
- };
76
+ Manifests: {}
77
+ });
50
78
 
51
79
  class viewRecordSetDashboard extends libPictRecordSetRecordView
52
80
  {
@@ -54,6 +82,296 @@ class viewRecordSetDashboard extends libPictRecordSetRecordView
54
82
  {
55
83
  let tmpOptions = Object.assign({}, _DEFAULT_CONFIGURATION__Dashboard, pOptions);
56
84
  super(pFable, tmpOptions, pServiceHash);
85
+
86
+ this.childViews = {
87
+ headerList: null,
88
+ title: null,
89
+ paginationTop: null,
90
+ recordList: null,
91
+ recordListHeader: null,
92
+ recordListEntry: null,
93
+ paginationBottom: null
94
+ };
95
+ }
96
+
97
+ handleRecordSetDashboardRoute(pRoutePayload)
98
+ {
99
+ if (typeof(pRoutePayload) != 'object')
100
+ {
101
+ throw new Error(`Pict RecordSet List view route handler called with invalid route payload.`);
102
+ }
103
+
104
+ //_Pict.PictSectionRecordSet.recordSetProviderConfigurations['Book'], 'RSP-Provider-Book'
105
+ // FIXME: Not in love with this but good enough to start.
106
+ // FIXME: Typescript mumbo jumbo
107
+ // if (!('PictSectionRecordSet' in this.pict))
108
+ // {
109
+ // return false;
110
+ // }
111
+ const tmpProviderConfiguration = this.pict.PictSectionRecordSet.recordSetProviderConfigurations[pRoutePayload.data.RecordSet];
112
+ const tmpProviderHash = `RSP-Provider-${pRoutePayload.data.RecordSet}`;
113
+
114
+ const tmpFilterString = pRoutePayload.data.FilterString || '';
115
+
116
+ const tmpOffset = pRoutePayload.data.Offset ? pRoutePayload.data.Offset : 0;
117
+ const tmpPageSize = pRoutePayload.data.PageSize ? pRoutePayload.data.PageSize : 100;
118
+
119
+ return this.renderList(tmpProviderConfiguration, tmpProviderHash, tmpFilterString, tmpOffset, tmpPageSize);
120
+ }
121
+
122
+ /**
123
+ * @param {import('pict-router')} pPictRouter
124
+ */
125
+ addRoutes(pPictRouter)
126
+ {
127
+ pPictRouter.router.on('/PSRS/:RecordSet/DashboardFilteredTo/:FilterString/:Offset/:PageSize', this.handleRecordSetDashboardRoute.bind(this));
128
+ pPictRouter.router.on('/PSRS/:RecordSet/DashboardFilteredTo/:FilterString', this.handleRecordSetDashboardRoute.bind(this));
129
+ pPictRouter.router.on('/PSRS/:RecordSet/Dashboard/:Offset/:PageSize', this.handleRecordSetDashboardRoute.bind(this));
130
+ pPictRouter.router.on('/PSRS/:RecordSet/Dashboard/:Offset', this.handleRecordSetDashboardRoute.bind(this));
131
+ pPictRouter.router.on('/PSRS/:RecordSet/Dashboard', this.handleRecordSetDashboardRoute.bind(this));
132
+ pPictRouter.router.resolve();
133
+ return true;
134
+ }
135
+
136
+ onBeforeRenderList(pRecordListData)
137
+ {
138
+ return pRecordListData;
139
+ }
140
+
141
+ dynamicallyGenerateColumns(pRecordListData)
142
+ {
143
+ pRecordListData.TableCells = [];
144
+ const tmpEntity = pRecordListData.RecordSetConfiguration.Entity;
145
+ this.excludedByDefaultCells = [
146
+ 'ID' + tmpEntity,
147
+ 'GUID' + tmpEntity,
148
+ 'CreateDate',
149
+ 'CreatingIDUser',
150
+ 'DeleteDate',
151
+ 'Deleted',
152
+ 'DeletingIDUser',
153
+ 'UpdateDate',
154
+ 'UpdatingIDUser',
155
+ ];
156
+
157
+ const tmpSchema = pRecordListData.RecordSchema;
158
+ const tmpProperties = tmpSchema?.properties;
159
+ // loop throught the schema and add the columns to the tableCells
160
+ for (const tmpColumn in tmpProperties)
161
+ {
162
+ if (tmpProperties.hasOwnProperty(tmpColumn))
163
+ {
164
+ // Check if the column is excluded by the default list of columns (or is not a GUID/ID)
165
+ if (this.excludedByDefaultCells.includes(tmpColumn) === false)
166
+ {
167
+ pRecordListData.TableCells.push({
168
+ 'Key': tmpColumn,
169
+ 'DisplayName': tmpProperties?.[tmpColumn].title || tmpColumn,
170
+ });
171
+ }
172
+ }
173
+ }
174
+ return pRecordListData;
175
+ }
176
+
177
+ async renderList(pRecordSetConfiguration, pProviderHash, pFilterString, pOffset, pPageSize)
178
+ {
179
+ // Get the records
180
+ if (!(pProviderHash in this.pict.providers))
181
+ {
182
+ this.pict.log.error(`RecordSetDashboard: No provider found for ${pProviderHash} in ${pRecordSetConfiguration.RecordSet}. List Render failed.`);
183
+ return false;
184
+ }
185
+
186
+ let tmpRecordListData =
187
+ {
188
+ "Title": pRecordSetConfiguration.RecordSet,
189
+
190
+ "RecordSet": pRecordSetConfiguration.RecordSet,
191
+ "RecordSetConfiguration": pRecordSetConfiguration,
192
+
193
+ "RenderDestination": this.options.DefaultDestinationAddress,
194
+
195
+ "FilterString": pFilterString ? encodeURIComponent(pFilterString) : undefined,
196
+
197
+ "Records": { "Records": [] },
198
+ "TotalRecordCount": { "Count": -1 },
199
+
200
+ "Offset": pOffset || 0,
201
+ "PageSize": pPageSize || 100,
202
+ };
203
+
204
+ // TODO: There are still problems with the way these have nested data. Discuss how we might move that around
205
+ // Fetch the records
206
+ tmpRecordListData.Records = await this.pict.providers[pProviderHash].getDecoratedRecords(tmpRecordListData);
207
+ // Get the total record count
208
+ tmpRecordListData.TotalRecordCount = await this.pict.providers[pProviderHash].getRecordSetCount(tmpRecordListData);
209
+ // Get the record schema
210
+ tmpRecordListData.RecordSchema = await this.pict.providers[pProviderHash].getRecordSchema();
211
+
212
+ // TODO: This should be coming from the schema but that can come after we discuss how we deal with default routing
213
+ tmpRecordListData.GUIDAddress = `GUID${this.pict.providers[pProviderHash].options.Entity}`;
214
+
215
+ // Get the "page end record number" for the current page (e.g. for messaging like Record 700 to 800 of 75,000)
216
+ tmpRecordListData.PageEnd = parseInt(tmpRecordListData.Offset) + tmpRecordListData.Records.Records.length;
217
+
218
+ // Compute the number of pages total
219
+ tmpRecordListData.PageCount = Math.ceil(tmpRecordListData.TotalRecordCount.Count / tmpRecordListData.PageSize);
220
+
221
+ // Generate each page's links.
222
+ // TODO: This is fast and cool; any reason not to?
223
+ // Get "bookmarks" as references to the array of page links.
224
+ tmpRecordListData.PageLinkBookmarks = (
225
+ {
226
+ Current: Math.floor(tmpRecordListData.Offset / tmpRecordListData.PageSize)
227
+ });
228
+ tmpRecordListData.PageLinks = [];
229
+ for (let i = 0; i < tmpRecordListData.PageCount; i++)
230
+ {
231
+ if (tmpRecordListData.FilterString)
232
+ {
233
+ tmpRecordListData.PageLinks.push(
234
+ {
235
+ Page: i + 1,
236
+ RelativeOffset: i - tmpRecordListData.PageLinkBookmarks.Current,
237
+ URL: `#/PSRS/${tmpRecordListData.RecordSet}/DashboardFilteredTo/${tmpRecordListData.FilterString}/${i * tmpRecordListData.PageSize}/${tmpRecordListData.PageSize}`
238
+ });
239
+ }
240
+ else
241
+ {
242
+ tmpRecordListData.PageLinks.push(
243
+ {
244
+ Page: i + 1,
245
+ RelativeOffset: i - tmpRecordListData.PageLinkBookmarks.Current,
246
+ URL: `#/PSRS/${tmpRecordListData.RecordSet}/Dashboard/${i * tmpRecordListData.PageSize}/${tmpRecordListData.PageSize}`
247
+ });
248
+ }
249
+ }
250
+
251
+ //FIXME: short-term workaround to not blow up the tempplate rendering with way too many links
252
+ const linkRangeStart = Math.max(0, tmpRecordListData.PageLinkBookmarks.Current - 10);
253
+ const linkRangeEnd = Math.min(tmpRecordListData.PageLinks.length, tmpRecordListData.PageLinkBookmarks.Current + 10);
254
+ tmpRecordListData.PageLinksLimited = tmpRecordListData.PageLinks.slice(linkRangeStart, linkRangeEnd);
255
+ if (linkRangeStart > 0)
256
+ {
257
+ if (tmpRecordListData.FilterString)
258
+ {
259
+ tmpRecordListData.PageLinksLimited.unshift(
260
+ {
261
+ Page: 1,
262
+ RelativeOffset: -tmpRecordListData.PageLinkBookmarks.Current,
263
+ URL: `#/PSRS/${tmpRecordListData.RecordSet}/DashboardFilteredTo/${tmpRecordListData.FilterString}/${tmpRecordListData.PageSize}/${tmpRecordListData.PageSize}`
264
+ });
265
+ }
266
+ else
267
+ {
268
+ tmpRecordListData.PageLinksLimited.unshift(
269
+ {
270
+ Page: 1,
271
+ RelativeOffset: -tmpRecordListData.PageLinkBookmarks.Current,
272
+ URL: `#/PSRS/${tmpRecordListData.RecordSet}/Dashboard/${0}/${tmpRecordListData.PageSize}`
273
+ });
274
+ }
275
+ }
276
+ if (linkRangeEnd < tmpRecordListData.PageLinks.length)
277
+ {
278
+ if (tmpRecordListData.FilterString)
279
+ {
280
+ tmpRecordListData.PageLinksLimited.push(
281
+ {
282
+ Page: tmpRecordListData.PageCount,
283
+ RelativeOffset: (tmpRecordListData.PageCount - 1) - tmpRecordListData.PageLinkBookmarks.Current,
284
+ URL: `#/PSRS/${tmpRecordListData.RecordSet}/DashboardFilteredTo/${tmpRecordListData.FilterString}/${(tmpRecordListData.PageCount - 1) * tmpRecordListData.PageSize}/${tmpRecordListData.PageSize}`
285
+ });
286
+ }
287
+ else
288
+ {
289
+ tmpRecordListData.PageLinksLimited.push(
290
+ {
291
+ Page: tmpRecordListData.PageCount,
292
+ RelativeOffset: (tmpRecordListData.PageCount - 1) - tmpRecordListData.PageLinkBookmarks.Current,
293
+ URL: `#/PSRS/${tmpRecordListData.RecordSet}/Dashboard/${(tmpRecordListData.PageCount - 1) * tmpRecordListData.PageSize}/${tmpRecordListData.PageSize}`
294
+ });
295
+ }
296
+ }
297
+
298
+ tmpRecordListData.PageLinkBookmarks.Previous = tmpRecordListData.PageLinkBookmarks.Current - 1;
299
+ tmpRecordListData.PageLinkBookmarks.Next = tmpRecordListData.PageLinkBookmarks.Current + 1;
300
+ tmpRecordListData.PageLinkBookmarks.ShowPreviousLink = true;
301
+ tmpRecordListData.PageLinkBookmarks.ShowNextLink = true;
302
+ if (tmpRecordListData.PageLinkBookmarks.Previous < 0)
303
+ {
304
+ tmpRecordListData.PageLinkBookmarks.PreviousLink = false;
305
+ tmpRecordListData.PageLinkBookmarks.ShowPreviousLink = false;
306
+ }
307
+ else
308
+ {
309
+ tmpRecordListData.PageLinkBookmarks.PreviousLink = tmpRecordListData.PageLinks[tmpRecordListData.PageLinkBookmarks.Previous];
310
+ }
311
+ if (tmpRecordListData.PageLinkBookmarks.Next >= tmpRecordListData.PageLinks.length)
312
+ {
313
+ tmpRecordListData.PageLinkBookmarks.NextLink = false;
314
+ tmpRecordListData.PageLinkBookmarks.ShowNextLink = false;
315
+ }
316
+ else
317
+ {
318
+ tmpRecordListData.PageLinkBookmarks.NextLink = tmpRecordListData.PageLinks[tmpRecordListData.PageLinkBookmarks.Next];
319
+ }
320
+
321
+ // Put code here to preprocess columns into other data parts.
322
+ if (tmpRecordListData.RecordSetConfiguration.hasOwnProperty('RecordSetListColumns'))
323
+ {
324
+ tmpRecordListData.TableCells = tmpRecordListData.RecordSetConfiguration.RecordSetListColumns;
325
+ }
326
+ else
327
+ {
328
+ this.dynamicallyGenerateColumns(tmpRecordListData);
329
+ }
330
+
331
+ tmpRecordListData = this.onBeforeRenderList(tmpRecordListData);
332
+
333
+ this.renderAsync('PRSP_Renderable_List', tmpRecordListData.RenderDestination, tmpRecordListData,
334
+ function (pError)
335
+ {
336
+ if (pError)
337
+ {
338
+ this.pict.log.error(`RecordSetDashboard: Error rendering list ${pError}`, tmpRecordListData);
339
+ return false;
340
+ }
341
+
342
+ if (this.pict.LogNoisiness > 0)
343
+ {
344
+ this.pict.log.info(`RecordSetDashboard: Rendered list ${tmpRecordListData.RecordSet} with ${tmpRecordListData.Records.Records.length} records.`, tmpRecordListData);
345
+ }
346
+ else
347
+ {
348
+ this.pict.log.info(`RecordSetDashboard: Rendered list ${tmpRecordListData.RecordSet} with ${tmpRecordListData.Records.Records.length} records.`);
349
+ }
350
+ return true;
351
+ }.bind(this));
352
+ }
353
+
354
+ onInitialize()
355
+ {
356
+ this.childViews.headerList = this.pict.addView('PRSP-Dashboard-HeaderDashboard', viewHeaderDashboard.default_configuration, viewHeaderDashboard);
357
+ this.childViews.title = this.pict.addView('PRSP-Dashboard-Title', viewTitle.default_configuration, viewTitle);
358
+ this.childViews.filters = this.pict.views['PRSP-Filters'] || this.pict.addView('PRSP-Filters', { }, viewFilters);
359
+ this.childViews.paginationTop = this.pict.addView('PRSP-Dashboard-PaginationTop', viewPaginationTop.default_configuration, viewPaginationTop);
360
+ this.childViews.recordList = this.pict.addView('PRSP-Dashboard-RecordList', viewRecordList.default_configuration, viewRecordList);
361
+ this.childViews.recordListHeader = this.pict.addView('PRSP-Dashboard-RecordListHeader', viewRecordListHeader.default_configuration, viewRecordListHeader);
362
+ this.childViews.recordListEntry = this.pict.addView('PRSP-Dashboard-RecordListEntry', viewRecordListEntry.default_configuration, viewRecordListEntry);
363
+ this.childViews.paginationBottom = this.pict.addView('PRSP-Dashboard-PaginationBottom', viewPaginationBottom.default_configuration, viewPaginationBottom);
364
+
365
+ // Initialize the subviews
366
+ this.childViews.headerList.initialize();
367
+ this.childViews.title.initialize();
368
+ this.childViews.paginationTop.initialize();
369
+ this.childViews.recordList.initialize();
370
+ this.childViews.recordListHeader.initialize();
371
+ this.childViews.recordListEntry.initialize();
372
+ this.childViews.paginationBottom.initialize();
373
+
374
+ return super.onInitialize();
57
375
  }
58
376
  }
59
377
 
@@ -1,5 +1,6 @@
1
1
  const libPictView = require('pict-view');
2
2
 
3
+ /** @type {Record<string, any>} */
3
4
  const _DEFAULT_CONFIGURATION_Edit_HeaderEdit =
4
5
  {
5
6
  ViewIdentifier: 'PRSP-Edit-HeaderEdit',
@@ -1,5 +1,6 @@
1
1
  const libPictView = require('pict-view');
2
2
 
3
+ /** @type {Record<string, any>} */
3
4
  const _DEFAULT_CONFIGURATION_Edit_RecordEdit =
4
5
  {
5
6
  ViewIdentifier: 'PRSP-Edit-RecordEdit',
@@ -1,5 +1,6 @@
1
1
  const libPictView = require('pict-view');
2
2
 
3
+ /** @type {Record<string, any>} */
3
4
  const _DEFAULT_CONFIGURATION_Edit_RecordEditControls =
4
5
  {
5
6
  ViewIdentifier: 'PRSP-Edit-RecordEditControls',
@@ -1,5 +1,6 @@
1
1
  const libPictView = require('pict-view');
2
2
 
3
+ /** @type {Record<string, any>} */
3
4
  const _DEFAULT_CONFIGURATION_Edit_RecordEditExtra =
4
5
  {
5
6
  ViewIdentifier: 'PRSP-Edit-RecordEditExtra',
@@ -1,5 +1,6 @@
1
1
  const libPictView = require('pict-view');
2
2
 
3
+ /** @type {Record<string, any>} */
3
4
  const _DEFAULT_CONFIGURATION_Edit_TabBarEdit =
4
5
  {
5
6
  ViewIdentifier: 'PRSP-Edit-TabBarEdit',
@@ -1,5 +1,6 @@
1
1
  const libPictRecordSetRecordView = require('../RecordSet-RecordBaseView.js');
2
2
 
3
+ /** @type {Record<string, any>} */
3
4
  const _DEFAULT_CONFIGURATION__Edit =
4
5
  {
5
6
  ViewIdentifier: 'PRSP-Edit',
@@ -1,5 +1,6 @@
1
1
  const libPictView = require('pict-view');
2
2
 
3
+ /** @type {Record<string, any>} */
3
4
  const _DEFAULT_CONFIGURATION_List_HeaderList =
4
5
  {
5
6
  ViewIdentifier: 'PRSP-List-HeaderList',
@@ -1,5 +1,6 @@
1
1
  const libPictView = require('pict-view');
2
2
 
3
+ /** @type {Record<string, any>} */
3
4
  const _DEFAULT_CONFIGURATION_List_PaginationBottom = (
4
5
  {
5
6
  ViewIdentifier: 'PRSP-List-PaginationBottom',
@@ -1,5 +1,6 @@
1
1
  const libPictView = require('pict-view');
2
2
 
3
+ /** @type {Record<string, any>} */
3
4
  const _DEFAULT_CONFIGURATION_List_PaginationTop = (
4
5
  {
5
6
  ViewIdentifier: 'PRSP-List-PaginationTop',
@@ -1,5 +1,6 @@
1
1
  const libPictView = require('pict-view');
2
2
 
3
+ /** @type {Record<string, any>} */
3
4
  const _DEFAULT_CONFIGURATION_List_RecordList =
4
5
  {
5
6
  ViewIdentifier: 'PRSP-List-RecordList',
@@ -1,5 +1,6 @@
1
1
  const libPictView = require('pict-view');
2
2
 
3
+ /** @type {Record<string, any>} */
3
4
  const _DEFAULT_CONFIGURATION_List_RecordListEntry = (
4
5
  {
5
6
  ViewIdentifier: 'PRSP-List-RecordListEntry',
@@ -1,5 +1,6 @@
1
1
  const libPictView = require('pict-view');
2
2
 
3
+ /** @type {Record<string, any>} */
3
4
  const _DEFAULT_CONFIGURATION_List_RecordListHeader = (
4
5
  {
5
6
  ViewIdentifier: 'PRSP-List-RecordListHeader',
@@ -1,5 +1,6 @@
1
1
  const libPictView = require('pict-view');
2
2
 
3
+ /** @type {Record<string, any>} */
3
4
  const _DEFAULT_CONFIGURATION_List_Title =
4
5
  {
5
6
  ViewIdentifier: 'PRSP-List-Title',