@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,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,156 +9,136 @@ import { propTypes } from './props/propTypes';
|
|
|
9
9
|
import Label from '@zohodesk/components/es/v1/Label/Label';
|
|
10
10
|
import TextBoxIcon from '@zohodesk/components/es/v1/TextBoxIcon/TextBoxIcon';
|
|
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 TextBoxField extends PureComponent {
|
|
18
|
-
constructor(props) {
|
|
19
|
-
super(props);
|
|
20
|
-
this.handleChange = this.handleChange.bind(this);
|
|
21
|
-
this.handleGetRef = this.handleGetRef.bind(this); // this.handleLabelClick = this.handleLabelClick.bind(this);
|
|
22
17
|
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
const TextBoxField = props => {
|
|
19
|
+
const {
|
|
20
|
+
labelName,
|
|
21
|
+
id,
|
|
22
|
+
textBoxSize,
|
|
23
|
+
textBoxVariant,
|
|
24
|
+
textBoxType,
|
|
25
|
+
isMandatory,
|
|
26
|
+
validationMessage,
|
|
27
|
+
validationPalette,
|
|
28
|
+
maxLength,
|
|
29
|
+
isReadOnly,
|
|
30
|
+
value,
|
|
31
|
+
errorType,
|
|
32
|
+
isDisabled,
|
|
33
|
+
title,
|
|
34
|
+
onBlur,
|
|
35
|
+
dataId,
|
|
36
|
+
dataSelectorId,
|
|
37
|
+
validationRuleMessage,
|
|
38
|
+
validationRulePalette,
|
|
39
|
+
onKeyDown,
|
|
40
|
+
placeHolder,
|
|
41
|
+
infoText,
|
|
42
|
+
borderColor,
|
|
43
|
+
fieldSize,
|
|
44
|
+
labelPalette,
|
|
45
|
+
labelCustomClass,
|
|
46
|
+
htmlId,
|
|
47
|
+
lockedInfoText,
|
|
48
|
+
isLocked,
|
|
49
|
+
needReadOnlyStyle,
|
|
50
|
+
isClickable,
|
|
51
|
+
onFocus,
|
|
52
|
+
ePhiData,
|
|
53
|
+
children,
|
|
54
|
+
customProps,
|
|
55
|
+
renderLabelProps,
|
|
56
|
+
onChange,
|
|
57
|
+
getRef
|
|
58
|
+
} = props;
|
|
59
|
+
const {
|
|
60
|
+
LabelProps = {},
|
|
61
|
+
TextBoxIconProps = {},
|
|
62
|
+
ValidationMessageProps1 = {},
|
|
63
|
+
ValidationMessageProps2 = {}
|
|
64
|
+
} = customProps;
|
|
65
|
+
const getNextId = useUniqueId();
|
|
66
|
+
let uniqueId = htmlId ? htmlId : getNextId();
|
|
25
67
|
|
|
26
|
-
handleChange
|
|
27
|
-
let {
|
|
28
|
-
id,
|
|
29
|
-
onChange
|
|
30
|
-
} = this.props;
|
|
68
|
+
const handleChange = value => {
|
|
31
69
|
onChange && onChange(id, value);
|
|
32
|
-
}
|
|
70
|
+
};
|
|
33
71
|
|
|
34
|
-
handleGetRef
|
|
35
|
-
let {
|
|
36
|
-
getRef,
|
|
37
|
-
id
|
|
38
|
-
} = this.props;
|
|
39
|
-
this.textBox = el;
|
|
72
|
+
const handleGetRef = el => {
|
|
40
73
|
getRef && getRef(el, id);
|
|
41
|
-
}
|
|
42
|
-
// // let { isFocusOnLabelClick } = this.props;
|
|
43
|
-
// // if (isFocusOnLabelClick && this.textBox && this.textBox.focus) {
|
|
44
|
-
// // this.textBox.focus();
|
|
45
|
-
// // }
|
|
46
|
-
// }
|
|
74
|
+
};
|
|
47
75
|
|
|
76
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
77
|
+
className: `${style.container} ${isDisabled ? style.disabled : isReadOnly ? style.readonly : ''}`,
|
|
78
|
+
"data-title": isDisabled ? title : null,
|
|
79
|
+
"data-selector-id": dataSelectorId
|
|
80
|
+
}, labelName && /*#__PURE__*/React.createElement(FieldContainer, {
|
|
81
|
+
infoText: infoText,
|
|
82
|
+
isLocked: isLocked,
|
|
83
|
+
lockedInfoText: lockedInfoText,
|
|
84
|
+
ePhiData: ePhiData,
|
|
85
|
+
dataId: dataId,
|
|
86
|
+
renderProps: renderLabelProps
|
|
87
|
+
}, /*#__PURE__*/React.createElement(Label, _extends({
|
|
88
|
+
text: labelName,
|
|
89
|
+
size: fieldSize === 'small' ? 'small' : 'medium',
|
|
90
|
+
palette: isMandatory ? 'mandatory' : isDisabled ? 'primary' : labelPalette,
|
|
91
|
+
customClass: `${style.fieldLabel} ${labelCustomClass} ${isMandatory ? style.labelMandatory : ''}`,
|
|
92
|
+
htmlFor: uniqueId,
|
|
93
|
+
dataId: isDisabled ? `${dataId}_label_disabled` : isMandatory ? `${dataId}_label_mandatory` : `${dataId}_label`
|
|
94
|
+
}, LabelProps, {
|
|
95
|
+
id: labelName
|
|
96
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
97
|
+
className: `${style.fieldContainer} ${labelName ? style[`fieldMargin_${fieldSize}`] : ''}`
|
|
98
|
+
}, /*#__PURE__*/React.createElement(TextBoxIcon, _extends({
|
|
99
|
+
htmlId: uniqueId,
|
|
100
|
+
id: id,
|
|
101
|
+
type: textBoxType,
|
|
102
|
+
variant: textBoxVariant,
|
|
103
|
+
size: fieldSize === 'medium' ? textBoxSize : 'xsmall',
|
|
104
|
+
maxLength: maxLength,
|
|
105
|
+
isReadOnly: isReadOnly,
|
|
106
|
+
inputRef: handleGetRef,
|
|
107
|
+
value: value,
|
|
108
|
+
onChange: handleChange,
|
|
109
|
+
dataId: dataId,
|
|
110
|
+
onBlur: onBlur,
|
|
111
|
+
onKeyDown: onKeyDown,
|
|
112
|
+
placeHolder: placeHolder,
|
|
113
|
+
borderColor: borderColor,
|
|
114
|
+
onFocus: onFocus,
|
|
115
|
+
isDisabled: isDisabled,
|
|
116
|
+
needEffect: isReadOnly || isDisabled ? false : true,
|
|
117
|
+
isClickable: isClickable,
|
|
118
|
+
needReadOnlyStyle: needReadOnlyStyle
|
|
119
|
+
}, TextBoxIconProps, {
|
|
120
|
+
a11y: {
|
|
121
|
+
ariaLabelledby: labelName
|
|
122
|
+
}
|
|
123
|
+
}), children ? children : null), validationMessage && /*#__PURE__*/React.createElement(ValidationMessage, _extends({
|
|
124
|
+
text: validationMessage,
|
|
125
|
+
palette: validationPalette,
|
|
126
|
+
type: errorType,
|
|
127
|
+
dataId: `${dataId}_ValidationMessage`,
|
|
128
|
+
htmlFor: uniqueId
|
|
129
|
+
}, ValidationMessageProps1)), validationRuleMessage && /*#__PURE__*/React.createElement(ValidationMessage, _extends({
|
|
130
|
+
text: validationRuleMessage,
|
|
131
|
+
palette: validationRulePalette,
|
|
132
|
+
type: errorType,
|
|
133
|
+
htmlFor: uniqueId,
|
|
134
|
+
dataId: `${dataId}_ValidationRuleMessage`
|
|
135
|
+
}, ValidationMessageProps2))));
|
|
136
|
+
};
|
|
48
137
|
|
|
49
|
-
render() {
|
|
50
|
-
let {
|
|
51
|
-
labelName,
|
|
52
|
-
id,
|
|
53
|
-
textBoxSize,
|
|
54
|
-
textBoxVariant,
|
|
55
|
-
textBoxType,
|
|
56
|
-
isMandatory,
|
|
57
|
-
validationMessage,
|
|
58
|
-
validationPalette,
|
|
59
|
-
maxLength,
|
|
60
|
-
isReadOnly,
|
|
61
|
-
value,
|
|
62
|
-
errorType,
|
|
63
|
-
isDisabled,
|
|
64
|
-
title,
|
|
65
|
-
onBlur,
|
|
66
|
-
dataId,
|
|
67
|
-
dataSelectorId,
|
|
68
|
-
validationRuleMessage,
|
|
69
|
-
validationRulePalette,
|
|
70
|
-
onKeyDown,
|
|
71
|
-
placeHolder,
|
|
72
|
-
infoText,
|
|
73
|
-
borderColor,
|
|
74
|
-
fieldSize,
|
|
75
|
-
labelPalette,
|
|
76
|
-
labelCustomClass,
|
|
77
|
-
htmlId,
|
|
78
|
-
lockedInfoText,
|
|
79
|
-
isLocked,
|
|
80
|
-
needReadOnlyStyle,
|
|
81
|
-
isClickable,
|
|
82
|
-
onFocus,
|
|
83
|
-
ePhiData,
|
|
84
|
-
children,
|
|
85
|
-
customProps,
|
|
86
|
-
renderLabelProps
|
|
87
|
-
} = this.props;
|
|
88
|
-
const {
|
|
89
|
-
LabelProps = {},
|
|
90
|
-
TextBoxIconProps = {},
|
|
91
|
-
ValidationMessageProps1 = {},
|
|
92
|
-
ValidationMessageProps2 = {}
|
|
93
|
-
} = customProps;
|
|
94
|
-
let uniqueId = htmlId ? htmlId : this.getNextId();
|
|
95
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
96
|
-
className: `${style.container} ${isDisabled ? style.disabled : isReadOnly ? style.readonly : ''}`,
|
|
97
|
-
"data-title": isDisabled ? title : null,
|
|
98
|
-
"data-selector-id": dataSelectorId
|
|
99
|
-
}, labelName && /*#__PURE__*/React.createElement(FieldContainer, {
|
|
100
|
-
infoText: infoText,
|
|
101
|
-
isLocked: isLocked,
|
|
102
|
-
lockedInfoText: lockedInfoText,
|
|
103
|
-
ePhiData: ePhiData,
|
|
104
|
-
dataId: dataId,
|
|
105
|
-
renderProps: renderLabelProps
|
|
106
|
-
}, /*#__PURE__*/React.createElement(Label, _extends({
|
|
107
|
-
text: labelName,
|
|
108
|
-
size: fieldSize === 'small' ? 'small' : 'medium',
|
|
109
|
-
palette: isMandatory ? 'mandatory' : isDisabled ? 'primary' : labelPalette,
|
|
110
|
-
customClass: `${style.fieldLabel} ${labelCustomClass} ${isMandatory ? style.labelMandatory : ''}`,
|
|
111
|
-
htmlFor: uniqueId,
|
|
112
|
-
dataId: isDisabled ? `${dataId}_label_disabled` : isMandatory ? `${dataId}_label_mandatory` : `${dataId}_label`
|
|
113
|
-
}, LabelProps, {
|
|
114
|
-
id: labelName
|
|
115
|
-
}))), /*#__PURE__*/React.createElement("div", {
|
|
116
|
-
className: `${style.fieldContainer} ${labelName ? style[`fieldMargin_${fieldSize}`] : ''}`
|
|
117
|
-
}, /*#__PURE__*/React.createElement(TextBoxIcon, _extends({
|
|
118
|
-
htmlId: uniqueId,
|
|
119
|
-
id: id,
|
|
120
|
-
type: textBoxType,
|
|
121
|
-
variant: textBoxVariant,
|
|
122
|
-
size: fieldSize === 'medium' ? textBoxSize : 'xsmall',
|
|
123
|
-
maxLength: maxLength,
|
|
124
|
-
isReadOnly: isReadOnly,
|
|
125
|
-
inputRef: this.handleGetRef,
|
|
126
|
-
value: value,
|
|
127
|
-
onChange: this.handleChange,
|
|
128
|
-
dataId: dataId,
|
|
129
|
-
onBlur: onBlur,
|
|
130
|
-
onKeyDown: onKeyDown,
|
|
131
|
-
placeHolder: placeHolder,
|
|
132
|
-
borderColor: borderColor,
|
|
133
|
-
onFocus: onFocus,
|
|
134
|
-
isDisabled: isDisabled,
|
|
135
|
-
needEffect: isReadOnly || isDisabled ? false : true,
|
|
136
|
-
isClickable: isClickable,
|
|
137
|
-
needReadOnlyStyle: needReadOnlyStyle
|
|
138
|
-
}, TextBoxIconProps, {
|
|
139
|
-
a11y: {
|
|
140
|
-
ariaLabelledby: labelName
|
|
141
|
-
}
|
|
142
|
-
}), children ? children : null), validationMessage && /*#__PURE__*/React.createElement(ValidationMessage, _extends({
|
|
143
|
-
text: validationMessage,
|
|
144
|
-
palette: validationPalette,
|
|
145
|
-
type: errorType,
|
|
146
|
-
dataId: `${dataId}_ValidationMessage`,
|
|
147
|
-
htmlFor: uniqueId
|
|
148
|
-
}, ValidationMessageProps1)), validationRuleMessage && /*#__PURE__*/React.createElement(ValidationMessage, _extends({
|
|
149
|
-
text: validationRuleMessage,
|
|
150
|
-
palette: validationRulePalette,
|
|
151
|
-
type: errorType,
|
|
152
|
-
htmlFor: uniqueId,
|
|
153
|
-
dataId: `${dataId}_ValidationRuleMessage`
|
|
154
|
-
}, ValidationMessageProps2))));
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
}
|
|
158
138
|
TextBoxField.propTypes = propTypes;
|
|
159
|
-
TextBoxField.defaultProps = defaultProps;
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
139
|
+
TextBoxField.defaultProps = defaultProps;
|
|
140
|
+
const MemoizedTextBoxField = /*#__PURE__*/memo(TextBoxField);
|
|
141
|
+
MemoizedTextBoxField.propTypes = propTypes;
|
|
142
|
+
MemoizedTextBoxField.defaultProps = defaultProps;
|
|
143
|
+
MemoizedTextBoxField.displayName = 'TextBoxField';
|
|
144
|
+
export default TextBoxField;
|
|
@@ -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, useRef } from 'react';
|
|
5
5
|
import { defaultProps } from './props/defaultProps';
|
|
6
6
|
import { propTypes } from './props/propTypes';
|
|
7
7
|
/**** Components ****/
|
|
@@ -13,166 +13,146 @@ import FieldContainer from '../FieldContainer/FieldContainer';
|
|
|
13
13
|
/** Css */
|
|
14
14
|
|
|
15
15
|
import style from '../../../../form/fields/Fields.module.css';
|
|
16
|
-
export default class TextEditorField extends PureComponent {
|
|
17
|
-
constructor(props) {
|
|
18
|
-
super(props);
|
|
19
|
-
this.handleChange = this.handleChange.bind(this);
|
|
20
|
-
this.handleGetRef = this.handleGetRef.bind(this);
|
|
21
|
-
this.handleLabelClick = this.handleLabelClick.bind(this);
|
|
22
|
-
this.renderEnd = this.renderEnd.bind(this);
|
|
23
|
-
}
|
|
24
16
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
17
|
+
const TextEditorField = props => {
|
|
18
|
+
const {
|
|
19
|
+
labelName,
|
|
20
|
+
id,
|
|
21
|
+
isMandatory,
|
|
22
|
+
value,
|
|
23
|
+
validationMessage,
|
|
24
|
+
validationPalette,
|
|
25
|
+
isReadOnly,
|
|
26
|
+
onAttachmentUpload,
|
|
27
|
+
needEditor,
|
|
28
|
+
dataId,
|
|
29
|
+
dataSelectorId,
|
|
30
|
+
isDisabled,
|
|
31
|
+
fieldSize,
|
|
32
|
+
textBoxSize,
|
|
33
|
+
textBoxVariant,
|
|
34
|
+
labelPalette,
|
|
35
|
+
labelCustomClass,
|
|
36
|
+
infoText,
|
|
37
|
+
isLocked,
|
|
38
|
+
lockedInfoText,
|
|
39
|
+
errorType,
|
|
40
|
+
EDITORURL,
|
|
41
|
+
editorMode,
|
|
42
|
+
isCustomScroll,
|
|
43
|
+
initCallback,
|
|
44
|
+
loadingComponent,
|
|
45
|
+
handleAlertMessage,
|
|
46
|
+
editorCallback,
|
|
47
|
+
editorBlurCallback,
|
|
48
|
+
editorOptions,
|
|
49
|
+
onFocus,
|
|
50
|
+
isEditorDefaultOpen,
|
|
51
|
+
changeEditorContent,
|
|
52
|
+
shouldEditorUpdateContent,
|
|
53
|
+
setInlineAttachmentInProgress,
|
|
54
|
+
handleEditorDropUpload,
|
|
55
|
+
ImgLazyLoad,
|
|
56
|
+
needInlineAttachment,
|
|
57
|
+
i18nKeys,
|
|
58
|
+
className,
|
|
59
|
+
children,
|
|
60
|
+
ePhiData,
|
|
61
|
+
customProps,
|
|
62
|
+
onChange,
|
|
63
|
+
getRef,
|
|
64
|
+
isFocusOnLabelClick
|
|
65
|
+
} = props;
|
|
66
|
+
const textEditorEleRef = useRef(null);
|
|
67
|
+
const {
|
|
68
|
+
LabelProps = {},
|
|
69
|
+
TextEditorWrapperProps = {},
|
|
70
|
+
ValidationMessageProps = {}
|
|
71
|
+
} = customProps;
|
|
72
|
+
|
|
73
|
+
const handleChange = value => {
|
|
30
74
|
onChange && onChange(id, value);
|
|
31
|
-
}
|
|
75
|
+
};
|
|
32
76
|
|
|
33
|
-
handleGetRef
|
|
34
|
-
|
|
35
|
-
getRef,
|
|
36
|
-
id
|
|
37
|
-
} = this.props;
|
|
38
|
-
this.textEditor = el;
|
|
77
|
+
const handleGetRef = el => {
|
|
78
|
+
textEditorEleRef.current = el;
|
|
39
79
|
getRef && getRef(el, id);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
handleLabelClick() {
|
|
43
|
-
let {
|
|
44
|
-
isFocusOnLabelClick,
|
|
45
|
-
isDisabled,
|
|
46
|
-
isReadOnly
|
|
47
|
-
} = this.props;
|
|
80
|
+
};
|
|
48
81
|
|
|
49
|
-
|
|
50
|
-
|
|
82
|
+
const handleLabelClick = () => {
|
|
83
|
+
if (isFocusOnLabelClick && !isDisabled && !isReadOnly && textEditorEleRef.current && textEditorEleRef.current.focus) {
|
|
84
|
+
textEditorEleRef.current.focus();
|
|
51
85
|
}
|
|
52
|
-
}
|
|
86
|
+
};
|
|
53
87
|
|
|
54
|
-
renderEnd() {
|
|
55
|
-
let {
|
|
56
|
-
children
|
|
57
|
-
} = this.props;
|
|
88
|
+
const renderEnd = () => {
|
|
58
89
|
return children ? children : null;
|
|
59
|
-
}
|
|
90
|
+
};
|
|
60
91
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
-
dataId: dataId,
|
|
121
|
-
renderProps: {
|
|
122
|
-
end: this.renderEnd
|
|
123
|
-
}
|
|
124
|
-
}, /*#__PURE__*/React.createElement(Label, _extends({
|
|
125
|
-
text: labelName,
|
|
126
|
-
size: fieldSize === 'small' ? 'small' : 'medium',
|
|
127
|
-
htmlFor: !isReadOnly && !isDisabled ? id : undefined,
|
|
128
|
-
palette: isMandatory ? 'mandatory' : isDisabled ? 'primary' : labelPalette,
|
|
129
|
-
onClick: this.handleLabelClick,
|
|
130
|
-
customClass: `${style.fieldLabel} ${labelCustomClass} ${isMandatory ? style.labelMandatory : ''}`,
|
|
131
|
-
dataId: isDisabled ? `${dataId}_label_disabled` : isMandatory ? `${dataId}_label_mandatory` : `${dataId}_label`
|
|
132
|
-
}, LabelProps))), /*#__PURE__*/React.createElement("div", {
|
|
133
|
-
className: `${style.fieldContainer} ${labelName ? style[`fieldMargin_${fieldSize}`] : ''}`
|
|
134
|
-
}, /*#__PURE__*/React.createElement(TextEditorWrapper, _extends({
|
|
135
|
-
needEditor: needEditor,
|
|
136
|
-
onChange: this.handleChange,
|
|
137
|
-
id: id,
|
|
138
|
-
value: value,
|
|
139
|
-
isReadOnly: isReadOnly,
|
|
140
|
-
getRef: this.handleGetRef,
|
|
141
|
-
onAttachmentUpload: onAttachmentUpload,
|
|
142
|
-
dataId: dataId,
|
|
143
|
-
isDisabled: isDisabled,
|
|
144
|
-
textBoxSize: fieldSize === 'medium' ? textBoxSize : 'xsmall',
|
|
145
|
-
textBoxVariant: textBoxVariant,
|
|
146
|
-
EDITORURL: EDITORURL,
|
|
147
|
-
editorMode: editorMode,
|
|
148
|
-
isCustomScroll: isCustomScroll,
|
|
149
|
-
initCallback: initCallback,
|
|
150
|
-
loadingComponent: loadingComponent,
|
|
151
|
-
handleAlertMessage: handleAlertMessage,
|
|
152
|
-
editorCallback: editorCallback,
|
|
153
|
-
i18nKeys: i18nKeys,
|
|
154
|
-
ImgLazyLoad: ImgLazyLoad,
|
|
155
|
-
editorOptions: editorOptions,
|
|
156
|
-
editorBlurCallback: editorBlurCallback,
|
|
157
|
-
onFocus: onFocus,
|
|
158
|
-
isEditorDefaultOpen: isEditorDefaultOpen,
|
|
159
|
-
changeEditorContent: changeEditorContent,
|
|
160
|
-
shouldEditorUpdateContent: shouldEditorUpdateContent,
|
|
161
|
-
setInlineAttachmentInProgress: setInlineAttachmentInProgress,
|
|
162
|
-
handleEditorDropUpload: handleEditorDropUpload,
|
|
163
|
-
needInlineAttachment: needInlineAttachment
|
|
164
|
-
}, TextEditorWrapperProps))), validationMessage && /*#__PURE__*/React.createElement(ValidationMessage, _extends({
|
|
165
|
-
text: validationMessage,
|
|
166
|
-
palette: validationPalette,
|
|
167
|
-
type: errorType,
|
|
168
|
-
dataId: `${dataId}_ValidationMessage`
|
|
169
|
-
}, ValidationMessageProps)));
|
|
170
|
-
}
|
|
92
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
93
|
+
className: `${style.container} ${isDisabled ? style.disabled : isReadOnly ? style.readonly : ''} ${className || ''}`,
|
|
94
|
+
"data-selector-id": dataSelectorId
|
|
95
|
+
}, labelName && /*#__PURE__*/React.createElement(FieldContainer, {
|
|
96
|
+
infoText: infoText,
|
|
97
|
+
isLocked: isLocked,
|
|
98
|
+
lockedInfoText: lockedInfoText,
|
|
99
|
+
ePhiData: ePhiData,
|
|
100
|
+
dataId: dataId,
|
|
101
|
+
renderProps: {
|
|
102
|
+
end: renderEnd
|
|
103
|
+
}
|
|
104
|
+
}, /*#__PURE__*/React.createElement(Label, _extends({
|
|
105
|
+
text: labelName,
|
|
106
|
+
size: fieldSize === 'small' ? 'small' : 'medium',
|
|
107
|
+
htmlFor: !isReadOnly && !isDisabled ? id : undefined,
|
|
108
|
+
palette: isMandatory ? 'mandatory' : isDisabled ? 'primary' : labelPalette,
|
|
109
|
+
onClick: handleLabelClick,
|
|
110
|
+
customClass: `${style.fieldLabel} ${labelCustomClass} ${isMandatory ? style.labelMandatory : ''}`,
|
|
111
|
+
dataId: isDisabled ? `${dataId}_label_disabled` : isMandatory ? `${dataId}_label_mandatory` : `${dataId}_label`
|
|
112
|
+
}, LabelProps))), /*#__PURE__*/React.createElement("div", {
|
|
113
|
+
className: `${style.fieldContainer} ${labelName ? style[`fieldMargin_${fieldSize}`] : ''}`
|
|
114
|
+
}, /*#__PURE__*/React.createElement(TextEditorWrapper, _extends({
|
|
115
|
+
needEditor: needEditor,
|
|
116
|
+
onChange: handleChange,
|
|
117
|
+
id: id,
|
|
118
|
+
value: value,
|
|
119
|
+
isReadOnly: isReadOnly,
|
|
120
|
+
getRef: handleGetRef,
|
|
121
|
+
onAttachmentUpload: onAttachmentUpload,
|
|
122
|
+
dataId: dataId,
|
|
123
|
+
isDisabled: isDisabled,
|
|
124
|
+
textBoxSize: fieldSize === 'medium' ? textBoxSize : 'xsmall',
|
|
125
|
+
textBoxVariant: textBoxVariant,
|
|
126
|
+
EDITORURL: EDITORURL,
|
|
127
|
+
editorMode: editorMode,
|
|
128
|
+
isCustomScroll: isCustomScroll,
|
|
129
|
+
initCallback: initCallback,
|
|
130
|
+
loadingComponent: loadingComponent,
|
|
131
|
+
handleAlertMessage: handleAlertMessage,
|
|
132
|
+
editorCallback: editorCallback,
|
|
133
|
+
i18nKeys: i18nKeys,
|
|
134
|
+
ImgLazyLoad: ImgLazyLoad,
|
|
135
|
+
editorOptions: editorOptions,
|
|
136
|
+
editorBlurCallback: editorBlurCallback,
|
|
137
|
+
onFocus: onFocus,
|
|
138
|
+
isEditorDefaultOpen: isEditorDefaultOpen,
|
|
139
|
+
changeEditorContent: changeEditorContent,
|
|
140
|
+
shouldEditorUpdateContent: shouldEditorUpdateContent,
|
|
141
|
+
setInlineAttachmentInProgress: setInlineAttachmentInProgress,
|
|
142
|
+
handleEditorDropUpload: handleEditorDropUpload,
|
|
143
|
+
needInlineAttachment: needInlineAttachment
|
|
144
|
+
}, TextEditorWrapperProps))), validationMessage && /*#__PURE__*/React.createElement(ValidationMessage, _extends({
|
|
145
|
+
text: validationMessage,
|
|
146
|
+
palette: validationPalette,
|
|
147
|
+
type: errorType,
|
|
148
|
+
dataId: `${dataId}_ValidationMessage`
|
|
149
|
+
}, ValidationMessageProps)));
|
|
150
|
+
};
|
|
171
151
|
|
|
172
|
-
}
|
|
173
152
|
TextEditorField.propTypes = propTypes;
|
|
174
|
-
TextEditorField.defaultProps = defaultProps;
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
153
|
+
TextEditorField.defaultProps = defaultProps;
|
|
154
|
+
const MemoizedTextEditorField = /*#__PURE__*/memo(TextEditorField);
|
|
155
|
+
MemoizedTextEditorField.propTypes = propTypes;
|
|
156
|
+
MemoizedTextEditorField.defaultProps = defaultProps;
|
|
157
|
+
MemoizedTextEditorField.displayName = 'TextEditorField';
|
|
158
|
+
export default TextEditorField;
|