@zohodesk/dot 1.0.0-temp-187.3 → 1.0.0-temp-201
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/propValidation_report.html +1 -1
- package/README.md +10 -0
- package/es/form/fields/Fields.module.css +1 -1
- package/es/form/fields/RadioField/RadioField.js +69 -6
- package/es/form/fields/RadioField/props/defaultProps.js +1 -0
- package/es/form/fields/RadioField/props/propTypes.js +3 -0
- package/es/form/fields/TagsMultiSelect/TagsMultiSelect.js +2 -4
- package/es/list/DepartmentDropDown/DepartmentDropDown.js +2 -7
- package/es/list/DepartmentDropDown/props/defaultProps.js +1 -2
- package/es/list/DepartmentDropDown/props/propTypes.js +1 -2
- package/es/list/status/StatusListItem/StatusListItem.module.css +5 -35
- package/es/lookup/header/Search/LookupSearch.module.css +33 -27
- package/es/lookup/header/Search/Search.js +58 -40
- package/es/lookup/header/Search/__tests__/Search.spec.js +67 -1
- package/es/lookup/header/Search/__tests__/__snapshots__/Search.spec.js.snap +316 -3
- package/es/lookup/header/Search/props/defaultProps.js +3 -1
- package/es/lookup/header/Search/props/propTypes.js +6 -1
- package/es/v1/form/fields/RadioField/RadioField.js +3 -2
- package/lib/form/fields/Fields.module.css +1 -1
- package/lib/form/fields/RadioField/RadioField.js +100 -31
- package/lib/form/fields/RadioField/props/defaultProps.js +1 -0
- package/lib/form/fields/RadioField/props/propTypes.js +3 -0
- package/lib/form/fields/TagsMultiSelect/TagsMultiSelect.js +3 -5
- package/lib/list/DepartmentDropDown/DepartmentDropDown.js +3 -8
- package/lib/list/DepartmentDropDown/props/defaultProps.js +1 -2
- package/lib/list/DepartmentDropDown/props/propTypes.js +1 -1
- package/lib/list/status/StatusListItem/StatusListItem.module.css +5 -35
- package/lib/lookup/header/Search/LookupSearch.module.css +33 -27
- package/lib/lookup/header/Search/Search.js +76 -66
- package/lib/lookup/header/Search/__tests__/Search.spec.js +65 -0
- package/lib/lookup/header/Search/__tests__/__snapshots__/Search.spec.js.snap +316 -3
- package/lib/lookup/header/Search/props/defaultProps.js +3 -1
- package/lib/lookup/header/Search/props/propTypes.js +6 -1
- package/lib/v1/form/fields/RadioField/RadioField.js +3 -2
- package/package.json +6 -6
- package/result.json +1 -1
- package/unittest/index.html +1 -1
|
@@ -12,8 +12,10 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
12
12
|
var propTypes = {
|
|
13
13
|
dataId: _propTypes["default"].string,
|
|
14
14
|
errorType: _propTypes["default"].oneOf(['primary', 'secondary']),
|
|
15
|
+
getRef: _propTypes["default"].func,
|
|
15
16
|
id: _propTypes["default"].string,
|
|
16
17
|
isActive: _propTypes["default"].bool,
|
|
18
|
+
isBoxStyle: _propTypes["default"].bool,
|
|
17
19
|
isDisabled: _propTypes["default"].bool,
|
|
18
20
|
isMandatory: _propTypes["default"].bool,
|
|
19
21
|
isReadOnly: _propTypes["default"].bool,
|
|
@@ -33,6 +35,7 @@ var propTypes = {
|
|
|
33
35
|
customProps: _propTypes["default"].shape({
|
|
34
36
|
LabelProps: _propTypes["default"].object,
|
|
35
37
|
RadioProps: _propTypes["default"].object,
|
|
38
|
+
InfoIconProps: _propTypes["default"].object,
|
|
36
39
|
ValidationMessageProps1: _propTypes["default"].object,
|
|
37
40
|
ValidationMessageProps2: _propTypes["default"].object
|
|
38
41
|
}),
|
|
@@ -227,9 +227,7 @@ var TagsMultiSelect = /*#__PURE__*/function (_React$Component) {
|
|
|
227
227
|
_customProps$TagWrapp = customProps.TagWrapperProps,
|
|
228
228
|
TagWrapperProps = _customProps$TagWrapp === void 0 ? {} : _customProps$TagWrapp,
|
|
229
229
|
_customProps$TagProps = customProps.TagProps,
|
|
230
|
-
TagProps = _customProps$TagProps === void 0 ? {} : _customProps$TagProps
|
|
231
|
-
_customProps$listProp = customProps.listProps,
|
|
232
|
-
listProps = _customProps$listProp === void 0 ? {} : _customProps$listProp;
|
|
230
|
+
TagProps = _customProps$TagProps === void 0 ? {} : _customProps$TagProps;
|
|
233
231
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
234
232
|
className: "".concat(_TagsMultiSelectModule["default"].container, " ").concat(!isReadOnly ? " ".concat(needBorder ? _TagsMultiSelectModule["default"].hasBorder : '', "\n ").concat(needBorder ? _TagsMultiSelectModule["default"]["borderColor_".concat(borderColor)] : _TagsMultiSelectModule["default"].borderColor_transparent, " ").concat(isPopupReady && needBorder ? _TagsMultiSelectModule["default"].active : '') : '', " ").concat(className),
|
|
235
233
|
onClick: _General.stopBubbling,
|
|
@@ -338,7 +336,7 @@ var TagsMultiSelect = /*#__PURE__*/function (_React$Component) {
|
|
|
338
336
|
var name = item.name,
|
|
339
337
|
isNew = item.isNew,
|
|
340
338
|
listItemProps = item.listItemProps;
|
|
341
|
-
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, searchList.length > 1 && isNew ? /*#__PURE__*/_react["default"].createElement(_DropDownSeparator["default"], null) : null, /*#__PURE__*/_react["default"].createElement(_ListItem["default"],
|
|
339
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, searchList.length > 1 && isNew ? /*#__PURE__*/_react["default"].createElement(_DropDownSeparator["default"], null) : null, /*#__PURE__*/_react["default"].createElement(_ListItem["default"], {
|
|
342
340
|
key: index,
|
|
343
341
|
index: index,
|
|
344
342
|
autoHover: true,
|
|
@@ -351,7 +349,7 @@ var TagsMultiSelect = /*#__PURE__*/function (_React$Component) {
|
|
|
351
349
|
isDisabled: listDisabled,
|
|
352
350
|
customProps: listItemProps,
|
|
353
351
|
customClass: listItemClass
|
|
354
|
-
},
|
|
352
|
+
}, isNew ? /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
355
353
|
alignBox: "row",
|
|
356
354
|
align: "vertical"
|
|
357
355
|
}, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
@@ -25,8 +25,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
25
25
|
|
|
26
26
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
27
|
|
|
28
|
-
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); }
|
|
29
|
-
|
|
30
28
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
31
29
|
|
|
32
30
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
@@ -102,10 +100,7 @@ var DepartmentDropDown = /*#__PURE__*/function (_Component) {
|
|
|
102
100
|
onSearch = _this$props3.onSearch,
|
|
103
101
|
needSearchFetching = _this$props3.needSearchFetching,
|
|
104
102
|
searchStr = _this$props3.searchStr,
|
|
105
|
-
i18nKeys = _this$props3.i18nKeys
|
|
106
|
-
customProps = _this$props3.customProps;
|
|
107
|
-
var _customProps$toggleDr = customProps.toggleDropDownProps,
|
|
108
|
-
toggleDropDownProps = _customProps$toggleDr === void 0 ? {} : _customProps$toggleDr;
|
|
103
|
+
i18nKeys = _this$props3.i18nKeys;
|
|
109
104
|
var _i18nKeys$title = i18nKeys.title,
|
|
110
105
|
title = _i18nKeys$title === void 0 ? 'Move Department' : _i18nKeys$title,
|
|
111
106
|
_i18nKeys$searchEmpty = i18nKeys.searchEmptyText,
|
|
@@ -114,7 +109,7 @@ var DepartmentDropDown = /*#__PURE__*/function (_Component) {
|
|
|
114
109
|
searchErrorText = _i18nKeys$searchError === void 0 ? 'No results' : _i18nKeys$searchError,
|
|
115
110
|
_i18nKeys$placeholder = i18nKeys.placeholder,
|
|
116
111
|
placeholder = _i18nKeys$placeholder === void 0 ? 'Search Department' : _i18nKeys$placeholder;
|
|
117
|
-
return /*#__PURE__*/_react["default"].createElement(_ToggleDropDown["default"],
|
|
112
|
+
return /*#__PURE__*/_react["default"].createElement(_ToggleDropDown["default"], {
|
|
118
113
|
title: title,
|
|
119
114
|
options: departmentList,
|
|
120
115
|
value: /*#__PURE__*/_react["default"].createElement(_SecondaryText.DepartmentText, {
|
|
@@ -143,7 +138,7 @@ var DepartmentDropDown = /*#__PURE__*/function (_Component) {
|
|
|
143
138
|
isNextOptions: isNextOptions,
|
|
144
139
|
onSearch: onSearch,
|
|
145
140
|
needSearchFetching: needSearchFetching
|
|
146
|
-
}
|
|
141
|
+
});
|
|
147
142
|
}
|
|
148
143
|
}]);
|
|
149
144
|
|
|
@@ -31,5 +31,5 @@ var propTypes = (_propTypes = {
|
|
|
31
31
|
searchEmptyText: _propTypes2["default"].string,
|
|
32
32
|
searchErrorText: _propTypes2["default"].string,
|
|
33
33
|
placeholder: _propTypes2["default"].string
|
|
34
|
-
})),
|
|
34
|
+
})), _propTypes);
|
|
35
35
|
exports.propTypes = propTypes;
|
|
@@ -6,58 +6,43 @@
|
|
|
6
6
|
min-height: var(--zd_size35) ;
|
|
7
7
|
cursor: pointer;
|
|
8
8
|
}
|
|
9
|
-
|
|
10
9
|
[dir=ltr] .withBorder {
|
|
11
10
|
border-left: 1px solid var(--zdt_statuslistitem_default_border);
|
|
12
11
|
}
|
|
13
|
-
|
|
14
12
|
[dir=rtl] .withBorder {
|
|
15
13
|
border-right: 1px solid var(--zdt_statuslistitem_default_border);
|
|
16
14
|
}
|
|
17
|
-
|
|
18
15
|
[dir=ltr] .small {
|
|
19
16
|
padding: var(--zd_size7) var(--zd_size3) var(--zd_size7) var(--zd_size5) ;
|
|
20
17
|
}
|
|
21
|
-
|
|
22
18
|
[dir=rtl] .small {
|
|
23
19
|
padding: var(--zd_size7) var(--zd_size5) var(--zd_size7) var(--zd_size3) ;
|
|
24
20
|
}
|
|
25
|
-
|
|
26
21
|
.medium {
|
|
27
22
|
padding: var(--zd_size7) var(--zd_size20) ;
|
|
28
23
|
}
|
|
29
|
-
|
|
30
24
|
.large {
|
|
31
25
|
height: var(--zd_size48) ;
|
|
32
26
|
}
|
|
33
|
-
|
|
34
27
|
[dir=ltr] .large {
|
|
35
28
|
padding: var(--zd_size10) var(--zd_size3) var(--zd_size10) var(--zd_size25) ;
|
|
36
29
|
}
|
|
37
|
-
|
|
38
30
|
[dir=rtl] .large {
|
|
39
31
|
padding: var(--zd_size10) var(--zd_size25) var(--zd_size10) var(--zd_size3) ;
|
|
40
32
|
}
|
|
41
|
-
|
|
42
|
-
.value,
|
|
43
|
-
.multiLineValue {
|
|
33
|
+
.value,.multiLineValue {
|
|
44
34
|
line-height: 1.5385;
|
|
45
35
|
}
|
|
46
|
-
|
|
47
36
|
.value {
|
|
48
37
|
composes: dotted from '~@zohodesk/components/lib/common/common.module.css';
|
|
49
38
|
}
|
|
50
|
-
|
|
51
|
-
.multiLineValue {
|
|
39
|
+
.multiLineValue{
|
|
52
40
|
word-break: break-word;
|
|
53
|
-
-webkit-line-clamp: 3;
|
|
54
41
|
composes: clamp from '~@zohodesk/components/lib/common/common.module.css';
|
|
55
42
|
}
|
|
56
|
-
|
|
57
43
|
[dir=ltr] .withBorder.active {
|
|
58
44
|
border-left-color: var(--zdt_statuslistitem_default_active_border);
|
|
59
45
|
}
|
|
60
|
-
|
|
61
46
|
[dir=rtl] .withBorder.active {
|
|
62
47
|
border-right-color: var(--zdt_statuslistitem_default_active_border);
|
|
63
48
|
}
|
|
@@ -65,56 +50,44 @@
|
|
|
65
50
|
.default.hover, .default.effect:hover {
|
|
66
51
|
background-color: var(--zdt_statuslistitem_default_effect_bg);
|
|
67
52
|
}
|
|
68
|
-
|
|
69
53
|
.primary.hover, .primary.effect:hover, .selected {
|
|
70
54
|
background-color: var(--zdt_statuslistitem_primary_efffect_bg);
|
|
71
55
|
}
|
|
72
|
-
|
|
73
56
|
.secondary.hover, .secondary.effect:hover {
|
|
74
57
|
background-color: var(--zdt_statuslistitem_secondary_effect_bg);
|
|
75
58
|
}
|
|
76
|
-
|
|
77
59
|
.list.active.default, .list.active.primary {
|
|
78
60
|
background-color: var(--zdt_statuslistitem_primary_efffect_bg);
|
|
79
61
|
}
|
|
80
|
-
|
|
81
62
|
.list.active.secondary {
|
|
82
63
|
background-color: var(--zdt_statuslistitem_secondary_effect_bg);
|
|
83
64
|
}
|
|
84
|
-
|
|
85
65
|
.secondary.hover,
|
|
86
66
|
.secondary.effect:hover,
|
|
87
67
|
.list.active.secondary {
|
|
88
68
|
color: var(--zdt_statuslistitem_secondary_effect_text);
|
|
89
69
|
}
|
|
90
|
-
|
|
91
70
|
.tickIcon {
|
|
92
71
|
color: var(--zdt_statuslistitem_tickicon);
|
|
93
72
|
position: absolute;
|
|
94
|
-
top:
|
|
73
|
+
top:50% ;
|
|
95
74
|
transform: translateY(-50%);
|
|
96
75
|
}
|
|
97
|
-
|
|
98
76
|
[dir=ltr] .tickIcon {
|
|
99
77
|
right: var(--zd_size20) ;
|
|
100
78
|
}
|
|
101
|
-
|
|
102
79
|
[dir=rtl] .tickIcon {
|
|
103
80
|
left: var(--zd_size20) ;
|
|
104
81
|
}
|
|
105
|
-
|
|
106
|
-
.tickIcon>i {
|
|
82
|
+
.tickIcon > i {
|
|
107
83
|
display: block;
|
|
108
84
|
}
|
|
109
|
-
|
|
110
85
|
[dir=ltr] .active.withTick {
|
|
111
86
|
padding-right: var(--zd_size39) ;
|
|
112
87
|
}
|
|
113
|
-
|
|
114
88
|
[dir=rtl] .active.withTick {
|
|
115
89
|
padding-left: var(--zd_size39) ;
|
|
116
90
|
}
|
|
117
|
-
|
|
118
91
|
/* Status Type */
|
|
119
92
|
.statusType {
|
|
120
93
|
width: var(--zd_size8) ;
|
|
@@ -127,15 +100,12 @@
|
|
|
127
100
|
[dir=rtl] .statusType {
|
|
128
101
|
margin-left: var(--zd_size13) ;
|
|
129
102
|
}
|
|
130
|
-
|
|
131
103
|
.black {
|
|
132
104
|
background-color: var(--zdt_statuslistitem_black_bg);
|
|
133
105
|
}
|
|
134
|
-
|
|
135
106
|
.orange {
|
|
136
107
|
background-color: var(--zdt_statuslistitem_orange_bg);
|
|
137
108
|
}
|
|
138
|
-
|
|
139
109
|
.green {
|
|
140
110
|
background-color: var(--zdt_statuslistitem_green_bg);
|
|
141
|
-
}
|
|
111
|
+
}
|
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
.
|
|
2
|
-
.boxStyle {
|
|
1
|
+
.wrapper {
|
|
3
2
|
transition: var(--zd_transition1);
|
|
4
|
-
width: var(--
|
|
3
|
+
width: var(--zd_size160) ;
|
|
5
4
|
height: var(--zd_size28) ;
|
|
6
5
|
position: relative;
|
|
7
|
-
}.searchStyle, .boxStyle {
|
|
8
|
-
background: none;
|
|
9
6
|
}
|
|
10
|
-
.
|
|
11
|
-
|
|
7
|
+
.boxType {
|
|
8
|
+
border: 1px solid transparent;
|
|
12
9
|
border-radius: 4px;
|
|
13
|
-
border: 1px solid var(--zdt_lookupsearch_boxstyle_border);
|
|
14
10
|
}
|
|
15
|
-
.
|
|
11
|
+
.borderType {
|
|
12
|
+
border-bottom: 1px solid transparent;
|
|
13
|
+
}
|
|
14
|
+
.boxType, .borderType {
|
|
15
|
+
border-color: var(--zdt_lookupsearch_boxstyle_border);
|
|
16
|
+
}
|
|
17
|
+
.boxType:hover, .borderType:hover {
|
|
16
18
|
border-color: var(--zdt_lookupsearch_boxstyle_hover_border);
|
|
17
19
|
}
|
|
20
|
+
.boxType.active, .borderType.active {
|
|
21
|
+
border-color: var(--zdt_lookupsearch_boxstyle_activer_border);
|
|
22
|
+
}
|
|
18
23
|
.focusWidth {
|
|
19
24
|
width: var(--zd_size220) ;
|
|
20
25
|
}
|
|
@@ -23,35 +28,36 @@
|
|
|
23
28
|
height: var(--zd_size28) ;
|
|
24
29
|
cursor: pointer;
|
|
25
30
|
}
|
|
26
|
-
.drpSearchBox
|
|
27
|
-
|
|
28
|
-
position: absolute;
|
|
29
|
-
top: var(--zd_size8) ;
|
|
30
|
-
bottom: var(--zd_size8) ;
|
|
31
|
+
[dir=ltr] .drpSearchBox {
|
|
32
|
+
padding-left: var(--zd_size12) ;
|
|
31
33
|
}
|
|
32
|
-
[dir=
|
|
33
|
-
right:
|
|
34
|
-
border-right: 1px solid var(--zdt_lookupsearch_boxstyle_border);
|
|
34
|
+
[dir=rtl] .drpSearchBox {
|
|
35
|
+
padding-right: var(--zd_size12) ;
|
|
35
36
|
}
|
|
36
|
-
[dir=
|
|
37
|
-
|
|
38
|
-
border-left: 1px solid var(--zdt_lookupsearch_boxstyle_border);
|
|
37
|
+
[dir=ltr] .searchIcon {
|
|
38
|
+
padding-right: var(--zd_size8) ;
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
padding:
|
|
40
|
+
[dir=rtl] .searchIcon {
|
|
41
|
+
padding-left: var(--zd_size8) ;
|
|
42
42
|
}
|
|
43
43
|
[dir=ltr] .searchIconBox {
|
|
44
|
-
padding: var(--
|
|
44
|
+
padding-left: var(--zd_size12) ;
|
|
45
45
|
}
|
|
46
46
|
[dir=rtl] .searchIconBox {
|
|
47
|
-
padding: var(--
|
|
47
|
+
padding-right: var(--zd_size12) ;
|
|
48
48
|
}
|
|
49
49
|
.active, .boxStyle.active, .lineActive.drpSearchBox::after {
|
|
50
50
|
border-color: var(--zdt_lookupsearch_boxstyle_activer_border);
|
|
51
51
|
}
|
|
52
52
|
[dir=ltr] .iconArrow {
|
|
53
|
-
margin-left: var(--
|
|
53
|
+
margin-left: var(--zd_size6) ;
|
|
54
54
|
}
|
|
55
55
|
[dir=rtl] .iconArrow {
|
|
56
|
-
margin-right: var(--
|
|
57
|
-
}
|
|
56
|
+
margin-right: var(--zd_size6) ;
|
|
57
|
+
}
|
|
58
|
+
.separator {
|
|
59
|
+
width: var(--zd_size1) ;
|
|
60
|
+
height: var(--zd_size16) ;
|
|
61
|
+
margin: 0 var(--zd_size12) ;
|
|
62
|
+
background-color: var(--zdt_lookupsearch_boxstyle_border);
|
|
63
|
+
}
|
|
@@ -17,6 +17,8 @@ var _TextBoxIcon = _interopRequireDefault(require("@zohodesk/components/lib/Text
|
|
|
17
17
|
|
|
18
18
|
var _Layout = require("@zohodesk/components/lib/Layout");
|
|
19
19
|
|
|
20
|
+
var _utils = require("@zohodesk/utils");
|
|
21
|
+
|
|
20
22
|
var _icons = require("@zohodesk/icons");
|
|
21
23
|
|
|
22
24
|
var _ToggleDropDown = _interopRequireDefault(require("../../../dropdown/ToggleDropDown/ToggleDropDown"));
|
|
@@ -66,33 +68,17 @@ var Search = /*#__PURE__*/function (_Component) {
|
|
|
66
68
|
_classCallCheck(this, Search);
|
|
67
69
|
|
|
68
70
|
_this = _super.call(this, props);
|
|
69
|
-
_this.handleDropDownOpen = _this.handleDropDownOpen.bind(_assertThisInitialized(_this));
|
|
70
|
-
_this.handleDropDownClose = _this.handleDropDownClose.bind(_assertThisInitialized(_this));
|
|
71
71
|
_this.handleTextBoxFocus = _this.handleTextBoxFocus.bind(_assertThisInitialized(_this));
|
|
72
72
|
_this.handleTextBoxBlur = _this.handleTextBoxBlur.bind(_assertThisInitialized(_this));
|
|
73
73
|
_this.handleGetTextBoxRef = _this.handleGetTextBoxRef.bind(_assertThisInitialized(_this));
|
|
74
|
+
_this.handleRenderChildren = _this.handleRenderChildren.bind(_assertThisInitialized(_this));
|
|
74
75
|
_this.state = {
|
|
75
|
-
isFocus: false
|
|
76
|
-
isDropDownOpen: false
|
|
76
|
+
isFocus: false
|
|
77
77
|
};
|
|
78
78
|
return _this;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
_createClass(Search, [{
|
|
82
|
-
key: "handleDropDownOpen",
|
|
83
|
-
value: function handleDropDownOpen() {
|
|
84
|
-
this.setState({
|
|
85
|
-
isDropDownOpen: true
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
}, {
|
|
89
|
-
key: "handleDropDownClose",
|
|
90
|
-
value: function handleDropDownClose() {
|
|
91
|
-
this.setState({
|
|
92
|
-
isDropDownOpen: false
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
}, {
|
|
96
82
|
key: "handleTextBoxFocus",
|
|
97
83
|
value: function handleTextBoxFocus(e) {
|
|
98
84
|
var onFocus = this.props.onFocus;
|
|
@@ -118,21 +104,38 @@ var Search = /*#__PURE__*/function (_Component) {
|
|
|
118
104
|
getRef && getRef(el);
|
|
119
105
|
}
|
|
120
106
|
}, {
|
|
121
|
-
key: "
|
|
122
|
-
value: function
|
|
107
|
+
key: "handleRenderChildren",
|
|
108
|
+
value: function handleRenderChildren(_ref) {
|
|
109
|
+
var isActive = _ref.isActive,
|
|
110
|
+
isFocus = _ref.isFocus;
|
|
123
111
|
var _this$props = this.props,
|
|
124
|
-
options = _this$props.options,
|
|
125
|
-
onSelect = _this$props.onSelect,
|
|
126
112
|
value = _this$props.value,
|
|
127
|
-
selectedId = _this$props.selectedId
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
113
|
+
selectedId = _this$props.selectedId,
|
|
114
|
+
renderChildren = _this$props.renderChildren;
|
|
115
|
+
return renderChildren({
|
|
116
|
+
isActive: isActive,
|
|
117
|
+
isFocus: isFocus,
|
|
118
|
+
value: value,
|
|
119
|
+
selectedId: selectedId
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}, {
|
|
123
|
+
key: "render",
|
|
124
|
+
value: function render() {
|
|
125
|
+
var _this$props2 = this.props,
|
|
126
|
+
options = _this$props2.options,
|
|
127
|
+
onSelect = _this$props2.onSelect,
|
|
128
|
+
value = _this$props2.value,
|
|
129
|
+
selectedId = _this$props2.selectedId,
|
|
130
|
+
renderChildren = _this$props2.renderChildren;
|
|
131
|
+
var isFocus = this.state.isFocus;
|
|
131
132
|
var searchUIExtraProps = {
|
|
132
|
-
isFocus: isFocus
|
|
133
|
+
isFocus: isFocus,
|
|
133
134
|
onFocus: this.handleTextBoxFocus,
|
|
134
135
|
onBlur: this.handleTextBoxBlur,
|
|
135
|
-
getRef: this.handleGetTextBoxRef
|
|
136
|
+
getRef: this.handleGetTextBoxRef,
|
|
137
|
+
value: value,
|
|
138
|
+
renderChildren: typeof renderChildren == 'function' ? this.handleRenderChildren : undefined
|
|
136
139
|
};
|
|
137
140
|
return options ? /*#__PURE__*/_react["default"].createElement(_ToggleDropDown["default"], {
|
|
138
141
|
value: value,
|
|
@@ -141,9 +144,7 @@ var Search = /*#__PURE__*/function (_Component) {
|
|
|
141
144
|
needTick: true,
|
|
142
145
|
isArrow: false,
|
|
143
146
|
isToggleStateNeeded: true,
|
|
144
|
-
selectedId: selectedId
|
|
145
|
-
onDropDownOpen: this.handleDropDownOpen,
|
|
146
|
-
onDropDownClose: this.handleDropDownClose
|
|
147
|
+
selectedId: selectedId
|
|
147
148
|
}, /*#__PURE__*/_react["default"].createElement(SearchUI, _extends({}, this.props, searchUIExtraProps))) : /*#__PURE__*/_react["default"].createElement(SearchUI, _extends({}, this.props, searchUIExtraProps));
|
|
148
149
|
}
|
|
149
150
|
}]);
|
|
@@ -182,10 +183,10 @@ var SearchUI = /*#__PURE__*/function (_Component2) {
|
|
|
182
183
|
key: "handleKeyDown",
|
|
183
184
|
value: function handleKeyDown(e) {
|
|
184
185
|
var keyCode = e.keyCode;
|
|
185
|
-
var _this$
|
|
186
|
-
onSearch = _this$
|
|
187
|
-
needOnTypeSearch = _this$
|
|
188
|
-
onKeyDown = _this$
|
|
186
|
+
var _this$props3 = this.props,
|
|
187
|
+
onSearch = _this$props3.onSearch,
|
|
188
|
+
needOnTypeSearch = _this$props3.needOnTypeSearch,
|
|
189
|
+
onKeyDown = _this$props3.onKeyDown;
|
|
189
190
|
onKeyDown && onKeyDown(e);
|
|
190
191
|
|
|
191
192
|
if (keyCode === 13) {
|
|
@@ -195,9 +196,9 @@ var SearchUI = /*#__PURE__*/function (_Component2) {
|
|
|
195
196
|
}, {
|
|
196
197
|
key: "handleChange",
|
|
197
198
|
value: function handleChange(value) {
|
|
198
|
-
var _this$
|
|
199
|
-
onChange = _this$
|
|
200
|
-
needOnTypeSearch = _this$
|
|
199
|
+
var _this$props4 = this.props,
|
|
200
|
+
onChange = _this$props4.onChange,
|
|
201
|
+
needOnTypeSearch = _this$props4.needOnTypeSearch;
|
|
201
202
|
onChange && onChange(value);
|
|
202
203
|
needOnTypeSearch && this.handleSearch();
|
|
203
204
|
}
|
|
@@ -212,26 +213,36 @@ var SearchUI = /*#__PURE__*/function (_Component2) {
|
|
|
212
213
|
}, {
|
|
213
214
|
key: "render",
|
|
214
215
|
value: function render() {
|
|
215
|
-
var _this$
|
|
216
|
-
dataId = _this$
|
|
217
|
-
searchStr = _this$
|
|
218
|
-
placeHolder = _this$
|
|
219
|
-
getRef = _this$
|
|
220
|
-
title = _this$
|
|
221
|
-
isBoxed = _this$
|
|
222
|
-
isSearchIconNeed = _this$
|
|
223
|
-
options = _this$
|
|
224
|
-
activeClass = _this$
|
|
225
|
-
isFocus = _this$
|
|
226
|
-
onFocus = _this$
|
|
227
|
-
onBlur = _this$
|
|
216
|
+
var _this$props5 = this.props,
|
|
217
|
+
dataId = _this$props5.dataId,
|
|
218
|
+
searchStr = _this$props5.searchStr,
|
|
219
|
+
placeHolder = _this$props5.placeHolder,
|
|
220
|
+
getRef = _this$props5.getRef,
|
|
221
|
+
title = _this$props5.title,
|
|
222
|
+
isBoxed = _this$props5.isBoxed,
|
|
223
|
+
isSearchIconNeed = _this$props5.isSearchIconNeed,
|
|
224
|
+
options = _this$props5.options,
|
|
225
|
+
activeClass = _this$props5.activeClass,
|
|
226
|
+
isFocus = _this$props5.isFocus,
|
|
227
|
+
onFocus = _this$props5.onFocus,
|
|
228
|
+
onBlur = _this$props5.onBlur,
|
|
229
|
+
renderChildren = _this$props5.renderChildren,
|
|
230
|
+
isActive = _this$props5.isActive,
|
|
231
|
+
hasSeparator = _this$props5.hasSeparator,
|
|
232
|
+
customStyle = _this$props5.customStyle;
|
|
233
|
+
var isActiveState = isFocus || isActive;
|
|
234
|
+
var isFocusWidth = isActiveState || searchStr;
|
|
235
|
+
var style = (0, _utils.mergeStyle)(_LookupSearchModule["default"], customStyle);
|
|
228
236
|
return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
229
237
|
isCover: false,
|
|
230
238
|
alignBox: "row",
|
|
231
239
|
align: "vertical",
|
|
232
|
-
className: "".concat(
|
|
233
|
-
},
|
|
234
|
-
|
|
240
|
+
className: "\n ".concat(style.wrapper, " ").concat(isBoxed ? style.boxType : style.borderType, " \n ").concat(isActiveState ? "".concat(style.active, " ").concat(activeClass || '') : '', "\n ").concat(isFocusWidth ? style.focusWidth : '', "\n ")
|
|
241
|
+
}, typeof renderChildren == 'function' ? renderChildren({
|
|
242
|
+
isActive: isActive,
|
|
243
|
+
isFocus: isFocus
|
|
244
|
+
}) : options ? /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
245
|
+
className: "".concat(style.drpSearchBox, " ").concat(isActiveState ? style.lineActive : ''),
|
|
235
246
|
isCover: false,
|
|
236
247
|
align: "vertical",
|
|
237
248
|
alignBox: "row",
|
|
@@ -242,18 +253,17 @@ var SearchUI = /*#__PURE__*/function (_Component2) {
|
|
|
242
253
|
}), /*#__PURE__*/_react["default"].createElement(_icons.Icon, {
|
|
243
254
|
name: "ZD-down",
|
|
244
255
|
size: "7",
|
|
245
|
-
iconClass:
|
|
246
|
-
}))
|
|
247
|
-
className: _LookupSearchModule["default"].searchIconBox
|
|
248
|
-
}, /*#__PURE__*/_react["default"].createElement(_icons.Icon, {
|
|
256
|
+
iconClass: style.iconArrow
|
|
257
|
+
})) : isSearchIconNeed ? /*#__PURE__*/_react["default"].createElement(_icons.Icon, {
|
|
249
258
|
name: "ZD-search",
|
|
250
|
-
size: "11"
|
|
251
|
-
|
|
252
|
-
|
|
259
|
+
size: "11",
|
|
260
|
+
iconClass: "".concat(style.searchIcon, " ").concat(isBoxed ? style.searchIconBox : '')
|
|
261
|
+
}) : null, hasSeparator ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
262
|
+
className: style.separator
|
|
263
|
+
}) : null, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
264
|
+
flexible: true,
|
|
265
|
+
onClick: _Common.cancelBubblingEffect
|
|
253
266
|
}, /*#__PURE__*/_react["default"].createElement(_TextBoxIcon["default"], {
|
|
254
|
-
customClass: {
|
|
255
|
-
customTextBox: "".concat(isBoxed ? _LookupSearchModule["default"].inputBox : '')
|
|
256
|
-
},
|
|
257
267
|
customProps: {
|
|
258
268
|
TextBoxProps: {
|
|
259
269
|
'data-a11y-autofocus': true
|
|
@@ -262,7 +272,6 @@ var SearchUI = /*#__PURE__*/function (_Component2) {
|
|
|
262
272
|
placeHolder: placeHolder,
|
|
263
273
|
value: searchStr,
|
|
264
274
|
onChange: this.handleChange,
|
|
265
|
-
onClick: _Common.cancelBubblingEffect,
|
|
266
275
|
onFocus: onFocus,
|
|
267
276
|
onBlur: onBlur,
|
|
268
277
|
onKeyDown: this.handleKeyDown,
|
|
@@ -271,7 +280,8 @@ var SearchUI = /*#__PURE__*/function (_Component2) {
|
|
|
271
280
|
size: "small",
|
|
272
281
|
inputRef: getRef,
|
|
273
282
|
onClear: this.handleClear,
|
|
274
|
-
onClearMouseDown: _Common.cancelBubblingEffect
|
|
283
|
+
onClearMouseDown: _Common.cancelBubblingEffect,
|
|
284
|
+
needBorder: false
|
|
275
285
|
})));
|
|
276
286
|
}
|
|
277
287
|
}]);
|
|
@@ -8,6 +8,7 @@ var _Search = _interopRequireDefault(require("../Search"));
|
|
|
8
8
|
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
10
10
|
|
|
11
|
+
afterEach(_react2.cleanup);
|
|
11
12
|
describe('Search', function () {
|
|
12
13
|
test('rendering the defult props', function () {
|
|
13
14
|
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Search["default"], null)),
|
|
@@ -15,4 +16,68 @@ describe('Search', function () {
|
|
|
15
16
|
|
|
16
17
|
expect(asFragment()).toMatchSnapshot();
|
|
17
18
|
});
|
|
19
|
+
test('rendering the search active', function () {
|
|
20
|
+
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Search["default"], null)),
|
|
21
|
+
asFragment = _render2.asFragment,
|
|
22
|
+
getByRole = _render2.getByRole;
|
|
23
|
+
|
|
24
|
+
_react2.fireEvent.focus(getByRole('textbox'));
|
|
25
|
+
|
|
26
|
+
expect(asFragment()).toMatchSnapshot();
|
|
27
|
+
});
|
|
28
|
+
test('rendering the prop hasSeparator is true', function () {
|
|
29
|
+
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Search["default"], {
|
|
30
|
+
hasSeparator: true
|
|
31
|
+
})),
|
|
32
|
+
asFragment = _render3.asFragment;
|
|
33
|
+
|
|
34
|
+
expect(asFragment()).toMatchSnapshot();
|
|
35
|
+
});
|
|
36
|
+
test('rendering the prop hasSeparator is false', function () {
|
|
37
|
+
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Search["default"], {
|
|
38
|
+
hasSeparator: false
|
|
39
|
+
})),
|
|
40
|
+
asFragment = _render4.asFragment;
|
|
41
|
+
|
|
42
|
+
expect(asFragment()).toMatchSnapshot();
|
|
43
|
+
});
|
|
44
|
+
test('rendering the renderChildren props via function', function () {
|
|
45
|
+
var options = [{
|
|
46
|
+
value: 'All Fields',
|
|
47
|
+
id: '1'
|
|
48
|
+
}, {
|
|
49
|
+
value: 'Account',
|
|
50
|
+
id: '3'
|
|
51
|
+
}, {
|
|
52
|
+
value: 'Customer Place',
|
|
53
|
+
id: '4'
|
|
54
|
+
}, {
|
|
55
|
+
value: 'Conatct ID',
|
|
56
|
+
id: '5'
|
|
57
|
+
}];
|
|
58
|
+
|
|
59
|
+
function renderChildren(_ref) {
|
|
60
|
+
var value = _ref.value;
|
|
61
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, value);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
var _render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Search["default"], {
|
|
65
|
+
value: "All Fields",
|
|
66
|
+
renderChildren: renderChildren,
|
|
67
|
+
options: options
|
|
68
|
+
})),
|
|
69
|
+
asFragment = _render5.asFragment;
|
|
70
|
+
|
|
71
|
+
expect(asFragment()).toMatchSnapshot();
|
|
72
|
+
});
|
|
73
|
+
test('rendering the customized style search', function () {
|
|
74
|
+
var _render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Search["default"], {
|
|
75
|
+
customStyle: {
|
|
76
|
+
wrapper: "searchWrapperClass"
|
|
77
|
+
}
|
|
78
|
+
})),
|
|
79
|
+
asFragment = _render6.asFragment;
|
|
80
|
+
|
|
81
|
+
expect(asFragment()).toMatchSnapshot();
|
|
82
|
+
});
|
|
18
83
|
});
|