@abgov/jsonforms-components 1.3.0 → 1.3.1

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
@@ -3703,7 +3703,7 @@ let _$4 = t => t,
3703
3703
  _t$4,
3704
3704
  _t2$2,
3705
3705
  _t3$1,
3706
- _t4,
3706
+ _t4$1,
3707
3707
  _t5,
3708
3708
  _t6,
3709
3709
  _t7;
@@ -3728,7 +3728,7 @@ const ReviewItemHeader = styled.div(_t3$1 || (_t3$1 = _$4`
3728
3728
  justify-content: space-between;
3729
3729
  margin-bottom: 2rem;
3730
3730
  `));
3731
- const ReviewItemTitle = styled.div(_t4 || (_t4 = _$4`
3731
+ const ReviewItemTitle = styled.div(_t4$1 || (_t4$1 = _$4`
3732
3732
  font-size: var(--fs-xl);
3733
3733
  line-height: var(--lh-lg);
3734
3734
  font-weight: var(--fw-light);
@@ -4213,7 +4213,8 @@ const ObjectArrayToolBar = /*#__PURE__*/React.memo(function TableToolbar({
4213
4213
  let _$1 = t => t,
4214
4214
  _t$1,
4215
4215
  _t2,
4216
- _t3;
4216
+ _t3,
4217
+ _t4;
4217
4218
  const DeleteDialogContent = styled.div(_t$1 || (_t$1 = _$1`
4218
4219
  margin-bottom: var(--goa-space-m);
4219
4220
  `));
@@ -4223,6 +4224,9 @@ const ToolBarHeader = styled.div(_t2 || (_t2 = _$1`
4223
4224
  const ObjectArrayTitle = styled.h2(_t3 || (_t3 = _$1`
4224
4225
  margin-bottom: var(--goa-space-l);
4225
4226
  `));
4227
+ const DisplayWrapper = styled.div(_t4 || (_t4 = _$1`
4228
+ display: ${0};
4229
+ `), p => p.visible ? 'initial' : 'none');
4226
4230
 
4227
4231
  // eslint-disable-next-line
4228
4232
  const extractScopesFromUISchema = uischema => {
@@ -4302,17 +4306,18 @@ const ctxToNonEmptyCellProps = (ctx, ownProps) => {
4302
4306
  renderers: ownProps.renderers || ctx.renderers
4303
4307
  };
4304
4308
  };
4305
- const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellComponent({
4306
- schema,
4307
- errors,
4308
- enabled,
4309
- renderers,
4310
- cells,
4311
- rowPath,
4312
- isValid,
4313
- uischema
4314
- }) {
4315
- var _a, _b;
4309
+ const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellComponent(props) {
4310
+ var _a, _b, _c;
4311
+ const {
4312
+ schema,
4313
+ errors,
4314
+ enabled,
4315
+ renderers,
4316
+ cells,
4317
+ rowPath,
4318
+ isValid,
4319
+ uischema
4320
+ } = props;
4316
4321
  const propNames = getValidColumnProps(schema);
4317
4322
  const propScopes = (uischema === null || uischema === void 0 ? void 0 : uischema.scope) ? propNames.map(name => {
4318
4323
  return `#/properties/${name}`;
@@ -4338,6 +4343,7 @@ const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellCompo
4338
4343
  // eslint-disable-next-line
4339
4344
  (_b = uischema === null || uischema === void 0 ? void 0 : uischema.elements) === null || _b === void 0 ? void 0 : _b.map(element => {
4340
4345
  return jsx(JsonFormsDispatch, {
4346
+ "data-testid": `jsonforms-object-list-defined-elements-dispatch`,
4341
4347
  schema: schema,
4342
4348
  uischema: element,
4343
4349
  path: rowPath,
@@ -4345,7 +4351,7 @@ const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellCompo
4345
4351
  renderers: renderers,
4346
4352
  cells: cells
4347
4353
  }, rowPath);
4348
- }), jsx(JsonFormsDispatch, {
4354
+ }), ((_c = uiSchemaElementsForNotDefined === null || uiSchemaElementsForNotDefined === void 0 ? void 0 : uiSchemaElementsForNotDefined.elements) === null || _c === void 0 ? void 0 : _c.length) > 0 && jsx(JsonFormsDispatch, {
4349
4355
  schema: schema,
4350
4356
  uischema: uiSchemaElementsForNotDefined,
4351
4357
  path: rowPath,
@@ -4457,38 +4463,37 @@ class ObjectArrayControl extends React.Component {
4457
4463
  const controlElement = uischema;
4458
4464
  // eslint-disable-next-line
4459
4465
  const listTitle = label || ((_a = uischema.options) === null || _a === void 0 ? void 0 : _a.title);
4460
- return jsx(Hidden, {
4461
- xsUp: !visible,
4462
- children: jsxs("div", {
4463
- children: [jsxs(ToolBarHeader, {
4464
- children: [listTitle && jsx(ObjectArrayTitle, {
4465
- children: listTitle
4466
- }), jsx(ObjectArrayToolBar, {
4467
- errors: errors,
4468
- label: label,
4469
- addItem: this.addItem,
4470
- numColumns: 0,
4471
- path: path,
4472
- uischema: controlElement,
4473
- schema: schema,
4474
- rootSchema: rootSchema,
4475
- enabled: enabled,
4476
- translations: translations
4477
- })]
4478
- }), jsx("div", {
4479
- children: jsx(ObjectArrayList, Object.assign({
4480
- path: path,
4481
- schema: schema,
4482
- uischema: uischema,
4483
- enabled: enabled,
4484
- openDeleteDialog: openDeleteDialog,
4485
- translations: translations,
4486
- data: data,
4487
- cells: cells,
4488
- config: config
4489
- }, additionalProps))
4466
+ return jsxs(DisplayWrapper, {
4467
+ visible: visible,
4468
+ "data-testid": "jsonforms-object-list-wrapper",
4469
+ children: [jsxs(ToolBarHeader, {
4470
+ children: [listTitle && jsx(ObjectArrayTitle, {
4471
+ children: listTitle
4472
+ }), jsx(ObjectArrayToolBar, {
4473
+ errors: errors,
4474
+ label: label,
4475
+ addItem: this.addItem,
4476
+ numColumns: 0,
4477
+ path: path,
4478
+ uischema: controlElement,
4479
+ schema: schema,
4480
+ rootSchema: rootSchema,
4481
+ enabled: enabled,
4482
+ translations: translations
4490
4483
  })]
4491
- })
4484
+ }), jsx("div", {
4485
+ children: jsx(ObjectArrayList, Object.assign({
4486
+ path: path,
4487
+ schema: schema,
4488
+ uischema: uischema,
4489
+ enabled: enabled,
4490
+ openDeleteDialog: openDeleteDialog,
4491
+ translations: translations,
4492
+ data: data,
4493
+ cells: cells,
4494
+ config: config
4495
+ }, additionalProps))
4496
+ })]
4492
4497
  });
4493
4498
  }
4494
4499
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
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,10 +1,24 @@
1
1
  import React from 'react';
2
- import { ArrayLayoutProps, ControlElement, JsonSchema, JsonFormsCellRendererRegistryEntry, ArrayTranslations } from '@jsonforms/core';
2
+ import { ArrayLayoutProps, ControlElement, JsonSchema, JsonFormsRendererRegistryEntry, JsonFormsCellRendererRegistryEntry, ArrayTranslations, Layout } from '@jsonforms/core';
3
3
  import { WithDeleteDialogSupport } from './DeleteDialog';
4
+ export type ObjectArrayControlProps = ArrayLayoutProps & WithDeleteDialogSupport;
4
5
  export interface EmptyListProps {
5
6
  numColumns: number;
6
7
  translations: ArrayTranslations;
7
8
  }
9
+ interface NonEmptyRowComponentProps {
10
+ propName?: string;
11
+ schema: JsonSchema;
12
+ rootSchema?: JsonSchema;
13
+ rowPath: string;
14
+ errors: string;
15
+ enabled: boolean;
16
+ renderers?: JsonFormsRendererRegistryEntry[];
17
+ cells?: JsonFormsCellRendererRegistryEntry[];
18
+ isValid: boolean;
19
+ uischema?: ControlElement | Layout;
20
+ }
21
+ export declare const NonEmptyCellComponent: React.NamedExoticComponent<NonEmptyRowComponentProps>;
8
22
  interface NonEmptyRowProps {
9
23
  childPath: string;
10
24
  schema: JsonSchema;
@@ -17,7 +31,7 @@ interface NonEmptyRowProps {
17
31
  uischema: ControlElement;
18
32
  }
19
33
  export declare const NonEmptyList: React.MemoExoticComponent<({ childPath, schema, rowIndex, openDeleteDialog, enabled, cells, path, translations, uischema, }: NonEmptyRowProps & WithDeleteDialogSupport) => import("react/jsx-runtime").JSX.Element>;
20
- export declare class ObjectArrayControl extends React.Component<ArrayLayoutProps & WithDeleteDialogSupport, any> {
34
+ export declare class ObjectArrayControl extends React.Component<ObjectArrayControlProps, any> {
21
35
  addItem: (path: string, value: any) => () => void;
22
36
  render(): import("react/jsx-runtime").JSX.Element;
23
37
  }
@@ -1,3 +1,6 @@
1
1
  export declare const DeleteDialogContent: import("styled-components").StyledComponent<"div", any, {}, never>;
2
2
  export declare const ToolBarHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
3
3
  export declare const ObjectArrayTitle: import("styled-components").StyledComponent<"h2", any, {}, never>;
4
+ export declare const DisplayWrapper: import("styled-components").StyledComponent<"div", any, {
5
+ visible: boolean;
6
+ }, never>;