@evoke-platform/ui-components 1.0.0-dev.226 → 1.0.0-dev.228
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/dist/published/components/core/Accordion/Accordion.js +1 -1
- package/dist/published/components/core/Accordion/AccordionActions/AccordionActions.js +1 -1
- package/dist/published/components/core/Accordion/AccordionDetails/AccordionDetails.js +1 -1
- package/dist/published/components/core/Accordion/AccordionSummary/AccordionSummary.js +1 -1
- package/dist/published/components/core/Alert/Alert.js +8 -9
- package/dist/published/components/core/AlertTitle/AlertTitle.js +1 -1
- package/dist/published/components/core/AppBar/AppBar.js +1 -1
- package/dist/published/components/core/Autocomplete/Autocomplete.js +33 -15
- package/dist/published/components/core/Autocomplete/Autocomplete.test.js +1 -1
- package/dist/published/components/core/Avatar/Avatar.js +7 -4
- package/dist/published/components/core/Backdrop/Backdrop.js +1 -1
- package/dist/published/components/core/Badge/Badge.js +1 -1
- package/dist/published/components/core/Breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/published/components/core/Button/Button.js +1 -1
- package/dist/published/components/core/ButtonGroup/ButtonGroup.js +1 -1
- package/dist/published/components/core/Card/Card.js +1 -1
- package/dist/published/components/core/Checkbox/Checkbox.js +1 -1
- package/dist/published/components/core/Chip/Chip.js +1 -1
- package/dist/published/components/core/CircularProgress/CircularProgress.js +1 -1
- package/dist/published/components/core/Collapse/Collapse.js +1 -1
- package/dist/published/components/core/DatePicker/DatePicker.js +4 -16
- package/dist/published/components/core/DateTimePicker/DateTimePicker.js +3 -15
- package/dist/published/components/core/Dialog/Dialog.js +1 -1
- package/dist/published/components/core/Dialog/DialogActions/DialogActions.js +2 -13
- package/dist/published/components/core/Dialog/DialogContent/DialogContent.js +1 -1
- package/dist/published/components/core/Dialog/DialogContentText/DialogContentText.js +1 -1
- package/dist/published/components/core/Dialog/DialogTitle/DialogTitle.js +1 -1
- package/dist/published/components/core/Divider/Divider.js +1 -1
- package/dist/published/components/core/Drawer/Drawer.js +1 -1
- package/dist/published/components/core/FieldError/FieldError.js +1 -2
- package/dist/published/components/core/FormElements/FormControl/FormControl.js +1 -1
- package/dist/published/components/core/FormElements/FormControlLabel/FormControlLabel.js +1 -1
- package/dist/published/components/core/FormElements/FormGroup/FormGroup.js +1 -1
- package/dist/published/components/core/FormElements/FormHelperText/FormHelperText.js +1 -1
- package/dist/published/components/core/FormElements/FormLabel/FormLabel.js +1 -1
- package/dist/published/components/core/IconButton/IconButton.js +1 -1
- package/dist/published/components/core/LinearProgress/LinearProgress.js +1 -1
- package/dist/published/components/core/Link/Link.js +1 -1
- package/dist/published/components/core/List/List.js +1 -1
- package/dist/published/components/core/List/ListItem.js +1 -1
- package/dist/published/components/core/List/ListItemText/ListItemText.js +1 -1
- package/dist/published/components/core/LoadingButton/LoadingButton.js +1 -1
- package/dist/published/components/core/LocalizationProvider/LocalizationProvider.js +3 -14
- package/dist/published/components/core/Menu/Menu.js +1 -1
- package/dist/published/components/core/Menu/MenuItem/MenuItem.js +1 -1
- package/dist/published/components/core/Paper/Paper.js +1 -1
- package/dist/published/components/core/Popover/Popover.js +1 -1
- package/dist/published/components/core/Popper/Popper.js +1 -1
- package/dist/published/components/core/RadioGroup/Radio.js +1 -1
- package/dist/published/components/core/RadioGroup/RadioGroup.js +1 -1
- package/dist/published/components/core/Select/Select.js +11 -4
- package/dist/published/components/core/Skeleton/Skeleton.js +1 -1
- package/dist/published/components/core/Snackbar/Snackbar.js +2 -2
- package/dist/published/components/core/StaticDatePicker/StaticDatePicker.js +3 -15
- package/dist/published/components/core/Stepper/Step/Step.js +1 -1
- package/dist/published/components/core/Stepper/StepButton/StepButton.js +1 -1
- package/dist/published/components/core/Stepper/StepConnector/StepConnector.js +1 -1
- package/dist/published/components/core/Stepper/StepContent/StepContent.js +1 -1
- package/dist/published/components/core/Stepper/StepIcon/StepIcon.js +1 -1
- package/dist/published/components/core/Stepper/StepLabel/StepLabel.js +1 -1
- package/dist/published/components/core/Stepper/Stepper.js +1 -1
- package/dist/published/components/core/Switch/Switch.js +1 -1
- package/dist/published/components/core/Table/Table.js +1 -1
- package/dist/published/components/core/Tabs/Tab/Tab.js +1 -1
- package/dist/published/components/core/Tabs/Tabs.js +1 -1
- package/dist/published/components/core/TextField/TextField.js +12 -6
- package/dist/published/components/core/ToggleButton/ToggleButton.js +1 -1
- package/dist/published/components/core/ToggleButtonGroup/ToggleButtonGroup.js +1 -1
- package/dist/published/components/core/Tooltip/Tooltip.js +15 -2
- package/dist/published/components/core/Typography/index.js +1 -1
- package/dist/published/components/custom/BuilderGrid/BuilderGrid.js +33 -29
- package/dist/published/components/custom/BuilderGrid/BuilderGridToolbar.js +1 -2
- package/dist/published/components/custom/BuilderGrid/EmptyContent.js +4 -5
- package/dist/published/components/custom/BuilderGrid/EmptyContentIllustration.js +6 -1
- package/dist/published/components/custom/BuilderGrid/ToolbarActions.js +3 -1
- package/dist/published/components/custom/CriteriaBuilder/CriteriaBuilder.js +46 -27
- package/dist/published/components/custom/CriteriaBuilder/CriteriaBuilder.test.js +12 -21
- package/dist/published/components/custom/CriteriaBuilder/ValueEditor.js +27 -34
- package/dist/published/components/custom/DataGrid/DataGrid.js +38 -33
- package/dist/published/components/custom/DataGrid/DateTimeCustomOperator.js +3 -5
- package/dist/published/components/custom/DataGrid/Toolbar.js +3 -4
- package/dist/published/components/custom/ErrorComponent/ErrorComponent.js +11 -1
- package/dist/published/components/custom/Form/Common/Form.js +106 -80
- package/dist/published/components/custom/Form/Common/FormComponentWrapper.js +20 -11
- package/dist/published/components/custom/Form/FormComponents/ButtonComponent.js +9 -20
- package/dist/published/components/custom/Form/FormComponents/DocumentComponent/Document.js +10 -20
- package/dist/published/components/custom/Form/FormComponents/DocumentComponent/DocumentComponent.js +24 -28
- package/dist/published/components/custom/Form/FormComponents/DocumentComponent/DocumentList.js +49 -64
- package/dist/published/components/custom/Form/FormComponents/FormFieldComponent.d.ts +1 -0
- package/dist/published/components/custom/Form/FormComponents/FormFieldComponent.js +109 -34
- package/dist/published/components/custom/Form/FormComponents/ImageComponent/Image.d.ts +2 -0
- package/dist/published/components/custom/Form/FormComponents/ImageComponent/Image.js +13 -25
- package/dist/published/components/custom/Form/FormComponents/ImageComponent/ImageComponent.d.ts +3 -1
- package/dist/published/components/custom/Form/FormComponents/ImageComponent/ImageComponent.js +30 -9
- package/dist/published/components/custom/Form/FormComponents/ObjectComponent/InstanceLookup.js +26 -31
- package/dist/published/components/custom/Form/FormComponents/ObjectComponent/ObjectComponent.d.ts +5 -4
- package/dist/published/components/custom/Form/FormComponents/ObjectComponent/ObjectComponent.js +70 -22
- package/dist/published/components/custom/Form/FormComponents/ObjectComponent/ObjectPropertyInput.js +93 -75
- package/dist/published/components/custom/Form/FormComponents/ObjectComponent/RelatedObjectInstance.d.ts +2 -2
- package/dist/published/components/custom/Form/FormComponents/ObjectComponent/RelatedObjectInstance.js +17 -26
- package/dist/published/components/custom/Form/FormComponents/RepeatableFieldComponent/ActionDialog.js +20 -24
- package/dist/published/components/custom/Form/FormComponents/RepeatableFieldComponent/ManyToMany/DropdownRepeatableField.js +22 -33
- package/dist/published/components/custom/Form/FormComponents/RepeatableFieldComponent/ManyToMany/DropdownRepeatableFieldInput.js +12 -9
- package/dist/published/components/custom/Form/FormComponents/RepeatableFieldComponent/RepeatableField.js +105 -82
- package/dist/published/components/custom/Form/FormComponents/RepeatableFieldComponent/RepeatableFieldComponent.js +8 -6
- package/dist/published/components/custom/Form/FormComponents/UserComponent/UserComponent.d.ts +3 -1
- package/dist/published/components/custom/Form/FormComponents/UserComponent/UserComponent.js +55 -12
- package/dist/published/components/custom/Form/FormComponents/UserComponent/UserProperty.js +32 -30
- package/dist/published/components/custom/Form/FormComponents/ViewOnlyComponent.js +12 -9
- package/dist/published/components/custom/Form/types.d.ts +5 -5
- package/dist/published/components/custom/Form/utils.js +611 -446
- package/dist/published/components/custom/FormField/AddressFieldComponent/AddressFieldComponent.test.js +41 -54
- package/dist/published/components/custom/FormField/AddressFieldComponent/addressFieldComponent.js +7 -8
- package/dist/published/components/custom/FormField/BooleanSelect/BooleanSelect.js +1 -1
- package/dist/published/components/custom/FormField/BooleanSelect/BooleanSelect.test.js +5 -14
- package/dist/published/components/custom/FormField/DatePickerSelect/DatePickerSelect.js +2 -2
- package/dist/published/components/custom/FormField/DatePickerSelect/DatePickerSelect.test.js +12 -21
- package/dist/published/components/custom/FormField/DateTimePickerSelect/DateTimePickerSelect.js +2 -2
- package/dist/published/components/custom/FormField/DateTimePickerSelect/DateTimePickerSelect.test.js +12 -21
- package/dist/published/components/custom/FormField/FileUpload/FileUpload.js +10 -11
- package/dist/published/components/custom/FormField/FormField.js +10 -10
- package/dist/published/components/custom/FormField/InputFieldComponent/InputFieldComponent.js +22 -30
- package/dist/published/components/custom/FormField/InputFieldComponent/InputFieldComponent.test.js +8 -17
- package/dist/published/components/custom/FormField/Select/Select.js +5 -6
- package/dist/published/components/custom/FormField/Select/Select.test.js +18 -27
- package/dist/published/components/custom/FormField/TimePickerSelect/TimePickerSelect.js +4 -4
- package/dist/published/components/custom/HistoryLog/DisplayedProperty.js +12 -13
- package/dist/published/components/custom/HistoryLog/HistoryData.js +49 -45
- package/dist/published/components/custom/HistoryLog/HistoryLoading.js +5 -5
- package/dist/published/components/custom/HistoryLog/index.js +5 -6
- package/dist/published/components/custom/Menubar/Menubar.js +2 -2
- package/dist/published/components/custom/MultiSelect/MultiSelect.js +38 -50
- package/dist/published/components/custom/MultiSelect/SortableItem.js +1 -1
- package/dist/published/components/custom/RepeatableField/RepeatableField.js +14 -16
- package/dist/published/components/custom/UserAvatar/UserAvatar.js +12 -5
- package/dist/published/components/custom/util.js +1 -1
- package/dist/published/components/layout/Box/Box.js +1 -1
- package/dist/published/components/layout/Container/Container.js +1 -1
- package/dist/published/components/layout/Grid/Grid.js +1 -1
- package/dist/published/components/layout/Stack/Stack.js +1 -1
- package/dist/published/icons/custom/FileWithExtension.js +8 -4
- package/dist/published/icons/custom/Inherited.js +8 -6
- package/dist/published/icons/custom/Overrides.js +9 -7
- package/dist/published/icons/custom/TrashCan.js +10 -8
- package/dist/published/icons/custom/UploadCloud.js +9 -7
- package/dist/published/stories/Accordion.stories.js +2 -2
- package/dist/published/stories/Alert.stories.js +1 -1
- package/dist/published/stories/AlertTitle.stories.js +1 -1
- package/dist/published/stories/Autocomplete.stories.js +2 -2
- package/dist/published/stories/Avatar.stories.js +1 -1
- package/dist/published/stories/Backdrop.stories.js +1 -1
- package/dist/published/stories/Badge.stories.js +1 -1
- package/dist/published/stories/Box.stories.js +2 -2
- package/dist/published/stories/Breadcrumbs.stories.js +1 -1
- package/dist/published/stories/Button.stories.js +1 -1
- package/dist/published/stories/ButtonGroup.stories.js +1 -1
- package/dist/published/stories/Card.stories.js +1 -1
- package/dist/published/stories/Checkbox.stories.js +1 -1
- package/dist/published/stories/Chip.stories.js +1 -1
- package/dist/published/stories/CircularProgress.stories.js +1 -1
- package/dist/published/stories/Collapse.stories.js +1 -1
- package/dist/published/stories/Container.stories.js +1 -1
- package/dist/published/stories/CriteriaBuilder.stories.js +7 -3
- package/dist/published/stories/DataGrid.stories.js +3 -3
- package/dist/published/stories/DatePicker.stories.js +3 -14
- package/dist/published/stories/Dialog.stories.js +1 -1
- package/dist/published/stories/Divider.stories.js +1 -1
- package/dist/published/stories/Drawer.stories.js +2 -2
- package/dist/published/stories/FormControl.stories.js +1 -1
- package/dist/published/stories/FormControlLabel.stories.js +1 -1
- package/dist/published/stories/FormField.stories.js +3 -12
- package/dist/published/stories/FormGroup.stories.js +1 -1
- package/dist/published/stories/FormHelperText.stories.js +1 -1
- package/dist/published/stories/FormLabel.stories.js +1 -1
- package/dist/published/stories/Grid.stories.js +1 -1
- package/dist/published/stories/HistoryLog.stories.js +1 -1
- package/dist/published/stories/IconButton.stories.js +4 -4
- package/dist/published/stories/LinearProgress.stories.js +1 -1
- package/dist/published/stories/Link.stories.js +1 -1
- package/dist/published/stories/List.stories.js +2 -2
- package/dist/published/stories/Menu.stories.js +2 -2
- package/dist/published/stories/MenuBar.stories.js +1 -1
- package/dist/published/stories/MultiSelect.stories.js +3 -3
- package/dist/published/stories/Palette.stories.js +11 -11
- package/dist/published/stories/Paper.stories.js +1 -1
- package/dist/published/stories/RadioGroup.stories.js +1 -1
- package/dist/published/stories/RepeatableField.stories.js +6 -7
- package/dist/published/stories/RichTextViewer.stories.js +1 -1
- package/dist/published/stories/Skeleton.stories.js +1 -1
- package/dist/published/stories/Snackbar.stories.js +1 -1
- package/dist/published/stories/Stack.stories.js +1 -1
- package/dist/published/stories/StaticDatePicker.stories.js +3 -14
- package/dist/published/stories/Stepper.stories.js +3 -3
- package/dist/published/stories/Switch.stories.js +1 -1
- package/dist/published/stories/Table.stories.js +2 -2
- package/dist/published/stories/Tabs.stories.js +6 -17
- package/dist/published/stories/TextField.stories.js +1 -1
- package/dist/published/stories/TimePicker.stories.js +3 -14
- package/dist/published/stories/TimePickerSelect.stories.js +3 -14
- package/dist/published/stories/ToggleButton.stories.js +4 -4
- package/dist/published/theme/UIThemeProvider.js +1 -2
- package/package.json +1 -1
package/dist/published/components/custom/Form/FormComponents/DocumentComponent/DocumentComponent.js
CHANGED
@@ -1,12 +1,3 @@
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
|
-
});
|
9
|
-
};
|
10
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
11
2
|
import { ReactComponent } from '@formio/react';
|
12
3
|
import { isEmpty } from 'lodash';
|
@@ -17,11 +8,15 @@ import { FormComponentWrapper } from '../../Common';
|
|
17
8
|
import { Document } from './Document';
|
18
9
|
export class DocumentComponent extends ReactComponent {
|
19
10
|
constructor(component, options, data) {
|
20
|
-
super(
|
11
|
+
super({
|
12
|
+
...component,
|
13
|
+
canUpdateProperty: !component.readOnly,
|
14
|
+
hideLabel: true,
|
15
|
+
}, options, data);
|
21
16
|
this.handleChange = (key, value) => {
|
22
17
|
delete this.errorDetails['api-error'];
|
23
18
|
this.setValue(value);
|
24
|
-
this.updateValue(value
|
19
|
+
this.updateValue(value ?? [], { modified: true });
|
25
20
|
this.handleValidation(value);
|
26
21
|
this.emit('changed-' + this.component.key, value);
|
27
22
|
this.attach(this.element);
|
@@ -53,10 +48,15 @@ export class DocumentComponent extends ReactComponent {
|
|
53
48
|
if (!this.root.customErrors.find((err) => err.formattedKeyOrPath === this.component.key && err.message === error.message)) {
|
54
49
|
this.root.customErrors = [
|
55
50
|
...this.root.customErrors,
|
56
|
-
|
51
|
+
{
|
52
|
+
...error,
|
53
|
+
code: 'api-error',
|
54
|
+
component: this.component,
|
55
|
+
formattedKeyOrPath: this.component.key,
|
56
|
+
},
|
57
57
|
];
|
58
58
|
}
|
59
|
-
this.errorDetails['api-error'] = error
|
59
|
+
this.errorDetails['api-error'] = error?.message;
|
60
60
|
}
|
61
61
|
else {
|
62
62
|
this.root.customErrors = this.root.customErrors.filter((item) => item.formattedKeyOrPath !== this.component.key);
|
@@ -80,10 +80,9 @@ export class DocumentComponent extends ReactComponent {
|
|
80
80
|
* Synchronizes out-of-the-box form.io errors with this field's errorDetails object
|
81
81
|
*/
|
82
82
|
manageFormErrors() {
|
83
|
-
|
84
|
-
const outOfTheBoxError = (_a = this.root.errors.find((error) => {
|
83
|
+
const outOfTheBoxError = this.root.errors.find((error) => {
|
85
84
|
return error.component.key === this.component.key;
|
86
|
-
})
|
85
|
+
})?.message;
|
87
86
|
// add OoB form.io error to errorDetails object to show under field
|
88
87
|
if (outOfTheBoxError) {
|
89
88
|
this.errorDetails['rootError'] = outOfTheBoxError;
|
@@ -103,14 +102,13 @@ export class DocumentComponent extends ReactComponent {
|
|
103
102
|
});
|
104
103
|
}
|
105
104
|
handleValidation(value) {
|
106
|
-
var _a;
|
107
105
|
const validate = this.component.validate;
|
108
|
-
const amountOfDocuments =
|
106
|
+
const amountOfDocuments = value?.length ?? 0;
|
109
107
|
if (amountOfDocuments &&
|
110
|
-
((
|
111
|
-
(
|
108
|
+
((validate?.minDocuments && amountOfDocuments < validate.minDocuments) ||
|
109
|
+
(validate?.maxDocuments && amountOfDocuments > validate.maxDocuments))) {
|
112
110
|
let error;
|
113
|
-
if (validate
|
111
|
+
if (validate?.customMessage) {
|
114
112
|
error = validate.customMessage;
|
115
113
|
}
|
116
114
|
else if (validate.minDocuments && validate.maxDocuments) {
|
@@ -131,11 +129,9 @@ export class DocumentComponent extends ReactComponent {
|
|
131
129
|
this.checkValidity(this.dataValue, true, this.data);
|
132
130
|
this.manageFormErrors();
|
133
131
|
}
|
134
|
-
beforeSubmit() {
|
135
|
-
|
136
|
-
|
137
|
-
this.element && this.attach(this.element);
|
138
|
-
});
|
132
|
+
async beforeSubmit() {
|
133
|
+
this.handleValidation(this.dataValue);
|
134
|
+
this.element && this.attach(this.element);
|
139
135
|
}
|
140
136
|
attachReact(element) {
|
141
137
|
let root = ReactDOM.findDOMNode(element);
|
@@ -148,7 +144,7 @@ export class DocumentComponent extends ReactComponent {
|
|
148
144
|
// Form.io uses id for an enclosing div, so we need to give the input field a different id
|
149
145
|
const inputId = `${this.component.id}-input`;
|
150
146
|
return ReactDOM.render(React.createElement("div", null,
|
151
|
-
React.createElement(FormComponentWrapper,
|
152
|
-
React.createElement(Document,
|
147
|
+
React.createElement(FormComponentWrapper, { ...this.component, inputId: inputId, viewOnly: !this.component.canUpdateProperty, errorMessage: this.errorMessages() },
|
148
|
+
React.createElement(Document, { ...this.component, id: inputId, handleChange: this.handleChange, error: this.hasErrors(), value: this.dataValue }))), root);
|
153
149
|
}
|
154
150
|
}
|
package/dist/published/components/custom/Form/FormComponents/DocumentComponent/DocumentList.js
CHANGED
@@ -1,12 +1,3 @@
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
|
-
});
|
9
|
-
};
|
10
1
|
import { isEqual } from 'lodash';
|
11
2
|
import prettyBytes from 'pretty-bytes';
|
12
3
|
import React, { useEffect, useState } from 'react';
|
@@ -35,11 +26,11 @@ export const DocumentList = (props) => {
|
|
35
26
|
const [savedDocuments, setSavedDocuments] = useState();
|
36
27
|
const [hasViewPermission, setHasViewPermission] = useState(true);
|
37
28
|
useEffect(() => {
|
38
|
-
const currentValue = instance
|
39
|
-
if (currentValue
|
29
|
+
const currentValue = instance?.[property.id];
|
30
|
+
if (currentValue?.length) {
|
40
31
|
const currentDocumentIds = currentValue.map((doc) => doc.id);
|
41
32
|
if (currentDocumentIds.length &&
|
42
|
-
!isEqual(currentDocumentIds, savedDocuments
|
33
|
+
!isEqual(currentDocumentIds, savedDocuments?.map((doc) => doc.id))) {
|
43
34
|
getDocuments(currentDocumentIds);
|
44
35
|
}
|
45
36
|
}
|
@@ -66,31 +57,28 @@ export const DocumentList = (props) => {
|
|
66
57
|
checkPermissions();
|
67
58
|
}, []);
|
68
59
|
const checkPermissions = () => {
|
69
|
-
|
70
|
-
if ((_a = instance === null || instance === void 0 ? void 0 : instance[property.id]) === null || _a === void 0 ? void 0 : _a.length) {
|
60
|
+
if (instance?.[property.id]?.length) {
|
71
61
|
apiServices
|
72
62
|
.get(getPrefixedUrl(`/objects/${objectId}/instances/${instance.id}/documents/checkAccess?action=view`))
|
73
63
|
.then((accessCheck) => setHasViewPermission(accessCheck.result));
|
74
64
|
}
|
75
65
|
};
|
76
66
|
const isFile = (doc) => doc instanceof File;
|
77
|
-
const fileExists = (doc) => savedDocuments
|
67
|
+
const fileExists = (doc) => savedDocuments?.find((d) => d.id === doc.id);
|
78
68
|
const handleRemove = (index) => {
|
79
|
-
|
80
|
-
const updatedDocuments = (_a = documents === null || documents === void 0 ? void 0 : documents.filter((_, i) => i !== index)) !== null && _a !== void 0 ? _a : [];
|
69
|
+
const updatedDocuments = documents?.filter((_, i) => i !== index) ?? [];
|
81
70
|
handleChange(property.id, updatedDocuments);
|
82
71
|
};
|
83
|
-
const openDocument = (index) =>
|
84
|
-
|
85
|
-
const doc = documents === null || documents === void 0 ? void 0 : documents[index];
|
72
|
+
const openDocument = async (index) => {
|
73
|
+
const doc = documents?.[index];
|
86
74
|
if (doc) {
|
87
75
|
let url;
|
88
76
|
const contentType = doc instanceof File
|
89
77
|
? doc.type
|
90
|
-
:
|
78
|
+
: savedDocuments?.find((savedDocument) => savedDocument.id === doc.id)?.contentType;
|
91
79
|
if (!isFile(doc)) {
|
92
80
|
try {
|
93
|
-
const documentResponse =
|
81
|
+
const documentResponse = await apiServices.get(getPrefixedUrl(`/objects/${objectId}/instances/${instance.id}/documents/${doc.id}/content`), { responseType: 'blob' });
|
94
82
|
const blob = new Blob([documentResponse], { type: contentType });
|
95
83
|
url = window.URL.createObjectURL(blob);
|
96
84
|
}
|
@@ -112,61 +100,58 @@ export const DocumentList = (props) => {
|
|
112
100
|
document.body.appendChild(link);
|
113
101
|
link.click();
|
114
102
|
// Clean up and remove the link
|
115
|
-
|
103
|
+
link.parentNode?.removeChild(link);
|
116
104
|
}
|
117
105
|
}
|
118
|
-
}
|
106
|
+
};
|
119
107
|
const getDocumentSize = (doc) => {
|
120
108
|
let size;
|
121
109
|
if (isFile(doc)) {
|
122
110
|
size = prettyBytes(doc.size);
|
123
111
|
}
|
124
112
|
else {
|
125
|
-
const savedDoc = savedDocuments
|
113
|
+
const savedDoc = savedDocuments?.find((savedDocument) => savedDocument.id === doc.id);
|
126
114
|
size = savedDoc ? prettyBytes(savedDoc.size) : '';
|
127
115
|
}
|
128
116
|
return size;
|
129
117
|
};
|
130
118
|
return (React.createElement(React.Fragment, null,
|
131
119
|
!documents && !canUpdateProperty && (React.createElement(Typography, { variant: "body2", sx: { color: '#637381' } }, "No documents")),
|
132
|
-
!!
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
120
|
+
!!documents?.length && (React.createElement(Box, null, documents.map((doc, index) => (React.createElement(Grid, { container: true, sx: {
|
121
|
+
width: '100%',
|
122
|
+
border: '1px solid #C4CDD5',
|
123
|
+
borderRadius: '6px',
|
124
|
+
margin: '5px 2px',
|
125
|
+
padding: ' 8px',
|
126
|
+
display: 'flex',
|
127
|
+
alignItems: 'center',
|
128
|
+
} },
|
129
|
+
React.createElement(Grid, { item: true, sx: { display: 'flex', justifyContent: 'center', padding: '7px', marginLeft: '4px' } },
|
130
|
+
React.createElement(FileWithExtension, { fontFamily: "Arial", fileExtension: doc.name?.split('.')?.pop() ?? '', sx: { height: '1.5em', width: '1.5em' } })),
|
131
|
+
React.createElement(Grid, { item: true, sx: { flex: 1, justifyContent: 'center', paddingBottom: '5px' } },
|
132
|
+
React.createElement(Grid, { item: true, xs: 12 },
|
133
|
+
React.createElement(Typography, { sx: {
|
134
|
+
fontSize: '14px',
|
135
|
+
fontWeight: 700,
|
136
|
+
color: '#212B36',
|
137
|
+
lineHeight: '15px',
|
138
|
+
paddingTop: '8px',
|
139
|
+
} }, doc.name)),
|
140
|
+
React.createElement(Grid, { item: true, xs: 12 },
|
141
|
+
React.createElement(Typography, { sx: { fontSize: '12px', color: '#637381' } }, getDocumentSize(doc)))),
|
142
|
+
(isFile(doc) || (hasViewPermission && !isFile(doc) && fileExists(doc))) && (React.createElement(Grid, { item: true },
|
143
|
+
React.createElement(IconButton, { "aria-label": "open document", sx: { ...styles.icon, marginRight: '16px' }, onClick: () => openDocument(index) },
|
144
|
+
React.createElement(LaunchRounded, { sx: { color: '#637381', fontSize: '22px' } })))),
|
145
|
+
!isFile(doc) && savedDocuments && !fileExists(doc) && (React.createElement(Chip, { label: "Deleted", sx: {
|
146
|
+
marginRight: '16px',
|
147
|
+
backgroundColor: 'rgba(222, 48, 36, 0.16)',
|
148
|
+
color: '#A91813',
|
137
149
|
borderRadius: '6px',
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
React.createElement(
|
144
|
-
React.createElement(
|
145
|
-
React.createElement(Grid, { item: true, sx: { flex: 1, justifyContent: 'center', paddingBottom: '5px' } },
|
146
|
-
React.createElement(Grid, { item: true, xs: 12 },
|
147
|
-
React.createElement(Typography, { sx: {
|
148
|
-
fontSize: '14px',
|
149
|
-
fontWeight: 700,
|
150
|
-
color: '#212B36',
|
151
|
-
lineHeight: '15px',
|
152
|
-
paddingTop: '8px',
|
153
|
-
} }, doc.name)),
|
154
|
-
React.createElement(Grid, { item: true, xs: 12 },
|
155
|
-
React.createElement(Typography, { sx: { fontSize: '12px', color: '#637381' } }, getDocumentSize(doc)))),
|
156
|
-
(isFile(doc) || (hasViewPermission && !isFile(doc) && fileExists(doc))) && (React.createElement(Grid, { item: true },
|
157
|
-
React.createElement(IconButton, { "aria-label": "open document", sx: Object.assign(Object.assign({}, styles.icon), { marginRight: '16px' }), onClick: () => openDocument(index) },
|
158
|
-
React.createElement(LaunchRounded, { sx: { color: '#637381', fontSize: '22px' } })))),
|
159
|
-
!isFile(doc) && savedDocuments && !fileExists(doc) && (React.createElement(Chip, { label: "Deleted", sx: {
|
160
|
-
marginRight: '16px',
|
161
|
-
backgroundColor: 'rgba(222, 48, 36, 0.16)',
|
162
|
-
color: '#A91813',
|
163
|
-
borderRadius: '6px',
|
164
|
-
height: '25px',
|
165
|
-
fontWeight: 700,
|
166
|
-
'& .MuiChip-icon': { color: '#A91813', width: '.8em', marginBottom: '2px' },
|
167
|
-
}, icon: React.createElement(WarningRounded, null) })),
|
168
|
-
canUpdateProperty && (React.createElement(Grid, { item: true },
|
169
|
-
React.createElement(IconButton, { "aria-label": "delete document", sx: styles.icon, onClick: () => handleRemove(index) },
|
170
|
-
React.createElement(TrashCan, { sx: { color: '#637381' } }))))));
|
171
|
-
})))));
|
150
|
+
height: '25px',
|
151
|
+
fontWeight: 700,
|
152
|
+
'& .MuiChip-icon': { color: '#A91813', width: '.8em', marginBottom: '2px' },
|
153
|
+
}, icon: React.createElement(WarningRounded, null) })),
|
154
|
+
canUpdateProperty && (React.createElement(Grid, { item: true },
|
155
|
+
React.createElement(IconButton, { "aria-label": "delete document", sx: styles.icon, onClick: () => handleRemove(index) },
|
156
|
+
React.createElement(TrashCan, { sx: { color: '#637381' } })))))))))));
|
172
157
|
};
|
@@ -9,6 +9,7 @@ declare type FormFieldComponentProps = Omit<BaseFormComponentProps, 'property'>
|
|
9
9
|
inputMaskPlaceholderChar?: string;
|
10
10
|
addressPropertyId?: string;
|
11
11
|
isAddressLine1?: boolean;
|
12
|
+
initialValue?: string;
|
12
13
|
};
|
13
14
|
export declare class FormFieldComponent extends ReactComponent {
|
14
15
|
[x: string]: any;
|
@@ -1,12 +1,15 @@
|
|
1
1
|
import { ReactComponent } from '@formio/react';
|
2
2
|
import Handlebars from 'handlebars';
|
3
|
-
import { isArray, isEmpty, isNil } from 'lodash';
|
3
|
+
import { isArray, isEmpty, isNil, uniq } from 'lodash';
|
4
4
|
import { DateTime } from 'luxon';
|
5
5
|
import React from 'react';
|
6
6
|
import ReactDOM from 'react-dom';
|
7
7
|
import { FormField } from '../../../custom';
|
8
8
|
import { FormComponentWrapper } from '../Common';
|
9
9
|
import { isPropertyVisible } from '../utils';
|
10
|
+
function isAddressProperties(key) {
|
11
|
+
return /\.line1|\.line2|\.city|\.county|\.state|\.zipCode$/.test(key);
|
12
|
+
}
|
10
13
|
Handlebars.registerHelper('addDays', function (addend1, addend2) {
|
11
14
|
const dateAddend1 = DateTime.fromISO(addend1);
|
12
15
|
if (dateAddend1.isValid) {
|
@@ -31,17 +34,19 @@ export class FormFieldComponent extends ReactComponent {
|
|
31
34
|
* @param data - The contextual data object (model) used for this component.
|
32
35
|
*/
|
33
36
|
constructor(component, options, data) {
|
34
|
-
var _a;
|
35
37
|
const { property } = component;
|
36
|
-
component.property =
|
38
|
+
component.property = {
|
39
|
+
...component.property,
|
40
|
+
type: (property?.type === 'string' && property?.enum) || component.type === 'Select'
|
37
41
|
? 'choices'
|
38
|
-
: property
|
42
|
+
: property?.type,
|
43
|
+
};
|
39
44
|
let selectOptions = [];
|
40
45
|
if (!isEmpty(component.data)) {
|
41
46
|
selectOptions = component.data.values;
|
42
47
|
}
|
43
|
-
else if (property
|
44
|
-
selectOptions =
|
48
|
+
else if (property?.enum) {
|
49
|
+
selectOptions = property?.enum?.map((val) => ({ label: val, value: val }));
|
45
50
|
}
|
46
51
|
else if (component.type === 'Select') {
|
47
52
|
selectOptions = [
|
@@ -50,7 +55,12 @@ export class FormFieldComponent extends ReactComponent {
|
|
50
55
|
{ label: 'Public', value: 'Public' },
|
51
56
|
];
|
52
57
|
}
|
53
|
-
super(
|
58
|
+
super({
|
59
|
+
...component,
|
60
|
+
hideLabel: true,
|
61
|
+
selectOptions,
|
62
|
+
inputMaskPlaceholderChar: component.inputMaskPlaceholderChar || '_',
|
63
|
+
}, options, data);
|
54
64
|
this.handleComponentChange = (components, value) => {
|
55
65
|
if (isArray(components)) {
|
56
66
|
if (components.filter((component) => Object.hasOwnProperty.call(component, 'components'))) {
|
@@ -73,6 +83,7 @@ export class FormFieldComponent extends ReactComponent {
|
|
73
83
|
}
|
74
84
|
};
|
75
85
|
this.handleChange = (key, value) => {
|
86
|
+
delete this.errorDetails['api-error'];
|
76
87
|
let selectedValue, label;
|
77
88
|
if (this.component.isAddressLine1) {
|
78
89
|
if (typeof value === 'string') {
|
@@ -107,7 +118,7 @@ export class FormFieldComponent extends ReactComponent {
|
|
107
118
|
? value.label
|
108
119
|
: value;
|
109
120
|
}
|
110
|
-
this.setValue(selectedValue
|
121
|
+
this.setValue(selectedValue ?? '');
|
111
122
|
this.updateValue(label, { modified: true });
|
112
123
|
this.handleValidation(selectedValue);
|
113
124
|
!['TextField', 'Decimal', 'Integer'].includes(this.component.type) &&
|
@@ -134,7 +145,6 @@ export class FormFieldComponent extends ReactComponent {
|
|
134
145
|
this.handleChange = this.handleChange.bind(this);
|
135
146
|
}
|
136
147
|
init() {
|
137
|
-
var _a, _b, _c, _d;
|
138
148
|
this.on('changed-' + this.component.conditional.when, (value) => {
|
139
149
|
//set default value when conditional field is shown
|
140
150
|
if (this.component.defaultValue && value === this.component.conditional.eq) {
|
@@ -154,7 +164,7 @@ export class FormFieldComponent extends ReactComponent {
|
|
154
164
|
this.component.key.includes('.state') ||
|
155
165
|
this.component.key.includes('.zipCode')) {
|
156
166
|
this.on('changed-' + this.component.key, (value) => {
|
157
|
-
this.setValue(value
|
167
|
+
this.setValue(value ?? '');
|
158
168
|
this.updateValue(value, { modified: true });
|
159
169
|
this.attach(this.element);
|
160
170
|
});
|
@@ -164,57 +174,124 @@ export class FormFieldComponent extends ReactComponent {
|
|
164
174
|
// When date validation use handlebars. i.e {{input.datePropertyId}} or {{addDays input.datePropertyId 10}}
|
165
175
|
// We need to retrieve the property id to create a listener when those properties changed
|
166
176
|
// Then revalidate the current property.
|
167
|
-
if (
|
177
|
+
if (this.component.validate?.minDate && /^{{.*}}$/.test(this.component.validate?.minDate)) {
|
168
178
|
const matches = this.component.validate.minDate.match(/^{{.*input\.([a-z][a-zA-Z0-9_]*).*}}$/);
|
169
|
-
if (
|
179
|
+
if (matches?.[1] && !inputProps.includes(matches[1])) {
|
170
180
|
inputProps.push(matches[1]);
|
171
181
|
}
|
172
182
|
}
|
173
|
-
if (
|
183
|
+
if (this.component.validate?.maxDate && /^{{.*}}$/.test(this.component.validate?.maxDate)) {
|
174
184
|
const matches = this.component.validate.maxDate.match(/^{{.*input\.([a-z][a-zA-Z0-9_]*).*}}$/);
|
175
|
-
if (
|
185
|
+
if (matches?.[1] && !inputProps.includes(matches[1])) {
|
176
186
|
inputProps.push(matches[1]);
|
177
187
|
}
|
178
188
|
}
|
179
189
|
for (const inputProp of inputProps) {
|
180
190
|
this.on(`changed-${inputProp}`, (value) => {
|
181
|
-
var _a;
|
182
191
|
if (this.dataValue) {
|
183
192
|
this.handleValidation(this.dataValue);
|
184
|
-
this.setValue(
|
193
|
+
this.setValue(this.dataValue ?? '');
|
185
194
|
this.updateValue(this.dataValue, { modified: true });
|
186
195
|
this.attach(this.element);
|
187
196
|
}
|
188
197
|
});
|
189
198
|
}
|
190
199
|
}
|
191
|
-
this.on(`error
|
192
|
-
const error = details.find((detail) => detail.code === 'errorMessage');
|
200
|
+
this.on(`api-error`, (details) => {
|
201
|
+
const error = details.find((detail) => detail.code === 'errorMessage' && detail.path.replace('/', '') === this.component.key);
|
193
202
|
if (error) {
|
194
203
|
if (!this.root.customErrors.find((err) => err.formattedKeyOrPath === this.component.key && err.message === error.message)) {
|
195
204
|
this.root.customErrors = [
|
196
205
|
...this.root.customErrors,
|
197
|
-
|
206
|
+
{
|
207
|
+
...error,
|
208
|
+
code: 'api-error',
|
209
|
+
component: this.component,
|
210
|
+
formattedKeyOrPath: this.component.key,
|
211
|
+
},
|
198
212
|
];
|
199
213
|
}
|
200
|
-
this.errorDetails['
|
201
|
-
|
202
|
-
|
214
|
+
this.errorDetails['api-error'] = error?.message;
|
215
|
+
}
|
216
|
+
else {
|
217
|
+
this.root.customErrors = this.root.customErrors.filter((item) => item.formattedKeyOrPath !== this.component.key);
|
218
|
+
delete this.errorDetails['api-error'];
|
203
219
|
}
|
220
|
+
this.attach(this.element);
|
221
|
+
this.attachReact(this.element);
|
204
222
|
});
|
223
|
+
if (this.component.initialValue) {
|
224
|
+
if (Array.isArray(this.component.initialValue) &&
|
225
|
+
this.component.initialValue.some((item) => /^{{.*}}$/.test(item))) {
|
226
|
+
const staticValues = this.component.initialValue.filter((item) => !/^{{.*}}$/.test(item));
|
227
|
+
for (const item of this.component.initialValue.filter((item) => /^{{.*}}$/.test(item))) {
|
228
|
+
const regex = /^{{input\.(?<relatedObjectProperty>[a-zA-Z][a-zA-Z0-9_]*)\.(?<nestedProperty>[a-zA-Z][a-zA-Z0-9_]*)}}$/;
|
229
|
+
const groups = regex.exec(item)?.groups;
|
230
|
+
if (groups?.relatedObjectProperty && groups?.nestedProperty) {
|
231
|
+
this.on(`changed-${groups.relatedObjectProperty}`, (value) => {
|
232
|
+
if (value) {
|
233
|
+
const newValue = uniq([
|
234
|
+
...this.dataValue,
|
235
|
+
...staticValues,
|
236
|
+
...value[groups.nestedProperty],
|
237
|
+
]);
|
238
|
+
this.setValue(newValue);
|
239
|
+
this.updateValue(newValue, { modified: true });
|
240
|
+
this.attach(this.element);
|
241
|
+
}
|
242
|
+
});
|
243
|
+
}
|
244
|
+
}
|
245
|
+
}
|
246
|
+
else if (/^{{.*}}$/.test(this.component.initialValue)) {
|
247
|
+
if (isAddressProperties(this.component.key)) {
|
248
|
+
const regex = /^{{input\.(?<relatedObjectProperty>[a-zA-Z][a-zA-Z0-9_]*)\.(?<addressProperty>[a-zA-Z][a-zA-Z0-9_]*)\.(?<nestedAddressProperty>line1|line2|city|county|state|zipCode)}}$/;
|
249
|
+
const groups = regex.exec(this.component.initialValue)?.groups;
|
250
|
+
if (groups?.relatedObjectProperty && groups?.addressProperty && groups?.nestedAddressProperty) {
|
251
|
+
this.on(`changed-${groups.relatedObjectProperty}`, (value) => {
|
252
|
+
if (value) {
|
253
|
+
const newValue = value[groups.addressProperty]?.[groups.nestedAddressProperty];
|
254
|
+
this.setValue(newValue);
|
255
|
+
this.updateValue(newValue, { modified: true });
|
256
|
+
this.attach(this.element);
|
257
|
+
}
|
258
|
+
});
|
259
|
+
}
|
260
|
+
}
|
261
|
+
else {
|
262
|
+
const regex = /^{{input\.(?<relatedObjectProperty>[a-zA-Z][a-zA-Z0-9_]*)\.(?<nestedProperty>[a-zA-Z][a-zA-Z0-9_]*)}}$/;
|
263
|
+
const groups = regex.exec(this.component.initialValue)?.groups;
|
264
|
+
if (groups?.relatedObjectProperty && groups?.nestedProperty) {
|
265
|
+
this.on(`changed-${groups.relatedObjectProperty}`, (value) => {
|
266
|
+
if (value) {
|
267
|
+
const newValue = value[groups.nestedProperty];
|
268
|
+
this.setValue(newValue);
|
269
|
+
this.updateValue(newValue, { modified: true });
|
270
|
+
this.attach(this.element);
|
271
|
+
if (this.component.type === 'Select') {
|
272
|
+
this.attachReact(this.element);
|
273
|
+
}
|
274
|
+
}
|
275
|
+
});
|
276
|
+
}
|
277
|
+
}
|
278
|
+
}
|
279
|
+
}
|
205
280
|
}
|
206
281
|
clearErrors() {
|
207
282
|
this.errorDetails = {};
|
208
283
|
this.root.customErrors = this.root.customErrors.filter((error) => error.formattedKeyOrPath !== this.component.key);
|
209
284
|
}
|
210
285
|
handleValidation(value) {
|
211
|
-
var _a;
|
212
286
|
const { validate } = this.component;
|
213
287
|
if (!isPropertyVisible(this.component.conditional, this.root.data)) {
|
214
288
|
return;
|
215
289
|
}
|
216
290
|
const emptyMask = this.component.inputMaskPlaceholderChar &&
|
217
|
-
|
291
|
+
this.component.inputMask
|
292
|
+
?.replaceAll('9', this.component.inputMaskPlaceholderChar)
|
293
|
+
.replaceAll('a', this.component.inputMaskPlaceholderChar)
|
294
|
+
.replaceAll('*', this.component.inputMaskPlaceholderChar);
|
218
295
|
const emptyField = value === undefined || value === null || value === '' || isNil(value) || value === emptyMask;
|
219
296
|
if (emptyField &&
|
220
297
|
!validate.required &&
|
@@ -285,7 +362,7 @@ export class FormFieldComponent extends ReactComponent {
|
|
285
362
|
if (this.component.validate.minDate || this.component.validate.maxDate) {
|
286
363
|
const dateRegex = /^\d{4}-\d{2}-\d{2}$/;
|
287
364
|
const data = {
|
288
|
-
input:
|
365
|
+
input: { ...this.root.data },
|
289
366
|
__today__: DateTime.now().toISODate(),
|
290
367
|
};
|
291
368
|
let { minDate, maxDate } = validate;
|
@@ -344,10 +421,9 @@ export class FormFieldComponent extends ReactComponent {
|
|
344
421
|
* Synchronizes out-of-the-box formio errors with this field's errorDetails object
|
345
422
|
*/
|
346
423
|
manageFormErrors() {
|
347
|
-
|
348
|
-
const outOfTheBoxError = (_a = this.root.errors.find((error) => {
|
424
|
+
const outOfTheBoxError = this.root.errors.find((error) => {
|
349
425
|
return error.component.key === this.component.key;
|
350
|
-
})
|
426
|
+
})?.message;
|
351
427
|
//add OoB formio error to errorDetails object to show under field
|
352
428
|
if (outOfTheBoxError) {
|
353
429
|
this.errorDetails['rootError'] = outOfTheBoxError;
|
@@ -375,8 +451,7 @@ export class FormFieldComponent extends ReactComponent {
|
|
375
451
|
this.element && this.attach(this.element);
|
376
452
|
}
|
377
453
|
attachReact(element) {
|
378
|
-
|
379
|
-
const { id, defaultValue } = this.component;
|
454
|
+
const { id } = this.component;
|
380
455
|
let root = ReactDOM.findDOMNode(element);
|
381
456
|
if (!root) {
|
382
457
|
root = element;
|
@@ -387,11 +462,11 @@ export class FormFieldComponent extends ReactComponent {
|
|
387
462
|
* It'll cause issues with: field-level errors not showing up, conditional visibility not working, focus moving out of the form on keypress
|
388
463
|
* Will need to be revisited later. Possibly look into using this.ref */
|
389
464
|
return ReactDOM.render(React.createElement("div", null,
|
390
|
-
React.createElement(FormComponentWrapper,
|
391
|
-
React.createElement(FormField,
|
465
|
+
React.createElement(FormComponentWrapper, { ...this.component, inputId: inputId, errorMessage: this.errorMessages(), value: this.dataValue },
|
466
|
+
React.createElement(FormField, { onChange: this.handleChange, onBlur: (e) => {
|
392
467
|
// no mask errors when field is empty and not required
|
393
468
|
const componentError = this.root.errors.find((error) => error.component.key === this.component.key);
|
394
|
-
const maskMessage = componentError
|
469
|
+
const maskMessage = componentError?.messages.find((message) => message.context.validator === 'mask');
|
395
470
|
const falsePositiveMaskError = !(!!maskMessage &&
|
396
471
|
!this.component.validate.required &&
|
397
472
|
this.root.data[this.component.key] === maskMessage.context.value);
|
@@ -404,6 +479,6 @@ export class FormFieldComponent extends ReactComponent {
|
|
404
479
|
falsePositiveMaskError &&
|
405
480
|
isEmpty(this.errorDetails) &&
|
406
481
|
this.emit('changed-' + this.component.key, e.target.value);
|
407
|
-
}
|
482
|
+
}, ...this.component, id: inputId, defaultValue: this.dataValue, mask: this.component.inputMask, error: this.hasErrors(), size: this.component.fieldHeight ?? 'medium' }))), root);
|
408
483
|
}
|
409
484
|
}
|
@@ -3,6 +3,7 @@ import { ObjectInstance } from '@evoke-platform/context';
|
|
3
3
|
export declare function blobToDataUrl(blob: Blob): Promise<string>;
|
4
4
|
declare type ImageProps = {
|
5
5
|
id: string;
|
6
|
+
value?: string;
|
6
7
|
handleChange: (propertyId: string, value: string | null) => void;
|
7
8
|
property: {
|
8
9
|
id: string;
|
@@ -10,6 +11,7 @@ declare type ImageProps = {
|
|
10
11
|
instance: ObjectInstance;
|
11
12
|
canUpdateProperty: boolean;
|
12
13
|
error: boolean;
|
14
|
+
initialValue?: unknown;
|
13
15
|
};
|
14
16
|
export declare const Image: (props: ImageProps) => JSX.Element;
|
15
17
|
export {};
|