@genesislcap/foundation-forms 15.3.2-FUI-2571-formatters.1 → 15.3.2-FUI-2591.1
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/dts/form.d.ts.map +1 -1
- package/dist/dts/jsonforms/renderers/DateControlRenderer.d.ts +12 -0
- package/dist/dts/jsonforms/renderers/DateControlRenderer.d.ts.map +1 -1
- package/dist/dts/utils/review-utils.d.ts +0 -22
- package/dist/dts/utils/review-utils.d.ts.map +1 -1
- package/dist/esm/form.js +45 -97
- package/dist/esm/jsonforms/renderers/DateControlRenderer.js +26 -13
- package/dist/esm/utils/review-utils.js +7 -149
- package/dist/foundation-forms.d.ts +0 -23
- package/package.json +15 -15
package/dist/dts/form.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../src/form.ts"],"names":[],"mappings":"AAGA,OAAO,EAGL,aAAa,EAGd,MAAM,iBAAiB,CAAC;AASzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,KAAK,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAyB1C,OAAO,EACL,aAAa,EAOb,yBAAyB,EACzB,aAAa,EAOb,QAAQ,EACT,MAAM,SAAS,CAAC;AACjB,OAAO,EAWL,aAAa,EACd,MAAM,SAAS,CAAC;AAiBjB;;;GAGG;AACH,eAAO,MAAM,SAAS,OAwBrB,CAAC;;;;;;;;kBA5CyB,CAAC;;;;;;;;8BAmDqD,CAAC,cAAc,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAW7F,CAAC;4IAC6D,CAAC;wFACsB,CAAC;+IAUvF,CAAH;2FAG+C,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BA6BlC,CAAC;;;;;;;;;;;;;;;;;;;;;;;mBA0EZ,CAAC;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AAC,0BAA0B;IAQlC;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAOzB;;;OAGG;IACH,kBAAkB;IAQlB;;;OAGG;IACG,kBAAkB;IAmCxB;;;;;OAKG;IACG,qBAAqB,CAAC,KAAK,EAAE,KAAK;IA4FxC;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAMzB;;;;;OAKG;IACH,mBAAmB;CA+BpB"}
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { RendererEntry } from '../../types';
|
|
2
2
|
import { DispatchRenderer } from './dispatch-renderer';
|
|
3
|
+
/**
|
|
4
|
+
* Computes the `<input type="date"|"datetime-local">` text value for a control's stored epoch.
|
|
5
|
+
*
|
|
6
|
+
* A date-only value ("YYYY-MM-DD", written back via `new Date(inputValue)` below) is parsed as
|
|
7
|
+
* UTC midnight per spec, but a datetime-local value ("YYYY-MM-DDTHH:MM") is parsed as local
|
|
8
|
+
* time. Reading a DATE control's stored epoch back with local getters disagrees with that UTC
|
|
9
|
+
* write, shifting the displayed day by one for any negative UTC offset — so DATE reads via UTC
|
|
10
|
+
* getters to match, while DATETIME (a true instant, correctly local on both ends) keeps local
|
|
11
|
+
* getters.
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare function formatDateControlValue(control: any): string;
|
|
3
15
|
export declare const DateControlRendererTemplate: (prefix?: string) => import("@microsoft/fast-element").ViewTemplate<DispatchRenderer, any>;
|
|
4
16
|
export declare const DateControlRendererEntry: RendererEntry;
|
|
5
17
|
//# sourceMappingURL=DateControlRenderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateControlRenderer.d.ts","sourceRoot":"","sources":["../../../../src/jsonforms/renderers/DateControlRenderer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAI5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAgBvD,eAAO,MAAM,2BAA2B,GAAI,SAAQ,MAAe,
|
|
1
|
+
{"version":3,"file":"DateControlRenderer.d.ts","sourceRoot":"","sources":["../../../../src/jsonforms/renderers/DateControlRenderer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAI5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAgBvD;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,GAAG,GAAG,MAAM,CAc3D;AAED,eAAO,MAAM,2BAA2B,GAAI,SAAQ,MAAe,0EA8BlE,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,aAMtC,CAAC"}
|
|
@@ -66,28 +66,6 @@ export declare function resolveResourceOptionLabel(raw: any, options: any): Prom
|
|
|
66
66
|
* @internal
|
|
67
67
|
*/
|
|
68
68
|
export declare function resolveEnumLabel(raw: any, fieldName: string, schema: any): string | null;
|
|
69
|
-
/**
|
|
70
|
-
* Formats a raw value for the review panel by the same renderer type
|
|
71
|
-
* (`NumberControlRenderer`/`DateControlRenderer`) the form would use for this field. Numbers
|
|
72
|
-
* are formatted with `toIntlNumberFormat` (the same precision-safe path `NumberField` itself
|
|
73
|
-
* uses); dates/datetimes with `getDateFormatter`, adding hours/minutes for `GenesisType.DATETIME`
|
|
74
|
-
* fields. Returns `null` for non-number/date fields, or when no JSON schema is available to
|
|
75
|
-
* determine the field's type.
|
|
76
|
-
*
|
|
77
|
-
* `uischemaOptions` (the Control element's `options`, as passed to `resolveOptionLabel` etc.)
|
|
78
|
-
* carries the same display-affecting settings `NumberControlRenderer` reads directly —
|
|
79
|
-
* `formatOptions`, `withoutFormatting`, `prefix`, `suffix` — so a field configured with e.g.
|
|
80
|
-
* `withoutFormatting: true` or a custom `formatOptions.maximumFractionDigits` doesn't disagree
|
|
81
|
-
* with review over how many digits it shows.
|
|
82
|
-
*
|
|
83
|
-
* A `raw` array against an array-typed field schema (`{ type: 'array', items: {...} }`, per
|
|
84
|
-
* `isArray`'s convention) formats each element against `items` individually — e.g. an array of
|
|
85
|
-
* DATE values — falling back to the unformatted element for any that don't format, so
|
|
86
|
-
* `formatValueForReview`'s comma-join still sees a flat array of primitives. `uischemaOptions`
|
|
87
|
-
* applies to every element, matching how one Control renders every item in the array.
|
|
88
|
-
* @internal
|
|
89
|
-
*/
|
|
90
|
-
export declare function formatValueByFieldType(raw: any, fieldName: string, schema: any, uischemaOptions?: any): string | unknown[] | null;
|
|
91
69
|
/**
|
|
92
70
|
* Navigates a `/properties/`-separated path in data to support nested object scopes
|
|
93
71
|
* such as `ADDRESS/properties/STREET` produced by Group layout UI schemas.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"review-utils.d.ts","sourceRoot":"","sources":["../../../src/utils/review-utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"review-utils.d.ts","sourceRoot":"","sources":["../../../src/utils/review-utils.ts"],"names":[],"mappings":"AAIA,cAAc;AACd,MAAM,MAAM,WAAW,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3D,cAAc;AACd,MAAM,MAAM,aAAa,GAAG;IAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,WAAW,EAAE,CAAA;CAAE,CAAC;AAE5E;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzB,QAAQ,EAAE,GAAG,EACb,MAAM,EAAE,GAAG,GACV,OAAO,CAAC,aAAa,EAAE,CAAC,CAuE1B;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,aAAa,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,aAAa,EAAE,CAc9F;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,GAAG,MAAM,GAAG,IAAI,CAMxE;AAED;;;;;;;;GAQG;AACH,wBAAsB,0BAA0B,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA8B/F;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,MAAM,GAAG,IAAI,CAiBxF;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,GAAG,GAAG,CAEpE;AAYD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,CAwBvD"}
|
package/dist/esm/form.js
CHANGED
|
@@ -393,27 +393,7 @@ let Form = class Form extends LifecycleMixin(FoundationElement) {
|
|
|
393
393
|
this.$emit('submit', { payload, errors: this.errors });
|
|
394
394
|
if (Object.entries(payload).length !== 0 && !this.hasValidationErrors() && this.resourceName) {
|
|
395
395
|
this.submitting = true;
|
|
396
|
-
|
|
397
|
-
// genuine transport failure, so it's fair to report it as SUBMIT_ERROR. Response
|
|
398
|
-
// handling below (which can itself throw — e.g. a backend sending ERROR as a single
|
|
399
|
-
// object rather than an array) stays outside it, so a bug there surfaces as itself
|
|
400
|
-
// instead of being mislabeled as a transport failure with the server's real message lost.
|
|
401
|
-
// submitting is always cleared before the terminal $emit (success or failure) fires, not
|
|
402
|
-
// after, so a listener that reads it or re-triggers submission sees the request as done.
|
|
403
|
-
let formSubmitReq;
|
|
404
|
-
try {
|
|
405
|
-
formSubmitReq = yield this.connect.commitEvent(this.resourceName, commitPayload);
|
|
406
|
-
}
|
|
407
|
-
catch (error) {
|
|
408
|
-
// No applyServerFieldErrors here: a transport failure has no FIELD/PATH, so
|
|
409
|
-
// mapGenesisFieldErrorsToAdditionalErrors would map it to [] and wipe out any
|
|
410
|
-
// inline server errors already on screen from a prior submit, replacing them with
|
|
411
|
-
// nothing. Left to submit-failure listeners, matching the bulk/row-level paths below.
|
|
412
|
-
const errors = [{ CODE: 'SUBMIT_ERROR', TEXT: String(error) }];
|
|
413
|
-
this.submitting = false;
|
|
414
|
-
this.$emit('submit-failure', { payload, errors });
|
|
415
|
-
return;
|
|
416
|
-
}
|
|
396
|
+
const formSubmitReq = yield this.connect.commitEvent(this.resourceName, commitPayload);
|
|
417
397
|
this.submitting = false;
|
|
418
398
|
if (formSubmitReq.ERROR) {
|
|
419
399
|
const approvalError = formSubmitReq.ERROR.find((err) => err.CODE === 'APPROVAL_MESSAGE_MISSING');
|
|
@@ -479,66 +459,55 @@ let Form = class Form extends LifecycleMixin(FoundationElement) {
|
|
|
479
459
|
return;
|
|
480
460
|
}
|
|
481
461
|
this.submitting = true;
|
|
462
|
+
// Initialize rows as pending, but preserve already successful rows
|
|
463
|
+
for (let i = 0; i < items.length; i += 1) {
|
|
464
|
+
const currentStatus = this.rowSubmitStatuses.get(i);
|
|
465
|
+
// Don't reset rows that were already successfully submitted
|
|
466
|
+
if ((currentStatus === null || currentStatus === void 0 ? void 0 : currentStatus.status) !== 'success') {
|
|
467
|
+
this.rowSubmitStatuses.set(i, { status: 'pending' });
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
// Trigger reactivity by reassigning and emit event
|
|
471
|
+
this.rowSubmitStatuses = new Map(this.rowSubmitStatuses);
|
|
472
|
+
this.$emit('row-status-changed', {
|
|
473
|
+
statuses: this.rowSubmitStatuses,
|
|
474
|
+
});
|
|
482
475
|
const results = {
|
|
483
476
|
successful: [],
|
|
484
477
|
failed: [],
|
|
485
478
|
};
|
|
486
|
-
//
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
try {
|
|
494
|
-
// Initialize rows as pending, but preserve already successful rows
|
|
495
|
-
for (let i = 0; i < items.length; i += 1) {
|
|
496
|
-
const currentStatus = this.rowSubmitStatuses.get(i);
|
|
497
|
-
// Don't reset rows that were already successfully submitted
|
|
498
|
-
if ((currentStatus === null || currentStatus === void 0 ? void 0 : currentStatus.status) !== 'success') {
|
|
499
|
-
this.rowSubmitStatuses.set(i, { status: 'pending' });
|
|
500
|
-
}
|
|
479
|
+
// Submit each item sequentially, skipping already successful rows
|
|
480
|
+
/* oxlint-disable no-await-in-loop -- bulk submit must be sequential */
|
|
481
|
+
for (let i = 0; i < items.length; i += 1) {
|
|
482
|
+
// Skip rows that were already successfully submitted
|
|
483
|
+
const currentStatus = this.rowSubmitStatuses.get(i);
|
|
484
|
+
if ((currentStatus === null || currentStatus === void 0 ? void 0 : currentStatus.status) === 'success') {
|
|
485
|
+
continue;
|
|
501
486
|
}
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
this
|
|
505
|
-
|
|
506
|
-
});
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
if ((currentStatus === null || currentStatus === void 0 ? void 0 : currentStatus.status) === 'success') {
|
|
513
|
-
continue;
|
|
514
|
-
}
|
|
515
|
-
const item = items[i];
|
|
516
|
-
// Filter data to only include fields from UI schema
|
|
517
|
-
const commitPayload = this.buildCommitPayload(item, true);
|
|
518
|
-
// Update status to submitting
|
|
519
|
-
this.updateRowStatus(i, { status: 'submitting' });
|
|
520
|
-
try {
|
|
521
|
-
const response = yield this.connect.commitEvent(this.resourceName, commitPayload);
|
|
522
|
-
if (response.ERROR) {
|
|
523
|
-
results.failed.push({ item, index: i, errors: response.ERROR });
|
|
524
|
-
this.updateRowStatus(i, { status: 'failed', errors: response.ERROR });
|
|
525
|
-
}
|
|
526
|
-
else {
|
|
527
|
-
results.successful.push({ item, index: i, response });
|
|
528
|
-
this.updateRowStatus(i, { status: 'success', response });
|
|
529
|
-
}
|
|
487
|
+
const item = items[i];
|
|
488
|
+
// Filter data to only include fields from UI schema
|
|
489
|
+
const commitPayload = this.buildCommitPayload(item, true);
|
|
490
|
+
// Update status to submitting
|
|
491
|
+
this.updateRowStatus(i, { status: 'submitting' });
|
|
492
|
+
try {
|
|
493
|
+
const response = yield this.connect.commitEvent(this.resourceName, commitPayload);
|
|
494
|
+
if (response.ERROR) {
|
|
495
|
+
results.failed.push({ item, index: i, errors: response.ERROR });
|
|
496
|
+
this.updateRowStatus(i, { status: 'failed', errors: response.ERROR });
|
|
530
497
|
}
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
this.updateRowStatus(i, { status: 'failed', errors });
|
|
498
|
+
else {
|
|
499
|
+
results.successful.push({ item, index: i, response });
|
|
500
|
+
this.updateRowStatus(i, { status: 'success', response });
|
|
535
501
|
}
|
|
536
502
|
}
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
503
|
+
catch (error) {
|
|
504
|
+
const errors = [{ CODE: 'SUBMIT_ERROR', TEXT: String(error) }];
|
|
505
|
+
results.failed.push({ item, index: i, errors });
|
|
506
|
+
this.updateRowStatus(i, { status: 'failed', errors });
|
|
507
|
+
}
|
|
541
508
|
}
|
|
509
|
+
/* oxlint-enable no-await-in-loop */
|
|
510
|
+
this.submitting = false;
|
|
542
511
|
// Emit bulk-specific event with aggregated results
|
|
543
512
|
this.$emit('bulk-submit-complete', results);
|
|
544
513
|
// Also emit standard events based on overall result
|
|
@@ -833,40 +802,19 @@ let Form = class Form extends LifecycleMixin(FoundationElement) {
|
|
|
833
802
|
DETAILS: this.pendingPayload,
|
|
834
803
|
APPROVAL_MESSAGE: this.approvalMessage,
|
|
835
804
|
};
|
|
836
|
-
|
|
837
|
-
// failure while handling the response (e.g. closeApprovalModal's approvalModal.close()
|
|
838
|
-
// throwing) can't be reported as a transport failure for a submission that already
|
|
839
|
-
// succeeded — that previously fired submit-failure with payload: null (pendingPayload is
|
|
840
|
-
// cleared by closeApprovalModal before .close() runs) right after submit-success had
|
|
841
|
-
// already fired for the same request, and left the modal visually open despite its state
|
|
842
|
-
// saying otherwise.
|
|
843
|
-
const pendingPayload = this.pendingPayload;
|
|
844
|
-
let formSubmitReq;
|
|
845
|
-
try {
|
|
846
|
-
formSubmitReq = yield this.connect.commitEvent(this.resourceName, commitPayload);
|
|
847
|
-
}
|
|
848
|
-
catch (error) {
|
|
849
|
-
// No applyServerFieldErrors here: no FIELD/PATH, so it would wipe existing inline errors
|
|
850
|
-
// and show nothing in their place.
|
|
851
|
-
const errors = [{ CODE: 'SUBMIT_ERROR', TEXT: String(error) }];
|
|
852
|
-
this.submitting = false;
|
|
853
|
-
this.$emit('submit-failure', {
|
|
854
|
-
payload: pendingPayload,
|
|
855
|
-
errors,
|
|
856
|
-
});
|
|
857
|
-
return;
|
|
858
|
-
}
|
|
805
|
+
const formSubmitReq = yield this.connect.commitEvent(this.resourceName, commitPayload);
|
|
859
806
|
this.submitting = false;
|
|
860
807
|
if (formSubmitReq.ERROR) {
|
|
861
808
|
this.applyServerFieldErrors(formSubmitReq.ERROR);
|
|
862
809
|
this.$emit('submit-failure', {
|
|
863
|
-
payload: pendingPayload,
|
|
810
|
+
payload: this.pendingPayload,
|
|
864
811
|
errors: formSubmitReq.ERROR,
|
|
865
812
|
});
|
|
866
813
|
}
|
|
867
814
|
else {
|
|
868
|
-
this.$emit('submit-success', { payload: pendingPayload, response: formSubmitReq });
|
|
815
|
+
this.$emit('submit-success', { payload: this.pendingPayload, response: formSubmitReq });
|
|
869
816
|
this.closeApprovalModal();
|
|
817
|
+
this.pendingPayload = null;
|
|
870
818
|
}
|
|
871
819
|
});
|
|
872
820
|
}
|
|
@@ -17,25 +17,38 @@ const typeSwitch = (control) => {
|
|
|
17
17
|
}
|
|
18
18
|
return ((_b = control.schema) === null || _b === void 0 ? void 0 : _b.genesisType) === GenesisType.DATETIME ? 'datetime-local' : 'date';
|
|
19
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* Computes the `<input type="date"|"datetime-local">` text value for a control's stored epoch.
|
|
22
|
+
*
|
|
23
|
+
* A date-only value ("YYYY-MM-DD", written back via `new Date(inputValue)` below) is parsed as
|
|
24
|
+
* UTC midnight per spec, but a datetime-local value ("YYYY-MM-DDTHH:MM") is parsed as local
|
|
25
|
+
* time. Reading a DATE control's stored epoch back with local getters disagrees with that UTC
|
|
26
|
+
* write, shifting the displayed day by one for any negative UTC offset — so DATE reads via UTC
|
|
27
|
+
* getters to match, while DATETIME (a true instant, correctly local on both ends) keeps local
|
|
28
|
+
* getters.
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
export function formatDateControlValue(control) {
|
|
32
|
+
if (!control.data)
|
|
33
|
+
return '';
|
|
34
|
+
const type = typeSwitch(control);
|
|
35
|
+
const date = new Date(control.data);
|
|
36
|
+
const padded = (dateComponent) => dateComponent.toString().padStart(2, '0');
|
|
37
|
+
const isDateOnly = type !== 'datetime-local';
|
|
38
|
+
const year = isDateOnly ? date.getUTCFullYear() : date.getFullYear();
|
|
39
|
+
const month = padded((isDateOnly ? date.getUTCMonth() : date.getMonth()) + 1);
|
|
40
|
+
const day = padded(isDateOnly ? date.getUTCDate() : date.getDate());
|
|
41
|
+
const hour = padded(date.getHours());
|
|
42
|
+
const minute = padded(date.getMinutes());
|
|
43
|
+
return `${year}-${month}-${day}` + (type === 'datetime-local' ? `T${hour}:${minute}` : '');
|
|
44
|
+
}
|
|
20
45
|
export const DateControlRendererTemplate = (prefix = 'zero') => html `
|
|
21
46
|
<template>
|
|
22
47
|
${controlWrapperTemplate({
|
|
23
48
|
prefix,
|
|
24
49
|
innerTemplate: html `
|
|
25
50
|
<${prefix}-text-field
|
|
26
|
-
:value=${(x) =>
|
|
27
|
-
if (!x.control.data)
|
|
28
|
-
return '';
|
|
29
|
-
const type = typeSwitch(x.control);
|
|
30
|
-
const date = new Date(x.control.data);
|
|
31
|
-
const padded = (dateComponent) => dateComponent.toString().padStart(2, '0');
|
|
32
|
-
const year = date.getFullYear();
|
|
33
|
-
const month = padded(date.getMonth() + 1);
|
|
34
|
-
const day = padded(date.getDate());
|
|
35
|
-
const hour = padded(date.getHours());
|
|
36
|
-
const minute = padded(date.getMinutes());
|
|
37
|
-
return (`${year}-${month}-${day}` + (type === 'datetime-local' ? `T${hour}:${minute}` : ''));
|
|
38
|
-
}}
|
|
51
|
+
:value=${(x) => formatDateControlValue(x.control)}
|
|
39
52
|
id=${(x) => x.control.path}
|
|
40
53
|
type="${(x) => typeSwitch(x.control)}"
|
|
41
54
|
data-test-id=${(x) => x.control.path}
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
2
|
import { getDatasource } from '@genesislcap/foundation-comms';
|
|
3
3
|
import { CriteriaBuilder, ExpressionBuilder } from '@genesislcap/foundation-criteria';
|
|
4
|
-
import { toIntlNumberFormat } from '@genesislcap/foundation-ui';
|
|
5
|
-
import { getDateFormatter } from '@genesislcap/foundation-utils';
|
|
6
4
|
import { capitalCase } from 'change-case';
|
|
7
|
-
import { isOneOfDate } from '../jsonforms/testers/isDate';
|
|
8
|
-
import { isBigDecimal, isOneOfNumber } from '../jsonforms/testers/isOneOfNumber';
|
|
9
|
-
import { GenesisType } from './types';
|
|
10
5
|
/**
|
|
11
6
|
* Builds the review panel's fields grouped into sections by their nearest `Group` layout.
|
|
12
7
|
* Sections are formed from consecutive runs of the same group title as fields are
|
|
@@ -44,8 +39,8 @@ export function buildReviewSections(data, uiSchema, schema) {
|
|
|
44
39
|
}
|
|
45
40
|
};
|
|
46
41
|
const resolveDisplayValue = (raw, fieldName, options) => __awaiter(this, void 0, void 0, function* () {
|
|
47
|
-
var _a, _b, _c
|
|
48
|
-
const displayValue = (
|
|
42
|
+
var _a, _b, _c;
|
|
43
|
+
const displayValue = (_c = (_b = (_a = resolveOptionLabel(raw, options)) !== null && _a !== void 0 ? _a : (yield resolveResourceOptionLabel(raw, options))) !== null && _b !== void 0 ? _b : resolveEnumLabel(raw, fieldName, schema)) !== null && _c !== void 0 ? _c : raw;
|
|
49
44
|
return formatValueForReview(displayValue);
|
|
50
45
|
});
|
|
51
46
|
const collect = (element, groupTitle) => {
|
|
@@ -175,161 +170,24 @@ export function resolveResourceOptionLabel(raw, options) {
|
|
|
175
170
|
* @internal
|
|
176
171
|
*/
|
|
177
172
|
export function resolveEnumLabel(raw, fieldName, schema) {
|
|
178
|
-
var _a, _b, _c;
|
|
173
|
+
var _a, _b, _c, _d;
|
|
179
174
|
if (typeof raw !== 'string')
|
|
180
175
|
return null;
|
|
181
|
-
const fieldSchema = resolveFieldSchema(fieldName, schema);
|
|
182
|
-
if (!fieldSchema)
|
|
183
|
-
return null;
|
|
184
|
-
// Matches plain `enum: [...]` or nullable `oneOf: [{ enum: [...] }, { type: 'null' }]`
|
|
185
|
-
const enumValues = (_a = fieldSchema.enum) !== null && _a !== void 0 ? _a : (_c = (_b = fieldSchema.oneOf) === null || _b === void 0 ? void 0 : _b.find((x) => x.enum)) === null || _c === void 0 ? void 0 : _c.enum;
|
|
186
|
-
if (Array.isArray(enumValues) && enumValues.includes(raw)) {
|
|
187
|
-
return capitalCase(raw);
|
|
188
|
-
}
|
|
189
|
-
return null;
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Navigates a `/properties/`-separated field name through `schema.properties` to find the
|
|
193
|
-
* JSON schema describing that field, honoring nested Group scopes
|
|
194
|
-
* (`ADDRESS/properties/STREET`). Returns `null` when `schema` has no `properties` (e.g. no
|
|
195
|
-
* JSON schema is available) or the path doesn't resolve.
|
|
196
|
-
* @internal
|
|
197
|
-
*/
|
|
198
|
-
function resolveFieldSchema(fieldName, schema) {
|
|
199
|
-
var _a;
|
|
200
176
|
if (!(schema === null || schema === void 0 ? void 0 : schema.properties))
|
|
201
177
|
return null;
|
|
202
178
|
let fieldSchema = schema;
|
|
203
179
|
for (const part of fieldName.split('/properties/')) {
|
|
204
180
|
fieldSchema = (_a = fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema.properties) === null || _a === void 0 ? void 0 : _a[part];
|
|
205
181
|
}
|
|
206
|
-
return fieldSchema !== null && fieldSchema !== void 0 ? fieldSchema : null;
|
|
207
|
-
}
|
|
208
|
-
/** Minimal `Control` uischema used to drive the `isOneOfNumber`/`isOneOfDate` testers directly
|
|
209
|
-
* against an already-resolved field schema — `schemaMatches` only needs `scope` to be a
|
|
210
|
-
* non-empty string here, since a non-object field schema is tested as-is rather than resolved
|
|
211
|
-
* further via that scope. @internal */
|
|
212
|
-
const FIELD_SCHEMA_TESTER_CONTROL = { type: 'Control', scope: '#' };
|
|
213
|
-
const FIELD_SCHEMA_TESTER_CONTEXT = { config: {}, rootSchema: {} };
|
|
214
|
-
/** Matches `NumberControlRenderer`'s own `defaultOptions`, used whenever the uischema doesn't
|
|
215
|
-
* set `options.formatOptions`. */
|
|
216
|
-
const REVIEW_NUMBER_OPTIONS = {
|
|
217
|
-
maximumFractionDigits: 3,
|
|
218
|
-
minimumFractionDigits: 0,
|
|
219
|
-
};
|
|
220
|
-
/** `NumberField`'s own hardcoded default (`number-field.ts`) — `NumberControlRenderer` never
|
|
221
|
-
* forwards a `locale` from uischema options to the control, so every number field renders in
|
|
222
|
-
* this locale regardless of the user's browser locale. Matching it here (rather than e.g. the
|
|
223
|
-
* date branch's browser-locale resolution) is what "shows the same thing as the field" means
|
|
224
|
-
* for numbers specifically. */
|
|
225
|
-
const NUMBER_FIELD_DEFAULT_LOCALE = 'en-US';
|
|
226
|
-
/** Plain decimal or scientific notation only — matches what `Number()`/`Intl.NumberFormat`
|
|
227
|
-
* parse correctly. Excludes anything else (ids, free text) that a BigDecimal-described schema
|
|
228
|
-
* might still carry as bad data. */
|
|
229
|
-
const NUMERIC_STRING = /^-?\d+(\.\d+)?([eE][+-]?\d+)?$/;
|
|
230
|
-
// No `timeZone` override: `DateControlRenderer` builds its `<input>` value from
|
|
231
|
-
// `new Date(x.control.data)`'s local getters (`getFullYear`/`getMonth`/`getDate`/...), so
|
|
232
|
-
// formatting here must default to the runtime's local time zone too, or the review panel
|
|
233
|
-
// disagrees with the field the user just filled in for anyone not in UTC.
|
|
234
|
-
const REVIEW_DATE_OPTIONS = {
|
|
235
|
-
year: 'numeric',
|
|
236
|
-
month: '2-digit',
|
|
237
|
-
day: '2-digit',
|
|
238
|
-
};
|
|
239
|
-
const REVIEW_DATETIME_OPTIONS = Object.assign(Object.assign({}, REVIEW_DATE_OPTIONS), { hour: '2-digit', minute: '2-digit' });
|
|
240
|
-
/**
|
|
241
|
-
* The runtime's default `Intl` locale — the same one `Intl.DateTimeFormat(undefined, ...)`
|
|
242
|
-
* (and, in a browser, `<input type="date">`'s native rendering) resolves to. `getDateFormatter`
|
|
243
|
-
* defaults to a hardcoded `en-GB` when passed `undefined`, which would pin review to
|
|
244
|
-
* DD/MM/YYYY regardless of what locale the field actually renders in for the user.
|
|
245
|
-
* @internal
|
|
246
|
-
*/
|
|
247
|
-
function resolveDefaultLocale() {
|
|
248
|
-
return new Intl.DateTimeFormat().resolvedOptions().locale;
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* Formats a raw value for the review panel by the same renderer type
|
|
252
|
-
* (`NumberControlRenderer`/`DateControlRenderer`) the form would use for this field. Numbers
|
|
253
|
-
* are formatted with `toIntlNumberFormat` (the same precision-safe path `NumberField` itself
|
|
254
|
-
* uses); dates/datetimes with `getDateFormatter`, adding hours/minutes for `GenesisType.DATETIME`
|
|
255
|
-
* fields. Returns `null` for non-number/date fields, or when no JSON schema is available to
|
|
256
|
-
* determine the field's type.
|
|
257
|
-
*
|
|
258
|
-
* `uischemaOptions` (the Control element's `options`, as passed to `resolveOptionLabel` etc.)
|
|
259
|
-
* carries the same display-affecting settings `NumberControlRenderer` reads directly —
|
|
260
|
-
* `formatOptions`, `withoutFormatting`, `prefix`, `suffix` — so a field configured with e.g.
|
|
261
|
-
* `withoutFormatting: true` or a custom `formatOptions.maximumFractionDigits` doesn't disagree
|
|
262
|
-
* with review over how many digits it shows.
|
|
263
|
-
*
|
|
264
|
-
* A `raw` array against an array-typed field schema (`{ type: 'array', items: {...} }`, per
|
|
265
|
-
* `isArray`'s convention) formats each element against `items` individually — e.g. an array of
|
|
266
|
-
* DATE values — falling back to the unformatted element for any that don't format, so
|
|
267
|
-
* `formatValueForReview`'s comma-join still sees a flat array of primitives. `uischemaOptions`
|
|
268
|
-
* applies to every element, matching how one Control renders every item in the array.
|
|
269
|
-
* @internal
|
|
270
|
-
*/
|
|
271
|
-
export function formatValueByFieldType(raw, fieldName, schema, uischemaOptions) {
|
|
272
|
-
const fieldSchema = resolveFieldSchema(fieldName, schema);
|
|
273
|
-
if (!fieldSchema)
|
|
274
|
-
return null;
|
|
275
|
-
if (Array.isArray(raw) && fieldSchema.items) {
|
|
276
|
-
return raw.map((item) => { var _a; return (_a = formatScalarByFieldSchema(item, fieldSchema.items, uischemaOptions)) !== null && _a !== void 0 ? _a : item; });
|
|
277
|
-
}
|
|
278
|
-
return formatScalarByFieldSchema(raw, fieldSchema, uischemaOptions);
|
|
279
|
-
}
|
|
280
|
-
/** Formats a single value against an already-resolved (non-array) field schema. @internal */
|
|
281
|
-
function formatScalarByFieldSchema(raw, fieldSchema, uischemaOptions) {
|
|
282
|
-
var _a, _b;
|
|
283
182
|
if (!fieldSchema)
|
|
284
183
|
return null;
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
if (!raw)
|
|
290
|
-
return null;
|
|
291
|
-
// Mirrors typeSwitch's exact control flow (DateControlRenderer.ts), which short-circuits
|
|
292
|
-
// on `hasOwnProperty('oneOf')`: once `oneOf` is present it ONLY looks at branch-level
|
|
293
|
-
// `genesisType`, ignoring the field's own top-level `genesisType` entirely — it is not an
|
|
294
|
-
// OR of both. That matters because the server's actual nullable-field shape (see
|
|
295
|
-
// foundation-utils' `ORDER_DATETIME` fixture) puts `genesisType: 'DATETIME'` at the top
|
|
296
|
-
// level with bare, typeless `oneOf` branches — which typeSwitch (and so this) resolves to
|
|
297
|
-
// date-only, not datetime.
|
|
298
|
-
const isDatetime = fieldSchema.hasOwnProperty('oneOf')
|
|
299
|
-
? fieldSchema.oneOf.some((branch) => branch.genesisType === GenesisType.DATETIME)
|
|
300
|
-
: fieldSchema.genesisType === GenesisType.DATETIME;
|
|
301
|
-
const formatted = getDateFormatter(resolveDefaultLocale(), isDatetime ? REVIEW_DATETIME_OPTIONS : REVIEW_DATE_OPTIONS)({ value: raw });
|
|
302
|
-
return formatted || null;
|
|
303
|
-
}
|
|
304
|
-
if (isOneOfNumber(FIELD_SCHEMA_TESTER_CONTROL, fieldSchema, FIELD_SCHEMA_TESTER_CONTEXT)) {
|
|
305
|
-
const isBigDecimalField = isBigDecimal(fieldSchema) ||
|
|
306
|
-
((_a = fieldSchema.oneOf) === null || _a === void 0 ? void 0 : _a.some((branch) => isBigDecimal(branch)));
|
|
307
|
-
// BigDecimals arrive as strings and can carry Java's `toString()` scientific notation
|
|
308
|
-
// (e.g. `1E-7`) — guard against that (and other non-numeric bad data) up front, same as
|
|
309
|
-
// before, rather than handing it to `Intl`/`Number()` and rendering "NaN".
|
|
310
|
-
if (isBigDecimalField && (typeof raw !== 'string' || !NUMERIC_STRING.test(raw))) {
|
|
311
|
-
return null;
|
|
312
|
-
}
|
|
313
|
-
const withoutFormatting = !!(uischemaOptions === null || uischemaOptions === void 0 ? void 0 : uischemaOptions.withoutFormatting);
|
|
314
|
-
const formatOptions = (_b = uischemaOptions === null || uischemaOptions === void 0 ? void 0 : uischemaOptions.formatOptions) !== null && _b !== void 0 ? _b : REVIEW_NUMBER_OPTIONS;
|
|
315
|
-
// `NumberField`'s `value` is always a string internally, and `withFormatting: false` shows
|
|
316
|
-
// it completely unformatted (no grouping, no fraction-digit rounding) — matching that here
|
|
317
|
-
// means skipping `toIntlNumberFormat` entirely rather than applying it and stripping commas
|
|
318
|
-
// back out.
|
|
319
|
-
const core = withoutFormatting
|
|
320
|
-
? String(raw)
|
|
321
|
-
: toIntlNumberFormat(String(raw), NUMBER_FIELD_DEFAULT_LOCALE, formatOptions);
|
|
322
|
-
if (!core)
|
|
323
|
-
return null;
|
|
324
|
-
return applyAffixes(core, uischemaOptions);
|
|
184
|
+
// Matches plain `enum: [...]` or nullable `oneOf: [{ enum: [...] }, { type: 'null' }]`
|
|
185
|
+
const enumValues = (_b = fieldSchema.enum) !== null && _b !== void 0 ? _b : (_d = (_c = fieldSchema.oneOf) === null || _c === void 0 ? void 0 : _c.find((x) => x.enum)) === null || _d === void 0 ? void 0 : _d.enum;
|
|
186
|
+
if (Array.isArray(enumValues) && enumValues.includes(raw)) {
|
|
187
|
+
return capitalCase(raw);
|
|
325
188
|
}
|
|
326
189
|
return null;
|
|
327
190
|
}
|
|
328
|
-
/** Wraps a formatted value with `options.prefix`/`options.suffix`, matching the affix text
|
|
329
|
-
* `AffixMixin` (shared by `NumberField`/`TextField`) renders alongside the control. @internal */
|
|
330
|
-
function applyAffixes(value, options) {
|
|
331
|
-
return [options === null || options === void 0 ? void 0 : options.prefix, value, options === null || options === void 0 ? void 0 : options.suffix].filter(Boolean).join(' ');
|
|
332
|
-
}
|
|
333
191
|
/**
|
|
334
192
|
* Navigates a `/properties/`-separated path in data to support nested object scopes
|
|
335
193
|
* such as `ADDRESS/properties/STREET` produced by Group layout UI schemas.
|
|
@@ -1970,29 +1970,6 @@ declare const Form_base: (new (...args: any[]) => {
|
|
|
1970
1970
|
focus(options?: FocusOptions): void;
|
|
1971
1971
|
}) & typeof FoundationElement;
|
|
1972
1972
|
|
|
1973
|
-
/**
|
|
1974
|
-
* Formats a raw value for the review panel by the same renderer type
|
|
1975
|
-
* (`NumberControlRenderer`/`DateControlRenderer`) the form would use for this field. Numbers
|
|
1976
|
-
* are formatted with `toIntlNumberFormat` (the same precision-safe path `NumberField` itself
|
|
1977
|
-
* uses); dates/datetimes with `getDateFormatter`, adding hours/minutes for `GenesisType.DATETIME`
|
|
1978
|
-
* fields. Returns `null` for non-number/date fields, or when no JSON schema is available to
|
|
1979
|
-
* determine the field's type.
|
|
1980
|
-
*
|
|
1981
|
-
* `uischemaOptions` (the Control element's `options`, as passed to `resolveOptionLabel` etc.)
|
|
1982
|
-
* carries the same display-affecting settings `NumberControlRenderer` reads directly —
|
|
1983
|
-
* `formatOptions`, `withoutFormatting`, `prefix`, `suffix` — so a field configured with e.g.
|
|
1984
|
-
* `withoutFormatting: true` or a custom `formatOptions.maximumFractionDigits` doesn't disagree
|
|
1985
|
-
* with review over how many digits it shows.
|
|
1986
|
-
*
|
|
1987
|
-
* A `raw` array against an array-typed field schema (`{ type: 'array', items: {...} }`, per
|
|
1988
|
-
* `isArray`'s convention) formats each element against `items` individually — e.g. an array of
|
|
1989
|
-
* DATE values — falling back to the unformatted element for any that don't format, so
|
|
1990
|
-
* `formatValueForReview`'s comma-join still sees a flat array of primitives. `uischemaOptions`
|
|
1991
|
-
* applies to every element, matching how one Control renders every item in the array.
|
|
1992
|
-
* @internal
|
|
1993
|
-
*/
|
|
1994
|
-
export declare function formatValueByFieldType(raw: any, fieldName: string, schema: any, uischemaOptions?: any): string | unknown[] | null;
|
|
1995
|
-
|
|
1996
1973
|
/**
|
|
1997
1974
|
* Converts a raw field value to a display string for the review panel.
|
|
1998
1975
|
* Arrays of primitives are comma-joined; arrays of objects and plain objects
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/foundation-forms",
|
|
3
3
|
"description": "Genesis Foundation Forms",
|
|
4
|
-
"version": "15.3.2-FUI-
|
|
4
|
+
"version": "15.3.2-FUI-2591.1",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -59,13 +59,13 @@
|
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@genesislcap/foundation-testing": "15.3.2-FUI-
|
|
63
|
-
"@genesislcap/genx": "15.3.2-FUI-
|
|
64
|
-
"@genesislcap/rollup-builder": "15.3.2-FUI-
|
|
65
|
-
"@genesislcap/ts-builder": "15.3.2-FUI-
|
|
66
|
-
"@genesislcap/uvu-playwright-builder": "15.3.2-FUI-
|
|
67
|
-
"@genesislcap/vite-builder": "15.3.2-FUI-
|
|
68
|
-
"@genesislcap/webpack-builder": "15.3.2-FUI-
|
|
62
|
+
"@genesislcap/foundation-testing": "15.3.2-FUI-2591.1",
|
|
63
|
+
"@genesislcap/genx": "15.3.2-FUI-2591.1",
|
|
64
|
+
"@genesislcap/rollup-builder": "15.3.2-FUI-2591.1",
|
|
65
|
+
"@genesislcap/ts-builder": "15.3.2-FUI-2591.1",
|
|
66
|
+
"@genesislcap/uvu-playwright-builder": "15.3.2-FUI-2591.1",
|
|
67
|
+
"@genesislcap/vite-builder": "15.3.2-FUI-2591.1",
|
|
68
|
+
"@genesislcap/webpack-builder": "15.3.2-FUI-2591.1",
|
|
69
69
|
"@types/json-schema": "^7.0.11",
|
|
70
70
|
"@types/papaparse": "^5.3.14"
|
|
71
71
|
},
|
|
@@ -82,12 +82,12 @@
|
|
|
82
82
|
}
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
|
-
"@genesislcap/foundation-comms": "15.3.2-FUI-
|
|
86
|
-
"@genesislcap/foundation-criteria": "15.3.2-FUI-
|
|
87
|
-
"@genesislcap/foundation-logger": "15.3.2-FUI-
|
|
88
|
-
"@genesislcap/foundation-notifications": "15.3.2-FUI-
|
|
89
|
-
"@genesislcap/foundation-ui": "15.3.2-FUI-
|
|
90
|
-
"@genesislcap/foundation-utils": "15.3.2-FUI-
|
|
85
|
+
"@genesislcap/foundation-comms": "15.3.2-FUI-2591.1",
|
|
86
|
+
"@genesislcap/foundation-criteria": "15.3.2-FUI-2591.1",
|
|
87
|
+
"@genesislcap/foundation-logger": "15.3.2-FUI-2591.1",
|
|
88
|
+
"@genesislcap/foundation-notifications": "15.3.2-FUI-2591.1",
|
|
89
|
+
"@genesislcap/foundation-ui": "15.3.2-FUI-2591.1",
|
|
90
|
+
"@genesislcap/foundation-utils": "15.3.2-FUI-2591.1",
|
|
91
91
|
"@json-schema-tools/dereferencer": "^1.6.1",
|
|
92
92
|
"@jsonforms/core": "^3.2.1",
|
|
93
93
|
"@microsoft/fast-components": "2.30.6",
|
|
@@ -109,5 +109,5 @@
|
|
|
109
109
|
"access": "public"
|
|
110
110
|
},
|
|
111
111
|
"customElements": "dist/custom-elements.json",
|
|
112
|
-
"gitHead": "
|
|
112
|
+
"gitHead": "36595b8ce13d31fda4bb2638948c78931133159a"
|
|
113
113
|
}
|