pict-section-recordset 1.0.58 → 1.0.59
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/docs/.nojekyll +0 -0
- package/docs/README.md +76 -0
- package/docs/_sidebar.md +19 -0
- package/docs/api-reference.md +233 -0
- package/docs/cover.md +11 -0
- package/docs/filters.md +151 -0
- package/docs/index.html +51 -0
- package/docs/record-providers.md +155 -0
- package/docs/views/create/README.md +181 -0
- package/docs/views/dashboard/README.md +308 -0
- package/docs/views/list/README.md +260 -0
- package/docs/views/read/README.md +216 -0
- package/package.json +1 -1
- package/source/providers/Filter-Data-Provider.js +25 -6
- package/source/views/Filter-PersistenceView.js +169 -29
- package/source/views/RecordSet-Filters.js +45 -3
package/docs/.nojekyll
ADDED
|
File without changes
|
package/docs/README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Pict-Section-RecordSet
|
|
2
|
+
|
|
3
|
+
> Dynamic record set management views with CRUD operations
|
|
4
|
+
|
|
5
|
+
Pict-Section-RecordSet provides automatic CRUD (Create, Read, Update, Delete) views for managing record sets in Pict applications. Built on top of pict-section-form, it offers list views, detail views, filtering, pagination, and seamless integration with Meadow API endpoints.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Automatic CRUD Views** - List, detail, create, and edit views generated from configuration
|
|
10
|
+
- **Built-in Filtering** - Configurable filter controls with various input types
|
|
11
|
+
- **Pagination Support** - Navigate large record sets with configurable page sizes
|
|
12
|
+
- **Meadow Integration** - Native support for Meadow REST API endpoints
|
|
13
|
+
- **Faceted Search** - Search with facets for filtering by field values and ranges
|
|
14
|
+
- **Custom Providers** - Extensible provider system for any data source
|
|
15
|
+
- **Router Integration** - Built-in routing for navigation between views
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
```javascript
|
|
20
|
+
const libPictRecordSet = require('pict-section-recordset');
|
|
21
|
+
|
|
22
|
+
// Create a record set application
|
|
23
|
+
const app = new libPictRecordSet.PictRecordSetApplication(pict, {
|
|
24
|
+
Name: 'User Management',
|
|
25
|
+
Hash: 'UserManagement',
|
|
26
|
+
pict_configuration: {
|
|
27
|
+
Product: 'UserManager'
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// Initialize the application
|
|
32
|
+
app.initialize();
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install pict-section-recordset
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Core Concepts
|
|
42
|
+
|
|
43
|
+
### Record Providers
|
|
44
|
+
|
|
45
|
+
Record providers handle data fetching, creating, updating, and deleting. The package includes:
|
|
46
|
+
|
|
47
|
+
- **RecordSetProviderBase** - Base class for custom providers
|
|
48
|
+
- **RecordSetProviderMeadowEndpoints** - Provider for Meadow REST APIs
|
|
49
|
+
|
|
50
|
+
### Views
|
|
51
|
+
|
|
52
|
+
The package provides several view types:
|
|
53
|
+
|
|
54
|
+
- **List View** - Displays records in a table with sorting and pagination
|
|
55
|
+
- **Detail View** - Shows a single record with all fields
|
|
56
|
+
- **Create View** - Form for creating new records
|
|
57
|
+
- **Edit View** - Form for editing existing records
|
|
58
|
+
- **Dashboard View** - Overview with statistics and quick actions
|
|
59
|
+
|
|
60
|
+
### Filters
|
|
61
|
+
|
|
62
|
+
Filters allow users to narrow down record sets. Filter types include text search, date ranges, select dropdowns, and custom filter controls.
|
|
63
|
+
|
|
64
|
+
## Documentation
|
|
65
|
+
|
|
66
|
+
- [Record Providers](record-providers.md) - Creating and configuring data providers
|
|
67
|
+
- [Filters](filters.md) - Configuring filter controls
|
|
68
|
+
- [API Reference](api-reference.md) - Complete API documentation
|
|
69
|
+
|
|
70
|
+
## Related Packages
|
|
71
|
+
|
|
72
|
+
- [pict](https://github.com/stevenvelozo/pict) - Core Pict framework
|
|
73
|
+
- [pict-section-form](https://github.com/stevenvelozo/pict-section-form) - Dynamic forms framework
|
|
74
|
+
- [pict-application](https://github.com/stevenvelozo/pict-application) - Application base class
|
|
75
|
+
- [meadow](https://github.com/stevenvelozo/meadow) - REST API framework
|
|
76
|
+
- [fable](https://github.com/stevenvelozo/fable) - Service provider framework
|
package/docs/_sidebar.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
- Getting Started
|
|
2
|
+
|
|
3
|
+
- [Introduction](/)
|
|
4
|
+
- [Record Providers](record-providers.md)
|
|
5
|
+
|
|
6
|
+
- Views
|
|
7
|
+
|
|
8
|
+
- [Create View](views/create/)
|
|
9
|
+
- [Read View](views/read/)
|
|
10
|
+
- [List View](views/list/)
|
|
11
|
+
- [Dashboard View](views/dashboard/)
|
|
12
|
+
|
|
13
|
+
- Configuration
|
|
14
|
+
|
|
15
|
+
- [Filters](filters.md)
|
|
16
|
+
|
|
17
|
+
- Reference
|
|
18
|
+
|
|
19
|
+
- [API Reference](api-reference.md)
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
# API Reference
|
|
2
|
+
|
|
3
|
+
Complete API documentation for Pict-Section-RecordSet.
|
|
4
|
+
|
|
5
|
+
## PictRecordSetApplication
|
|
6
|
+
|
|
7
|
+
Main application class for record set management.
|
|
8
|
+
|
|
9
|
+
### Constructor
|
|
10
|
+
|
|
11
|
+
```javascript
|
|
12
|
+
new PictRecordSetApplication(pFable, pOptions, pServiceHash)
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
| Parameter | Type | Description |
|
|
16
|
+
|-----------|------|-------------|
|
|
17
|
+
| `pFable` | object | Pict/Fable instance |
|
|
18
|
+
| `pOptions` | object | Application configuration |
|
|
19
|
+
| `pServiceHash` | string | Service identifier |
|
|
20
|
+
|
|
21
|
+
### Configuration Options
|
|
22
|
+
|
|
23
|
+
```javascript
|
|
24
|
+
{
|
|
25
|
+
Name: 'My Record Set App',
|
|
26
|
+
Hash: 'MyRecordSetApp',
|
|
27
|
+
pict_configuration: {
|
|
28
|
+
Product: 'MyProduct'
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## RecordSetProviderBase
|
|
36
|
+
|
|
37
|
+
Base class for record providers.
|
|
38
|
+
|
|
39
|
+
### Methods
|
|
40
|
+
|
|
41
|
+
#### getRecord(pIDOrGuid, fCallback)
|
|
42
|
+
|
|
43
|
+
Retrieves a single record.
|
|
44
|
+
|
|
45
|
+
| Parameter | Type | Description |
|
|
46
|
+
|-----------|------|-------------|
|
|
47
|
+
| `pIDOrGuid` | string/number | Record identifier |
|
|
48
|
+
| `fCallback` | function | Callback `(error, record)` |
|
|
49
|
+
|
|
50
|
+
#### getRecords(pFilter, fCallback)
|
|
51
|
+
|
|
52
|
+
Retrieves multiple records with filtering.
|
|
53
|
+
|
|
54
|
+
| Parameter | Type | Description |
|
|
55
|
+
|-----------|------|-------------|
|
|
56
|
+
| `pFilter` | object | Filter configuration |
|
|
57
|
+
| `fCallback` | function | Callback `(error, result)` |
|
|
58
|
+
|
|
59
|
+
**Filter Object:**
|
|
60
|
+
|
|
61
|
+
```javascript
|
|
62
|
+
{
|
|
63
|
+
Entity: 'EntityName',
|
|
64
|
+
FilterString: 'FBV~Field~EQ~Value',
|
|
65
|
+
Offset: 0,
|
|
66
|
+
PageSize: 25,
|
|
67
|
+
Facets: {
|
|
68
|
+
ReturnRecords: true,
|
|
69
|
+
Fields: ['Field1', 'Field2'],
|
|
70
|
+
Ranges: [{ Field: 'Date', Start: '2020', End: '2025', Gap: 'YEAR' }]
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Result Object:**
|
|
76
|
+
|
|
77
|
+
```javascript
|
|
78
|
+
{
|
|
79
|
+
Records: [...],
|
|
80
|
+
Facets: {
|
|
81
|
+
Field1: { 'value1': 10, 'value2': 5 },
|
|
82
|
+
ByRange: { '2020': 100, '2021': 150 }
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
#### createRecord(pRecord, fCallback)
|
|
88
|
+
|
|
89
|
+
Creates a new record.
|
|
90
|
+
|
|
91
|
+
| Parameter | Type | Description |
|
|
92
|
+
|-----------|------|-------------|
|
|
93
|
+
| `pRecord` | object | Record data |
|
|
94
|
+
| `fCallback` | function | Callback `(error, newRecord)` |
|
|
95
|
+
|
|
96
|
+
#### updateRecord(pRecord, fCallback)
|
|
97
|
+
|
|
98
|
+
Updates an existing record.
|
|
99
|
+
|
|
100
|
+
| Parameter | Type | Description |
|
|
101
|
+
|-----------|------|-------------|
|
|
102
|
+
| `pRecord` | object | Record data with ID |
|
|
103
|
+
| `fCallback` | function | Callback `(error, updatedRecord)` |
|
|
104
|
+
|
|
105
|
+
#### deleteRecord(pIDOrGuid, fCallback)
|
|
106
|
+
|
|
107
|
+
Deletes a record.
|
|
108
|
+
|
|
109
|
+
| Parameter | Type | Description |
|
|
110
|
+
|-----------|------|-------------|
|
|
111
|
+
| `pIDOrGuid` | string/number | Record identifier |
|
|
112
|
+
| `fCallback` | function | Callback `(error, success)` |
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## RecordSetProviderMeadowEndpoints
|
|
117
|
+
|
|
118
|
+
Provider for Meadow REST API endpoints. Extends RecordSetProviderBase.
|
|
119
|
+
|
|
120
|
+
### Additional Configuration
|
|
121
|
+
|
|
122
|
+
```javascript
|
|
123
|
+
{
|
|
124
|
+
// Base URL for API
|
|
125
|
+
APIEndpoint: '/1.0/',
|
|
126
|
+
|
|
127
|
+
// Entity name
|
|
128
|
+
Entity: 'User',
|
|
129
|
+
|
|
130
|
+
// Use schema endpoint for auto-configuration
|
|
131
|
+
UseSchemaEndpoint: true
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Meadow Endpoints Used
|
|
136
|
+
|
|
137
|
+
| Operation | Endpoint |
|
|
138
|
+
|-----------|----------|
|
|
139
|
+
| Get One | `GET /{Entity}/{id}` |
|
|
140
|
+
| Get Many | `GET /{Entity}s/FilteredTo/{filter}/{offset}/{limit}` |
|
|
141
|
+
| Create | `POST /{Entity}` |
|
|
142
|
+
| Update | `PUT /{Entity}` |
|
|
143
|
+
| Delete | `DELETE /{Entity}/{id}` |
|
|
144
|
+
| Schema | `GET /{Entity}/Schema` |
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Views
|
|
149
|
+
|
|
150
|
+
### List View
|
|
151
|
+
|
|
152
|
+
Displays records in a table format.
|
|
153
|
+
|
|
154
|
+
```javascript
|
|
155
|
+
// Configuration
|
|
156
|
+
{
|
|
157
|
+
ViewType: 'List',
|
|
158
|
+
Columns: [
|
|
159
|
+
{ Field: 'Name', Header: 'Name', Sortable: true },
|
|
160
|
+
{ Field: 'Email', Header: 'Email' },
|
|
161
|
+
{ Field: 'Status', Header: 'Status' }
|
|
162
|
+
],
|
|
163
|
+
PageSize: 25,
|
|
164
|
+
ShowPagination: true
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Detail View
|
|
169
|
+
|
|
170
|
+
Shows a single record.
|
|
171
|
+
|
|
172
|
+
```javascript
|
|
173
|
+
// Configuration
|
|
174
|
+
{
|
|
175
|
+
ViewType: 'Read',
|
|
176
|
+
Fields: [
|
|
177
|
+
{ Field: 'Name', Label: 'Full Name' },
|
|
178
|
+
{ Field: 'Email', Label: 'Email Address' },
|
|
179
|
+
{ Field: 'CreatedDate', Label: 'Created', Format: 'date' }
|
|
180
|
+
]
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Create/Edit View
|
|
185
|
+
|
|
186
|
+
Form for creating or editing records. Uses pict-section-form configuration.
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Router
|
|
191
|
+
|
|
192
|
+
Built-in routing for navigation.
|
|
193
|
+
|
|
194
|
+
### Routes
|
|
195
|
+
|
|
196
|
+
| Route | View |
|
|
197
|
+
|-------|------|
|
|
198
|
+
| `/` | Dashboard |
|
|
199
|
+
| `/list` | List view |
|
|
200
|
+
| `/view/{id}` | Detail view |
|
|
201
|
+
| `/create` | Create form |
|
|
202
|
+
| `/edit/{id}` | Edit form |
|
|
203
|
+
|
|
204
|
+
### Programmatic Navigation
|
|
205
|
+
|
|
206
|
+
```javascript
|
|
207
|
+
// Navigate to list
|
|
208
|
+
pict.providers.RecordSetRouter.navigateTo('list');
|
|
209
|
+
|
|
210
|
+
// Navigate to detail view
|
|
211
|
+
pict.providers.RecordSetRouter.navigateTo('view', { id: 123 });
|
|
212
|
+
|
|
213
|
+
// Navigate to edit
|
|
214
|
+
pict.providers.RecordSetRouter.navigateTo('edit', { id: 123 });
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## Module Exports
|
|
220
|
+
|
|
221
|
+
```javascript
|
|
222
|
+
const libPictRecordSet = require('pict-section-recordset');
|
|
223
|
+
|
|
224
|
+
// Main meta controller
|
|
225
|
+
libPictRecordSet // RecordSet MetaController
|
|
226
|
+
|
|
227
|
+
// Application class
|
|
228
|
+
libPictRecordSet.PictRecordSetApplication
|
|
229
|
+
|
|
230
|
+
// Providers
|
|
231
|
+
libPictRecordSet.RecordSetProviderBase
|
|
232
|
+
libPictRecordSet.RecordSetProviderMeadowEndpoints
|
|
233
|
+
```
|
package/docs/cover.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Pict-Section-RecordSet <small>1</small>
|
|
2
|
+
|
|
3
|
+
> Dynamic record set management views with CRUD operations
|
|
4
|
+
|
|
5
|
+
- Automatic Create, Read, Update, Delete views
|
|
6
|
+
- Built-in filtering, pagination, and search
|
|
7
|
+
- Meadow endpoint integration for API-driven data
|
|
8
|
+
- Extensible record providers for custom data sources
|
|
9
|
+
|
|
10
|
+
[GitHub](https://github.com/stevenvelozo/pict-section-recordset)
|
|
11
|
+
[Get Started](#pict-section-recordset)
|
package/docs/filters.md
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# Filters
|
|
2
|
+
|
|
3
|
+
Filters allow users to narrow down record sets based on field values.
|
|
4
|
+
|
|
5
|
+
## Filter Types
|
|
6
|
+
|
|
7
|
+
The record set supports various filter control types:
|
|
8
|
+
|
|
9
|
+
| Type | Description |
|
|
10
|
+
|------|-------------|
|
|
11
|
+
| `Text` | Free-text search input |
|
|
12
|
+
| `Select` | Dropdown selection |
|
|
13
|
+
| `DateRange` | Date range picker |
|
|
14
|
+
| `NumberRange` | Numeric range inputs |
|
|
15
|
+
| `Checkbox` | Boolean toggle |
|
|
16
|
+
| `MultiSelect` | Multiple selection |
|
|
17
|
+
|
|
18
|
+
## Filter Configuration
|
|
19
|
+
|
|
20
|
+
Configure filters in your record set manifest:
|
|
21
|
+
|
|
22
|
+
```javascript
|
|
23
|
+
const filterConfig = {
|
|
24
|
+
Filters: [
|
|
25
|
+
{
|
|
26
|
+
Hash: 'NameFilter',
|
|
27
|
+
Name: 'Name',
|
|
28
|
+
FilterType: 'Text',
|
|
29
|
+
Field: 'Name',
|
|
30
|
+
Operator: 'LIKE'
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
Hash: 'StatusFilter',
|
|
34
|
+
Name: 'Status',
|
|
35
|
+
FilterType: 'Select',
|
|
36
|
+
Field: 'Status',
|
|
37
|
+
Options: [
|
|
38
|
+
{ Value: 'active', Label: 'Active' },
|
|
39
|
+
{ Value: 'inactive', Label: 'Inactive' },
|
|
40
|
+
{ Value: 'pending', Label: 'Pending' }
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
Hash: 'DateFilter',
|
|
45
|
+
Name: 'Created Date',
|
|
46
|
+
FilterType: 'DateRange',
|
|
47
|
+
Field: 'CreatedDate'
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
};
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Filter Operators
|
|
54
|
+
|
|
55
|
+
Available operators for filter conditions:
|
|
56
|
+
|
|
57
|
+
| Operator | Description | Example |
|
|
58
|
+
|----------|-------------|---------|
|
|
59
|
+
| `EQ` | Equals | `Status EQ 'active'` |
|
|
60
|
+
| `NE` | Not equals | `Status NE 'deleted'` |
|
|
61
|
+
| `GT` | Greater than | `Age GT 18` |
|
|
62
|
+
| `GE` | Greater or equal | `Age GE 21` |
|
|
63
|
+
| `LT` | Less than | `Price LT 100` |
|
|
64
|
+
| `LE` | Less or equal | `Price LE 50` |
|
|
65
|
+
| `LIKE` | Contains | `Name LIKE 'John'` |
|
|
66
|
+
| `IN` | In list | `Status IN ['active','pending']` |
|
|
67
|
+
|
|
68
|
+
## Filter String Format
|
|
69
|
+
|
|
70
|
+
Filters are converted to Meadow filter strings:
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
FBV~FieldName~Operator~Value
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Multiple filters are joined:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
FBV~Name~LIKE~John~FBV~Status~EQ~active
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Dynamic Filters
|
|
83
|
+
|
|
84
|
+
Filters can be generated from record data:
|
|
85
|
+
|
|
86
|
+
```javascript
|
|
87
|
+
// Auto-generate select options from unique field values
|
|
88
|
+
const filter = {
|
|
89
|
+
Hash: 'DepartmentFilter',
|
|
90
|
+
Name: 'Department',
|
|
91
|
+
FilterType: 'Select',
|
|
92
|
+
Field: 'Department',
|
|
93
|
+
DynamicOptions: true, // Fetch options from data
|
|
94
|
+
FacetField: 'Department' // Use facet for counts
|
|
95
|
+
};
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Filter Events
|
|
99
|
+
|
|
100
|
+
Handle filter changes in your application:
|
|
101
|
+
|
|
102
|
+
```javascript
|
|
103
|
+
// Listen for filter changes
|
|
104
|
+
pict.PictSectionRecordSet.on('filter-changed', (filterState) => {
|
|
105
|
+
console.log('Active filters:', filterState);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
// Programmatically set filters
|
|
109
|
+
pict.PictSectionRecordSet.setFilter('StatusFilter', 'active');
|
|
110
|
+
|
|
111
|
+
// Clear all filters
|
|
112
|
+
pict.PictSectionRecordSet.clearFilters();
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Custom Filter Controls
|
|
116
|
+
|
|
117
|
+
Create custom filter input providers:
|
|
118
|
+
|
|
119
|
+
```javascript
|
|
120
|
+
const libFilterProvider = require('pict-section-recordset').FilterProvider;
|
|
121
|
+
|
|
122
|
+
class CustomRangeFilter extends libFilterProvider
|
|
123
|
+
{
|
|
124
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
125
|
+
{
|
|
126
|
+
super(pFable, pOptions, pServiceHash);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Render custom filter UI
|
|
130
|
+
render(pFilterConfig, pContainer)
|
|
131
|
+
{
|
|
132
|
+
// Custom rendering logic
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Get filter value
|
|
136
|
+
getValue()
|
|
137
|
+
{
|
|
138
|
+
return {
|
|
139
|
+
min: this.minInput.value,
|
|
140
|
+
max: this.maxInput.value
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Convert to filter string
|
|
145
|
+
toFilterString()
|
|
146
|
+
{
|
|
147
|
+
const value = this.getValue();
|
|
148
|
+
return `FBV~${this.options.Field}~GE~${value.min}~FBV~${this.options.Field}~LE~${value.max}`;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
```
|
package/docs/index.html
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<title>Pict-Section-RecordSet Documentation</title>
|
|
6
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
|
7
|
+
<meta name="description" content="Documentation for Pict-Section-RecordSet - Dynamic record set management views with CRUD operations" />
|
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0" />
|
|
9
|
+
<meta name="keywords" content="pict, recordset, crud, javascript, framework, meadow, data management" />
|
|
10
|
+
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/vue.css" />
|
|
11
|
+
<style>
|
|
12
|
+
:root {
|
|
13
|
+
--theme-color: #42b983;
|
|
14
|
+
}
|
|
15
|
+
</style>
|
|
16
|
+
</head>
|
|
17
|
+
<body>
|
|
18
|
+
<div id="app"></div>
|
|
19
|
+
<script>
|
|
20
|
+
window.$docsify = {
|
|
21
|
+
name: 'Pict-Section-RecordSet',
|
|
22
|
+
repo: 'https://github.com/stevenvelozo/pict-section-recordset',
|
|
23
|
+
loadSidebar: '_sidebar.md',
|
|
24
|
+
subMaxLevel: 3,
|
|
25
|
+
auto2top: true,
|
|
26
|
+
coverpage: 'cover.md',
|
|
27
|
+
onlyCover: false,
|
|
28
|
+
search: {
|
|
29
|
+
placeholder: 'Search',
|
|
30
|
+
noData: 'No results found',
|
|
31
|
+
depth: 3
|
|
32
|
+
},
|
|
33
|
+
copyCode: {
|
|
34
|
+
buttonText: 'Copy',
|
|
35
|
+
successText: 'Copied'
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
</script>
|
|
39
|
+
<!-- Docsify v4 -->
|
|
40
|
+
<script src="//cdn.jsdelivr.net/npm/docsify@4"></script>
|
|
41
|
+
<!-- Syntax highlighting -->
|
|
42
|
+
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-javascript.min.js"></script>
|
|
43
|
+
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-json.min.js"></script>
|
|
44
|
+
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-bash.min.js"></script>
|
|
45
|
+
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-markdown.min.js"></script>
|
|
46
|
+
<!-- Search plugin -->
|
|
47
|
+
<script src="//cdn.jsdelivr.net/npm/docsify@4/lib/plugins/search.min.js"></script>
|
|
48
|
+
<!-- Copy code plugin -->
|
|
49
|
+
<script src="//cdn.jsdelivr.net/npm/docsify-copy-code@2"></script>
|
|
50
|
+
</body>
|
|
51
|
+
</html>
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# Record Providers
|
|
2
|
+
|
|
3
|
+
Record providers handle all data operations for your record sets.
|
|
4
|
+
|
|
5
|
+
## Provider Types
|
|
6
|
+
|
|
7
|
+
### RecordSetProviderBase
|
|
8
|
+
|
|
9
|
+
The base class for creating custom record providers:
|
|
10
|
+
|
|
11
|
+
```javascript
|
|
12
|
+
const libRecordSetProviderBase = require('pict-section-recordset').RecordSetProviderBase;
|
|
13
|
+
|
|
14
|
+
class MyRecordProvider extends libRecordSetProviderBase
|
|
15
|
+
{
|
|
16
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
17
|
+
{
|
|
18
|
+
super(pFable, pOptions, pServiceHash);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Get a single record by ID
|
|
22
|
+
getRecord(pIDOrGuid, fCallback)
|
|
23
|
+
{
|
|
24
|
+
// Fetch record from your data source
|
|
25
|
+
const record = this.fetchFromDatabase(pIDOrGuid);
|
|
26
|
+
fCallback(null, record);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Get multiple records with filtering
|
|
30
|
+
getRecords(pFilter, fCallback)
|
|
31
|
+
{
|
|
32
|
+
// Fetch records with filter applied
|
|
33
|
+
const records = this.queryDatabase(pFilter);
|
|
34
|
+
fCallback(null, { Records: records });
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Create a new record
|
|
38
|
+
createRecord(pRecord, fCallback)
|
|
39
|
+
{
|
|
40
|
+
const newRecord = this.insertIntoDatabase(pRecord);
|
|
41
|
+
fCallback(null, newRecord);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Update an existing record
|
|
45
|
+
updateRecord(pRecord, fCallback)
|
|
46
|
+
{
|
|
47
|
+
const updated = this.updateInDatabase(pRecord);
|
|
48
|
+
fCallback(null, updated);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Delete a record
|
|
52
|
+
deleteRecord(pIDOrGuid, fCallback)
|
|
53
|
+
{
|
|
54
|
+
this.deleteFromDatabase(pIDOrGuid);
|
|
55
|
+
fCallback(null, true);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
module.exports = MyRecordProvider;
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### RecordSetProviderMeadowEndpoints
|
|
63
|
+
|
|
64
|
+
Provider for Meadow REST API endpoints:
|
|
65
|
+
|
|
66
|
+
```javascript
|
|
67
|
+
const libMeadowProvider = require('pict-section-recordset').RecordSetProviderMeadowEndpoints;
|
|
68
|
+
|
|
69
|
+
// The provider automatically handles:
|
|
70
|
+
// - GET /Entity/{id} - Get single record
|
|
71
|
+
// - GET /Entities/FilteredTo/{filter}/0/100 - Get filtered records
|
|
72
|
+
// - POST /Entity - Create record
|
|
73
|
+
// - PUT /Entity - Update record
|
|
74
|
+
// - DELETE /Entity/{id} - Delete record
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Filter Object
|
|
78
|
+
|
|
79
|
+
When fetching records, you can pass a filter object:
|
|
80
|
+
|
|
81
|
+
```javascript
|
|
82
|
+
const filter = {
|
|
83
|
+
// Entity name (can override for LiteExtended, etc.)
|
|
84
|
+
Entity: 'User',
|
|
85
|
+
|
|
86
|
+
// Meadow-style filter string
|
|
87
|
+
FilterString: 'FBV~Name~EQ~John',
|
|
88
|
+
|
|
89
|
+
// Pagination
|
|
90
|
+
Offset: 0,
|
|
91
|
+
PageSize: 25,
|
|
92
|
+
|
|
93
|
+
// Faceting for search
|
|
94
|
+
Facets: {
|
|
95
|
+
ReturnRecords: true,
|
|
96
|
+
Fields: ['Status', 'Department'],
|
|
97
|
+
Ranges: [
|
|
98
|
+
{
|
|
99
|
+
Field: 'CreatedDate',
|
|
100
|
+
Start: '2020-01-01',
|
|
101
|
+
End: '2025-12-31',
|
|
102
|
+
Gap: 'YEAR'
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
provider.getRecords(filter, (err, result) => {
|
|
109
|
+
console.log(result.Records); // Array of records
|
|
110
|
+
console.log(result.Facets); // Facet counts
|
|
111
|
+
});
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Provider Configuration
|
|
115
|
+
|
|
116
|
+
```javascript
|
|
117
|
+
const providerConfig = {
|
|
118
|
+
ProviderIdentifier: 'MyRecordProvider',
|
|
119
|
+
|
|
120
|
+
// Auto-initialize with application
|
|
121
|
+
AutoInitialize: true,
|
|
122
|
+
AutoInitializeOrdinal: 1,
|
|
123
|
+
|
|
124
|
+
// Don't solve with app (records loaded on demand)
|
|
125
|
+
AutoSolveWithApp: false
|
|
126
|
+
};
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Registering Providers
|
|
130
|
+
|
|
131
|
+
Register your provider with the Pict instance:
|
|
132
|
+
|
|
133
|
+
```javascript
|
|
134
|
+
// Add the provider type
|
|
135
|
+
pict.addProviderSingleton('MyRecordProvider', providerConfig, MyRecordProvider);
|
|
136
|
+
|
|
137
|
+
// Or instantiate directly
|
|
138
|
+
const provider = pict.instantiateServiceProvider('RecordSetProviderBase', {
|
|
139
|
+
ProviderIdentifier: 'UserProvider'
|
|
140
|
+
});
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Using with Meadow Endpoints
|
|
144
|
+
|
|
145
|
+
The Meadow provider can auto-generate configuration from schema:
|
|
146
|
+
|
|
147
|
+
```javascript
|
|
148
|
+
// Fetch schema from Meadow endpoint
|
|
149
|
+
fetch('/1.0/User/Schema')
|
|
150
|
+
.then(response => response.json())
|
|
151
|
+
.then(schema => {
|
|
152
|
+
// Use schema to configure the record set
|
|
153
|
+
app.configureFromSchema(schema);
|
|
154
|
+
});
|
|
155
|
+
```
|