@abgov/jsonforms-components 2.52.5 → 2.53.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 +199 -42
- package/package.json +1 -1
- package/renderer-catalog.json +2 -2
- package/src/lib/Context/register/actions.d.ts +4 -0
- package/src/lib/Context/register/reducer.d.ts +2 -0
- package/src/lib/Context/register/registerContext.d.ts +10 -0
- package/src/lib/Controls/Inputs/InputTextControl.d.ts +3 -0
- package/src/lib/util/autoPopulate.d.ts +65 -0
package/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as runtime from 'react/jsx-runtime';
|
|
2
2
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import React, {
|
|
3
|
+
import React, { useContext, useReducer, useMemo, useEffect, createContext, useCallback, useRef, useState, useLayoutEffect } from 'react';
|
|
4
4
|
import { GoabFormItem, GoabDropdown, GoabDropdownItem, GoabInput, GoabTextArea, GoabCallout, GoabRadioGroup, GoabRadioItem, GoabCheckbox, GoabIcon, GoabButton, GoabGrid, GoabIconButton, GoabTable, GoabModal, GoabButtonGroup, GoabContainer, GoabDetails, GoabFormStepper, GoabFormStep, GoabPages, GoabBadge, GoabText, GoabFileUploadInput, GoabCircularProgress, GoabSpinner } from '@abgov/react-components';
|
|
5
5
|
import styled from 'styled-components';
|
|
6
6
|
import axios from 'axios';
|
|
@@ -3596,6 +3596,7 @@ const Visible = styled.div(_t2$6 || (_t2$6 = _$a`
|
|
|
3596
3596
|
const ADD_REGISTER_DATA_ACTION = 'jsonforms/register/data/add';
|
|
3597
3597
|
const ADD_NO_ANONYMOUS_ACTION = 'jsonforms/register/no_anonymous';
|
|
3598
3598
|
const ADD_DATALIST_ACTION = 'jsonforms/register/add_datalist_action';
|
|
3599
|
+
const ADD_USER_ACTION = 'jsonforms/register/add_user_action';
|
|
3599
3600
|
const ADD_REGISTER_DATA_ERROR = 'jsonforms/register/add_register_data_error';
|
|
3600
3601
|
|
|
3601
3602
|
var classof$5 = classofRaw$2;
|
|
@@ -3715,6 +3716,12 @@ function registerReducer(state, action) {
|
|
|
3715
3716
|
nonExistent: action.payload.nonExistent || []
|
|
3716
3717
|
});
|
|
3717
3718
|
}
|
|
3719
|
+
case ADD_USER_ACTION:
|
|
3720
|
+
{
|
|
3721
|
+
return Object.assign({}, state, {
|
|
3722
|
+
user: action.payload.user
|
|
3723
|
+
});
|
|
3724
|
+
}
|
|
3718
3725
|
}
|
|
3719
3726
|
return state;
|
|
3720
3727
|
}
|
|
@@ -5078,12 +5085,14 @@ const JsonFormRegisterProvider = ({
|
|
|
5078
5085
|
registerData: [],
|
|
5079
5086
|
nonAnonymous: [],
|
|
5080
5087
|
nonExistent: [],
|
|
5088
|
+
user: defaultRegisters == null ? void 0 : defaultRegisters.user,
|
|
5081
5089
|
errors: {}
|
|
5082
5090
|
});
|
|
5083
5091
|
const context = useMemo(() => {
|
|
5084
5092
|
return {
|
|
5085
5093
|
isProvided: true,
|
|
5086
5094
|
registerDispatch: dispatch,
|
|
5095
|
+
user: registers.user,
|
|
5087
5096
|
selectRegisterData: criteria => {
|
|
5088
5097
|
if (criteria != null && criteria.url) {
|
|
5089
5098
|
var _registers$registerDa;
|
|
@@ -5196,6 +5205,14 @@ const JsonFormRegisterProvider = ({
|
|
|
5196
5205
|
}
|
|
5197
5206
|
});
|
|
5198
5207
|
}
|
|
5208
|
+
if (defaultRegisters != null && defaultRegisters.user) {
|
|
5209
|
+
dispatch({
|
|
5210
|
+
type: ADD_USER_ACTION,
|
|
5211
|
+
payload: {
|
|
5212
|
+
user: defaultRegisters == null ? void 0 : defaultRegisters.user
|
|
5213
|
+
}
|
|
5214
|
+
});
|
|
5215
|
+
}
|
|
5199
5216
|
}
|
|
5200
5217
|
}, [dispatch, defaultRegisters]);
|
|
5201
5218
|
/* The client might use the context outside of the Jsonform to provide custom register data */
|
|
@@ -5210,6 +5227,13 @@ const JsonFormRegisterProvider = ({
|
|
|
5210
5227
|
children: children
|
|
5211
5228
|
});
|
|
5212
5229
|
};
|
|
5230
|
+
const useRegisterUser = () => {
|
|
5231
|
+
const ctx = useContext(JsonFormsRegisterContext);
|
|
5232
|
+
if (!ctx) {
|
|
5233
|
+
throw new Error('useRegisterUser must be used inside JsonFormRegisterProvider');
|
|
5234
|
+
}
|
|
5235
|
+
return ctx.user;
|
|
5236
|
+
};
|
|
5213
5237
|
|
|
5214
5238
|
let _$9 = t => t,
|
|
5215
5239
|
_t$a,
|
|
@@ -7088,6 +7112,82 @@ function useDebounce(value, delay) {
|
|
|
7088
7112
|
return debouncedValue;
|
|
7089
7113
|
}
|
|
7090
7114
|
|
|
7115
|
+
const defineFields = fields => fields;
|
|
7116
|
+
const autoLabel = name => `${name} (auto from user profile)`;
|
|
7117
|
+
const buildInsertText = (key, schema) => `${key}": ${JSON.stringify(schema, null, 2)}`;
|
|
7118
|
+
const USER_FIELD_DEFINITIONS = defineFields({
|
|
7119
|
+
fullName: {
|
|
7120
|
+
schema: {
|
|
7121
|
+
type: 'string',
|
|
7122
|
+
minLength: 3,
|
|
7123
|
+
description: 'Please enter your full name'
|
|
7124
|
+
},
|
|
7125
|
+
getValue: user => user == null ? void 0 : user.name
|
|
7126
|
+
},
|
|
7127
|
+
name: {
|
|
7128
|
+
schema: {
|
|
7129
|
+
type: 'string',
|
|
7130
|
+
minLength: 3,
|
|
7131
|
+
description: 'Please enter your full name'
|
|
7132
|
+
},
|
|
7133
|
+
getValue: user => user == null ? void 0 : user.name
|
|
7134
|
+
},
|
|
7135
|
+
firstName: {
|
|
7136
|
+
schema: {
|
|
7137
|
+
type: 'string',
|
|
7138
|
+
minLength: 3,
|
|
7139
|
+
description: 'Please enter your first name'
|
|
7140
|
+
},
|
|
7141
|
+
getValue: user => getNameParts(user).first
|
|
7142
|
+
},
|
|
7143
|
+
lastName: {
|
|
7144
|
+
schema: {
|
|
7145
|
+
type: 'string',
|
|
7146
|
+
minLength: 3,
|
|
7147
|
+
description: 'Please enter your last name'
|
|
7148
|
+
},
|
|
7149
|
+
getValue: user => getNameParts(user).last
|
|
7150
|
+
},
|
|
7151
|
+
userName: {
|
|
7152
|
+
schema: {
|
|
7153
|
+
type: 'string',
|
|
7154
|
+
minLength: 3,
|
|
7155
|
+
description: 'Please enter your username'
|
|
7156
|
+
},
|
|
7157
|
+
getValue: user => (user == null ? void 0 : user.preferredUsername) || (user == null ? void 0 : user.email) || ''
|
|
7158
|
+
},
|
|
7159
|
+
email: {
|
|
7160
|
+
schema: {
|
|
7161
|
+
type: 'string',
|
|
7162
|
+
format: 'email',
|
|
7163
|
+
maxLength: 100,
|
|
7164
|
+
pattern: '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\\\.[a-zA-Z]{2,}$',
|
|
7165
|
+
description: 'Please enter a valid email address (e.g., name@example.com).',
|
|
7166
|
+
errorMessage: {
|
|
7167
|
+
pattern: '(e.g., name@example.com).',
|
|
7168
|
+
maxLength: 'Email must be less than 100 characters.'
|
|
7169
|
+
}
|
|
7170
|
+
},
|
|
7171
|
+
getValue: user => (user == null ? void 0 : user.email) || ''
|
|
7172
|
+
}
|
|
7173
|
+
});
|
|
7174
|
+
const autoPopulateValue = (user, props) => {
|
|
7175
|
+
const field = USER_FIELD_DEFINITIONS[props.path];
|
|
7176
|
+
if (!field) return undefined;
|
|
7177
|
+
return field.getValue(user);
|
|
7178
|
+
};
|
|
7179
|
+
Object.entries(USER_FIELD_DEFINITIONS).map(([key, field]) => ({
|
|
7180
|
+
label: autoLabel(key),
|
|
7181
|
+
insertText: buildInsertText(key, field.schema)
|
|
7182
|
+
}));
|
|
7183
|
+
const getNameParts = user => {
|
|
7184
|
+
const [first = '', last = ''] = ((user == null ? void 0 : user.name) || '').split(' ');
|
|
7185
|
+
return {
|
|
7186
|
+
first,
|
|
7187
|
+
last
|
|
7188
|
+
};
|
|
7189
|
+
};
|
|
7190
|
+
|
|
7091
7191
|
function fetchRegisterConfigFromOptions$1(options) {
|
|
7092
7192
|
if (!(options != null && options.url) && !(options != null && options.urn)) return undefined;
|
|
7093
7193
|
const config = Object.assign({}, options);
|
|
@@ -7108,7 +7208,13 @@ const formatSin = value => {
|
|
|
7108
7208
|
return formatVal;
|
|
7109
7209
|
};
|
|
7110
7210
|
const GoAInputText = props => {
|
|
7111
|
-
|
|
7211
|
+
return jsxs(JsonFormRegisterProvider, {
|
|
7212
|
+
defaultRegisters: undefined,
|
|
7213
|
+
children: [jsx(InnerGoAInputText, Object.assign({}, props)), ' ']
|
|
7214
|
+
});
|
|
7215
|
+
};
|
|
7216
|
+
const InnerGoAInputText = props => {
|
|
7217
|
+
var _ref, _ref2, _uischema$options$com, _uischema$options, _props$uischema, _props$uischema2, _uischema$options2, _uischema$options3, _uischema$options$com2, _uischema$options4, _uischema$options5, _uischema$options6;
|
|
7112
7218
|
const {
|
|
7113
7219
|
data,
|
|
7114
7220
|
config,
|
|
@@ -7123,11 +7229,20 @@ const GoAInputText = props => {
|
|
|
7123
7229
|
isVisited,
|
|
7124
7230
|
setIsVisited
|
|
7125
7231
|
} = props;
|
|
7126
|
-
const
|
|
7232
|
+
const user = useRegisterUser();
|
|
7233
|
+
const initialValue = (_ref = (_ref2 = user && autoPopulateValue(user, props)) != null ? _ref2 : data) != null ? _ref : '';
|
|
7234
|
+
const [localValue, setLocalValue] = useState(initialValue);
|
|
7127
7235
|
const debouncedValue = useDebounce(localValue, 300);
|
|
7128
7236
|
useEffect(() => {
|
|
7129
|
-
setLocalValue(
|
|
7237
|
+
setLocalValue(initialValue);
|
|
7130
7238
|
}, [data]);
|
|
7239
|
+
useEffect(() => {
|
|
7240
|
+
const autoPopulatedValue = schema.default || user && autoPopulateValue(user, props);
|
|
7241
|
+
if (autoPopulatedValue && autoPopulatedValue !== data) {
|
|
7242
|
+
handleChange(props.path, autoPopulatedValue);
|
|
7243
|
+
}
|
|
7244
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7245
|
+
}, [schema, data, user]);
|
|
7131
7246
|
/* istanbul ignore next */
|
|
7132
7247
|
useEffect(() => {
|
|
7133
7248
|
// Only sync if debouncedValue differs from data and is not initial empty state
|
|
@@ -9758,6 +9873,24 @@ const GoAInputBaseTableReview = props => {
|
|
|
9758
9873
|
}
|
|
9759
9874
|
let reviewText = data;
|
|
9760
9875
|
const isBoolean = typeof data === 'boolean';
|
|
9876
|
+
const getArrayDisplayValues = () => {
|
|
9877
|
+
var _itemSchema$oneOf;
|
|
9878
|
+
if (!Array.isArray(data)) {
|
|
9879
|
+
return [];
|
|
9880
|
+
}
|
|
9881
|
+
const itemSchema = schema == null ? void 0 : schema.items;
|
|
9882
|
+
const oneOf = (_itemSchema$oneOf = itemSchema == null ? void 0 : itemSchema.oneOf) != null ? _itemSchema$oneOf : [];
|
|
9883
|
+
const titleByConst = new Map();
|
|
9884
|
+
oneOf.forEach(option => {
|
|
9885
|
+
var _option$title;
|
|
9886
|
+
if (!(option != null && option.const)) return;
|
|
9887
|
+
titleByConst.set(option.const, (_option$title = option.title) != null ? _option$title : option.const);
|
|
9888
|
+
});
|
|
9889
|
+
return data.map(value => {
|
|
9890
|
+
const raw = typeof value === 'string' ? value : String(value);
|
|
9891
|
+
return titleByConst.get(raw) || raw;
|
|
9892
|
+
});
|
|
9893
|
+
};
|
|
9761
9894
|
if (isBoolean) {
|
|
9762
9895
|
var _uischema$options2, _uischema$options3;
|
|
9763
9896
|
let checkboxLabel = '';
|
|
@@ -9777,6 +9910,18 @@ const GoAInputBaseTableReview = props => {
|
|
|
9777
9910
|
}
|
|
9778
9911
|
}
|
|
9779
9912
|
}
|
|
9913
|
+
if (Array.isArray(data) && data.length > 0) {
|
|
9914
|
+
const displayValues = getArrayDisplayValues();
|
|
9915
|
+
reviewText = jsx("ul", {
|
|
9916
|
+
style: {
|
|
9917
|
+
margin: 0,
|
|
9918
|
+
paddingLeft: '1.25rem'
|
|
9919
|
+
},
|
|
9920
|
+
children: displayValues.map((value, index) => jsx("li", {
|
|
9921
|
+
children: value
|
|
9922
|
+
}, `${value}-${index}`))
|
|
9923
|
+
});
|
|
9924
|
+
}
|
|
9780
9925
|
// Helper to extract errors manually from global state, bypassing "touched" filter
|
|
9781
9926
|
const normalizePath = p => p.replace(/\[(\d+)\]/g, '.$1').replace(/^\./, '').replace(/\//g, '.');
|
|
9782
9927
|
const findMatchingError = currentErrors => {
|
|
@@ -9850,7 +9995,7 @@ const GoAInputBaseTableReview = props => {
|
|
|
9850
9995
|
children: "Change"
|
|
9851
9996
|
})]
|
|
9852
9997
|
}), jsxs(ReviewValue, {
|
|
9853
|
-
children: [typeof reviewText === 'string' || typeof reviewText === 'number' ? jsx("div", {
|
|
9998
|
+
children: [typeof reviewText === 'string' || typeof reviewText === 'number' || /*#__PURE__*/React.isValidElement(reviewText) ? jsx("div", {
|
|
9854
9999
|
"data-testid": `review-value-${label}`,
|
|
9855
10000
|
children: reviewText
|
|
9856
10001
|
}) : jsx(JsonFormsDispatch, {
|
|
@@ -9994,12 +10139,14 @@ const GoAEmailInput = props => {
|
|
|
9994
10139
|
errors,
|
|
9995
10140
|
schema,
|
|
9996
10141
|
required,
|
|
9997
|
-
label
|
|
10142
|
+
label,
|
|
10143
|
+
handleChange
|
|
9998
10144
|
} = props;
|
|
9999
10145
|
const defaultSchema = schema;
|
|
10000
10146
|
const appliedUiSchemaOptions = Object.assign({}, config, uischema == null ? void 0 : uischema.options);
|
|
10001
10147
|
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;
|
|
10002
10148
|
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%';
|
|
10149
|
+
const user = useRegisterUser();
|
|
10003
10150
|
const formStepperCtx = useContext(JsonFormsStepperContext);
|
|
10004
10151
|
const stepperState = formStepperCtx == null || formStepperCtx.selectStepperState == null ? void 0 : formStepperCtx.selectStepperState();
|
|
10005
10152
|
const currentCategory = stepperState == null || (_stepperState$categor = stepperState.categories) == null ? void 0 : _stepperState$categor[stepperState == null ? void 0 : stepperState.activeId];
|
|
@@ -10015,43 +10162,53 @@ const GoAEmailInput = props => {
|
|
|
10015
10162
|
const splintIndex = splitErrors.findIndex(e => e === REQUIRED_PROPERTY_ERROR);
|
|
10016
10163
|
splitErrors[splintIndex] = `${primaryLabel} is required`;
|
|
10017
10164
|
const finalErrors = splitErrors.join('\n');
|
|
10165
|
+
useEffect(() => {
|
|
10166
|
+
const autoPopulatedValue = schema.default || user && autoPopulateValue(user, props);
|
|
10167
|
+
if (autoPopulatedValue && autoPopulatedValue !== data) {
|
|
10168
|
+
handleChange(props.path, autoPopulatedValue);
|
|
10169
|
+
}
|
|
10170
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
10171
|
+
}, [schema, data, user]);
|
|
10018
10172
|
return jsx(Visible, {
|
|
10019
10173
|
visible: visible,
|
|
10020
|
-
children: jsx(
|
|
10021
|
-
|
|
10022
|
-
|
|
10023
|
-
|
|
10024
|
-
|
|
10025
|
-
|
|
10026
|
-
|
|
10027
|
-
|
|
10028
|
-
|
|
10029
|
-
|
|
10030
|
-
|
|
10031
|
-
|
|
10032
|
-
|
|
10033
|
-
|
|
10034
|
-
|
|
10035
|
-
|
|
10036
|
-
|
|
10037
|
-
|
|
10038
|
-
|
|
10039
|
-
|
|
10040
|
-
|
|
10041
|
-
|
|
10042
|
-
|
|
10043
|
-
|
|
10044
|
-
|
|
10045
|
-
|
|
10046
|
-
|
|
10047
|
-
|
|
10174
|
+
children: jsx(JsonFormRegisterProvider, {
|
|
10175
|
+
defaultRegisters: undefined,
|
|
10176
|
+
children: jsx(FormFieldWrapper, {
|
|
10177
|
+
children: jsx(GoabFormItem, {
|
|
10178
|
+
error: isVisited && finalErrors,
|
|
10179
|
+
testId: "form-email-input-wrapper",
|
|
10180
|
+
requirement: required ? 'required' : undefined,
|
|
10181
|
+
label: primaryLabel,
|
|
10182
|
+
children: jsx(GoabInput, {
|
|
10183
|
+
error: isVisited && finalErrors.length > 0,
|
|
10184
|
+
type: 'email',
|
|
10185
|
+
width: width,
|
|
10186
|
+
name: "Email address",
|
|
10187
|
+
value: data,
|
|
10188
|
+
testId: (appliedUiSchemaOptions == null ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
|
|
10189
|
+
disabled: !enabled,
|
|
10190
|
+
readonly: readOnly,
|
|
10191
|
+
onChange: detail => {
|
|
10192
|
+
if (!isVisited) {
|
|
10193
|
+
setIsVisited(true);
|
|
10194
|
+
}
|
|
10195
|
+
onChangeForInputControl({
|
|
10196
|
+
name: detail.name,
|
|
10197
|
+
value: detail.value,
|
|
10198
|
+
controlProps: props
|
|
10199
|
+
});
|
|
10200
|
+
},
|
|
10201
|
+
onBlur: detail => {
|
|
10202
|
+
if (!isVisited) {
|
|
10203
|
+
setIsVisited(true);
|
|
10204
|
+
}
|
|
10205
|
+
onBlurForTextControl({
|
|
10206
|
+
name: detail.name,
|
|
10207
|
+
value: detail.value,
|
|
10208
|
+
controlProps: props
|
|
10209
|
+
});
|
|
10048
10210
|
}
|
|
10049
|
-
|
|
10050
|
-
name: detail.name,
|
|
10051
|
-
value: detail.value,
|
|
10052
|
-
controlProps: props
|
|
10053
|
-
});
|
|
10054
|
-
}
|
|
10211
|
+
})
|
|
10055
10212
|
})
|
|
10056
10213
|
})
|
|
10057
10214
|
})
|
|
@@ -17360,7 +17517,7 @@ function evaluateExpression(expression, data, opts) {
|
|
|
17360
17517
|
const sumScope = sumMatch[1];
|
|
17361
17518
|
return evaluateSum(sumScope, data, opts);
|
|
17362
17519
|
}
|
|
17363
|
-
const scopeRegex = /#\/(?:properties\/)?[^\s"'()]+/g;
|
|
17520
|
+
const scopeRegex = /#\/(?:properties\/)?[^\s"'(),]+/g;
|
|
17364
17521
|
const matches = trimmed.match(scopeRegex) || [];
|
|
17365
17522
|
const uniqueScopes = Array.from(new Set(matches));
|
|
17366
17523
|
const normalizedScopes = uniqueScopes.map(s => s.replace(/^#\/(properties\/)?/, '#/properties/'));
|
|
@@ -18039,4 +18196,4 @@ const GoARenderers = [...GoABaseRenderers, {
|
|
|
18039
18196
|
}];
|
|
18040
18197
|
const GoACells = [...InputCells];
|
|
18041
18198
|
|
|
18042
|
-
export { ADD_DATALIST_ACTION, ADD_NO_ANONYMOUS_ACTION, ADD_REGISTER_DATA_ACTION, ADD_REGISTER_DATA_ERROR, AddressLookUpControl, AddressLookUpControlReview, AddressLookUpTester, AddressLoopUpControlTableReview, ArrayControl, ArrayControlBase, ArrayControlReview, BooleanComponent, BooleanControl, BooleanRadioComponent, BooleanRadioControl, CategorizationPagesRendererTester, CategorizationStepperRendererTester, CheckboxGroup, ContextProviderC, ContextProviderClass, ContextProviderFactory, 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, 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, JsonFormContext, JsonFormRegisterProvider, JsonFormsRegisterContext, ListWithDetailsControl, MultiLineText, MultiLineTextControl, MultiLineTextControlInput, MultiLineTextControlTester, PHONE_REGEX, PhoneGrid, PhoneNumberControl, PhoneNumberReviewControl, PhoneNumberTester, PhoneNumberWithTypeControl, PhoneNumberWithTypeReviewControl, PhoneNumberWithTypeTester, PrimitiveArrayControl, RadioGroup, categoriesAreValid, createDefaultAjv, enumControl, errMalformedDate, formatSin, getByJsonPointer, getCategoryScopes, hasDataInScopes, hasDataValue, isAddressLookup, isFullName, isFullNameDoB, isPhoneNumber, isPhoneNumberWithType, registerReducer, resolveRefs, tryResolveRefs };
|
|
18199
|
+
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, ContextProviderC, ContextProviderClass, ContextProviderFactory, 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, 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, PHONE_REGEX, PhoneGrid, PhoneNumberControl, PhoneNumberReviewControl, PhoneNumberTester, PhoneNumberWithTypeControl, PhoneNumberWithTypeReviewControl, PhoneNumberWithTypeTester, PrimitiveArrayControl, RadioGroup, categoriesAreValid, createDefaultAjv, enumControl, errMalformedDate, fetchRegisterConfigFromOptions$1 as fetchRegisterConfigFromOptions, formatSin, getByJsonPointer, getCategoryScopes, hasDataInScopes, hasDataValue, isAddressLookup, isFullName, isFullNameDoB, isPhoneNumber, isPhoneNumberWithType, registerReducer, resolveRefs, tryResolveRefs, useRegisterUser };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abgov/jsonforms-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.53.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-03-
|
|
4
|
-
"sourceCommit": "
|
|
3
|
+
"generatedAt": "2026-03-13T17:54:45.947Z",
|
|
4
|
+
"sourceCommit": "ca0777fa0c83dbc8906d95bd24deecc82c540820",
|
|
5
5
|
"sourcePath": "libs/jsonforms-components/src/index.ts",
|
|
6
6
|
"rendererCount": 32,
|
|
7
7
|
"renderers": [
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Dispatch } from 'react';
|
|
2
|
+
import { User } from './registerContext';
|
|
2
3
|
export declare const ADD_REGISTER_DATA_ACTION = "jsonforms/register/data/add";
|
|
3
4
|
export declare const ADD_NO_ANONYMOUS_ACTION = "jsonforms/register/no_anonymous";
|
|
4
5
|
export declare const ADD_DATALIST_ACTION = "jsonforms/register/add_datalist_action";
|
|
6
|
+
export declare const ADD_USER_ACTION = "jsonforms/register/add_user_action";
|
|
5
7
|
export declare const ADD_REGISTER_DATA_ERROR = "jsonforms/register/add_register_data_error";
|
|
6
8
|
export interface RegisterConfig {
|
|
7
9
|
urn?: string;
|
|
@@ -27,6 +29,7 @@ export interface RegisterConfigData extends RegisterConfig {
|
|
|
27
29
|
errors?: Record<string, Errors>;
|
|
28
30
|
nonAnonymous?: string[];
|
|
29
31
|
nonExistent?: string[];
|
|
32
|
+
user?: User;
|
|
30
33
|
}
|
|
31
34
|
export type RegisterData = RegisterConfigData[];
|
|
32
35
|
export type RegisterDataResponse = {
|
|
@@ -34,6 +37,7 @@ export type RegisterDataResponse = {
|
|
|
34
37
|
nonExistent: string[];
|
|
35
38
|
nonAnonymous: string[];
|
|
36
39
|
errors: Record<string, Errors>;
|
|
40
|
+
user?: User;
|
|
37
41
|
};
|
|
38
42
|
type AddDataAction = {
|
|
39
43
|
type: string;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { RegisterActions, RegisterData, RegisterDataResponse, Errors } from './actions';
|
|
2
|
+
import { User } from './registerContext';
|
|
2
3
|
export declare function registerReducer(state: {
|
|
3
4
|
registerData: RegisterData;
|
|
4
5
|
nonExistent: string[];
|
|
5
6
|
nonAnonymous: string[];
|
|
6
7
|
errors: Record<string, Errors>;
|
|
8
|
+
user?: User;
|
|
7
9
|
}, action: RegisterActions): RegisterDataResponse;
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { RegisterConfig, RegisterData, JsonFormRegisterDispatch, RegisterDataType } from './actions';
|
|
3
|
+
export interface User {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
email: string;
|
|
7
|
+
roles: string[];
|
|
8
|
+
preferredUsername: string;
|
|
9
|
+
}
|
|
3
10
|
interface JsonFormsRegisterContextProps {
|
|
4
11
|
registerDispatch: JsonFormRegisterDispatch;
|
|
5
12
|
fetchRegisterByUrl: (registerConfig: RegisterConfig) => Promise<void>;
|
|
6
13
|
selectRegisterData: (registerConfig: RegisterConfig) => RegisterDataType;
|
|
7
14
|
fetchErrors: (registerConfig: RegisterConfig) => string;
|
|
8
15
|
isProvided: boolean;
|
|
16
|
+
user?: User;
|
|
9
17
|
}
|
|
10
18
|
export declare const JsonFormsRegisterContext: import("react").Context<JsonFormsRegisterContextProps | undefined>;
|
|
11
19
|
interface JsonFormsRegisterProviderProps {
|
|
@@ -14,7 +22,9 @@ interface JsonFormsRegisterProviderProps {
|
|
|
14
22
|
registerData: RegisterData;
|
|
15
23
|
dataList: string[];
|
|
16
24
|
nonAnonymous: string[];
|
|
25
|
+
user?: User;
|
|
17
26
|
} | undefined;
|
|
18
27
|
}
|
|
19
28
|
export declare const JsonFormRegisterProvider: ({ children, defaultRegisters, }: JsonFormsRegisterProviderProps) => JSX.Element;
|
|
29
|
+
export declare const useRegisterUser: () => User | undefined;
|
|
20
30
|
export {};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CellProps, WithClassname, ControlProps, RankedTester } from '@jsonforms/core';
|
|
3
3
|
import { WithInputProps } from './type';
|
|
4
|
+
import { RegisterConfig } from '../../Context/register';
|
|
4
5
|
export type GoAInputTextProps = CellProps & WithClassname & WithInputProps;
|
|
6
|
+
export declare function fetchRegisterConfigFromOptions(options: Record<string, unknown> | undefined): RegisterConfig | undefined;
|
|
5
7
|
export declare const formatSin: (value: string) => string;
|
|
6
8
|
export declare const GoAInputText: (props: GoAInputTextProps) => JSX.Element;
|
|
9
|
+
export declare const InnerGoAInputText: (props: GoAInputTextProps) => JSX.Element;
|
|
7
10
|
export declare const GoATextControl: (props: ControlProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
11
|
export declare const GoATextControlTester: RankedTester;
|
|
9
12
|
export declare const GoAInputTextControl: React.ComponentType<import("@jsonforms/core").OwnPropsOfControl>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { User } from '../Context/register';
|
|
2
|
+
export declare const USER_FIELD_DEFINITIONS: {
|
|
3
|
+
fullName: {
|
|
4
|
+
schema: {
|
|
5
|
+
type: string;
|
|
6
|
+
minLength: number;
|
|
7
|
+
description: string;
|
|
8
|
+
};
|
|
9
|
+
getValue: (user: User) => string;
|
|
10
|
+
};
|
|
11
|
+
name: {
|
|
12
|
+
schema: {
|
|
13
|
+
type: string;
|
|
14
|
+
minLength: number;
|
|
15
|
+
description: string;
|
|
16
|
+
};
|
|
17
|
+
getValue: (user: User) => string;
|
|
18
|
+
};
|
|
19
|
+
firstName: {
|
|
20
|
+
schema: {
|
|
21
|
+
type: string;
|
|
22
|
+
minLength: number;
|
|
23
|
+
description: string;
|
|
24
|
+
};
|
|
25
|
+
getValue: (user: User) => string;
|
|
26
|
+
};
|
|
27
|
+
lastName: {
|
|
28
|
+
schema: {
|
|
29
|
+
type: string;
|
|
30
|
+
minLength: number;
|
|
31
|
+
description: string;
|
|
32
|
+
};
|
|
33
|
+
getValue: (user: User) => string;
|
|
34
|
+
};
|
|
35
|
+
userName: {
|
|
36
|
+
schema: {
|
|
37
|
+
type: string;
|
|
38
|
+
minLength: number;
|
|
39
|
+
description: string;
|
|
40
|
+
};
|
|
41
|
+
getValue: (user: User) => string;
|
|
42
|
+
};
|
|
43
|
+
email: {
|
|
44
|
+
schema: {
|
|
45
|
+
type: string;
|
|
46
|
+
format: string;
|
|
47
|
+
maxLength: number;
|
|
48
|
+
pattern: string;
|
|
49
|
+
description: string;
|
|
50
|
+
errorMessage: {
|
|
51
|
+
pattern: string;
|
|
52
|
+
maxLength: string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
getValue: (user: User) => string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
export type UserField = keyof typeof USER_FIELD_DEFINITIONS;
|
|
59
|
+
export declare const autoPopulateValue: (user: User, props: {
|
|
60
|
+
path: string;
|
|
61
|
+
}) => string | undefined;
|
|
62
|
+
export declare const autoPopulatePropertiesMonaco: {
|
|
63
|
+
label: string;
|
|
64
|
+
insertText: string;
|
|
65
|
+
}[];
|