pict-section-recordset 1.0.11 → 1.0.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pict-section-recordset",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "Pict dynamic record set management views",
5
5
  "main": "source/Pict-Section-RecordSet.js",
6
6
  "directories": {
@@ -29,7 +29,7 @@
29
29
  "devDependencies": {
30
30
  "@eslint/js": "^9.27.0",
31
31
  "@types/mocha": "^10.0.10",
32
- "@types/node": "^22.15.19",
32
+ "@types/node": "^16.18.126",
33
33
  "browser-env": "^3.3.0",
34
34
  "eslint": "^9.27.0",
35
35
  "jquery": "^3.7.1",
@@ -92,9 +92,9 @@ const _DEFAULT_CONFIGURATION_List_PaginationTop = (
92
92
  {
93
93
  Hash: 'PRSP-List-Pagination-Template-Pages',
94
94
  Template: /*html*/`
95
- <!-- DefaultPackage pict view template: [PRSP-List-Pagination-Template-Button-Page] -->
96
- <a href="{~D:Record.URL~}" aria-label="Go to page {~D:Record.Page~}">{~D:Record.Page~}</a>
97
- <!-- DefaultPackage end view template: [PRSP-List-Pagination-Template-Button-Page] -->
95
+ <!-- DefaultPackage pict view template: [PRSP-List-Pagination-Template-Button-Pages] -->
96
+ <a href="{~D:Record.URL~}" aria-label="Go to page {~D:Record.Page~}" class="page-offset_{~D:Record.RelativeOffset~}">{~D:Record.Page~}</a>
97
+ <!-- DefaultPackage end view template: [PRSP-List-Pagination-Template-Button-Pages] -->
98
98
  `
99
99
  }
100
100
  ],
@@ -235,6 +235,11 @@ class viewRecordSetList extends libPictRecordSetRecordView
235
235
 
236
236
  // Generate each page's links.
237
237
  // TODO: This is fast and cool; any reason not to?
238
+ // Get "bookmarks" as references to the array of page links.
239
+ tmpRecordListData.PageLinkBookmarks = (
240
+ {
241
+ Current: Math.floor(tmpRecordListData.Offset / tmpRecordListData.PageSize)
242
+ });
238
243
  tmpRecordListData.PageLinks = [];
239
244
  for (let i = 0; i < tmpRecordListData.PageCount; i++)
240
245
  {
@@ -242,24 +247,21 @@ class viewRecordSetList extends libPictRecordSetRecordView
242
247
  {
243
248
  tmpRecordListData.PageLinks.push(
244
249
  {
245
- Page: i+1,
246
- URL:`#/PSRS/${tmpRecordListData.RecordSet}/List/FilteredTo/${tmpRecordListData.FilterString}/${i * tmpRecordListData.PageSize}/${tmpRecordListData.PageSize}`
250
+ Page: i + 1,
251
+ RelativeOffset: i - tmpRecordListData.PageLinkBookmarks.Current,
252
+ URL: `#/PSRS/${tmpRecordListData.RecordSet}/List/FilteredTo/${tmpRecordListData.FilterString}/${i * tmpRecordListData.PageSize}/${tmpRecordListData.PageSize}`
247
253
  });
248
254
  }
249
255
  else
250
256
  {
251
257
  tmpRecordListData.PageLinks.push(
252
258
  {
253
- Page: i+1,
254
- URL:`#/PSRS/${tmpRecordListData.RecordSet}/List/${i * tmpRecordListData.PageSize}/${tmpRecordListData.PageSize}`
259
+ Page: i + 1,
260
+ RelativeOffset: i - tmpRecordListData.PageLinkBookmarks.Current,
261
+ URL: `#/PSRS/${tmpRecordListData.RecordSet}/List/${i * tmpRecordListData.PageSize}/${tmpRecordListData.PageSize}`
255
262
  });
256
263
  }
257
264
  }
258
- // Get "bookmarks" as references to the array of page links.
259
- tmpRecordListData.PageLinkBookmarks = (
260
- {
261
- Current: Math.floor(tmpRecordListData.Offset / tmpRecordListData.PageSize)
262
- });
263
265
 
264
266
  //FIXME: short-term workaround to not blow up the tempplate rendering with way too many links
265
267
  const linkRangeStart = Math.max(0, tmpRecordListData.PageLinkBookmarks.Current - 10);
@@ -267,19 +269,45 @@ class viewRecordSetList extends libPictRecordSetRecordView
267
269
  tmpRecordListData.PageLinksLimited = tmpRecordListData.PageLinks.slice(linkRangeStart, linkRangeEnd);
268
270
  if (linkRangeStart > 0)
269
271
  {
270
- tmpRecordListData.PageLinksLimited.unshift(
271
- {
272
- Page: 1,
273
- URL:`#/PSRS/${tmpRecordListData.RecordSet}/List/${0}/${tmpRecordListData.PageSize}`
274
- });
272
+ if (tmpRecordListData.FilterString)
273
+ {
274
+ tmpRecordListData.PageLinksLimited.unshift(
275
+ {
276
+ Page: 1,
277
+ RelativeOffset: -tmpRecordListData.PageLinkBookmarks.Current,
278
+ URL: `#/PSRS/${tmpRecordListData.RecordSet}/List/FilteredTo/${tmpRecordListData.FilterString}/${tmpRecordListData.PageSize}/${tmpRecordListData.PageSize}`
279
+ });
280
+ }
281
+ else
282
+ {
283
+ tmpRecordListData.PageLinksLimited.unshift(
284
+ {
285
+ Page: 1,
286
+ RelativeOffset: -tmpRecordListData.PageLinkBookmarks.Current,
287
+ URL: `#/PSRS/${tmpRecordListData.RecordSet}/List/${0}/${tmpRecordListData.PageSize}`
288
+ });
289
+ }
275
290
  }
276
291
  if (linkRangeEnd < tmpRecordListData.PageLinks.length)
277
292
  {
278
- tmpRecordListData.PageLinksLimited.push(
279
- {
280
- Page: tmpRecordListData.PageCount,
281
- URL:`#/PSRS/${tmpRecordListData.RecordSet}/List/${(tmpRecordListData.PageCount - 1) * tmpRecordListData.PageSize}/${tmpRecordListData.PageSize}`
282
- });
293
+ if (tmpRecordListData.FilterString)
294
+ {
295
+ tmpRecordListData.PageLinksLimited.push(
296
+ {
297
+ Page: tmpRecordListData.PageCount,
298
+ RelativeOffset: (tmpRecordListData.PageCount - 1) - tmpRecordListData.PageLinkBookmarks.Current,
299
+ URL: `#/PSRS/${tmpRecordListData.RecordSet}/List/FilteredTo/${tmpRecordListData.FilterString}/${(tmpRecordListData.PageCount - 1) * tmpRecordListData.PageSize}/${tmpRecordListData.PageSize}`
300
+ });
301
+ }
302
+ else
303
+ {
304
+ tmpRecordListData.PageLinksLimited.push(
305
+ {
306
+ Page: tmpRecordListData.PageCount,
307
+ RelativeOffset: (tmpRecordListData.PageCount - 1) - tmpRecordListData.PageLinkBookmarks.Current,
308
+ URL: `#/PSRS/${tmpRecordListData.RecordSet}/List/${(tmpRecordListData.PageCount - 1) * tmpRecordListData.PageSize}/${tmpRecordListData.PageSize}`
309
+ });
310
+ }
283
311
  }
284
312
 
285
313
  tmpRecordListData.PageLinkBookmarks.Previous = tmpRecordListData.PageLinkBookmarks.Current - 1;
@@ -1 +1 @@
1
- {"version":3,"file":"RecordSet-List.d.ts","sourceRoot":"","sources":["../../../source/views/list/RecordSet-List.js"],"names":[],"mappings":";AAyEA;IAOE;;;;;;;;MAQC;IAGF,uCAuBC;IAED,+DAuBC;IAWD,8CAGC;IAED,sDAkCC;IA9BA,iCAUC;IAsBF,iIAmJC;CAwBD"}
1
+ {"version":3,"file":"RecordSet-List.d.ts","sourceRoot":"","sources":["../../../source/views/list/RecordSet-List.js"],"names":[],"mappings":";AAyEA;IAOE;;;;;;;;MAQC;IAGF,uCAuBC;IAED,+DAuBC;IAWD,8CAGC;IAED,sDAkCC;IA9BA,iCAUC;IAsBF,iIA+KC;CAwBD"}