pict-section-recordset 1.0.1 → 1.0.3

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 (54) hide show
  1. package/example_applications/ServeExamples.js +1 -1
  2. package/example_applications/mocks/book-edit-view.html +145 -0
  3. package/example_applications/mocks/book-read-view.html +139 -0
  4. package/example_applications/simple_entity/Simple-RecordSet-Application.js +3 -3
  5. package/example_applications/simple_entity/html/index.html +1 -1
  6. package/package.json +7 -6
  7. package/source/application/Pict-Application-RecordSet.js +12 -4
  8. package/source/providers/RecordSet-Link-Manager.js +52 -0
  9. package/source/providers/RecordSet-RecordProvider-MeadowEndpoints.js +1 -0
  10. package/source/providers/RecordSet-Router.js +64 -0
  11. package/source/services/RecordsSet-MetaController.js +99 -16
  12. package/source/views/RecordSet-RecordBaseView.js +84 -0
  13. package/source/views/RecordsSet-MacroView.js +63 -0
  14. package/source/views/dashboard/RecordSet-Dashboard.js +2 -2
  15. package/source/views/edit/RecordSet-Edit.js +2 -2
  16. package/source/views/list/RecordSet-List-PaginationBottom.js +42 -42
  17. package/source/views/list/RecordSet-List-PaginationTop.js +102 -90
  18. package/source/views/list/RecordSet-List-RecordList.js +3 -3
  19. package/source/views/list/RecordSet-List-RecordListEntry.js +86 -69
  20. package/source/views/list/RecordSet-List-RecordListHeader.js +65 -64
  21. package/source/views/list/RecordSet-List-Title.js +0 -1
  22. package/source/views/list/RecordSet-List.js +168 -22
  23. package/source/views/read/RecordSet-Read-RecordRead.js +62 -48
  24. package/source/views/read/RecordSet-Read.js +193 -51
  25. package/test/PictSectionRecordSet-Basic_tests.js +5 -1
  26. package/test/PictSectionRecordSet-RecordProvider-Meadow_tests.js +1 -1
  27. package/types/Pict-Section-RecordSet.d.ts +5 -1
  28. package/types/application/Pict-Application-RecordSet.d.ts +5 -5
  29. package/types/application/Pict-Application-RecordSet.d.ts.map +1 -1
  30. package/types/providers/RecordSet-Link-Manager.d.ts +23 -0
  31. package/types/providers/RecordSet-Link-Manager.d.ts.map +1 -0
  32. package/types/providers/RecordSet-RecordProvider-MeadowEndpoints.d.ts.map +1 -1
  33. package/types/providers/RecordSet-Router.d.ts +36 -0
  34. package/types/providers/RecordSet-Router.d.ts.map +1 -0
  35. package/types/services/RecordsSet-MetaController.d.ts +13 -6
  36. package/types/services/RecordsSet-MetaController.d.ts.map +1 -1
  37. package/types/views/RecordSet-RecordBaseView.d.ts +53 -0
  38. package/types/views/RecordSet-RecordBaseView.d.ts.map +1 -0
  39. package/types/views/RecordsSet-MacroView.d.ts +33 -0
  40. package/types/views/RecordsSet-MacroView.d.ts.map +1 -1
  41. package/types/views/dashboard/RecordSet-Dashboard.d.ts +2 -3
  42. package/types/views/dashboard/RecordSet-Dashboard.d.ts.map +1 -1
  43. package/types/views/edit/RecordSet-Edit.d.ts +2 -3
  44. package/types/views/edit/RecordSet-Edit.d.ts.map +1 -1
  45. package/types/views/list/RecordSet-List-PaginationBottom.d.ts.map +1 -1
  46. package/types/views/list/RecordSet-List-PaginationTop.d.ts.map +1 -1
  47. package/types/views/list/RecordSet-List-RecordListEntry.d.ts.map +1 -1
  48. package/types/views/list/RecordSet-List-RecordListHeader.d.ts.map +1 -1
  49. package/types/views/list/RecordSet-List.d.ts +7 -3
  50. package/types/views/list/RecordSet-List.d.ts.map +1 -1
  51. package/types/views/read/RecordSet-Read-RecordRead.d.ts.map +1 -1
  52. package/types/views/read/RecordSet-Read.d.ts +12 -3
  53. package/types/views/read/RecordSet-Read.d.ts.map +1 -1
  54. /package/example_applications/{list_view/index.html → mocks/list-view.html} +0 -0
@@ -6,7 +6,7 @@ const defaultFableSettings = (
6
6
  ProductVersion: '1.0.0',
7
7
  APIServerPort: 9090,
8
8
 
9
- OratorHTTPProxyDestinationURL: 'http://127.0.0.1:8086/'
9
+ OratorHTTPProxyDestinationURL: 'http://localhost:8086/',
10
10
  });
11
11
 
12
12
  // Initialize Fable
@@ -0,0 +1,145 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Example Pict-Section-Form List View </title>
7
+ <style>
8
+ .grid-container {
9
+ display: grid;
10
+ grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
11
+ gap: 10px;
12
+ }
13
+ .grid-item{
14
+ background-color: #f0f0f0;
15
+ padding: 10px;
16
+ text-align: center;
17
+ border: 1px solid #ccc;
18
+ list-style-type: none;
19
+ }
20
+ .grid-item.active {
21
+ background-color: aliceblue
22
+ }
23
+ article {
24
+ padding: 20px;
25
+ border: 1px solid #ccc;
26
+ margin: 10px 0;
27
+ }
28
+ </style>
29
+ </head>
30
+ <body>
31
+ <!-- START Header template -->
32
+ <header id="RSP-Header-Container">
33
+ <!-- START Header-Title template -->
34
+ <input type="text" style="font-size: 24px; margin-top: 20px;" value="Book Title" />
35
+ <br>
36
+ <!-- END Header-Title template -->
37
+ <!-- START Header-Nav template -->
38
+ <nav id="RSP-Header-Nav">
39
+ <ul class="grid-container">
40
+ <li class="grid-item active"><a href="javascript:void(0);" onclick="toggleTabContent(event, 'RSP-Record-Toggleable-Content-1')">Details</a></li>
41
+ <li class="grid-item"><a href="javascript:void(0);" onclick="toggleTabContent(event, 'RSP-Record-Toggleable-Content-2')">Author</a></li>
42
+ <li class="grid-item"><a href="javascript:void(0);" onclick="toggleTabContent(event, 'RSP-Record-Toggleable-Content-3')">Series</a></li>
43
+ </ul>
44
+ </nav>
45
+ <!-- END Header-Nav template -->
46
+ </header>
47
+ <!-- END Header template -->
48
+
49
+ <!-- START Record template -->
50
+ <section id="RSP-Record-Container">
51
+ <!-- START Record Content -->
52
+ <article id="RSP-Record-Toggleable-Content-1">
53
+ <!-- START Record Content-Description template -->
54
+ <br />
55
+ <textarea>Book Description</textarea>
56
+ <br />
57
+ <!-- END Record Content-Description template -->
58
+ <!-- START Record Content-Image template -->
59
+ <img src="image.jpg" alt="Book Image">
60
+ <button type="button" id="RSP-Record-Image-Button">Change Image</button>
61
+ <!-- END Record Content-Image template -->
62
+ <!-- START Record Content-Details template -->
63
+ <h4>Book Metadata:</h4>
64
+ <ul>
65
+ <li><input type="text" value="Info 1" /></li>
66
+ <li><input type="text" value="Info 2" /></li>
67
+ <li><input type="text" value="Info 3" /></li>
68
+ </ul>
69
+ <!-- END Record Content-Details template -->
70
+ </article>
71
+ <!-- END Record Content -->
72
+
73
+ <!-- START Record Content -->
74
+ <article id="RSP-Record-Toggleable-Content-2" style="display:none;">
75
+ <!-- START Record Content-Title template -->
76
+ <input type="text" value="Joined Entity 1 Title" />
77
+ <!-- END Record Content-Title template -->
78
+ <!-- START Record Content-Description template -->
79
+ <br />
80
+ <textarea>Joined Entity 1 Description</textarea>
81
+ <!-- END Record Content-Description template -->
82
+ <!-- START Record Content-Details template -->
83
+ <ul>
84
+ <li><input type="text" value="Detail A" /></li>
85
+ <li><input type="text" value="Detail B" /></li>
86
+ <li><input type="text" value="Detail C" /></li>
87
+ </ul>
88
+ <!-- END Record Content-Details template -->
89
+ </article>
90
+ <!-- END Record Content -->
91
+
92
+ <!-- START Record Content -->
93
+ <article id="RSP-Record-Toggleable-Content-3" style="display:none;">
94
+ <!-- START Record Content-Title template -->
95
+ <input type="text" value="Joined Entity 2 Title" />
96
+ <!-- END Record Content-Title template -->
97
+ <!-- START Record Content-Description template -->
98
+ <br />
99
+ <textarea>Joined Entity 2 Description</textarea>
100
+ <!-- END Record Content-Description template -->
101
+ <!-- START Record Content-Details template -->
102
+ <ul>
103
+ <li><input type="text" value="Detail X" /></li>
104
+ <li><input type="text" value="Detail Y" /></li>
105
+ <li><input type="text" value="Detail Z" /></li>
106
+ </ul>
107
+ <!-- END Record Content-Details template -->
108
+ </article>
109
+ <!-- END Record Content -->
110
+
111
+ </section>
112
+ <!-- END Record template -->
113
+
114
+ <!-- Footer template -->
115
+ <footer id="RSP-Footer-Container">
116
+ <!-- NOTE: slot for additional set actions -->
117
+ <!-- START Record Content-Button template -->
118
+ <button type="button" id="RSP-Record-Button" onclick="window.location='./book-read-view.html'">Save Changes</button>
119
+ <!-- END Record Content-Button template -->
120
+ </footer>
121
+ <!-- END Footer template -->
122
+
123
+
124
+ <script>
125
+ function toggleTabContent(event, contentId) {
126
+ // Remove 'active' class from all tabs
127
+ const tabs = document.querySelectorAll('#RSP-Header-Nav .grid-item');
128
+ tabs.forEach(tab => {
129
+ tab.classList.remove('active');
130
+ });
131
+ // Add 'active' class to the clicked tab
132
+ event.currentTarget.parentElement.classList.add('active');
133
+ // Hide all content sections
134
+ const contents = document.querySelectorAll('article[id^="RSP-Record-Toggleable-Content-"]');
135
+ contents.forEach(content => {
136
+ if (content.id === contentId) {
137
+ content.style.display = 'block';
138
+ } else {
139
+ content.style.display = 'none';
140
+ }
141
+ });
142
+ }
143
+ </script>
144
+ </body>
145
+ </html>
@@ -0,0 +1,139 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Example Pict-Section-Form List View </title>
7
+ <style>
8
+ .grid-container {
9
+ display: grid;
10
+ grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
11
+ gap: 10px;
12
+ }
13
+ .grid-item{
14
+ background-color: #f0f0f0;
15
+ padding: 10px;
16
+ text-align: center;
17
+ border: 1px solid #ccc;
18
+ list-style-type: none;
19
+ }
20
+ .grid-item.active {
21
+ background-color: aliceblue
22
+ }
23
+ article {
24
+ padding: 20px;
25
+ border: 1px solid #ccc;
26
+ margin: 10px 0;
27
+ }
28
+ </style>
29
+ </head>
30
+ <body>
31
+ <!-- START Header template -->
32
+ <header id="RSP-Header-Container">
33
+ <!-- START Header-Title template -->
34
+ <h1>Book Title</h1>
35
+ <!-- END Header-Title template -->
36
+ <!-- START Header-Nav template -->
37
+ <nav id="RSP-Header-Nav">
38
+ <ul class="grid-container">
39
+ <li class="grid-item active"><a href="javascript:void(0);" onclick="toggleTabContent(event, 'RSP-Record-Toggleable-Content-1')">Details</a></li>
40
+ <li class="grid-item"><a href="javascript:void(0);" onclick="toggleTabContent(event, 'RSP-Record-Toggleable-Content-2')">Author</a></li>
41
+ <li class="grid-item"><a href="javascript:void(0);" onclick="toggleTabContent(event, 'RSP-Record-Toggleable-Content-3')">Series</a></li>
42
+ </ul>
43
+ </nav>
44
+ <!-- END Header-Nav template -->
45
+ </header>
46
+ <!-- END Header template -->
47
+
48
+ <!-- START Record template -->
49
+ <section id="RSP-Record-Container">
50
+ <!-- START Record Content -->
51
+ <article id="RSP-Record-Toggleable-Content-1">
52
+ <!-- START Record Content-Description template -->
53
+ <p>Book Description</p>
54
+ <!-- END Record Content-Description template -->
55
+ <!-- START Record Content-Image template -->
56
+ <img src="image.jpg" alt="Book Image">
57
+ <!-- END Record Content-Image template -->
58
+ <!-- START Record Content-Details template -->
59
+ <h4>Book Metadata:</h4>
60
+ <ul>
61
+ <li>Info 1</li>
62
+ <li>Info 2</li>
63
+ <li>Info 3</li>
64
+ </ul>
65
+ <!-- END Record Content-Details template -->
66
+ </article>
67
+ <!-- END Record Content -->
68
+
69
+ <!-- START Record Content -->
70
+ <article id="RSP-Record-Toggleable-Content-2" style="display:none;">
71
+ <!-- START Record Content-Title template -->
72
+ <h3>Joined Entity 1 Title</h3>
73
+ <!-- END Record Content-Title template -->
74
+ <!-- START Record Content-Description template -->
75
+ <p>Joined Entity 1 Description</p>
76
+ <!-- END Record Content-Description template -->
77
+ <!-- START Record Content-Details template -->
78
+ <ul>
79
+ <li>Detail A</li>
80
+ <li>Detail B</li>
81
+ <li>Detail C</li>
82
+ </ul>
83
+ <!-- END Record Content-Details template -->
84
+ </article>
85
+ <!-- END Record Content -->
86
+
87
+ <!-- START Record Content -->
88
+ <article id="RSP-Record-Toggleable-Content-3" style="display:none;">
89
+ <!-- START Record Content-Title template -->
90
+ <h3>Joined Entity 2 Title</h3>
91
+ <!-- END Record Content-Title template -->
92
+ <!-- START Record Content-Description template -->
93
+ <p>Joined Entity 2 Description</p>
94
+ <!-- END Record Content-Description template -->
95
+ <!-- START Record Content-Details template -->
96
+ <ul>
97
+ <li>Detail X</li>
98
+ <li>Detail Y</li>
99
+ <li>Detail Z</li>
100
+ </ul>
101
+ <!-- END Record Content-Details template -->
102
+ </article>
103
+ <!-- END Record Content -->
104
+
105
+ </section>
106
+ <!-- END Record template -->
107
+
108
+ <!-- Footer template -->
109
+ <footer id="RSP-Footer-Container">
110
+ <!-- NOTE: slot for additional set actions -->
111
+ <!-- START Record Content-Button template -->
112
+ <button type="button" id="RSP-Record-Button" onclick="window.location='./book-edit-view.html'">Edit Record</button>
113
+ <!-- END Record Content-Button template -->
114
+ </footer>
115
+ <!-- END Footer template -->
116
+
117
+
118
+ <script>
119
+ function toggleTabContent(event, contentId) {
120
+ // Remove 'active' class from all tabs
121
+ const tabs = document.querySelectorAll('#RSP-Header-Nav .grid-item');
122
+ tabs.forEach(tab => {
123
+ tab.classList.remove('active');
124
+ });
125
+ // Add 'active' class to the clicked tab
126
+ event.currentTarget.parentElement.classList.add('active');
127
+ // Hide all content sections
128
+ const contents = document.querySelectorAll('article[id^="RSP-Record-Toggleable-Content-"]');
129
+ contents.forEach(content => {
130
+ if (content.id === contentId) {
131
+ content.style.display = 'block';
132
+ } else {
133
+ content.style.display = 'none';
134
+ }
135
+ });
136
+ }
137
+ </script>
138
+ </body>
139
+ </html>
@@ -20,7 +20,7 @@ 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
- "RecordSetURLPrefix": "http://www.datadebase.com:8086/1.0/"
23
+ "RecordSetURLPrefix": "/1.0/"
24
24
  },
25
25
  {
26
26
  "RecordSet": "Author",
@@ -28,7 +28,7 @@ module.exports.default_configuration.pict_configuration = (
28
28
  "RecordSetType": "MeadowEndpoint",
29
29
  "RecordSetMeadowEntity": "Author",
30
30
 
31
- "RecordSetURLPrefix": "http://www.datadebase.com:8086/1.0/"
31
+ "RecordSetURLPrefix": "/1.0/"
32
32
  },
33
33
  {
34
34
  "RecordSet": "RandomizedValues",
@@ -36,4 +36,4 @@ module.exports.default_configuration.pict_configuration = (
36
36
  "RecordSetType": "Custom" // This means the `PS-RSP-RandomizedValues` provider will be checked for to get records.
37
37
  }
38
38
  ]
39
- });
39
+ });
@@ -7,7 +7,7 @@
7
7
  <script type="text/javascript">Pict.safeOnDocumentReady(() => { Pict.safeLoadPictApplication(SimpleApplication, 1)});</script>
8
8
  </head>
9
9
  <body>
10
- <div id="PRSP_List_Container"></div>
10
+ <div id="PRSP_Container"></div>
11
11
  <script src="./simple_application.js" type="text/javascript"></script>
12
12
  </body>
13
13
  </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pict-section-recordset",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Pict dynamic record set management views",
5
5
  "main": "source/Pict-Section-RecordSet.js",
6
6
  "directories": {
@@ -27,22 +27,23 @@
27
27
  "author": "steven velozo <steven@velozo.com>",
28
28
  "license": "MIT",
29
29
  "devDependencies": {
30
- "@eslint/js": "^9.21.0",
30
+ "@eslint/js": "^9.27.0",
31
31
  "@types/mocha": "^10.0.10",
32
- "@types/node": "^16.18.126",
32
+ "@types/node": "^22.15.19",
33
33
  "browser-env": "^3.3.0",
34
- "eslint": "^9.21.0",
34
+ "eslint": "^9.27.0",
35
35
  "jquery": "^3.7.1",
36
- "pict": "^1.0.239",
36
+ "pict": "^1.0.252",
37
37
  "pict-application": "^1.0.25",
38
38
  "pict-service-commandlineutility": "^1.0.15",
39
39
  "quackage": "^1.0.41",
40
- "typescript": "^5.7.3"
40
+ "typescript": "^5.8.3"
41
41
  },
42
42
  "dependencies": {
43
43
  "fable-serviceproviderbase": "^3.0.15",
44
44
  "pict-provider": "^1.0.3",
45
45
  "pict-router": "^1.0.3",
46
+ "pict-section-form": "^1.0.90",
46
47
  "pict-template": "^1.0.10",
47
48
  "pict-view": "^1.0.60"
48
49
  },
@@ -3,14 +3,14 @@ const libPictApplication = require('pict-application');
3
3
  const libPictSectionRecordSet = require('../Pict-Section-RecordSet.js');
4
4
 
5
5
  /**
6
- * Represents a PictSectionFormApplication.
6
+ * Represents a PictSectionRecordSetApplication.
7
7
  *
8
- * This is the automagic controller for a dyncamic form application.
8
+ * This is the automagic controller for a dynamic record set application.
9
9
  *
10
10
  * @class
11
11
  * @extends libPictApplication
12
12
  */
13
- class PictSectionFormApplication extends libPictApplication
13
+ class PictSectionRecordSetApplication extends libPictApplication
14
14
  {
15
15
  constructor(pFable, pOptions, pServiceHash)
16
16
  {
@@ -32,9 +32,17 @@ class PictSectionFormApplication extends libPictApplication
32
32
  // Initialize the parent class
33
33
  return super.onInitialize();
34
34
  }
35
+
36
+ onAfterInitialize()
37
+ {
38
+ // Now add the routes
39
+ this.pict.providers.RecordSetRouter.addRoutes(this.fable.providers.RecordSetRouter.pictRouter);
40
+
41
+ return super.onAfterInitialize();
42
+ }
35
43
  };
36
44
 
37
- module.exports = PictSectionFormApplication
45
+ module.exports = PictSectionRecordSetApplication
38
46
 
39
47
  module.exports.default_configuration = (
40
48
  {
@@ -0,0 +1,52 @@
1
+ const libPictProvider = require('pict-provider');
2
+
3
+ const _DEFAULT_PROVIDER_CONFIGURATION =
4
+ {
5
+ ProviderIdentifier: 'Pict-RecordSet-LinkManager',
6
+
7
+ AutoInitialize: true,
8
+ AutoInitializeOrdinal: 0
9
+ }
10
+
11
+ class PictRecordSetRouter extends libPictProvider
12
+ {
13
+ constructor(pFable, pOptions, pServiceHash)
14
+ {
15
+ let tmpOptions = Object.assign({}, _DEFAULT_PROVIDER_CONFIGURATION, pOptions);
16
+ super(pFable, tmpOptions, pServiceHash);
17
+
18
+ /** @type {Record<string, any>} */
19
+ this.options;
20
+ /** @type {import('pict')} */
21
+ this.pict;
22
+
23
+ // An array of link templates with a hash, name template and uri template.
24
+ // Format:
25
+ // {
26
+ // Name: "View Record",
27
+ // URL: "#/PSRS/{~D:Record.Payload.RecordSet~}/Read/{~DVBK:Record.Data:Record.Payload.GUIDAddress~}",
28
+ // Default: true
29
+ // }
30
+ this.linkTemplates = [];
31
+ }
32
+
33
+ // TODO: Add the ability to add routes that are scoped to particular entity types
34
+ addRecordLinkTemplate(pNameTemplate, pURLTemplate, pDefault)
35
+ {
36
+ let tmpDefaultAction = (typeof(pDefault) !== 'undefined') ? pDefault : false;
37
+
38
+ const tmpLinkTemplateObject = (
39
+ {
40
+ Name: pNameTemplate,
41
+ URL: pURLTemplate,
42
+ Default: tmpDefaultAction
43
+ });
44
+
45
+ this.linkTemplates.push(tmpLinkTemplateObject);
46
+
47
+ return tmpLinkTemplateObject;
48
+ }
49
+ }
50
+
51
+ module.exports = PictRecordSetRouter;
52
+ module.exports.default_configuration = _DEFAULT_PROVIDER_CONFIGURATION;
@@ -63,6 +63,7 @@ class RecordSetProvider extends libRecordSetProviderBase
63
63
  {
64
64
  throw new Error('Entity is not defined in the provider options.');
65
65
  }
66
+ // FIXME: The GUIDS are returning false to isNaN so this doesn't work
66
67
  if (typeof pIDOrGuid === 'string' && isNaN(parseInt(pIDOrGuid)))
67
68
  {
68
69
  return this.getRecordByGUID(pIDOrGuid);
@@ -0,0 +1,64 @@
1
+ const libPictProvider = require('pict-provider');
2
+ const libPictRouter = require('pict-router');
3
+
4
+ const _DEFAULT_PROVIDER_CONFIGURATION =
5
+ {
6
+ ProviderIdentifier: 'Pict-RecordSet-Router',
7
+
8
+ AutoInitialize: true,
9
+ AutoInitializeOrdinal: 0
10
+ }
11
+
12
+ class PictRecordSetRouter extends libPictProvider
13
+ {
14
+ constructor(pFable, pOptions, pServiceHash)
15
+ {
16
+ let tmpOptions = Object.assign({}, _DEFAULT_PROVIDER_CONFIGURATION, pOptions);
17
+ super(pFable, tmpOptions, pServiceHash);
18
+
19
+ /** @type {Record<string, any>} */
20
+ this.options;
21
+ /** @type {import('pict') & { PictSectionRecordSet: InstanceType<import('../Pict-Section-RecordSet.js')> }} */
22
+ this.pict;
23
+
24
+ this.pictRouter = null;
25
+ }
26
+
27
+ onInitialize()
28
+ {
29
+ if (!('PictRouter' in this.pict.providers))
30
+ {
31
+ this.pictRouter = this.pict.addProvider('PictRouter', { RouterMode: 'memory' }, libPictRouter);
32
+ }
33
+ else
34
+ {
35
+ this.pictRouter = this.pict.providers.PictRouter;
36
+ }
37
+ return super.onInitialize();
38
+ }
39
+
40
+ addRoutes(pRouter)
41
+ {
42
+ // TODO: Create some kind of state tracking to see if these routes have already been added
43
+ //this.pictRouter.addRoute('/PSRS/:RecordSet/List/:Begin/:Cap', "{~LV:Record~}");
44
+ this.pict.views['RSP-RecordSet-List'].addRoutes(pRouter);
45
+ this.pict.views['RSP-RecordSet-Read'].addRoutes(pRouter);
46
+ this.pict.views['RSP-RecordSet-Edit'].addRoutes(pRouter);
47
+ this.pict.views['RSP-RecordSet-Dashboard'].addRoutes(pRouter);
48
+
49
+ this.pict.PictSectionRecordSet.addRoutes(pRouter);
50
+ }
51
+
52
+ /**
53
+ * Navigate to a given route (set the browser URL string, add to history, trigger router)
54
+ *
55
+ * @param {string} pRoute - The route to navigate to
56
+ */
57
+ navigate(pRoute)
58
+ {
59
+ this.pictRouter.navigate(pRoute);
60
+ }
61
+ }
62
+
63
+ module.exports = PictRecordSetRouter;
64
+ module.exports.default_configuration = _DEFAULT_PROVIDER_CONFIGURATION;