@genesislcap/foundation-forms 14.397.0 → 14.397.1-alpha-87a7828.0

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 (60) hide show
  1. package/dist/custom-elements.json +325 -1
  2. package/dist/dts/form.d.ts +100 -1
  3. package/dist/dts/form.d.ts.map +1 -1
  4. package/dist/dts/form.styles.d.ts.map +1 -1
  5. package/dist/dts/form.template.d.ts.map +1 -1
  6. package/dist/dts/jsonforms/json-forms.d.ts +13 -0
  7. package/dist/dts/jsonforms/json-forms.d.ts.map +1 -1
  8. package/dist/dts/jsonforms/renderers/ArrayListWrapperRenderer.d.ts +5 -0
  9. package/dist/dts/jsonforms/renderers/ArrayListWrapperRenderer.d.ts.map +1 -1
  10. package/dist/dts/types.d.ts +88 -1
  11. package/dist/dts/types.d.ts.map +1 -1
  12. package/dist/dts/utils/csv-parser.d.ts +82 -0
  13. package/dist/dts/utils/csv-parser.d.ts.map +1 -0
  14. package/dist/dts/utils/index.d.ts +1 -0
  15. package/dist/dts/utils/index.d.ts.map +1 -1
  16. package/dist/dts/utils/schema-utils.d.ts +46 -0
  17. package/dist/dts/utils/schema-utils.d.ts.map +1 -0
  18. package/dist/dts/utils/validation.d.ts +2 -0
  19. package/dist/dts/utils/validation.d.ts.map +1 -1
  20. package/dist/esm/form.js +421 -5
  21. package/dist/esm/form.styles.js +38 -1
  22. package/dist/esm/form.template.js +33 -1
  23. package/dist/esm/jsonforms/json-forms.js +30 -0
  24. package/dist/esm/jsonforms/renderers/ArrayListWrapperRenderer.js +207 -13
  25. package/dist/esm/utils/csv-parser.js +458 -0
  26. package/dist/esm/utils/index.js +1 -0
  27. package/dist/esm/utils/schema-utils.js +120 -0
  28. package/dist/esm/utils/validation.js +2 -0
  29. package/dist/foundation-forms.api.json +1006 -29
  30. package/dist/foundation-forms.d.ts +281 -1
  31. package/docs/api/foundation-forms.arrayrendereroptions.md +2 -2
  32. package/docs/api/foundation-forms.bulkrowstatus.md +22 -0
  33. package/docs/api/foundation-forms.bulkrowsubmitstatus.md +13 -0
  34. package/docs/api/foundation-forms.bulksubmitfaileditem.md +20 -0
  35. package/docs/api/foundation-forms.bulksubmitresult.md +18 -0
  36. package/docs/api/foundation-forms.bulksubmitsuccessitem.md +17 -0
  37. package/docs/api/foundation-forms.childuischemaresolver.md +15 -0
  38. package/docs/api/foundation-forms.csvmappingresult.mappedrows.md +13 -0
  39. package/docs/api/foundation-forms.csvmappingresult.md +77 -0
  40. package/docs/api/foundation-forms.csvmappingresult.unmappedcolumns.md +13 -0
  41. package/docs/api/foundation-forms.csvparseresult.errors.md +13 -0
  42. package/docs/api/foundation-forms.csvparseresult.headers.md +13 -0
  43. package/docs/api/foundation-forms.csvparseresult.md +96 -0
  44. package/docs/api/foundation-forms.csvparseresult.rows.md +13 -0
  45. package/docs/api/foundation-forms.downloadcsvtemplate.md +74 -0
  46. package/docs/api/foundation-forms.form.bulkinsert.md +13 -0
  47. package/docs/api/foundation-forms.form.bulkinsertmaxitems.md +13 -0
  48. package/docs/api/foundation-forms.form.bulkinsertminitems.md +13 -0
  49. package/docs/api/foundation-forms.form.clearrowsubmitstatuses.md +17 -0
  50. package/docs/api/foundation-forms.form.downloadcsvtemplate.md +17 -0
  51. package/docs/api/foundation-forms.form.handlecsvfileselected.md +54 -0
  52. package/docs/api/foundation-forms.form.md +132 -0
  53. package/docs/api/foundation-forms.form.rowsubmitstatuses.md +13 -0
  54. package/docs/api/foundation-forms.form.submitsinglerow.md +56 -0
  55. package/docs/api/foundation-forms.generatecsvtemplate.md +104 -0
  56. package/docs/api/foundation-forms.mapcsvtoschema.md +72 -0
  57. package/docs/api/foundation-forms.md +147 -0
  58. package/docs/api/foundation-forms.parsecsv.md +56 -0
  59. package/docs/api-report.md.api.md +85 -3
  60. package/package.json +19 -17
@@ -0,0 +1,72 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-forms](./foundation-forms.md) &gt; [mapCsvToSchema](./foundation-forms.mapcsvtoschema.md)
4
+
5
+ ## mapCsvToSchema() function
6
+
7
+ Maps CSV rows to schema fields with case-insensitive matching. Converts values to appropriate types based on schema definition.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export declare function mapCsvToSchema(csvRows: Record<string, string>[], schema: JSONSchema7 | undefined): CsvMappingResult;
13
+ ```
14
+
15
+ ## Parameters
16
+
17
+ <table><thead><tr><th>
18
+
19
+ Parameter
20
+
21
+
22
+ </th><th>
23
+
24
+ Type
25
+
26
+
27
+ </th><th>
28
+
29
+ Description
30
+
31
+
32
+ </th></tr></thead>
33
+ <tbody><tr><td>
34
+
35
+ csvRows
36
+
37
+
38
+ </td><td>
39
+
40
+ Record&lt;string, string&gt;\[\]
41
+
42
+
43
+ </td><td>
44
+
45
+ The parsed CSV rows
46
+
47
+
48
+ </td></tr>
49
+ <tr><td>
50
+
51
+ schema
52
+
53
+
54
+ </td><td>
55
+
56
+ JSONSchema7 \| undefined
57
+
58
+
59
+ </td><td>
60
+
61
+ The JSON schema defining the fields
62
+
63
+
64
+ </td></tr>
65
+ </tbody></table>
66
+
67
+ **Returns:**
68
+
69
+ [CsvMappingResult](./foundation-forms.csvmappingresult.md)
70
+
71
+ Mapped rows and list of unmapped columns
72
+
@@ -56,6 +56,28 @@ Description
56
56
  </th></tr></thead>
57
57
  <tbody><tr><td>
58
58
 
59
+ [downloadCsvTemplate(csvContent, fileName)](./foundation-forms.downloadcsvtemplate.md)
60
+
61
+
62
+ </td><td>
63
+
64
+ Triggers a download of the CSV template file in the browser.
65
+
66
+
67
+ </td></tr>
68
+ <tr><td>
69
+
70
+ [generateCsvTemplate(schema, uiSchema, includeOptionalFields, includeBom)](./foundation-forms.generatecsvtemplate.md)
71
+
72
+
73
+ </td><td>
74
+
75
+ Generates a CSV template string with headers and sample data based on JSON schema. If a UI schema is provided, it will be used to determine which fields to include and in what order. Hidden fields in the UI schema will be excluded.
76
+
77
+
78
+ </td></tr>
79
+ <tr><td>
80
+
59
81
  [getAnyOfErrorMessage(errors, schema, controlPath, uiCustomMsg)](./foundation-forms.getanyoferrormessage.md)
60
82
 
61
83
 
@@ -64,6 +86,17 @@ Description
64
86
  Computes a human-friendly anyOf error message for a given control path. Prefers UI schema custom message, then JSON schema errorMessage.anyOf, then a constructed fallback.
65
87
 
66
88
 
89
+ </td></tr>
90
+ <tr><td>
91
+
92
+ [mapCsvToSchema(csvRows, schema)](./foundation-forms.mapcsvtoschema.md)
93
+
94
+
95
+ </td><td>
96
+
97
+ Maps CSV rows to schema fields with case-insensitive matching. Converts values to appropriate types based on schema definition.
98
+
99
+
67
100
  </td></tr>
68
101
  <tr><td>
69
102
 
@@ -75,6 +108,54 @@ Computes a human-friendly anyOf error message for a given control path. Prefers
75
108
  Ensures the value of the current field (the one the validator is on) matches the one of the target field.
76
109
 
77
110
 
111
+ </td></tr>
112
+ <tr><td>
113
+
114
+ [parseCsv(content)](./foundation-forms.parsecsv.md)
115
+
116
+
117
+ </td><td>
118
+
119
+ Parses a CSV string into headers and rows using PapaParse. Handles quoted fields, escaped quotes, empty values, and mixed line endings.
120
+
121
+
122
+ </td></tr>
123
+ </tbody></table>
124
+
125
+ ## Interfaces
126
+
127
+ <table><thead><tr><th>
128
+
129
+ Interface
130
+
131
+
132
+ </th><th>
133
+
134
+ Description
135
+
136
+
137
+ </th></tr></thead>
138
+ <tbody><tr><td>
139
+
140
+ [CsvMappingResult](./foundation-forms.csvmappingresult.md)
141
+
142
+
143
+ </td><td>
144
+
145
+ Result of mapping CSV data to schema fields.
146
+
147
+
148
+ </td></tr>
149
+ <tr><td>
150
+
151
+ [CsvParseResult](./foundation-forms.csvparseresult.md)
152
+
153
+
154
+ </td><td>
155
+
156
+ Result of parsing a CSV file.
157
+
158
+
78
159
  </td></tr>
79
160
  </tbody></table>
80
161
 
@@ -138,6 +219,61 @@ Description
138
219
  Configuration options available for array renderer.
139
220
 
140
221
 
222
+ </td></tr>
223
+ <tr><td>
224
+
225
+ [BulkRowStatus](./foundation-forms.bulkrowstatus.md)
226
+
227
+
228
+ </td><td>
229
+
230
+ Tracks the submission status and result for a single row in bulk insert mode.
231
+
232
+
233
+ </td></tr>
234
+ <tr><td>
235
+
236
+ [BulkRowSubmitStatus](./foundation-forms.bulkrowsubmitstatus.md)
237
+
238
+
239
+ </td><td>
240
+
241
+ Possible submission status values for a row in bulk insert mode.
242
+
243
+
244
+ </td></tr>
245
+ <tr><td>
246
+
247
+ [BulkSubmitFailedItem](./foundation-forms.bulksubmitfaileditem.md)
248
+
249
+
250
+ </td><td>
251
+
252
+ Represents a failed bulk insert item result.
253
+
254
+
255
+ </td></tr>
256
+ <tr><td>
257
+
258
+ [BulkSubmitResult](./foundation-forms.bulksubmitresult.md)
259
+
260
+
261
+ </td><td>
262
+
263
+ Result of a bulk insert submission containing successful and failed items.
264
+
265
+
266
+ </td></tr>
267
+ <tr><td>
268
+
269
+ [BulkSubmitSuccessItem](./foundation-forms.bulksubmitsuccessitem.md)
270
+
271
+
272
+ </td><td>
273
+
274
+ Represents a successful bulk insert item result.
275
+
276
+
141
277
  </td></tr>
142
278
  <tr><td>
143
279
 
@@ -149,6 +285,17 @@ Configuration options available for array renderer.
149
285
  Configuration options available for categorization renderer.
150
286
 
151
287
 
288
+ </td></tr>
289
+ <tr><td>
290
+
291
+ [ChildUiSchemaResolver](./foundation-forms.childuischemaresolver.md)
292
+
293
+
294
+ </td><td>
295
+
296
+ Resolver for dynamic per-row UI schema in array/bulk-insert mode. Receives the row index, that row's data, and the full form data.
297
+
298
+
152
299
  </td></tr>
153
300
  <tr><td>
154
301
 
@@ -0,0 +1,56 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-forms](./foundation-forms.md) &gt; [parseCsv](./foundation-forms.parsecsv.md)
4
+
5
+ ## parseCsv() function
6
+
7
+ Parses a CSV string into headers and rows using PapaParse. Handles quoted fields, escaped quotes, empty values, and mixed line endings.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export declare function parseCsv(content: string): CsvParseResult;
13
+ ```
14
+
15
+ ## Parameters
16
+
17
+ <table><thead><tr><th>
18
+
19
+ Parameter
20
+
21
+
22
+ </th><th>
23
+
24
+ Type
25
+
26
+
27
+ </th><th>
28
+
29
+ Description
30
+
31
+
32
+ </th></tr></thead>
33
+ <tbody><tr><td>
34
+
35
+ content
36
+
37
+
38
+ </td><td>
39
+
40
+ string
41
+
42
+
43
+ </td><td>
44
+
45
+ The CSV content as a string
46
+
47
+
48
+ </td></tr>
49
+ </tbody></table>
50
+
51
+ **Returns:**
52
+
53
+ [CsvParseResult](./foundation-forms.csvparseresult.md)
54
+
55
+ The parsed result with headers, rows, and any errors
56
+
@@ -31,18 +31,57 @@ import { ViewTemplate } from '@microsoft/fast-element';
31
31
 
32
32
  // @public
33
33
  export type ArrayRendererOptions = {
34
- childUiSchema?: UiSchema;
34
+ childUiSchema?: UiSchema | ChildUiSchemaResolver;
35
35
  addLabel?: string;
36
36
  deleteLabel?: string;
37
37
  border?: boolean;
38
38
  canDelete?: (item: any) => boolean;
39
39
  };
40
40
 
41
+ // @public
42
+ export type BulkRowStatus = {
43
+ status: BulkRowSubmitStatus;
44
+ errors?: Array<{
45
+ CODE: string;
46
+ TEXT: string;
47
+ }>;
48
+ response?: any;
49
+ };
50
+
51
+ // @public
52
+ export type BulkRowSubmitStatus = 'pending' | 'submitting' | 'success' | 'failed';
53
+
54
+ // @public
55
+ export type BulkSubmitFailedItem = {
56
+ item: any;
57
+ index: number;
58
+ errors: Array<{
59
+ CODE: string;
60
+ TEXT: string;
61
+ }>;
62
+ };
63
+
64
+ // @public
65
+ export type BulkSubmitResult = {
66
+ successful: BulkSubmitSuccessItem[];
67
+ failed: BulkSubmitFailedItem[];
68
+ };
69
+
70
+ // @public
71
+ export type BulkSubmitSuccessItem = {
72
+ item: any;
73
+ index: number;
74
+ response: any;
75
+ };
76
+
41
77
  // @public
42
78
  export type CategorizationRendererOptions = {
43
79
  childElements?: UiSchema[];
44
80
  };
45
81
 
82
+ // @public
83
+ export type ChildUiSchemaResolver = (index: number, rowData: any, formData: any) => UiSchema;
84
+
46
85
  // Warning: (ae-internal-missing-underscore) The name "comboboxRendererStyles" should be prefixed with an underscore because the declaration is marked as @internal
47
86
  //
48
87
  // @internal (undocumented)
@@ -75,6 +114,30 @@ export type ConnectedRenderersOptions = {
75
114
  // @internal
76
115
  export const createExpressions: (payload: any) => Expressions;
77
116
 
117
+ // @public
118
+ export interface CsvMappingResult {
119
+ mappedRows: Record<string, any>[];
120
+ unmappedColumns: string[];
121
+ }
122
+
123
+ // @public
124
+ export interface CsvParseResult {
125
+ errors: string[];
126
+ headers: string[];
127
+ rows: Record<string, string>[];
128
+ }
129
+
130
+ // @public
131
+ export function downloadCsvTemplate(csvContent: string, fileName?: string): void;
132
+
133
+ // Warning: (ae-internal-missing-underscore) The name "extractFieldsFromUiSchema" should be prefixed with an underscore because the declaration is marked as @internal
134
+ //
135
+ // @internal
136
+ export function extractFieldsFromUiSchema(uiSchema: UiSchema): Array<{
137
+ fieldName: string;
138
+ isHidden: boolean;
139
+ }>;
140
+
78
141
  // Warning: (ae-forgotten-export) The symbol "Filters_base" needs to be exported by the entry point index.d.ts
79
142
  //
80
143
  // @public
@@ -137,14 +200,22 @@ export class Form extends Form_base {
137
200
  approvalMessageLabel: string;
138
201
  // @internal
139
202
  approvalModal: any;
203
+ bulkInsert: boolean;
204
+ bulkInsertMaxItems: number | undefined;
205
+ bulkInsertMinItems: number;
206
+ clearRowSubmitStatuses(): void;
140
207
  // @internal
141
208
  closeApprovalModal(): void;
142
209
  confirmationMessage: string;
210
+ // @internal
211
+ csvFileInput: HTMLInputElement;
143
212
  data: any;
144
213
  // @internal (undocumented)
145
214
  deepClone(): Node;
146
215
  // @internal (undocumented)
147
216
  disconnectedCallback(): void;
217
+ downloadCsvTemplate(): void;
218
+ handleCsvFileSelected(event: Event): Promise<void>;
148
219
  hideSubmit: boolean;
149
220
  // @internal
150
221
  get isSubmitHidden(): boolean;
@@ -160,11 +231,13 @@ export class Form extends Form_base {
160
231
  renderersChanged(): void;
161
232
  reset(clearData?: boolean): void;
162
233
  resourceName: string;
234
+ rowSubmitStatuses: Map<number, BulkRowStatus>;
163
235
  setApprovalMessage: boolean;
164
236
  // @internal (undocumented)
165
237
  _submit(): Promise<void>;
166
238
  // @internal (undocumented)
167
239
  submitPart(event: CustomEvent): void;
240
+ submitSingleRow(index: number): Promise<void>;
168
241
  // @internal (undocumented)
169
242
  submitted: boolean;
170
243
  // @internal (undocumented)
@@ -184,6 +257,9 @@ export const foundationFormStyles: ElementStyles;
184
257
  // @internal (undocumented)
185
258
  export const foundationFormTemplate: ViewTemplate<Form, any>;
186
259
 
260
+ // @public
261
+ export function generateCsvTemplate(schema: JSONSchema7 | undefined, uiSchema?: UiSchema, includeOptionalFields?: boolean, includeBom?: boolean): string;
262
+
187
263
  // Warning: (ae-internal-missing-underscore) The name "genesisErrorTranslator" should be prefixed with an underscore because the declaration is marked as @internal
188
264
  //
189
265
  // @internal (undocumented)
@@ -243,6 +319,9 @@ export { Layout }
243
319
  // @internal (undocumented)
244
320
  export const logger: Logger;
245
321
 
322
+ // @public
323
+ export function mapCsvToSchema(csvRows: Record<string, string>[], schema: JSONSchema7 | undefined): CsvMappingResult;
324
+
246
325
  // @public
247
326
  export const mustMatch: (target: string) => (data: any, path: any, label: any) => {
248
327
  instancePath: string;
@@ -259,6 +338,9 @@ export type NumberRendererOptions = {
259
338
  autocomplete?: string;
260
339
  };
261
340
 
341
+ // @public
342
+ export function parseCsv(content: string): CsvParseResult;
343
+
262
344
  // @public
263
345
  export type RendererEntry = {
264
346
  renderer: ViewTemplate<DispatchRenderer, any>;
@@ -329,8 +411,8 @@ export type UiSchemaOptions = StepperOrientationOptions | LabelPlacementOptions;
329
411
 
330
412
  // Warnings were encountered during analysis:
331
413
  //
332
- // src/types.ts:368:3 - (ae-forgotten-export) The symbol "Rule" needs to be exported by the entry point index.d.ts
333
- // src/types.ts:418:3 - (ae-forgotten-export) The symbol "DispatchRenderer" needs to be exported by the entry point index.d.ts
414
+ // src/types.ts:377:3 - (ae-forgotten-export) The symbol "Rule" needs to be exported by the entry point index.d.ts
415
+ // src/types.ts:427:3 - (ae-forgotten-export) The symbol "DispatchRenderer" needs to be exported by the entry point index.d.ts
334
416
 
335
417
  // (No @packageDocumentation comment for this package)
336
418
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/foundation-forms",
3
3
  "description": "Genesis Foundation Forms",
4
- "version": "14.397.0",
4
+ "version": "14.397.1-alpha-87a7828.0",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -50,22 +50,23 @@
50
50
  }
51
51
  },
52
52
  "devDependencies": {
53
- "@genesislcap/foundation-testing": "14.397.0",
54
- "@genesislcap/genx": "14.397.0",
55
- "@genesislcap/rollup-builder": "14.397.0",
56
- "@genesislcap/ts-builder": "14.397.0",
57
- "@genesislcap/uvu-playwright-builder": "14.397.0",
58
- "@genesislcap/vite-builder": "14.397.0",
59
- "@genesislcap/webpack-builder": "14.397.0",
60
- "@types/json-schema": "^7.0.11"
53
+ "@genesislcap/foundation-testing": "14.397.1-alpha-87a7828.0",
54
+ "@genesislcap/genx": "14.397.1-alpha-87a7828.0",
55
+ "@genesislcap/rollup-builder": "14.397.1-alpha-87a7828.0",
56
+ "@genesislcap/ts-builder": "14.397.1-alpha-87a7828.0",
57
+ "@genesislcap/uvu-playwright-builder": "14.397.1-alpha-87a7828.0",
58
+ "@genesislcap/vite-builder": "14.397.1-alpha-87a7828.0",
59
+ "@genesislcap/webpack-builder": "14.397.1-alpha-87a7828.0",
60
+ "@types/json-schema": "^7.0.11",
61
+ "@types/papaparse": "^5.3.14"
61
62
  },
62
63
  "dependencies": {
63
- "@genesislcap/foundation-comms": "14.397.0",
64
- "@genesislcap/foundation-criteria": "14.397.0",
65
- "@genesislcap/foundation-logger": "14.397.0",
66
- "@genesislcap/foundation-notifications": "14.397.0",
67
- "@genesislcap/foundation-ui": "14.397.0",
68
- "@genesislcap/foundation-utils": "14.397.0",
64
+ "@genesislcap/foundation-comms": "14.397.1-alpha-87a7828.0",
65
+ "@genesislcap/foundation-criteria": "14.397.1-alpha-87a7828.0",
66
+ "@genesislcap/foundation-logger": "14.397.1-alpha-87a7828.0",
67
+ "@genesislcap/foundation-notifications": "14.397.1-alpha-87a7828.0",
68
+ "@genesislcap/foundation-ui": "14.397.1-alpha-87a7828.0",
69
+ "@genesislcap/foundation-utils": "14.397.1-alpha-87a7828.0",
69
70
  "@json-schema-tools/dereferencer": "^1.6.1",
70
71
  "@jsonforms/core": "^3.2.1",
71
72
  "@microsoft/fast-components": "2.30.6",
@@ -75,7 +76,8 @@
75
76
  "ajv": "8.16.0",
76
77
  "change-case": "^4.1.2",
77
78
  "json-schema": "^0.4.0",
78
- "lodash": "^4.17.21"
79
+ "lodash": "^4.17.21",
80
+ "papaparse": "^5.4.1"
79
81
  },
80
82
  "repository": {
81
83
  "type": "git",
@@ -86,5 +88,5 @@
86
88
  "access": "public"
87
89
  },
88
90
  "customElements": "dist/custom-elements.json",
89
- "gitHead": "8f1ca152926bc3dfadd9f09ff5f712d0dafda2af"
91
+ "gitHead": "5ce075ab560a022253661c2f8af9c8883c76b0ad"
90
92
  }