@jsonforms/material-renderers 3.1.0-alpha.0 → 3.1.0-alpha.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/lib/controls/MaterialBooleanControl.d.ts +1 -1
- package/lib/controls/MaterialBooleanToggleControl.d.ts +1 -1
- package/lib/controls/index.d.ts +2 -2
- package/lib/jsonforms-react-material.cjs.js +79 -11
- package/lib/jsonforms-react-material.cjs.js.map +1 -1
- package/lib/jsonforms-react-material.esm.js +79 -11
- package/lib/jsonforms-react-material.esm.js.map +1 -1
- package/lib/mui-controls/MuiCheckbox.d.ts +6 -1
- package/lib/mui-controls/MuiToggle.d.ts +6 -1
- package/package.json +23 -12
- package/src/additional/ListWithDetailMasterItem.tsx +1 -1
- package/src/controls/MaterialBooleanControl.tsx +84 -23
- package/src/controls/MaterialBooleanToggleControl.tsx +84 -23
- package/src/mui-controls/MuiCheckbox.tsx +12 -5
- package/src/mui-controls/MuiToggle.tsx +12 -5
- package/docs/assets/css/main.css +0 -1
- package/docs/assets/images/icons.png +0 -0
- package/docs/assets/images/icons@2x.png +0 -0
- package/docs/assets/images/widgets.png +0 -0
- package/docs/assets/images/widgets@2x.png +0 -0
- package/docs/assets/js/main.js +0 -51
- package/docs/assets/js/search.json +0 -1
- package/docs/classes/combinatorproperties.html +0 -957
- package/docs/classes/materialanyofstringorenumcontrol.html +0 -822
- package/docs/classes/materialtablecontrol.html +0 -999
- package/docs/globals.html +0 -4492
- package/docs/index.html +0 -753
- package/docs/interfaces/ajvprops.html +0 -162
- package/docs/interfaces/arraylayouttoolbarprops.html +0 -253
- package/docs/interfaces/categorizationstate.html +0 -154
- package/docs/interfaces/categorizationstepperstate.html +0 -154
- package/docs/interfaces/combinatorpropertiesprops.html +0 -182
- package/docs/interfaces/deletedialogprops.html +0 -225
- package/docs/interfaces/dispatchpropsofexpandpanel.html +0 -296
- package/docs/interfaces/emptytableprops.html +0 -154
- package/docs/interfaces/expandpanelprops.html +0 -594
- package/docs/interfaces/inputref.html +0 -168
- package/docs/interfaces/jsonformstheme.html +0 -352
- package/docs/interfaces/materialcategorizationlayoutrendererprops.html +0 -460
- package/docs/interfaces/materialcategorizationstepperlayoutrendererprops.html +0 -394
- package/docs/interfaces/materiallabelablelayoutrendererprops.html +0 -328
- package/docs/interfaces/materiallayoutrendererprops.html +0 -317
- package/docs/interfaces/materialtabletoolbarprops.html +0 -302
- package/docs/interfaces/muitextinputprops.html +0 -168
- package/docs/interfaces/nonemptycellcomponentprops.html +0 -266
- package/docs/interfaces/nonemptycellprops.html +0 -277
- package/docs/interfaces/nonemptyrowprops.html +0 -366
- package/docs/interfaces/ownoneofprops.html +0 -308
- package/docs/interfaces/ownpropsofexpandpanel.html +0 -397
- package/docs/interfaces/ownpropsofnonemptycell.html +0 -229
- package/docs/interfaces/statepropsofexpandpanel.html +0 -445
- package/docs/interfaces/tableheadercellprops.html +0 -154
- package/docs/interfaces/tablerowsprop.html +0 -330
- package/docs/interfaces/validationprops.html +0 -168
- package/docs/interfaces/withdeletedialogsupport.html +0 -170
- package/docs/interfaces/withinput.html +0 -154
- package/docs/interfaces/withoptionlabel.html +0 -230
- package/example/index.html +0 -16
- package/example/index.ts +0 -31
- package/rollup.config.js +0 -51
- package/stats.html +0 -3279
- package/test/renderers/MatchMediaMock.ts +0 -36
- package/test/renderers/MaterialAllOfRenderer.test.tsx +0 -114
- package/test/renderers/MaterialAnyOfRenderer.test.tsx +0 -310
- package/test/renderers/MaterialAnyOfStringOrEnumControl.test.tsx +0 -126
- package/test/renderers/MaterialArrayControl.test.tsx +0 -633
- package/test/renderers/MaterialArrayLayout.test.tsx +0 -528
- package/test/renderers/MaterialBooleanCell.test.tsx +0 -374
- package/test/renderers/MaterialBooleanToggleCell.test.tsx +0 -466
- package/test/renderers/MaterialBooleanToggleControl.test.tsx +0 -469
- package/test/renderers/MaterialCategorizationLayout.test.tsx +0 -458
- package/test/renderers/MaterialCategorizationStepperLayout.test.tsx +0 -647
- package/test/renderers/MaterialDateCell.test.tsx +0 -303
- package/test/renderers/MaterialDateControl.test.tsx +0 -411
- package/test/renderers/MaterialDateTimeControl.test.tsx +0 -417
- package/test/renderers/MaterialEnumArrayRenderer.test.tsx +0 -207
- package/test/renderers/MaterialEnumCell.test.tsx +0 -88
- package/test/renderers/MaterialEnumControl.test.tsx +0 -75
- package/test/renderers/MaterialGroupLayout.test.tsx +0 -90
- package/test/renderers/MaterialInputControl.test.tsx +0 -370
- package/test/renderers/MaterialIntegerCell.test.tsx +0 -333
- package/test/renderers/MaterialLabelRenderer.test.tsx +0 -114
- package/test/renderers/MaterialLayouts.test.tsx +0 -542
- package/test/renderers/MaterialListWithDetailRenderer.test.tsx +0 -279
- package/test/renderers/MaterialNativeControl.test.tsx +0 -81
- package/test/renderers/MaterialNumberCell.test.tsx +0 -382
- package/test/renderers/MaterialObjectControl.test.tsx +0 -186
- package/test/renderers/MaterialOneOfEnumCell.test.tsx +0 -94
- package/test/renderers/MaterialOneOfRadioGroupControl.test.tsx +0 -108
- package/test/renderers/MaterialOneOfRenderer.test.tsx +0 -603
- package/test/renderers/MaterialRadioGroupControl.test.tsx +0 -125
- package/test/renderers/MaterialSliderControl.test.tsx +0 -438
- package/test/renderers/MaterialTextCell.test.tsx +0 -541
- package/test/renderers/MaterialTextControl.test.tsx +0 -115
- package/test/renderers/MaterialTimeCell.test.tsx +0 -331
- package/test/renderers/MaterialTimeControl.test.tsx +0 -411
- package/test/renderers/util.ts +0 -50
- package/tsconfig.json +0 -13
- package/tsconfig.test.json +0 -7
- package/webpack/webpack.dev.js +0 -11
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createDefaultValue, Resolve, encode, Paths, formatErrorMessage, errorsAt, rankWith, isObjectControl, findUISchema, Generate, isAllOfControl, findMatchingUISchema, createCombinatorRenderInfos, isAnyOfControl, isOneOfControl, getAjv, and, uiTypeIs, schemaMatches, hasType, schemaSubPathMatches, or, isObjectArrayControl, isPrimitiveArrayControl, isObjectArray, computeLabel, composePaths, isBooleanControl,
|
|
1
|
+
import { createDefaultValue, Resolve, encode, Paths, formatErrorMessage, errorsAt, rankWith, isObjectControl, findUISchema, Generate, isAllOfControl, findMatchingUISchema, createCombinatorRenderInfos, isAnyOfControl, isOneOfControl, getAjv, and, uiTypeIs, schemaMatches, hasType, schemaSubPathMatches, or, isObjectArrayControl, isPrimitiveArrayControl, isObjectArray, computeLabel, composePaths, isBooleanControl, isDescriptionHidden, optionIs, showAsRequired, isEnumControl, isDateControl, isTimeControl, isDateTimeControl, isRangeControl, isIntegerControl, isNumberControl, isStringControl, isOneOfEnumControl, withIncreasedRank, isVisible, deriveLabelForUISchemaElement, createId, removeId, getFirstPrimitiveProp, update, moveUp, moveDown, isObjectArrayWithNesting, isNumberFormatControl, categorizationHasCategory } from '@jsonforms/core';
|
|
2
2
|
import React, { useMemo, Fragment, useState, useCallback, useRef, useEffect } from 'react';
|
|
3
3
|
import { DispatchCell, useJsonForms, withJsonFormsArrayLayoutProps, withJsonFormsDetailProps, JsonFormsDispatch, withJsonFormsAllOfProps, withJsonFormsAnyOfProps, withJsonFormsOneOfProps, withJsonFormsMultiEnumProps, withJsonFormsLabelProps, withJsonFormsMasterListItemProps, withJsonFormsControlProps, withJsonFormsEnumProps, withTranslateProps, Control, withJsonFormsOneOfEnumProps, withJsonFormsLayoutProps, withJsonFormsContext, withJsonFormsCellProps, withJsonFormsEnumCellProps, withJsonFormsOneOfEnumCellProps } from '@jsonforms/react';
|
|
4
4
|
import isEmpty from 'lodash/isEmpty';
|
|
@@ -319,11 +319,13 @@ const materialOneOfControlTester = rankWith(3, isOneOfControl);
|
|
|
319
319
|
var MaterialOneOfRenderer$1 = withJsonFormsOneOfProps(MaterialOneOfRenderer);
|
|
320
320
|
|
|
321
321
|
const MuiCheckbox = React.memo((props) => {
|
|
322
|
-
const { data, className, id, enabled, uischema, path, handleChange, config } = props;
|
|
322
|
+
const { data, className, id, enabled, uischema, path, handleChange, config, inputProps } = props;
|
|
323
323
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
324
|
-
const
|
|
324
|
+
const inputPropsMerged = merge({}, inputProps, {
|
|
325
|
+
autoFocus: !!appliedUiSchemaOptions.focus
|
|
326
|
+
});
|
|
325
327
|
const checked = !!data;
|
|
326
|
-
return (React.createElement(Checkbox, { checked: checked, onChange: (_ev, isChecked) => handleChange(path, isChecked), className: className, id: id, disabled: !enabled, inputProps:
|
|
328
|
+
return (React.createElement(Checkbox, { checked: checked, onChange: (_ev, isChecked) => handleChange(path, isChecked), className: className, id: id, disabled: !enabled, inputProps: inputPropsMerged }));
|
|
327
329
|
});
|
|
328
330
|
|
|
329
331
|
dayjs.extend(customParsing);
|
|
@@ -586,24 +588,90 @@ const MaterialListWithDetailRenderer = ({ uischemas, schema, uischema, path, err
|
|
|
586
588
|
const materialListWithDetailTester = rankWith(4, and(uiTypeIs('ListWithDetail'), isObjectArray));
|
|
587
589
|
var MaterialListWithDetailRenderer$1 = withJsonFormsArrayLayoutProps(MaterialListWithDetailRenderer);
|
|
588
590
|
|
|
589
|
-
const MaterialBooleanControl = ({ data, visible, label, id, enabled, uischema, schema, rootSchema, handleChange, errors, path, config }) => {
|
|
591
|
+
const MaterialBooleanControl = ({ data, visible, label, id, enabled, uischema, schema, rootSchema, handleChange, errors, path, config, description }) => {
|
|
592
|
+
const isValid = errors.length === 0;
|
|
593
|
+
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
594
|
+
const showDescription = !isDescriptionHidden(visible, description,
|
|
595
|
+
false, appliedUiSchemaOptions.showUnfocusedDescription);
|
|
596
|
+
const showTooltip = !showDescription && !isDescriptionHidden(visible, description,
|
|
597
|
+
true,
|
|
598
|
+
true);
|
|
599
|
+
const firstFormHelperText = showDescription
|
|
600
|
+
? description
|
|
601
|
+
: !isValid
|
|
602
|
+
? errors
|
|
603
|
+
: null;
|
|
604
|
+
const secondFormHelperText = showDescription && !isValid ? errors : null;
|
|
605
|
+
const descriptionIds = [];
|
|
606
|
+
const tooltipId = `${id}-tip`;
|
|
607
|
+
const helpId1 = `${id}-help1`;
|
|
608
|
+
const helpId2 = `${id}-help2`;
|
|
609
|
+
if (showTooltip) {
|
|
610
|
+
descriptionIds.push(tooltipId);
|
|
611
|
+
}
|
|
612
|
+
if (firstFormHelperText) {
|
|
613
|
+
descriptionIds.push(helpId1);
|
|
614
|
+
}
|
|
615
|
+
if (secondFormHelperText) {
|
|
616
|
+
descriptionIds.push(helpId2);
|
|
617
|
+
}
|
|
618
|
+
const ariaDescribedBy = descriptionIds.join(' ');
|
|
590
619
|
return (React.createElement(Hidden, { xsUp: !visible },
|
|
591
|
-
React.createElement(
|
|
620
|
+
React.createElement(Tooltip, { id: tooltipId, title: (showTooltip) ? description : '' },
|
|
621
|
+
React.createElement(FormControlLabel, { label: label, id: id, control: React.createElement(MuiCheckbox, { id: `${id}-input`, isValid: isEmpty(errors), data: data, enabled: enabled, visible: visible, path: path, uischema: uischema, schema: schema, rootSchema: rootSchema, handleChange: handleChange, errors: errors, config: config, inputProps: {
|
|
622
|
+
'aria-describedby': ariaDescribedBy
|
|
623
|
+
} }) })),
|
|
624
|
+
React.createElement(FormHelperText, { id: helpId1, error: !isValid && !showDescription }, firstFormHelperText),
|
|
625
|
+
React.createElement(FormHelperText, { id: helpId2, error: !isValid }, secondFormHelperText)));
|
|
592
626
|
};
|
|
593
627
|
const materialBooleanControlTester = rankWith(2, isBooleanControl);
|
|
594
628
|
var MaterialBooleanControl$1 = withJsonFormsControlProps(MaterialBooleanControl);
|
|
595
629
|
|
|
596
630
|
const MuiToggle = React.memo((props) => {
|
|
597
|
-
const { data, className, id, enabled, uischema, path, handleChange, config } = props;
|
|
631
|
+
const { data, className, id, enabled, uischema, path, handleChange, config, inputProps } = props;
|
|
598
632
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
599
|
-
const
|
|
633
|
+
const inputPropsMerged = merge({}, inputProps, {
|
|
634
|
+
autoFocus: !!appliedUiSchemaOptions.focus
|
|
635
|
+
});
|
|
600
636
|
const checked = !!data;
|
|
601
|
-
return (React.createElement(Switch, { checked: checked, onChange: (_ev, isChecked) => handleChange(path, isChecked), className: className, id: id, disabled: !enabled, inputProps:
|
|
637
|
+
return (React.createElement(Switch, { checked: checked, onChange: (_ev, isChecked) => handleChange(path, isChecked), className: className, id: id, disabled: !enabled, inputProps: inputPropsMerged }));
|
|
602
638
|
});
|
|
603
639
|
|
|
604
|
-
const MaterialBooleanToggleControl = ({ data, visible, label, id, enabled, uischema, schema, rootSchema, handleChange, errors, path, config }) => {
|
|
640
|
+
const MaterialBooleanToggleControl = ({ data, visible, label, id, enabled, uischema, schema, rootSchema, handleChange, errors, path, config, description }) => {
|
|
641
|
+
const isValid = errors.length === 0;
|
|
642
|
+
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
643
|
+
const showDescription = !isDescriptionHidden(visible, description,
|
|
644
|
+
false, appliedUiSchemaOptions.showUnfocusedDescription);
|
|
645
|
+
const showTooltip = !showDescription && !isDescriptionHidden(visible, description,
|
|
646
|
+
true,
|
|
647
|
+
true);
|
|
648
|
+
const firstFormHelperText = showDescription
|
|
649
|
+
? description
|
|
650
|
+
: !isValid
|
|
651
|
+
? errors
|
|
652
|
+
: null;
|
|
653
|
+
const secondFormHelperText = showDescription && !isValid ? errors : null;
|
|
654
|
+
const descriptionIds = [];
|
|
655
|
+
const tooltipId = `${id}-tip`;
|
|
656
|
+
const helpId1 = `${id}-help1`;
|
|
657
|
+
const helpId2 = `${id}-help2`;
|
|
658
|
+
if (showTooltip) {
|
|
659
|
+
descriptionIds.push(tooltipId);
|
|
660
|
+
}
|
|
661
|
+
if (firstFormHelperText) {
|
|
662
|
+
descriptionIds.push(helpId1);
|
|
663
|
+
}
|
|
664
|
+
if (secondFormHelperText) {
|
|
665
|
+
descriptionIds.push(helpId2);
|
|
666
|
+
}
|
|
667
|
+
const ariaDescribedBy = descriptionIds.join(' ');
|
|
605
668
|
return (React.createElement(Hidden, { xsUp: !visible },
|
|
606
|
-
React.createElement(
|
|
669
|
+
React.createElement(Tooltip, { id: tooltipId, title: (showTooltip) ? description : '' },
|
|
670
|
+
React.createElement(FormControlLabel, { label: label, id: id, control: React.createElement(MuiToggle, { id: `${id}-input`, isValid: isEmpty(errors), data: data, enabled: enabled, visible: visible, path: path, uischema: uischema, schema: schema, rootSchema: rootSchema, handleChange: handleChange, errors: errors, config: config, inputProps: {
|
|
671
|
+
'aria-describedby': ariaDescribedBy
|
|
672
|
+
} }) })),
|
|
673
|
+
React.createElement(FormHelperText, { id: helpId1, error: !isValid && !showDescription }, firstFormHelperText),
|
|
674
|
+
React.createElement(FormHelperText, { id: helpId2, error: !isValid }, secondFormHelperText)));
|
|
607
675
|
};
|
|
608
676
|
const materialBooleanToggleControlTester = rankWith(3, and(isBooleanControl, optionIs('toggle', true)));
|
|
609
677
|
var MaterialBooleanToggleControl$1 = withJsonFormsControlProps(MaterialBooleanToggleControl);
|