@abgov/jsonforms-components 2.60.2 → 2.60.4

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
@@ -4317,6 +4317,9 @@ const OPTION_DEFINITIONS = defineFields$1({
4317
4317
  enablePhone: {
4318
4318
  schema: true
4319
4319
  },
4320
+ placeholder: {
4321
+ schema: 'Please select something'
4322
+ },
4320
4323
  emailFirst: {
4321
4324
  schema: true
4322
4325
  },
@@ -8071,24 +8074,22 @@ function fetchRegisterConfigFromOptions(options) {
8071
8074
  return config;
8072
8075
  }
8073
8076
  const EnumSelect = props => {
8074
- var _props$uischema, _uischema$options, _uischema$options2, _props$uischema2, _uischema$options3;
8077
+ var _props$uischema, _uischema$options, _uischema$options2, _uischema$options$pla, _uischema$options3, _props$uischema2, _uischema$options4;
8075
8078
  const {
8076
8079
  data,
8077
8080
  enabled,
8078
8081
  path,
8079
8082
  handleChange,
8080
8083
  options,
8081
- label,
8082
8084
  uischema,
8083
- required,
8084
- setIsVisited,
8085
- isVisited,
8086
- schema
8085
+ schema,
8086
+ errors
8087
8087
  } = props;
8088
8088
  const registerCtx = useContext(JsonFormsRegisterContext);
8089
8089
  const registerConfig = fetchRegisterConfigFromOptions((_props$uischema = props.uischema) == null || (_props$uischema = _props$uischema.options) == null ? void 0 : _props$uischema.register);
8090
8090
  const labelPath = (uischema == null || (_uischema$options = uischema.options) == null ? void 0 : _uischema$options.label) || 'label';
8091
8091
  const valuePath = (uischema == null || (_uischema$options2 = uischema.options) == null ? void 0 : _uischema$options2.value) || 'value';
8092
+ const placeholder = (_uischema$options$pla = uischema == null || (_uischema$options3 = uischema.options) == null ? void 0 : _uischema$options3.placeholder) != null ? _uischema$options$pla : 'Select an option';
8092
8093
  let registerData = [];
8093
8094
  let error = '';
8094
8095
  if (registerConfig) {
@@ -8098,13 +8099,15 @@ const EnumSelect = props => {
8098
8099
  const autoCompletion = ((_props$uischema2 = props.uischema) == null || (_props$uischema2 = _props$uischema2.options) == null ? void 0 : _props$uischema2.autoComplete) === true;
8099
8100
  const mergedOptions = useMemo(() => {
8100
8101
  var _registerData;
8101
- const newOptions = [...(options || []), ...(((_registerData = registerData) == null ? void 0 : _registerData.map(d => {
8102
+ const staticOptions = (options || []).filter(item => !(item.value === '' && item.label.trim() === ''));
8103
+ const dynamicOptions = ((_registerData = registerData) == null ? void 0 : _registerData.map(d => {
8102
8104
  if (typeof d === 'string') {
8103
8105
  return {
8104
8106
  value: d,
8105
8107
  label: d
8106
8108
  };
8107
- } else if (typeof d === 'object' && d !== null) {
8109
+ }
8110
+ if (typeof d === 'object' && d !== null) {
8108
8111
  return {
8109
8112
  value: ___default.get(d, valuePath) || '',
8110
8113
  label: ___default.get(d, labelPath) || ''
@@ -8114,21 +8117,16 @@ const EnumSelect = props => {
8114
8117
  label: '',
8115
8118
  value: ''
8116
8119
  };
8117
- })) || [])];
8118
- const hasNonEmptyOptions = newOptions.some(option => option.value !== '');
8119
- if (!hasNonEmptyOptions && newOptions.length === 1 && newOptions[0].value === '') {
8120
- return newOptions;
8121
- }
8122
- if (newOptions && newOptions.length === 0) {
8123
- newOptions.push({
8124
- label: '',
8125
- value: ''
8126
- });
8127
- }
8120
+ })) || [];
8121
+ const filteredDynamicOptions = dynamicOptions.filter(item => !(item.value === '' && item.label.trim() === ''));
8122
+ const newOptions = [{
8123
+ label: placeholder,
8124
+ value: ''
8125
+ }, ...staticOptions, ...filteredDynamicOptions];
8128
8126
  return newOptions;
8129
- //eslint-disable-next-line
8130
- }, [registerData, options]);
8131
- const width = (uischema == null || (_uischema$options3 = uischema.options) == null || (_uischema$options3 = _uischema$options3.componentProps) == null ? void 0 : _uischema$options3.width) || '100%';
8127
+ // eslint-disable-next-line
8128
+ }, [registerData, options, valuePath, labelPath]);
8129
+ const width = (uischema == null || (_uischema$options4 = uischema.options) == null || (_uischema$options4 = _uischema$options4.componentProps) == null ? void 0 : _uischema$options4.width) || '100%';
8132
8130
  useEffect(() => {
8133
8131
  if (registerConfig) {
8134
8132
  registerCtx == null || registerCtx.fetchRegisterByUrl(registerConfig);
@@ -8171,8 +8169,8 @@ const enumControl = props => {
8171
8169
  }));
8172
8170
  };
8173
8171
  const GoAEnumControlTester = rankWith(4, (uischema, schema, context) => {
8174
- var _uischema$options4;
8175
- return (schema == null ? void 0 : schema.type) === 'object' && isControl$1(uischema) && (uischema == null || (_uischema$options4 = uischema.options) == null ? void 0 : _uischema$options4.format) === 'enum' || isEnumControl(uischema, schema, context);
8172
+ var _uischema$options5;
8173
+ return (schema == null ? void 0 : schema.type) === 'object' && isControl$1(uischema) && (uischema == null || (_uischema$options5 = uischema.options) == null ? void 0 : _uischema$options5.format) === 'enum' || isEnumControl(uischema, schema, context);
8176
8174
  });
8177
8175
  const GoAEnumControl = withJsonFormsEnumProps(withTranslateProps(enumControl), true);
8178
8176
 
@@ -9903,7 +9901,7 @@ class ListWithDetailControl extends React.Component {
9903
9901
  }
9904
9902
 
9905
9903
  const GoAInputBaseTableReview = props => {
9906
- var _uischema$options, _uischema$scope2, _jsonForms$core, _uischema$options4;
9904
+ var _uischema$options, _uischema$scope2, _jsonForms$core, _uischema$options4, _uischema$options5;
9907
9905
  const {
9908
9906
  data,
9909
9907
  uischema,
@@ -10085,7 +10083,7 @@ const GoAInputBaseTableReview = props => {
10085
10083
  children: [labelToUpdate, required && jsx(RequiredTextLabel, {
10086
10084
  children: " (required)"
10087
10085
  })]
10088
- }), stepId !== undefined && jsx(GoabButton, {
10086
+ }), stepId !== undefined && !((_uischema$options5 = uischema.options) != null && (_uischema$options5 = _uischema$options5.componentProps) != null && _uischema$options5.readOnly) && jsx(GoabButton, {
10089
10087
  type: "tertiary",
10090
10088
  size: "compact",
10091
10089
  onClick: () => context == null ? void 0 : context.goToPage(stepId, uischema.scope),
@@ -10871,30 +10869,33 @@ const FullNameControlReview = props => {
10871
10869
  } = props;
10872
10870
  const requiredFields = (_props$schema$require = (_props$schema = props.schema) == null ? void 0 : _props$schema.required) != null ? _props$schema$require : [];
10873
10871
  const isMissing = value => isNilOrEmptyString(value);
10874
- const renderRow = (fieldLabel, value, fieldName, testId) => jsx("tr", {
10875
- children: jsxs(PageReviewContainer, {
10876
- colSpan: 3,
10877
- children: [jsxs(ReviewHeader, {
10878
- children: [jsx(ReviewLabel, {
10879
- children: fieldLabel
10880
- }), stepId !== undefined && jsx(GoabButton, {
10881
- type: "tertiary",
10882
- size: "compact",
10883
- onClick: () => context == null ? void 0 : context.goToPage(stepId, uischema.scope),
10884
- testId: `${fieldName}-change-btn`,
10885
- children: "Change"
10886
- })]
10887
- }), jsxs(ReviewValue, {
10888
- children: [jsx("div", {
10889
- "data-testid": testId,
10890
- children: value != null ? value : ''
10891
- }), requiredFields.includes(fieldName) && isMissing(value) && jsx(GoabFormItem, {
10892
- error: `${fieldLabel} is required`,
10893
- label: ""
10872
+ const renderRow = (fieldLabel, value, fieldName, testId) => {
10873
+ var _uischema$options;
10874
+ return jsx("tr", {
10875
+ children: jsxs(PageReviewContainer, {
10876
+ colSpan: 3,
10877
+ children: [jsxs(ReviewHeader, {
10878
+ children: [jsx(ReviewLabel, {
10879
+ children: fieldLabel
10880
+ }), stepId !== undefined && !((_uischema$options = uischema.options) != null && (_uischema$options = _uischema$options.componentProps) != null && _uischema$options.readOnly) && jsx(GoabButton, {
10881
+ type: "tertiary",
10882
+ size: "compact",
10883
+ onClick: () => context == null ? void 0 : context.goToPage(stepId, uischema.scope),
10884
+ testId: `${fieldName}-change-btn`,
10885
+ children: "Change"
10886
+ })]
10887
+ }), jsxs(ReviewValue, {
10888
+ children: [jsx("div", {
10889
+ "data-testid": testId,
10890
+ children: value != null ? value : ''
10891
+ }), requiredFields.includes(fieldName) && isMissing(value) && jsx(GoabFormItem, {
10892
+ error: `${fieldLabel} is required`,
10893
+ label: ""
10894
+ })]
10894
10895
  })]
10895
- })]
10896
- })
10897
- }, testId);
10896
+ })
10897
+ }, testId);
10898
+ };
10898
10899
  return jsxs(Fragment, {
10899
10900
  children: [renderRow('First name', data == null ? void 0 : data.firstName, 'firstName', `firstName-control-${id}`), (data == null ? void 0 : data.middleName) && renderRow('Middle name', data == null ? void 0 : data.middleName, 'middleName', `middleName-control-${id}`), renderRow('Last name', data == null ? void 0 : data.lastName, 'lastName', `lastName-control-${id}`)]
10900
10901
  });
@@ -10915,30 +10916,33 @@ const FullNameDobReviewControl = props => {
10915
10916
  const stepId = uischema == null || (_uischema$options = uischema.options) == null ? void 0 : _uischema$options.stepId;
10916
10917
  const requiredFields = (_props$schema$require = (_props$schema = props.schema) == null ? void 0 : _props$schema.required) != null ? _props$schema$require : [];
10917
10918
  const isMissing = value => isNilOrEmptyString(value);
10918
- const renderRow = (fieldLabel, value, fieldName, testId) => jsx("tr", {
10919
- children: jsxs(PageReviewContainer, {
10920
- colSpan: 3,
10921
- children: [jsxs(ReviewHeader, {
10922
- children: [jsx(ReviewLabel, {
10923
- children: fieldLabel
10924
- }), stepId !== undefined && jsx(GoabButton, {
10925
- type: "tertiary",
10926
- size: "compact",
10927
- onClick: () => context == null ? void 0 : context.goToPage(stepId, uischema.scope),
10928
- testId: `${fieldName}-change-btn`,
10929
- children: "Change"
10930
- })]
10931
- }), jsxs(ReviewValue, {
10932
- children: [jsx("div", {
10933
- "data-testid": testId,
10934
- children: value != null ? value : ''
10935
- }), requiredFields.includes(fieldName) && isMissing(value) && jsx(GoabFormItem, {
10936
- error: `${fieldLabel} is required`,
10937
- label: ""
10919
+ const renderRow = (fieldLabel, value, fieldName, testId) => {
10920
+ var _uischema$options2;
10921
+ return jsx("tr", {
10922
+ children: jsxs(PageReviewContainer, {
10923
+ colSpan: 3,
10924
+ children: [jsxs(ReviewHeader, {
10925
+ children: [jsx(ReviewLabel, {
10926
+ children: fieldLabel
10927
+ }), stepId !== undefined && !((_uischema$options2 = uischema.options) != null && (_uischema$options2 = _uischema$options2.componentProps) != null && _uischema$options2.readOnly) && jsx(GoabButton, {
10928
+ type: "tertiary",
10929
+ size: "compact",
10930
+ onClick: () => context == null ? void 0 : context.goToPage(stepId, uischema.scope),
10931
+ testId: `${fieldName}-change-btn`,
10932
+ children: "Change"
10933
+ })]
10934
+ }), jsxs(ReviewValue, {
10935
+ children: [jsx("div", {
10936
+ "data-testid": testId,
10937
+ children: value != null ? value : ''
10938
+ }), requiredFields.includes(fieldName) && isMissing(value) && jsx(GoabFormItem, {
10939
+ error: `${fieldLabel} is required`,
10940
+ label: ""
10941
+ })]
10938
10942
  })]
10939
- })]
10940
- })
10941
- }, testId);
10943
+ })
10944
+ }, testId);
10945
+ };
10942
10946
  return jsxs(Fragment, {
10943
10947
  children: [renderRow('First name', data == null ? void 0 : data.firstName, 'firstName', `firstName-control-${id}`), (data == null ? void 0 : data.middleName) && renderRow('Middle name', data == null ? void 0 : data.middleName, 'middleName', `middleName-control-${id}`), renderRow('Last name', data == null ? void 0 : data.lastName, 'lastName', `lastName-control-${id}`), renderRow('Date of birth', data == null ? void 0 : data.dateOfBirth, 'dateOfBirth', `dob-control-${id}`)]
10944
10948
  });
@@ -11297,30 +11301,33 @@ const ContractInfoControlReview = props => {
11297
11301
  } = props;
11298
11302
  const requiredFields = (_schema$required = schema == null ? void 0 : schema.required) != null ? _schema$required : [];
11299
11303
  const isMissing = value => value === undefined || value === null || value === '';
11300
- const renderRow = (fieldLabel, value, fieldName, testId) => jsx("tr", {
11301
- children: jsxs(PageReviewContainer, {
11302
- colSpan: 3,
11303
- children: [jsxs(ReviewHeader, {
11304
- children: [jsx(ReviewLabel, {
11305
- children: fieldLabel
11306
- }), stepId !== undefined && jsx(GoabButton, {
11307
- type: "tertiary",
11308
- size: "compact",
11309
- onClick: () => context == null ? void 0 : context.goToPage(stepId, uischema.scope),
11310
- testId: `${fieldName}-change-btn`,
11311
- children: "Change"
11312
- })]
11313
- }), jsxs(ReviewValue, {
11314
- children: [jsx("div", {
11315
- "data-testid": testId,
11316
- children: value != null ? value : ''
11317
- }), requiredFields.includes(fieldName) && isMissing(value) && jsx(GoabFormItem, {
11318
- error: `${fieldLabel} is required`,
11319
- label: ""
11304
+ const renderRow = (fieldLabel, value, fieldName, testId) => {
11305
+ var _uischema$options;
11306
+ return jsx("tr", {
11307
+ children: jsxs(PageReviewContainer, {
11308
+ colSpan: 3,
11309
+ children: [jsxs(ReviewHeader, {
11310
+ children: [jsx(ReviewLabel, {
11311
+ children: fieldLabel
11312
+ }), stepId !== undefined && !((_uischema$options = uischema.options) != null && (_uischema$options = _uischema$options.componentProps) != null && _uischema$options.readOnly) && jsx(GoabButton, {
11313
+ type: "tertiary",
11314
+ size: "compact",
11315
+ onClick: () => context == null ? void 0 : context.goToPage(stepId, uischema.scope),
11316
+ testId: `${fieldName}-change-btn`,
11317
+ children: "Change"
11318
+ })]
11319
+ }), jsxs(ReviewValue, {
11320
+ children: [jsx("div", {
11321
+ "data-testid": testId,
11322
+ children: value != null ? value : ''
11323
+ }), requiredFields.includes(fieldName) && isMissing(value) && jsx(GoabFormItem, {
11324
+ error: `${fieldLabel} is required`,
11325
+ label: ""
11326
+ })]
11320
11327
  })]
11321
- })]
11322
- })
11323
- }, testId);
11328
+ })
11329
+ }, testId);
11330
+ };
11324
11331
  const {
11325
11332
  options
11326
11333
  } = uischema;
@@ -12188,7 +12195,7 @@ const ObjectArrayControl = props => {
12188
12195
  const isInReview = isStepperReview === true;
12189
12196
  const isListWithDetail = controlElement.type === 'ListWithDetail';
12190
12197
  if (isInReview) {
12191
- var _uischema$options6;
12198
+ var _uischema$options6, _uischema$options7;
12192
12199
  return jsx("tr", {
12193
12200
  children: jsxs(PageReviewContainer, {
12194
12201
  colSpan: 3,
@@ -12220,12 +12227,12 @@ const ObjectArrayControl = props => {
12220
12227
  },
12221
12228
  children: maxItemsError
12222
12229
  })]
12223
- }), ((_uischema$options6 = uischema.options) == null ? void 0 : _uischema$options6.stepId) !== undefined && jsx(GoabButton, {
12230
+ }), ((_uischema$options6 = uischema.options) == null ? void 0 : _uischema$options6.stepId) !== undefined && !((_uischema$options7 = uischema.options) != null && (_uischema$options7 = _uischema$options7.componentProps) != null && _uischema$options7.readOnly) && jsx(GoabButton, {
12224
12231
  type: "tertiary",
12225
12232
  size: "compact",
12226
12233
  onClick: () => {
12227
- var _uischema$options7;
12228
- return context == null ? void 0 : context.goToPage((_uischema$options7 = uischema.options) == null ? void 0 : _uischema$options7.stepId);
12234
+ var _uischema$options8;
12235
+ return context == null ? void 0 : context.goToPage((_uischema$options8 = uischema.options) == null ? void 0 : _uischema$options8.stepId);
12229
12236
  },
12230
12237
  children: "Change"
12231
12238
  })]
@@ -12636,7 +12643,7 @@ const AddressLookUpControlReview = props => {
12636
12643
  });
12637
12644
  };
12638
12645
  const AddressLoopUpControlTableReview = props => {
12639
- var _uischema$options, _schema$properties2, _provinces$find;
12646
+ var _uischema$options, _schema$properties2, _provinces$find, _uischema$options3;
12640
12647
  const {
12641
12648
  data,
12642
12649
  schema,
@@ -12741,6 +12748,7 @@ const AddressLoopUpControlTableReview = props => {
12741
12748
  // Build the target scope for the address control
12742
12749
  const targetScope = (uischema == null ? void 0 : uischema.scope) || (path ? `#/properties/${path}` : undefined);
12743
12750
  const renderRow = (label, value, propName, showButton = false) => {
12751
+ var _uischema$options2;
12744
12752
  let error = getError(propName);
12745
12753
  const required = isRequired(propName);
12746
12754
  if (required && !value && !error) {
@@ -12755,7 +12763,7 @@ const AddressLoopUpControlTableReview = props => {
12755
12763
  children: [label, required && jsx(RequiredTextLabel, {
12756
12764
  children: " (required)"
12757
12765
  })]
12758
- }), showButton && stepId !== undefined && jsx(GoabButton, {
12766
+ }), showButton && stepId !== undefined && !((_uischema$options2 = uischema.options) != null && (_uischema$options2 = _uischema$options2.componentProps) != null && _uischema$options2.readOnly) && jsx(GoabButton, {
12759
12767
  type: "tertiary",
12760
12768
  size: "compact",
12761
12769
  onClick: () => formStepperCtx == null ? void 0 : formStepperCtx.goToPage(stepId, targetScope),
@@ -12779,7 +12787,7 @@ const AddressLoopUpControlTableReview = props => {
12779
12787
  children: jsxs(ReviewHeader, {
12780
12788
  children: [jsx(ReviewLabel, {
12781
12789
  children: `${isAlbertaAddress ? 'Alberta' : 'Canada'} postal address`
12782
- }), stepId !== undefined && jsx(GoabButton, {
12790
+ }), stepId !== undefined && !((_uischema$options3 = uischema.options) != null && (_uischema$options3 = _uischema$options3.componentProps) != null && _uischema$options3.readOnly) && jsx(GoabButton, {
12783
12791
  type: "tertiary",
12784
12792
  size: "compact",
12785
12793
  onClick: () => formStepperCtx == null ? void 0 : formStepperCtx.goToPage(stepId, targetScope),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.60.2",
3
+ "version": "2.60.4",
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",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": "1.0.0",
3
- "generatedAt": "2026-04-15T21:58:29.714Z",
4
- "sourceCommit": "437fc5583187822f070dbda79b67b20daa47557d",
3
+ "generatedAt": "2026-04-16T17:49:58.442Z",
4
+ "sourceCommit": "6b13c854de609d2c21611e8510a9e430563515bc",
5
5
  "sourcePath": "libs/jsonforms-components/src/index.ts",
6
6
  "rendererCount": 33,
7
7
  "renderers": [
@@ -8,6 +8,9 @@ export declare const OPTION_DEFINITIONS: {
8
8
  enablePhone: {
9
9
  schema: boolean;
10
10
  };
11
+ placeholder: {
12
+ schema: string;
13
+ };
11
14
  emailFirst: {
12
15
  schema: boolean;
13
16
  };