linear-react-components-ui 1.1.22-beta.4 → 1.1.22-beta.6
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/file.scss +10 -7
- package/lib/assets/styles/select.scss +15 -19
- package/lib/assets/styles/tabs.scss +3 -16
- package/lib/assets/styles/wizard.scss +2 -2
- package/lib/calendar/base/index.js +1 -1
- package/lib/dialog/base/index.js +1 -1
- package/lib/dialog/form/index.js +2 -3
- package/lib/dialog/types.d.ts +0 -1
- package/lib/drawer/Drawer.d.ts +1 -1
- package/lib/drawer/Drawer.js +2 -6
- package/lib/drawer/types.d.ts +0 -1
- package/lib/form/Field.js +8 -31
- package/lib/form/FieldArray.js +2 -11
- package/lib/form/FieldNumber.js +1 -10
- package/lib/form/FieldPeriod.js +1 -15
- package/lib/form/index.d.ts +1 -1
- package/lib/form/index.js +5 -30
- package/lib/form/types.d.ts +1 -13
- package/lib/form/withFieldHOC.js +2 -4
- package/lib/inputs/date/helpers.d.ts +1 -31
- package/lib/inputs/date/helpers.js +2 -32
- package/lib/inputs/date/index.js +20 -28
- package/lib/inputs/date/types.d.ts +0 -1
- package/lib/inputs/mask/BaseMask.d.ts +1 -1
- package/lib/inputs/mask/BaseMask.js +4 -6
- package/lib/inputs/mask/helpers.d.ts +53 -6
- package/lib/inputs/mask/helpers.js +35 -15
- package/lib/inputs/mask/types.d.ts +0 -1
- package/lib/inputs/select/multiple/Selecteds.d.ts +1 -1
- package/lib/inputs/select/multiple/Selecteds.js +1 -3
- package/lib/inputs/select/multiple/index.js +2 -3
- package/lib/inputs/select/types.d.ts +0 -1
- package/lib/panel/Content.js +7 -10
- package/lib/radio/index.d.ts +1 -4
- package/lib/radio/index.js +0 -1
- package/lib/tabs/Menu.d.ts +1 -1
- package/lib/tabs/Menu.js +2 -4
- package/lib/tabs/MenuTabs.js +5 -16
- package/lib/tabs/context.d.ts +1 -1
- package/lib/tabs/context.js +1 -3
- package/lib/tabs/index.d.ts +1 -1
- package/lib/tabs/index.js +6 -13
- package/lib/tabs/types.d.ts +0 -6
- package/package.json +1 -1
package/lib/form/withFieldHOC.js
CHANGED
|
@@ -51,8 +51,7 @@ const withFieldHOC = WrappedComponent => {
|
|
|
51
51
|
externalFieldErrors,
|
|
52
52
|
handlerStoreValidators,
|
|
53
53
|
handlerRemoveValidators,
|
|
54
|
-
skeletonize
|
|
55
|
-
handleValidationErrorsOnTab
|
|
54
|
+
skeletonize
|
|
56
55
|
} = _ref;
|
|
57
56
|
return /*#__PURE__*/_react.default.createElement(EnhancedComponent, _extends({}, props, {
|
|
58
57
|
skeletonize: skeletonize,
|
|
@@ -63,8 +62,7 @@ const withFieldHOC = WrappedComponent => {
|
|
|
63
62
|
data: data,
|
|
64
63
|
fieldErrors: fieldErrors,
|
|
65
64
|
externalFieldErrors: externalFieldErrors,
|
|
66
|
-
forwardedRef: ref
|
|
67
|
-
handleValidationErrorsOnTab: handleValidationErrorsOnTab
|
|
65
|
+
forwardedRef: ref
|
|
68
66
|
}));
|
|
69
67
|
});
|
|
70
68
|
}
|
|
@@ -1,37 +1,7 @@
|
|
|
1
|
-
import * as imask from 'imask';
|
|
2
1
|
import moment from 'moment';
|
|
3
2
|
|
|
4
3
|
declare const PT_BR_FORMAT = "DD/MM/YYYY";
|
|
5
|
-
declare const PT_BR_FORMAT_DATETIME = "DD/MM/YYYY HH:mm";
|
|
6
4
|
declare const EN_US_FORMAT = "YYYY-MM-DD";
|
|
7
|
-
declare const EN_US_FORMAT_DATETIME = "YYYY-MM-DD HH.mm";
|
|
8
5
|
declare const getMomentValue: (value: string) => moment.Moment;
|
|
9
|
-
declare const blocksDateTimeFormat: {
|
|
10
|
-
DD: {
|
|
11
|
-
mask: typeof imask.MaskedRange;
|
|
12
|
-
from: number;
|
|
13
|
-
to: number;
|
|
14
|
-
};
|
|
15
|
-
MM: {
|
|
16
|
-
mask: typeof imask.MaskedRange;
|
|
17
|
-
from: number;
|
|
18
|
-
to: number;
|
|
19
|
-
};
|
|
20
|
-
YYYY: {
|
|
21
|
-
mask: typeof imask.MaskedRange;
|
|
22
|
-
from: number;
|
|
23
|
-
to: number;
|
|
24
|
-
};
|
|
25
|
-
HH: {
|
|
26
|
-
mask: typeof imask.MaskedRange;
|
|
27
|
-
from: number;
|
|
28
|
-
to: number;
|
|
29
|
-
};
|
|
30
|
-
mm: {
|
|
31
|
-
mask: typeof imask.MaskedRange;
|
|
32
|
-
from: number;
|
|
33
|
-
to: number;
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
6
|
|
|
37
|
-
export { EN_US_FORMAT,
|
|
7
|
+
export { EN_US_FORMAT, PT_BR_FORMAT, getMomentValue };
|
|
@@ -3,14 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getMomentValue = exports.
|
|
6
|
+
exports.getMomentValue = exports.PT_BR_FORMAT = exports.EN_US_FORMAT = void 0;
|
|
7
7
|
var _moment = _interopRequireDefault(require("moment"));
|
|
8
|
-
var _reactImask = require("react-imask");
|
|
9
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
9
|
const PT_BR_FORMAT = exports.PT_BR_FORMAT = 'DD/MM/YYYY';
|
|
11
|
-
const PT_BR_FORMAT_DATETIME = exports.PT_BR_FORMAT_DATETIME = 'DD/MM/YYYY HH:mm';
|
|
12
10
|
const EN_US_FORMAT = exports.EN_US_FORMAT = 'YYYY-MM-DD';
|
|
13
|
-
const EN_US_FORMAT_DATETIME = exports.EN_US_FORMAT_DATETIME = 'YYYY-MM-DD HH.mm';
|
|
14
11
|
const getMomentValue = value => {
|
|
15
12
|
let newValue = value;
|
|
16
13
|
if ((0, _moment.default)(newValue, PT_BR_FORMAT, true).isValid()) {
|
|
@@ -18,31 +15,4 @@ const getMomentValue = value => {
|
|
|
18
15
|
}
|
|
19
16
|
return typeof newValue === 'string' ? (0, _moment.default)(newValue, EN_US_FORMAT) : newValue;
|
|
20
17
|
};
|
|
21
|
-
exports.getMomentValue = getMomentValue;
|
|
22
|
-
const blocksDateTimeFormat = exports.blocksDateTimeFormat = {
|
|
23
|
-
DD: {
|
|
24
|
-
mask: _reactImask.IMask.MaskedRange,
|
|
25
|
-
from: 1,
|
|
26
|
-
to: 31
|
|
27
|
-
},
|
|
28
|
-
MM: {
|
|
29
|
-
mask: _reactImask.IMask.MaskedRange,
|
|
30
|
-
from: 1,
|
|
31
|
-
to: 12
|
|
32
|
-
},
|
|
33
|
-
YYYY: {
|
|
34
|
-
mask: _reactImask.IMask.MaskedRange,
|
|
35
|
-
from: 1900,
|
|
36
|
-
to: 2999
|
|
37
|
-
},
|
|
38
|
-
HH: {
|
|
39
|
-
mask: _reactImask.IMask.MaskedRange,
|
|
40
|
-
from: 0,
|
|
41
|
-
to: 23
|
|
42
|
-
},
|
|
43
|
-
mm: {
|
|
44
|
-
mask: _reactImask.IMask.MaskedRange,
|
|
45
|
-
from: 0,
|
|
46
|
-
to: 59
|
|
47
|
-
}
|
|
48
|
-
};
|
|
18
|
+
exports.getMomentValue = getMomentValue;
|
package/lib/inputs/date/index.js
CHANGED
|
@@ -6,14 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _moment = _interopRequireDefault(require("moment"));
|
|
9
|
-
var _gridlayout = _interopRequireDefault(require("../../gridlayout"));
|
|
10
|
-
var _buttons = _interopRequireDefault(require("../../buttons"));
|
|
11
|
-
var _calendar = _interopRequireDefault(require("../../calendar"));
|
|
12
9
|
var _Dialog = _interopRequireDefault(require("./Dialog"));
|
|
13
10
|
var _Dropdown = _interopRequireDefault(require("./Dropdown"));
|
|
11
|
+
var _buttons = _interopRequireDefault(require("../../buttons"));
|
|
12
|
+
var _gridlayout = _interopRequireDefault(require("../../gridlayout"));
|
|
13
|
+
var _calendar = _interopRequireDefault(require("../../calendar"));
|
|
14
|
+
var _BaseMask = _interopRequireDefault(require("../mask/BaseMask"));
|
|
14
15
|
var _helpers = require("./helpers");
|
|
15
16
|
require("../../assets/styles/datepicker.scss");
|
|
16
|
-
var _BaseMask = _interopRequireDefault(require("../mask/BaseMask"));
|
|
17
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
18
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
19
19
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -34,16 +34,11 @@ const DatePicker = props => {
|
|
|
34
34
|
height: '384px'
|
|
35
35
|
},
|
|
36
36
|
gridLayout,
|
|
37
|
-
shouldCloseOnEsc = true
|
|
38
|
-
isDateTimeField = false
|
|
37
|
+
shouldCloseOnEsc = true
|
|
39
38
|
} = props;
|
|
40
|
-
const maskFormat = !isDateTimeField ? '00/00/0000' : Date;
|
|
41
|
-
const patternFormat = !isDateTimeField ? undefined : 'DD/MM/YYYY HH:mm';
|
|
42
|
-
const brFormatter = !isDateTimeField ? _helpers.PT_BR_FORMAT : _helpers.PT_BR_FORMAT_DATETIME;
|
|
43
|
-
const usFormatter = !isDateTimeField ? _helpers.EN_US_FORMAT : _helpers.EN_US_FORMAT_DATETIME;
|
|
44
39
|
const [valueState, setValueState] = (0, _react.useState)(value ? (0, _helpers.getMomentValue)(value) : undefined);
|
|
45
40
|
const [showCalendar, setShowCalendar] = (0, _react.useState)(false);
|
|
46
|
-
const [valueFromProps, setValueFromProps] = (0, _react.useState)(
|
|
41
|
+
const [valueFromProps, setValueFromProps] = (0, _react.useState)(value);
|
|
47
42
|
const [inputDimensions, setInputDimensions] = (0, _react.useState)();
|
|
48
43
|
const [calendarOnDialog, setCalendarOnDialog] = (0, _react.useState)(false);
|
|
49
44
|
const [onDenied, setOnDenied] = (0, _react.useState)({
|
|
@@ -129,11 +124,11 @@ const DatePicker = props => {
|
|
|
129
124
|
};
|
|
130
125
|
const isValidDate = date => {
|
|
131
126
|
if (typeof date === 'object' && !(date instanceof Date)) {
|
|
132
|
-
const initialValid = (0, _moment.default)(date.initial,
|
|
133
|
-
const finalValid = (0, _moment.default)(date.final,
|
|
127
|
+
const initialValid = (0, _moment.default)(date.initial, _helpers.PT_BR_FORMAT, true).isValid();
|
|
128
|
+
const finalValid = (0, _moment.default)(date.final, _helpers.PT_BR_FORMAT, true).isValid();
|
|
134
129
|
return initialValid && finalValid;
|
|
135
130
|
}
|
|
136
|
-
return (0, _moment.default)(date,
|
|
131
|
+
return (0, _moment.default)(date, _helpers.PT_BR_FORMAT, true).isValid();
|
|
137
132
|
};
|
|
138
133
|
const onInputChange = function (event) {
|
|
139
134
|
let valueInput = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
@@ -141,7 +136,7 @@ const DatePicker = props => {
|
|
|
141
136
|
const date = event.target.value ?? '';
|
|
142
137
|
if (props.onChange) {
|
|
143
138
|
if (isValidDate(date)) {
|
|
144
|
-
const newValue = (0, _moment.default)(date,
|
|
139
|
+
const newValue = (0, _moment.default)(date, _helpers.PT_BR_FORMAT).format(_helpers.EN_US_FORMAT);
|
|
145
140
|
const obj = {
|
|
146
141
|
target: {
|
|
147
142
|
value: newValue,
|
|
@@ -168,12 +163,12 @@ const DatePicker = props => {
|
|
|
168
163
|
if (props.onComplete) props.onComplete(e, valueParam);
|
|
169
164
|
if (props.onChange) onInputChange({
|
|
170
165
|
target: {
|
|
171
|
-
value: valueParam
|
|
166
|
+
value: valueParam,
|
|
172
167
|
name
|
|
173
168
|
}
|
|
174
169
|
}, valueParam);
|
|
175
170
|
if (shouldCloseOnSelect) setShowCalendar(false);
|
|
176
|
-
setValueState((0, _moment.default)(valueParam,
|
|
171
|
+
setValueState((0, _moment.default)(valueParam, _helpers.PT_BR_FORMAT));
|
|
177
172
|
};
|
|
178
173
|
const shouldDisable = () => props.disabled || onDenied && (onDenied.disabled || onDenied.hideContent);
|
|
179
174
|
const getButtonOpen = () => {
|
|
@@ -199,7 +194,7 @@ const DatePicker = props => {
|
|
|
199
194
|
colorStyle: calendarColorStyle,
|
|
200
195
|
currentDate: valueCalendar !== undefined ? valueCalendar : (0, _moment.default)(),
|
|
201
196
|
onDateChange: date => {
|
|
202
|
-
setValue(date.format(
|
|
197
|
+
setValue(date.format(_helpers.PT_BR_FORMAT), undefined);
|
|
203
198
|
if (showCalendarInDialog) setCalendarOnDialog(false);
|
|
204
199
|
},
|
|
205
200
|
currentDateButton: buttonElement => currentDateButtonRef.current = buttonElement,
|
|
@@ -225,8 +220,8 @@ const DatePicker = props => {
|
|
|
225
220
|
}, getCalendar(valueState, props?.calendarColorStyle));
|
|
226
221
|
};
|
|
227
222
|
(0, _react.useEffect)(() => {
|
|
228
|
-
if (value && (0, _moment.default)(value,
|
|
229
|
-
setValueState((0, _moment.default)(value,
|
|
223
|
+
if (value && (0, _moment.default)(value, _helpers.EN_US_FORMAT).format() !== 'Invalid date' && (0, _moment.default)(valueFromProps, _helpers.EN_US_FORMAT).format() !== (0, _moment.default)(value, _helpers.EN_US_FORMAT).format()) {
|
|
224
|
+
setValueState((0, _moment.default)(value, _helpers.EN_US_FORMAT));
|
|
230
225
|
setValueFromProps(value);
|
|
231
226
|
} else if (!value && value !== valueFromProps) {
|
|
232
227
|
setValueState(undefined);
|
|
@@ -258,14 +253,11 @@ const DatePicker = props => {
|
|
|
258
253
|
className: "datepicker-container"
|
|
259
254
|
}, /*#__PURE__*/_react.default.createElement(_BaseMask.default, _extends({}, props, {
|
|
260
255
|
gridLayout: undefined,
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
onComplete: e => {
|
|
267
|
-
if (e) {
|
|
268
|
-
setValue(e.target?.maskedValue, e);
|
|
256
|
+
value: !valueState ? ' ' : valueState.format(_helpers.PT_BR_FORMAT),
|
|
257
|
+
mask: "00/00/0000",
|
|
258
|
+
onComplete: (e, date) => {
|
|
259
|
+
if (date) {
|
|
260
|
+
setValue(date, e);
|
|
269
261
|
}
|
|
270
262
|
},
|
|
271
263
|
onBlur: onInputBlur,
|
|
@@ -7,6 +7,6 @@ import '../../@types/Period.js';
|
|
|
7
7
|
import '../../internals/types.js';
|
|
8
8
|
import '../../@types/Position.js';
|
|
9
9
|
|
|
10
|
-
declare const BaseMask: ({ value: valueProp, defaultValue, inputRef, onChange, onComplete, permissionAttr, mask,
|
|
10
|
+
declare const BaseMask: ({ value: valueProp, defaultValue, inputRef, onChange, onComplete, permissionAttr, mask, ...rest }: IBaseMaskProps) => JSX.Element;
|
|
11
11
|
|
|
12
12
|
export { BaseMask as default };
|
|
@@ -10,7 +10,7 @@ var _format_number = require("../number/format_number");
|
|
|
10
10
|
var _reactImask = require("react-imask");
|
|
11
11
|
var _permissionValidations = require("../../permissionValidations");
|
|
12
12
|
var _helpers = require("./helpers");
|
|
13
|
-
const _excluded = ["value", "defaultValue", "inputRef", "onChange", "onComplete", "permissionAttr", "mask"
|
|
13
|
+
const _excluded = ["value", "defaultValue", "inputRef", "onChange", "onComplete", "permissionAttr", "mask"];
|
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
15
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
16
16
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -102,8 +102,7 @@ const BaseMask = _ref => {
|
|
|
102
102
|
onChange,
|
|
103
103
|
onComplete,
|
|
104
104
|
permissionAttr,
|
|
105
|
-
mask
|
|
106
|
-
isDateTimeField
|
|
105
|
+
mask
|
|
107
106
|
} = _ref,
|
|
108
107
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
109
108
|
const onDenied = (0, _permissionValidations.actionsOnPermissionDenied)(options, permissionAttr);
|
|
@@ -113,15 +112,14 @@ const BaseMask = _ref => {
|
|
|
113
112
|
} = onDenied;
|
|
114
113
|
const disableCallbacks = disabled || readOnly;
|
|
115
114
|
const maskOptions = (0, _helpers.getMaskOptions)(_objectSpread({
|
|
116
|
-
mask
|
|
117
|
-
isDateTimeField
|
|
115
|
+
mask
|
|
118
116
|
}, rest));
|
|
119
117
|
const {
|
|
120
118
|
ref,
|
|
121
119
|
setValue,
|
|
122
120
|
setTypedValue,
|
|
123
121
|
maskRef
|
|
124
|
-
} = (0, _reactImask.useIMask)(
|
|
122
|
+
} = (0, _reactImask.useIMask)(maskOptions, {
|
|
125
123
|
defaultValue: defaultValue,
|
|
126
124
|
onAccept: (_, r) => {
|
|
127
125
|
if (!disableCallbacks && onChange) {
|
|
@@ -1,14 +1,61 @@
|
|
|
1
|
+
import { TextAlign } from '../../@types/Align.js';
|
|
2
|
+
import { OnDenied, PermissionAttr } from '../../@types/PermissionAttr.js';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { CustomInputEvent } from '../base/types.js';
|
|
1
5
|
import { IBaseMaskProps } from './types.js';
|
|
2
|
-
import { ReactMaskOpts } from 'react-imask';
|
|
3
|
-
import 'react';
|
|
4
|
-
import '../../@types/Align.js';
|
|
5
|
-
import '../../@types/PermissionAttr.js';
|
|
6
|
-
import '../base/types.js';
|
|
7
6
|
import '../../@types/Period.js';
|
|
8
7
|
import '../../internals/types.js';
|
|
9
8
|
import '../../@types/Position.js';
|
|
10
9
|
|
|
11
|
-
declare const getMaskOptions: ({ isDateField, placeholderChar, min, max, lazy, pattern, radix, thousandsSeparator, mapToRadix, scale, normalizeZeros, padFractionalZeros, rightElements, leftElements,
|
|
10
|
+
declare const getMaskOptions: ({ isDateField, placeholderChar, min, max, lazy, pattern, radix, thousandsSeparator, mapToRadix, scale, normalizeZeros, padFractionalZeros, rightElements, leftElements, ...rest }: IBaseMaskProps) => {
|
|
11
|
+
value?: string | number | undefined;
|
|
12
|
+
onBlur?: ((e: CustomInputEvent) => void) | undefined;
|
|
13
|
+
onKeyDown?: ((e: CustomInputEvent | React.KeyboardEvent<Element>) => void) | undefined;
|
|
14
|
+
defaultValue?: string | undefined;
|
|
15
|
+
isNumeric?: boolean | undefined;
|
|
16
|
+
blocks?: any;
|
|
17
|
+
handlerSetOnDenied?: ((onDeniedValue: OnDenied) => void) | undefined;
|
|
18
|
+
onChange?: ((e: CustomInputEvent, maskValue?: string | undefined, date?: string | undefined) => void) | undefined;
|
|
19
|
+
onComplete?: ((e: CustomInputEvent, maskValue?: string | undefined, date?: string | undefined) => void) | undefined;
|
|
20
|
+
inputRef?: React.MutableRefObject<HTMLInputElement | HTMLTextAreaElement | null> | ((ref: HTMLInputElement | HTMLTextAreaElement | null) => void) | undefined;
|
|
21
|
+
permissionAttr?: PermissionAttr | undefined;
|
|
22
|
+
errorMessages?: string[] | undefined;
|
|
23
|
+
rounded?: boolean | undefined;
|
|
24
|
+
textAlign?: TextAlign | undefined;
|
|
25
|
+
customClassForInputContent?: string | undefined;
|
|
26
|
+
label?: string | undefined;
|
|
27
|
+
name?: string | undefined;
|
|
28
|
+
customClassForLabel?: string | undefined;
|
|
29
|
+
customClass?: string | undefined;
|
|
30
|
+
gridLayout?: string | undefined;
|
|
31
|
+
placeHolder?: string | undefined;
|
|
32
|
+
readOnly?: boolean | undefined;
|
|
33
|
+
labelUppercase?: boolean | undefined;
|
|
34
|
+
disabled?: boolean | undefined;
|
|
35
|
+
unmask?: boolean | undefined;
|
|
36
|
+
onFocus?: ((e: CustomInputEvent) => void) | undefined;
|
|
37
|
+
required?: boolean | undefined;
|
|
38
|
+
returnFormattedValueOnBlur?: boolean | undefined;
|
|
39
|
+
returnFormattedValueOnKeyDown?: boolean | undefined;
|
|
40
|
+
autoCompleteMask?: "left" | "right" | undefined;
|
|
41
|
+
definitions?: any;
|
|
42
|
+
mask?: any;
|
|
43
|
+
hint?: string | string[] | undefined;
|
|
44
|
+
hintPosition?: "below" | "onLabelRight" | undefined;
|
|
45
|
+
themePopover?: "dark" | "light" | undefined;
|
|
46
|
+
popoverAlign?: "left" | "right" | undefined;
|
|
47
|
+
placeholderChar: string;
|
|
48
|
+
min: any;
|
|
49
|
+
max: any;
|
|
50
|
+
lazy: boolean;
|
|
51
|
+
pattern: string;
|
|
52
|
+
radix: string;
|
|
53
|
+
thousandsSeparator: string;
|
|
54
|
+
mapToRadix: string[];
|
|
55
|
+
scale: number;
|
|
56
|
+
normalizeZeros: boolean;
|
|
57
|
+
padFractionalZeros: boolean;
|
|
58
|
+
};
|
|
12
59
|
declare function CPFValidation(cpf?: string, returnMessage?: (msg: string) => void): void | "CPF inválido";
|
|
13
60
|
declare function CNPJValidation(cnpj?: string, returnMessage?: (msg: string) => void): void | "CNPJ inválido";
|
|
14
61
|
|
|
@@ -7,10 +7,8 @@ exports.CNPJValidation = CNPJValidation;
|
|
|
7
7
|
exports.CPFValidation = CPFValidation;
|
|
8
8
|
exports.getMaskOptions = void 0;
|
|
9
9
|
var _lodash = require("lodash");
|
|
10
|
-
|
|
11
|
-
const _excluded = ["isDateField", "placeholderChar", "min", "max", "lazy", "pattern", "radix", "thousandsSeparator", "mapToRadix", "scale", "normalizeZeros", "padFractionalZeros", "rightElements", "leftElements", "isDateTimeField"];
|
|
10
|
+
const _excluded = ["isDateField", "placeholderChar", "min", "max", "lazy", "pattern", "radix", "thousandsSeparator", "mapToRadix", "scale", "normalizeZeros", "padFractionalZeros", "rightElements", "leftElements"];
|
|
12
11
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
13
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
12
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
13
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16
14
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
@@ -34,11 +32,42 @@ const getMaskOptions = _ref => {
|
|
|
34
32
|
normalizeZeros = true,
|
|
35
33
|
padFractionalZeros = true,
|
|
36
34
|
rightElements,
|
|
37
|
-
leftElements
|
|
38
|
-
isDateTimeField
|
|
35
|
+
leftElements
|
|
39
36
|
} = _ref,
|
|
40
37
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
41
|
-
|
|
38
|
+
// TODO: essa etapa deverá ser feita junto com o refactory dos componentes Date e Period.
|
|
39
|
+
// if (isDateField) {
|
|
40
|
+
// return {
|
|
41
|
+
// mask: Date,
|
|
42
|
+
// min: min || new Date(1900, 0, 1),
|
|
43
|
+
// max: max || new Date(9999, 0, 1),
|
|
44
|
+
// pattern: momentFormat,
|
|
45
|
+
// lazy,
|
|
46
|
+
// format: (date: moment.MomentInput) => moment(date).format(momentFormat),
|
|
47
|
+
// parse: (str) => moment(str, momentFormat).toDate(),
|
|
48
|
+
// blocks: {
|
|
49
|
+
// DD: {
|
|
50
|
+
// mask: IMask.MaskedRange,
|
|
51
|
+
// from: 1,
|
|
52
|
+
// to: 31,
|
|
53
|
+
// maxLength: 2,
|
|
54
|
+
// },
|
|
55
|
+
// MM: {
|
|
56
|
+
// mask: IMask.MaskedRange,
|
|
57
|
+
// from: 1,
|
|
58
|
+
// to: 12,
|
|
59
|
+
// maxLength: 2,
|
|
60
|
+
// },
|
|
61
|
+
// YYYY: {
|
|
62
|
+
// mask: IMask.MaskedRange,
|
|
63
|
+
// from: 1900,
|
|
64
|
+
// to: 9999,
|
|
65
|
+
// },
|
|
66
|
+
// },
|
|
67
|
+
// } satisfies ReactMaskOpts;
|
|
68
|
+
// }
|
|
69
|
+
|
|
70
|
+
return _objectSpread({
|
|
42
71
|
placeholderChar: placeholderChar === '' ? ' ' : placeholderChar,
|
|
43
72
|
min,
|
|
44
73
|
max,
|
|
@@ -51,15 +80,6 @@ const getMaskOptions = _ref => {
|
|
|
51
80
|
normalizeZeros,
|
|
52
81
|
padFractionalZeros
|
|
53
82
|
}, rest);
|
|
54
|
-
if (isDateTimeField) {
|
|
55
|
-
options.format = date => {
|
|
56
|
-
return (0, _moment.default)(date).format(momentFormat);
|
|
57
|
-
};
|
|
58
|
-
options.parse = str => {
|
|
59
|
-
return (0, _moment.default)(str, momentFormat);
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
return options;
|
|
63
83
|
};
|
|
64
84
|
exports.getMaskOptions = getMaskOptions;
|
|
65
85
|
const allEqualDigits = input => input.split('').every(char => char === input[0]);
|
|
@@ -8,6 +8,6 @@ import '../../../@types/Period.js';
|
|
|
8
8
|
import '../../../internals/types.js';
|
|
9
9
|
import '../../../@types/Position.js';
|
|
10
10
|
|
|
11
|
-
declare const Selecteds: ({ currents, descriptionKey, idKey,
|
|
11
|
+
declare const Selecteds: ({ currents, descriptionKey, idKey, handlerOnUnselect, }: ISelectedsMultipleProps) => JSX.Element;
|
|
12
12
|
|
|
13
13
|
export { Selecteds as default };
|
|
@@ -11,14 +11,12 @@ const Selecteds = _ref => {
|
|
|
11
11
|
currents,
|
|
12
12
|
descriptionKey,
|
|
13
13
|
idKey,
|
|
14
|
-
disabled,
|
|
15
14
|
handlerOnUnselect
|
|
16
15
|
} = _ref;
|
|
17
16
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, currents.map(selected => /*#__PURE__*/_react.default.createElement("div", {
|
|
18
|
-
className:
|
|
17
|
+
className: "selecteditem",
|
|
19
18
|
key: `selected-${selected[idKey]}`
|
|
20
19
|
}, typeof descriptionKey === 'string' ? selected[descriptionKey] : descriptionKey(selected), /*#__PURE__*/_react.default.createElement("button", {
|
|
21
|
-
disabled: disabled,
|
|
22
20
|
className: "close",
|
|
23
21
|
tabIndex: -1,
|
|
24
22
|
onClick: () => handlerOnUnselect(selected[idKey])
|
|
@@ -33,8 +33,7 @@ const MultipleSelect = props => {
|
|
|
33
33
|
customClassForLabel,
|
|
34
34
|
customClassForWrapper,
|
|
35
35
|
customClassForInputContent,
|
|
36
|
-
customClassForSideButtons
|
|
37
|
-
disabled = false
|
|
36
|
+
customClassForSideButtons
|
|
38
37
|
} = props;
|
|
39
38
|
const [dataCombo, setDataCombo] = (0, _react.useState)(dataSource);
|
|
40
39
|
const [currents, setCurrents] = (0, _react.useState)([]);
|
|
@@ -171,7 +170,7 @@ const MultipleSelect = props => {
|
|
|
171
170
|
const setOnDenied = denied => {
|
|
172
171
|
setOnDeniedSelect(denied);
|
|
173
172
|
};
|
|
174
|
-
const shouldDisable = () => disabled || onDenied && (onDenied.disabled || onDenied.hideContent);
|
|
173
|
+
const shouldDisable = () => props.disabled || onDenied && (onDenied.disabled || onDenied.hideContent);
|
|
175
174
|
const shouldBeReadOnly = () => props.readOnly || onDenied && onDenied.readOnly;
|
|
176
175
|
(0, _react.useEffect)(() => {
|
|
177
176
|
window.addEventListener('resize', onScreenResize);
|
|
@@ -103,7 +103,6 @@ interface IMultipleSelectProps extends Omit<ISimpleSelectProps, 'idKey' | 'value
|
|
|
103
103
|
popoverAlign?: 'right' | 'left';
|
|
104
104
|
}
|
|
105
105
|
interface ISelectedsMultipleProps {
|
|
106
|
-
disabled?: boolean;
|
|
107
106
|
idKey: string;
|
|
108
107
|
descriptionKey: DescriptionKey;
|
|
109
108
|
currents: DataCombo[];
|
package/lib/panel/Content.js
CHANGED
|
@@ -50,17 +50,14 @@ const PanelContent = _ref => {
|
|
|
50
50
|
}, [onEndReached, onEndReachedThreshold, rootElementRef.current, lastScrollHeight.current]);
|
|
51
51
|
(0, _react.useEffect)(() => {
|
|
52
52
|
let observer;
|
|
53
|
-
if (rootElementRef
|
|
53
|
+
if (rootElementRef.current && onEndReached) {
|
|
54
54
|
observer = new ResizeObserver(() => {
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
enableOnEndReached.current = true;
|
|
62
|
-
observer?.disconnect();
|
|
63
|
-
}
|
|
55
|
+
const {
|
|
56
|
+
scrollHeight
|
|
57
|
+
} = rootElementRef.current;
|
|
58
|
+
if (scrollHeight !== lastScrollHeight.current) {
|
|
59
|
+
enableOnEndReached.current = true;
|
|
60
|
+
observer?.disconnect();
|
|
64
61
|
}
|
|
65
62
|
});
|
|
66
63
|
observer.observe(rootElementRef.current);
|
package/lib/radio/index.d.ts
CHANGED
|
@@ -8,9 +8,6 @@ import '../@types/Size.js';
|
|
|
8
8
|
* o componente Field dentro do componente Form, pois o mesmo leva em consideração o tipo do
|
|
9
9
|
* componente para gerar propriedades customizadas.
|
|
10
10
|
*/
|
|
11
|
-
declare const Radio: {
|
|
12
|
-
({ id, label, value, checked, onChange, name, disabled, required, skeletonize, defaultChecked, inputRef, size, customClassForLabel, labelUppercase, hint, hintPosition, themePopover, popoverAlign, permissionAttr, }: IRadioProps): JSX.Element | null;
|
|
13
|
-
displayName: string;
|
|
14
|
-
};
|
|
11
|
+
declare const Radio: ({ id, label, value, checked, onChange, name, disabled, required, skeletonize, defaultChecked, inputRef, size, customClassForLabel, labelUppercase, hint, hintPosition, themePopover, popoverAlign, permissionAttr, }: IRadioProps) => JSX.Element | null;
|
|
15
12
|
|
|
16
13
|
export { Radio as default };
|
package/lib/radio/index.js
CHANGED
package/lib/tabs/Menu.d.ts
CHANGED
|
@@ -6,6 +6,6 @@ import '../@types/PermissionAttr.js';
|
|
|
6
6
|
import '../@types/Icon.js';
|
|
7
7
|
import '../icons/helper.js';
|
|
8
8
|
|
|
9
|
-
declare const Menu: ({ toolbar, customClassForToolBar, tabWidth,
|
|
9
|
+
declare const Menu: ({ toolbar, customClassForToolBar, tabWidth, ...props }: MenuProps) => JSX.Element;
|
|
10
10
|
|
|
11
11
|
export { Menu as default };
|
package/lib/tabs/Menu.js
CHANGED
|
@@ -8,7 +8,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _MenuTabs = _interopRequireDefault(require("./MenuTabs"));
|
|
9
9
|
var _DropdownTabs = _interopRequireDefault(require("./DropdownTabs"));
|
|
10
10
|
var _useTabs = require("./useTabs");
|
|
11
|
-
const _excluded = ["toolbar", "customClassForToolBar", "tabWidth"
|
|
11
|
+
const _excluded = ["toolbar", "customClassForToolBar", "tabWidth"];
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
13
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
14
14
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
|
|
@@ -16,8 +16,7 @@ const Menu = _ref => {
|
|
|
16
16
|
let {
|
|
17
17
|
toolbar,
|
|
18
18
|
customClassForToolBar = '',
|
|
19
|
-
tabWidth = 'auto'
|
|
20
|
-
tabsWithError
|
|
19
|
+
tabWidth = 'auto'
|
|
21
20
|
} = _ref,
|
|
22
21
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
23
22
|
const {
|
|
@@ -28,7 +27,6 @@ const Menu = _ref => {
|
|
|
28
27
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
29
28
|
className: "menucontainer"
|
|
30
29
|
}, /*#__PURE__*/_react.default.createElement(_MenuTabs.default, {
|
|
31
|
-
tabsWithError: tabsWithError,
|
|
32
30
|
tabs: menuTabs,
|
|
33
31
|
tabWidth: tabWidth,
|
|
34
32
|
tabMenuSize: props.tabMenuSize,
|
package/lib/tabs/MenuTabs.js
CHANGED
|
@@ -28,8 +28,7 @@ const MenuTab = _ref => {
|
|
|
28
28
|
tooltip,
|
|
29
29
|
tooltipPosition,
|
|
30
30
|
tooltipWidth,
|
|
31
|
-
closeable
|
|
32
|
-
tabsWithError
|
|
31
|
+
closeable
|
|
33
32
|
} = _ref;
|
|
34
33
|
const {
|
|
35
34
|
selectedTabId,
|
|
@@ -38,17 +37,12 @@ const MenuTab = _ref => {
|
|
|
38
37
|
tabsCount
|
|
39
38
|
} = (0, _useTabs.useTabs)();
|
|
40
39
|
const onDenied = (0, _permissionValidations.actionsOnPermissionDenied)(helpers.onDeniedOptions, permissionAttr);
|
|
41
|
-
const withErrorInContent = tabsWithError?.includes(id);
|
|
42
40
|
return onDenied.unvisible ? null : /*#__PURE__*/_react.default.createElement("li", {
|
|
43
41
|
key: id,
|
|
44
42
|
style: {
|
|
45
43
|
width: tabWidth
|
|
46
44
|
},
|
|
47
|
-
className: `
|
|
48
|
-
menuitem
|
|
49
|
-
${selectedTabId === id && 'selected'}
|
|
50
|
-
${withErrorInContent && 'witherrorcontent'}
|
|
51
|
-
`
|
|
45
|
+
className: `menuitem ${selectedTabId === id && 'selected'}`
|
|
52
46
|
}, /*#__PURE__*/_react.default.createElement(_buttons.default, {
|
|
53
47
|
className: "btn menubutton",
|
|
54
48
|
boxShadow: false,
|
|
@@ -73,13 +67,9 @@ const MenuTabs = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
73
67
|
tabWidth = 'auto',
|
|
74
68
|
tabMenuSize = 'medium',
|
|
75
69
|
tabMenuAlign = 'left',
|
|
76
|
-
firstTabIdent = false
|
|
77
|
-
tabsWithError
|
|
70
|
+
firstTabIdent = false
|
|
78
71
|
} = _ref2;
|
|
79
|
-
const
|
|
80
|
-
keepPanelsInOrder
|
|
81
|
-
} = (0, _useTabs.useTabs)();
|
|
82
|
-
const uniqueTabs = keepPanelsInOrder ? _lodash.default.sortBy(_lodash.default.uniqBy(tabs, 'id'), tabPanel => keepPanelsInOrder.indexOf(tabPanel.id)) : _lodash.default.uniqBy(tabs, 'id');
|
|
72
|
+
const uniqueTabs = _lodash.default.uniqBy(tabs, 'id');
|
|
83
73
|
return /*#__PURE__*/_react.default.createElement("ul", {
|
|
84
74
|
className: `menu ${firstTabIdent && '-firsttabident'}`,
|
|
85
75
|
style: helpers.menuStyles(tabMenuAlign),
|
|
@@ -87,8 +77,7 @@ const MenuTabs = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
87
77
|
}, uniqueTabs.map(tab => /*#__PURE__*/_react.default.createElement(MenuTab, _extends({
|
|
88
78
|
key: tab.id,
|
|
89
79
|
tabMenuSize: tabMenuSize,
|
|
90
|
-
tabWidth: tabWidth
|
|
91
|
-
tabsWithError: tabsWithError
|
|
80
|
+
tabWidth: tabWidth
|
|
92
81
|
}, tab))));
|
|
93
82
|
});
|
|
94
83
|
MenuTabs.displayName = 'MenuTabs';
|
package/lib/tabs/context.d.ts
CHANGED
|
@@ -7,6 +7,6 @@ import '../@types/Icon.js';
|
|
|
7
7
|
import '../icons/helper.js';
|
|
8
8
|
|
|
9
9
|
declare const TabsContext: React__default.Context<TabsContextType>;
|
|
10
|
-
declare function TabsProvider({ children, tabs: tabsProp, container, selectedTab, onTabChange, onTabClose, tabsWidth: tabsWidthProp, firstTabIdent,
|
|
10
|
+
declare function TabsProvider({ children, tabs: tabsProp, container, selectedTab, onTabChange, onTabClose, tabsWidth: tabsWidthProp, firstTabIdent, keepTabOriginalPosition, }: TabsProviderProps): JSX.Element;
|
|
11
11
|
|
|
12
12
|
export { TabsContext, TabsProvider };
|
package/lib/tabs/context.js
CHANGED
|
@@ -22,7 +22,6 @@ function TabsProvider(_ref) {
|
|
|
22
22
|
onTabClose,
|
|
23
23
|
tabsWidth: tabsWidthProp,
|
|
24
24
|
firstTabIdent = false,
|
|
25
|
-
keepPanelsInOrder,
|
|
26
25
|
keepTabOriginalPosition = true
|
|
27
26
|
} = _ref;
|
|
28
27
|
const [selectedTabId, setSelectedTabId] = _react.default.useState(selectedTab);
|
|
@@ -122,8 +121,7 @@ function TabsProvider(_ref) {
|
|
|
122
121
|
selectTab,
|
|
123
122
|
selectedTabId,
|
|
124
123
|
removeTab,
|
|
125
|
-
menuRef
|
|
126
|
-
keepPanelsInOrder
|
|
124
|
+
menuRef
|
|
127
125
|
}
|
|
128
126
|
}, children);
|
|
129
127
|
}
|