linear-react-components-ui 1.0.14-beta.0 → 1.0.14-beta.2
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/datepicker.scss +3 -1
- package/lib/assets/styles/periodpicker.scss +3 -7
- package/lib/assets/styles/tabs.scss +25 -56
- package/lib/form/FieldArray.js +6 -8
- package/lib/form/FieldPeriod.js +37 -51
- package/lib/form/types.d.ts +3 -10
- package/lib/inputs/base/helpers.d.ts +2 -2
- package/lib/inputs/base/helpers.js +4 -2
- package/lib/inputs/multiSelect/index.js +1 -2
- package/lib/inputs/period/index.js +49 -110
- package/lib/inputs/period/types.d.ts +1 -10
- package/lib/uitour/index.js +25 -2
- package/package.json +1 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
@import "commons.scss";
|
|
2
2
|
@import "effects.scss";
|
|
3
|
-
|
|
4
3
|
.periodpicker-component {
|
|
5
4
|
height: auto;
|
|
6
5
|
position: relative;
|
|
@@ -9,7 +8,7 @@
|
|
|
9
8
|
border: 1px solid #dae1e8;
|
|
10
9
|
|
|
11
10
|
.inputwrapper {
|
|
12
|
-
|
|
11
|
+
border: none;
|
|
13
12
|
}
|
|
14
13
|
|
|
15
14
|
.separation_icon {
|
|
@@ -22,7 +21,7 @@
|
|
|
22
21
|
padding: 4px;
|
|
23
22
|
border: none;
|
|
24
23
|
}
|
|
25
|
-
|
|
24
|
+
|
|
26
25
|
.input-base-component {
|
|
27
26
|
flex: 1;
|
|
28
27
|
}
|
|
@@ -40,14 +39,11 @@
|
|
|
40
39
|
&:hover {
|
|
41
40
|
background-color: $default-hover-color;
|
|
42
41
|
}
|
|
43
|
-
|
|
44
42
|
&.-selected {
|
|
45
43
|
background-color: $default-hover-color;
|
|
46
44
|
}
|
|
47
|
-
|
|
48
45
|
&.-disabled {
|
|
49
46
|
@extend %component-menu-disabled;
|
|
50
|
-
|
|
51
47
|
&:hover {
|
|
52
48
|
background-color: transparent;
|
|
53
49
|
}
|
|
@@ -66,4 +62,4 @@
|
|
|
66
62
|
overflow-x: hidden;
|
|
67
63
|
/* margin-top: 2px; */
|
|
68
64
|
z-index: 99999999999;
|
|
69
|
-
}
|
|
65
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
@import "colors.scss";
|
|
2
|
-
|
|
3
2
|
%tab-closepanel {
|
|
4
3
|
background-color: transparent;
|
|
5
4
|
border: 0;
|
|
@@ -11,7 +10,6 @@
|
|
|
11
10
|
visibility: hidden;
|
|
12
11
|
transition: all 0.2s ease-in-out;
|
|
13
12
|
border-radius: 4px;
|
|
14
|
-
|
|
15
13
|
&:after {
|
|
16
14
|
content: "×";
|
|
17
15
|
font-size: 20px;
|
|
@@ -19,16 +17,13 @@
|
|
|
19
17
|
color: $font-color-soft;
|
|
20
18
|
transition: all 0.2s ease-in-out;
|
|
21
19
|
}
|
|
22
|
-
|
|
23
20
|
&:hover {
|
|
24
21
|
background-color: $color-light-dark;
|
|
25
|
-
|
|
26
22
|
&:after {
|
|
27
23
|
color: $font-color-second;
|
|
28
24
|
}
|
|
29
25
|
}
|
|
30
26
|
}
|
|
31
|
-
|
|
32
27
|
%tab-component-menus {
|
|
33
28
|
.menu {
|
|
34
29
|
-webkit-box-shadow: 0px -1px 0px $component-border-color inset;
|
|
@@ -38,13 +33,11 @@
|
|
|
38
33
|
flex-wrap: nowrap;
|
|
39
34
|
justify-content: center;
|
|
40
35
|
flex: 1;
|
|
41
|
-
|
|
42
|
-
&.-firsttabident>.menuitem:first-child {
|
|
36
|
+
&.-firsttabident > .menuitem:first-child {
|
|
43
37
|
margin-left: 15px;
|
|
44
38
|
}
|
|
45
39
|
}
|
|
46
|
-
|
|
47
|
-
.menu>.menuitem {
|
|
40
|
+
.menu > .menuitem {
|
|
48
41
|
border-bottom: 0;
|
|
49
42
|
border-radius: 5px 5px 0px 0px;
|
|
50
43
|
-moz-border-radius: 5px 5px 0px 0px;
|
|
@@ -58,31 +51,27 @@
|
|
|
58
51
|
display: flex;
|
|
59
52
|
justify-content: space-between;
|
|
60
53
|
align-items: center;
|
|
61
|
-
|
|
62
54
|
&.selected {
|
|
63
55
|
border: 1px solid $component-border-color;
|
|
64
56
|
background: $font-color-second;
|
|
65
57
|
border-bottom: 1px solid $font-color-second;
|
|
66
58
|
border-top: 2px solid $component-selected-color;
|
|
67
59
|
box-shadow: 0;
|
|
68
|
-
font-weight: bold;
|
|
69
|
-
/* z-index: 2; */
|
|
60
|
+
font-weight: bold; /* z-index: 2; */
|
|
70
61
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
&:hover>.closepanel {
|
|
62
|
+
&.selected > .closepanel,
|
|
63
|
+
&:hover > .closepanel {
|
|
74
64
|
visibility: visible;
|
|
75
65
|
}
|
|
76
66
|
}
|
|
77
|
-
|
|
78
|
-
.menu>.menuitem>.menubutton {
|
|
67
|
+
.menu > .menuitem > .menubutton {
|
|
79
68
|
white-space: nowrap;
|
|
80
69
|
text-overflow: ellipsis;
|
|
81
70
|
background: transparent;
|
|
82
71
|
border: 0;
|
|
83
72
|
}
|
|
84
73
|
|
|
85
|
-
.menu
|
|
74
|
+
.menu > .menuitem > .closepanel {
|
|
86
75
|
@extend %tab-closepanel;
|
|
87
76
|
}
|
|
88
77
|
|
|
@@ -101,32 +90,27 @@
|
|
|
101
90
|
grid-template-rows: auto 1fr;
|
|
102
91
|
width: 100%;
|
|
103
92
|
height: 100%;
|
|
104
|
-
overflow: auto;
|
|
105
93
|
@extend %tab-component-menus;
|
|
106
|
-
|
|
107
|
-
>.menucontainer {
|
|
94
|
+
> .menucontainer {
|
|
108
95
|
display: flex;
|
|
109
96
|
flex-wrap: nowrap;
|
|
110
97
|
width: 100%;
|
|
111
98
|
min-height: 35px;
|
|
112
99
|
overflow: hidden;
|
|
113
100
|
@extend %tab-component-menus;
|
|
114
|
-
|
|
115
|
-
>.dropdownbutton {
|
|
101
|
+
> .dropdownbutton {
|
|
116
102
|
border-bottom: 1px solid $component-border-color;
|
|
117
103
|
padding: 0 0.8rem;
|
|
118
104
|
}
|
|
119
105
|
}
|
|
120
|
-
|
|
121
|
-
>.panel {
|
|
106
|
+
> .panel {
|
|
122
107
|
background-color: $font-color-second;
|
|
123
108
|
border: 1px solid $component-border-color;
|
|
124
109
|
border-top: 0;
|
|
125
110
|
padding: 10px;
|
|
126
111
|
overflow: auto;
|
|
127
112
|
}
|
|
128
|
-
|
|
129
|
-
>.hidepanel {
|
|
113
|
+
> .hidepanel {
|
|
130
114
|
display: none;
|
|
131
115
|
}
|
|
132
116
|
}
|
|
@@ -137,19 +121,16 @@
|
|
|
137
121
|
.tabs-component.menu-left {
|
|
138
122
|
grid-template-columns: auto 1fr;
|
|
139
123
|
grid-template-rows: none;
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
>.menu {
|
|
124
|
+
> .menucontainer {
|
|
125
|
+
> .menu {
|
|
143
126
|
box-shadow: -1px 0px 0px 0px $component-border-color inset;
|
|
144
127
|
flex-direction: column;
|
|
145
128
|
justify-content: center;
|
|
146
129
|
}
|
|
147
|
-
|
|
148
|
-
>.menu>.menuitem {
|
|
130
|
+
> .menu > .menuitem {
|
|
149
131
|
border-radius: 5px 0px 0px 5px;
|
|
150
132
|
-moz-border-radius: 5px 0px 0px 5px;
|
|
151
133
|
-webkit-border-radius: 5px 0px 0px 5px;
|
|
152
|
-
|
|
153
134
|
&.selected {
|
|
154
135
|
border: 1px solid $component-border-color;
|
|
155
136
|
border-right: 1px solid $font-color-second;
|
|
@@ -157,13 +138,11 @@
|
|
|
157
138
|
width: 100%;
|
|
158
139
|
}
|
|
159
140
|
}
|
|
160
|
-
|
|
161
|
-
>.menu>.menuitem>.closepanel {
|
|
141
|
+
> .menu > .menuitem > .closepanel {
|
|
162
142
|
float: left;
|
|
163
143
|
}
|
|
164
144
|
}
|
|
165
|
-
|
|
166
|
-
>.panel {
|
|
145
|
+
> .panel {
|
|
167
146
|
border-top: 1px solid $component-border-color;
|
|
168
147
|
border-left: 0;
|
|
169
148
|
}
|
|
@@ -174,17 +153,14 @@
|
|
|
174
153
|
*/
|
|
175
154
|
.tabs-component.menu-bottom {
|
|
176
155
|
grid-template-rows: 1fr auto;
|
|
177
|
-
|
|
178
156
|
.menucontainer {
|
|
179
|
-
|
|
157
|
+
> .menu {
|
|
180
158
|
box-shadow: 0 1px 1px 0px $component-border-color inset;
|
|
181
159
|
}
|
|
182
|
-
|
|
183
|
-
>.menu>.menuitem {
|
|
160
|
+
> .menu > .menuitem {
|
|
184
161
|
border-radius: 0px 0px 5px 5px;
|
|
185
162
|
-moz-border-radius: 0px 0px 5px 5px;
|
|
186
163
|
-webkit-border-radius: 0px 0px 5px 5px;
|
|
187
|
-
|
|
188
164
|
&.selected {
|
|
189
165
|
border: 1px solid $component-border-color;
|
|
190
166
|
border-top: 1px solid $font-color-second;
|
|
@@ -193,8 +169,7 @@
|
|
|
193
169
|
}
|
|
194
170
|
}
|
|
195
171
|
}
|
|
196
|
-
|
|
197
|
-
>.panel {
|
|
172
|
+
> .panel {
|
|
198
173
|
border-top: 1px solid $component-border-color;
|
|
199
174
|
border-bottom: 0;
|
|
200
175
|
}
|
|
@@ -206,19 +181,16 @@
|
|
|
206
181
|
.tabs-component.menu-right {
|
|
207
182
|
grid-template-columns: 1fr auto;
|
|
208
183
|
grid-template-rows: none;
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
>.menu {
|
|
184
|
+
.menucontainer{
|
|
185
|
+
> .menu {
|
|
212
186
|
box-shadow: 2px 0 0px -1px $component-border-color inset;
|
|
213
187
|
flex-direction: column;
|
|
214
188
|
justify-content: center;
|
|
215
189
|
}
|
|
216
|
-
|
|
217
|
-
>.menu>.menuitem {
|
|
190
|
+
> .menu > .menuitem {
|
|
218
191
|
border-radius: 0px 5px 5px 0px;
|
|
219
192
|
-moz-border-radius: 0px 5px 5px 0px;
|
|
220
193
|
-webkit-border-radius: 0px 5px 5px 0px;
|
|
221
|
-
|
|
222
194
|
&.selected {
|
|
223
195
|
border: 1px solid $component-border-color;
|
|
224
196
|
border-left: 1px solid $font-color-second;
|
|
@@ -227,8 +199,7 @@
|
|
|
227
199
|
}
|
|
228
200
|
}
|
|
229
201
|
}
|
|
230
|
-
|
|
231
|
-
>.panel {
|
|
202
|
+
> .panel {
|
|
232
203
|
border-top: 1px solid $component-border-color;
|
|
233
204
|
border-right: 0;
|
|
234
205
|
}
|
|
@@ -245,12 +216,10 @@
|
|
|
245
216
|
align-items: center;
|
|
246
217
|
justify-content: space-between;
|
|
247
218
|
min-height: 50px;
|
|
248
|
-
|
|
249
|
-
>.closepanel {
|
|
219
|
+
> .closepanel {
|
|
250
220
|
@extend %tab-closepanel;
|
|
251
221
|
}
|
|
252
|
-
|
|
253
|
-
&:hover>.closepanel {
|
|
222
|
+
&:hover > .closepanel {
|
|
254
223
|
visibility: visible;
|
|
255
224
|
}
|
|
256
225
|
}
|
package/lib/form/FieldArray.js
CHANGED
|
@@ -116,10 +116,9 @@ var FieldArray = function FieldArray(props) {
|
|
|
116
116
|
}
|
|
117
117
|
})), {
|
|
118
118
|
label: label,
|
|
119
|
-
name: name
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}))
|
|
119
|
+
name: name
|
|
120
|
+
})), (0, _helpers.getErrorMessages)(_objectSpread(_objectSpread({}, props), {}, {
|
|
121
|
+
fieldErrors: showValidateMessages ? props.fieldErrors : {}
|
|
123
122
|
})));
|
|
124
123
|
} else {
|
|
125
124
|
content = /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(Component, _extends({}, rest, getDefaultProps(props, handleShowValidateMessages), getEvents(_objectSpread(_objectSpread({}, props), {}, {
|
|
@@ -128,10 +127,9 @@ var FieldArray = function FieldArray(props) {
|
|
|
128
127
|
}
|
|
129
128
|
})), {
|
|
130
129
|
label: label,
|
|
131
|
-
name: name
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}))
|
|
130
|
+
name: name
|
|
131
|
+
})), (0, _helpers.getErrorMessages)(_objectSpread(_objectSpread({}, props), {}, {
|
|
132
|
+
fieldErrors: showValidateMessages ? props.fieldErrors : {}
|
|
135
133
|
})));
|
|
136
134
|
}
|
|
137
135
|
}
|
package/lib/form/FieldPeriod.js
CHANGED
|
@@ -7,16 +7,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
10
|
-
var _gridlayout = _interopRequireDefault(require("../gridlayout"));
|
|
11
10
|
var _withFieldHOC = _interopRequireDefault(require("./withFieldHOC"));
|
|
12
11
|
var _helpers = require("./helpers");
|
|
13
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
13
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
14
|
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; }
|
|
16
15
|
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); }
|
|
17
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
18
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
19
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
20
16
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
21
17
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
22
18
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -33,18 +29,13 @@ var FieldPeriod = function FieldPeriod(props) {
|
|
|
33
29
|
externalMessagesErrors = props.externalMessagesErrors,
|
|
34
30
|
_onChange = props.onChange,
|
|
35
31
|
validators = props.validators,
|
|
36
|
-
originalData = props.originalData
|
|
37
|
-
gridLayout = props.gridLayout,
|
|
38
|
-
Component = props.component,
|
|
39
|
-
name = props.name,
|
|
40
|
-
externalFieldErrors = props.externalFieldErrors;
|
|
41
|
-
var content = null;
|
|
32
|
+
originalData = props.originalData;
|
|
42
33
|
var _useState = (0, _react.useState)(false),
|
|
43
34
|
_useState2 = _slicedToArray(_useState, 2),
|
|
44
35
|
showValidateMessages = _useState2[0],
|
|
45
36
|
setShowValidateMessages = _useState2[1];
|
|
46
|
-
var currentValue = _lodash.default.get(data,
|
|
47
|
-
var originalValue = _lodash.default.get(originalData,
|
|
37
|
+
var currentValue = _lodash.default.get(data, nameDateInitial);
|
|
38
|
+
var originalValue = _lodash.default.get(originalData, nameDateInitial);
|
|
48
39
|
(0, _react.useEffect)(function () {
|
|
49
40
|
if (!_lodash.default.isEqual(currentValue, originalValue) && currentValue && (!!currentValue || currentValue === 0 || Array.isArray(currentValue) && currentValue.length > 0)) {
|
|
50
41
|
setShowValidateMessages(true);
|
|
@@ -53,52 +44,47 @@ var FieldPeriod = function FieldPeriod(props) {
|
|
|
53
44
|
}
|
|
54
45
|
}, [currentValue]);
|
|
55
46
|
var errorMessages = (0, _helpers.getErrorMessages)({
|
|
56
|
-
name:
|
|
47
|
+
name: nameDateInitial,
|
|
57
48
|
fieldErrors: showValidateMessages ? fieldErrors : {},
|
|
58
|
-
externalFieldErrors: externalFieldErrors,
|
|
59
49
|
externalMessagesErrors: externalMessagesErrors
|
|
60
50
|
});
|
|
61
|
-
if (
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
handlerFieldValidade(nameDateInitial, (_handlerFieldValidade = {}, _defineProperty(_handlerFieldValidade, nameDateInitial, initial), _defineProperty(_handlerFieldValidade, nameDateFinal, final), _handlerFieldValidade), validators);
|
|
70
|
-
setShowValidateMessages(true);
|
|
71
|
-
}
|
|
72
|
-
if (handlerFieldChange) {
|
|
73
|
-
var _value;
|
|
74
|
-
handlerFieldChange({
|
|
75
|
-
target: {
|
|
76
|
-
name: name,
|
|
77
|
-
value: (_value = {}, _defineProperty(_value, nameDateInitial, initial), _defineProperty(_value, nameDateFinal, final), _value)
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
if (_onChange) _onChange({
|
|
51
|
+
if (!props.component) return null;
|
|
52
|
+
return /*#__PURE__*/_react.default.createElement(props.component, _extends({}, props, {
|
|
53
|
+
errorMessages: errorMessages,
|
|
54
|
+
onChange: function onChange(e, maskValue, _ref) {
|
|
55
|
+
var initial = _ref.initial,
|
|
56
|
+
final = _ref.final;
|
|
57
|
+
if (validators && handlerFieldValidade) {
|
|
58
|
+
handlerFieldValidade(nameDateInitial, {
|
|
82
59
|
initial: initial,
|
|
83
60
|
final: final
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
value: {
|
|
87
|
-
initial: _lodash.default.get(data, "".concat(name, ".").concat(nameDateInitial)),
|
|
88
|
-
final: _lodash.default.get(data, "".concat(name, ".").concat(nameDateFinal))
|
|
61
|
+
}, validators);
|
|
62
|
+
setShowValidateMessages(true);
|
|
89
63
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
64
|
+
if (handlerFieldChange) {
|
|
65
|
+
handlerFieldChange({
|
|
66
|
+
target: {
|
|
67
|
+
name: nameDateInitial,
|
|
68
|
+
value: initial
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
handlerFieldChange({
|
|
72
|
+
target: {
|
|
73
|
+
name: nameDateFinal,
|
|
74
|
+
value: final
|
|
75
|
+
}
|
|
76
|
+
});
|
|
98
77
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
78
|
+
if (_onChange) _onChange({
|
|
79
|
+
initial: initial,
|
|
80
|
+
final: final
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
value: {
|
|
84
|
+
initial: _lodash.default.get(data, nameDateInitial),
|
|
85
|
+
final: _lodash.default.get(data, nameDateFinal)
|
|
86
|
+
}
|
|
87
|
+
}));
|
|
102
88
|
};
|
|
103
89
|
var _default = (0, _withFieldHOC.default)(FieldPeriod);
|
|
104
90
|
exports.default = _default;
|
package/lib/form/types.d.ts
CHANGED
|
@@ -8,8 +8,8 @@ import '../@types/Period.js';
|
|
|
8
8
|
|
|
9
9
|
type Validator = (value: string) => string | undefined;
|
|
10
10
|
type PeriodValidator = (value: {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
initialData: string;
|
|
12
|
+
finalData: string;
|
|
13
13
|
}) => string | undefined;
|
|
14
14
|
type OnFielChangeEvent = Event & {
|
|
15
15
|
target: HTMLInputElement;
|
|
@@ -117,7 +117,6 @@ interface IFieldArrayProps extends WithFieldProps {
|
|
|
117
117
|
disabled?: boolean;
|
|
118
118
|
onBlur?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
119
119
|
handlerFieldValidade?: (name: string, value: string, validatorsArray: Validator[] | Validator) => void;
|
|
120
|
-
required?: boolean;
|
|
121
120
|
}
|
|
122
121
|
type PeriodChangeEvent = {
|
|
123
122
|
initial: string;
|
|
@@ -126,9 +125,7 @@ type PeriodChangeEvent = {
|
|
|
126
125
|
type PeriodFieldChangeEvent = {
|
|
127
126
|
target: {
|
|
128
127
|
name: string;
|
|
129
|
-
value:
|
|
130
|
-
[valueDate: string]: string;
|
|
131
|
-
};
|
|
128
|
+
value: string;
|
|
132
129
|
};
|
|
133
130
|
};
|
|
134
131
|
interface IFieldPeriodProps extends WithFieldProps {
|
|
@@ -145,12 +142,8 @@ interface IFieldPeriodProps extends WithFieldProps {
|
|
|
145
142
|
[name: string]: string[];
|
|
146
143
|
};
|
|
147
144
|
externalMessagesErrors?: string[];
|
|
148
|
-
externalFieldErrors?: {
|
|
149
|
-
[name: string]: string[];
|
|
150
|
-
};
|
|
151
145
|
handlerFieldValidade?: (name: string, value: object, validatorsArray: PeriodValidator[] | PeriodValidator) => void;
|
|
152
146
|
onChange?: (event: PeriodChangeEvent) => PeriodChangeEvent;
|
|
153
|
-
gridLayout?: string;
|
|
154
147
|
}
|
|
155
148
|
interface FormContextProps {
|
|
156
149
|
skeletonize?: boolean;
|
|
@@ -4,13 +4,13 @@ import 'react';
|
|
|
4
4
|
import '../../@types/Period.js';
|
|
5
5
|
import '../../@types/PermissionAttr.js';
|
|
6
6
|
|
|
7
|
-
declare const getInputClass: ({ textAlign, readOnly, readOnlyClass
|
|
7
|
+
declare const getInputClass: ({ textAlign, readOnly, readOnlyClass }: {
|
|
8
8
|
textAlign?: TextAlign | undefined;
|
|
9
9
|
readOnly?: boolean | undefined;
|
|
10
10
|
readOnlyClass?: string | undefined;
|
|
11
11
|
}) => string;
|
|
12
12
|
declare const getInputWrapperClass: (props: IBaseProps) => string;
|
|
13
13
|
declare const getErrorMessages: (messages: string[]) => JSX.Element;
|
|
14
|
-
declare const getRightElements: (errorMessages: string[], skeletonize: boolean, rightElements?: JSX.Element | JSX.Element[]) => JSX.Element[] | null;
|
|
14
|
+
declare const getRightElements: (errorMessages: string[], skeletonize: boolean, rightElements?: JSX.Element | JSX.Element[]) => JSX.Element | JSX.Element[] | null;
|
|
15
15
|
|
|
16
16
|
export { getErrorMessages, getInputClass, getInputWrapperClass, getRightElements };
|
|
@@ -41,7 +41,9 @@ var getRightElements = function getRightElements(errorMessages, skeletonize, rig
|
|
|
41
41
|
key: "rightelement-".concat(index + 1)
|
|
42
42
|
});
|
|
43
43
|
});
|
|
44
|
-
if (errorMessages) return elements;
|
|
45
|
-
return
|
|
44
|
+
if (errorMessages && errorMessages.length === 0) return elements;
|
|
45
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
46
|
+
className: "sidebuttons"
|
|
47
|
+
}, elements);
|
|
46
48
|
};
|
|
47
49
|
exports.getRightElements = getRightElements;
|
|
@@ -188,8 +188,7 @@ var MultiSelectField = function MultiSelectField(props) {
|
|
|
188
188
|
};
|
|
189
189
|
(0, _react.useEffect)(function () {
|
|
190
190
|
if (gridLayout) {
|
|
191
|
-
var
|
|
192
|
-
var currentGridEl = (_selectWrapper$curren = selectWrapper.current) === null || _selectWrapper$curren === void 0 ? void 0 : _selectWrapper$curren.parentElement;
|
|
191
|
+
var currentGridEl = document.querySelector("#".concat(componentId, ">.-withinput.grid-container"));
|
|
193
192
|
if (currentGridEl) setElementStyles(window.getComputedStyle(currentGridEl));
|
|
194
193
|
}
|
|
195
194
|
window.addEventListener('resize', onScreenResize);
|
|
@@ -14,7 +14,6 @@ var _calendar = _interopRequireDefault(require("../../calendar"));
|
|
|
14
14
|
var _buttons = _interopRequireDefault(require("../../buttons"));
|
|
15
15
|
var _icons = _interopRequireDefault(require("../../icons"));
|
|
16
16
|
var _Dialog = _interopRequireDefault(require("./Dialog"));
|
|
17
|
-
var _hint = _interopRequireDefault(require("../../hint"));
|
|
18
17
|
var helperBase = _interopRequireWildcard(require("../base/helpers"));
|
|
19
18
|
require("../../assets/styles/periodpicker.scss");
|
|
20
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -38,7 +37,6 @@ var PeriodPicker = function PeriodPicker(props) {
|
|
|
38
37
|
openOnFocus = _props$openOnFocus === void 0 ? true : _props$openOnFocus,
|
|
39
38
|
_props$shouldCloseOnS = props.shouldCloseOnSelect,
|
|
40
39
|
shouldCloseOnSelect = _props$shouldCloseOnS === void 0 ? true : _props$shouldCloseOnS,
|
|
41
|
-
calendarColorStyle = props.calendarColorStyle,
|
|
42
40
|
_props$showCalendarIn = props.showCalendarInDialog,
|
|
43
41
|
showCalendarInDialog = _props$showCalendarIn === void 0 ? false : _props$showCalendarIn,
|
|
44
42
|
_props$dialogSize = props.dialogSize,
|
|
@@ -46,27 +44,27 @@ var PeriodPicker = function PeriodPicker(props) {
|
|
|
46
44
|
width: '350px',
|
|
47
45
|
height: '350px'
|
|
48
46
|
} : _props$dialogSize,
|
|
49
|
-
|
|
50
|
-
var _useState = (0, _react.useState)(props.value && (0, _moment.default)(props.value.initial
|
|
47
|
+
calendarColorStyle = props.calendarColorStyle;
|
|
48
|
+
var _useState = (0, _react.useState)(props.value && props.value.initial ? (0, _moment.default)(props.value.initial) : undefined),
|
|
51
49
|
_useState2 = _slicedToArray(_useState, 2),
|
|
52
50
|
valueInitial = _useState2[0],
|
|
53
51
|
setValueInitial = _useState2[1];
|
|
54
|
-
var _useState3 = (0, _react.useState)(props.value && (0, _moment.default)(props.value.final
|
|
52
|
+
var _useState3 = (0, _react.useState)(props.value && props.value.final ? (0, _moment.default)(props.value.final) : undefined),
|
|
55
53
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
56
54
|
valueFinal = _useState4[0],
|
|
57
55
|
setValueFinal = _useState4[1];
|
|
58
|
-
var _useState5 = (0, _react.useState)('
|
|
56
|
+
var _useState5 = (0, _react.useState)('valueInitial'),
|
|
59
57
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
var _useState7 = (0, _react.useState)(
|
|
58
|
+
changing = _useState6[0],
|
|
59
|
+
setChanging = _useState6[1];
|
|
60
|
+
var _useState7 = (0, _react.useState)('week'),
|
|
63
61
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
valuePeriodSelection = _useState8[0],
|
|
63
|
+
setValuePeriodSelection = _useState8[1];
|
|
66
64
|
var _useState9 = (0, _react.useState)(false),
|
|
67
65
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
showCalendar = _useState10[0],
|
|
67
|
+
setShowCalendar = _useState10[1];
|
|
70
68
|
var _useState11 = (0, _react.useState)(false),
|
|
71
69
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
72
70
|
showPeriodSelection = _useState12[0],
|
|
@@ -79,7 +77,6 @@ var PeriodPicker = function PeriodPicker(props) {
|
|
|
79
77
|
_useState16 = _slicedToArray(_useState15, 2),
|
|
80
78
|
onDenied = _useState16[0],
|
|
81
79
|
setOnDenied = _useState16[1];
|
|
82
|
-
var wrapperBaseInputPeriodRef = (0, _react.useRef)(null);
|
|
83
80
|
var inputContainerRef = (0, _react.useRef)(null);
|
|
84
81
|
var inputInitialRef = (0, _react.useRef)(null);
|
|
85
82
|
var buttonOpenRef = (0, _react.useRef)(null);
|
|
@@ -97,31 +94,18 @@ var PeriodPicker = function PeriodPicker(props) {
|
|
|
97
94
|
if (target === inputContainerRef.current || target === inputInitialRef.current || target === inputFinalRef.current || target === buttonOpenRef.current || target === buttonSelectPeriodRef.current) {
|
|
98
95
|
return;
|
|
99
96
|
}
|
|
100
|
-
if (dropdownCalendarContainer.current && dropdownCalendarContainer.current.contains(target))
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
97
|
+
if (dropdownCalendarContainer.current && dropdownCalendarContainer.current.contains(target)) return;
|
|
103
98
|
if (dropdownPeriodContainer.current && dropdownPeriodContainer.current.contains(target)) return;
|
|
104
|
-
|
|
105
|
-
setShowCalendarValueFinal(false);
|
|
99
|
+
setShowCalendar(false);
|
|
106
100
|
setShowPeriodSelection(false);
|
|
107
101
|
};
|
|
108
|
-
var onCloseCalendarWithoutFocus = function onCloseCalendarWithoutFocus(event) {
|
|
109
|
-
if (event.key === 'Tab') {
|
|
110
|
-
if (wrapperBaseInputPeriodRef.current && wrapperBaseInputPeriodRef.current.contains(document.activeElement) && document.activeElement instanceof HTMLInputElement) {
|
|
111
|
-
setShowCalendarValueInitial(false);
|
|
112
|
-
setShowCalendarValueFinal(false);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
102
|
(0, _react.useEffect)(function () {
|
|
117
103
|
window.addEventListener('resize', onScreenResize);
|
|
118
104
|
document.addEventListener('click', onClickOutside);
|
|
119
|
-
document.addEventListener('keydown', onCloseCalendarWithoutFocus);
|
|
120
105
|
if (inputContainerRef.current) onScreenResize();
|
|
121
106
|
return function () {
|
|
122
107
|
window.removeEventListener('resize', onScreenResize);
|
|
123
108
|
document.removeEventListener('click', onClickOutside);
|
|
124
|
-
document.removeEventListener('keydown', onCloseCalendarWithoutFocus);
|
|
125
109
|
};
|
|
126
110
|
}, []);
|
|
127
111
|
(0, _react.useEffect)(function () {
|
|
@@ -154,14 +138,8 @@ var PeriodPicker = function PeriodPicker(props) {
|
|
|
154
138
|
setValueFinal(newValueFinal);
|
|
155
139
|
}
|
|
156
140
|
}, [props.value]);
|
|
157
|
-
var openCalendar = function openCalendar(
|
|
158
|
-
|
|
159
|
-
setShowCalendarValueFinal(false);
|
|
160
|
-
setShowCalendarValueInitial(true);
|
|
161
|
-
} else {
|
|
162
|
-
setShowCalendarValueInitial(false);
|
|
163
|
-
setShowCalendarValueFinal(true);
|
|
164
|
-
}
|
|
141
|
+
var openCalendar = function openCalendar() {
|
|
142
|
+
setShowCalendar(true);
|
|
165
143
|
setShowPeriodSelection(false);
|
|
166
144
|
if (inputContainerRef.current) {
|
|
167
145
|
setInputDimensions(inputContainerRef.current.getBoundingClientRect());
|
|
@@ -170,17 +148,14 @@ var PeriodPicker = function PeriodPicker(props) {
|
|
|
170
148
|
var onInputFocus = function onInputFocus(e) {
|
|
171
149
|
var _ref = e.target,
|
|
172
150
|
name = _ref.name;
|
|
173
|
-
|
|
174
|
-
if (
|
|
175
|
-
};
|
|
176
|
-
var onInputBlur = function onInputBlur(e) {
|
|
177
|
-
if (props.onBlur) props.onBlur(e);
|
|
151
|
+
setChanging(name);
|
|
152
|
+
if (openOnFocus) openCalendar();
|
|
178
153
|
};
|
|
179
154
|
var onInputChange = function onInputChange(event, value) {
|
|
180
155
|
if (event) {
|
|
181
156
|
var _ref2 = event.target,
|
|
182
157
|
changingAux = _ref2.name;
|
|
183
|
-
if (value && value.replace(/\D/g, '')
|
|
158
|
+
if (value && value.replace(/\D/g, '') === '') {
|
|
184
159
|
if (changingAux === 'valueInitial') {
|
|
185
160
|
setValueInitial(undefined);
|
|
186
161
|
} else {
|
|
@@ -189,28 +164,25 @@ var PeriodPicker = function PeriodPicker(props) {
|
|
|
189
164
|
}
|
|
190
165
|
}
|
|
191
166
|
};
|
|
192
|
-
var setValue = function setValue(
|
|
193
|
-
var _inputInitialRef$curr, _inputFinalRef$curren;
|
|
167
|
+
var setValue = function setValue(e, value) {
|
|
194
168
|
var shouldOpenDropdown = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
195
|
-
var
|
|
169
|
+
var changingAux = e ? e.target.name : '';
|
|
196
170
|
var dateObj = (0, _moment.default)(value, 'DD/MM/YYYY');
|
|
197
|
-
if (
|
|
198
|
-
if (showCalendarValueFinal) (_inputFinalRef$curren = inputFinalRef.current) === null || _inputFinalRef$curren === void 0 ? void 0 : _inputFinalRef$curren.focus();
|
|
199
|
-
if (valueDateName === 'valueInitial') {
|
|
171
|
+
if (changingAux === 'valueInitial') {
|
|
200
172
|
setValueInitial(dateObj);
|
|
201
173
|
} else {
|
|
202
174
|
setValueFinal(dateObj);
|
|
203
175
|
}
|
|
204
|
-
if (
|
|
205
|
-
var _inputFinalRef$
|
|
206
|
-
(
|
|
176
|
+
if (changingAux === 'valueInitial' && !valueFinal && shouldOpenDropdown) {
|
|
177
|
+
var _inputFinalRef$curren;
|
|
178
|
+
if (valueFinal) setChanging(valueFinal);
|
|
179
|
+
setShowCalendar(false);
|
|
180
|
+
(_inputFinalRef$curren = inputFinalRef.current) === null || _inputFinalRef$curren === void 0 ? void 0 : _inputFinalRef$curren.focus();
|
|
207
181
|
setTimeout(function () {
|
|
208
|
-
return
|
|
182
|
+
return setShowCalendar(true);
|
|
209
183
|
}, 100);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
setShowCalendarValueInitial(false);
|
|
213
|
-
setShowCalendarValueFinal(false);
|
|
184
|
+
} else if (shouldCloseOnSelect) {
|
|
185
|
+
setShowCalendar(false);
|
|
214
186
|
}
|
|
215
187
|
};
|
|
216
188
|
var shouldDisable = function shouldDisable() {
|
|
@@ -226,9 +198,10 @@ var PeriodPicker = function PeriodPicker(props) {
|
|
|
226
198
|
name: "calendar"
|
|
227
199
|
}),
|
|
228
200
|
onClick: function onClick() {
|
|
229
|
-
var _inputInitialRef$
|
|
230
|
-
(_inputInitialRef$
|
|
231
|
-
|
|
201
|
+
var _inputInitialRef$curr;
|
|
202
|
+
(_inputInitialRef$curr = inputInitialRef.current) === null || _inputInitialRef$curr === void 0 ? void 0 : _inputInitialRef$curr.focus();
|
|
203
|
+
setChanging('valueInitial');
|
|
204
|
+
openCalendar();
|
|
232
205
|
},
|
|
233
206
|
customClass: "calendar-button",
|
|
234
207
|
tabIndex: -1,
|
|
@@ -245,8 +218,7 @@ var PeriodPicker = function PeriodPicker(props) {
|
|
|
245
218
|
});
|
|
246
219
|
};
|
|
247
220
|
var openPeriodSelecion = function openPeriodSelecion() {
|
|
248
|
-
|
|
249
|
-
setShowCalendarValueInitial(false);
|
|
221
|
+
setShowCalendar(false);
|
|
250
222
|
setShowPeriodSelection(true);
|
|
251
223
|
if (inputContainerRef.current) {
|
|
252
224
|
setInputDimensions(inputContainerRef.current.getBoundingClientRect());
|
|
@@ -259,11 +231,6 @@ var PeriodPicker = function PeriodPicker(props) {
|
|
|
259
231
|
icon: /*#__PURE__*/_react.default.createElement(_icons.default, {
|
|
260
232
|
name: "more1"
|
|
261
233
|
}),
|
|
262
|
-
onBlur: function onBlur() {
|
|
263
|
-
return setTimeout(function () {
|
|
264
|
-
return setShowPeriodSelection(false);
|
|
265
|
-
}, 100);
|
|
266
|
-
},
|
|
267
234
|
onClick: function onClick() {
|
|
268
235
|
return openPeriodSelecion();
|
|
269
236
|
},
|
|
@@ -275,13 +242,13 @@ var PeriodPicker = function PeriodPicker(props) {
|
|
|
275
242
|
disabled: shouldDisable()
|
|
276
243
|
});
|
|
277
244
|
};
|
|
278
|
-
var getCalendar = function getCalendar(value, calendarColorStyleCalendar,
|
|
245
|
+
var getCalendar = function getCalendar(value, calendarColorStyleCalendar, changingAux) {
|
|
279
246
|
return /*#__PURE__*/_react.default.createElement(_calendar.default, {
|
|
280
247
|
currentDate: value !== undefined ? (0, _moment.default)(value) : (0, _moment.default)(),
|
|
281
248
|
onDateChange: function onDateChange(date) {
|
|
282
249
|
return setValue({
|
|
283
250
|
target: {
|
|
284
|
-
name:
|
|
251
|
+
name: changingAux
|
|
285
252
|
}
|
|
286
253
|
}, date);
|
|
287
254
|
},
|
|
@@ -290,10 +257,12 @@ var PeriodPicker = function PeriodPicker(props) {
|
|
|
290
257
|
};
|
|
291
258
|
var setPeriodDates = function setPeriodDates(selected, dates) {
|
|
292
259
|
if (selected === 'custom') {
|
|
293
|
-
var _inputInitialRef$
|
|
294
|
-
(_inputInitialRef$
|
|
260
|
+
var _inputInitialRef$curr2;
|
|
261
|
+
(_inputInitialRef$curr2 = inputInitialRef.current) === null || _inputInitialRef$curr2 === void 0 ? void 0 : _inputInitialRef$curr2.focus();
|
|
295
262
|
setValuePeriodSelection(selected);
|
|
263
|
+
setChanging('valueInitial');
|
|
296
264
|
setShowPeriodSelection(false);
|
|
265
|
+
setShowCalendar(true);
|
|
297
266
|
return;
|
|
298
267
|
}
|
|
299
268
|
setValuePeriodSelection(selected);
|
|
@@ -305,35 +274,16 @@ var PeriodPicker = function PeriodPicker(props) {
|
|
|
305
274
|
setShowPeriodSelection(false);
|
|
306
275
|
}
|
|
307
276
|
};
|
|
308
|
-
var
|
|
309
|
-
|
|
310
|
-
if (showCalendarInDialog) {
|
|
311
|
-
return /*#__PURE__*/_react.default.createElement(_Dialog.default, {
|
|
312
|
-
dialogSize: dialogSize,
|
|
313
|
-
handlerClose: function handlerClose() {
|
|
314
|
-
return setShowCalendarValueInitial(false);
|
|
315
|
-
}
|
|
316
|
-
}, getCalendar(valueInitial, calendarColorStyle, 'valueInitial'));
|
|
317
|
-
}
|
|
318
|
-
return /*#__PURE__*/_react.default.createElement(_Dropdown.default, {
|
|
319
|
-
targetElement: inputContainerRef.current,
|
|
320
|
-
topPosition: inputDimensions ? inputDimensions.top + inputDimensions.height + 5 : '',
|
|
321
|
-
leftPosition: inputDimensions ? inputDimensions.left : '',
|
|
322
|
-
width: inputDimensions ? inputDimensions.width : '',
|
|
323
|
-
dropdownRef: function dropdownRef(el) {
|
|
324
|
-
dropdownCalendarContainer.current = el;
|
|
325
|
-
}
|
|
326
|
-
}, getCalendar(valueInitial, calendarColorStyle, 'valueInitial'));
|
|
327
|
-
};
|
|
328
|
-
var getWrapperComponentCalendarValueFinal = function getWrapperComponentCalendarValueFinal() {
|
|
277
|
+
var getWrapperComponentCalendar = function getWrapperComponentCalendar() {
|
|
278
|
+
var value = changing === 'valueInitial' ? valueInitial : valueFinal;
|
|
329
279
|
if (onDenied && onDenied.readOnly) return null;
|
|
330
280
|
if (showCalendarInDialog) {
|
|
331
281
|
return /*#__PURE__*/_react.default.createElement(_Dialog.default, {
|
|
332
282
|
dialogSize: dialogSize,
|
|
333
283
|
handlerClose: function handlerClose() {
|
|
334
|
-
return
|
|
284
|
+
return setShowCalendar(false);
|
|
335
285
|
}
|
|
336
|
-
}, getCalendar(
|
|
286
|
+
}, getCalendar(value, calendarColorStyle, changing));
|
|
337
287
|
}
|
|
338
288
|
return /*#__PURE__*/_react.default.createElement(_Dropdown.default, {
|
|
339
289
|
targetElement: inputContainerRef.current,
|
|
@@ -343,7 +293,7 @@ var PeriodPicker = function PeriodPicker(props) {
|
|
|
343
293
|
dropdownRef: function dropdownRef(el) {
|
|
344
294
|
dropdownCalendarContainer.current = el;
|
|
345
295
|
}
|
|
346
|
-
}, getCalendar(
|
|
296
|
+
}, getCalendar(value, calendarColorStyle, changing));
|
|
347
297
|
};
|
|
348
298
|
var getWrapperComponentPeriodSelection = function getWrapperComponentPeriodSelection() {
|
|
349
299
|
if (showCalendarInDialog) {
|
|
@@ -366,7 +316,6 @@ var PeriodPicker = function PeriodPicker(props) {
|
|
|
366
316
|
};
|
|
367
317
|
if (onDenied && onDenied.unvisible) return null;
|
|
368
318
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
369
|
-
ref: wrapperBaseInputPeriodRef,
|
|
370
319
|
className: "input-base-component"
|
|
371
320
|
}, props.label && /*#__PURE__*/_react.default.createElement("div", {
|
|
372
321
|
className: "labelcontainer"
|
|
@@ -386,16 +335,13 @@ var PeriodPicker = function PeriodPicker(props) {
|
|
|
386
335
|
value: !valueInitial ? '' : (0, _moment.default)(valueInitial).format('DD/MM/YYYY'),
|
|
387
336
|
mask: "00/00/0000",
|
|
388
337
|
onComplete: function onComplete(e, date) {
|
|
389
|
-
setValue(e, date,
|
|
338
|
+
setValue(e, date, false);
|
|
390
339
|
},
|
|
391
340
|
onFocus: onInputFocus,
|
|
392
|
-
onBlur: function onBlur(e) {
|
|
393
|
-
return onInputBlur(e);
|
|
394
|
-
},
|
|
395
341
|
isDateField: true,
|
|
396
342
|
onChange: onInputChange,
|
|
397
343
|
inputRef: function inputRef(el) {
|
|
398
|
-
inputInitialRef.current = el;
|
|
344
|
+
if (el) inputInitialRef.current = el;
|
|
399
345
|
},
|
|
400
346
|
handlerSetOnDenied: function handlerSetOnDenied(denied) {
|
|
401
347
|
setOnDenied(denied);
|
|
@@ -411,12 +357,9 @@ var PeriodPicker = function PeriodPicker(props) {
|
|
|
411
357
|
mask: "00/00/0000",
|
|
412
358
|
isDateField: true,
|
|
413
359
|
onComplete: function onComplete(e, date) {
|
|
414
|
-
setValue(e, date,
|
|
360
|
+
setValue(e, date, false);
|
|
415
361
|
},
|
|
416
362
|
onFocus: onInputFocus,
|
|
417
|
-
onBlur: function onBlur(e) {
|
|
418
|
-
return onInputBlur(e);
|
|
419
|
-
},
|
|
420
363
|
onChange: onInputChange,
|
|
421
364
|
inputRef: function inputRef(el) {
|
|
422
365
|
inputFinalRef.current = el;
|
|
@@ -425,11 +368,7 @@ var PeriodPicker = function PeriodPicker(props) {
|
|
|
425
368
|
return setOnDenied(denied);
|
|
426
369
|
},
|
|
427
370
|
required: props.required
|
|
428
|
-
}), getButtonOpen(), getButtonSelectPeriod()),
|
|
429
|
-
visible: !!hint,
|
|
430
|
-
customClass: "hint",
|
|
431
|
-
description: hint
|
|
432
|
-
}), props.errorMessages && helperBase.getErrorMessages(props.errorMessages));
|
|
371
|
+
}), getButtonOpen(), getButtonSelectPeriod()), showCalendar && getWrapperComponentCalendar(), showPeriodSelection && getWrapperComponentPeriodSelection(), props.errorMessages && helperBase.getErrorMessages(props.errorMessages));
|
|
433
372
|
};
|
|
434
373
|
var _default = PeriodPicker;
|
|
435
374
|
exports.default = _default;
|
|
@@ -7,12 +7,6 @@ import { CustomInputEvent } from '../base/types.js';
|
|
|
7
7
|
import '../../@types/Align.js';
|
|
8
8
|
|
|
9
9
|
type DateTypes = 'today' | 'week' | 'lastweek' | 'last15' | 'month' | 'lastmonth';
|
|
10
|
-
interface ChangeInputPeriodEvent {
|
|
11
|
-
target: {
|
|
12
|
-
value?: string;
|
|
13
|
-
name?: string;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
10
|
interface IPeriodOptions {
|
|
17
11
|
id: DateTypes | 'custom';
|
|
18
12
|
label?: string;
|
|
@@ -56,13 +50,10 @@ interface IPeriodPickerProps {
|
|
|
56
50
|
permissionAttr?: PermissionAttr;
|
|
57
51
|
errorMessages?: string[];
|
|
58
52
|
name?: string;
|
|
59
|
-
hint?: string;
|
|
60
|
-
onBlur?: (e: CustomInputEvent) => void;
|
|
61
|
-
onFocus?: (e: CustomInputEvent) => void;
|
|
62
53
|
}
|
|
63
54
|
interface IPeriodListProps {
|
|
64
55
|
handleOnSelect: (value: DateTypes | 'custom', date: Moment[] | null) => void;
|
|
65
56
|
selected?: string;
|
|
66
57
|
}
|
|
67
58
|
|
|
68
|
-
export {
|
|
59
|
+
export { DateTypes, IDialogProps, IPeriodDropdownProps, IPeriodListProps, IPeriodOptions, IPeriodPickerProps };
|
package/lib/uitour/index.js
CHANGED
|
@@ -121,6 +121,10 @@ var UiTour = function UiTour(props) {
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
};
|
|
124
|
+
var showStepTour = function showStepTour(step) {
|
|
125
|
+
setShowTour(visible);
|
|
126
|
+
setCurrentStep(step);
|
|
127
|
+
};
|
|
124
128
|
(0, _react.useEffect)(function () {
|
|
125
129
|
if (currentStep) {
|
|
126
130
|
var target = document.getElementById(currentStep.targetId);
|
|
@@ -155,14 +159,33 @@ var UiTour = function UiTour(props) {
|
|
|
155
159
|
}
|
|
156
160
|
}, [currentStep, stepRef.current]);
|
|
157
161
|
(0, _react.useEffect)(function () {
|
|
162
|
+
var mutationObserver = null;
|
|
158
163
|
if (data && visible) {
|
|
159
164
|
var initialNumber = 1;
|
|
160
165
|
var initialStep = _objectSpread(_objectSpread({}, data[0]), {}, {
|
|
161
166
|
number: initialNumber
|
|
162
167
|
});
|
|
163
|
-
|
|
164
|
-
|
|
168
|
+
var target = document.getElementById(initialStep.targetId);
|
|
169
|
+
if (target) {
|
|
170
|
+
showStepTour(initialStep);
|
|
171
|
+
} else {
|
|
172
|
+
mutationObserver = new MutationObserver(function () {
|
|
173
|
+
var targetObserved = document.getElementById(initialStep.targetId);
|
|
174
|
+
if (targetObserved) {
|
|
175
|
+
showStepTour(initialStep);
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
mutationObserver.observe(document, {
|
|
179
|
+
subtree: true,
|
|
180
|
+
childList: true
|
|
181
|
+
});
|
|
182
|
+
}
|
|
165
183
|
}
|
|
184
|
+
return function () {
|
|
185
|
+
var _mutationObserver;
|
|
186
|
+
(_mutationObserver = mutationObserver) === null || _mutationObserver === void 0 ? void 0 : _mutationObserver.disconnect();
|
|
187
|
+
mutationObserver = null;
|
|
188
|
+
};
|
|
166
189
|
}, [visible, data]);
|
|
167
190
|
if (!showTour) return null;
|
|
168
191
|
return /*#__PURE__*/_react.default.createElement("div", {
|