@genesislcap/foundation-forms 14.483.3-alpha-7a2e689.0 → 14.484.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.
- package/dist/custom-elements.json +14 -14
- package/dist/dts/filters/filters.d.ts +1 -1
- package/dist/dts/filters/filters.d.ts.map +1 -1
- package/dist/dts/form.d.ts +14 -14
- package/dist/dts/form.d.ts.map +1 -1
- package/dist/dts/jsonforms/json-forms.d.ts +1 -1
- package/dist/dts/jsonforms/json-forms.d.ts.map +1 -1
- package/dist/dts/react.d.ts +13 -12
- package/dist/dts/types.d.ts +199 -0
- package/dist/dts/types.d.ts.map +1 -1
- package/dist/esm/filters/filters.js +1 -1
- package/dist/esm/form.js +69 -26
- package/dist/esm/jsonforms/json-forms.js +1 -1
- package/dist/foundation-forms.api.json +467 -2
- package/dist/foundation-forms.d.ts +226 -14
- package/package.json +15 -15
package/dist/esm/form.js
CHANGED
|
@@ -78,20 +78,20 @@ export const renderers = [
|
|
|
78
78
|
* Allowing customisable form elements using UI schema and set of custom renderers
|
|
79
79
|
* @public
|
|
80
80
|
*
|
|
81
|
-
* @fires submit - Fired when the form is submitted (includes payload and validation errors)
|
|
82
|
-
* @fires submit-failure - Fired when submit fails (server or client validation)
|
|
81
|
+
* @fires submit - Fired when the form is submitted (includes payload and validation errors). detail: `SubmitEventDetail`
|
|
82
|
+
* @fires submit-failure - Fired when submit fails (server or client validation). detail: `SubmitFailureEventDetail`
|
|
83
83
|
* @fires submit-success - Fired when submit succeeds
|
|
84
|
-
* @fires submit-partial-success - Fired when bulk submit partially succeeds
|
|
84
|
+
* @fires submit-partial-success - Fired when bulk submit partially succeeds. detail: `SubmitPartialSuccessEventDetail`
|
|
85
85
|
* @fires reset-clicked - Fired reset button is clicked
|
|
86
|
-
* @fires row-status-changed - Fired when row submit status changes
|
|
87
|
-
* @fires bulk-submit-complete - Fired when bulk submit completes
|
|
88
|
-
* @fires row-submit-failure - Fired when a single row submit fails
|
|
89
|
-
* @fires row-submit-success - Fired when a single row submit succeeds
|
|
90
|
-
* @fires data-change - Fired when form data changes
|
|
91
|
-
* @fires csv-parse-error - Fired when CSV import parsing fails
|
|
92
|
-
* @fires csv-imported - Fired when CSV data is imported successfully
|
|
93
|
-
* @fires csv-template-error - Fired when CSV template cannot be generated
|
|
94
|
-
* @fires csv-template-downloaded - Fired when CSV template is downloaded
|
|
86
|
+
* @fires row-status-changed - Fired when row submit status changes. detail: `RowStatusChangedEventDetail`
|
|
87
|
+
* @fires bulk-submit-complete - Fired when bulk submit completes. detail: `BulkSubmitResult`
|
|
88
|
+
* @fires row-submit-failure - Fired when a single row submit fails. detail: `RowSubmitFailureEventDetail`
|
|
89
|
+
* @fires row-submit-success - Fired when a single row submit succeeds. detail: `RowSubmitSuccessEventDetail`
|
|
90
|
+
* @fires data-change - Fired when form data changes. detail: `FormDataChangeEventDetail`
|
|
91
|
+
* @fires csv-parse-error - Fired when CSV import parsing fails. detail: `CsvParseErrorEventDetail`
|
|
92
|
+
* @fires csv-imported - Fired when CSV data is imported successfully. detail: `CsvImportedEventDetail`
|
|
93
|
+
* @fires csv-template-error - Fired when CSV template cannot be generated. detail: `CsvTemplateErrorEventDetail`
|
|
94
|
+
* @fires csv-template-downloaded - Fired when CSV template is downloaded. detail: `CsvTemplateDownloadedEventDetail`
|
|
95
95
|
*/
|
|
96
96
|
let Form = class Form extends LifecycleMixin(FoundationElement) {
|
|
97
97
|
constructor() {
|
|
@@ -305,7 +305,10 @@ let Form = class Form extends LifecycleMixin(FoundationElement) {
|
|
|
305
305
|
}
|
|
306
306
|
else {
|
|
307
307
|
this.applyServerFieldErrors(formSubmitReq.ERROR);
|
|
308
|
-
this.$emit('submit-failure', {
|
|
308
|
+
this.$emit('submit-failure', {
|
|
309
|
+
payload,
|
|
310
|
+
errors: formSubmitReq.ERROR,
|
|
311
|
+
});
|
|
309
312
|
}
|
|
310
313
|
}
|
|
311
314
|
else {
|
|
@@ -329,7 +332,10 @@ let Form = class Form extends LifecycleMixin(FoundationElement) {
|
|
|
329
332
|
CODE: 'BULK_INSERT_MIN_ITEMS',
|
|
330
333
|
TEXT: `At least ${this.bulkInsertMinItems} item(s) required`,
|
|
331
334
|
};
|
|
332
|
-
this.$emit('submit-failure', {
|
|
335
|
+
this.$emit('submit-failure', {
|
|
336
|
+
payload: this.data,
|
|
337
|
+
errors: [error],
|
|
338
|
+
});
|
|
333
339
|
return;
|
|
334
340
|
}
|
|
335
341
|
// Validate maximum items if set
|
|
@@ -338,11 +344,17 @@ let Form = class Form extends LifecycleMixin(FoundationElement) {
|
|
|
338
344
|
CODE: 'BULK_INSERT_MAX_ITEMS',
|
|
339
345
|
TEXT: `Maximum ${this.bulkInsertMaxItems} item(s) allowed`,
|
|
340
346
|
};
|
|
341
|
-
this.$emit('submit-failure', {
|
|
347
|
+
this.$emit('submit-failure', {
|
|
348
|
+
payload: this.data,
|
|
349
|
+
errors: [error],
|
|
350
|
+
});
|
|
342
351
|
return;
|
|
343
352
|
}
|
|
344
353
|
logger.debug({ bulkItems: items, errors: this.errors });
|
|
345
|
-
this.$emit('submit', {
|
|
354
|
+
this.$emit('submit', {
|
|
355
|
+
payload: this.data,
|
|
356
|
+
errors: this.errors,
|
|
357
|
+
});
|
|
346
358
|
if (items.length === 0 || this.errors.length || !this.resourceName) {
|
|
347
359
|
return;
|
|
348
360
|
}
|
|
@@ -357,7 +369,9 @@ let Form = class Form extends LifecycleMixin(FoundationElement) {
|
|
|
357
369
|
}
|
|
358
370
|
// Trigger reactivity by reassigning and emit event
|
|
359
371
|
this.rowSubmitStatuses = new Map(this.rowSubmitStatuses);
|
|
360
|
-
this.$emit('row-status-changed', {
|
|
372
|
+
this.$emit('row-status-changed', {
|
|
373
|
+
statuses: this.rowSubmitStatuses,
|
|
374
|
+
});
|
|
361
375
|
const results = {
|
|
362
376
|
successful: [],
|
|
363
377
|
failed: [],
|
|
@@ -411,7 +425,10 @@ let Form = class Form extends LifecycleMixin(FoundationElement) {
|
|
|
411
425
|
else {
|
|
412
426
|
this.applyBulkServerFieldErrors(results.failed);
|
|
413
427
|
// Partial success - emit both events
|
|
414
|
-
this.$emit('submit-partial-success', {
|
|
428
|
+
this.$emit('submit-partial-success', {
|
|
429
|
+
payload: this.data,
|
|
430
|
+
results,
|
|
431
|
+
});
|
|
415
432
|
}
|
|
416
433
|
});
|
|
417
434
|
}
|
|
@@ -426,7 +443,11 @@ let Form = class Form extends LifecycleMixin(FoundationElement) {
|
|
|
426
443
|
// Create a new Map to trigger FAST Element reactivity
|
|
427
444
|
this.rowSubmitStatuses = new Map(this.rowSubmitStatuses);
|
|
428
445
|
// Emit event for child components to update
|
|
429
|
-
this.$emit('row-status-changed', {
|
|
446
|
+
this.$emit('row-status-changed', {
|
|
447
|
+
statuses: this.rowSubmitStatuses,
|
|
448
|
+
index,
|
|
449
|
+
status,
|
|
450
|
+
});
|
|
430
451
|
}
|
|
431
452
|
/**
|
|
432
453
|
* Clears all row submit statuses, typically called when resetting the form.
|
|
@@ -473,17 +494,29 @@ let Form = class Form extends LifecycleMixin(FoundationElement) {
|
|
|
473
494
|
if (response.ERROR) {
|
|
474
495
|
this.updateRowStatus(index, { status: 'failed', errors: response.ERROR });
|
|
475
496
|
this.applyServerFieldErrors(response.ERROR, `/items/${index}`);
|
|
476
|
-
this.$emit('row-submit-failure', {
|
|
497
|
+
this.$emit('row-submit-failure', {
|
|
498
|
+
index,
|
|
499
|
+
item,
|
|
500
|
+
errors: response.ERROR,
|
|
501
|
+
});
|
|
477
502
|
}
|
|
478
503
|
else {
|
|
479
504
|
this.updateRowStatus(index, { status: 'success', response });
|
|
480
|
-
this.$emit('row-submit-success', {
|
|
505
|
+
this.$emit('row-submit-success', {
|
|
506
|
+
index,
|
|
507
|
+
item,
|
|
508
|
+
response,
|
|
509
|
+
});
|
|
481
510
|
}
|
|
482
511
|
}
|
|
483
512
|
catch (error) {
|
|
484
513
|
const errors = [{ CODE: 'SUBMIT_ERROR', TEXT: String(error) }];
|
|
485
514
|
this.updateRowStatus(index, { status: 'failed', errors });
|
|
486
|
-
this.$emit('row-submit-failure', {
|
|
515
|
+
this.$emit('row-submit-failure', {
|
|
516
|
+
index,
|
|
517
|
+
item,
|
|
518
|
+
errors,
|
|
519
|
+
});
|
|
487
520
|
}
|
|
488
521
|
});
|
|
489
522
|
}
|
|
@@ -671,7 +704,10 @@ let Form = class Form extends LifecycleMixin(FoundationElement) {
|
|
|
671
704
|
this.submitting = false;
|
|
672
705
|
if (formSubmitReq.ERROR) {
|
|
673
706
|
this.applyServerFieldErrors(formSubmitReq.ERROR);
|
|
674
|
-
this.$emit('submit-failure', {
|
|
707
|
+
this.$emit('submit-failure', {
|
|
708
|
+
payload: this.pendingPayload,
|
|
709
|
+
errors: formSubmitReq.ERROR,
|
|
710
|
+
});
|
|
675
711
|
}
|
|
676
712
|
else {
|
|
677
713
|
this.$emit('submit-success', { payload: this.pendingPayload, response: formSubmitReq });
|
|
@@ -697,7 +733,10 @@ let Form = class Form extends LifecycleMixin(FoundationElement) {
|
|
|
697
733
|
const content = yield file.text();
|
|
698
734
|
const parseResult = parseCsv(content);
|
|
699
735
|
if (parseResult.errors.length > 0) {
|
|
700
|
-
this.$emit('csv-parse-error', {
|
|
736
|
+
this.$emit('csv-parse-error', {
|
|
737
|
+
errors: parseResult.errors,
|
|
738
|
+
fileName: file.name,
|
|
739
|
+
});
|
|
701
740
|
logger.warn('CSV parse errors:', parseResult.errors);
|
|
702
741
|
this.clearCsvFileInput();
|
|
703
742
|
return;
|
|
@@ -779,14 +818,18 @@ let Form = class Form extends LifecycleMixin(FoundationElement) {
|
|
|
779
818
|
downloadCsvTemplate() {
|
|
780
819
|
if (!this.originalDetailsSchema) {
|
|
781
820
|
logger.warn('Cannot download CSV template: schema not available');
|
|
782
|
-
this.$emit('csv-template-error', {
|
|
821
|
+
this.$emit('csv-template-error', {
|
|
822
|
+
error: 'Schema not available',
|
|
823
|
+
});
|
|
783
824
|
return;
|
|
784
825
|
}
|
|
785
826
|
// Use UI schema to determine which columns to include (only fields in uischema, not all schema fields)
|
|
786
827
|
const csvContent = generateCsvTemplate(this.originalDetailsSchema, this.uischema);
|
|
787
828
|
if (!csvContent) {
|
|
788
829
|
logger.warn('Cannot download CSV template: no fields in schema');
|
|
789
|
-
this.$emit('csv-template-error', {
|
|
830
|
+
this.$emit('csv-template-error', {
|
|
831
|
+
error: 'No fields found in schema',
|
|
832
|
+
});
|
|
790
833
|
return;
|
|
791
834
|
}
|
|
792
835
|
// Generate filename based on resource name or use default
|
|
@@ -31,7 +31,7 @@ const errorTranslator = (error, t, uischema) => {
|
|
|
31
31
|
* @public
|
|
32
32
|
*
|
|
33
33
|
* @fires change - Bubbles from nested dispatch-renderer when a control emits change (e.g. multiselect)
|
|
34
|
-
* @fires data-change - Fired when bound form data changes
|
|
34
|
+
* @fires data-change - Fired when bound form data changes. detail: `FormDataChangeEventDetail`
|
|
35
35
|
*/
|
|
36
36
|
let JSONForms = class JSONForms extends FASTElement {
|
|
37
37
|
constructor() {
|