@abgov/jsonforms-components 1.24.0 → 1.24.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.
Files changed (2) hide show
  1. package/index.esm.js +22 -7
  2. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -3402,7 +3402,7 @@ if (DESCRIPTORS$1 && isCallable$2(NativeSymbol) && (!('description' in SymbolPro
3402
3402
  }
3403
3403
 
3404
3404
  const GoAInputText = props => {
3405
- var _a, _b, _c, _d, _e, _f, _g;
3405
+ var _a, _b, _c, _d, _e, _f, _g, _h;
3406
3406
  const {
3407
3407
  data,
3408
3408
  config,
@@ -3424,7 +3424,8 @@ const GoAInputText = props => {
3424
3424
  value: data,
3425
3425
  width: '100%',
3426
3426
  readonly: readOnly,
3427
- placeholder: placeholder,
3427
+ placeholder: placeholder
3428
+ }, (_g = uischema.options) === null || _g === void 0 ? void 0 : _g.componentProps, {
3428
3429
  // maxLength={appliedUiSchemaOptions?.maxLength}
3429
3430
  name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
3430
3431
  testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
@@ -3447,7 +3448,7 @@ const GoAInputText = props => {
3447
3448
  value: autoCapitalize ? value.toUpperCase() : value
3448
3449
  });
3449
3450
  }
3450
- }, (_g = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _g === void 0 ? void 0 : _g.componentProps));
3451
+ }, (_h = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _h === void 0 ? void 0 : _h.componentProps));
3451
3452
  };
3452
3453
  const GoATextControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
3453
3454
  input: GoAInputText
@@ -5844,7 +5845,7 @@ const ctxToNonEmptyCellProps = (ctx, ownProps) => {
5844
5845
  };
5845
5846
  };
5846
5847
  const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellComponent(props) {
5847
- var _a, _b, _c;
5848
+ var _a, _b;
5848
5849
  const {
5849
5850
  schema,
5850
5851
  errors,
@@ -5863,11 +5864,25 @@ const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellCompo
5863
5864
  const scopesNotInElements = propScopes.filter(scope => {
5864
5865
  return !scopesInElements.includes(scope);
5865
5866
  });
5867
+ /**
5868
+ * Get the first layout type in the elements for the object array and used it
5869
+ * as the default type, if none is provided.
5870
+ * @returns layout type
5871
+ */
5872
+ const getFirstLayoutType = () => {
5873
+ var _a, _b, _c, _d, _e, _f, _g, _h;
5874
+ let defaultType = 'VerticalLayout';
5875
+ if ((_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.defaultType) return (_b = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _b === void 0 ? void 0 : _b.defaultType;
5876
+ if (((_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.detail) && ((_f = (_e = (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.detail) === null || _e === void 0 ? void 0 : _e.elements) === null || _f === void 0 ? void 0 : _f.length) > 0) {
5877
+ defaultType = (_h = (_g = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _g === void 0 ? void 0 : _g.detail) === null || _h === void 0 ? void 0 : _h.elements.at(0).type;
5878
+ }
5879
+ return defaultType;
5880
+ };
5866
5881
  /* Create default elements for scope not defined in the uischema
5867
5882
  * future work: merge the options
5868
5883
  */
5869
5884
  const uiSchemaElementsForNotDefined = {
5870
- type: ((_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.defaultType) || 'VerticalLayout',
5885
+ type: getFirstLayoutType(),
5871
5886
  elements: scopesNotInElements.map(scope => {
5872
5887
  return {
5873
5888
  type: 'Control',
@@ -5878,7 +5893,7 @@ const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellCompo
5878
5893
  return jsxs(Fragment, {
5879
5894
  children: [
5880
5895
  // eslint-disable-next-line
5881
- (_b = uischema === null || uischema === void 0 ? void 0 : uischema.elements) === null || _b === void 0 ? void 0 : _b.map(element => {
5896
+ (_a = uischema === null || uischema === void 0 ? void 0 : uischema.elements) === null || _a === void 0 ? void 0 : _a.map(element => {
5882
5897
  return jsx(JsonFormsDispatch, {
5883
5898
  "data-testid": `jsonforms-object-list-defined-elements-dispatch`,
5884
5899
  schema: schema,
@@ -5888,7 +5903,7 @@ const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellCompo
5888
5903
  renderers: renderers,
5889
5904
  cells: cells
5890
5905
  }, rowPath);
5891
- }), ((_c = uiSchemaElementsForNotDefined === null || uiSchemaElementsForNotDefined === void 0 ? void 0 : uiSchemaElementsForNotDefined.elements) === null || _c === void 0 ? void 0 : _c.length) > 0 && jsx(JsonFormsDispatch, {
5906
+ }), ((_b = uiSchemaElementsForNotDefined === null || uiSchemaElementsForNotDefined === void 0 ? void 0 : uiSchemaElementsForNotDefined.elements) === null || _b === void 0 ? void 0 : _b.length) > 0 && jsx(JsonFormsDispatch, {
5892
5907
  schema: schema,
5893
5908
  uischema: uiSchemaElementsForNotDefined,
5894
5909
  path: rowPath,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "1.24.0",
3
+ "version": "1.24.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",