@zohodesk/dot 1.4.9 → 1.4.11
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/.cli/UnValidatedFiles.html +101 -0
- package/.cli/propValidation_report.html +1 -1
- package/README.md +10 -1
- package/coverage/ExternalLink/ExternalLink.js.html +1 -1
- package/coverage/ExternalLink/ExternalLink.module.css.html +1 -1
- package/coverage/ExternalLink/index.html +1 -1
- package/coverage/ExternalLink/props/defaultProps.js.html +1 -1
- package/coverage/ExternalLink/props/index.html +1 -1
- package/coverage/ExternalLink/props/propTypes.js.html +1 -1
- package/coverage/IconButton/IconButton.js.html +1 -1
- package/coverage/IconButton/IconButton.module.css.html +1 -1
- package/coverage/IconButton/index.html +1 -1
- package/coverage/IconButton/props/defaultProps.js.html +1 -1
- package/coverage/IconButton/props/index.html +1 -1
- package/coverage/IconButton/props/propTypes.js.html +1 -1
- package/coverage/Image/Image.js.html +1 -1
- package/coverage/Image/Image.module.css.html +1 -1
- package/coverage/Image/index.html +1 -1
- package/coverage/Image/props/defaultProps.js.html +1 -1
- package/coverage/Image/props/index.html +1 -1
- package/coverage/Image/props/propTypes.js.html +1 -1
- package/coverage/avatar/AvatarWithTeam/AvatarWithTeam.js.html +1 -1
- package/coverage/avatar/AvatarWithTeam/AvatarWithTeam.module.css.html +1 -1
- package/coverage/avatar/AvatarWithTeam/index.html +1 -1
- package/coverage/avatar/AvatarWithTeam/props/defaultProps.js.html +1 -1
- package/coverage/avatar/AvatarWithTeam/props/index.html +1 -1
- package/coverage/avatar/AvatarWithTeam/props/propTypes.js.html +1 -1
- package/coverage/index.html +1 -1
- package/es/NewStar/NewStar.module.css +128 -67
- package/es/form/fields/TagsMultiSelect/TagsMultiSelect.js +4 -4
- package/es/form/fields/TagsMultiSelect/TagsMultiSelect.module.css +9 -0
- package/es/form/fields/TagsMultiSelectField/TagsMultiSelectField.js +9 -2
- package/es/form/fields/TagsMultiSelectField/props/defaultProps.js +3 -1
- package/es/form/fields/TagsMultiSelectField/props/propTypes.js +5 -1
- package/es/form/fields/TextEditor/TextEditor.module.css +63 -47
- package/es/v1/form/fields/SelectField/SelectField.js +1 -9
- package/es/v1/form/fields/TagsMultiSelect/TagsMultiSelect.js +42 -13
- package/es/v1/form/fields/TagsMultiSelect/props/defaultProps.js +4 -1
- package/es/v1/form/fields/TagsMultiSelect/props/propTypes.js +10 -1
- package/es/v1/form/fields/TagsMultiSelectField/TagsMultiSelectField.js +9 -2
- package/es/v1/form/fields/TagsMultiSelectField/props/defaultProps.js +3 -1
- package/es/v1/form/fields/TagsMultiSelectField/props/propTypes.js +5 -1
- package/es/v1/form/fields/TextBoxField/TextBoxField.js +122 -142
- package/es/v1/form/fields/TextEditorField/TextEditorField.js +133 -153
- package/es/v1/form/fields/TextEditorWrapper/TextEditorWrapper.js +137 -178
- package/es/v1/form/fields/TextareaField/TextareaField.js +113 -137
- package/es/v1/form/fields/ValidationMessage/ValidationMessage.js +43 -43
- package/es/v1/form/layout/Field/Field.js +24 -28
- package/es/v1/form/layout/Section/Section.js +26 -33
- package/es/v1/list/Subject/Subject.js +39 -48
- package/es/v1/list/TagNew/TagNew.js +18 -27
- package/es/v1/list/Thread/Thread.js +26 -35
- package/lib/NewStar/NewStar.module.css +128 -67
- package/lib/form/fields/TagsMultiSelect/TagsMultiSelect.js +5 -5
- package/lib/form/fields/TagsMultiSelect/TagsMultiSelect.module.css +9 -0
- package/lib/form/fields/TagsMultiSelectField/TagsMultiSelectField.js +9 -2
- package/lib/form/fields/TagsMultiSelectField/props/defaultProps.js +3 -1
- package/lib/form/fields/TagsMultiSelectField/props/propTypes.js +5 -1
- package/lib/form/fields/TextEditor/TextEditor.module.css +63 -47
- package/lib/v1/form/fields/SelectField/SelectField.js +1 -7
- package/lib/v1/form/fields/TagsMultiSelect/TagsMultiSelect.js +45 -13
- package/lib/v1/form/fields/TagsMultiSelect/props/defaultProps.js +4 -1
- package/lib/v1/form/fields/TagsMultiSelect/props/propTypes.js +10 -1
- package/lib/v1/form/fields/TagsMultiSelectField/TagsMultiSelectField.js +9 -2
- package/lib/v1/form/fields/TagsMultiSelectField/props/defaultProps.js +3 -1
- package/lib/v1/form/fields/TagsMultiSelectField/props/propTypes.js +5 -1
- package/lib/v1/form/fields/TextBoxField/TextBoxField.js +125 -181
- package/lib/v1/form/fields/TextEditorField/TextEditorField.js +138 -193
- package/lib/v1/form/fields/TextEditorWrapper/TextEditorWrapper.js +160 -212
- package/lib/v1/form/fields/TextareaField/TextareaField.js +117 -177
- package/lib/v1/form/fields/ValidationMessage/ValidationMessage.js +41 -80
- package/lib/v1/form/layout/Field/Field.js +22 -69
- package/lib/v1/form/layout/Section/Section.js +26 -72
- package/lib/v1/list/Subject/Subject.js +39 -87
- package/lib/v1/list/TagNew/TagNew.js +18 -66
- package/lib/v1/list/Thread/Thread.js +25 -73
- package/package.json +10 -10
- package/propValidationArg.json +8 -4
- package/result.json +1 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
|
|
3
|
-
import React, {
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
4
|
import { defaultProps } from './props/defaultProps';
|
|
5
5
|
import { propTypes } from './props/propTypes';
|
|
6
6
|
/**** Components ****/
|
|
7
7
|
|
|
8
|
+
import useEffectCallOnlyAfterState from '@zohodesk/hooks/es/utils/useEffectCallOnlyAfterState';
|
|
8
9
|
import TextEditor from '../TextEditor/TextEditor';
|
|
9
10
|
import Textarea from '@zohodesk/components/es/v1/Textarea/Textarea';
|
|
10
11
|
import VelocityAnimationGroup from '@zohodesk/components/es/v1/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup';
|
|
@@ -12,192 +13,150 @@ import { editorContentValidate } from '../../../../utils/editorUtils';
|
|
|
12
13
|
import style from './../../../../form/fields/TextEditorWrapper/TextEditorWrapper.module.css';
|
|
13
14
|
/* eslint-disable react/no-deprecated */
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
16
|
+
const TextEditorWrapper = props => {
|
|
17
|
+
const {
|
|
18
|
+
id,
|
|
19
|
+
onChange,
|
|
20
|
+
value,
|
|
21
|
+
onAttachmentUpload,
|
|
22
|
+
needEditor,
|
|
23
|
+
dataId,
|
|
24
|
+
isReadOnly,
|
|
25
|
+
isDisabled,
|
|
26
|
+
getRef,
|
|
27
|
+
textBoxSize,
|
|
28
|
+
textBoxVariant,
|
|
29
|
+
editorMode,
|
|
30
|
+
editorSize,
|
|
31
|
+
editorBorder,
|
|
32
|
+
EDITORURL,
|
|
33
|
+
isCustomScroll,
|
|
34
|
+
initCallback,
|
|
35
|
+
loadingComponent,
|
|
36
|
+
handleAlertMessage,
|
|
37
|
+
editorCallback,
|
|
38
|
+
editorBlurCallback,
|
|
39
|
+
editorOptions,
|
|
40
|
+
changeEditorContent,
|
|
41
|
+
shouldEditorUpdateContent,
|
|
42
|
+
setInlineAttachmentInProgress,
|
|
43
|
+
handleEditorDropUpload,
|
|
44
|
+
ImgLazyLoad,
|
|
45
|
+
i18nKeys,
|
|
46
|
+
isEditorDefaultOpen,
|
|
47
|
+
needInlineAttachment,
|
|
48
|
+
customProps,
|
|
49
|
+
dataSelectorId,
|
|
50
|
+
onFocus
|
|
51
|
+
} = props;
|
|
52
|
+
const {
|
|
53
|
+
Textarea1Props = {},
|
|
54
|
+
Textarea2Props = {},
|
|
55
|
+
TextEditorProps = {}
|
|
56
|
+
} = customProps;
|
|
57
|
+
const [isEditorShow, setIsEditorShow] = useState(isEditorDefaultOpen ? true : !!value);
|
|
58
|
+
const [isEditorFocus, setIsEditorFocus] = useState(false);
|
|
59
|
+
const defaultObj = {
|
|
60
|
+
needEditorFocus: !value
|
|
61
|
+
};
|
|
62
|
+
const editorOptionsObject = Object.assign(defaultObj, editorOptions);
|
|
35
63
|
|
|
64
|
+
const handleTextareaFocus = () => {
|
|
36
65
|
if (!isReadOnly && !isDisabled) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
editor[this.props.id].squireInstance.focus();
|
|
42
|
-
}, 300);
|
|
43
|
-
});
|
|
66
|
+
setIsEditorShow(true);
|
|
67
|
+
setTimeout(() => {
|
|
68
|
+
editor[id].squireInstance.focus();
|
|
69
|
+
}, 300);
|
|
44
70
|
}
|
|
45
|
-
}
|
|
71
|
+
};
|
|
46
72
|
|
|
47
|
-
toggleEdit
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
});
|
|
51
|
-
}
|
|
73
|
+
const toggleEdit = value => {
|
|
74
|
+
setIsEditorShow(value);
|
|
75
|
+
};
|
|
52
76
|
|
|
53
|
-
focusCallback() {
|
|
54
|
-
|
|
55
|
-
onFocus
|
|
56
|
-
} = this.props;
|
|
57
|
-
this.setState({
|
|
58
|
-
isEditorFocus: true
|
|
59
|
-
});
|
|
77
|
+
const focusCallback = () => {
|
|
78
|
+
setIsEditorFocus(true);
|
|
60
79
|
onFocus && onFocus();
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
componentWillReceiveProps(np) {
|
|
64
|
-
let {
|
|
65
|
-
id,
|
|
66
|
-
value
|
|
67
|
-
} = this.props;
|
|
80
|
+
};
|
|
68
81
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
});
|
|
82
|
+
useEffectCallOnlyAfterState(() => {
|
|
83
|
+
if (value || typeof editor !== 'undefined' && editorContentValidate(editor[id])) {
|
|
84
|
+
setIsEditorShow(true);
|
|
73
85
|
} else {
|
|
74
|
-
if (!
|
|
75
|
-
|
|
76
|
-
isEditorShow: false
|
|
77
|
-
});
|
|
86
|
+
if (!isEditorFocus && !isEditorDefaultOpen) {
|
|
87
|
+
setIsEditorShow(false);
|
|
78
88
|
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
name: "slideDown",
|
|
150
|
-
runOnMount: true,
|
|
151
|
-
enterDuration: '300',
|
|
152
|
-
exitDuration: '400',
|
|
153
|
-
isActive: isEditorShow,
|
|
154
|
-
component: "div"
|
|
155
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
156
|
-
className: style.textEditor
|
|
157
|
-
}, isEditorShow && needEditor ? /*#__PURE__*/React.createElement(TextEditor, _extends({
|
|
158
|
-
id: id,
|
|
159
|
-
value: value,
|
|
160
|
-
onChange: !isReadOnly && !isDisabled ? onChange : null,
|
|
161
|
-
editorOptions: editorOptionsObject,
|
|
162
|
-
onUpload: onAttachmentUpload,
|
|
163
|
-
editorMode: editorMode,
|
|
164
|
-
type: editorSize,
|
|
165
|
-
border: editorBorder,
|
|
166
|
-
dataId: dataId,
|
|
167
|
-
getRef: getRef,
|
|
168
|
-
plainTextSwitchCallback: !isReadOnly && !isDisabled ? onChange : null,
|
|
169
|
-
EDITORURL: EDITORURL,
|
|
170
|
-
isCustomScroll: isCustomScroll,
|
|
171
|
-
initCallback: initCallback,
|
|
172
|
-
loadingComponent: loadingComponent,
|
|
173
|
-
handleAlertMessage: handleAlertMessage,
|
|
174
|
-
toggleEdit: this.toggleEdit,
|
|
175
|
-
isEditorDefaultOpen: isEditorDefaultOpen,
|
|
176
|
-
editorCallback: editorCallback,
|
|
177
|
-
i18nKeys: i18nKeys,
|
|
178
|
-
ImgLazyLoad: ImgLazyLoad,
|
|
179
|
-
blurCallback: editorBlurCallback,
|
|
180
|
-
changeEditorContent: changeEditorContent,
|
|
181
|
-
shouldUpdateContent: shouldEditorUpdateContent,
|
|
182
|
-
setInlineAttachmentInProgress: setInlineAttachmentInProgress,
|
|
183
|
-
handleDropUpload: handleEditorDropUpload,
|
|
184
|
-
onFocus: this.focusCallback,
|
|
185
|
-
needInlineAttachment: needInlineAttachment
|
|
186
|
-
}, TextEditorProps)) : /*#__PURE__*/React.createElement(Textarea, _extends({
|
|
187
|
-
onFocus: this.handleTextareaFocus,
|
|
188
|
-
text: value,
|
|
189
|
-
animated: !needEditor,
|
|
190
|
-
onChange: onChange,
|
|
191
|
-
dataId: dataId,
|
|
192
|
-
isReadOnly: isReadOnly,
|
|
193
|
-
isDisabled: isDisabled,
|
|
194
|
-
needEffect: !(isReadOnly || isDisabled),
|
|
195
|
-
getRef: getRef,
|
|
196
|
-
size: textBoxSize,
|
|
197
|
-
variant: textBoxVariant
|
|
198
|
-
}, Textarea2Props)))));
|
|
199
|
-
}
|
|
89
|
+
}
|
|
90
|
+
}, [value, id, isEditorDefaultOpen]);
|
|
91
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
92
|
+
className: style.container,
|
|
93
|
+
"data-selector-id": dataSelectorId
|
|
94
|
+
}, !isEditorShow ? /*#__PURE__*/React.createElement(Textarea, _extends({
|
|
95
|
+
onFocus: handleTextareaFocus,
|
|
96
|
+
text: value,
|
|
97
|
+
animated: !needEditor,
|
|
98
|
+
onChange: onChange,
|
|
99
|
+
dataId: dataId,
|
|
100
|
+
isReadOnly: isReadOnly,
|
|
101
|
+
isDisabled: isDisabled,
|
|
102
|
+
needEffect: !(isReadOnly || isDisabled),
|
|
103
|
+
getRef: getRef,
|
|
104
|
+
size: textBoxSize,
|
|
105
|
+
variant: textBoxVariant,
|
|
106
|
+
customClass: style.textBox
|
|
107
|
+
}, Textarea1Props)) : null, /*#__PURE__*/React.createElement(VelocityAnimationGroup, {
|
|
108
|
+
name: "slideDown",
|
|
109
|
+
runOnMount: true,
|
|
110
|
+
enterDuration: '300',
|
|
111
|
+
exitDuration: '400',
|
|
112
|
+
isActive: isEditorShow,
|
|
113
|
+
component: "div"
|
|
114
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
115
|
+
className: style.textEditor
|
|
116
|
+
}, isEditorShow && needEditor ? /*#__PURE__*/React.createElement(TextEditor, _extends({
|
|
117
|
+
id: id,
|
|
118
|
+
value: value,
|
|
119
|
+
onChange: !isReadOnly && !isDisabled ? onChange : null,
|
|
120
|
+
editorOptions: editorOptionsObject,
|
|
121
|
+
onUpload: onAttachmentUpload,
|
|
122
|
+
editorMode: editorMode,
|
|
123
|
+
type: editorSize,
|
|
124
|
+
border: editorBorder,
|
|
125
|
+
dataId: dataId,
|
|
126
|
+
getRef: getRef,
|
|
127
|
+
plainTextSwitchCallback: !isReadOnly && !isDisabled ? onChange : null,
|
|
128
|
+
EDITORURL: EDITORURL,
|
|
129
|
+
isCustomScroll: isCustomScroll,
|
|
130
|
+
initCallback: initCallback,
|
|
131
|
+
loadingComponent: loadingComponent,
|
|
132
|
+
handleAlertMessage: handleAlertMessage,
|
|
133
|
+
toggleEdit: toggleEdit,
|
|
134
|
+
isEditorDefaultOpen: isEditorDefaultOpen,
|
|
135
|
+
editorCallback: editorCallback,
|
|
136
|
+
i18nKeys: i18nKeys,
|
|
137
|
+
ImgLazyLoad: ImgLazyLoad,
|
|
138
|
+
blurCallback: editorBlurCallback,
|
|
139
|
+
changeEditorContent: changeEditorContent,
|
|
140
|
+
shouldUpdateContent: shouldEditorUpdateContent,
|
|
141
|
+
setInlineAttachmentInProgress: setInlineAttachmentInProgress,
|
|
142
|
+
handleDropUpload: handleEditorDropUpload,
|
|
143
|
+
onFocus: focusCallback,
|
|
144
|
+
needInlineAttachment: needInlineAttachment
|
|
145
|
+
}, TextEditorProps)) : /*#__PURE__*/React.createElement(Textarea, _extends({
|
|
146
|
+
onFocus: handleTextareaFocus,
|
|
147
|
+
text: value,
|
|
148
|
+
animated: !needEditor,
|
|
149
|
+
onChange: onChange,
|
|
150
|
+
dataId: dataId,
|
|
151
|
+
isReadOnly: isReadOnly,
|
|
152
|
+
isDisabled: isDisabled,
|
|
153
|
+
needEffect: !(isReadOnly || isDisabled),
|
|
154
|
+
getRef: getRef,
|
|
155
|
+
size: textBoxSize,
|
|
156
|
+
variant: textBoxVariant
|
|
157
|
+
}, Textarea2Props)))));
|
|
158
|
+
};
|
|
200
159
|
|
|
201
|
-
|
|
160
|
+
export default TextEditorWrapper;
|
|
202
161
|
TextEditorWrapper.propTypes = propTypes;
|
|
203
162
|
TextEditorWrapper.defaultProps = defaultProps;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
|
|
3
3
|
/**** Libraries ****/
|
|
4
|
-
import React, {
|
|
4
|
+
import React, { memo } from 'react';
|
|
5
5
|
import { defaultProps } from './props/defaultProps';
|
|
6
6
|
import { propTypes } from './props/propTypes';
|
|
7
7
|
/**** Components ****/
|
|
@@ -9,153 +9,129 @@ import { propTypes } from './props/propTypes';
|
|
|
9
9
|
import Label from '@zohodesk/components/es/v1/Label/Label';
|
|
10
10
|
import Textarea from '@zohodesk/components/es/v1/Textarea/Textarea';
|
|
11
11
|
import ValidationMessage from '../ValidationMessage/ValidationMessage';
|
|
12
|
-
import {
|
|
12
|
+
import { useUniqueId } from '@zohodesk/components/es/v1/Provider/IdProvider';
|
|
13
13
|
import FieldContainer from '../FieldContainer/FieldContainer';
|
|
14
14
|
/**** CSS ****/
|
|
15
15
|
|
|
16
16
|
import style from '../../../../form/fields/Fields.module.css';
|
|
17
|
-
export default class TextareaField extends PureComponent {
|
|
18
|
-
constructor(props) {
|
|
19
|
-
super(props);
|
|
20
|
-
this.handleChange = this.handleChange.bind(this);
|
|
21
|
-
this.handleBlur = this.handleBlur.bind(this);
|
|
22
|
-
this.handleGetRef = this.handleGetRef.bind(this); // this.handleLabelClick = this.handleLabelClick.bind(this);
|
|
23
17
|
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
const TextareaField = props => {
|
|
19
|
+
const {
|
|
20
|
+
labelName,
|
|
21
|
+
id,
|
|
22
|
+
isMandatory,
|
|
23
|
+
textBoxSize,
|
|
24
|
+
animated,
|
|
25
|
+
textBoxVariant,
|
|
26
|
+
isReadOnly,
|
|
27
|
+
validationMessage,
|
|
28
|
+
validationPalette,
|
|
29
|
+
maxLength,
|
|
30
|
+
value,
|
|
31
|
+
errorType,
|
|
32
|
+
isDisabled,
|
|
33
|
+
title,
|
|
34
|
+
placeHolder,
|
|
35
|
+
dataId,
|
|
36
|
+
dataSelectorId,
|
|
37
|
+
validationRuleMessage,
|
|
38
|
+
validationRulePalette,
|
|
39
|
+
// onKeyDown,
|
|
40
|
+
infoText,
|
|
41
|
+
borderColor,
|
|
42
|
+
fieldSize,
|
|
43
|
+
labelPalette,
|
|
44
|
+
labelCustomClass,
|
|
45
|
+
htmlId,
|
|
46
|
+
lockedInfoText,
|
|
47
|
+
isLocked,
|
|
48
|
+
customProps,
|
|
49
|
+
renderLabelProps,
|
|
50
|
+
onChange,
|
|
51
|
+
onBlur,
|
|
52
|
+
getRef
|
|
53
|
+
} = props;
|
|
54
|
+
const {
|
|
55
|
+
LabelProps = {},
|
|
56
|
+
TextareaProps = {},
|
|
57
|
+
ValidationMessageProps1 = {},
|
|
58
|
+
ValidationMessageProps2 = {}
|
|
59
|
+
} = customProps;
|
|
60
|
+
const getNextId = useUniqueId();
|
|
61
|
+
let uniqueId = htmlId ? htmlId : getNextId();
|
|
26
62
|
|
|
27
|
-
handleChange
|
|
28
|
-
let {
|
|
29
|
-
id,
|
|
30
|
-
onChange
|
|
31
|
-
} = this.props;
|
|
63
|
+
const handleChange = value => {
|
|
32
64
|
onChange && onChange(id, value);
|
|
33
|
-
}
|
|
65
|
+
};
|
|
34
66
|
|
|
35
|
-
handleBlur
|
|
36
|
-
let {
|
|
37
|
-
id,
|
|
38
|
-
onBlur
|
|
39
|
-
} = this.props;
|
|
67
|
+
const handleBlur = value => {
|
|
40
68
|
onBlur && onBlur(id, value);
|
|
41
|
-
}
|
|
69
|
+
};
|
|
42
70
|
|
|
43
|
-
handleGetRef
|
|
44
|
-
let {
|
|
45
|
-
getRef,
|
|
46
|
-
id
|
|
47
|
-
} = this.props;
|
|
48
|
-
this.textarea = el;
|
|
71
|
+
const handleGetRef = el => {
|
|
49
72
|
getRef && getRef(el, id);
|
|
50
|
-
}
|
|
51
|
-
// let { isFocusOnLabelClick } = this.props;
|
|
52
|
-
// if (isFocusOnLabelClick && this.textarea && this.textarea.focus) {
|
|
53
|
-
// this.textarea.focus();
|
|
54
|
-
// }
|
|
55
|
-
// }
|
|
73
|
+
};
|
|
56
74
|
|
|
75
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
76
|
+
className: `${style.container} ${isDisabled ? style.disabled : isReadOnly ? style.readonly : ''}`,
|
|
77
|
+
"data-title": isDisabled ? title : null,
|
|
78
|
+
"data-selector-id": dataSelectorId
|
|
79
|
+
}, labelName && /*#__PURE__*/React.createElement(FieldContainer, {
|
|
80
|
+
infoText: infoText,
|
|
81
|
+
isLocked: isLocked,
|
|
82
|
+
lockedInfoText: lockedInfoText,
|
|
83
|
+
renderProps: renderLabelProps
|
|
84
|
+
}, /*#__PURE__*/React.createElement(Label, _extends({
|
|
85
|
+
text: labelName,
|
|
86
|
+
id: id,
|
|
87
|
+
size: fieldSize === 'small' ? 'small' : 'medium',
|
|
88
|
+
palette: isMandatory ? 'mandatory' : isDisabled ? 'primary' : labelPalette,
|
|
89
|
+
customClass: `${style.fieldLabel} ${labelCustomClass} ${isMandatory ? style.labelMandatory : ''}`,
|
|
90
|
+
htmlFor: uniqueId,
|
|
91
|
+
dataId: isDisabled ? `${dataId}_label_disabled` : isMandatory ? `${dataId}_label_mandatory` : `${dataId}_label`
|
|
92
|
+
}, LabelProps))), /*#__PURE__*/React.createElement("div", {
|
|
93
|
+
className: `${style.fieldContainer} ${labelName ? style[`fieldMargin_${fieldSize}`] : ''}`
|
|
94
|
+
}, /*#__PURE__*/React.createElement(Textarea, _extends({
|
|
95
|
+
onChange: handleChange,
|
|
96
|
+
animated: animated,
|
|
97
|
+
size: fieldSize === 'medium' ? textBoxSize : 'xmedium',
|
|
98
|
+
variant: textBoxVariant,
|
|
99
|
+
isReadOnly: isReadOnly,
|
|
100
|
+
isDisabled: isDisabled,
|
|
101
|
+
getRef: handleGetRef,
|
|
102
|
+
maxLength: maxLength,
|
|
103
|
+
text: value,
|
|
104
|
+
placeHolder: placeHolder,
|
|
105
|
+
dataId: `property(${dataId})`,
|
|
106
|
+
onBlur: handleBlur,
|
|
107
|
+
borderColor: borderColor,
|
|
108
|
+
needEffect: isReadOnly || isDisabled ? false : true,
|
|
109
|
+
resize: "vertical" // onKeyDown={onKeyDown}
|
|
110
|
+
,
|
|
111
|
+
htmlId: uniqueId
|
|
112
|
+
}, TextareaProps, {
|
|
113
|
+
a11y: {
|
|
114
|
+
ariaLabelledby: labelName
|
|
115
|
+
}
|
|
116
|
+
})), validationMessage && /*#__PURE__*/React.createElement(ValidationMessage, _extends({
|
|
117
|
+
text: validationMessage,
|
|
118
|
+
palette: validationPalette,
|
|
119
|
+
type: errorType,
|
|
120
|
+
htmlFor: uniqueId,
|
|
121
|
+
dataId: `${dataId}_ValidationMessage`
|
|
122
|
+
}, ValidationMessageProps1)), validationRuleMessage && /*#__PURE__*/React.createElement(ValidationMessage, _extends({
|
|
123
|
+
text: validationRuleMessage,
|
|
124
|
+
palette: validationRulePalette,
|
|
125
|
+
type: errorType,
|
|
126
|
+
htmlFor: uniqueId,
|
|
127
|
+
dataId: `${dataId}_ValidationRuleMessage`
|
|
128
|
+
}, ValidationMessageProps2))));
|
|
129
|
+
};
|
|
57
130
|
|
|
58
|
-
render() {
|
|
59
|
-
let {
|
|
60
|
-
labelName,
|
|
61
|
-
id,
|
|
62
|
-
isMandatory,
|
|
63
|
-
textBoxSize,
|
|
64
|
-
animated,
|
|
65
|
-
textBoxVariant,
|
|
66
|
-
isReadOnly,
|
|
67
|
-
validationMessage,
|
|
68
|
-
validationPalette,
|
|
69
|
-
maxLength,
|
|
70
|
-
value,
|
|
71
|
-
errorType,
|
|
72
|
-
isDisabled,
|
|
73
|
-
title,
|
|
74
|
-
placeHolder,
|
|
75
|
-
dataId,
|
|
76
|
-
dataSelectorId,
|
|
77
|
-
validationRuleMessage,
|
|
78
|
-
validationRulePalette,
|
|
79
|
-
// onKeyDown,
|
|
80
|
-
infoText,
|
|
81
|
-
borderColor,
|
|
82
|
-
fieldSize,
|
|
83
|
-
labelPalette,
|
|
84
|
-
labelCustomClass,
|
|
85
|
-
htmlId,
|
|
86
|
-
lockedInfoText,
|
|
87
|
-
isLocked,
|
|
88
|
-
customProps,
|
|
89
|
-
renderLabelProps
|
|
90
|
-
} = this.props;
|
|
91
|
-
const {
|
|
92
|
-
LabelProps = {},
|
|
93
|
-
TextareaProps = {},
|
|
94
|
-
ValidationMessageProps1 = {},
|
|
95
|
-
ValidationMessageProps2 = {}
|
|
96
|
-
} = customProps;
|
|
97
|
-
let uniqueId = htmlId ? htmlId : this.getNextId();
|
|
98
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
99
|
-
className: `${style.container} ${isDisabled ? style.disabled : isReadOnly ? style.readonly : ''}`,
|
|
100
|
-
"data-title": isDisabled ? title : null,
|
|
101
|
-
"data-selector-id": dataSelectorId
|
|
102
|
-
}, labelName && /*#__PURE__*/React.createElement(FieldContainer, {
|
|
103
|
-
infoText: infoText,
|
|
104
|
-
isLocked: isLocked,
|
|
105
|
-
lockedInfoText: lockedInfoText,
|
|
106
|
-
renderProps: renderLabelProps
|
|
107
|
-
}, /*#__PURE__*/React.createElement(Label, _extends({
|
|
108
|
-
text: labelName,
|
|
109
|
-
id: id,
|
|
110
|
-
size: fieldSize === 'small' ? 'small' : 'medium',
|
|
111
|
-
palette: isMandatory ? 'mandatory' : isDisabled ? 'primary' : labelPalette,
|
|
112
|
-
customClass: `${style.fieldLabel} ${labelCustomClass} ${isMandatory ? style.labelMandatory : ''}`,
|
|
113
|
-
htmlFor: uniqueId,
|
|
114
|
-
dataId: isDisabled ? `${dataId}_label_disabled` : isMandatory ? `${dataId}_label_mandatory` : `${dataId}_label`
|
|
115
|
-
}, LabelProps))), /*#__PURE__*/React.createElement("div", {
|
|
116
|
-
className: `${style.fieldContainer} ${labelName ? style[`fieldMargin_${fieldSize}`] : ''}`
|
|
117
|
-
}, /*#__PURE__*/React.createElement(Textarea, _extends({
|
|
118
|
-
onChange: this.handleChange,
|
|
119
|
-
animated: animated,
|
|
120
|
-
size: fieldSize === 'medium' ? textBoxSize : 'xmedium',
|
|
121
|
-
variant: textBoxVariant,
|
|
122
|
-
isReadOnly: isReadOnly,
|
|
123
|
-
isDisabled: isDisabled,
|
|
124
|
-
getRef: this.handleGetRef,
|
|
125
|
-
maxLength: maxLength,
|
|
126
|
-
text: value,
|
|
127
|
-
placeHolder: placeHolder,
|
|
128
|
-
dataId: `property(${dataId})`,
|
|
129
|
-
onBlur: this.handleBlur,
|
|
130
|
-
borderColor: borderColor,
|
|
131
|
-
needEffect: isReadOnly || isDisabled ? false : true,
|
|
132
|
-
resize: "vertical" // onKeyDown={onKeyDown}
|
|
133
|
-
,
|
|
134
|
-
htmlId: uniqueId
|
|
135
|
-
}, TextareaProps, {
|
|
136
|
-
a11y: {
|
|
137
|
-
ariaLabelledby: labelName
|
|
138
|
-
}
|
|
139
|
-
})), validationMessage && /*#__PURE__*/React.createElement(ValidationMessage, _extends({
|
|
140
|
-
text: validationMessage,
|
|
141
|
-
palette: validationPalette,
|
|
142
|
-
type: errorType,
|
|
143
|
-
htmlFor: uniqueId,
|
|
144
|
-
dataId: `${dataId}_ValidationMessage`
|
|
145
|
-
}, ValidationMessageProps1)), validationRuleMessage && /*#__PURE__*/React.createElement(ValidationMessage, _extends({
|
|
146
|
-
text: validationRuleMessage,
|
|
147
|
-
palette: validationRulePalette,
|
|
148
|
-
type: errorType,
|
|
149
|
-
htmlFor: uniqueId,
|
|
150
|
-
dataId: `${dataId}_ValidationRuleMessage`
|
|
151
|
-
}, ValidationMessageProps2))));
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
}
|
|
155
131
|
TextareaField.propTypes = propTypes;
|
|
156
|
-
TextareaField.defaultProps = defaultProps;
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
132
|
+
TextareaField.defaultProps = defaultProps;
|
|
133
|
+
const MemoizedTextareaField = /*#__PURE__*/memo(TextareaField);
|
|
134
|
+
MemoizedTextareaField.propTypes = propTypes;
|
|
135
|
+
MemoizedTextareaField.defaultProps = defaultProps;
|
|
136
|
+
MemoizedTextareaField.displayName = 'TextareaField';
|
|
137
|
+
export default TextareaField;
|