@abgov/jsonforms-components 2.66.3 → 2.67.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/index.esm.js +265 -137
- package/package.json +1 -1
- package/renderer-catalog.json +2 -2
- package/src/lib/Controls/FormStepper/context/StepperContext.d.ts +3 -0
- package/src/lib/Controls/Inputs/style-component.d.ts +1 -0
- package/src/lib/Controls/ObjectArray/ObjectListControlUtils.d.ts +1 -0
- package/src/lib/util/autoPopulate.d.ts +29 -41
- package/src/lib/util/registerOptions.d.ts +3 -0
package/index.esm.js
CHANGED
|
@@ -6,7 +6,7 @@ import Ajv from 'ajv';
|
|
|
6
6
|
import styled from 'styled-components';
|
|
7
7
|
import axios from 'axios';
|
|
8
8
|
import get$1 from 'lodash/get';
|
|
9
|
-
import { isVisible, isEnabled, deriveLabelForUISchemaElement, rankWith, isStringControl, and, optionIs, isDateControl, isNumberControl, isIntegerControl, isDateTimeControl, isTimeControl, uiTypeIs, isControl as isControl$1, isEnumControl, or, isOneOfEnumControl, isBooleanControl, createDefaultValue, Paths, Resolve, toDataPath, schemaTypeIs, formatIs, getAjv, schemaMatches, isObjectArrayControl, isPrimitiveArrayControl, composePaths, hasType, isCategorization, isLayout } from '@jsonforms/core';
|
|
9
|
+
import { isVisible, isEnabled, deriveLabelForUISchemaElement, rankWith, isStringControl, and, optionIs, isDateControl, isNumberControl, isIntegerControl, isDateTimeControl, isTimeControl, uiTypeIs, isControl as isControl$1, isEnumControl, or, isOneOfEnumControl, isBooleanControl, createDefaultValue, Paths, Resolve, toDataPath, schemaTypeIs, formatIs, getAjv, schemaMatches, isObjectArrayControl, isPrimitiveArrayControl, composePaths, hasType, isCategorization, isLayout, INIT, UPDATE_CORE } from '@jsonforms/core';
|
|
10
10
|
import * as _$c from 'lodash';
|
|
11
11
|
import ___default, { isObject as isObject$i, isEmpty as isEmpty$1 } from 'lodash';
|
|
12
12
|
import { useJsonForms, withJsonFormsControlProps, withJsonFormsEnumProps, withTranslateProps, JsonFormsDispatch, withJsonFormsAllOfProps, withJsonFormsArrayLayoutProps, withJsonFormsLayoutProps, withJsonFormsCellProps } from '@jsonforms/react';
|
|
@@ -4103,7 +4103,7 @@ const onKeyPressForTimeControl = props => {
|
|
|
4103
4103
|
path
|
|
4104
4104
|
} = controlProps;
|
|
4105
4105
|
if (isNotKeyPressTabOrShift(key)) {
|
|
4106
|
-
handleChange(path, value
|
|
4106
|
+
handleChange(path, value);
|
|
4107
4107
|
}
|
|
4108
4108
|
};
|
|
4109
4109
|
/**
|
|
@@ -4124,7 +4124,7 @@ const onKeyPressForDateControl = props => {
|
|
|
4124
4124
|
} = controlProps;
|
|
4125
4125
|
if (isNotKeyPressTabOrShift(key)) {
|
|
4126
4126
|
value = standardizeDate(value) || '';
|
|
4127
|
-
handleChange(path, value
|
|
4127
|
+
handleChange(path, value);
|
|
4128
4128
|
}
|
|
4129
4129
|
};
|
|
4130
4130
|
/**
|
|
@@ -4141,7 +4141,7 @@ const onBlurForTextControl = props => {
|
|
|
4141
4141
|
path
|
|
4142
4142
|
} = controlProps;
|
|
4143
4143
|
if (isRequiredAndHasNoData(controlProps)) {
|
|
4144
|
-
handleChange(path, value
|
|
4144
|
+
handleChange(path, value);
|
|
4145
4145
|
}
|
|
4146
4146
|
};
|
|
4147
4147
|
/**
|
|
@@ -4182,7 +4182,7 @@ const onBlurForDateControl = props => {
|
|
|
4182
4182
|
} = controlProps;
|
|
4183
4183
|
if (isRequiredAndHasNoData(controlProps)) {
|
|
4184
4184
|
value = standardizeDate(value) || '';
|
|
4185
|
-
handleChange(path, value
|
|
4185
|
+
handleChange(path, value);
|
|
4186
4186
|
}
|
|
4187
4187
|
};
|
|
4188
4188
|
/**
|
|
@@ -4204,7 +4204,7 @@ const onChangeForDateControl = props => {
|
|
|
4204
4204
|
if (value && value !== null) {
|
|
4205
4205
|
value = standardizeDate(value) || '';
|
|
4206
4206
|
if (value !== data) {
|
|
4207
|
-
handleChange(path, value
|
|
4207
|
+
handleChange(path, value);
|
|
4208
4208
|
}
|
|
4209
4209
|
}
|
|
4210
4210
|
};
|
|
@@ -4223,7 +4223,7 @@ const onChangeForInputControl = props => {
|
|
|
4223
4223
|
handleChange,
|
|
4224
4224
|
path
|
|
4225
4225
|
} = controlProps;
|
|
4226
|
-
handleChange(path, value
|
|
4226
|
+
handleChange(path, value);
|
|
4227
4227
|
};
|
|
4228
4228
|
/**
|
|
4229
4229
|
* Helper function to process onChange event for Date controls.
|
|
@@ -4245,19 +4245,23 @@ const onChangeForDateTimeControl = props => {
|
|
|
4245
4245
|
var _Date;
|
|
4246
4246
|
value = isValidDate(value) ? (_Date = new Date(value)) == null ? void 0 : _Date.toISOString() : '';
|
|
4247
4247
|
if (data !== value) {
|
|
4248
|
-
handleChange(path, value
|
|
4248
|
+
handleChange(path, value);
|
|
4249
4249
|
}
|
|
4250
4250
|
}
|
|
4251
4251
|
};
|
|
4252
|
+
const toNumericControlValue = value => {
|
|
4253
|
+
if (value === '' || value === null || value === undefined || value instanceof Date) {
|
|
4254
|
+
return undefined;
|
|
4255
|
+
}
|
|
4256
|
+
return +value;
|
|
4257
|
+
};
|
|
4252
4258
|
/**
|
|
4253
4259
|
* Helper function to process onChange event for Number/Integer controls.
|
|
4254
4260
|
* @param props - EventChangeControlProps
|
|
4255
4261
|
*/
|
|
4256
4262
|
const onChangeForNumericControl = props => {
|
|
4257
4263
|
const {
|
|
4258
|
-
value
|
|
4259
|
-
} = props;
|
|
4260
|
-
const {
|
|
4264
|
+
value,
|
|
4261
4265
|
controlProps
|
|
4262
4266
|
} = props;
|
|
4263
4267
|
const {
|
|
@@ -4265,18 +4269,9 @@ const onChangeForNumericControl = props => {
|
|
|
4265
4269
|
path,
|
|
4266
4270
|
data
|
|
4267
4271
|
} = controlProps;
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
if (data !== +value) {
|
|
4272
|
-
let newValue = undefined;
|
|
4273
|
-
if (value !== '') {
|
|
4274
|
-
newValue = +value;
|
|
4275
|
-
}
|
|
4276
|
-
handleChange(path, newValue);
|
|
4277
|
-
}
|
|
4278
|
-
} else {
|
|
4279
|
-
handleChange(path, value === '' ? undefined : value);
|
|
4272
|
+
const newValue = toNumericControlValue(value);
|
|
4273
|
+
if (data !== newValue) {
|
|
4274
|
+
handleChange(path, newValue);
|
|
4280
4275
|
}
|
|
4281
4276
|
};
|
|
4282
4277
|
const ensureGoaDatePointerCursor = host => {
|
|
@@ -4425,8 +4420,8 @@ if ($stringify) {
|
|
|
4425
4420
|
});
|
|
4426
4421
|
}
|
|
4427
4422
|
|
|
4428
|
-
const defineFields
|
|
4429
|
-
const OPTION_DEFINITIONS = defineFields
|
|
4423
|
+
const defineFields = fields => fields;
|
|
4424
|
+
const OPTION_DEFINITIONS = defineFields({
|
|
4430
4425
|
mainTitle: {
|
|
4431
4426
|
schema: 'Main form title'
|
|
4432
4427
|
},
|
|
@@ -4442,6 +4437,9 @@ const OPTION_DEFINITIONS = defineFields$1({
|
|
|
4442
4437
|
emailFirst: {
|
|
4443
4438
|
schema: true
|
|
4444
4439
|
},
|
|
4440
|
+
autoPopulate: {
|
|
4441
|
+
schema: 'firstName'
|
|
4442
|
+
},
|
|
4445
4443
|
noDataMessage: {
|
|
4446
4444
|
schema: 'no data'
|
|
4447
4445
|
},
|
|
@@ -5910,7 +5908,8 @@ let _$a = t => t,
|
|
|
5910
5908
|
_t0$2,
|
|
5911
5909
|
_t1$2,
|
|
5912
5910
|
_t10$2,
|
|
5913
|
-
_t11$2
|
|
5911
|
+
_t11$2,
|
|
5912
|
+
_t12$2;
|
|
5914
5913
|
const FormFieldWrapper$1 = styled.div(_t$b || (_t$b = _$a`
|
|
5915
5914
|
margin-bottom: var(--goa-space-l);
|
|
5916
5915
|
`));
|
|
@@ -5973,11 +5972,17 @@ const NoneGivenText = styled.span(_t1$2 || (_t1$2 = _$a`
|
|
|
5973
5972
|
color: var(--goa-color-greyscale-700);
|
|
5974
5973
|
font-style: italic;
|
|
5975
5974
|
`));
|
|
5976
|
-
styled.
|
|
5975
|
+
const NoneGivenTableText = styled.span(_t10$2 || (_t10$2 = _$a`
|
|
5976
|
+
padding-top: var(--goa-space-l);
|
|
5977
|
+
padding-left: var(--goa-space-m);
|
|
5978
|
+
color: var(--goa-color-greyscale-700);
|
|
5979
|
+
font-style: italic;
|
|
5980
|
+
`));
|
|
5981
|
+
styled.h4(_t11$2 || (_t11$2 = _$a`
|
|
5977
5982
|
margin: 0 0 0.25rem 0;
|
|
5978
5983
|
fontsize: larger;
|
|
5979
5984
|
`));
|
|
5980
|
-
styled.h4(
|
|
5985
|
+
styled.h4(_t12$2 || (_t12$2 = _$a`
|
|
5981
5986
|
border-bottom: 1px solid #ddd;
|
|
5982
5987
|
`));
|
|
5983
5988
|
|
|
@@ -6852,6 +6857,9 @@ const createStepperContextInitData = props => {
|
|
|
6852
6857
|
};
|
|
6853
6858
|
};
|
|
6854
6859
|
const JsonFormsStepperContext = /*#__PURE__*/createContext(undefined);
|
|
6860
|
+
const isFormValid = (ajvValid, emptyRequiredStringErrors) => {
|
|
6861
|
+
return ajvValid && emptyRequiredStringErrors.length === 0;
|
|
6862
|
+
};
|
|
6855
6863
|
const JsonFormsStepperContextProvider = ({
|
|
6856
6864
|
children,
|
|
6857
6865
|
StepperProps
|
|
@@ -6888,6 +6896,8 @@ const JsonFormsStepperContextProvider = ({
|
|
|
6888
6896
|
stepperDispatch,
|
|
6889
6897
|
selectStepperState: () => {
|
|
6890
6898
|
var _stepperState$categor;
|
|
6899
|
+
const emptyRequiredStringErrors = getEmptyRequiredStringErrors(data || {}, schema);
|
|
6900
|
+
stepperState.isValid = isFormValid(stepperState.isValid, emptyRequiredStringErrors);
|
|
6891
6901
|
return Object.assign({}, stepperState, {
|
|
6892
6902
|
categories: (_stepperState$categor = stepperState.categories) == null ? void 0 : _stepperState$categor.map(c => {
|
|
6893
6903
|
return Object.assign({}, c, {
|
|
@@ -7002,6 +7012,58 @@ const JsonFormsStepperContextProvider = ({
|
|
|
7002
7012
|
children: children
|
|
7003
7013
|
});
|
|
7004
7014
|
};
|
|
7015
|
+
const isSchemaObject = schema => {
|
|
7016
|
+
return !!schema && typeof schema === 'object' && !Array.isArray(schema);
|
|
7017
|
+
};
|
|
7018
|
+
const getObjectData = data => {
|
|
7019
|
+
return data && typeof data === 'object' && !Array.isArray(data) ? data : {};
|
|
7020
|
+
};
|
|
7021
|
+
const isRequiredStringSchema = schema => {
|
|
7022
|
+
return isSchemaObject(schema) && schema.type === 'string';
|
|
7023
|
+
};
|
|
7024
|
+
const createRequiredStringError = (schema, propertyName, instancePath, schemaPath) => ({
|
|
7025
|
+
instancePath: `${instancePath}/${propertyName}`,
|
|
7026
|
+
schemaPath: `${schemaPath}/requiredString`,
|
|
7027
|
+
keyword: 'requiredString',
|
|
7028
|
+
params: {
|
|
7029
|
+
propertyName
|
|
7030
|
+
},
|
|
7031
|
+
message: 'is required',
|
|
7032
|
+
schema: true,
|
|
7033
|
+
parentSchema: schema,
|
|
7034
|
+
data: ''
|
|
7035
|
+
});
|
|
7036
|
+
const addEmptyRequiredStringErrors = (data, schema, instancePath, schemaPath, errors) => {
|
|
7037
|
+
var _schema$required, _schema$properties;
|
|
7038
|
+
const required = (_schema$required = schema.required) != null ? _schema$required : [];
|
|
7039
|
+
const properties = (_schema$properties = schema.properties) != null ? _schema$properties : {};
|
|
7040
|
+
for (const propertyName of required) {
|
|
7041
|
+
const propertySchema = properties[propertyName];
|
|
7042
|
+
if (isRequiredStringSchema(propertySchema) && data[propertyName] === '') {
|
|
7043
|
+
errors.push(createRequiredStringError(schema, propertyName, instancePath, schemaPath));
|
|
7044
|
+
}
|
|
7045
|
+
}
|
|
7046
|
+
};
|
|
7047
|
+
const collectEmptyRequiredStringErrors = (data, schema, instancePath, schemaPath, errors) => {
|
|
7048
|
+
var _schema$properties2;
|
|
7049
|
+
if (!isSchemaObject(schema)) {
|
|
7050
|
+
return;
|
|
7051
|
+
}
|
|
7052
|
+
const objectData = getObjectData(data);
|
|
7053
|
+
const properties = (_schema$properties2 = schema.properties) != null ? _schema$properties2 : {};
|
|
7054
|
+
addEmptyRequiredStringErrors(objectData, schema, instancePath, schemaPath, errors);
|
|
7055
|
+
for (const [propertyName, propertySchema] of Object.entries(properties)) {
|
|
7056
|
+
if (!isSchemaObject(propertySchema)) {
|
|
7057
|
+
continue;
|
|
7058
|
+
}
|
|
7059
|
+
collectEmptyRequiredStringErrors(objectData[propertyName], propertySchema, `${instancePath}/${propertyName}`, `${schemaPath}/properties/${propertyName}`, errors);
|
|
7060
|
+
}
|
|
7061
|
+
};
|
|
7062
|
+
const getEmptyRequiredStringErrors = (data, schema) => {
|
|
7063
|
+
const errors = [];
|
|
7064
|
+
collectEmptyRequiredStringErrors(data, schema, '', '#', errors);
|
|
7065
|
+
return errors;
|
|
7066
|
+
};
|
|
7005
7067
|
|
|
7006
7068
|
const GoAInputBaseControl = props => {
|
|
7007
7069
|
var _stepperState$categor, _uischema$options$com, _uischema$options, _uischema$options2, _uischema$options3;
|
|
@@ -7295,7 +7357,6 @@ const InnerGoAInputText = props => {
|
|
|
7295
7357
|
isVisited,
|
|
7296
7358
|
setIsVisited
|
|
7297
7359
|
} = props;
|
|
7298
|
-
useRegisterUser();
|
|
7299
7360
|
const isSinField = schema.title === sinTitle;
|
|
7300
7361
|
const initialValue = isSinField && typeof data === 'string' ? formatSinForDisplay(data) : data;
|
|
7301
7362
|
const [manualInput, setManualInput] = useState(false);
|
|
@@ -10370,94 +10431,6 @@ fixRegExpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNa
|
|
|
10370
10431
|
];
|
|
10371
10432
|
}, BUGGY || !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC, UNSUPPORTED_Y);
|
|
10372
10433
|
|
|
10373
|
-
const defineFields = fields => fields;
|
|
10374
|
-
const autoLabel = name => `${name} (auto from user profile)`;
|
|
10375
|
-
const buildInsertText = (key, schema) => `${key}": ${JSON.stringify(schema, null, 2)}`;
|
|
10376
|
-
const getNameParts = user => {
|
|
10377
|
-
const [first = '', last = ''] = ((user == null ? void 0 : user.name) || '').split(' ');
|
|
10378
|
-
return {
|
|
10379
|
-
first,
|
|
10380
|
-
last
|
|
10381
|
-
};
|
|
10382
|
-
};
|
|
10383
|
-
const fullNameSchema = {
|
|
10384
|
-
type: 'string',
|
|
10385
|
-
minLength: 3,
|
|
10386
|
-
description: 'Please enter your full name'
|
|
10387
|
-
};
|
|
10388
|
-
const firstNameSchema = {
|
|
10389
|
-
type: 'string',
|
|
10390
|
-
minLength: 3,
|
|
10391
|
-
description: 'Please enter your first name'
|
|
10392
|
-
};
|
|
10393
|
-
const lastNameSchema = {
|
|
10394
|
-
type: 'string',
|
|
10395
|
-
minLength: 3,
|
|
10396
|
-
description: 'Please enter your last name'
|
|
10397
|
-
};
|
|
10398
|
-
const emailSchema = {
|
|
10399
|
-
type: 'string',
|
|
10400
|
-
format: 'email',
|
|
10401
|
-
maxLength: 100,
|
|
10402
|
-
pattern: '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\\\.[a-zA-Z]{2,}$',
|
|
10403
|
-
description: 'Please enter a valid email address (e.g., name@example.com).',
|
|
10404
|
-
errorMessage: {
|
|
10405
|
-
pattern: '(e.g., name@example.com).',
|
|
10406
|
-
maxLength: 'Email must be less than 100 characters.'
|
|
10407
|
-
}
|
|
10408
|
-
};
|
|
10409
|
-
const USER_FIELD_DEFINITIONS = defineFields({
|
|
10410
|
-
fullName: {
|
|
10411
|
-
schema: fullNameSchema,
|
|
10412
|
-
getValue: user => user == null ? void 0 : user.name
|
|
10413
|
-
},
|
|
10414
|
-
name: {
|
|
10415
|
-
schema: fullNameSchema,
|
|
10416
|
-
getValue: user => user == null ? void 0 : user.name
|
|
10417
|
-
},
|
|
10418
|
-
firstName: {
|
|
10419
|
-
schema: firstNameSchema,
|
|
10420
|
-
getValue: user => getNameParts(user).first
|
|
10421
|
-
},
|
|
10422
|
-
givenName: {
|
|
10423
|
-
schema: firstNameSchema,
|
|
10424
|
-
getValue: user => getNameParts(user).first
|
|
10425
|
-
},
|
|
10426
|
-
lastName: {
|
|
10427
|
-
schema: lastNameSchema,
|
|
10428
|
-
getValue: user => getNameParts(user).last
|
|
10429
|
-
},
|
|
10430
|
-
familyName: {
|
|
10431
|
-
schema: lastNameSchema,
|
|
10432
|
-
getValue: user => getNameParts(user).last
|
|
10433
|
-
},
|
|
10434
|
-
surname: {
|
|
10435
|
-
schema: lastNameSchema,
|
|
10436
|
-
getValue: user => getNameParts(user).last
|
|
10437
|
-
},
|
|
10438
|
-
email: {
|
|
10439
|
-
schema: emailSchema,
|
|
10440
|
-
getValue: user => (user == null ? void 0 : user.email) || ''
|
|
10441
|
-
},
|
|
10442
|
-
emailAddress: {
|
|
10443
|
-
schema: emailSchema,
|
|
10444
|
-
getValue: user => (user == null ? void 0 : user.email) || ''
|
|
10445
|
-
},
|
|
10446
|
-
primaryEmail: {
|
|
10447
|
-
schema: emailSchema,
|
|
10448
|
-
getValue: user => (user == null ? void 0 : user.email) || ''
|
|
10449
|
-
}
|
|
10450
|
-
});
|
|
10451
|
-
const autoPopulateValue = (user, props) => {
|
|
10452
|
-
const field = USER_FIELD_DEFINITIONS[props.path];
|
|
10453
|
-
if (!field) return undefined;
|
|
10454
|
-
return field.getValue(user);
|
|
10455
|
-
};
|
|
10456
|
-
const autoPopulatePropertiesMonaco = Object.entries(USER_FIELD_DEFINITIONS).map(([key, field]) => ({
|
|
10457
|
-
label: autoLabel(key),
|
|
10458
|
-
insertText: buildInsertText(key, field.schema)
|
|
10459
|
-
}));
|
|
10460
|
-
|
|
10461
10434
|
const defaultLabel = 'Email address';
|
|
10462
10435
|
const GoAEmailInput = props => {
|
|
10463
10436
|
var _uischema$options$com, _uischema$options, _uischema$options$com2, _uischema$options2, _stepperState$categor;
|
|
@@ -10478,13 +10451,18 @@ const GoAEmailInput = props => {
|
|
|
10478
10451
|
const appliedUiSchemaOptions = Object.assign({}, config, uischema == null ? void 0 : uischema.options);
|
|
10479
10452
|
const readOnly = (_uischema$options$com = uischema == null || (_uischema$options = uischema.options) == null || (_uischema$options = _uischema$options.componentProps) == null ? void 0 : _uischema$options.readOnly) != null ? _uischema$options$com : false;
|
|
10480
10453
|
const width = (_uischema$options$com2 = uischema == null || (_uischema$options2 = uischema.options) == null || (_uischema$options2 = _uischema$options2.componentProps) == null ? void 0 : _uischema$options2.width) != null ? _uischema$options$com2 : '100%';
|
|
10481
|
-
const user = useRegisterUser();
|
|
10482
10454
|
const formStepperCtx = useContext(JsonFormsStepperContext);
|
|
10483
10455
|
const stepperState = formStepperCtx == null || formStepperCtx.selectStepperState == null ? void 0 : formStepperCtx.selectStepperState();
|
|
10484
10456
|
const currentCategory = stepperState == null || (_stepperState$categor = stepperState.categories) == null ? void 0 : _stepperState$categor[stepperState == null ? void 0 : stepperState.activeId];
|
|
10485
10457
|
const showReviewLink = currentCategory == null ? void 0 : currentCategory.showReviewPageLink;
|
|
10486
10458
|
const [localValue, setLocalValue] = useState(data);
|
|
10487
10459
|
const debouncedValue = useDebounce(localValue, 300);
|
|
10460
|
+
useEffect(() => {
|
|
10461
|
+
if (data === undefined || data === null) {
|
|
10462
|
+
return;
|
|
10463
|
+
}
|
|
10464
|
+
setLocalValue(data);
|
|
10465
|
+
}, [data]);
|
|
10488
10466
|
/* istanbul ignore next */
|
|
10489
10467
|
useEffect(() => {
|
|
10490
10468
|
if (debouncedValue === data) return;
|
|
@@ -10496,7 +10474,6 @@ const GoAEmailInput = props => {
|
|
|
10496
10474
|
});
|
|
10497
10475
|
}
|
|
10498
10476
|
}, [debouncedValue]);
|
|
10499
|
-
const [manualInput, setManualInput] = useState(false);
|
|
10500
10477
|
const [isVisited, setIsVisited] = useState(false);
|
|
10501
10478
|
useEffect(() => {
|
|
10502
10479
|
if (showReviewLink === true) {
|
|
@@ -10508,14 +10485,6 @@ const GoAEmailInput = props => {
|
|
|
10508
10485
|
const splintIndex = splitErrors.findIndex(e => e === REQUIRED_PROPERTY_ERROR);
|
|
10509
10486
|
splitErrors[splintIndex] = `${primaryLabel} is required`;
|
|
10510
10487
|
const finalErrors = splitErrors.join('\n');
|
|
10511
|
-
useEffect(() => {
|
|
10512
|
-
if (!user || data) return;
|
|
10513
|
-
const autoPopulatedValue = schema.default || user && autoPopulateValue(user, props);
|
|
10514
|
-
if (autoPopulatedValue && autoPopulatedValue !== data && !manualInput) {
|
|
10515
|
-
handleChange(props.path, autoPopulatedValue);
|
|
10516
|
-
}
|
|
10517
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
10518
|
-
}, [schema, user]);
|
|
10519
10488
|
useEffect(() => {
|
|
10520
10489
|
if (typeof handleChange === 'function' && (schema == null ? void 0 : schema.default) !== undefined) {
|
|
10521
10490
|
handleChange(props.path, schema.default);
|
|
@@ -10542,7 +10511,6 @@ const GoAEmailInput = props => {
|
|
|
10542
10511
|
disabled: !enabled,
|
|
10543
10512
|
readonly: readOnly,
|
|
10544
10513
|
onChange: detail => {
|
|
10545
|
-
setManualInput(true);
|
|
10546
10514
|
if (!isVisited) {
|
|
10547
10515
|
setIsVisited(true);
|
|
10548
10516
|
}
|
|
@@ -12017,6 +11985,13 @@ const isObjectArrayEmpty = currentData => {
|
|
|
12017
11985
|
const result = isEmpty$1(currentData) || JSON.stringify(currentData) === '[{}]';
|
|
12018
11986
|
return result;
|
|
12019
11987
|
};
|
|
11988
|
+
const renderNoneGivenText = data => {
|
|
11989
|
+
return !data ? jsxs(Fragment, {
|
|
11990
|
+
children: [jsx(NoneGivenTableText, {
|
|
11991
|
+
children: "(none given)"
|
|
11992
|
+
}), jsx("br", {})]
|
|
11993
|
+
}) : data;
|
|
11994
|
+
};
|
|
12020
11995
|
const renderCellColumn = ({
|
|
12021
11996
|
data,
|
|
12022
11997
|
error,
|
|
@@ -12026,24 +12001,25 @@ const renderCellColumn = ({
|
|
|
12026
12001
|
element,
|
|
12027
12002
|
isRequired
|
|
12028
12003
|
}) => {
|
|
12029
|
-
const renderWarningCell =
|
|
12030
|
-
return
|
|
12031
|
-
children:
|
|
12032
|
-
children: jsx(GoabIcon, {
|
|
12004
|
+
const renderWarningCell = error => {
|
|
12005
|
+
return jsxs(HilightCellWarning, {
|
|
12006
|
+
children: [renderNoneGivenText(data), jsxs(ObjectArrayWarningIconDiv, {
|
|
12007
|
+
children: [jsx(GoabIcon, {
|
|
12033
12008
|
type: "warning",
|
|
12034
12009
|
title: "warning",
|
|
12035
12010
|
size: "small",
|
|
12036
12011
|
theme: "filled",
|
|
12037
12012
|
ml: "2xs",
|
|
12038
12013
|
mt: "2xs"
|
|
12039
|
-
})
|
|
12040
|
-
})
|
|
12014
|
+
}), error ? error : '']
|
|
12015
|
+
})]
|
|
12041
12016
|
});
|
|
12042
12017
|
};
|
|
12043
12018
|
if (data === undefined && isRequired || error !== '' && error !== undefined) {
|
|
12044
|
-
|
|
12019
|
+
const message = error || (isRequired && data === undefined ? 'Required' : data);
|
|
12020
|
+
return renderWarningCell(message);
|
|
12045
12021
|
} else if (data !== undefined && isRequired && error) {
|
|
12046
|
-
return renderWarningCell();
|
|
12022
|
+
return renderWarningCell(error);
|
|
12047
12023
|
}
|
|
12048
12024
|
const path = `/${rowPath}/${index}/${element}/${index === 0 ? index : index - 1}`;
|
|
12049
12025
|
const nestedErrors = errors == null ? void 0 : errors.filter(e => e.instancePath.includes(path));
|
|
@@ -18855,6 +18831,158 @@ async function tryResolveRefs(schema, ...refSchemas) {
|
|
|
18855
18831
|
}
|
|
18856
18832
|
}
|
|
18857
18833
|
|
|
18834
|
+
const AUTO_POPULATE_SOURCES = ['firstName', 'lastName', 'email'];
|
|
18835
|
+
const getNameParts = user => {
|
|
18836
|
+
const parts = ((user == null ? void 0 : user.name) || '').trim().split(/\s+/).filter(Boolean);
|
|
18837
|
+
return {
|
|
18838
|
+
firstName: parts[0] || '',
|
|
18839
|
+
lastName: parts.length > 1 ? parts[parts.length - 1] : ''
|
|
18840
|
+
};
|
|
18841
|
+
};
|
|
18842
|
+
/**
|
|
18843
|
+
* @deprecated Field names no longer control auto-population. Use the
|
|
18844
|
+
* UI-schema `options.autoPopulate` directive.
|
|
18845
|
+
*/
|
|
18846
|
+
const USER_FIELD_DEFINITIONS = {
|
|
18847
|
+
fullName: {
|
|
18848
|
+
schema: {
|
|
18849
|
+
type: 'string'
|
|
18850
|
+
},
|
|
18851
|
+
getValue: user => user == null ? void 0 : user.name
|
|
18852
|
+
},
|
|
18853
|
+
name: {
|
|
18854
|
+
schema: {
|
|
18855
|
+
type: 'string'
|
|
18856
|
+
},
|
|
18857
|
+
getValue: user => user == null ? void 0 : user.name
|
|
18858
|
+
},
|
|
18859
|
+
firstName: {
|
|
18860
|
+
schema: {
|
|
18861
|
+
type: 'string'
|
|
18862
|
+
},
|
|
18863
|
+
getValue: user => getNameParts(user).firstName
|
|
18864
|
+
},
|
|
18865
|
+
givenName: {
|
|
18866
|
+
schema: {
|
|
18867
|
+
type: 'string'
|
|
18868
|
+
},
|
|
18869
|
+
getValue: user => getNameParts(user).firstName
|
|
18870
|
+
},
|
|
18871
|
+
lastName: {
|
|
18872
|
+
schema: {
|
|
18873
|
+
type: 'string'
|
|
18874
|
+
},
|
|
18875
|
+
getValue: user => getNameParts(user).lastName
|
|
18876
|
+
},
|
|
18877
|
+
familyName: {
|
|
18878
|
+
schema: {
|
|
18879
|
+
type: 'string'
|
|
18880
|
+
},
|
|
18881
|
+
getValue: user => getNameParts(user).lastName
|
|
18882
|
+
},
|
|
18883
|
+
surname: {
|
|
18884
|
+
schema: {
|
|
18885
|
+
type: 'string'
|
|
18886
|
+
},
|
|
18887
|
+
getValue: user => getNameParts(user).lastName
|
|
18888
|
+
},
|
|
18889
|
+
email: {
|
|
18890
|
+
schema: {
|
|
18891
|
+
type: 'string',
|
|
18892
|
+
format: 'email'
|
|
18893
|
+
},
|
|
18894
|
+
getValue: user => (user == null ? void 0 : user.email) || ''
|
|
18895
|
+
},
|
|
18896
|
+
emailAddress: {
|
|
18897
|
+
schema: {
|
|
18898
|
+
type: 'string',
|
|
18899
|
+
format: 'email'
|
|
18900
|
+
},
|
|
18901
|
+
getValue: user => (user == null ? void 0 : user.email) || ''
|
|
18902
|
+
},
|
|
18903
|
+
primaryEmail: {
|
|
18904
|
+
schema: {
|
|
18905
|
+
type: 'string',
|
|
18906
|
+
format: 'email'
|
|
18907
|
+
},
|
|
18908
|
+
getValue: user => (user == null ? void 0 : user.email) || ''
|
|
18909
|
+
}
|
|
18910
|
+
};
|
|
18911
|
+
const AUTO_POPULATE_ACTION_TYPES = new Set([INIT, UPDATE_CORE]);
|
|
18912
|
+
const isEmptyAutoPopulateTarget = value => value === undefined || value === null || value === '';
|
|
18913
|
+
const shouldAutoPopulate = actionType => AUTO_POPULATE_ACTION_TYPES.has(actionType);
|
|
18914
|
+
const isAutoPopulateSource = value => typeof value === 'string' && AUTO_POPULATE_SOURCES.includes(value);
|
|
18915
|
+
const autoPopulateValue = (user, props) => {
|
|
18916
|
+
var _props$uischema;
|
|
18917
|
+
const source = (_props$uischema = props.uischema) == null || (_props$uischema = _props$uischema.options) == null ? void 0 : _props$uischema.autoPopulate;
|
|
18918
|
+
if (!isAutoPopulateSource(source)) {
|
|
18919
|
+
return undefined;
|
|
18920
|
+
}
|
|
18921
|
+
const name = getNameParts(user);
|
|
18922
|
+
const values = {
|
|
18923
|
+
firstName: name.firstName,
|
|
18924
|
+
lastName: name.lastName,
|
|
18925
|
+
email: (user == null ? void 0 : user.email) || ''
|
|
18926
|
+
};
|
|
18927
|
+
return values[source];
|
|
18928
|
+
};
|
|
18929
|
+
const getAutoPopulateControls = element => {
|
|
18930
|
+
var _element$options, _element$elements;
|
|
18931
|
+
if (!element) {
|
|
18932
|
+
return [];
|
|
18933
|
+
}
|
|
18934
|
+
const controls = element.type === 'Control' && (_element$options = element.options) != null && _element$options.autoPopulate ? [element] : [];
|
|
18935
|
+
const children = (_element$elements = element.elements) != null ? _element$elements : [];
|
|
18936
|
+
return [...controls, ...children.flatMap(getAutoPopulateControls)];
|
|
18937
|
+
};
|
|
18938
|
+
const getAutoPopulatedData = (uischema, user) => {
|
|
18939
|
+
if (!user) {
|
|
18940
|
+
return [];
|
|
18941
|
+
}
|
|
18942
|
+
return getAutoPopulateControls(uischema).map(control => ({
|
|
18943
|
+
path: toDataPath(control.scope),
|
|
18944
|
+
value: autoPopulateValue(user, {
|
|
18945
|
+
uischema: control
|
|
18946
|
+
})
|
|
18947
|
+
})).filter(({
|
|
18948
|
+
path,
|
|
18949
|
+
value
|
|
18950
|
+
}) => Boolean(path) && value !== undefined && value !== null);
|
|
18951
|
+
};
|
|
18952
|
+
const mergeAutoPopulatedData = (data, autoPopulatedData) => {
|
|
18953
|
+
if (autoPopulatedData.length === 0) {
|
|
18954
|
+
return data;
|
|
18955
|
+
}
|
|
18956
|
+
const defaults = autoPopulatedData.reduce((values, {
|
|
18957
|
+
path,
|
|
18958
|
+
value
|
|
18959
|
+
}) => _$c.set(values, path, value), {});
|
|
18960
|
+
const normalizedData = _$c.cloneDeep(data != null ? data : {});
|
|
18961
|
+
autoPopulatedData.forEach(({
|
|
18962
|
+
path,
|
|
18963
|
+
value
|
|
18964
|
+
}) => {
|
|
18965
|
+
if (isEmptyAutoPopulateTarget(_$c.get(normalizedData, path)) && value !== undefined && value !== null) {
|
|
18966
|
+
_$c.unset(normalizedData, path);
|
|
18967
|
+
}
|
|
18968
|
+
});
|
|
18969
|
+
return _$c.defaultsDeep({}, normalizedData, defaults);
|
|
18970
|
+
};
|
|
18971
|
+
const createAutoPopulateMiddleware = (uischema, user) => (state, action, defaultReducer) => {
|
|
18972
|
+
const newState = defaultReducer(state, action);
|
|
18973
|
+
if (!shouldAutoPopulate(action.type)) {
|
|
18974
|
+
return newState;
|
|
18975
|
+
}
|
|
18976
|
+
return Object.assign({}, newState, {
|
|
18977
|
+
data: mergeAutoPopulatedData(newState.data, getAutoPopulatedData(uischema, user))
|
|
18978
|
+
});
|
|
18979
|
+
};
|
|
18980
|
+
/**
|
|
18981
|
+
* Retained for compatibility with consumers of the previous data-schema
|
|
18982
|
+
* autocomplete API. Auto-population is now configured in the UI schema.
|
|
18983
|
+
*/
|
|
18984
|
+
const autoPopulatePropertiesMonaco = [];
|
|
18985
|
+
|
|
18858
18986
|
const GoABaseRenderers = [
|
|
18859
18987
|
// controls
|
|
18860
18988
|
{
|
|
@@ -19121,4 +19249,4 @@ const GoARenderers = [...GoABaseRenderers, {
|
|
|
19121
19249
|
}];
|
|
19122
19250
|
const GoACells = [...InputCells];
|
|
19123
19251
|
|
|
19124
|
-
export { ADD_DATALIST_ACTION, ADD_NO_ANONYMOUS_ACTION, ADD_REGISTER_DATA_ACTION, ADD_REGISTER_DATA_ERROR, ADD_USER_ACTION, AddressLookUpControl, AddressLookUpControlReview, AddressLookUpTester, AddressLoopUpControlTableReview, ArrayControl, ArrayControlBase, ArrayControlReview, BooleanComponent, BooleanControl, BooleanRadioComponent, BooleanRadioControl, CategorizationPagesRendererTester, CategorizationStepperRendererTester, CheckboxGroup, ContactInformationTester, ContextProviderC, ContextProviderClass, ContextProviderFactory, ContractInfoControl, ContractInfoControlReview, EnumCheckboxControl, EnumRadioControl, EnumSelect, FileUploader, FileUploaderReview, FileUploaderTester, FormPageStepper, FormPagesView, FormStepper, FormStepperControl, FormStepperPagesControl, FormStepperReviewControl, FormStepperReviewer, FormStepperView, FullNameControl, FullNameControlReview, FullNameDobControl, FullNameDobReviewControl, FullNameDobTester, FullNameReviewControl, FullNameTester, GoAArrayControlRenderer, GoAArrayControlReviewRenderer, GoAArrayControlTester, GoABaseInputReviewComponent, GoABaseRenderers, GoABaseReviewRenderers, GoABaseTableReviewRenderers, GoABooleanControl, GoABooleanControlTester, GoABooleanRadioControl, GoABooleanRadioControlTester, GoACalculationControl, GoACalculationControlTester, GoACells, GoACheckoutGroupControlTester, GoAContractInfoControlReview, GoADateControl, GoADateControlTester, GoADateInput, GoADateTimeControl, GoADateTimeControlTester, GoADateTimeInput, GoAEmailControl, GoAEmailControlTester, GoAEmailInput, GoAEnumCheckboxGroupControl, GoAEnumControl, GoAEnumControlTester, GoAEnumRadioGroupControl, GoAInputBaseControl, GoAInputBaseFullNameControlReview, GoAInputBaseFullNameDobControlReview, GoAInputBaseReviewControl, GoAInputBaseTableReview, GoAInputBaseTableReviewControl, GoAInputDateControl, GoAInputDateTimeControl, GoAInputEmailControl, GoAInputIntegerControl, GoAInputNumberControl, GoAInputText, GoAInputTextControl, GoAInputTimeControl, GoAIntegerControl, GoAIntegerControlTester, GoAListWithDetailsControlRenderer, GoAListWithDetailsTester, GoANumberControl, GoANumberControlTester, GoANumberInput, GoAPhoneNumberControl, GoAPhoneNumberWithTypeControl, GoAPrimitiveArrayRenderer, GoAPrimitiveArrayTester, GoARadioGroupControlTester, GoARenderers, GoAReviewRenderers, GoATextControl, GoATextControlTester, GoATimeControl, GoATimeControlTester, GoATimeInput, GoInputBaseReview, GoabInputBasePhoneNumberReviewControl, GoabInputBasePhoneNumberWithTypeReviewControl, GoabInputInteger, InnerGoAInputText, JsonFormContext, JsonFormRegisterProvider, JsonFormsRegisterContext, ListWithDetailsControl, MultiLineText, MultiLineTextControl, MultiLineTextControlInput, MultiLineTextControlTester, OPTION_DEFINITIONS, PHONE_REGEX, PhoneGrid, PhoneNumberControl, PhoneNumberReviewControl, PhoneNumberTester, PhoneNumberWithTypeControl, PhoneNumberWithTypeReviewControl, PhoneNumberWithTypeTester, PrimitiveArrayControl, RadioGroup, USER_FIELD_DEFINITIONS, autoPopulatePropertiesMonaco, autoPopulateValue, categoriesAreValid, createDefaultAjv, enumControl, errMalformedDate, fetchRegisterConfigFromOptions$1 as fetchRegisterConfigFromOptions, formatSin, getByJsonPointer, getCategoryScopes, hasDataInScopes, hasDataValue, isAddressLookup, isContactInformation, isFullName, isFullNameDoB, isPhoneNumberWithType, predictiveOptionsMonaco, registerReducer, resolveRefs, toDateTimeLocalInputValue, tryResolveRefs, useRegisterUser };
|
|
19252
|
+
export { ADD_DATALIST_ACTION, ADD_NO_ANONYMOUS_ACTION, ADD_REGISTER_DATA_ACTION, ADD_REGISTER_DATA_ERROR, ADD_USER_ACTION, AUTO_POPULATE_SOURCES, AddressLookUpControl, AddressLookUpControlReview, AddressLookUpTester, AddressLoopUpControlTableReview, ArrayControl, ArrayControlBase, ArrayControlReview, BooleanComponent, BooleanControl, BooleanRadioComponent, BooleanRadioControl, CategorizationPagesRendererTester, CategorizationStepperRendererTester, CheckboxGroup, ContactInformationTester, ContextProviderC, ContextProviderClass, ContextProviderFactory, ContractInfoControl, ContractInfoControlReview, EnumCheckboxControl, EnumRadioControl, EnumSelect, FileUploader, FileUploaderReview, FileUploaderTester, FormPageStepper, FormPagesView, FormStepper, FormStepperControl, FormStepperPagesControl, FormStepperReviewControl, FormStepperReviewer, FormStepperView, FullNameControl, FullNameControlReview, FullNameDobControl, FullNameDobReviewControl, FullNameDobTester, FullNameReviewControl, FullNameTester, GoAArrayControlRenderer, GoAArrayControlReviewRenderer, GoAArrayControlTester, GoABaseInputReviewComponent, GoABaseRenderers, GoABaseReviewRenderers, GoABaseTableReviewRenderers, GoABooleanControl, GoABooleanControlTester, GoABooleanRadioControl, GoABooleanRadioControlTester, GoACalculationControl, GoACalculationControlTester, GoACells, GoACheckoutGroupControlTester, GoAContractInfoControlReview, GoADateControl, GoADateControlTester, GoADateInput, GoADateTimeControl, GoADateTimeControlTester, GoADateTimeInput, GoAEmailControl, GoAEmailControlTester, GoAEmailInput, GoAEnumCheckboxGroupControl, GoAEnumControl, GoAEnumControlTester, GoAEnumRadioGroupControl, GoAInputBaseControl, GoAInputBaseFullNameControlReview, GoAInputBaseFullNameDobControlReview, GoAInputBaseReviewControl, GoAInputBaseTableReview, GoAInputBaseTableReviewControl, GoAInputDateControl, GoAInputDateTimeControl, GoAInputEmailControl, GoAInputIntegerControl, GoAInputNumberControl, GoAInputText, GoAInputTextControl, GoAInputTimeControl, GoAIntegerControl, GoAIntegerControlTester, GoAListWithDetailsControlRenderer, GoAListWithDetailsTester, GoANumberControl, GoANumberControlTester, GoANumberInput, GoAPhoneNumberControl, GoAPhoneNumberWithTypeControl, GoAPrimitiveArrayRenderer, GoAPrimitiveArrayTester, GoARadioGroupControlTester, GoARenderers, GoAReviewRenderers, GoATextControl, GoATextControlTester, GoATimeControl, GoATimeControlTester, GoATimeInput, GoInputBaseReview, GoabInputBasePhoneNumberReviewControl, GoabInputBasePhoneNumberWithTypeReviewControl, GoabInputInteger, InnerGoAInputText, JsonFormContext, JsonFormRegisterProvider, JsonFormsRegisterContext, ListWithDetailsControl, MultiLineText, MultiLineTextControl, MultiLineTextControlInput, MultiLineTextControlTester, OPTION_DEFINITIONS, PHONE_REGEX, PhoneGrid, PhoneNumberControl, PhoneNumberReviewControl, PhoneNumberTester, PhoneNumberWithTypeControl, PhoneNumberWithTypeReviewControl, PhoneNumberWithTypeTester, PrimitiveArrayControl, RadioGroup, USER_FIELD_DEFINITIONS, autoPopulatePropertiesMonaco, autoPopulateValue, categoriesAreValid, createAutoPopulateMiddleware, createDefaultAjv, enumControl, errMalformedDate, fetchRegisterConfigFromOptions$1 as fetchRegisterConfigFromOptions, formatSin, getAutoPopulateControls, getAutoPopulatedData, getByJsonPointer, getCategoryScopes, hasDataInScopes, hasDataValue, isAddressLookup, isContactInformation, isFullName, isFullNameDoB, isPhoneNumberWithType, mergeAutoPopulatedData, predictiveOptionsMonaco, registerReducer, resolveRefs, toDateTimeLocalInputValue, tryResolveRefs, useRegisterUser };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abgov/jsonforms-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.67.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Government of Alberta - React renderers for JSON Forms based on the design system.",
|
|
6
6
|
"repository": "https://github.com/GovAlta/adsp-monorepo",
|
package/renderer-catalog.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": "1.0.0",
|
|
3
|
-
"generatedAt": "2026-06-
|
|
4
|
-
"sourceCommit": "
|
|
3
|
+
"generatedAt": "2026-06-17T16:47:32.172Z",
|
|
4
|
+
"sourceCommit": "bb6ddf86d6467140c26b258d1deb5e7f22736f6a",
|
|
5
5
|
"sourcePath": "libs/jsonforms-components/src/index.ts",
|
|
6
6
|
"rendererCount": 33,
|
|
7
7
|
"renderers": [
|
|
@@ -2,6 +2,8 @@ import { ReactNode, Dispatch } from 'react';
|
|
|
2
2
|
import { CategorizationStepperLayoutRendererProps } from '../types';
|
|
3
3
|
import { StepperContextDataType, CategoryState } from './types';
|
|
4
4
|
import { JsonFormStepperDispatch } from './reducer';
|
|
5
|
+
import { JsonSchema } from '@jsonforms/core';
|
|
6
|
+
import { ErrorObject } from 'ajv';
|
|
5
7
|
export interface JsonFormsStepperContextProviderProps {
|
|
6
8
|
children: ReactNode;
|
|
7
9
|
StepperProps: CategorizationStepperLayoutRendererProps & {
|
|
@@ -29,3 +31,4 @@ export interface JsonFormsStepperContextProps {
|
|
|
29
31
|
}
|
|
30
32
|
export declare const JsonFormsStepperContext: import("react").Context<JsonFormsStepperContextProps | undefined>;
|
|
31
33
|
export declare const JsonFormsStepperContextProvider: ({ children, StepperProps, }: JsonFormsStepperContextProviderProps) => JSX.Element;
|
|
34
|
+
export declare const getEmptyRequiredStringErrors: (data: unknown, schema: JsonSchema) => ErrorObject[];
|
|
@@ -9,5 +9,6 @@ export declare const ReviewLabel: import("styled-components/dist/types").IStyled
|
|
|
9
9
|
export declare const ReviewValue: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
10
10
|
export declare const CheckboxWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
11
11
|
export declare const NoneGivenText: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>>> & string;
|
|
12
|
+
export declare const NoneGivenTableText: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>>> & string;
|
|
12
13
|
export declare const H4Large: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never>>> & string;
|
|
13
14
|
export declare const Row: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never>>> & string;
|
|
@@ -13,4 +13,5 @@ export interface TableProps {
|
|
|
13
13
|
columnLabels?: Record<string, string>;
|
|
14
14
|
}
|
|
15
15
|
export declare const isObjectArrayEmpty: (currentData: string) => boolean;
|
|
16
|
+
export declare const renderNoneGivenText: (data: string | undefined) => string | import("react/jsx-runtime").JSX.Element;
|
|
16
17
|
export declare const renderCellColumn: ({ data, error, errors, index, rowPath, element, isRequired, }: RenderCellColumnProps) => string | import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,58 +1,51 @@
|
|
|
1
1
|
import { User } from '../Context/register';
|
|
2
|
+
import { ControlElement, Middleware, UISchemaElement } from '@jsonforms/core';
|
|
3
|
+
export declare const AUTO_POPULATE_SOURCES: readonly ["firstName", "lastName", "email"];
|
|
4
|
+
export type AutoPopulateSource = (typeof AUTO_POPULATE_SOURCES)[number];
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Field names no longer control auto-population. Use the
|
|
7
|
+
* UI-schema `options.autoPopulate` directive.
|
|
8
|
+
*/
|
|
2
9
|
export declare const USER_FIELD_DEFINITIONS: {
|
|
3
10
|
fullName: {
|
|
4
11
|
schema: {
|
|
5
12
|
type: string;
|
|
6
|
-
minLength: number;
|
|
7
|
-
description: string;
|
|
8
13
|
};
|
|
9
14
|
getValue: (user: User) => string;
|
|
10
15
|
};
|
|
11
16
|
name: {
|
|
12
17
|
schema: {
|
|
13
18
|
type: string;
|
|
14
|
-
minLength: number;
|
|
15
|
-
description: string;
|
|
16
19
|
};
|
|
17
20
|
getValue: (user: User) => string;
|
|
18
21
|
};
|
|
19
22
|
firstName: {
|
|
20
23
|
schema: {
|
|
21
24
|
type: string;
|
|
22
|
-
minLength: number;
|
|
23
|
-
description: string;
|
|
24
25
|
};
|
|
25
26
|
getValue: (user: User) => string;
|
|
26
27
|
};
|
|
27
28
|
givenName: {
|
|
28
29
|
schema: {
|
|
29
30
|
type: string;
|
|
30
|
-
minLength: number;
|
|
31
|
-
description: string;
|
|
32
31
|
};
|
|
33
32
|
getValue: (user: User) => string;
|
|
34
33
|
};
|
|
35
34
|
lastName: {
|
|
36
35
|
schema: {
|
|
37
36
|
type: string;
|
|
38
|
-
minLength: number;
|
|
39
|
-
description: string;
|
|
40
37
|
};
|
|
41
38
|
getValue: (user: User) => string;
|
|
42
39
|
};
|
|
43
40
|
familyName: {
|
|
44
41
|
schema: {
|
|
45
42
|
type: string;
|
|
46
|
-
minLength: number;
|
|
47
|
-
description: string;
|
|
48
43
|
};
|
|
49
44
|
getValue: (user: User) => string;
|
|
50
45
|
};
|
|
51
46
|
surname: {
|
|
52
47
|
schema: {
|
|
53
48
|
type: string;
|
|
54
|
-
minLength: number;
|
|
55
|
-
description: string;
|
|
56
49
|
};
|
|
57
50
|
getValue: (user: User) => string;
|
|
58
51
|
};
|
|
@@ -60,13 +53,6 @@ export declare const USER_FIELD_DEFINITIONS: {
|
|
|
60
53
|
schema: {
|
|
61
54
|
type: string;
|
|
62
55
|
format: string;
|
|
63
|
-
maxLength: number;
|
|
64
|
-
pattern: string;
|
|
65
|
-
description: string;
|
|
66
|
-
errorMessage: {
|
|
67
|
-
pattern: string;
|
|
68
|
-
maxLength: string;
|
|
69
|
-
};
|
|
70
56
|
};
|
|
71
57
|
getValue: (user: User) => string;
|
|
72
58
|
};
|
|
@@ -74,13 +60,6 @@ export declare const USER_FIELD_DEFINITIONS: {
|
|
|
74
60
|
schema: {
|
|
75
61
|
type: string;
|
|
76
62
|
format: string;
|
|
77
|
-
maxLength: number;
|
|
78
|
-
pattern: string;
|
|
79
|
-
description: string;
|
|
80
|
-
errorMessage: {
|
|
81
|
-
pattern: string;
|
|
82
|
-
maxLength: string;
|
|
83
|
-
};
|
|
84
63
|
};
|
|
85
64
|
getValue: (user: User) => string;
|
|
86
65
|
};
|
|
@@ -88,22 +67,31 @@ export declare const USER_FIELD_DEFINITIONS: {
|
|
|
88
67
|
schema: {
|
|
89
68
|
type: string;
|
|
90
69
|
format: string;
|
|
91
|
-
maxLength: number;
|
|
92
|
-
pattern: string;
|
|
93
|
-
description: string;
|
|
94
|
-
errorMessage: {
|
|
95
|
-
pattern: string;
|
|
96
|
-
maxLength: string;
|
|
97
|
-
};
|
|
98
70
|
};
|
|
99
71
|
getValue: (user: User) => string;
|
|
100
72
|
};
|
|
101
73
|
};
|
|
74
|
+
/** @deprecated Use AutoPopulateSource. */
|
|
102
75
|
export type UserField = keyof typeof USER_FIELD_DEFINITIONS;
|
|
103
|
-
|
|
76
|
+
type AutoPopulateProps = {
|
|
77
|
+
uischema?: {
|
|
78
|
+
options?: {
|
|
79
|
+
autoPopulate?: unknown;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
interface AutoPopulatedValue {
|
|
104
84
|
path: string;
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
85
|
+
value: unknown;
|
|
86
|
+
}
|
|
87
|
+
export declare const autoPopulateValue: (user: User, props: AutoPopulateProps) => string | undefined;
|
|
88
|
+
export declare const getAutoPopulateControls: (element?: UISchemaElement) => ControlElement[];
|
|
89
|
+
export declare const getAutoPopulatedData: (uischema: UISchemaElement | undefined, user?: User) => AutoPopulatedValue[];
|
|
90
|
+
export declare const mergeAutoPopulatedData: (data: unknown, autoPopulatedData: AutoPopulatedValue[]) => any;
|
|
91
|
+
export declare const createAutoPopulateMiddleware: (uischema: UISchemaElement | undefined, user?: User) => Middleware;
|
|
92
|
+
/**
|
|
93
|
+
* Retained for compatibility with consumers of the previous data-schema
|
|
94
|
+
* autocomplete API. Auto-population is now configured in the UI schema.
|
|
95
|
+
*/
|
|
96
|
+
export declare const autoPopulatePropertiesMonaco: never[];
|
|
97
|
+
export {};
|