pict-section-recordset 1.0.4 → 1.0.5

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.4",
3
+ "version": "1.0.5",
4
4
  "description": "Pict dynamic record set management views",
5
5
  "main": "source/Pict-Section-RecordSet.js",
6
6
  "directories": {
@@ -1,88 +1,101 @@
1
1
  const libPictView = require('pict-view');
2
2
 
3
3
  const _DEFAULT_CONFIGURATION_SUBSET_Filter = (
4
- {
5
- ViewIdentifier: 'PRSP-SUBSET-Filter',
4
+ {
5
+ ViewIdentifier: 'PRSP-SUBSET-Filter',
6
6
 
7
- DefaultRenderable: 'PRSP_Renderable_Filter',
8
- DefaultDestinationAddress: '#PRSP_Filter_Container',
9
- DefaultTemplateRecordAddress: false,
7
+ DefaultRenderable: 'PRSP_Renderable_Filter',
8
+ DefaultDestinationAddress: '#PRSP_Filter_Container',
9
+ DefaultTemplateRecordAddress: false,
10
10
 
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,
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,
15
15
 
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,
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,
20
20
 
21
- AutoSolveWithApp: false,
22
- AutoSolveOrdinal: 0,
21
+ AutoSolveWithApp: false,
22
+ AutoSolveOrdinal: 0,
23
23
 
24
- CSS: false,
25
- CSSPriority: 500,
24
+ CSS: false,
25
+ CSSPriority: 500,
26
26
 
27
- Templates:
28
- [
29
- {
30
- Hash: 'PRSP-SUBSET-Filter-Template',
31
- Template: /*html*/`
27
+ Templates:
28
+ [
29
+ {
30
+ Hash: 'PRSP-SUBSET-Filter-Template',
31
+ Template: /*html*/`
32
32
  <!-- DefaultPackage pict view template: [PRSP-SUBSET-Filter-Template] -->
33
33
  <section id="PRSP_Filter_Container">
34
- <form id="PRSP_Filter_Form">
34
+ <form id="PRSP_Filter_Form" onsubmit="_Pict.views['PRSP-Filters'].handleSearch(event)">
35
35
  {~T:PRSP-SUBSET-Filter-Template-Input-Fieldset~}
36
- {~T:PRSP-SUBSET-Filter-Template-Button-Fieldset~}
36
+ {~T:PRSP-SUBSET-Filter-Template-Button-Fieldset~}
37
37
  </form>
38
38
  </section>
39
- <!-- DefaultPackage end view template: [PRSP-SUBSET-Filter-Template] -->
39
+ <!-- DefaultPackage end view template: [PRSP-SUBSET-Filter-Template] -->
40
40
  `
41
- },
42
- {
43
- Hash: 'PRSP-SUBSET-Filter-Template-Input-Fieldset',
44
- Template: /*html*/`
45
- <!-- DefaultPackage pict view template: [PRSP-SUBSET-Filter-Template-Input-Fieldset] -->
46
- <fieldset>
47
- <label for="filter">Filter:</label>
48
- <input type="text" name="filter">
49
- </fieldset>
50
- <!-- DefaultPackage end view template: [PRSP-SUBSET-Filter-Template-Input-Fieldset] -->
51
- `
52
- },
53
- {
54
- Hash: 'PRSP-SUBSET-Filter-Template-Button-Fieldset',
55
- Template: /*html*/`
56
- <!-- DefaultPackage pict view template: [PRSP-SUBSET-Filter-Template-Button-Fieldset] -->
57
- <fieldset>
58
- <button type="button" id="PRSP_Filter_Button_Reset">Reset</button>
59
- <button type="submit" id="PRSP_Filter_Button_Apply">Apply</button>
60
- </fieldset>
61
- <!-- DefaultPackage end view template: [PRSP-SUBSET-Filter-Template-Button-Fieldset] -->
62
- `
63
- },
64
- ],
41
+ },
42
+ {
43
+ Hash: 'PRSP-SUBSET-Filter-Template-Input-Fieldset',
44
+ Template: /*html*/`
45
+ <!-- DefaultPackage pict view template: [PRSP-SUBSET-Filter-Template-Input-Fieldset] -->
46
+ <fieldset>
47
+ <label for="filter">Filter:</label>
48
+ <input type="text" name="filter">
49
+ </fieldset>
50
+ <!-- DefaultPackage end view template: [PRSP-SUBSET-Filter-Template-Input-Fieldset] -->
51
+ `
52
+ },
53
+ {
54
+ Hash: 'PRSP-SUBSET-Filter-Template-Button-Fieldset',
55
+ Template: /*html*/`
56
+ <!-- DefaultPackage pict view template: [PRSP-SUBSET-Filter-Template-Button-Fieldset] -->
57
+ <fieldset>
58
+ <button type="button" id="PRSP_Filter_Button_Reset" onclick="_Pict.views['PRSP-Filters'].handleReset(event)">Reset</button>
59
+ <button type="submit" id="PRSP_Filter_Button_Apply">Apply</button>
60
+ </fieldset>
61
+ <!-- DefaultPackage end view template: [PRSP-SUBSET-Filter-Template-Button-Fieldset] -->
62
+ `
63
+ },
64
+ ],
65
65
 
66
- Renderables:
67
- [
68
- {
69
- RenderableHash: 'PRSP_Renderable_Filter',
70
- TemplateHash: 'PRSP-SUBSET-Filter-Template',
71
- DestinationAddress: '#PRSP_Filter_Container',
72
- RenderMethod: 'replace'
73
- }
74
- ],
66
+ Renderables:
67
+ [
68
+ {
69
+ RenderableHash: 'PRSP_Renderable_Filter',
70
+ TemplateHash: 'PRSP-SUBSET-Filter-Template',
71
+ DestinationAddress: '#PRSP_Filter_Container',
72
+ RenderMethod: 'replace'
73
+ }
74
+ ],
75
75
 
76
- Manifests: {}
77
- });
76
+ Manifests: {}
77
+ });
78
78
 
79
79
  class viewRecordSetSUBSETFilter extends libPictView
80
80
  {
81
- constructor(pFable, pOptions, pServiceHash)
82
- {
83
- let tmpOptions = Object.assign({}, _DEFAULT_CONFIGURATION_SUBSET_Filter, pOptions);
84
- super(pFable, tmpOptions, pServiceHash);
85
- }
81
+ constructor(pFable, pOptions, pServiceHash)
82
+ {
83
+ let tmpOptions = Object.assign({}, _DEFAULT_CONFIGURATION_SUBSET_Filter, pOptions);
84
+ super(pFable, tmpOptions, pServiceHash);
85
+ }
86
+
87
+ handleSearch(event)
88
+ {
89
+ event.stopPropagation();
90
+ event.preventDefault();
91
+ this.pict.views['RSP-RecordSet-List']?.handleSearch?.(this.pict.ContentAssignment.readContent('input[name="filter"]'));
92
+ }
93
+
94
+ handleReset(event)
95
+ {
96
+ event.stopPropagation();
97
+ this.pict.ContentAssignment.assignContent('input[name="filter"]', '');
98
+ }
86
99
  }
87
100
 
88
101
  module.exports = viewRecordSetSUBSETFilter;
@@ -2,6 +2,7 @@ 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');
5
+ const viewFilters = require('../RecordSet-Filter.js');
5
6
  const viewPaginationTop = require('./RecordSet-List-PaginationTop.js');
6
7
  const viewRecordList = require('./RecordSet-List-RecordList.js');
7
8
  const viewRecordListHeader = require('./RecordSet-List-RecordListHeader.js');
@@ -41,6 +42,7 @@ const _DEFAULT_CONFIGURATION__List = (
41
42
  <section id="PRSP_List_Container">
42
43
  {~V:PRSP-List-Title~}
43
44
  {~V:PRSP-List-HeaderList~}
45
+ {~V:PRSP-Filters~}
44
46
  {~V:PRSP-List-PaginationTop~}
45
47
  {~V:PRSP-List-RecordList~}
46
48
  {~V:PRSP-List-PaginationBottom~}
@@ -87,6 +89,31 @@ class viewRecordSetList extends libPictRecordSetRecordView
87
89
  };
88
90
  }
89
91
 
92
+ handleSearch(pSearchString)
93
+ {
94
+ const pictRouter = this.pict.providers.PictRouter;
95
+ const recordSet = pictRouter.router.current[0]?.data?.RecordSet;
96
+ const offset = pictRouter.router.current[0]?.data?.Offset || '0';
97
+ const pageSize = pictRouter.router.current[0]?.data?.PageSize || '100';
98
+ if (!recordSet)
99
+ {
100
+ this.pict.log.error('PictRecordSetRouter.handleSearch: No record set found in the current route: ', { routes: pictRouter.router.current });
101
+ return;
102
+ }
103
+ const tmpProviderConfiguration = this.pict.PictSectionRecordSet.recordSetProviderConfigurations[recordSet];
104
+ if (pSearchString)
105
+ {
106
+ //FIXME: figure this out based on the record set; or defer to another provider?
107
+ const searchFields = tmpProviderConfiguration?.SearchFields ?? [ 'Name' ];
108
+ const filterExpr = searchFields.map((filterField) => `FBVOR~${filterField}~LK~${encodeURIComponent(`%${pSearchString}%`)}`).join('~');
109
+ pictRouter.navigate(`/PSRS/${recordSet}/List/FilteredTo/${filterExpr}/${offset}/${pageSize}`);
110
+ }
111
+ else
112
+ {
113
+ pictRouter.navigate(`/PSRS/${recordSet}/List`);
114
+ }
115
+ }
116
+
90
117
  handleRecordSetListRoute(pRoutePayload)
91
118
  {
92
119
  if (typeof(pRoutePayload) != 'object')
@@ -104,7 +131,7 @@ class viewRecordSetList extends libPictRecordSetRecordView
104
131
  const tmpProviderConfiguration = this.pict.PictSectionRecordSet.recordSetProviderConfigurations[pRoutePayload.data.RecordSet];
105
132
  const tmpProviderHash = `RSP-Provider-${pRoutePayload.data.RecordSet}`;
106
133
 
107
- const tmpFilterString = pRoutePayload.data.FilterString ? pRoutePayload.data.FilterString : '';
134
+ const tmpFilterString = pRoutePayload.data.FilterString || '';
108
135
 
109
136
  const tmpOffset = pRoutePayload.data.Offset ? pRoutePayload.data.Offset : 0;
110
137
  const tmpPageSize = pRoutePayload.data.PageSize ? pRoutePayload.data.PageSize : 100;
@@ -180,7 +207,7 @@ class viewRecordSetList extends libPictRecordSetRecordView
180
207
 
181
208
  "RenderDestination": this.options.DefaultDestinationAddress,
182
209
 
183
- "FilterString": pFilterString || false,
210
+ "FilterString": pFilterString ? encodeURIComponent(pFilterString) : undefined,
184
211
 
185
212
  "Records": { "Records": [] },
186
213
  "TotalRecordCount": { "Count": -1 },
@@ -295,6 +322,7 @@ class viewRecordSetList extends libPictRecordSetRecordView
295
322
  {
296
323
  this.childViews.headerList = this.pict.addView('PRSP-List-HeaderList', viewHeaderList.default_configuration, viewHeaderList);
297
324
  this.childViews.title = this.pict.addView('PRSP-List-Title', viewTitle.default_configuration, viewTitle);
325
+ this.childViews.filters = this.pict.addView('PRSP-Filters', viewFilters.default_configuration, viewFilters);
298
326
  this.childViews.paginationTop = this.pict.addView('PRSP-List-PaginationTop', viewPaginationTop.default_configuration, viewPaginationTop);
299
327
  this.childViews.recordList = this.pict.addView('PRSP-List-RecordList', viewRecordList.default_configuration, viewRecordList);
300
328
  this.childViews.recordListHeader = this.pict.addView('PRSP-List-RecordListHeader', viewRecordListHeader.default_configuration, viewRecordListHeader);
@@ -19,6 +19,7 @@ declare class RecordSetMetacontroller {
19
19
  };
20
20
  recordSetProviders: {};
21
21
  recordSetProviderConfigurations: {};
22
+ recordSetListConfigurations: {};
22
23
  has_initialized: boolean;
23
24
  loadRecordSetConfiguration(pRecordSetConfiguration: any): boolean;
24
25
  loadRecordSetConfigurationArray(pRecordSetConfigurationArray: any): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"RecordsSet-MetaController.d.ts","sourceRoot":"","sources":["../../source/services/RecordsSet-MetaController.js"],"names":[],"mappings":";AAoBA;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,iFAGC;IAED,0BAuCC;CACD"}
1
+ {"version":3,"file":"RecordsSet-MetaController.d.ts","sourceRoot":"","sources":["../../source/services/RecordsSet-MetaController.js"],"names":[],"mappings":";AAoBA;IAEC,2DA2BC;IAtBA,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,gCAAqC;IAErC,yBAA4B;IA6B7B,kEA0FC;IAED,4EAmBC;IAED,iFAyCC;IAED,yDAaC;IAED,qCAMC;IAED,iFAGC;IAED,0BAuCC;CACD"}
@@ -1,6 +1,8 @@
1
1
  export = viewRecordSetSUBSETFilter;
2
2
  declare class viewRecordSetSUBSETFilter extends libPictView {
3
3
  constructor(pFable: any, pOptions: any, pServiceHash: any);
4
+ handleSearch(event: any): void;
5
+ handleReset(event: any): void;
4
6
  }
5
7
  declare namespace viewRecordSetSUBSETFilter {
6
8
  export { _DEFAULT_CONFIGURATION_SUBSET_Filter as default_configuration };
@@ -1 +1 @@
1
- {"version":3,"file":"RecordSet-Filter.d.ts","sourceRoot":"","sources":["../../source/views/RecordSet-Filter.js"],"names":[],"mappings":";AA8EA;IAEE,2DAIC;CACF"}
1
+ {"version":3,"file":"RecordSet-Filter.d.ts","sourceRoot":"","sources":["../../source/views/RecordSet-Filter.js"],"names":[],"mappings":";AA8EA;IAEC,2DAIC;IAEE,+BAKC;IAED,8BAIC;CACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"RecordSet-List-RecordListEntry.d.ts","sourceRoot":"","sources":["../../../source/views/list/RecordSet-List-RecordListEntry.js"],"names":[],"mappings":";AAgGA;IAEC,2DAIC;CACD"}
1
+ {"version":3,"file":"RecordSet-List-RecordListEntry.d.ts","sourceRoot":"","sources":["../../../source/views/list/RecordSet-List-RecordListEntry.js"],"names":[],"mappings":";AA6GA;IAEC,2DAIC;CACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"RecordSet-List-RecordListHeader.d.ts","sourceRoot":"","sources":["../../../source/views/list/RecordSet-List-RecordListHeader.js"],"names":[],"mappings":";AA2EA;IAEC,2DAIC;CACD"}
1
+ {"version":3,"file":"RecordSet-List-RecordListHeader.d.ts","sourceRoot":"","sources":["../../../source/views/list/RecordSet-List-RecordListHeader.js"],"names":[],"mappings":";AAqFA;IAEC,2DAIC;CACD"}
@@ -9,9 +9,10 @@ declare class viewRecordSetList extends libPictRecordSetRecordView {
9
9
  recordListEntry: any;
10
10
  paginationBottom: any;
11
11
  };
12
+ handleSearch(pSearchString: any): void;
12
13
  handleRecordSetListRoute(pRoutePayload: any): Promise<boolean>;
13
14
  onBeforeRenderList(pRecordListData: any): any;
14
- formatDisplayData(pRecordListData: any): any;
15
+ dynamicallyGenerateColumns(pRecordListData: any): any;
15
16
  excludedByDefaultCells: string[];
16
17
  renderList(pRecordSetConfiguration: any, pProviderHash: any, pFilterString: any, pOffset: any, pPageSize: any): Promise<boolean>;
17
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"RecordSet-List.d.ts","sourceRoot":"","sources":["../../../source/views/list/RecordSet-List.js"],"names":[],"mappings":";AAuEA;IAOE;;;;;;;;MAQC;IAGF,+DAuBC;IAWD,8CAMC;IAED,6CAkCC;IA9BA,iCAUC;IAsBF,iIAqHC;CAuBD"}
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+HC;CAwBD"}