@comet/admin 9.0.0-beta.3 → 9.0.0-beta.5
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/common/DeleteDialog.d.ts +1 -0
- package/lib/common/DeleteDialog.d.ts.map +1 -1
- package/lib/common/DeleteDialog.js +8 -1
- package/lib/common/__stories__/Tooltip.stories.js +404 -0
- package/lib/common/buttons/__stories__/Button.stories.js +445 -0
- package/lib/common/buttons/clearinput/ClearInputButton.js +1 -1
- package/lib/common/buttons/delete/__stories__/DeleteButton.stories.js +1 -1
- package/lib/common/toolbar/__stories__/DataGridToolbar.stories.js +76 -0
- package/lib/common/toolbar/__stories__/Toolbar.stories.js +82 -0
- package/lib/dataGrid/__stories__/ClickableRows.stories.js +109 -0
- package/lib/dataGrid/__stories__/CrudMoreActionsMenu.stories.js +50 -0
- package/lib/dataGrid/__stories__/DataGrid.stories.js +94 -0
- package/lib/dataGrid/__stories__/DataGridSingleSelectFilter.stories.js +492 -0
- package/lib/error/errorHandler/ErrorHandlerProvider.d.ts +8 -0
- package/lib/error/errorHandler/ErrorHandlerProvider.d.ts.map +1 -0
- package/lib/error/errorHandler/ErrorHandlerProvider.js +16 -0
- package/lib/error/errorboundary/ErrorBoundary.d.ts.map +1 -1
- package/lib/error/errorboundary/ErrorBoundary.js +26 -18
- package/lib/form/FinalFormInput.d.ts.map +1 -1
- package/lib/form/FinalFormInput.js +3 -2
- package/lib/form/__stories__/AsyncAutocompleteField.stories.js +660 -0
- package/lib/form/__stories__/AsyncSelectField.stories.js +513 -0
- package/lib/form/__stories__/Autocomplete.stories.js +188 -0
- package/lib/form/__stories__/AutocompleteField.stories.js +48 -0
- package/lib/form/__stories__/Checkbox.stories.js +70 -0
- package/lib/form/__stories__/CheckboxField.stories.js +87 -0
- package/lib/form/__stories__/CheckboxListField.stories.js +172 -0
- package/lib/form/__stories__/CustomButtons.stories.js +78 -0
- package/lib/form/__stories__/DependentAsyncSelects.stories.js +91 -0
- package/lib/form/__stories__/DisableAutoNavigation.stories.js +132 -0
- package/lib/form/__stories__/DisabledSubmitIfNotDirty.stories.js +54 -0
- package/lib/form/__stories__/FieldContainer.stories.js +87 -0
- package/lib/form/__stories__/FinalFormFileSelect.stories.js +155 -0
- package/lib/form/__stories__/FormInStack.stories.js +133 -0
- package/lib/form/__stories__/FormLayouts.stories.js +174 -0
- package/lib/form/__stories__/FormValidation.stories.js +82 -0
- package/lib/form/__stories__/Input.stories.js +37 -0
- package/lib/form/__stories__/NumberField.stories.js +38 -0
- package/lib/form/__stories__/Radio.stories.js +101 -0
- package/lib/form/__stories__/RadioGroupField.stories.js +172 -0
- package/lib/form/__stories__/RangeInput.stories.js +239 -0
- package/lib/form/__stories__/RouterTabs.stories.js +96 -0
- package/lib/form/__stories__/RouterTabsInForm.stories.js +73 -0
- package/lib/form/__stories__/RouterTabsInFormWithSubroutes.stories.js +96 -0
- package/lib/form/__stories__/ScrollToErrorField.stories.js +82 -0
- package/lib/form/__stories__/SearchField.stories.js +38 -0
- package/lib/form/__stories__/Select.stories.js +187 -0
- package/lib/form/__stories__/SelectField.stories.js +100 -0
- package/lib/form/__stories__/ShowErrorStrategies.stories.js +107 -0
- package/lib/form/__stories__/SingleTextField.stories.js +108 -0
- package/lib/form/__stories__/StackInForm.stories.js +53 -0
- package/lib/form/__stories__/SubmitErrors.stories.js +90 -0
- package/lib/form/__stories__/Switch.stories.js +49 -0
- package/lib/form/__stories__/SwitchField.stories.js +87 -0
- package/lib/form/__stories__/Tabs.stories.js +78 -0
- package/lib/form/__stories__/TextAreaField.stories.js +38 -0
- package/lib/form/__stories__/TextField.stories.js +67 -0
- package/lib/form/__stories__/ToggleButtonGroupField.stories.js +312 -0
- package/lib/form/__stories__/TwoLevelValidation.stories.js +168 -0
- package/lib/form/__stories__/Typography.stories.js +71 -0
- package/lib/form/file/__stories__/FileDropzone.stories.js +81 -0
- package/lib/form/file/__stories__/FileSelect.stories.js +139 -0
- package/lib/form/file/__stories__/FileSelectListItem.stories.js +108 -0
- package/lib/form/file/__stories__/FileSelectMultipleExamples.stories.js +187 -0
- package/lib/helpers/useTopOffset.js +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/section/__stories__/SectionHeadline.stories.js +71 -0
- package/lib/stack/Stack.d.ts.map +1 -1
- package/lib/stack/Stack.js +3 -0
- package/lib/stack/__stories__/RouterTabsNestedStack.stories.js +51 -0
- package/lib/stack/__stories__/Stack.stories.js +14 -0
- package/lib/stack/__stories__/StackBackButton.stories.js +50 -0
- package/lib/stack/__stories__/StackBreadcrumbs.stories.js +139 -0
- package/lib/stack/__stories__/StackBreadcrumbsTabs.stories.js +47 -0
- package/lib/stack/__stories__/StackCustomSeparator.stories.js +47 -0
- package/lib/stack/__stories__/StackLink.stories.js +41 -0
- package/lib/stack/__stories__/StackNested.stories.js +58 -0
- package/lib/stack/__stories__/StackNestedOnInitialPage.stories.js +78 -0
- package/lib/stack/__stories__/StackNestedOneStack.stories.js +90 -0
- package/lib/stack/__stories__/StackPageTitle.stories.js +121 -0
- package/lib/stack/__stories__/StackReactNodeTitle.stories.js +54 -0
- package/lib/stack/__stories__/StackRefApi.stories.js +56 -0
- package/lib/stack/__stories__/StackTableFormQueryAtStack.stories.js +155 -0
- package/lib/stack/__stories__/StackTableFormQueryInTable.stories.js +160 -0
- package/lib/stack/__stories__/StackUrl.stories.js +66 -0
- package/lib/tabs/__stories__/DynamicTabs.stories.js +84 -0
- package/lib/tabs/__stories__/NestedStackSwitchWithRouterTabs.stories.js +84 -0
- package/lib/tabs/__stories__/OverflowIssues.stories.js +224 -0
- package/lib/tabs/__stories__/RouterTabs.stories.js +31 -0
- package/lib/tabs/__stories__/RouterTabsInStack.stories.js +74 -0
- package/lib/tabs/__stories__/RouterTabsInSubroute.stories.js +68 -0
- package/lib/tabs/__stories__/Tabs.stories.js +219 -0
- package/lib/theme/componentsTheme/MuiDataGrid.js +1 -1
- package/lib/translator/ContentTranslationServiceContext.d.ts +1 -0
- package/lib/translator/ContentTranslationServiceContext.d.ts.map +1 -1
- package/lib/translator/ContentTranslationServiceProvider.d.ts +1 -1
- package/lib/translator/ContentTranslationServiceProvider.d.ts.map +1 -1
- package/lib/translator/ContentTranslationServiceProvider.js +4 -2
- package/lib/translator/PlainTextTranslationDialog.d.ts +1 -0
- package/lib/translator/PlainTextTranslationDialog.d.ts.map +1 -1
- package/lib/translator/PlainTextTranslationDialog.js +8 -3
- package/lib/translator/__stories__/ContentTranslation.stories.js +104 -0
- package/package.json +23 -24
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { Card, CardContent, Grid } from "@mui/material";
|
|
2
|
+
import { FinalForm } from "../../FinalForm";
|
|
3
|
+
import { Field } from "../../form/Field";
|
|
4
|
+
import { FinalFormInput } from "../../form/FinalFormInput";
|
|
5
|
+
import { FormSection } from "../../form/FormSection";
|
|
6
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
function VerticalFields() {
|
|
8
|
+
return /*#__PURE__*/_jsx(Card, {
|
|
9
|
+
variant: "outlined",
|
|
10
|
+
children: /*#__PURE__*/_jsx(CardContent, {
|
|
11
|
+
children: /*#__PURE__*/_jsxs(FormSection, {
|
|
12
|
+
title: "Vertical Fields",
|
|
13
|
+
disableMarginBottom: true,
|
|
14
|
+
children: [/*#__PURE__*/_jsx(Field, {
|
|
15
|
+
label: "Foo",
|
|
16
|
+
placeholder: "Foo",
|
|
17
|
+
name: "foo1",
|
|
18
|
+
component: FinalFormInput
|
|
19
|
+
}), /*#__PURE__*/_jsx(Field, {
|
|
20
|
+
label: "Bar",
|
|
21
|
+
placeholder: "Bar",
|
|
22
|
+
name: "bar1",
|
|
23
|
+
component: FinalFormInput
|
|
24
|
+
}), /*#__PURE__*/_jsx(Field, {
|
|
25
|
+
label: "Disabled",
|
|
26
|
+
placeholder: "Disabled",
|
|
27
|
+
name: "disabled1",
|
|
28
|
+
disabled: true,
|
|
29
|
+
component: FinalFormInput
|
|
30
|
+
}), /*#__PURE__*/_jsx(Field, {
|
|
31
|
+
label: "Required",
|
|
32
|
+
placeholder: "Required",
|
|
33
|
+
name: "required1",
|
|
34
|
+
required: true,
|
|
35
|
+
component: FinalFormInput
|
|
36
|
+
})]
|
|
37
|
+
})
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function HorizontalFields() {
|
|
42
|
+
return /*#__PURE__*/_jsx(Card, {
|
|
43
|
+
variant: "outlined",
|
|
44
|
+
children: /*#__PURE__*/_jsx(CardContent, {
|
|
45
|
+
children: /*#__PURE__*/_jsxs(FormSection, {
|
|
46
|
+
title: "Horizontal Fields",
|
|
47
|
+
disableMarginBottom: true,
|
|
48
|
+
children: [/*#__PURE__*/_jsx(Field, {
|
|
49
|
+
label: "Foo",
|
|
50
|
+
placeholder: "Foo",
|
|
51
|
+
name: "foo2",
|
|
52
|
+
component: FinalFormInput,
|
|
53
|
+
variant: "horizontal"
|
|
54
|
+
}), /*#__PURE__*/_jsx(Field, {
|
|
55
|
+
label: "Bar",
|
|
56
|
+
placeholder: "Bar",
|
|
57
|
+
name: "bar2",
|
|
58
|
+
component: FinalFormInput,
|
|
59
|
+
variant: "horizontal"
|
|
60
|
+
}), /*#__PURE__*/_jsx(Field, {
|
|
61
|
+
label: "Disabled",
|
|
62
|
+
placeholder: "Disabled",
|
|
63
|
+
name: "disabled2",
|
|
64
|
+
disabled: true,
|
|
65
|
+
component: FinalFormInput,
|
|
66
|
+
variant: "horizontal"
|
|
67
|
+
}), /*#__PURE__*/_jsx(Field, {
|
|
68
|
+
label: "Required",
|
|
69
|
+
placeholder: "Required",
|
|
70
|
+
name: "required2",
|
|
71
|
+
required: true,
|
|
72
|
+
component: FinalFormInput,
|
|
73
|
+
variant: "horizontal"
|
|
74
|
+
})]
|
|
75
|
+
})
|
|
76
|
+
})
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function FieldsInGrid() {
|
|
80
|
+
return /*#__PURE__*/_jsx(Card, {
|
|
81
|
+
variant: "outlined",
|
|
82
|
+
children: /*#__PURE__*/_jsx(CardContent, {
|
|
83
|
+
children: /*#__PURE__*/_jsx(FormSection, {
|
|
84
|
+
title: "Fields in Grid",
|
|
85
|
+
disableMarginBottom: true,
|
|
86
|
+
children: /*#__PURE__*/_jsxs(Grid, {
|
|
87
|
+
container: true,
|
|
88
|
+
spacing: 4,
|
|
89
|
+
children: [/*#__PURE__*/_jsx(Grid, {
|
|
90
|
+
size: {
|
|
91
|
+
xs: 12,
|
|
92
|
+
sm: 6,
|
|
93
|
+
md: 3
|
|
94
|
+
},
|
|
95
|
+
children: /*#__PURE__*/_jsx(Field, {
|
|
96
|
+
label: "Foo",
|
|
97
|
+
placeholder: "Foo",
|
|
98
|
+
name: "foo3",
|
|
99
|
+
fullWidth: true,
|
|
100
|
+
component: FinalFormInput
|
|
101
|
+
})
|
|
102
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
|
103
|
+
size: {
|
|
104
|
+
xs: 12,
|
|
105
|
+
sm: 6,
|
|
106
|
+
md: 3
|
|
107
|
+
},
|
|
108
|
+
children: /*#__PURE__*/_jsx(Field, {
|
|
109
|
+
label: "Bar",
|
|
110
|
+
placeholder: "Bar",
|
|
111
|
+
name: "bar3",
|
|
112
|
+
fullWidth: true,
|
|
113
|
+
component: FinalFormInput
|
|
114
|
+
})
|
|
115
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
|
116
|
+
size: {
|
|
117
|
+
xs: 12,
|
|
118
|
+
sm: 6,
|
|
119
|
+
md: 3
|
|
120
|
+
},
|
|
121
|
+
children: /*#__PURE__*/_jsx(Field, {
|
|
122
|
+
label: "Disabled",
|
|
123
|
+
placeholder: "Disabled",
|
|
124
|
+
name: "disabled3",
|
|
125
|
+
disabled: true,
|
|
126
|
+
fullWidth: true,
|
|
127
|
+
component: FinalFormInput
|
|
128
|
+
})
|
|
129
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
|
130
|
+
size: {
|
|
131
|
+
xs: 12,
|
|
132
|
+
sm: 6,
|
|
133
|
+
md: 3
|
|
134
|
+
},
|
|
135
|
+
children: /*#__PURE__*/_jsx(Field, {
|
|
136
|
+
label: "Required",
|
|
137
|
+
placeholder: "Required",
|
|
138
|
+
name: "required3",
|
|
139
|
+
required: true,
|
|
140
|
+
fullWidth: true,
|
|
141
|
+
component: FinalFormInput
|
|
142
|
+
})
|
|
143
|
+
})]
|
|
144
|
+
})
|
|
145
|
+
})
|
|
146
|
+
})
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
export default {
|
|
150
|
+
title: "components/form"
|
|
151
|
+
};
|
|
152
|
+
export var FormLayouts = function FormLayouts() {
|
|
153
|
+
return /*#__PURE__*/_jsx(FinalForm, {
|
|
154
|
+
mode: "edit",
|
|
155
|
+
onSubmit: function onSubmit() {},
|
|
156
|
+
children: /*#__PURE__*/_jsxs(Grid, {
|
|
157
|
+
container: true,
|
|
158
|
+
spacing: 8,
|
|
159
|
+
style: {
|
|
160
|
+
maxWidth: 1024
|
|
161
|
+
},
|
|
162
|
+
children: [/*#__PURE__*/_jsx(Grid, {
|
|
163
|
+
size: 12,
|
|
164
|
+
children: /*#__PURE__*/_jsx(VerticalFields, {})
|
|
165
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
|
166
|
+
size: 12,
|
|
167
|
+
children: /*#__PURE__*/_jsx(HorizontalFields, {})
|
|
168
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
|
169
|
+
size: 12,
|
|
170
|
+
children: /*#__PURE__*/_jsx(FieldsInGrid, {})
|
|
171
|
+
})]
|
|
172
|
+
})
|
|
173
|
+
});
|
|
174
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { Alert } from "../../alert/Alert";
|
|
2
|
+
import { FinalForm } from "../../FinalForm";
|
|
3
|
+
import { TextField } from "../../form/fields/TextField";
|
|
4
|
+
import { SaveBoundary } from "../../saveBoundary/SaveBoundary";
|
|
5
|
+
import { SaveBoundarySaveButton } from "../../saveBoundary/SaveBoundarySaveButton";
|
|
6
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
var config = {
|
|
8
|
+
title: "components/form/FormValidation"
|
|
9
|
+
};
|
|
10
|
+
export default config;
|
|
11
|
+
export var FormValidation = {
|
|
12
|
+
render: function render() {
|
|
13
|
+
return /*#__PURE__*/_jsx(SaveBoundary, {
|
|
14
|
+
children: /*#__PURE__*/_jsx(FinalForm, {
|
|
15
|
+
initialValues: {
|
|
16
|
+
text: "",
|
|
17
|
+
text2: "",
|
|
18
|
+
text3: ""
|
|
19
|
+
},
|
|
20
|
+
mode: "edit",
|
|
21
|
+
onSubmit: function onSubmit() {
|
|
22
|
+
// not handled
|
|
23
|
+
},
|
|
24
|
+
subscription: {
|
|
25
|
+
values: true,
|
|
26
|
+
errors: true,
|
|
27
|
+
submitError: true,
|
|
28
|
+
submitFailed: true,
|
|
29
|
+
submitSucceeded: true,
|
|
30
|
+
hasSubmitErrors: true,
|
|
31
|
+
touched: true
|
|
32
|
+
},
|
|
33
|
+
children: function children(_ref) {
|
|
34
|
+
var values = _ref.values,
|
|
35
|
+
errors = _ref.errors,
|
|
36
|
+
touched = _ref.touched,
|
|
37
|
+
submitError = _ref.submitError,
|
|
38
|
+
submitFailed = _ref.submitFailed,
|
|
39
|
+
submitSucceeded = _ref.submitSucceeded,
|
|
40
|
+
hasSubmitErrors = _ref.hasSubmitErrors;
|
|
41
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
42
|
+
children: [/*#__PURE__*/_jsx(TextField, {
|
|
43
|
+
name: "text",
|
|
44
|
+
label: "Text",
|
|
45
|
+
fullWidth: true,
|
|
46
|
+
required: true
|
|
47
|
+
}), /*#__PURE__*/_jsx(TextField, {
|
|
48
|
+
name: "text2",
|
|
49
|
+
label: "Text",
|
|
50
|
+
helperText: "Text must be more than 5 characters",
|
|
51
|
+
fullWidth: true,
|
|
52
|
+
required: true,
|
|
53
|
+
validate: function validate(value) {
|
|
54
|
+
if (value != null && value.length < 5) {
|
|
55
|
+
return "Text must be more than 5 characters";
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}), /*#__PURE__*/_jsx(TextField, {
|
|
59
|
+
name: "text3",
|
|
60
|
+
label: "Text",
|
|
61
|
+
fullWidth: true,
|
|
62
|
+
required: true
|
|
63
|
+
}), /*#__PURE__*/_jsx(SaveBoundarySaveButton, {}), /*#__PURE__*/_jsx(Alert, {
|
|
64
|
+
title: "FormState",
|
|
65
|
+
children: /*#__PURE__*/_jsx("pre", {
|
|
66
|
+
children: JSON.stringify({
|
|
67
|
+
submitError: submitError,
|
|
68
|
+
submitFailed: submitFailed,
|
|
69
|
+
submitSucceeded: submitSucceeded,
|
|
70
|
+
hasSubmitErrors: hasSubmitErrors,
|
|
71
|
+
touched: touched,
|
|
72
|
+
values: values,
|
|
73
|
+
errors: errors
|
|
74
|
+
}, null, 2)
|
|
75
|
+
})
|
|
76
|
+
})]
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Card, CardContent } from "@mui/material";
|
|
2
|
+
import { Form } from "react-final-form";
|
|
3
|
+
import { Field } from "../../form/Field";
|
|
4
|
+
import { FinalFormInput } from "../../form/FinalFormInput";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
export default {
|
|
7
|
+
title: "components/form"
|
|
8
|
+
};
|
|
9
|
+
export var Input = function Input() {
|
|
10
|
+
return /*#__PURE__*/_jsx("div", {
|
|
11
|
+
style: {
|
|
12
|
+
width: 300
|
|
13
|
+
},
|
|
14
|
+
children: /*#__PURE__*/_jsx(Form, {
|
|
15
|
+
onSubmit: function onSubmit(values) {
|
|
16
|
+
//
|
|
17
|
+
},
|
|
18
|
+
render: function render(_ref) {
|
|
19
|
+
var handleSubmit = _ref.handleSubmit;
|
|
20
|
+
return /*#__PURE__*/_jsx("form", {
|
|
21
|
+
onSubmit: handleSubmit,
|
|
22
|
+
children: /*#__PURE__*/_jsx(Card, {
|
|
23
|
+
variant: "outlined",
|
|
24
|
+
children: /*#__PURE__*/_jsx(CardContent, {
|
|
25
|
+
children: /*#__PURE__*/_jsx(Field, {
|
|
26
|
+
name: "name",
|
|
27
|
+
label: "Foo",
|
|
28
|
+
component: FinalFormInput,
|
|
29
|
+
fullWidth: true
|
|
30
|
+
})
|
|
31
|
+
})
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
});
|
|
37
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Alert } from "../../alert/Alert";
|
|
2
|
+
import { FinalForm } from "../../FinalForm";
|
|
3
|
+
import { NumberField } from "../../form/fields/NumberField";
|
|
4
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
var config = {
|
|
6
|
+
component: NumberField,
|
|
7
|
+
title: "components/form/NumberField"
|
|
8
|
+
};
|
|
9
|
+
export default config;
|
|
10
|
+
export var Default = {
|
|
11
|
+
render: function render() {
|
|
12
|
+
return /*#__PURE__*/_jsx(FinalForm, {
|
|
13
|
+
mode: "edit",
|
|
14
|
+
onSubmit: function onSubmit() {
|
|
15
|
+
// not handled
|
|
16
|
+
},
|
|
17
|
+
subscription: {
|
|
18
|
+
values: true
|
|
19
|
+
},
|
|
20
|
+
children: function children(_ref) {
|
|
21
|
+
var values = _ref.values;
|
|
22
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
23
|
+
children: [/*#__PURE__*/_jsx(NumberField, {
|
|
24
|
+
name: "value",
|
|
25
|
+
label: "Number Field",
|
|
26
|
+
fullWidth: true,
|
|
27
|
+
variant: "horizontal"
|
|
28
|
+
}), /*#__PURE__*/_jsx(Alert, {
|
|
29
|
+
title: "FormState",
|
|
30
|
+
children: /*#__PURE__*/_jsx("pre", {
|
|
31
|
+
children: JSON.stringify(values, null, 2)
|
|
32
|
+
})
|
|
33
|
+
})]
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
import { Card, CardContent, FormControlLabel, Grid } from "@mui/material";
|
|
8
|
+
import { Form } from "react-final-form";
|
|
9
|
+
import { Field } from "../../form/Field";
|
|
10
|
+
import { FieldContainer } from "../../form/FieldContainer";
|
|
11
|
+
import { FinalFormRadio } from "../../form/Radio";
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
export default {
|
|
14
|
+
title: "components/form"
|
|
15
|
+
};
|
|
16
|
+
export var Radio = function Radio() {
|
|
17
|
+
return /*#__PURE__*/_jsx("div", {
|
|
18
|
+
style: {
|
|
19
|
+
width: 600
|
|
20
|
+
},
|
|
21
|
+
children: /*#__PURE__*/_jsx(Form, {
|
|
22
|
+
initialValues: {
|
|
23
|
+
foo1: "bar2",
|
|
24
|
+
foo2: "bar2",
|
|
25
|
+
foo3: "bar2",
|
|
26
|
+
foo4: "bar2"
|
|
27
|
+
},
|
|
28
|
+
onSubmit: function onSubmit(values) {
|
|
29
|
+
//
|
|
30
|
+
},
|
|
31
|
+
render: function render(_ref) {
|
|
32
|
+
var handleSubmit = _ref.handleSubmit;
|
|
33
|
+
return /*#__PURE__*/_jsx("form", {
|
|
34
|
+
onSubmit: handleSubmit,
|
|
35
|
+
children: /*#__PURE__*/_jsx(Grid, {
|
|
36
|
+
container: true,
|
|
37
|
+
spacing: 4,
|
|
38
|
+
children: /*#__PURE__*/_jsx(Grid, {
|
|
39
|
+
size: 6,
|
|
40
|
+
children: /*#__PURE__*/_jsx(Card, {
|
|
41
|
+
variant: "outlined",
|
|
42
|
+
children: /*#__PURE__*/_jsx(CardContent, {
|
|
43
|
+
children: /*#__PURE__*/_jsxs(FieldContainer, {
|
|
44
|
+
label: "Radios",
|
|
45
|
+
children: [/*#__PURE__*/_jsx(Field, {
|
|
46
|
+
name: "foo1",
|
|
47
|
+
type: "radio",
|
|
48
|
+
value: "bar1",
|
|
49
|
+
fullWidth: true,
|
|
50
|
+
children: function children(props) {
|
|
51
|
+
return /*#__PURE__*/_jsx(FormControlLabel, {
|
|
52
|
+
label: "Unchecked",
|
|
53
|
+
control: /*#__PURE__*/_jsx(FinalFormRadio, _objectSpread({}, props))
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}), /*#__PURE__*/_jsx(Field, {
|
|
57
|
+
name: "foo1",
|
|
58
|
+
type: "radio",
|
|
59
|
+
value: "bar2",
|
|
60
|
+
fullWidth: true,
|
|
61
|
+
children: function children(props) {
|
|
62
|
+
return /*#__PURE__*/_jsx(FormControlLabel, {
|
|
63
|
+
label: "Checked",
|
|
64
|
+
control: /*#__PURE__*/_jsx(FinalFormRadio, _objectSpread({}, props))
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}), /*#__PURE__*/_jsx(Field, {
|
|
68
|
+
name: "foo2",
|
|
69
|
+
type: "radio",
|
|
70
|
+
value: "bar1",
|
|
71
|
+
fullWidth: true,
|
|
72
|
+
disabled: true,
|
|
73
|
+
children: function children(props) {
|
|
74
|
+
return /*#__PURE__*/_jsx(FormControlLabel, {
|
|
75
|
+
label: "Disabled",
|
|
76
|
+
control: /*#__PURE__*/_jsx(FinalFormRadio, _objectSpread({}, props))
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}), /*#__PURE__*/_jsx(Field, {
|
|
80
|
+
name: "foo2",
|
|
81
|
+
type: "radio",
|
|
82
|
+
value: "bar2",
|
|
83
|
+
fullWidth: true,
|
|
84
|
+
disabled: true,
|
|
85
|
+
children: function children(props) {
|
|
86
|
+
return /*#__PURE__*/_jsx(FormControlLabel, {
|
|
87
|
+
label: "Disabled & Checked",
|
|
88
|
+
control: /*#__PURE__*/_jsx(FinalFormRadio, _objectSpread({}, props))
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
})]
|
|
92
|
+
})
|
|
93
|
+
})
|
|
94
|
+
})
|
|
95
|
+
})
|
|
96
|
+
})
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
})
|
|
100
|
+
});
|
|
101
|
+
};
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { Alert } from "../../alert/Alert";
|
|
2
|
+
import { FieldSet } from "../../common/FieldSet";
|
|
3
|
+
import { FinalForm } from "../../FinalForm";
|
|
4
|
+
import { RadioGroupField } from "../../form/fields/RadioGroupField";
|
|
5
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
var config = {
|
|
7
|
+
component: RadioGroupField,
|
|
8
|
+
title: "components/form/RadioGroupField"
|
|
9
|
+
};
|
|
10
|
+
export default config;
|
|
11
|
+
export var Default = {
|
|
12
|
+
render: function render() {
|
|
13
|
+
return /*#__PURE__*/_jsx(FinalForm, {
|
|
14
|
+
mode: "edit",
|
|
15
|
+
onSubmit: function onSubmit() {
|
|
16
|
+
// not handled
|
|
17
|
+
},
|
|
18
|
+
subscription: {
|
|
19
|
+
values: true
|
|
20
|
+
},
|
|
21
|
+
children: function children(_ref) {
|
|
22
|
+
var values = _ref.values;
|
|
23
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
24
|
+
children: [/*#__PURE__*/_jsx(RadioGroupField, {
|
|
25
|
+
options: [{
|
|
26
|
+
label: "Option 1",
|
|
27
|
+
value: "option1"
|
|
28
|
+
}, {
|
|
29
|
+
label: "Option 2",
|
|
30
|
+
value: "option2"
|
|
31
|
+
}, {
|
|
32
|
+
label: "Option 3",
|
|
33
|
+
value: "option3"
|
|
34
|
+
}],
|
|
35
|
+
name: "value",
|
|
36
|
+
label: "Radio Group Field",
|
|
37
|
+
fullWidth: true,
|
|
38
|
+
variant: "horizontal"
|
|
39
|
+
}), /*#__PURE__*/_jsx(Alert, {
|
|
40
|
+
title: "FormState",
|
|
41
|
+
children: /*#__PURE__*/_jsx("pre", {
|
|
42
|
+
children: JSON.stringify(values, null, 2)
|
|
43
|
+
})
|
|
44
|
+
})]
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
var optionsWithShortNames = [{
|
|
51
|
+
label: "Option 1",
|
|
52
|
+
value: "option1"
|
|
53
|
+
}, {
|
|
54
|
+
label: "[disabled] Option 2",
|
|
55
|
+
value: "option2",
|
|
56
|
+
disabled: true
|
|
57
|
+
}, {
|
|
58
|
+
label: "Option 3",
|
|
59
|
+
value: "option3"
|
|
60
|
+
}, {
|
|
61
|
+
label: "Option 4",
|
|
62
|
+
value: "option4"
|
|
63
|
+
}, {
|
|
64
|
+
label: "Option 5",
|
|
65
|
+
value: "option5"
|
|
66
|
+
}, {
|
|
67
|
+
label: "Option 6",
|
|
68
|
+
value: "option6"
|
|
69
|
+
}, {
|
|
70
|
+
label: "Option 7",
|
|
71
|
+
value: "option7"
|
|
72
|
+
}];
|
|
73
|
+
var optionsWithLongNames = [{
|
|
74
|
+
label: "Donec sed odio dui.",
|
|
75
|
+
value: "donec"
|
|
76
|
+
}, {
|
|
77
|
+
label: "[disabled] Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.",
|
|
78
|
+
value: "lorem",
|
|
79
|
+
disabled: true
|
|
80
|
+
}, {
|
|
81
|
+
label: "Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.",
|
|
82
|
+
value: "duis"
|
|
83
|
+
}, {
|
|
84
|
+
label: "Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.",
|
|
85
|
+
value: "aenean"
|
|
86
|
+
}, {
|
|
87
|
+
label: "Donec id elit non mi porta gravida at eget metus.",
|
|
88
|
+
value: "donec-id"
|
|
89
|
+
}, {
|
|
90
|
+
label: "Etiam porta sem malesuada magna mollis euismod.",
|
|
91
|
+
value: "etiam"
|
|
92
|
+
}, {
|
|
93
|
+
label: "Curabitur blandit tempus porttitor. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Maecenas faucibus mollis interdum.",
|
|
94
|
+
value: "curabitur"
|
|
95
|
+
}];
|
|
96
|
+
export var LayoutVariants = {
|
|
97
|
+
render: function render() {
|
|
98
|
+
return /*#__PURE__*/_jsx(FinalForm, {
|
|
99
|
+
mode: "edit",
|
|
100
|
+
onSubmit: function onSubmit() {
|
|
101
|
+
// not handled
|
|
102
|
+
},
|
|
103
|
+
children: function children() {
|
|
104
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
105
|
+
children: [/*#__PURE__*/_jsxs(FieldSet, {
|
|
106
|
+
title: "Horizontal Field-Variant",
|
|
107
|
+
children: [/*#__PURE__*/_jsx(RadioGroupField, {
|
|
108
|
+
name: "horizontalRowShortOptions",
|
|
109
|
+
label: "Row Layout",
|
|
110
|
+
variant: "horizontal",
|
|
111
|
+
layout: "row",
|
|
112
|
+
options: optionsWithShortNames,
|
|
113
|
+
fullWidth: true
|
|
114
|
+
}), /*#__PURE__*/_jsx(RadioGroupField, {
|
|
115
|
+
name: "horizontalColumnShortOptions",
|
|
116
|
+
label: "Column Layout",
|
|
117
|
+
variant: "horizontal",
|
|
118
|
+
layout: "column",
|
|
119
|
+
options: optionsWithShortNames,
|
|
120
|
+
fullWidth: true
|
|
121
|
+
}), /*#__PURE__*/_jsx(RadioGroupField, {
|
|
122
|
+
name: "horizontalRowLongOptions",
|
|
123
|
+
label: "Row Layout",
|
|
124
|
+
variant: "horizontal",
|
|
125
|
+
layout: "row",
|
|
126
|
+
options: optionsWithLongNames,
|
|
127
|
+
fullWidth: true
|
|
128
|
+
}), /*#__PURE__*/_jsx(RadioGroupField, {
|
|
129
|
+
name: "horizontalColumnLongOptions",
|
|
130
|
+
label: "Column Layout",
|
|
131
|
+
variant: "horizontal",
|
|
132
|
+
layout: "column",
|
|
133
|
+
options: optionsWithLongNames,
|
|
134
|
+
fullWidth: true
|
|
135
|
+
})]
|
|
136
|
+
}), /*#__PURE__*/_jsxs(FieldSet, {
|
|
137
|
+
title: "Vertical Field-Variant",
|
|
138
|
+
children: [/*#__PURE__*/_jsx(RadioGroupField, {
|
|
139
|
+
name: "verticalRowShortOptions",
|
|
140
|
+
label: "Row Layout",
|
|
141
|
+
variant: "vertical",
|
|
142
|
+
layout: "row",
|
|
143
|
+
options: optionsWithShortNames,
|
|
144
|
+
fullWidth: true
|
|
145
|
+
}), /*#__PURE__*/_jsx(RadioGroupField, {
|
|
146
|
+
name: "verticalColumnShortOptions",
|
|
147
|
+
label: "Column Layout",
|
|
148
|
+
variant: "vertical",
|
|
149
|
+
layout: "column",
|
|
150
|
+
options: optionsWithShortNames,
|
|
151
|
+
fullWidth: true
|
|
152
|
+
}), /*#__PURE__*/_jsx(RadioGroupField, {
|
|
153
|
+
name: "verticalRowLongOptions",
|
|
154
|
+
label: "Row Layout",
|
|
155
|
+
variant: "vertical",
|
|
156
|
+
layout: "row",
|
|
157
|
+
options: optionsWithLongNames,
|
|
158
|
+
fullWidth: true
|
|
159
|
+
}), /*#__PURE__*/_jsx(RadioGroupField, {
|
|
160
|
+
name: "verticalColumnLongOptions",
|
|
161
|
+
label: "Column Layout",
|
|
162
|
+
variant: "vertical",
|
|
163
|
+
layout: "column",
|
|
164
|
+
options: optionsWithLongNames,
|
|
165
|
+
fullWidth: true
|
|
166
|
+
})]
|
|
167
|
+
})]
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
};
|