@data-driven-forms/mui-component-mapper 4.1.13 → 4.1.14
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/.eslintrc.json +27 -0
- package/CHANGELOG.md +11 -3
- package/checkbox/checkbox.d.ts +29 -16
- package/checkbox/checkbox.js +44 -77
- package/checkbox/checkbox.js.map +1 -0
- package/checkbox/index.js +22 -24
- package/checkbox/index.js.map +1 -0
- package/component-mapper/component-mapper.d.ts +35 -40
- package/component-mapper/component-mapper.js +55 -40
- package/component-mapper/component-mapper.js.map +1 -0
- package/component-mapper/index.js +22 -24
- package/component-mapper/index.js.map +1 -0
- package/date-picker/date-picker.d.ts +10 -10
- package/date-picker/date-picker.js +52 -63
- package/date-picker/date-picker.js.map +1 -0
- package/date-picker/index.js +22 -24
- package/date-picker/index.js.map +1 -0
- package/dual-list-select/dual-list-select.d.ts +3 -111
- package/dual-list-select/dual-list-select.js +93 -412
- package/dual-list-select/dual-list-select.js.map +1 -0
- package/dual-list-select/index.js +22 -24
- package/dual-list-select/index.js.map +1 -0
- package/esm/checkbox/checkbox.d.ts +31 -0
- package/esm/checkbox/checkbox.js +25 -69
- package/esm/checkbox/checkbox.js.map +1 -0
- package/esm/checkbox/index.d.ts +2 -0
- package/esm/checkbox/index.js +2 -1
- package/esm/checkbox/index.js.map +1 -0
- package/esm/component-mapper/component-mapper.d.ts +36 -0
- package/esm/component-mapper/component-mapper.js +34 -19
- package/esm/component-mapper/component-mapper.js.map +1 -0
- package/esm/component-mapper/index.d.ts +2 -0
- package/esm/component-mapper/index.js +2 -1
- package/esm/component-mapper/index.js.map +1 -0
- package/esm/date-picker/date-picker.d.ts +12 -0
- package/esm/date-picker/date-picker.js +35 -55
- package/esm/date-picker/date-picker.js.map +1 -0
- package/esm/date-picker/index.d.ts +2 -0
- package/esm/date-picker/index.js +2 -1
- package/esm/date-picker/index.js.map +1 -0
- package/esm/dual-list-select/dual-list-select.d.ts +3 -0
- package/esm/dual-list-select/dual-list-select.js +59 -404
- package/esm/dual-list-select/dual-list-select.js.map +1 -0
- package/esm/dual-list-select/index.d.ts +2 -0
- package/esm/dual-list-select/index.js +2 -1
- package/esm/dual-list-select/index.js.map +1 -0
- package/esm/field-array/field-array.d.ts +56 -0
- package/esm/field-array/field-array.js +107 -296
- package/esm/field-array/field-array.js.map +1 -0
- package/esm/field-array/index.d.ts +2 -0
- package/esm/field-array/index.js +2 -1
- package/esm/field-array/index.js.map +1 -0
- package/esm/form-field-grid/form-field-grid.d.ts +8 -0
- package/esm/form-field-grid/form-field-grid.js +26 -22
- package/esm/form-field-grid/form-field-grid.js.map +1 -0
- package/esm/form-field-grid/index.d.ts +2 -0
- package/esm/form-field-grid/index.js +3 -1
- package/esm/form-field-grid/index.js.map +1 -0
- package/esm/form-template/form-template.d.ts +17 -0
- package/esm/form-template/form-template.js +57 -126
- package/esm/form-template/form-template.js.map +1 -0
- package/esm/form-template/index.d.ts +2 -0
- package/esm/form-template/index.js +2 -1
- package/esm/form-template/index.js.map +1 -0
- package/esm/index.d.ts +21 -0
- package/esm/index.js +3 -2
- package/esm/index.js.map +1 -0
- package/esm/multiple-choice-list/index.d.ts +2 -0
- package/esm/multiple-choice-list/index.js +2 -1
- package/esm/multiple-choice-list/index.js.map +1 -0
- package/esm/multiple-choice-list/multiple-choice-list.d.ts +14 -0
- package/esm/multiple-choice-list/multiple-choice-list.js +39 -93
- package/esm/multiple-choice-list/multiple-choice-list.js.map +1 -0
- package/esm/plain-text/index.d.ts +2 -0
- package/esm/plain-text/index.js +2 -1
- package/esm/plain-text/index.js.map +1 -0
- package/esm/plain-text/plain-text.d.ts +12 -0
- package/esm/plain-text/plain-text.js +18 -27
- package/esm/plain-text/plain-text.js.map +1 -0
- package/esm/radio/index.d.ts +2 -0
- package/esm/radio/index.js +2 -1
- package/esm/radio/index.js.map +1 -0
- package/esm/radio/radio.d.ts +19 -0
- package/esm/radio/radio.js +38 -110
- package/esm/radio/radio.js.map +1 -0
- package/esm/select/index.d.ts +2 -0
- package/esm/select/index.js +2 -1
- package/esm/select/index.js.map +1 -0
- package/esm/select/select.d.ts +44 -0
- package/esm/select/select.js +55 -162
- package/esm/select/select.js.map +1 -0
- package/esm/slider/index.d.ts +2 -0
- package/esm/slider/index.js +2 -1
- package/esm/slider/index.js.map +1 -0
- package/esm/slider/slider.d.ts +24 -0
- package/esm/slider/slider.js +22 -63
- package/esm/slider/slider.js.map +1 -0
- package/esm/sub-form/index.d.ts +2 -0
- package/esm/sub-form/index.js +2 -1
- package/esm/sub-form/index.js.map +1 -0
- package/esm/sub-form/sub-form.d.ts +16 -0
- package/esm/sub-form/sub-form.js +29 -52
- package/esm/sub-form/sub-form.js.map +1 -0
- package/esm/switch/index.d.ts +2 -0
- package/esm/switch/index.js +2 -1
- package/esm/switch/index.js.map +1 -0
- package/esm/switch/switch.d.ts +18 -0
- package/esm/switch/switch.js +21 -62
- package/esm/switch/switch.js.map +1 -0
- package/esm/tabs/index.d.ts +2 -0
- package/esm/tabs/index.js +2 -1
- package/esm/tabs/index.js.map +1 -0
- package/esm/tabs/tabs.d.ts +19 -0
- package/esm/tabs/tabs.js +9 -73
- package/esm/tabs/tabs.js.map +1 -0
- package/esm/text-field/index.d.ts +2 -0
- package/esm/text-field/index.js +2 -1
- package/esm/text-field/index.js.map +1 -0
- package/esm/text-field/text-field.d.ts +10 -0
- package/esm/text-field/text-field.js +20 -38
- package/esm/text-field/text-field.js.map +1 -0
- package/esm/textarea/index.d.ts +2 -0
- package/esm/textarea/index.js +2 -1
- package/esm/textarea/index.js.map +1 -0
- package/esm/textarea/textarea.d.ts +13 -0
- package/esm/textarea/textarea.js +20 -42
- package/esm/textarea/textarea.js.map +1 -0
- package/esm/time-picker/index.d.ts +2 -0
- package/esm/time-picker/index.js +2 -1
- package/esm/time-picker/index.js.map +1 -0
- package/esm/time-picker/time-picker.d.ts +13 -0
- package/esm/time-picker/time-picker.js +35 -57
- package/esm/time-picker/time-picker.js.map +1 -0
- package/esm/validation-error/index.d.ts +2 -0
- package/esm/validation-error/index.js +2 -1
- package/esm/validation-error/index.js.map +1 -0
- package/esm/validation-error/validation-error.d.ts +6 -0
- package/esm/validation-error/validation-error.js +7 -6
- package/esm/validation-error/validation-error.js.map +1 -0
- package/esm/wizard/index.d.ts +2 -0
- package/esm/wizard/index.js +2 -1
- package/esm/wizard/index.js.map +1 -0
- package/esm/wizard/step-buttons.d.ts +33 -0
- package/esm/wizard/step-buttons.js +49 -104
- package/esm/wizard/step-buttons.js.map +1 -0
- package/esm/wizard/wizard-nav.d.ts +15 -0
- package/esm/wizard/wizard-nav.js +15 -33
- package/esm/wizard/wizard-nav.js.map +1 -0
- package/esm/wizard/wizard.d.ts +4 -0
- package/esm/wizard/wizard.js +21 -70
- package/esm/wizard/wizard.js.map +1 -0
- package/field-array/field-array.d.ts +54 -38
- package/field-array/field-array.js +138 -306
- package/field-array/field-array.js.map +1 -0
- package/field-array/index.js +22 -24
- package/field-array/index.js.map +1 -0
- package/form-field-grid/form-field-grid.d.ts +7 -5
- package/form-field-grid/form-field-grid.js +42 -28
- package/form-field-grid/form-field-grid.js.map +1 -0
- package/form-field-grid/index.js +23 -12
- package/form-field-grid/index.js.map +1 -0
- package/form-template/form-template.d.ts +17 -5
- package/form-template/form-template.js +78 -132
- package/form-template/form-template.js.map +1 -0
- package/form-template/index.js +22 -24
- package/form-template/index.js.map +1 -0
- package/index.d.ts +10 -29
- package/index.js +45 -146
- package/index.js.map +1 -0
- package/multiple-choice-list/index.js +22 -24
- package/multiple-choice-list/index.js.map +1 -0
- package/multiple-choice-list/multiple-choice-list.d.ts +12 -24
- package/multiple-choice-list/multiple-choice-list.js +53 -101
- package/multiple-choice-list/multiple-choice-list.js.map +1 -0
- package/package.json +8 -10
- package/plain-text/index.js +22 -24
- package/plain-text/index.js.map +1 -0
- package/plain-text/plain-text.d.ts +10 -10
- package/plain-text/plain-text.js +30 -33
- package/plain-text/plain-text.js.map +1 -0
- package/radio/index.js +22 -24
- package/radio/index.js.map +1 -0
- package/radio/radio.d.ts +17 -25
- package/radio/radio.js +56 -116
- package/radio/radio.js.map +1 -0
- package/select/index.js +22 -24
- package/select/index.js.map +1 -0
- package/select/select.d.ts +42 -27
- package/select/select.js +78 -172
- package/select/select.js.map +1 -0
- package/slider/index.js +22 -24
- package/slider/index.js.map +1 -0
- package/slider/slider.d.ts +22 -28
- package/slider/slider.js +39 -71
- package/slider/slider.js.map +1 -0
- package/sub-form/index.js +22 -24
- package/sub-form/index.js.map +1 -0
- package/sub-form/sub-form.d.ts +14 -16
- package/sub-form/sub-form.js +42 -56
- package/sub-form/sub-form.js.map +1 -0
- package/switch/index.js +22 -24
- package/switch/index.js.map +1 -0
- package/switch/switch.d.ts +16 -26
- package/switch/switch.js +43 -70
- package/switch/switch.js.map +1 -0
- package/tabs/index.js +22 -24
- package/tabs/index.js.map +1 -0
- package/tabs/tabs.d.ts +18 -14
- package/tabs/tabs.js +33 -82
- package/tabs/tabs.js.map +1 -0
- package/text-field/index.js +22 -24
- package/text-field/index.js.map +1 -0
- package/text-field/text-field.d.ts +8 -16
- package/text-field/text-field.js +37 -46
- package/text-field/text-field.js.map +1 -0
- package/textarea/index.js +22 -24
- package/textarea/index.js.map +1 -0
- package/textarea/textarea.d.ts +11 -17
- package/textarea/textarea.js +37 -50
- package/textarea/textarea.js.map +1 -0
- package/time-picker/index.js +22 -24
- package/time-picker/index.js.map +1 -0
- package/time-picker/time-picker.d.ts +11 -16
- package/time-picker/time-picker.js +52 -65
- package/time-picker/time-picker.js.map +1 -0
- package/tsconfig.cjs.json +8 -0
- package/tsconfig.demo.json +31 -0
- package/tsconfig.esm.json +8 -0
- package/tsconfig.json +17 -9
- package/validation-error/index.js +22 -24
- package/validation-error/index.js.map +1 -0
- package/validation-error/validation-error.d.ts +5 -4
- package/validation-error/validation-error.js +10 -11
- package/validation-error/validation-error.js.map +1 -0
- package/wizard/index.js +22 -24
- package/wizard/index.js.map +1 -0
- package/wizard/step-buttons.d.ts +33 -0
- package/wizard/step-buttons.js +68 -110
- package/wizard/step-buttons.js.map +1 -0
- package/wizard/wizard-nav.d.ts +15 -0
- package/wizard/wizard-nav.js +37 -37
- package/wizard/wizard-nav.js.map +1 -0
- package/wizard/wizard.d.ts +4 -28
- package/wizard/wizard.js +41 -79
- package/wizard/wizard.js.map +1 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TypographyProps, GridProps } from '@mui/material';
|
|
3
|
+
import type { Field } from '@data-driven-forms/react-form-renderer';
|
|
4
|
+
export interface SubFormProps extends Omit<GridProps, 'component' | 'title'> {
|
|
5
|
+
fields: Field[];
|
|
6
|
+
title?: React.ReactNode;
|
|
7
|
+
description?: React.ReactNode;
|
|
8
|
+
component?: string;
|
|
9
|
+
TitleGridProps?: GridProps;
|
|
10
|
+
TitleProps?: TypographyProps;
|
|
11
|
+
DescriptionProps?: TypographyProps;
|
|
12
|
+
DescriptionGridProps?: GridProps;
|
|
13
|
+
ItemsGridProps?: GridProps;
|
|
14
|
+
}
|
|
15
|
+
declare const SubForm: React.FC<SubFormProps>;
|
|
16
|
+
export default SubForm;
|
package/esm/sub-form/sub-form.js
CHANGED
|
@@ -1,55 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
13
|
import { styled } from '@mui/material/styles';
|
|
7
|
-
import Typography from
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
grid: "".concat(PREFIX, "-grid")
|
|
14
|
+
import { Typography, Grid } from '@mui/material';
|
|
15
|
+
import { useFormApi } from '@data-driven-forms/react-form-renderer';
|
|
16
|
+
const PREFIX = 'SubForm';
|
|
17
|
+
const classes = {
|
|
18
|
+
grid: `${PREFIX}-grid`,
|
|
13
19
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
description
|
|
24
|
-
component = _ref2.component,
|
|
25
|
-
TitleGridProps = _ref2.TitleGridProps,
|
|
26
|
-
TitleProps = _ref2.TitleProps,
|
|
27
|
-
DescriptionProps = _ref2.DescriptionProps,
|
|
28
|
-
DescriptionGridProps = _ref2.DescriptionGridProps,
|
|
29
|
-
ItemsGridProps = _ref2.ItemsGridProps,
|
|
30
|
-
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
31
|
-
var _useFormApi = useFormApi(),
|
|
32
|
-
renderForm = _useFormApi.renderForm;
|
|
33
|
-
return /*#__PURE__*/React.createElement(StyledGrid, _extends({
|
|
34
|
-
item: true,
|
|
35
|
-
xs: 12,
|
|
36
|
-
container: true,
|
|
37
|
-
className: classes.grid
|
|
38
|
-
}, rest), title && /*#__PURE__*/React.createElement(Grid, _extends({
|
|
39
|
-
item: true,
|
|
40
|
-
xs: 12
|
|
41
|
-
}, TitleGridProps), /*#__PURE__*/React.createElement(Typography, _extends({
|
|
42
|
-
variant: "h5"
|
|
43
|
-
}, TitleProps), title)), description && /*#__PURE__*/React.createElement(Grid, _extends({
|
|
44
|
-
item: true,
|
|
45
|
-
xs: 12
|
|
46
|
-
}, DescriptionGridProps), /*#__PURE__*/React.createElement(Typography, _extends({
|
|
47
|
-
paragraph: true
|
|
48
|
-
}, DescriptionProps), description)), /*#__PURE__*/React.createElement(Grid, _extends({
|
|
49
|
-
item: true,
|
|
50
|
-
xs: 12,
|
|
51
|
-
container: true,
|
|
52
|
-
rowSpacing: 2
|
|
53
|
-
}, ItemsGridProps), renderForm(fields)));
|
|
20
|
+
const StyledGrid = styled(Grid)(() => ({
|
|
21
|
+
[`&.${classes.grid}`]: {
|
|
22
|
+
paddingRight: 0,
|
|
23
|
+
paddingLeft: 0,
|
|
24
|
+
},
|
|
25
|
+
}));
|
|
26
|
+
const SubForm = (_a) => {
|
|
27
|
+
var { fields, title, description, component, TitleGridProps = {}, TitleProps = {}, DescriptionProps = {}, DescriptionGridProps = {}, ItemsGridProps = {} } = _a, rest = __rest(_a, ["fields", "title", "description", "component", "TitleGridProps", "TitleProps", "DescriptionProps", "DescriptionGridProps", "ItemsGridProps"]);
|
|
28
|
+
const { renderForm } = useFormApi();
|
|
29
|
+
return (_jsxs(StyledGrid, Object.assign({ item: true, xs: 12, container: true, className: classes.grid }, rest, { children: [title && (_jsx(Grid, Object.assign({ item: true, xs: 12 }, TitleGridProps, { children: _jsx(Typography, Object.assign({ variant: "h5" }, TitleProps, { children: title })) }))), description && (_jsx(Grid, Object.assign({ item: true, xs: 12 }, DescriptionGridProps, { children: _jsx(Typography, Object.assign({ paragraph: true }, DescriptionProps, { children: description })) }))), _jsx(Grid, Object.assign({ item: true, xs: 12, container: true, rowSpacing: 2 }, ItemsGridProps, { children: renderForm(fields) }))] })));
|
|
54
30
|
};
|
|
55
|
-
export default SubForm;
|
|
31
|
+
export default SubForm;
|
|
32
|
+
//# sourceMappingURL=sub-form.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sub-form.js","sourceRoot":"","sources":["../../src/sub-form/sub-form.tsx"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CA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I,QAAC,EAAE,EAAE,EAAE,EAAE,SAAS,QAAC,UAAU,EAAE,CAAC,IAAM,cAAc,cAC3D,UAAU,CAAC,MAAM,CAAC,IACd,KACI,CACd,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
package/esm/switch/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/switch/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { FormControlLabelProps, FormHelperTextProps, FormControlProps, FormGroupProps, FormLabelProps, SwitchProps as MUISwitchProps } from '@mui/material';
|
|
3
|
+
import type { BaseFieldProps } from '@data-driven-forms/react-form-renderer';
|
|
4
|
+
import type { FormFieldGridProps } from '../form-field-grid/form-field-grid';
|
|
5
|
+
export interface SwitchProps extends BaseFieldProps {
|
|
6
|
+
onText?: string;
|
|
7
|
+
offText?: string;
|
|
8
|
+
FormFieldGridProps?: FormFieldGridProps;
|
|
9
|
+
FormControlProps?: FormControlProps;
|
|
10
|
+
FormGroupProps?: FormGroupProps;
|
|
11
|
+
FormControlLabelProps?: FormControlLabelProps;
|
|
12
|
+
SwitchProps?: MUISwitchProps;
|
|
13
|
+
FormLabelProps?: FormLabelProps;
|
|
14
|
+
FormHelperTextProps?: FormHelperTextProps;
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}
|
|
17
|
+
export declare const Switch: React.FC<SwitchProps>;
|
|
18
|
+
export default Switch;
|
package/esm/switch/switch.js
CHANGED
|
@@ -1,65 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import
|
|
13
|
-
import MUISwitch from
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { FormControlLabel, FormHelperText, FormControl, FormGroup, FormLabel, Switch as MUISwitch } from '@mui/material';
|
|
14
|
+
import { useFieldApi } from '@data-driven-forms/react-form-renderer';
|
|
14
15
|
import FormFieldGrid from '../form-field-grid/form-field-grid';
|
|
15
16
|
import { validationError } from '../validation-error/validation-error';
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
})),
|
|
21
|
-
input = _useFieldApi.input,
|
|
22
|
-
isReadOnly = _useFieldApi.isReadOnly,
|
|
23
|
-
isDisabled = _useFieldApi.isDisabled,
|
|
24
|
-
isRequired = _useFieldApi.isRequired,
|
|
25
|
-
label = _useFieldApi.label,
|
|
26
|
-
helperText = _useFieldApi.helperText,
|
|
27
|
-
description = _useFieldApi.description,
|
|
28
|
-
validateOnMount = _useFieldApi.validateOnMount,
|
|
29
|
-
meta = _useFieldApi.meta,
|
|
30
|
-
onText = _useFieldApi.onText,
|
|
31
|
-
offText = _useFieldApi.offText,
|
|
32
|
-
_useFieldApi$FormFiel = _useFieldApi.FormFieldGridProps,
|
|
33
|
-
FormFieldGridProps = _useFieldApi$FormFiel === void 0 ? {} : _useFieldApi$FormFiel,
|
|
34
|
-
_useFieldApi$FormCont = _useFieldApi.FormControlProps,
|
|
35
|
-
FormControlProps = _useFieldApi$FormCont === void 0 ? {} : _useFieldApi$FormCont,
|
|
36
|
-
_useFieldApi$FormGrou = _useFieldApi.FormGroupProps,
|
|
37
|
-
FormGroupProps = _useFieldApi$FormGrou === void 0 ? {} : _useFieldApi$FormGrou,
|
|
38
|
-
_useFieldApi$FormCont2 = _useFieldApi.FormControlLabelProps,
|
|
39
|
-
FormControlLabelProps = _useFieldApi$FormCont2 === void 0 ? {} : _useFieldApi$FormCont2,
|
|
40
|
-
_useFieldApi$SwitchPr = _useFieldApi.SwitchProps,
|
|
41
|
-
SwitchProps = _useFieldApi$SwitchPr === void 0 ? {} : _useFieldApi$SwitchPr,
|
|
42
|
-
_useFieldApi$FormLabe = _useFieldApi.FormLabelProps,
|
|
43
|
-
FormLabelProps = _useFieldApi$FormLabe === void 0 ? {} : _useFieldApi$FormLabe,
|
|
44
|
-
_useFieldApi$FormHelp = _useFieldApi.FormHelperTextProps,
|
|
45
|
-
FormHelperTextProps = _useFieldApi$FormHelp === void 0 ? {} : _useFieldApi$FormHelp,
|
|
46
|
-
rest = _objectWithoutProperties(_useFieldApi, _excluded);
|
|
47
|
-
var invalid = validationError(meta, validateOnMount);
|
|
48
|
-
var text = invalid || (meta.touched || validateOnMount) && meta.warning || helperText || description;
|
|
49
|
-
return /*#__PURE__*/React.createElement(FormFieldGrid, FormFieldGridProps, /*#__PURE__*/React.createElement(FormControl, _extends({
|
|
50
|
-
required: isRequired,
|
|
51
|
-
error: !!invalid,
|
|
52
|
-
component: "fieldset"
|
|
53
|
-
}, FormControlProps), /*#__PURE__*/React.createElement(FormGroup, FormGroupProps, /*#__PURE__*/React.createElement(FormControlLabel, _extends({
|
|
54
|
-
control: /*#__PURE__*/React.createElement(MUISwitch, _extends({}, rest, input, {
|
|
55
|
-
readOnly: isReadOnly,
|
|
56
|
-
disabled: isDisabled || isReadOnly,
|
|
57
|
-
onChange: function onChange(_ref) {
|
|
58
|
-
var checked = _ref.target.checked;
|
|
59
|
-
return input.onChange(checked);
|
|
60
|
-
}
|
|
61
|
-
}, SwitchProps)),
|
|
62
|
-
label: /*#__PURE__*/React.createElement(FormLabel, FormLabelProps, input.checked ? onText || label : offText || label)
|
|
63
|
-
}, FormControlLabelProps)), text && /*#__PURE__*/React.createElement(FormHelperText, FormHelperTextProps, text))));
|
|
17
|
+
export const Switch = (props) => {
|
|
18
|
+
const _a = useFieldApi(Object.assign(Object.assign({}, props), { type: 'checkbox' })), { input, isReadOnly, isDisabled, isRequired, label, helperText, description, validateOnMount, meta, onText, offText, FormFieldGridProps = {}, FormControlProps = {}, FormGroupProps = {}, FormControlLabelProps = {}, SwitchProps = {}, FormLabelProps = {}, FormHelperTextProps = {} } = _a, rest = __rest(_a, ["input", "isReadOnly", "isDisabled", "isRequired", "label", "helperText", "description", "validateOnMount", "meta", "onText", "offText", "FormFieldGridProps", "FormControlProps", "FormGroupProps", "FormControlLabelProps", "SwitchProps", "FormLabelProps", "FormHelperTextProps"]);
|
|
19
|
+
const invalid = validationError(meta, validateOnMount);
|
|
20
|
+
const text = invalid || ((meta.touched || validateOnMount) && meta.warning) || helperText || description;
|
|
21
|
+
return (_jsx(FormFieldGrid, Object.assign({}, FormFieldGridProps, { children: _jsx(FormControl, Object.assign({ required: isRequired, error: !!invalid, component: "fieldset" }, FormControlProps, { children: _jsxs(FormGroup, Object.assign({}, FormGroupProps, { children: [_jsx(FormControlLabel, Object.assign({ control: _jsx(MUISwitch, Object.assign({}, rest, input, { readOnly: isReadOnly, disabled: isDisabled || isReadOnly, onChange: ({ target: { checked } }) => input.onChange(checked) }, SwitchProps)), label: _jsx(FormLabel, Object.assign({}, FormLabelProps, { children: input.checked ? onText || label : offText || label })) }, FormControlLabelProps)), text && _jsx(FormHelperText, Object.assign({}, FormHelperTextProps, { children: text }))] })) })) })));
|
|
64
22
|
};
|
|
65
|
-
export default Switch;
|
|
23
|
+
export default Switch;
|
|
24
|
+
//# sourceMapp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UAAU,IAAK,gBAAgB,cAC5F,MAAC,SAAS,oBAAK,cAAc,eAC3B,KAAC,gBAAgB,kBACf,OAAO,EACL,KAAC,SAAS,oBACJ,IAAI,EACJ,KAAK,IACT,QAAQ,EAAE,UAAU,EACpB,QAAQ,EAAE,UAAU,IAAI,UAAU,EAClC,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,IAC1D,WAAW,EACf,EAEJ,KAAK,EAAE,KAAC,SAAS,oBAAK,cAAc,cAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,OAAO,IAAI,KAAK,IAAa,IAClG,qBAAqB,EACzB,EACD,IAAI,IAAI,KAAC,cAAc,oBAAK,mBAAmB,cAAG,IAAI,IAAkB,KAC/D,IACA,IACA,CACjB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/esm/tabs/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tabs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AppBarProps, GridProps, TabProps as MUITabProps, TabsProps } from '@mui/material';
|
|
3
|
+
import type { FormFieldGridProps } from '../form-field-grid/form-field-grid';
|
|
4
|
+
import type { Field } from '@data-driven-forms/react-form-renderer';
|
|
5
|
+
interface TabField {
|
|
6
|
+
fields: Field[];
|
|
7
|
+
title?: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface FormTabsProps {
|
|
11
|
+
fields: TabField[];
|
|
12
|
+
AppBarProps?: AppBarProps;
|
|
13
|
+
TabsProps?: TabsProps;
|
|
14
|
+
TabProps?: MUITabProps;
|
|
15
|
+
FormFieldGridProps?: FormFieldGridProps;
|
|
16
|
+
GridItemProps?: GridProps;
|
|
17
|
+
}
|
|
18
|
+
declare const FormTabs: React.FC<FormTabsProps>;
|
|
19
|
+
export default FormTabs;
|
package/esm/tabs/tabs.js
CHANGED
|
@@ -1,76 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
-
import React, { useState } from 'react';
|
|
7
|
-
import AppBar from "@mui/material/AppBar";
|
|
8
|
-
import Grid from "@mui/material/Grid";
|
|
9
|
-
import Tab from "@mui/material/Tab";
|
|
10
|
-
import Tabs from "@mui/material/Tabs";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { AppBar, Grid, Tab, Tabs } from '@mui/material';
|
|
11
4
|
import FormFieldGrid from '../form-field-grid';
|
|
12
|
-
import useFormApi from
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
_ref$TabsProps = _ref.TabsProps,
|
|
18
|
-
TabsProps = _ref$TabsProps === void 0 ? {} : _ref$TabsProps,
|
|
19
|
-
_ref$TabProps = _ref.TabProps,
|
|
20
|
-
TabProps = _ref$TabProps === void 0 ? {} : _ref$TabProps,
|
|
21
|
-
_ref$FormFieldGridPro = _ref.FormFieldGridProps,
|
|
22
|
-
FormFieldGridProps = _ref$FormFieldGridPro === void 0 ? {} : _ref$FormFieldGridPro,
|
|
23
|
-
_ref$GridItemProps = _ref.GridItemProps,
|
|
24
|
-
GridItemProps = _ref$GridItemProps === void 0 ? {} : _ref$GridItemProps;
|
|
25
|
-
var formOptions = useFormApi();
|
|
26
|
-
var _useState = useState(0),
|
|
27
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
28
|
-
activeTab = _useState2[0],
|
|
29
|
-
setActiveTab = _useState2[1];
|
|
30
|
-
return /*#__PURE__*/React.createElement(FormFieldGrid, _extends({
|
|
31
|
-
container: true
|
|
32
|
-
}, FormFieldGridProps), /*#__PURE__*/React.createElement(AppBar, _extends({
|
|
33
|
-
position: "static"
|
|
34
|
-
}, AppBarProps), /*#__PURE__*/React.createElement(Tabs, _extends({
|
|
35
|
-
textColor: "inherit",
|
|
36
|
-
value: activeTab,
|
|
37
|
-
onChange: function onChange(_e, tabIndex) {
|
|
38
|
-
return setActiveTab(tabIndex);
|
|
39
|
-
}
|
|
40
|
-
}, TabsProps), fields.map(function (_ref2) {
|
|
41
|
-
var title = _ref2.title,
|
|
42
|
-
name = _ref2.name;
|
|
43
|
-
return /*#__PURE__*/React.createElement(Tab, _extends({
|
|
44
|
-
key: name,
|
|
45
|
-
label: title
|
|
46
|
-
}, TabProps));
|
|
47
|
-
}))), fields.map(function (_ref3, index) {
|
|
48
|
-
var fields = _ref3.fields,
|
|
49
|
-
name = _ref3.name;
|
|
50
|
-
return /*#__PURE__*/React.createElement(Grid, _extends({
|
|
51
|
-
key: name || index,
|
|
52
|
-
container: true,
|
|
53
|
-
item: true,
|
|
54
|
-
xs: 12,
|
|
55
|
-
rowSpacing: 2,
|
|
56
|
-
sx: _objectSpread({
|
|
57
|
-
mt: 1
|
|
58
|
-
}, index !== activeTab && {
|
|
59
|
-
display: 'none'
|
|
60
|
-
})
|
|
61
|
-
}, GridItemProps), formOptions.renderForm(fields));
|
|
62
|
-
}));
|
|
5
|
+
import { useFormApi } from '@data-driven-forms/react-form-renderer';
|
|
6
|
+
const FormTabs = ({ fields, AppBarProps = {}, TabsProps = {}, TabProps = {}, FormFieldGridProps = {}, GridItemProps = {}, }) => {
|
|
7
|
+
const formOptions = useFormApi();
|
|
8
|
+
const [activeTab, setActiveTab] = useState(0);
|
|
9
|
+
return (_jsxs(FormFieldGrid, Object.assign({ container: true }, FormFieldGridProps, { children: [_jsx(AppBar, Object.assign({ position: "static" }, AppBarProps, { children: _jsx(Tabs, Object.assign({ textColor: "inherit", value: activeTab, onChange: (_e, tabIndex) => setActiveTab(tabIndex) }, TabsProps, { children: fields.map(({ title, name }, index) => (_jsx(Tab, Object.assign({ label: title }, TabProps), name || index))) })) })), fields.map(({ fields, name }, index) => (_jsx(Grid, Object.assign({ container: true, item: true, xs: 12, rowSpacing: 2, sx: Object.assign({ mt: 1 }, (index !== activeTab && { display: 'none' })) }, GridItemProps, { children: formOptions.renderForm(fields) }), name || index)))] })));
|
|
63
10
|
};
|
|
64
11
|
export default FormTabs;
|
|
65
|
-
|
|
66
|
-
/*
|
|
67
|
-
{fields.map(({ fields }, index) =>
|
|
68
|
-
index === activeTab ? (
|
|
69
|
-
formOptions.renderForm(fields)
|
|
70
|
-
) : (
|
|
71
|
-
<Grid container item xs={12} sx={{ display: 'none' }}>
|
|
72
|
-
{formOptions.renderForm(fields)}
|
|
73
|
-
</Grid>
|
|
74
|
-
)
|
|
75
|
-
)}
|
|
76
|
-
*/
|
|
12
|
+
//# sourceMappingURL=tabs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.js","sourceRoot":"","sources":["../../src/tabs/tabs.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,IAA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,KACxD,aAAa,cAEhB,WAAW,CAAC,UAAU,CAAC,MAAM,CAAC,KAR1B,IAAI,IAAI,KAAK,CASb,CACR,CAAC,KACY,CACjB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
package/esm/text-field/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/text-field/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { BaseFieldProps } from '@data-driven-forms/react-form-renderer';
|
|
3
|
+
export interface TextFieldProps extends BaseFieldProps {
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
inputProps?: Record<string, any>;
|
|
6
|
+
FormFieldGridProps?: Record<string, any>;
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
}
|
|
9
|
+
declare const TextField: React.FC<TextFieldProps>;
|
|
10
|
+
export default TextField;
|
|
@@ -1,41 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { TextField as MuiTextField } from '@mui/material';
|
|
14
|
+
import { useFieldApi } from '@data-driven-forms/react-form-renderer';
|
|
9
15
|
import FormFieldGrid from '../form-field-grid/form-field-grid';
|
|
10
16
|
import { validationError } from '../validation-error/validation-error';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
isReadOnly = _useFieldApi.isReadOnly,
|
|
16
|
-
isDisabled = _useFieldApi.isDisabled,
|
|
17
|
-
placeholder = _useFieldApi.placeholder,
|
|
18
|
-
isRequired = _useFieldApi.isRequired,
|
|
19
|
-
label = _useFieldApi.label,
|
|
20
|
-
helperText = _useFieldApi.helperText,
|
|
21
|
-
description = _useFieldApi.description,
|
|
22
|
-
validateOnMount = _useFieldApi.validateOnMount,
|
|
23
|
-
meta = _useFieldApi.meta,
|
|
24
|
-
inputProps = _useFieldApi.inputProps,
|
|
25
|
-
FormFieldGridProps = _useFieldApi.FormFieldGridProps,
|
|
26
|
-
rest = _objectWithoutProperties(_useFieldApi, _excluded);
|
|
27
|
-
var invalid = validationError(meta, validateOnMount);
|
|
28
|
-
return /*#__PURE__*/React.createElement(FormFieldGrid, FormFieldGridProps, /*#__PURE__*/React.createElement(MuiTextField, _extends({}, input, {
|
|
29
|
-
fullWidth: true,
|
|
30
|
-
error: !!invalid,
|
|
31
|
-
helperText: invalid || (meta.touched || validateOnMount) && meta.warning || helperText || description,
|
|
32
|
-
disabled: isDisabled,
|
|
33
|
-
label: label,
|
|
34
|
-
placeholder: placeholder,
|
|
35
|
-
required: isRequired,
|
|
36
|
-
inputProps: _objectSpread({
|
|
37
|
-
readOnly: isReadOnly
|
|
38
|
-
}, inputProps)
|
|
39
|
-
}, rest)));
|
|
17
|
+
const TextField = (props) => {
|
|
18
|
+
const _a = useFieldApi(props), { input, isReadOnly, isDisabled, placeholder, isRequired, label, helperText, description, validateOnMount, meta, inputProps, FormFieldGridProps } = _a, rest = __rest(_a, ["input", "isReadOnly", "isDisabled", "placeholder", "isRequired", "label", "helperText", "description", "validateOnMount", "meta", "inputProps", "FormFieldGridProps"]);
|
|
19
|
+
const invalid = validationError(meta, validateOnMount);
|
|
20
|
+
return (_jsx(FormFieldGrid, Object.assign({}, FormFieldGridProps, { children: _jsx(MuiTextField, Object.assign({}, input, { fullWidth: true, error: !!invalid, helperText: invalid || ((meta.touched || validateOnMount) && meta.warning) || helperText || description, disabled: isDisabled, label: label, placeholder: placeholder, required: isRequired, inputProps: Object.assign({ readOnly: isReadOnly }, inputProps) }, rest)) })));
|
|
40
21
|
};
|
|
41
|
-
export default TextField;
|
|
22
|
+
export default TextField;
|
|
23
|
+
//# sourceMappingURL=text-field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-field.js","sourceRoot":"","sources":["../../src/text-field/text-field.tsx"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,SAAS,IAAI,YAAY,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAGrE,OAAO,aAAa,MAAM,oCAAoC,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAWvE,MAAM,SAAS,GAA6B,CAAC,KAAK,EAAE,EAAE;IACpD,MAAM,KAcF,WAAW,CAAC,KAAK,CAAC,EAdhB,EACJ,KAAK,EACL,UAAU,EACV,UAAU,EACV,WAAW,EACX,UAAU,EACV,KAAK,EACL,UAAU,EACV,WAAW,EACX,eAAe,EACf,IAAI,EACJ,UAAU,EACV,kBAAkB,OAEE,EADjB,IAAI,cAbH,uKAcL,CAAqB,CAAC;IACvB,MAAM,OAAO,GAAG,eAAe,CAAC,IAAyB,EAAE,eAAe,CAAC,CAAC;IAE5E,OAAO,CACL,KAAC,aAAa,oBAAK,kBAAkB,cACnC,KAAC,YAAY,oBACP,KAAK,IACT,SAAS,QACT,KAAK,EAAE,CAAC,CAAC,OAAO,EAChB,UAAU,EAAE,OAAO,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,IAAI,eAAe,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,UAAU,IAAI,WAAW,EACvG,QAAQ,EAAE,UAAU,EACpB,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,UAAU,EACpB,UAAU,kBACR,QAAQ,EAAE,UAAU,IACjB,UAAU,KAEX,IAAI,EACR,IACY,CACjB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
package/esm/textarea/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/textarea/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TextFieldProps as MuiTextFieldProps } from '@mui/material';
|
|
3
|
+
import type { BaseFieldProps } from '@data-driven-forms/react-form-renderer';
|
|
4
|
+
import type { FormFieldGridProps } from '../form-field-grid/form-field-grid';
|
|
5
|
+
export interface TextareaProps extends BaseFieldProps {
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
inputProps?: Record<string, any>;
|
|
8
|
+
FormFieldGridProps?: FormFieldGridProps;
|
|
9
|
+
TextFieldProps?: Omit<MuiTextFieldProps, 'name' | 'value' | 'onChange' | 'onBlur' | 'onFocus'>;
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}
|
|
12
|
+
declare const Textarea: React.FC<TextareaProps>;
|
|
13
|
+
export default Textarea;
|
package/esm/textarea/textarea.js
CHANGED
|
@@ -1,45 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { TextField as MuiTextField } from '@mui/material';
|
|
14
|
+
import { useFieldApi } from '@data-driven-forms/react-form-renderer';
|
|
9
15
|
import FormFieldGrid from '../form-field-grid/form-field-grid';
|
|
10
16
|
import { validationError } from '../validation-error/validation-error';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
isReadOnly = _useFieldApi.isReadOnly,
|
|
16
|
-
isDisabled = _useFieldApi.isDisabled,
|
|
17
|
-
placeholder = _useFieldApi.placeholder,
|
|
18
|
-
isRequired = _useFieldApi.isRequired,
|
|
19
|
-
label = _useFieldApi.label,
|
|
20
|
-
helperText = _useFieldApi.helperText,
|
|
21
|
-
description = _useFieldApi.description,
|
|
22
|
-
validateOnMount = _useFieldApi.validateOnMount,
|
|
23
|
-
meta = _useFieldApi.meta,
|
|
24
|
-
_useFieldApi$FormFiel = _useFieldApi.FormFieldGridProps,
|
|
25
|
-
FormFieldGridProps = _useFieldApi$FormFiel === void 0 ? {} : _useFieldApi$FormFiel,
|
|
26
|
-
_useFieldApi$inputPro = _useFieldApi.inputProps,
|
|
27
|
-
inputProps = _useFieldApi$inputPro === void 0 ? {} : _useFieldApi$inputPro,
|
|
28
|
-
rest = _objectWithoutProperties(_useFieldApi, _excluded);
|
|
29
|
-
var invalid = validationError(meta, validateOnMount);
|
|
30
|
-
return /*#__PURE__*/React.createElement(FormFieldGrid, FormFieldGridProps, /*#__PURE__*/React.createElement(MuiTextField, _extends({}, input, {
|
|
31
|
-
fullWidth: true,
|
|
32
|
-
error: !!invalid,
|
|
33
|
-
helperText: invalid || (meta.touched || validateOnMount) && meta.warning || helperText || description,
|
|
34
|
-
disabled: isDisabled,
|
|
35
|
-
label: label,
|
|
36
|
-
placeholder: placeholder,
|
|
37
|
-
required: isRequired,
|
|
38
|
-
inputProps: _objectSpread({
|
|
39
|
-
readOnly: isReadOnly
|
|
40
|
-
}, inputProps)
|
|
41
|
-
}, rest, {
|
|
42
|
-
multiline: true
|
|
43
|
-
})));
|
|
17
|
+
const Textarea = (props) => {
|
|
18
|
+
const _a = useFieldApi(props), { input, isReadOnly, isDisabled, placeholder, isRequired, label, helperText, description, validateOnMount, meta, FormFieldGridProps = {}, inputProps = {}, TextFieldProps = {} } = _a, rest = __rest(_a, ["input", "isReadOnly", "isDisabled", "placeholder", "isRequired", "label", "helperText", "description", "validateOnMount", "meta", "FormFieldGridProps", "inputProps", "TextFieldProps"]);
|
|
19
|
+
const invalid = validationError(meta, validateOnMount);
|
|
20
|
+
return (_jsx(FormFieldGrid, Object.assign({}, FormFieldGridProps, { children: _jsx(MuiTextField, Object.assign({}, input, { fullWidth: true, error: !!invalid, helperText: invalid || ((meta.touched || validateOnMount) && meta.warning) || helperText || description, disabled: isDisabled, label: label, placeholder: placeholder, required: isRequired, inputProps: Object.assign({ readOnly: isReadOnly }, inputProps) }, TextFieldProps, rest, { multiline: true })) })));
|
|
44
21
|
};
|
|
45
|
-
export default Textarea;
|
|
22
|
+
export default Textarea;
|
|
23
|
+
//# sourceMappingURL=textarea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textarea.js","sourceRoot":"","sources":["../../src/textarea/textarea.tsx"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,SAAS,IAAI,YAAY,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAGrE,OAAO,aAAa,MAAM,oCAAoC,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAWvE,MAAM,QAAQ,GAA4B,CAAC,KAAK,EAAE,EAAE;IAClD,MAAM,KAeF,WAAW,CAAC,KAAK,CAAC,EAfhB,EACJ,KAAK,EACL,UAAU,EACV,UAAU,EACV,WAAW,EACX,UAAU,EACV,KAAK,EACL,UAAU,EACV,WAAW,EACX,eAAe,EACf,IAAI,EACJ,kBAAkB,GAAG,EAAE,EACvB,UAAU,GAAG,EAAE,EACf,cAAc,GAAG,EAAE,OAEC,EADjB,IAAI,cAdH,yLAeL,CAAqB,CAAC;IAEvB,MAAM,OAAO,GAAG,eAAe,CAAC,IAAyB,EAAE,eAAe,CAAC,CAAC;IAE5E,OAAO,CACL,KAAC,aAAa,oBAAK,kBAAkB,cACnC,KAAC,YAAY,oBACP,KAAK,IACT,SAAS,QACT,KAAK,EAAE,CAAC,CAAC,OAAO,EAChB,UAAU,EAAE,OAAO,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,IAAI,eAAe,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,UAAU,IAAI,WAAW,EACvG,QAAQ,EAAE,UAAU,EACpB,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,UAAU,EACpB,UAAU,kBACR,QAAQ,EAAE,UAAU,IACjB,UAAU,KAEX,cAAc,EACd,IAAI,IACR,SAAS,UACT,IACY,CACjB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
package/esm/time-picker/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/time-picker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TimePickerProps as MUITimePickerProps } from '@mui/x-date-pickers';
|
|
3
|
+
import type { BaseFieldProps } from '@data-driven-forms/react-form-renderer';
|
|
4
|
+
import type { FormFieldGridProps } from '../form-field-grid/form-field-grid';
|
|
5
|
+
export interface TimePickerProps extends BaseFieldProps {
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
FormFieldGridProps?: FormFieldGridProps;
|
|
8
|
+
TimePickerProps?: Omit<MUITimePickerProps<Date>, 'value' | 'onChange' | 'disabled' | 'readOnly'>;
|
|
9
|
+
MuiPickersUtilsProviderProps?: any;
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}
|
|
12
|
+
declare const TimePicker: React.FC<TimePickerProps>;
|
|
13
|
+
export default TimePicker;
|