linear-react-components-ui 1.0.1-beta.1 → 1.0.1
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/commons.scss +10 -0
- package/lib/assets/styles/dropdown.scss +35 -2
- package/lib/assets/styles/effects.scss +11 -0
- package/lib/assets/styles/list.scss +8 -0
- package/lib/assets/styles/table.scss +2 -7
- package/lib/checkbox/index.js +3 -6
- package/lib/dialog/form/index.js +4 -2
- package/lib/dialog/types.d.ts +1 -0
- package/lib/drawer/Content.d.ts +1 -0
- package/lib/drawer/Drawer.d.ts +2 -1
- package/lib/drawer/Drawer.js +21 -4
- package/lib/drawer/Header.d.ts +1 -0
- package/lib/drawer/helpers.d.ts +1 -0
- package/lib/drawer/index.d.ts +1 -0
- package/lib/drawer/types.d.ts +5 -1
- package/lib/dropdown/withDropdown.js +1 -1
- package/lib/form/FieldNumber.js +16 -8
- package/lib/form/types.d.ts +11 -6
- package/lib/inputs/base/InputTextBase.js +3 -6
- package/lib/inputs/base/types.d.ts +3 -1
- package/lib/inputs/date/index.js +2 -3
- package/lib/inputs/inputHOC.d.ts +2 -1
- package/lib/inputs/mask/BaseMask.js +29 -15
- package/lib/inputs/mask/helpers.d.ts +2 -1
- package/lib/inputs/mask/imaskHOC.d.ts +2 -1
- package/lib/inputs/mask/imaskHOC.js +9 -4
- package/lib/inputs/mask/types.d.ts +4 -1
- package/lib/inputs/number/BaseNumber.d.ts +2 -1
- package/lib/inputs/number/BaseNumber.js +44 -25
- package/lib/inputs/number/Currency.d.ts +4 -3
- package/lib/inputs/number/Decimal.d.ts +2 -1
- package/lib/inputs/number/index.d.ts +2 -1
- package/lib/inputs/number/types.d.ts +5 -3
- package/lib/inputs/period/index.js +2 -0
- package/lib/inputs/search/index.d.ts +2 -1
- package/lib/inputs/search/index.js +14 -12
- package/lib/inputs/select/ActionButtons.d.ts +2 -1
- package/lib/inputs/select/Dropdown.d.ts +2 -1
- package/lib/inputs/select/helper.d.ts +2 -1
- package/lib/inputs/select/index.d.ts +1 -1
- package/lib/inputs/select/multiple/Selecteds.d.ts +1 -1
- package/lib/inputs/select/multiple/index.d.ts +1 -1
- package/lib/inputs/select/multiple/index.js +27 -29
- package/lib/inputs/select/simple/index.d.ts +1 -1
- package/lib/inputs/select/simple/index.js +17 -16
- package/lib/inputs/select/types.d.ts +2 -7
- package/lib/inputs/types.d.ts +13 -11
- package/lib/menus/float/MenuItem.d.ts +1 -1
- package/lib/menus/float/MenuItem.js +14 -5
- package/lib/menus/float/SubMenuContainer.js +83 -0
- package/lib/menus/float/index.d.ts +31 -1
- package/lib/menus/float/index.js +10 -1
- package/lib/menus/float/types.d.ts +1 -0
- package/lib/menus/index.d.ts +1 -0
- package/lib/menus/sidenav/index.js +1 -1
- package/lib/menus/sidenav/popup_menu_search/index.js +1 -0
- package/lib/panel/Header.js +1 -1
- package/lib/tabs/DropdownItems.d.ts +1 -1
- package/lib/tabs/DropdownItems.js +1 -1
- package/package.json +2 -1
- package/lib/assets/styles/hint.scss +0 -9
- package/lib/hint/index.d.ts +0 -6
- package/lib/hint/index.js +0 -25
- package/lib/hint/types.d.ts +0 -11
- package/lib/hint/types.js +0 -5
|
@@ -8,6 +8,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _imask = _interopRequireDefault(require("imask"));
|
|
9
9
|
var helpers = _interopRequireWildcard(require("./helpers"));
|
|
10
10
|
var _permissionValidations = require("../../permissionValidations");
|
|
11
|
+
var _format_number = require("../number/format_number");
|
|
11
12
|
var _this = void 0;
|
|
12
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
14
|
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); }
|
|
@@ -58,7 +59,9 @@ var IMaskHOC = function IMaskHOC(ComposedComponent) {
|
|
|
58
59
|
dispatch = props.dispatch,
|
|
59
60
|
_props$value = props.value,
|
|
60
61
|
value = _props$value === void 0 ? '' : _props$value,
|
|
61
|
-
onChange = props.onChange
|
|
62
|
+
onChange = props.onChange,
|
|
63
|
+
_props$isDateField = props.isDateField,
|
|
64
|
+
isDateField = _props$isDateField === void 0 ? false : _props$isDateField;
|
|
62
65
|
var maskOptions = {
|
|
63
66
|
placeholderChar: placeholderChar,
|
|
64
67
|
lazy: lazy,
|
|
@@ -93,7 +96,8 @@ var IMaskHOC = function IMaskHOC(ComposedComponent) {
|
|
|
93
96
|
var disableCallbacks = disabled || readOnly;
|
|
94
97
|
var setValue = function setValue(newValue) {
|
|
95
98
|
if (maskRef.current) {
|
|
96
|
-
if (props.unmask) maskRef.current.unmaskedValue = newValue.toString();
|
|
99
|
+
if (props.unmask) maskRef.current.unmaskedValue = newValue.toString();
|
|
100
|
+
maskRef.current.value = String(newValue);
|
|
97
101
|
}
|
|
98
102
|
};
|
|
99
103
|
var onAccept = function onAccept() {
|
|
@@ -157,7 +161,8 @@ var IMaskHOC = function IMaskHOC(ComposedComponent) {
|
|
|
157
161
|
(0, _react.useEffect)(function () {
|
|
158
162
|
if (maskOptions.mask && !dontInitMask) {
|
|
159
163
|
if (maskRef.current) {
|
|
160
|
-
|
|
164
|
+
var formattedValue = isDateField ? value : (0, _format_number.numberToPtBR)(value) || '';
|
|
165
|
+
setValue(formattedValue);
|
|
161
166
|
} else {
|
|
162
167
|
getMask();
|
|
163
168
|
}
|
|
@@ -165,7 +170,7 @@ var IMaskHOC = function IMaskHOC(ComposedComponent) {
|
|
|
165
170
|
destroyMask();
|
|
166
171
|
if (value && elementRef.current) elementRef.current.value = value;
|
|
167
172
|
}
|
|
168
|
-
}, [value]);
|
|
173
|
+
}, [value, isDateField]);
|
|
169
174
|
(0, _react.useEffect)(function () {
|
|
170
175
|
return destroyMask;
|
|
171
176
|
}, []);
|
|
@@ -6,7 +6,7 @@ import '../../@types/Period.js';
|
|
|
6
6
|
interface IBaseMaskProps {
|
|
7
7
|
value?: string;
|
|
8
8
|
onBlur?: (e: CustomInputEvent) => void;
|
|
9
|
-
onKeyDown?: (e: KeyboardEvent<Element>) => void;
|
|
9
|
+
onKeyDown?: (e: CustomInputEvent | KeyboardEvent<Element>) => void;
|
|
10
10
|
defaultValue?: string;
|
|
11
11
|
mask?: string | NumberConstructor;
|
|
12
12
|
isNumeric?: boolean;
|
|
@@ -42,6 +42,9 @@ interface IBaseMaskProps {
|
|
|
42
42
|
placeholderChar?: string;
|
|
43
43
|
onFocus?: (e: CustomInputEvent) => void;
|
|
44
44
|
required?: boolean;
|
|
45
|
+
returnFormattedValueOnBlur?: boolean;
|
|
46
|
+
returnFormattedValueOnKeyDown?: boolean;
|
|
47
|
+
isDateField?: boolean;
|
|
45
48
|
}
|
|
46
49
|
interface ICnpjFieldProps extends IBaseMaskProps {
|
|
47
50
|
value?: string;
|
|
@@ -5,7 +5,8 @@ import 'react';
|
|
|
5
5
|
import '../../@types/Period.js';
|
|
6
6
|
import '../types.js';
|
|
7
7
|
import '../../@types/DataCombo.js';
|
|
8
|
-
import '
|
|
8
|
+
import '../../drawer/types.js';
|
|
9
|
+
import '../../@types/Position.js';
|
|
9
10
|
|
|
10
11
|
declare const BaseNumber: (props: IBaseNumberProps) => JSX.Element;
|
|
11
12
|
|
|
@@ -9,37 +9,56 @@ var _BaseMask = _interopRequireDefault(require("../mask/BaseMask"));
|
|
|
9
9
|
var _format_number = require("./format_number");
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
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); }
|
|
12
|
+
var returnEventFormattedValue = function returnEventFormattedValue(props, event) {
|
|
13
|
+
if (props.returnFormattedValueOnBlur || props.returnFormattedValueOnKeyDown) {
|
|
14
|
+
// Retornando um objeto com a mesma estrutura do Proxy original
|
|
15
|
+
// para recuperacao do valor formatado no padrão americano.
|
|
16
|
+
// O retorno poderá ser modificado conforme necessidade, desde que seja
|
|
17
|
+
// mantido o path até a propriedade value e name.
|
|
18
|
+
var _event$target = event.target,
|
|
19
|
+
value = _event$target.value,
|
|
20
|
+
name = _event$target.name;
|
|
21
|
+
var teste = _extends({}, event, {
|
|
22
|
+
target: {
|
|
23
|
+
value: (0, _format_number.numberToEnUS)(value),
|
|
24
|
+
name: name
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
return teste;
|
|
28
|
+
}
|
|
29
|
+
return event;
|
|
30
|
+
};
|
|
31
|
+
var getEventProps = function getEventProps(props) {
|
|
32
|
+
var returnFormattedValueOnBlur = props.returnFormattedValueOnBlur,
|
|
33
|
+
returnFormattedValueOnKeyDown = props.returnFormattedValueOnKeyDown;
|
|
34
|
+
if (props.isNumeric) return {};
|
|
35
|
+
return {
|
|
36
|
+
onBlur: function onBlur(e) {
|
|
37
|
+
if (props.onBlur) {
|
|
38
|
+
var formattedEvent = returnFormattedValueOnBlur ? returnEventFormattedValue(props, e) : e;
|
|
39
|
+
props.onBlur(formattedEvent);
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
onKeyDown: function onKeyDown(e) {
|
|
43
|
+
if (props.onKeyDown) {
|
|
44
|
+
var formattedEvent = returnFormattedValueOnKeyDown ? returnEventFormattedValue(props, e) : e;
|
|
45
|
+
props.onKeyDown(formattedEvent);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
};
|
|
12
50
|
var BaseNumber = function BaseNumber(props) {
|
|
13
|
-
var
|
|
14
|
-
returnFormattedValueOnBlur
|
|
51
|
+
var eventProps = _extends({}, props, {
|
|
52
|
+
returnFormattedValueOnBlur: true,
|
|
53
|
+
returnFormattedValueOnKeyDown: true
|
|
54
|
+
});
|
|
15
55
|
return /*#__PURE__*/_react.default.createElement(_BaseMask.default, _extends({
|
|
16
56
|
value: (0, _format_number.numberToPtBR)(props.value),
|
|
17
57
|
thousandsSeparator: ".",
|
|
18
58
|
radix: ",",
|
|
19
59
|
mask: Number,
|
|
20
|
-
isNumeric: true
|
|
21
|
-
|
|
22
|
-
if (props.onBlur) {
|
|
23
|
-
if (returnFormattedValueOnBlur) {
|
|
24
|
-
// Retornando um objeto com a mesma estrutura do Proxy original
|
|
25
|
-
// para recuperacao do valor formatado no padrão americano.
|
|
26
|
-
// O retorno poderá ser modificado conforme necessidade, desde que seja
|
|
27
|
-
// mantido o path até a propriedade value e name.
|
|
28
|
-
var _ref = e.target,
|
|
29
|
-
value = _ref.value,
|
|
30
|
-
name = _ref.name;
|
|
31
|
-
props.onBlur({
|
|
32
|
-
target: {
|
|
33
|
-
value: value,
|
|
34
|
-
name: name
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
} else {
|
|
38
|
-
props.onBlur(e);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}, props));
|
|
60
|
+
isNumeric: true
|
|
61
|
+
}, props, getEventProps(eventProps)));
|
|
43
62
|
};
|
|
44
63
|
var _default = BaseNumber;
|
|
45
64
|
exports.default = _default;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ICurrencyProps } from './types.js';
|
|
2
2
|
import '../../@types/PermissionAttr.js';
|
|
3
3
|
import '../base/types.js';
|
|
4
4
|
import 'react';
|
|
5
5
|
import '../../@types/Period.js';
|
|
6
6
|
import '../types.js';
|
|
7
7
|
import '../../@types/DataCombo.js';
|
|
8
|
-
import '
|
|
8
|
+
import '../../drawer/types.js';
|
|
9
|
+
import '../../@types/Position.js';
|
|
9
10
|
|
|
10
|
-
declare const CurrencyField: (props:
|
|
11
|
+
declare const CurrencyField: (props: ICurrencyProps) => JSX.Element;
|
|
11
12
|
|
|
12
13
|
export { CurrencyField as default };
|
|
@@ -5,7 +5,8 @@ import 'react';
|
|
|
5
5
|
import '../../@types/Period.js';
|
|
6
6
|
import '../types.js';
|
|
7
7
|
import '../../@types/DataCombo.js';
|
|
8
|
-
import '
|
|
8
|
+
import '../../drawer/types.js';
|
|
9
|
+
import '../../@types/Position.js';
|
|
9
10
|
|
|
10
11
|
declare const DecimalField: (props: IBaseNumberProps) => JSX.Element;
|
|
11
12
|
|
|
@@ -7,7 +7,8 @@ import 'react';
|
|
|
7
7
|
import '../../@types/Period.js';
|
|
8
8
|
import '../types.js';
|
|
9
9
|
import '../../@types/DataCombo.js';
|
|
10
|
-
import '
|
|
10
|
+
import '../../drawer/types.js';
|
|
11
|
+
import '../../@types/Position.js';
|
|
11
12
|
|
|
12
13
|
declare const NumberField: (props: INumberFieldProps) => JSX.Element;
|
|
13
14
|
|
|
@@ -4,7 +4,8 @@ import { IMaskHOCProps } from '../types.js';
|
|
|
4
4
|
import 'react';
|
|
5
5
|
import '../../@types/Period.js';
|
|
6
6
|
import '../../@types/DataCombo.js';
|
|
7
|
-
import '
|
|
7
|
+
import '../../drawer/types.js';
|
|
8
|
+
import '../../@types/Position.js';
|
|
8
9
|
|
|
9
10
|
interface INumberFieldProps extends IMaskHOCProps {
|
|
10
11
|
value?: string;
|
|
@@ -21,10 +22,11 @@ interface IBaseNumberProps extends INumberFieldProps {
|
|
|
21
22
|
leftElements?: JSX.Element | JSX.Element[];
|
|
22
23
|
onBlur?: (e: CustomInputEvent) => void;
|
|
23
24
|
returnFormattedValueOnBlur?: boolean;
|
|
25
|
+
returnFormattedValueOnKeyDown?: boolean;
|
|
24
26
|
}
|
|
25
|
-
interface
|
|
27
|
+
interface ICurrencyProps extends INumberFieldProps {
|
|
26
28
|
currencySymbol?: string;
|
|
27
29
|
displayCurrencySymbol?: boolean;
|
|
28
30
|
}
|
|
29
31
|
|
|
30
|
-
export { IBaseNumberProps,
|
|
32
|
+
export { IBaseNumberProps, ICurrencyProps, INumberFieldProps };
|
|
@@ -335,6 +335,7 @@ var PeriodPicker = function PeriodPicker(props) {
|
|
|
335
335
|
setValue(e, date, false);
|
|
336
336
|
},
|
|
337
337
|
onFocus: onInputFocus,
|
|
338
|
+
isDateField: true,
|
|
338
339
|
onChange: onInputChange,
|
|
339
340
|
inputRef: function inputRef(el) {
|
|
340
341
|
if (el) inputInitialRef.current = el;
|
|
@@ -351,6 +352,7 @@ var PeriodPicker = function PeriodPicker(props) {
|
|
|
351
352
|
name: "valueFinal",
|
|
352
353
|
value: !valueFinal ? '' : (0, _moment.default)(valueFinal).format('DD/MM/YYYY'),
|
|
353
354
|
mask: "00/00/0000",
|
|
355
|
+
isDateField: true,
|
|
354
356
|
onComplete: function onComplete(e, date) {
|
|
355
357
|
setValue(e, date, false);
|
|
356
358
|
},
|
|
@@ -2,9 +2,10 @@ import { ISearchProps } from '../types.js';
|
|
|
2
2
|
import 'react';
|
|
3
3
|
import '../../@types/PermissionAttr.js';
|
|
4
4
|
import '../../@types/DataCombo.js';
|
|
5
|
-
import '../select/types.js';
|
|
6
5
|
import '../base/types.js';
|
|
7
6
|
import '../../@types/Period.js';
|
|
7
|
+
import '../../drawer/types.js';
|
|
8
|
+
import '../../@types/Position.js';
|
|
8
9
|
|
|
9
10
|
declare const SearchField: (props: ISearchProps) => JSX.Element | null;
|
|
10
11
|
|
|
@@ -11,6 +11,7 @@ var _buttons = _interopRequireDefault(require("../../buttons"));
|
|
|
11
11
|
var _icons = _interopRequireDefault(require("../../icons"));
|
|
12
12
|
require("../../assets/styles/search.scss");
|
|
13
13
|
var _drawer = _interopRequireWildcard(require("../../drawer"));
|
|
14
|
+
var _excluded = ["headerTitle", "content", "onStateChange"];
|
|
14
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
16
|
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); }
|
|
16
17
|
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; }
|
|
@@ -19,6 +20,8 @@ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread n
|
|
|
19
20
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
20
21
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
21
22
|
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); }
|
|
23
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
24
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
22
25
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
23
26
|
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."); }
|
|
24
27
|
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); }
|
|
@@ -28,7 +31,8 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
28
31
|
var SearchField = function SearchField(props) {
|
|
29
32
|
var _props$resetButton = props.resetButton,
|
|
30
33
|
resetButton = _props$resetButton === void 0 ? true : _props$resetButton,
|
|
31
|
-
|
|
34
|
+
_props$advancedFilter = props.advancedFilterProps,
|
|
35
|
+
advancedFilterProps = _props$advancedFilter === void 0 ? {} : _props$advancedFilter,
|
|
32
36
|
value = props.value;
|
|
33
37
|
var _useState = (0, _react.useState)(false),
|
|
34
38
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -42,6 +46,10 @@ var SearchField = function SearchField(props) {
|
|
|
42
46
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
43
47
|
onDenied = _useState6[0],
|
|
44
48
|
setOnDenied = _useState6[1];
|
|
49
|
+
var headerTitle = advancedFilterProps.headerTitle,
|
|
50
|
+
content = advancedFilterProps.content,
|
|
51
|
+
onStateChange = advancedFilterProps.onStateChange,
|
|
52
|
+
advancedFilterPropsRest = _objectWithoutProperties(advancedFilterProps, _excluded);
|
|
45
53
|
var onReset = function onReset(event) {
|
|
46
54
|
if (props.onReset) props.onReset(event);
|
|
47
55
|
setValorCampo('');
|
|
@@ -58,10 +66,8 @@ var SearchField = function SearchField(props) {
|
|
|
58
66
|
var shouldBeReadOnly = function shouldBeReadOnly() {
|
|
59
67
|
return props.readOnly || onDenied && onDenied.readOnly;
|
|
60
68
|
};
|
|
61
|
-
var hideContent = onDenied
|
|
69
|
+
var hideContent = onDenied === null || onDenied === void 0 ? void 0 : onDenied.hideContent;
|
|
62
70
|
var buttonProps = function buttonProps() {
|
|
63
|
-
var _ref = advancedFilterProps || {},
|
|
64
|
-
onStateChange = _ref.onStateChange;
|
|
65
71
|
var disableCallbacks = shouldBeReadOnly() || shouldDisable() || hideContent;
|
|
66
72
|
var propsButton = {
|
|
67
73
|
icon: /*#__PURE__*/_react.default.createElement(_icons.default, {
|
|
@@ -91,7 +97,7 @@ var SearchField = function SearchField(props) {
|
|
|
91
97
|
return propsButton;
|
|
92
98
|
};
|
|
93
99
|
var rightElements = function rightElements() {
|
|
94
|
-
var enableFilterButton = advancedFilterProps
|
|
100
|
+
var enableFilterButton = Object.keys(advancedFilterProps).length > 0;
|
|
95
101
|
var elements = [/*#__PURE__*/_react.default.createElement(_icons.default, {
|
|
96
102
|
name: "search",
|
|
97
103
|
color: "#a9a8a8",
|
|
@@ -113,15 +119,11 @@ var SearchField = function SearchField(props) {
|
|
|
113
119
|
if (resetButton && valorCampo.trim() !== '') elements = [resetButtonIcon].concat(_toConsumableArray(elements));
|
|
114
120
|
return elements;
|
|
115
121
|
};
|
|
116
|
-
var _ref2 = advancedFilterProps || {},
|
|
117
|
-
headerTitle = _ref2.headerTitle,
|
|
118
|
-
content = _ref2.content,
|
|
119
|
-
onStateChange = _ref2.onStateChange;
|
|
120
122
|
(0, _react.useEffect)(function () {
|
|
121
123
|
if (value !== undefined && value !== valorCampo) {
|
|
122
124
|
setValorCampo(value);
|
|
123
125
|
}
|
|
124
|
-
}, []);
|
|
126
|
+
}, [value]);
|
|
125
127
|
if (onDenied && onDenied.unvisible) {
|
|
126
128
|
return null;
|
|
127
129
|
}
|
|
@@ -132,12 +134,12 @@ var SearchField = function SearchField(props) {
|
|
|
132
134
|
customClass: "",
|
|
133
135
|
handlerSetOnDenied: setOnDenied,
|
|
134
136
|
rightElements: rightElements()
|
|
135
|
-
})), advancedFilterOpened && /*#__PURE__*/_react.default.createElement(_drawer.default,
|
|
137
|
+
})), advancedFilterOpened && /*#__PURE__*/_react.default.createElement(_drawer.default, {
|
|
136
138
|
handlerClose: function handlerClose() {
|
|
137
139
|
setAdvancedFilterOpened(false);
|
|
138
140
|
if (onStateChange) onStateChange(false);
|
|
139
141
|
}
|
|
140
|
-
},
|
|
142
|
+
}, headerTitle && /*#__PURE__*/_react.default.createElement(_drawer.DrawerHeader, {
|
|
141
143
|
title: headerTitle
|
|
142
144
|
}), /*#__PURE__*/_react.default.createElement(_drawer.DrawerContent, null, content)));
|
|
143
145
|
};
|
|
@@ -2,9 +2,10 @@ import { IActionButtonsSelectProps } from '../types.js';
|
|
|
2
2
|
import 'react';
|
|
3
3
|
import '../../@types/PermissionAttr.js';
|
|
4
4
|
import '../../@types/DataCombo.js';
|
|
5
|
-
import './types.js';
|
|
6
5
|
import '../base/types.js';
|
|
7
6
|
import '../../@types/Period.js';
|
|
7
|
+
import '../../drawer/types.js';
|
|
8
|
+
import '../../@types/Position.js';
|
|
8
9
|
|
|
9
10
|
declare const ActionButtons: (props: IActionButtonsSelectProps) => JSX.Element;
|
|
10
11
|
|
|
@@ -2,9 +2,10 @@ import { IDropdownSelectProps } from '../types.js';
|
|
|
2
2
|
import 'react';
|
|
3
3
|
import '../../@types/PermissionAttr.js';
|
|
4
4
|
import '../../@types/DataCombo.js';
|
|
5
|
-
import './types.js';
|
|
6
5
|
import '../base/types.js';
|
|
7
6
|
import '../../@types/Period.js';
|
|
7
|
+
import '../../drawer/types.js';
|
|
8
|
+
import '../../@types/Position.js';
|
|
8
9
|
|
|
9
10
|
declare const Dropdown: (props: IDropdownSelectProps) => JSX.Element;
|
|
10
11
|
|
|
@@ -2,9 +2,10 @@ import { DataCombo } from '../../@types/DataCombo.js';
|
|
|
2
2
|
import { IDropdownSelectProps } from '../types.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
import '../../@types/PermissionAttr.js';
|
|
5
|
-
import './types.js';
|
|
6
5
|
import '../base/types.js';
|
|
7
6
|
import '../../@types/Period.js';
|
|
7
|
+
import '../../drawer/types.js';
|
|
8
|
+
import '../../@types/Position.js';
|
|
8
9
|
|
|
9
10
|
declare const contentClass: (props: IDropdownSelectProps) => string;
|
|
10
11
|
declare const getDropdownItemCssClass: (selected: boolean, disabled: boolean, striped: boolean) => string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ISelectFieldProps } from './types.js';
|
|
2
|
-
import 'react';
|
|
3
2
|
import '../../@types/DataCombo.js';
|
|
4
3
|
import '../../@types/PermissionAttr.js';
|
|
5
4
|
import '../base/types.js';
|
|
5
|
+
import 'react';
|
|
6
6
|
import '../../@types/Period.js';
|
|
7
7
|
|
|
8
8
|
declare const SelectField: (props: ISelectFieldProps) => JSX.Element;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ISelectedsMultipleProps } from '../types.js';
|
|
2
|
-
import 'react';
|
|
3
2
|
import '../../../@types/DataCombo.js';
|
|
4
3
|
import '../../../@types/PermissionAttr.js';
|
|
5
4
|
import '../../base/types.js';
|
|
5
|
+
import 'react';
|
|
6
6
|
import '../../../@types/Period.js';
|
|
7
7
|
|
|
8
8
|
declare const Selecteds: ({ currents, descriptionKey, idKey, handleOnUnselect, }: ISelectedsMultipleProps) => JSX.Element;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { IMultipleSelectProps } from '../types.js';
|
|
2
|
-
import 'react';
|
|
3
2
|
import '../../../@types/DataCombo.js';
|
|
4
3
|
import '../../../@types/PermissionAttr.js';
|
|
5
4
|
import '../../base/types.js';
|
|
5
|
+
import 'react';
|
|
6
6
|
import '../../../@types/Period.js';
|
|
7
7
|
|
|
8
8
|
declare const MultipleSelect: (props: IMultipleSelectProps) => JSX.Element;
|
|
@@ -158,29 +158,31 @@ var MultipleSelect = function MultipleSelect(props) {
|
|
|
158
158
|
if (!insideComponent) setOpened(false);
|
|
159
159
|
};
|
|
160
160
|
var onInputKeyDown = function onInputKeyDown(e) {
|
|
161
|
-
if (e.keyCode
|
|
162
|
-
if (
|
|
163
|
-
|
|
164
|
-
if (
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
if (
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
161
|
+
if (e.keyCode) {
|
|
162
|
+
if (e.keyCode === constants.keyCodes.ENTER && selected) {
|
|
163
|
+
if (!currents.includes(selected)) onSelect(selected);
|
|
164
|
+
} else if ([constants.keyCodes.ARROW_UP, constants.keyCodes.ARROW_DOWN].includes(e.keyCode)) {
|
|
165
|
+
if (!opened) setOpened(true);
|
|
166
|
+
var index = dataSource ? dataSource.findIndex(function (d) {
|
|
167
|
+
return d === selected;
|
|
168
|
+
}) : 0;
|
|
169
|
+
if (e.keyCode === constants.keyCodes.ARROW_DOWN) {
|
|
170
|
+
index = dataSource && index === dataSource.length - 1 ? 0 : index + 1;
|
|
171
|
+
} else {
|
|
172
|
+
index = dataSource && index === 0 ? dataSource.length - 1 : index - 1;
|
|
173
|
+
}
|
|
174
|
+
if (dataSource && dataSource.length && dataSource[index][props.descriptionKey]) {
|
|
175
|
+
setInputValue(dataSource[index][props.descriptionKey]);
|
|
176
|
+
}
|
|
177
|
+
if (dataSource) setSelected(dataSource[index]);
|
|
178
|
+
} else if (e.keyCode === constants.keyCodes.BACKSPACE) {
|
|
179
|
+
if (inputValue === '') {
|
|
180
|
+
var currentsKeyDown = _lodash.default.dropRight(currents);
|
|
181
|
+
setCurrents(currentsKeyDown);
|
|
182
|
+
if (props.onSelect) props.onSelect(currentsKeyDown.map(function (i) {
|
|
183
|
+
return i[idKey];
|
|
184
|
+
}));
|
|
185
|
+
}
|
|
184
186
|
}
|
|
185
187
|
}
|
|
186
188
|
};
|
|
@@ -247,9 +249,7 @@ var MultipleSelect = function MultipleSelect(props) {
|
|
|
247
249
|
onChange: function onChange(e) {
|
|
248
250
|
if (e) onFilter(e.target.value);
|
|
249
251
|
},
|
|
250
|
-
onKeyDown:
|
|
251
|
-
onInputKeyDown(e);
|
|
252
|
-
},
|
|
252
|
+
onKeyDown: onInputKeyDown,
|
|
253
253
|
customClassForWrapper: "selectwrapper ".concat((props.readOnly || shouldDisable() || shouldBeReadOnly()) && ' -undigitable'),
|
|
254
254
|
customClassForInputContent: "multiselect",
|
|
255
255
|
inputBaseRef: function inputBaseRef(r) {
|
|
@@ -278,9 +278,7 @@ var MultipleSelect = function MultipleSelect(props) {
|
|
|
278
278
|
gridWrapperStyle: props.gridLayout && gridElRef.current ? window.getComputedStyle(gridElRef.current) : undefined,
|
|
279
279
|
handleOnSelect: onSelect,
|
|
280
280
|
handleOnFilter: onFilter,
|
|
281
|
-
handleOnKeydown:
|
|
282
|
-
return onInputKeyDown(e);
|
|
283
|
-
},
|
|
281
|
+
handleOnKeydown: onInputKeyDown,
|
|
284
282
|
handleOnBlur: function handleOnBlur() {
|
|
285
283
|
return _onBlur;
|
|
286
284
|
},
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ISimpleSelectProps } from '../types.js';
|
|
2
|
-
import 'react';
|
|
3
2
|
import '../../../@types/DataCombo.js';
|
|
4
3
|
import '../../../@types/PermissionAttr.js';
|
|
5
4
|
import '../../base/types.js';
|
|
5
|
+
import 'react';
|
|
6
6
|
import '../../../@types/Period.js';
|
|
7
7
|
|
|
8
8
|
declare const SimpleSelect: (props: ISimpleSelectProps) => JSX.Element;
|
|
@@ -171,20 +171,23 @@ var SimpleSelect = function SimpleSelect(props) {
|
|
|
171
171
|
}
|
|
172
172
|
};
|
|
173
173
|
var onInputKeyDown = function onInputKeyDown(e) {
|
|
174
|
-
if (e.keyCode
|
|
175
|
-
e.
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
174
|
+
if (e.keyCode) {
|
|
175
|
+
if (e.keyCode === constants.keyCodes.ENTER && selected) {
|
|
176
|
+
var _e$preventDefault;
|
|
177
|
+
(_e$preventDefault = e.preventDefault) === null || _e$preventDefault === void 0 ? void 0 : _e$preventDefault.call(e);
|
|
178
|
+
onSelect(selected);
|
|
179
|
+
} else if ([constants.keyCodes.ARROW_UP, constants.keyCodes.ARROW_DOWN].includes(e.keyCode)) {
|
|
180
|
+
if (!opened) setOpened(true);
|
|
181
|
+
var index = dataSource.length > 0 ? dataSource.findIndex(function (d) {
|
|
182
|
+
return selected && d[idKey] === selected[idKey];
|
|
183
|
+
}) : 0;
|
|
184
|
+
if (e.keyCode === constants.keyCodes.ARROW_DOWN) {
|
|
185
|
+
index = dataSource && index === dataSource.length - 1 ? 0 : index + 1;
|
|
186
|
+
} else {
|
|
187
|
+
index = dataSource && index === 0 ? (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) - 1 : index - 1;
|
|
188
|
+
}
|
|
189
|
+
setSelected(dataSource[index]);
|
|
186
190
|
}
|
|
187
|
-
setSelected(dataSource[index]);
|
|
188
191
|
}
|
|
189
192
|
if (!isTyping) setIsTyping(true);
|
|
190
193
|
};
|
|
@@ -263,9 +266,7 @@ var SimpleSelect = function SimpleSelect(props) {
|
|
|
263
266
|
onChange: function onChange(e) {
|
|
264
267
|
if (e) onFilter(e.target.value);
|
|
265
268
|
},
|
|
266
|
-
onKeyDown:
|
|
267
|
-
onInputKeyDown(e);
|
|
268
|
-
},
|
|
269
|
+
onKeyDown: onInputKeyDown,
|
|
269
270
|
customClassForWrapper: "selectwrapper ".concat((undigitable || searchOnDropdown || shouldBeReadOnly()) && ' -undigitable'),
|
|
270
271
|
customClassForInputContent: "multiselect",
|
|
271
272
|
inputBaseRef: function inputBaseRef(r) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
1
|
import { DataCombo } from '../../@types/DataCombo.js';
|
|
3
2
|
import { PermissionAttr } from '../../@types/PermissionAttr.js';
|
|
4
3
|
import { CustomInputEvent } from '../base/types.js';
|
|
4
|
+
import 'react';
|
|
5
5
|
import '../../@types/Period.js';
|
|
6
6
|
|
|
7
7
|
interface ISimpleSelectProps {
|
|
@@ -89,10 +89,5 @@ interface ISelectedsMultipleProps {
|
|
|
89
89
|
currents: DataCombo[];
|
|
90
90
|
handleOnUnselect: (id: string) => void;
|
|
91
91
|
}
|
|
92
|
-
interface IAdvancedFilterProps {
|
|
93
|
-
onStateChange?: (bol?: boolean) => void;
|
|
94
|
-
headerTitle?: string;
|
|
95
|
-
content?: ReactNode | ReactNode[];
|
|
96
|
-
}
|
|
97
92
|
|
|
98
|
-
export {
|
|
93
|
+
export { IMultipleSelectProps, ISelectFieldProps, ISelectedsMultipleProps, ISimpleSelectProps };
|
package/lib/inputs/types.d.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import { MouseEvent, MutableRefObject, CSSProperties,
|
|
1
|
+
import { ReactNode, MouseEvent, MutableRefObject, CSSProperties, KeyboardEvent, ReactElement } from 'react';
|
|
2
2
|
import { PermissionAttr, OnDenied } from '../@types/PermissionAttr.js';
|
|
3
3
|
import { DataCombo } from '../@types/DataCombo.js';
|
|
4
|
-
import { IAdvancedFilterProps } from './select/types.js';
|
|
5
4
|
import { IBaseProps, CustomInputEvent } from './base/types.js';
|
|
5
|
+
import { IDrawerProps } from '../drawer/types.js';
|
|
6
6
|
import '../@types/Period.js';
|
|
7
|
+
import '../@types/Position.js';
|
|
7
8
|
|
|
9
|
+
interface IAdvancedFilterProps extends Omit<IDrawerProps, 'content'> {
|
|
10
|
+
onStateChange?: (value?: boolean) => void;
|
|
11
|
+
headerTitle?: string;
|
|
12
|
+
content?: ReactNode | ReactNode[];
|
|
13
|
+
}
|
|
8
14
|
interface ISearchProps extends IBaseProps {
|
|
9
15
|
resetButton?: boolean;
|
|
10
16
|
onReset?: (event?: CustomInputEvent) => void;
|
|
@@ -71,7 +77,7 @@ interface IMaskHOCProps {
|
|
|
71
77
|
handlerSetOnDenied?: (onDeniedValue: OnDenied) => void;
|
|
72
78
|
isNumeric?: boolean;
|
|
73
79
|
required?: boolean;
|
|
74
|
-
onKeyDown?: (e: KeyboardEvent<Element>) => void;
|
|
80
|
+
onKeyDown?: (e: CustomInputEvent | KeyboardEvent<Element>) => void;
|
|
75
81
|
rightElements?: JSX.Element | JSX.Element[];
|
|
76
82
|
labelUppercase?: boolean;
|
|
77
83
|
readOnly?: boolean;
|
|
@@ -82,17 +88,13 @@ interface IMaskHOCProps {
|
|
|
82
88
|
customClassForInputContent?: string;
|
|
83
89
|
customClassForLabel?: string;
|
|
84
90
|
textAlign?: string;
|
|
85
|
-
onBlur?: (e:
|
|
86
|
-
target: {
|
|
87
|
-
value: string;
|
|
88
|
-
name?: string;
|
|
89
|
-
};
|
|
90
|
-
}) => void;
|
|
91
|
+
onBlur?: (e: CustomInputEvent) => void;
|
|
91
92
|
leftElements?: JSX.Element | JSX.Element[];
|
|
92
93
|
rounded?: boolean;
|
|
93
94
|
errorMessages?: string[];
|
|
94
95
|
skeletonize?: boolean;
|
|
95
96
|
mask?: string | NumberConstructor;
|
|
97
|
+
isDateField?: boolean;
|
|
96
98
|
}
|
|
97
99
|
interface IDropdownSelectProps {
|
|
98
100
|
idKey: string;
|
|
@@ -101,7 +103,7 @@ interface IDropdownSelectProps {
|
|
|
101
103
|
showClearButton?: boolean;
|
|
102
104
|
handleOnSelect: (item?: DataCombo) => void;
|
|
103
105
|
handleOnFilter: (value: string) => void;
|
|
104
|
-
handleOnKeydown: (e: KeyboardEvent
|
|
106
|
+
handleOnKeydown: (e: CustomInputEvent | KeyboardEvent) => void;
|
|
105
107
|
handleOnBlur: (item: DataCombo) => void;
|
|
106
108
|
handleOnFocus: () => void;
|
|
107
109
|
opened: boolean;
|
|
@@ -143,4 +145,4 @@ interface IButtonsProps {
|
|
|
143
145
|
disabled?: boolean;
|
|
144
146
|
}
|
|
145
147
|
|
|
146
|
-
export { IActionButtonsSelectProps, IButtonsProps, IDropdownProps, IDropdownSelectProps, IInputHOCProps, IMaskHOCProps, ISearchProps };
|
|
148
|
+
export { IActionButtonsSelectProps, IAdvancedFilterProps, IButtonsProps, IDropdownProps, IDropdownSelectProps, IInputHOCProps, IMaskHOCProps, ISearchProps };
|