@abgov/jsonforms-components 1.39.1 → 1.39.2

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 CHANGED
@@ -6506,7 +6506,7 @@ const extractScopesFromUISchema$1 = uischema => {
6506
6506
  return scopes;
6507
6507
  };
6508
6508
  const GenerateRows$1 = (Cell, schema, rowPath, enabled, openDeleteDialog, handleChange, cells, uischema, isInReview, count, data) => {
6509
- if (schema.type === 'object') {
6509
+ if ((schema === null || schema === void 0 ? void 0 : schema.type) === 'object') {
6510
6510
  const props = {
6511
6511
  schema,
6512
6512
  rowPath,
@@ -7034,7 +7034,7 @@ const extractScopesFromUISchema = uischema => {
7034
7034
  return scopes;
7035
7035
  };
7036
7036
  const GenerateRows = (Cell, schema, rowPath, enabled, cells, uischema) => {
7037
- if (schema.type === 'object') {
7037
+ if ((schema === null || schema === void 0 ? void 0 : schema.type) === 'object') {
7038
7038
  const props = {
7039
7039
  schema,
7040
7040
  rowPath,
@@ -7055,7 +7055,7 @@ const GenerateRows = (Cell, schema, rowPath, enabled, cells, uischema) => {
7055
7055
  }
7056
7056
  };
7057
7057
  const getValidColumnProps = scopedSchema => {
7058
- if (scopedSchema.type === 'object' && typeof scopedSchema.properties === 'object') {
7058
+ if ((scopedSchema === null || scopedSchema === void 0 ? void 0 : scopedSchema.type) === 'object' && typeof (scopedSchema === null || scopedSchema === void 0 ? void 0 : scopedSchema.properties) === 'object') {
7059
7059
  return Object.keys(scopedSchema.properties).filter(prop => {
7060
7060
  var _a;
7061
7061
  return ((_a = scopedSchema.properties) === null || _a === void 0 ? void 0 : _a[prop].type) !== 'array';
@@ -7076,14 +7076,14 @@ const EmptyList = ({
7076
7076
  })
7077
7077
  });
7078
7078
  const ctxToNonEmptyCellProps = (ctx, ownProps) => {
7079
- var _a;
7080
- ownProps.rowPath + (ownProps.schema.type === 'object' ? '.' + ownProps.propName : '');
7079
+ var _a, _b;
7080
+ ownProps.rowPath + (((_a = ownProps.schema) === null || _a === void 0 ? void 0 : _a.type) === 'object' ? '.' + ownProps.propName : '');
7081
7081
  const errors = '';
7082
7082
  return {
7083
7083
  uischema: ownProps.uischema,
7084
7084
  rowPath: ownProps.rowPath,
7085
7085
  schema: ownProps.schema,
7086
- rootSchema: (_a = ctx.core) === null || _a === void 0 ? void 0 : _a.schema,
7086
+ rootSchema: (_b = ctx.core) === null || _b === void 0 ? void 0 : _b.schema,
7087
7087
  errors,
7088
7088
  enabled: ownProps.enabled,
7089
7089
  cells: ownProps.cells || ctx.cells,
@@ -7453,6 +7453,7 @@ const AddressInputs = ({
7453
7453
  address,
7454
7454
  handleInputChange,
7455
7455
  isAlbertaAddress,
7456
+ readOnly,
7456
7457
  errors,
7457
7458
  handleOnBlur,
7458
7459
  requiredFields
@@ -7504,6 +7505,8 @@ const AddressInputs = ({
7504
7505
  children: jsx(GoAInput, {
7505
7506
  name: "addressLine2",
7506
7507
  testId: "address-form-address2",
7508
+ disabled: readOnly,
7509
+ readonly: readOnly,
7507
7510
  ariaLabel: 'address-form-address2',
7508
7511
  placeholder: "Unit number, suite, apartment",
7509
7512
  value: (address === null || address === void 0 ? void 0 : address.addressLine2) || '',
@@ -7521,6 +7524,8 @@ const AddressInputs = ({
7521
7524
  name: "municipality",
7522
7525
  testId: "address-form-city",
7523
7526
  ariaLabel: 'address-form-city',
7527
+ disabled: readOnly,
7528
+ readonly: readOnly,
7524
7529
  value: (address === null || address === void 0 ? void 0 : address.municipality) || '',
7525
7530
  onChange: (name, value) => handleInputChange(name, value),
7526
7531
  onBlur: (name, value) => handleOnBlur(name),
@@ -7534,6 +7539,8 @@ const AddressInputs = ({
7534
7539
  name: "postalCode",
7535
7540
  testId: "address-form-postal-code",
7536
7541
  ariaLabel: 'address-form-postal-code',
7542
+ disabled: readOnly,
7543
+ readonly: readOnly,
7537
7544
  placeholder: "A0A 0A0",
7538
7545
  value: (address === null || address === void 0 ? void 0 : address.postalCode) || '',
7539
7546
  onChange: (name, value) => handleInputChange(name, value),
@@ -7551,7 +7558,7 @@ const AddressInputs = ({
7551
7558
  "data-testid": "address-form-province",
7552
7559
  children: "Alberta"
7553
7560
  }), !isAlbertaAddress && jsx(GoADropdown, {
7554
- name: "province",
7561
+ name: "subdivisionCode",
7555
7562
  testId: "address-form-province-dropdown",
7556
7563
  ariaLabel: 'address-form-province',
7557
7564
  value: (address === null || address === void 0 ? void 0 : address.subdivisionCode) || '',
@@ -7862,13 +7869,15 @@ const HelpReviewContent = withJsonFormsControlProps(HelpContentReviewComponent);
7862
7869
 
7863
7870
  const ADDRESS_PATH = 'api/gateway/v1/address/v1/find';
7864
7871
  const AddressLookUpControl = props => {
7865
- var _a, _b, _c, _d;
7872
+ var _a, _b, _c, _d, _e, _f, _g;
7866
7873
  const {
7867
7874
  data,
7868
7875
  path,
7869
7876
  schema,
7877
+ enabled,
7870
7878
  handleChange,
7871
- uischema
7879
+ uischema,
7880
+ rootSchema
7872
7881
  } = props;
7873
7882
  const isAlbertaAddress = ((_b = (_a = schema === null || schema === void 0 ? void 0 : schema.properties) === null || _a === void 0 ? void 0 : _a.subdivisionCode) === null || _b === void 0 ? void 0 : _b.const) === 'AB';
7874
7883
  const formCtx = useContext(JsonFormContext);
@@ -7961,16 +7970,19 @@ const AddressLookUpControl = props => {
7961
7970
  delete errors[name];
7962
7971
  }
7963
7972
  };
7973
+ const readOnly = (_f = (_e = (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps) === null || _e === void 0 ? void 0 : _e.readOnly) !== null && _f !== void 0 ? _f : false;
7964
7974
  return jsxs("div", {
7965
7975
  children: [renderHelp(), jsx(GoAFormItem, {
7966
7976
  label: label,
7967
- error: (_d = errors === null || errors === void 0 ? void 0 : errors['addressLine1']) !== null && _d !== void 0 ? _d : '',
7977
+ error: (_g = errors === null || errors === void 0 ? void 0 : errors['addressLine1']) !== null && _g !== void 0 ? _g : '',
7968
7978
  "data-testId": "form-address-line1",
7969
7979
  children: jsxs(SearchBox, {
7970
7980
  children: [jsx(GoAInput, {
7971
- leadingIcon: autocompletion ? 'search' : undefined,
7981
+ leadingIcon: autocompletion && enabled ? 'search' : undefined,
7972
7982
  name: "addressLine1",
7973
7983
  testId: "address-form-address1",
7984
+ readonly: readOnly,
7985
+ disabled: !enabled,
7974
7986
  ariaLabel: 'address-form-address1',
7975
7987
  placeholder: "Start typing the first line of your address, required.",
7976
7988
  value: (address === null || address === void 0 ? void 0 : address.addressLine1) || '',
@@ -7992,6 +8004,7 @@ const AddressLookUpControl = props => {
7992
8004
  }), jsx("br", {}), jsx(AddressInputs, {
7993
8005
  address: address,
7994
8006
  errors: errors,
8007
+ readOnly: readOnly,
7995
8008
  handleInputChange: handleInputChange,
7996
8009
  isAlbertaAddress: isAlbertaAddress,
7997
8010
  handleOnBlur: handleRequiredFieldBlur,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "1.39.1",
3
+ "version": "1.39.2",
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",
@@ -4,6 +4,7 @@ interface AddressInputsProps {
4
4
  address: Address;
5
5
  handleInputChange: (field: string, value: string) => void;
6
6
  isAlbertaAddress?: boolean;
7
+ readOnly?: boolean;
7
8
  errors?: any;
8
9
  handleOnBlur: (field: string) => void;
9
10
  requiredFields?: string[];