linear-react-components-ui 0.4.76-beta.26 → 0.4.76-beta.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/assets/styles/effects.scss +0 -20
- package/lib/assets/styles/panel.scss +1 -4
- package/lib/assets/styles/table.scss +0 -13
- package/lib/assets/styles/tabs.scss +44 -49
- package/lib/assets/styles/treeview.scss +9 -0
- package/lib/icons/helper.js +0 -4
- package/lib/inputs/base/InputTextBase.js +3 -23
- package/lib/inputs/select/Dropdown.js +2 -5
- package/lib/inputs/select/multiple/index.js +3 -3
- package/lib/inputs/select/simple/index.js +2 -2
- package/lib/internals/constants.js +3 -4
- package/lib/internals/withTooltip.js +2 -2
- package/lib/list/Item.js +7 -25
- package/lib/list/index.js +10 -88
- package/lib/list/list.spec.js +102 -230
- package/lib/menus/sidenav/NavMenuItem.js +4 -12
- package/lib/menus/sidenav/index.js +3 -23
- package/lib/menus/sidenav/popup_menu_search/index.js +9 -13
- package/lib/menus/sidenav/sidenav.spec.js +19 -78
- package/lib/skeleton/SkeletonContainer.js +1 -1
- package/lib/table/Body.js +7 -41
- package/lib/table/Header.js +1 -12
- package/lib/table/HeaderColumn.js +2 -4
- package/lib/table/Row.js +7 -14
- package/lib/table/RowColumn.js +3 -4
- package/lib/table/helpers.js +1 -11
- package/lib/table/index.js +8 -32
- package/lib/tabs/Menu.js +11 -1
- package/lib/tabs/index.js +1 -1
- package/lib/treeview/Node.js +17 -5
- package/lib/treeview/index.js +23 -29
- package/lib/treeview/treeview.spec.js +9 -0
- package/package.json +1 -1
- package/lib/assets/styles/uitour.scss +0 -112
- package/lib/inputs/date/helper.js +0 -16
- package/lib/uitour/helpers.js +0 -15
- package/lib/uitour/index.js +0 -271
- package/lib/uitour/uitour.spec.js +0 -176
|
@@ -731,23 +731,3 @@
|
|
|
731
731
|
left: 100%;
|
|
732
732
|
}
|
|
733
733
|
}
|
|
734
|
-
|
|
735
|
-
@keyframes slideRightToLeftWithFade {
|
|
736
|
-
from {
|
|
737
|
-
opacity: 0;
|
|
738
|
-
transform: translateX(2%);
|
|
739
|
-
} to {
|
|
740
|
-
opacity: 1;
|
|
741
|
-
transform: translateX(0);
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
@keyframes slideLeftToRightWithFade {
|
|
746
|
-
from {
|
|
747
|
-
opacity: 0;
|
|
748
|
-
transform: translateX(-2%);
|
|
749
|
-
} to {
|
|
750
|
-
opacity: 1;
|
|
751
|
-
transform: translateX(0);
|
|
752
|
-
}
|
|
753
|
-
}
|
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
height: 100%;
|
|
7
7
|
margin-bottom: 20px;
|
|
8
8
|
border: solid 1px $component-border-color;
|
|
9
|
-
display: flex;
|
|
10
|
-
flex-direction: column;
|
|
11
9
|
&.panel-shadow {
|
|
12
10
|
box-shadow: 0 2px 5px 0 rgba(0,0,0,.16), 0 2px 10px 0 rgba(0,0,0,.12);
|
|
13
11
|
}
|
|
@@ -49,8 +47,7 @@
|
|
|
49
47
|
}
|
|
50
48
|
}
|
|
51
49
|
> .panel-content {
|
|
52
|
-
|
|
53
|
-
overflow: auto;
|
|
50
|
+
height: auto;
|
|
54
51
|
padding: 15px;
|
|
55
52
|
}
|
|
56
53
|
}
|
|
@@ -19,19 +19,6 @@
|
|
|
19
19
|
> .bodycontainer {
|
|
20
20
|
overflow-y: auto;
|
|
21
21
|
}
|
|
22
|
-
> .bodycontainer > .innertable > .tbody,
|
|
23
|
-
> .tbody {
|
|
24
|
-
position: relative;
|
|
25
|
-
&.skeleton-transparency::before {
|
|
26
|
-
content: '';
|
|
27
|
-
position: absolute;
|
|
28
|
-
width: 100%;
|
|
29
|
-
height: 100%;
|
|
30
|
-
background: rgb(255,255,255);
|
|
31
|
-
background: linear-gradient( 180deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.2) 30%,
|
|
32
|
-
rgba(255,255,255,0.6) 70%,rgba(255,255,255,0.8) 100%);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
22
|
> .headercontainer > .innertable > .theader > .trow,
|
|
36
23
|
> .bodycontainer > .innertable > .tbody > .trow,
|
|
37
24
|
> .theader > .trow,
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
margin-right: 1px;
|
|
49
49
|
padding: 0;
|
|
50
50
|
width: auto;
|
|
51
|
+
min-width: 100px;
|
|
51
52
|
display: flex;
|
|
52
53
|
justify-content: space-between;
|
|
53
54
|
align-items: center;
|
|
@@ -121,27 +122,25 @@
|
|
|
121
122
|
.tabs-component.menu-left {
|
|
122
123
|
grid-template-columns: auto 1fr;
|
|
123
124
|
grid-template-rows: none;
|
|
124
|
-
> .
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
width: 100%;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
> .menu > .menuitem > .closepanel {
|
|
142
|
-
float: left;
|
|
125
|
+
> .menu {
|
|
126
|
+
box-shadow: -1px 0px 0px 0px $component-border-color inset;
|
|
127
|
+
flex-direction: column;
|
|
128
|
+
justify-content: center;
|
|
129
|
+
}
|
|
130
|
+
> .menu > .menuitem {
|
|
131
|
+
border-radius: 5px 0px 0px 5px;
|
|
132
|
+
-moz-border-radius: 5px 0px 0px 5px;
|
|
133
|
+
-webkit-border-radius: 5px 0px 0px 5px;
|
|
134
|
+
&.selected {
|
|
135
|
+
border: 1px solid $component-border-color;
|
|
136
|
+
border-right: 1px solid $font-color-second;
|
|
137
|
+
border-left: 2px solid $component-selected-color;
|
|
138
|
+
width: 100%;
|
|
143
139
|
}
|
|
144
140
|
}
|
|
141
|
+
> .menu > .menuitem > .closepanel {
|
|
142
|
+
float: left;
|
|
143
|
+
}
|
|
145
144
|
> .panel {
|
|
146
145
|
border-top: 1px solid $component-border-color;
|
|
147
146
|
border-left: 0;
|
|
@@ -153,20 +152,18 @@
|
|
|
153
152
|
*/
|
|
154
153
|
.tabs-component.menu-bottom {
|
|
155
154
|
grid-template-rows: 1fr auto;
|
|
156
|
-
.
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
height: 100%;
|
|
169
|
-
}
|
|
155
|
+
> .menu {
|
|
156
|
+
box-shadow: 0 1px 1px 0px $component-border-color inset;
|
|
157
|
+
}
|
|
158
|
+
> .menu > .menuitem {
|
|
159
|
+
border-radius: 0px 0px 5px 5px;
|
|
160
|
+
-moz-border-radius: 0px 0px 5px 5px;
|
|
161
|
+
-webkit-border-radius: 0px 0px 5px 5px;
|
|
162
|
+
&.selected {
|
|
163
|
+
border: 1px solid $component-border-color;
|
|
164
|
+
border-top: 1px solid $font-color-second;
|
|
165
|
+
border-bottom: 2px solid $component-selected-color;
|
|
166
|
+
height: 100%;
|
|
170
167
|
}
|
|
171
168
|
}
|
|
172
169
|
> .panel {
|
|
@@ -181,22 +178,20 @@
|
|
|
181
178
|
.tabs-component.menu-right {
|
|
182
179
|
grid-template-columns: 1fr auto;
|
|
183
180
|
grid-template-rows: none;
|
|
184
|
-
.
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
width: 100%;
|
|
199
|
-
}
|
|
181
|
+
> .menu {
|
|
182
|
+
box-shadow: 2px 0 0px -1px $component-border-color inset;
|
|
183
|
+
flex-direction: column;
|
|
184
|
+
justify-content: center;
|
|
185
|
+
}
|
|
186
|
+
> .menu > .menuitem {
|
|
187
|
+
border-radius: 0px 5px 5px 0px;
|
|
188
|
+
-moz-border-radius: 0px 5px 5px 0px;
|
|
189
|
+
-webkit-border-radius: 0px 5px 5px 0px;
|
|
190
|
+
&.selected {
|
|
191
|
+
border: 1px solid $component-border-color;
|
|
192
|
+
border-left: 1px solid $font-color-second;
|
|
193
|
+
border-right: 2px solid $component-selected-color;
|
|
194
|
+
width: 100%;
|
|
200
195
|
}
|
|
201
196
|
}
|
|
202
197
|
> .panel {
|
|
@@ -15,6 +15,11 @@
|
|
|
15
15
|
margin-left: -20px;
|
|
16
16
|
cursor: pointer;
|
|
17
17
|
}
|
|
18
|
+
.isloading {
|
|
19
|
+
margin-left: -30px;
|
|
20
|
+
position: absolute;
|
|
21
|
+
margin-top: -5px;
|
|
22
|
+
}
|
|
18
23
|
}
|
|
19
24
|
}
|
|
20
25
|
|
|
@@ -45,6 +50,8 @@
|
|
|
45
50
|
display: flex;
|
|
46
51
|
justify-content: flex-start;
|
|
47
52
|
align-items: center;
|
|
53
|
+
min-height: 25px;
|
|
54
|
+
color: $font-color-soft;
|
|
48
55
|
>.node-menu {
|
|
49
56
|
animation: revealelement 0.3s forwards ease-in-out;
|
|
50
57
|
margin-left: 10px;
|
|
@@ -62,7 +69,9 @@
|
|
|
62
69
|
margin-left: 10px;
|
|
63
70
|
}
|
|
64
71
|
&:hover {
|
|
72
|
+
cursor: pointer;
|
|
65
73
|
background-color: rgb(209, 209, 209);
|
|
74
|
+
text-decoration: underline;
|
|
66
75
|
}
|
|
67
76
|
}
|
|
68
77
|
> .nodelist {
|
package/lib/icons/helper.js
CHANGED
|
@@ -554,10 +554,6 @@ function getIcons() {
|
|
|
554
554
|
flipVertical4: {
|
|
555
555
|
viewbox: '0 0 16 16',
|
|
556
556
|
paths: ['M0.854 5.146c-0.143-0.143-0.358-0.186-0.545-0.108s-0.309 0.26-0.309 0.462v10c0 0.202 0.122 0.385 0.309 0.462 0.062 0.026 0.127 0.038 0.191 0.038 0.13 0 0.258-0.051 0.354-0.146l5-5c0.195-0.195 0.195-0.512 0-0.707l-5-5z', 'M7.5 7c-0.276 0-0.5-0.224-0.5-0.5v-1c0-0.276 0.224-0.5 0.5-0.5s0.5 0.224 0.5 0.5v1c0 0.276-0.224 0.5-0.5 0.5z', 'M7.5 10c-0.276 0-0.5-0.224-0.5-0.5v-1c0-0.276 0.224-0.5 0.5-0.5s0.5 0.224 0.5 0.5v1c0 0.276-0.224 0.5-0.5 0.5z', 'M7.5 13c-0.276 0-0.5-0.224-0.5-0.5v-1c0-0.276 0.224-0.5 0.5-0.5s0.5 0.224 0.5 0.5v1c0 0.276-0.224 0.5-0.5 0.5z', 'M7.5 16c-0.276 0-0.5-0.224-0.5-0.5v-1c0-0.276 0.224-0.5 0.5-0.5s0.5 0.224 0.5 0.5v1c0 0.276-0.224 0.5-0.5 0.5z', 'M14.691 5.038c-0.062-0.026-0.127-0.038-0.191-0.038-0.13 0-0.258 0.051-0.354 0.146l-5 5c-0.195 0.195-0.195 0.512 0 0.707l5 5c0.143 0.143 0.358 0.186 0.545 0.108s0.309-0.26 0.309-0.462v-10c0-0.202-0.122-0.385-0.309-0.462zM13.875 13.991l-3.491-3.491 3.491-3.491v6.982z', 'M11.5 3c-0.943-1.257-2.419-2-4-2-1.672 0-3.226 0.831-4.158 2.222-0.154 0.229-0.092 0.54 0.137 0.694s0.54 0.092 0.694-0.137c0.745-1.113 1.989-1.778 3.327-1.778 1.313 0 2.534 0.64 3.284 1.716l-1.284 1.284h3.5v-3.5l-1.5 1.5z']
|
|
557
|
-
},
|
|
558
|
-
tools: {
|
|
559
|
-
viewbox: '0 0 20 16',
|
|
560
|
-
paths: ['M7.696 11.009l2.295 2.295-1.823 2.341c-0.334 0.437-0.926 0.476-1.315 0.087l-1.586-1.586c-0.389-0.389-0.35-0.98 0.087-1.315l2.341-1.823zM19.899 4.101l-2.399 2.399-3-3 2.399-2.399c-0.289-0.066-0.59-0.101-0.899-0.101-2.209 0-4 1.791-4 4 0 0.797 0.233 1.539 0.635 2.163l-2.233 1.739-3.402-3.402 4.5-4.5h-5l-2.22 2.22-0.22-0.22h-1.061v1.061l0.22 0.22-3.22 3.22 2.5 2.5 3-3 9 9 1.5-1.5-3.902-3.902 1.739-2.233c0.624 0.402 1.366 0.635 2.163 0.635 2.209 0 4-1.791 4-4 0-0.309-0.035-0.61-0.101-0.899z']
|
|
561
557
|
}
|
|
562
558
|
};
|
|
563
559
|
return icons;
|
|
@@ -79,12 +79,7 @@ var InputTextBase = function InputTextBase(props) {
|
|
|
79
79
|
onDeniedActions = props.onDeniedActions,
|
|
80
80
|
handlerSetOnDenied = props.handlerSetOnDenied,
|
|
81
81
|
targetRef = props.targetRef,
|
|
82
|
-
skeletonize = props.skeletonize
|
|
83
|
-
style = props.style,
|
|
84
|
-
styleForInputContent = props.styleForInputContent,
|
|
85
|
-
styleForWrapper = props.styleForWrapper,
|
|
86
|
-
styleForLabel = props.styleForLabel,
|
|
87
|
-
styleForSideButtons = props.styleForSideButtons;
|
|
82
|
+
skeletonize = props.skeletonize;
|
|
88
83
|
var options = [_permissionValidations.OPTIONS_ON_DENIED.disabled, _permissionValidations.OPTIONS_ON_DENIED.unvisible, _permissionValidations.OPTIONS_ON_DENIED.readOnly, _permissionValidations.OPTIONS_ON_DENIED.hideContent];
|
|
89
84
|
|
|
90
85
|
var _useState = (0, _react.useState)(onDeniedActions || (0, _permissionValidations.actionsOnPermissionDenied)(permissionAttr, options)),
|
|
@@ -158,28 +153,23 @@ var InputTextBase = function InputTextBase(props) {
|
|
|
158
153
|
|
|
159
154
|
if (!visible || unvisible) return null;
|
|
160
155
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
161
|
-
style: style,
|
|
162
156
|
className: "input-base-component ".concat(skeletonize ? '-skeletonized' : '', " ").concat(customClass),
|
|
163
157
|
ref: inputBaseRef
|
|
164
158
|
}, label && /*#__PURE__*/_react["default"].createElement("div", {
|
|
165
159
|
className: "labelcontainer"
|
|
166
160
|
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
167
|
-
style: styleForLabel,
|
|
168
161
|
className: "label ".concat(customClassForLabel, " ").concat(labelUppercase && ' -uppercase')
|
|
169
162
|
}, label, required && /*#__PURE__*/_react["default"].createElement("span", {
|
|
170
163
|
className: "-requiredlabel"
|
|
171
164
|
}, "*"))), /*#__PURE__*/_react["default"].createElement("div", {
|
|
172
165
|
"data-testid": "testInputWrapper",
|
|
173
|
-
style: styleForWrapper,
|
|
174
166
|
className: helpers.getInputWrapperClass(_extends({}, props, {
|
|
175
167
|
disabled: shouldDisable() || hideContent
|
|
176
168
|
}))
|
|
177
169
|
}, leftElements && /*#__PURE__*/_react["default"].createElement("div", {
|
|
178
|
-
style: styleForSideButtons,
|
|
179
170
|
className: "sidebuttons ".concat(customClassForSideButtons)
|
|
180
171
|
}, leftElements), /*#__PURE__*/_react["default"].createElement("div", {
|
|
181
172
|
"data-testid": "testInputContent",
|
|
182
|
-
style: styleForInputContent,
|
|
183
173
|
className: "inputcontent ".concat(customClassForInputContent)
|
|
184
174
|
}, type === 'textarea' ? /*#__PURE__*/_react["default"].createElement("textarea", _extends({
|
|
185
175
|
rows: props.rows,
|
|
@@ -233,12 +223,7 @@ InputTextBase.propTypes = {
|
|
|
233
223
|
handlerSetOnDenied: _propTypes["default"].func,
|
|
234
224
|
targetRef: _propTypes["default"].func,
|
|
235
225
|
gridLayout: _propTypes["default"].string,
|
|
236
|
-
skeletonize: _propTypes["default"].bool
|
|
237
|
-
style: _propTypes["default"].object,
|
|
238
|
-
styleForInputContent: _propTypes["default"].object,
|
|
239
|
-
styleForWrapper: _propTypes["default"].object,
|
|
240
|
-
styleForLabel: _propTypes["default"].object,
|
|
241
|
-
styleForSideButtons: _propTypes["default"].object
|
|
226
|
+
skeletonize: _propTypes["default"].bool
|
|
242
227
|
};
|
|
243
228
|
InputTextBase.defaultProps = {
|
|
244
229
|
value: undefined,
|
|
@@ -281,12 +266,7 @@ InputTextBase.defaultProps = {
|
|
|
281
266
|
handlerSetOnDenied: undefined,
|
|
282
267
|
targetRef: undefined,
|
|
283
268
|
gridLayout: undefined,
|
|
284
|
-
skeletonize: false
|
|
285
|
-
style: {},
|
|
286
|
-
styleForInputContent: {},
|
|
287
|
-
styleForWrapper: {},
|
|
288
|
-
styleForLabel: {},
|
|
289
|
-
styleForSideButtons: {}
|
|
269
|
+
skeletonize: false
|
|
290
270
|
};
|
|
291
271
|
|
|
292
272
|
var _default = (0, _inputHOC["default"])((0, _withTooltip["default"])(InputTextBase));
|
|
@@ -85,8 +85,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
85
85
|
imgSrcKey = _ref.imgSrcKey,
|
|
86
86
|
gridWrapperStyle = _ref.gridWrapperStyle,
|
|
87
87
|
selectFieldRef = _ref.selectFieldRef,
|
|
88
|
-
dropdownMaxHeight = _ref.dropdownMaxHeight
|
|
89
|
-
inputValue = _ref.inputValue;
|
|
88
|
+
dropdownMaxHeight = _ref.dropdownMaxHeight;
|
|
90
89
|
|
|
91
90
|
var _useState = (0, _react.useState)(returnDropdownDynamicStyles(selectFieldRef, dropdownMaxHeight)),
|
|
92
91
|
_useState2 = _slicedToArray(_useState, 1),
|
|
@@ -103,7 +102,6 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
103
102
|
}, /*#__PURE__*/_react["default"].createElement("input", {
|
|
104
103
|
className: "filterinput",
|
|
105
104
|
type: "text",
|
|
106
|
-
value: inputValue,
|
|
107
105
|
onFocus: function onFocus() {
|
|
108
106
|
handleOnFocus();
|
|
109
107
|
},
|
|
@@ -176,8 +174,7 @@ Dropdown.propTypes = {
|
|
|
176
174
|
striped: _propTypes["default"].bool,
|
|
177
175
|
gridWrapperStyle: _propTypes["default"].object,
|
|
178
176
|
selectFieldRef: _propTypes["default"].object,
|
|
179
|
-
dropdownMaxHeight: _propTypes["default"].number
|
|
180
|
-
inputValue: _propTypes["default"].string.isRequired
|
|
177
|
+
dropdownMaxHeight: _propTypes["default"].number
|
|
181
178
|
};
|
|
182
179
|
Dropdown.defaultProps = {
|
|
183
180
|
selected: null,
|
|
@@ -270,12 +270,12 @@ var MultipleSelect = /*#__PURE__*/function (_Component) {
|
|
|
270
270
|
|
|
271
271
|
if (e.keyCode === constants.keyCodes.ENTER) {
|
|
272
272
|
this.onSelect(selected);
|
|
273
|
-
} else if ([constants.keyCodes.
|
|
273
|
+
} else if ([constants.keyCodes.ARROW_DOWN, constants.keyCodes.ARROW_UP].includes(e.keyCode)) {
|
|
274
274
|
var index = dataSource.findIndex(function (d) {
|
|
275
275
|
return d === selected;
|
|
276
276
|
});
|
|
277
277
|
|
|
278
|
-
if (e.keyCode === constants.keyCodes.
|
|
278
|
+
if (e.keyCode === constants.keyCodes.ARROW_UP) {
|
|
279
279
|
index = index === dataSource.length - 1 ? 0 : index + 1;
|
|
280
280
|
} else {
|
|
281
281
|
index = index === 0 ? dataSource.length - 1 : index - 1;
|
|
@@ -397,7 +397,7 @@ Object.defineProperty(MultipleSelect, "getDerivedStateFromProps", {
|
|
|
397
397
|
var dataCombo = remoteSearch ? dataSource : (0, _helper.getFilteredMultipleDataCombo)(_extends({}, props, state));
|
|
398
398
|
return {
|
|
399
399
|
dataCombo: dataCombo,
|
|
400
|
-
selected:
|
|
400
|
+
selected: dataSource.length > 0 && remoteSearch ? dataSource[0] : null
|
|
401
401
|
};
|
|
402
402
|
}
|
|
403
403
|
|
|
@@ -385,12 +385,12 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
385
385
|
e.preventDefault();
|
|
386
386
|
|
|
387
387
|
_this3.onSelect(selected);
|
|
388
|
-
} else if ([constants.keyCodes.
|
|
388
|
+
} else if ([constants.keyCodes.ARROW_DOWN, constants.keyCodes.ARROW_UP].includes(e.keyCode)) {
|
|
389
389
|
var index = dataSource.findIndex(function (d) {
|
|
390
390
|
return d[idKey] === selected[idKey];
|
|
391
391
|
});
|
|
392
392
|
|
|
393
|
-
if (e.keyCode === constants.keyCodes.
|
|
393
|
+
if (e.keyCode === constants.keyCodes.ARROW_UP) {
|
|
394
394
|
index = index === dataSource.length - 1 ? 0 : index + 1;
|
|
395
395
|
} else {
|
|
396
396
|
index = index === 0 ? dataSource.length - 1 : index - 1;
|
|
@@ -7,10 +7,9 @@ exports.PARA_ENGANAR_O_ESLINT_JA_QUE_TENHO_SO_UMA_CONSTANTE = exports.keyCodes =
|
|
|
7
7
|
var keyCodes = {
|
|
8
8
|
TAB: 9,
|
|
9
9
|
ENTER: 13,
|
|
10
|
-
ARROW_UP:
|
|
11
|
-
ARROW_DOWN:
|
|
12
|
-
BACKSPACE: 8
|
|
13
|
-
F: 70
|
|
10
|
+
ARROW_UP: 40,
|
|
11
|
+
ARROW_DOWN: 38,
|
|
12
|
+
BACKSPACE: 8
|
|
14
13
|
};
|
|
15
14
|
exports.keyCodes = keyCodes;
|
|
16
15
|
var PARA_ENGANAR_O_ESLINT_JA_QUE_TENHO_SO_UMA_CONSTANTE = 1;
|
|
@@ -112,12 +112,12 @@ var withTooltip = function withTooltip(WrappedComponent) {
|
|
|
112
112
|
};
|
|
113
113
|
}, []);
|
|
114
114
|
(0, _react.useEffect)(function () {
|
|
115
|
-
if (targetElement.current
|
|
115
|
+
if (targetElement.current) {
|
|
116
116
|
var width = tooltipDimensions.width,
|
|
117
117
|
height = tooltipDimensions.height;
|
|
118
118
|
var targetDimensions = targetElement.current.getBoundingClientRect();
|
|
119
119
|
var targetVerticalCenter = (targetDimensions.top + targetDimensions.bottom) / 2;
|
|
120
|
-
var tooltipClientWidth = tooltipElement.current.clientWidth;
|
|
120
|
+
var tooltipClientWidth = tooltipElement.current && tooltipElement.current.clientWidth;
|
|
121
121
|
var style = "width: ".concat(typeof width === 'string' ? width : "".concat(width, "px"));
|
|
122
122
|
var left = targetDimensions.left + targetDimensions.width / 2 - tooltipClientWidth / 2;
|
|
123
123
|
left = Math.min(left, document.body.clientWidth - tooltipClientWidth - space);
|
package/lib/list/Item.js
CHANGED
|
@@ -21,8 +21,6 @@ var _helpers = _interopRequireDefault(require("./helpers"));
|
|
|
21
21
|
|
|
22
22
|
var _withDropdown = require("../dropdown/withDropdown");
|
|
23
23
|
|
|
24
|
-
var constants = _interopRequireWildcard(require("../internals/constants"));
|
|
25
|
-
|
|
26
24
|
var _permissionValidations = require("../permissionValidations");
|
|
27
25
|
|
|
28
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -46,7 +44,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== "und
|
|
|
46
44
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
47
45
|
|
|
48
46
|
var Item = function Item(props) {
|
|
49
|
-
var
|
|
47
|
+
var _onClick = props.onClick,
|
|
50
48
|
leftIconName = props.leftIconName,
|
|
51
49
|
leftIcon = props.leftIcon,
|
|
52
50
|
displayCheckbox = props.displayCheckbox,
|
|
@@ -70,8 +68,7 @@ var Item = function Item(props) {
|
|
|
70
68
|
var _useContext = (0, _react.useContext)(_helpers["default"]),
|
|
71
69
|
handleSelectItem = _useContext.handleSelectItem,
|
|
72
70
|
selectable = _useContext.selectable,
|
|
73
|
-
selectedItemId = _useContext.selectedItemId
|
|
74
|
-
selectedItemRef = _useContext.selectedItemRef;
|
|
71
|
+
selectedItemId = _useContext.selectedItemId;
|
|
75
72
|
|
|
76
73
|
var dropdownContext = (0, _react.useContext)(_withDropdown.WithDropdownContext);
|
|
77
74
|
var options = [_permissionValidations.OPTIONS_ON_DENIED.disabled, _permissionValidations.OPTIONS_ON_DENIED.unvisible];
|
|
@@ -80,8 +77,6 @@ var Item = function Item(props) {
|
|
|
80
77
|
_useState2 = _slicedToArray(_useState, 1),
|
|
81
78
|
onDenied = _useState2[0];
|
|
82
79
|
|
|
83
|
-
var history = (0, _reactRouterDom.useHistory)();
|
|
84
|
-
|
|
85
80
|
var shouldDisable = function shouldDisable() {
|
|
86
81
|
return disabled || onDenied.disabled;
|
|
87
82
|
};
|
|
@@ -102,28 +97,16 @@ var Item = function Item(props) {
|
|
|
102
97
|
return null;
|
|
103
98
|
};
|
|
104
99
|
|
|
105
|
-
var handleOnSelectItem = function handleOnSelectItem(e) {
|
|
106
|
-
if (onClick !== undefined) onClick(e, itemId);
|
|
107
|
-
if (dropdownContext) dropdownContext.handleDropdownClose();
|
|
108
|
-
if (selectable) handleSelectItem(itemId, onClick);
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
var onKeyDown = function onKeyDown(e) {
|
|
112
|
-
if ([constants.keyCodes.ENTER].includes(e.keyCode)) {
|
|
113
|
-
e.preventDefault();
|
|
114
|
-
handleOnSelectItem(e);
|
|
115
|
-
if (url) history.push(url);
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
|
|
119
100
|
var getProps = function getProps() {
|
|
120
101
|
if (shouldDisable()) return undefined;
|
|
121
|
-
if (
|
|
102
|
+
if (_onClick === undefined && dropdownContext === undefined && !selectable) return null;
|
|
122
103
|
return {
|
|
123
104
|
onClick: function onClick(e) {
|
|
124
|
-
|
|
105
|
+
if (_onClick !== undefined) _onClick(e, itemId);
|
|
106
|
+
if (dropdownContext) dropdownContext.handleDropdownClose();
|
|
107
|
+
if (selectable) handleSelectItem(itemId, _onClick);
|
|
125
108
|
},
|
|
126
|
-
onKeyDown:
|
|
109
|
+
onKeyDown: null,
|
|
127
110
|
role: 'button',
|
|
128
111
|
tabIndex: '0'
|
|
129
112
|
};
|
|
@@ -131,7 +114,6 @@ var Item = function Item(props) {
|
|
|
131
114
|
|
|
132
115
|
if (!visible || onDenied.unvisible) return null;
|
|
133
116
|
return /*#__PURE__*/_react["default"].createElement("li", _extends({
|
|
134
|
-
ref: itemId && selectedItemId === itemId ? selectedItemRef : null,
|
|
135
117
|
style: style,
|
|
136
118
|
className: "item-container ".concat(hovered && 'hovered', "\n ").concat(itemId && selectedItemId === itemId ? '-activedlist' : '')
|
|
137
119
|
}, getProps(), {
|
package/lib/list/index.js
CHANGED
|
@@ -33,8 +33,6 @@ var _Header = _interopRequireDefault(require("./Header"));
|
|
|
33
33
|
|
|
34
34
|
var _Item = _interopRequireDefault(require("./Item"));
|
|
35
35
|
|
|
36
|
-
var constants = _interopRequireWildcard(require("../internals/constants"));
|
|
37
|
-
|
|
38
36
|
var _Separator = _interopRequireDefault(require("./Separator"));
|
|
39
37
|
|
|
40
38
|
require("../assets/styles/list.scss");
|
|
@@ -60,19 +58,6 @@ function _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== "und
|
|
|
60
58
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
61
59
|
|
|
62
60
|
var List = function List(props) {
|
|
63
|
-
var selectedItemRef = (0, _react.useRef)(null);
|
|
64
|
-
var listRef = (0, _react.useRef)(null);
|
|
65
|
-
|
|
66
|
-
var _useState = (0, _react.useState)(''),
|
|
67
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
68
|
-
selectedItemId = _useState2[0],
|
|
69
|
-
setSelectedItemId = _useState2[1];
|
|
70
|
-
|
|
71
|
-
var _useState3 = (0, _react.useState)([]),
|
|
72
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
73
|
-
itensId = _useState4[0],
|
|
74
|
-
setItensId = _useState4[1];
|
|
75
|
-
|
|
76
61
|
var children = props.children,
|
|
77
62
|
customClass = props.customClass,
|
|
78
63
|
condensed = props.condensed,
|
|
@@ -80,92 +65,29 @@ var List = function List(props) {
|
|
|
80
65
|
style = props.style,
|
|
81
66
|
selectable = props.selectable,
|
|
82
67
|
onSelectItem = props.onSelectItem;
|
|
68
|
+
|
|
69
|
+
var _useState = (0, _react.useState)(''),
|
|
70
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
71
|
+
selectedItemId = _useState2[0],
|
|
72
|
+
setSelectedItemId = _useState2[1];
|
|
73
|
+
|
|
83
74
|
var contextValues = {
|
|
84
75
|
selectable: selectable,
|
|
85
76
|
selectedItemId: selectedItemId,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if (!onSelectItem && onClick) setSelectedItemId(itemId);
|
|
90
|
-
if (onSelectItem) onSelectItem(itemId);
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
var onKeyDown = function onKeyDown(e) {
|
|
95
|
-
if ([constants.keyCodes.ARROW_DOWN, constants.keyCodes.ARROW_UP].includes(e.keyCode)) {
|
|
96
|
-
e.preventDefault();
|
|
97
|
-
|
|
98
|
-
if (e.keyCode === constants.keyCodes.ARROW_DOWN) {
|
|
99
|
-
if (selectedItemId === itensId[itensId.length - 1]) {
|
|
100
|
-
setSelectedItemId(itensId[0]);
|
|
101
|
-
} else {
|
|
102
|
-
var index = itensId.indexOf(selectedItemId === '' ? '0' : selectedItemId);
|
|
103
|
-
setSelectedItemId(itensId[index + 1]);
|
|
104
|
-
}
|
|
105
|
-
} else if (e.keyCode === constants.keyCodes.ARROW_UP) {
|
|
106
|
-
if (selectedItemId === itensId[0]) {
|
|
107
|
-
setSelectedItemId(itensId[itensId.length - 1]);
|
|
108
|
-
} else {
|
|
109
|
-
var _index = itensId.indexOf(selectedItemId);
|
|
110
|
-
|
|
111
|
-
setSelectedItemId(itensId[_index - 1]);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return selectedItemRef.current && selectedItemRef.current.focus();
|
|
77
|
+
handleSelectItem: function handleSelectItem(selectedId, onClick) {
|
|
78
|
+
if (!onSelectItem && onClick) setSelectedItemId(selectedId);
|
|
79
|
+
if (onSelectItem) onSelectItem(selectedId);
|
|
116
80
|
}
|
|
117
|
-
|
|
118
|
-
return null;
|
|
119
81
|
};
|
|
120
|
-
|
|
121
|
-
(0, _react.useEffect)(function () {
|
|
122
|
-
if (selectedItemRef.current && listRef.current && listRef.current.scroll) {
|
|
123
|
-
var selectedItemRect = selectedItemRef.current.getBoundingClientRect();
|
|
124
|
-
var listRect = listRef.current.getBoundingClientRect();
|
|
125
|
-
var defaultScrollTop = 0;
|
|
126
|
-
var defaultBottomOffset = 100;
|
|
127
|
-
|
|
128
|
-
if (selectedItemRect.top - selectedItemRect.height > listRect.bottom) {
|
|
129
|
-
listRef.current.scroll({
|
|
130
|
-
top: selectedItemRect.top
|
|
131
|
-
});
|
|
132
|
-
} else if (selectedItemRect.top + selectedItemRect.height - listRect.y >= listRect.height) {
|
|
133
|
-
listRef.current.scroll({
|
|
134
|
-
top: listRef.current.scrollTop + selectedItemRect.height
|
|
135
|
-
});
|
|
136
|
-
} else if (selectedItemRect.bottom < defaultBottomOffset) {
|
|
137
|
-
listRef.current.scroll({
|
|
138
|
-
top: defaultScrollTop
|
|
139
|
-
});
|
|
140
|
-
} else {
|
|
141
|
-
listRef.current.scroll({
|
|
142
|
-
top: listRef.current.scrollTop - selectedItemRect.height
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}, [selectedItemRef.current]);
|
|
147
|
-
(0, _react.useEffect)(function () {
|
|
148
|
-
document.addEventListener('keydown', onKeyDown);
|
|
149
|
-
return function () {
|
|
150
|
-
document.removeEventListener('keydown', onKeyDown);
|
|
151
|
-
};
|
|
152
|
-
});
|
|
153
82
|
(0, _react.useEffect)(function () {
|
|
154
83
|
if (onSelectItem && props.selectedItemId) setSelectedItemId(props.selectedItemId);
|
|
155
84
|
}, [props.selectedItemId]);
|
|
156
|
-
(0, _react.useEffect)(function () {
|
|
157
|
-
var newItensIds = children.length > 0 && children.map(function (item) {
|
|
158
|
-
return item.props.itemId;
|
|
159
|
-
}).filter(Boolean);
|
|
160
|
-
setItensId(newItensIds);
|
|
161
|
-
}, [children.length]);
|
|
162
85
|
return /*#__PURE__*/_react["default"].createElement(_helpers["default"].Provider, {
|
|
163
86
|
value: contextValues
|
|
164
87
|
}, /*#__PURE__*/_react["default"].createElement("ul", {
|
|
165
88
|
"data-testid": "list-component",
|
|
166
89
|
style: style,
|
|
167
|
-
|
|
168
|
-
className: "list-component ".concat(condensed && '-condensed', "\n ").concat(customClass, " ").concat(!transparent && '-listbackground')
|
|
90
|
+
className: "list-component ".concat(condensed && '-condensed', " ").concat(customClass, " ").concat(!transparent && '-listbackground')
|
|
169
91
|
}, children));
|
|
170
92
|
};
|
|
171
93
|
|