linear-react-components-ui 1.1.24-beta.0 → 1.1.24-beta.10
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/BaseMask-0c14ef51.d.ts +24 -0
- package/lib/Cnpj-bde01dd0.d.ts +18 -0
- package/lib/Cpf-3fa496ad.d.ts +18 -0
- package/lib/Phone-2bb0b397.d.ts +18 -0
- package/lib/ZipCode-09460e18.d.ts +13 -0
- package/lib/alerts/AlertProvider.js +1 -2
- package/lib/alerts/BaseAlert.js +1 -1
- package/lib/alerts/Message.js +2 -3
- package/lib/alerts/withAlert.js +1 -2
- package/lib/assets/styles/calendar.scss +140 -35
- package/lib/assets/styles/datepicker2.scss +3 -9
- package/lib/assets/styles/file.scss +8 -0
- package/lib/assets/styles/filefield.scss +42 -0
- package/lib/assets/styles/numberfield.scss +18 -0
- package/lib/assets/styles/periodpicker.scss +1 -1
- package/lib/assets/styles/radiofield.scss +185 -0
- package/lib/assets/styles/selectfield.scss +1 -3
- package/lib/assets/styles/table.scss +6 -0
- package/lib/assets/styles/textfield.scss +61 -27
- package/lib/avatar/index.js +9 -11
- package/lib/badge/index.js +4 -4
- package/lib/buttons/Button.js +1 -2
- package/lib/buttons/DangerButton.js +1 -1
- package/lib/buttons/DefaultButton.js +22 -21
- package/lib/buttons/InfoButton.js +1 -1
- package/lib/buttons/PrimaryButton.js +1 -1
- package/lib/buttons/SuccessButton.js +1 -1
- package/lib/buttons/WarningButton.js +1 -1
- package/lib/buttons/button_container/index.js +1 -1
- package/lib/buttons/split_button/index.js +2 -2
- package/lib/calendar/base/helpers.js +2 -2
- package/lib/calendar/base/index.js +123 -44
- package/lib/checkbox/index.js +2 -3
- package/lib/dialog/Custom.js +2 -3
- package/lib/dialog/Question.js +5 -4
- package/lib/dialog/base/Content.js +5 -6
- package/lib/dialog/base/Header.js +3 -4
- package/lib/dialog/base/index.js +33 -23
- package/lib/dialog/form/index.js +52 -12
- package/lib/dialog/types.d.ts +4 -0
- package/lib/dialog/wizard/index.js +1 -2
- package/lib/dialog/wizard/progressbar.js +1 -1
- package/lib/dialog/wizard/step.js +1 -1
- package/lib/dialog/wizard/useWizard.js +1 -2
- package/lib/drawer/Content.js +1 -2
- package/lib/drawer/Drawer.js +6 -7
- package/lib/drawer/Header.js +2 -3
- package/lib/dropdown/Popup.js +7 -7
- package/lib/dropdown/helper.js +1 -1
- package/lib/dropdown/withDropdown.js +3 -4
- package/lib/fieldset/index.js +8 -9
- package/lib/form/Field.js +2 -3
- package/lib/form/FieldArray.js +2 -3
- package/lib/form/FieldNumber.js +4 -5
- package/lib/form/FieldPeriod.js +3 -4
- package/lib/form/index.js +3 -4
- package/lib/form/withFieldHOC.js +1 -2
- package/lib/form/withFormSecurity.js +1 -2
- package/lib/form2/helpers.js +1 -1
- package/lib/form2/index.d.ts +1 -1
- package/lib/form2/types.d.ts +7 -3
- package/lib/form2/useForm/index.js +22 -15
- package/lib/gridlayout/GridCol.js +5 -5
- package/lib/gridlayout/GridRow.js +1 -4
- package/lib/hint/index.js +1 -7
- package/lib/icons/helper.d.ts +16 -0
- package/lib/icons/helper.js +16 -0
- package/lib/icons/index.js +9 -9
- package/lib/index-208e7f62.d.ts +44 -0
- package/lib/index-3b70931d.d.ts +44 -0
- package/lib/index-442d51a2.d.ts +15 -0
- package/lib/index-4e511971.d.ts +26 -0
- package/lib/index-7dfa8924.d.ts +22 -0
- package/lib/index-9e576346.d.ts +23 -0
- package/lib/index-d3b6a19a.d.ts +41 -0
- package/lib/index-ecafc8c6.d.ts +30 -0
- package/lib/inputs/base/InputTextBase.js +9 -8
- package/lib/inputs/base/helpers.js +3 -7
- package/lib/inputs/base/types.d.ts +1 -1
- package/lib/inputs/color/index.js +2 -3
- package/lib/inputs/date/Dropdown.js +6 -4
- package/lib/inputs/date/index.js +34 -22
- package/lib/inputs/errorMessage/index.js +2 -3
- package/lib/inputs/file/DefaultFile.js +31 -31
- package/lib/inputs/file/DragDropFile.js +18 -17
- package/lib/inputs/file/File.js +6 -5
- package/lib/inputs/file/FileButtonSettings.js +0 -1
- package/lib/inputs/file/index.js +0 -1
- package/lib/inputs/inputHOC.js +1 -2
- package/lib/inputs/mask/BaseMask.js +1 -2
- package/lib/inputs/mask/Cnpj.js +1 -2
- package/lib/inputs/mask/Cpf.js +1 -2
- package/lib/inputs/multiSelect/ActionButtons.js +1 -2
- package/lib/inputs/multiSelect/Dropdown.js +11 -11
- package/lib/inputs/multiSelect/helper.js +2 -1
- package/lib/inputs/multiSelect/index.js +10 -9
- package/lib/inputs/number/BaseNumber.js +1 -1
- package/lib/inputs/number/index.js +3 -3
- package/lib/inputs/period/Dropdown.js +7 -4
- package/lib/inputs/period/PeriodList.js +3 -12
- package/lib/inputs/period/helper.js +1 -3
- package/lib/inputs/period/index.js +116 -113
- package/lib/inputs/period/types.d.ts +4 -1
- package/lib/inputs/search/index.js +8 -5
- package/lib/inputs/select/ActionButtons.js +1 -1
- package/lib/inputs/select/Dropdown.js +3 -4
- package/lib/inputs/select/helper.js +13 -10
- package/lib/inputs/select/multiple/Selecteds.js +2 -2
- package/lib/inputs/select/multiple/index.js +14 -11
- package/lib/inputs/select/simple/index.js +19 -13
- package/lib/inputs/textarea/index.js +1 -1
- package/lib/inputs/types.d.ts +1 -0
- package/lib/inputs2/checkboxfield/index.d.ts +1 -1
- package/lib/inputs2/checkboxfield/index.js +18 -15
- package/lib/inputs2/colorfield/index.d.ts +2 -2
- package/lib/inputs2/colorfield/index.js +5 -5
- package/lib/inputs2/date/base/constants.js +2 -1
- package/lib/inputs2/date/base/index.js +6 -8
- package/lib/inputs2/date/datefield/calendarbox.d.ts +1 -1
- package/lib/inputs2/date/datefield/calendarbox.js +3 -2
- package/lib/inputs2/date/datefield/context.d.ts +1 -0
- package/lib/inputs2/date/datefield/index.d.ts +1 -0
- package/lib/inputs2/date/datefield/index.js +44 -33
- package/lib/inputs2/date/datefield/triggers.js +1 -2
- package/lib/inputs2/date/datefield/types.d.ts +2 -0
- package/lib/inputs2/date/dateperiodfield/calendarbox.d.ts +1 -1
- package/lib/inputs2/date/dateperiodfield/calendarbox.js +8 -6
- package/lib/inputs2/date/dateperiodfield/context.d.ts +1 -0
- package/lib/inputs2/date/dateperiodfield/index.d.ts +1 -0
- package/lib/inputs2/date/dateperiodfield/index.js +66 -48
- package/lib/inputs2/date/dateperiodfield/triggers.js +19 -14
- package/lib/inputs2/date/dateperiodfield/types.d.ts +2 -0
- package/lib/inputs2/date/helpers.d.ts +1 -0
- package/lib/inputs2/date/types.d.ts +2 -1
- package/lib/inputs2/{number/Number.d.ts → filefield/index.d.ts} +2 -2
- package/lib/inputs2/filefield/index.js +174 -0
- package/lib/inputs2/index.d.ts +20 -14
- package/lib/inputs2/index.js +10 -11
- package/lib/inputs2/mask/BaseMask.d.ts +2 -2
- package/lib/inputs2/mask/BaseMask.js +7 -7
- package/lib/inputs2/mask/Cnpj.d.ts +3 -3
- package/lib/inputs2/mask/Cnpj.js +4 -5
- package/lib/inputs2/mask/Cpf.d.ts +3 -3
- package/lib/inputs2/mask/Cpf.js +4 -5
- package/lib/inputs2/mask/Phone.d.ts +3 -3
- package/lib/inputs2/mask/Phone.js +1 -2
- package/lib/inputs2/mask/ZipCode.d.ts +3 -3
- package/lib/inputs2/mask/ZipCode.js +1 -2
- package/lib/inputs2/numberfield/currency.d.ts +13 -0
- package/lib/inputs2/numberfield/currency.js +91 -0
- package/lib/inputs2/numberfield/decimal.d.ts +13 -0
- package/lib/inputs2/{number/BaseNumber.js → numberfield/decimal.js} +57 -58
- package/lib/inputs2/numberfield/helpers.d.ts +30 -0
- package/lib/inputs2/numberfield/helpers.js +53 -0
- package/lib/inputs2/numberfield/index.d.ts +12 -0
- package/lib/inputs2/numberfield/index.js +104 -0
- package/lib/inputs2/numberfield/types.d.ts +36 -0
- package/lib/inputs2/numberfield/types.js +5 -0
- package/lib/inputs2/{number/BaseNumber.d.ts → radiofield/index.d.ts} +4 -5
- package/lib/inputs2/radiofield/index.js +144 -0
- package/lib/inputs2/radiofield/types.d.ts +33 -0
- package/lib/inputs2/radiofield/types.js +5 -0
- package/lib/inputs2/selectfield/context.d.ts +1 -0
- package/lib/inputs2/selectfield/index.d.ts +2 -1
- package/lib/inputs2/selectfield/index.js +118 -58
- package/lib/inputs2/selectfield/item.d.ts +2 -1
- package/lib/inputs2/selectfield/item.js +8 -4
- package/lib/inputs2/selectfield/listbox.d.ts +1 -1
- package/lib/inputs2/selectfield/listbox.js +24 -10
- package/lib/inputs2/selectfield/options.d.ts +9 -0
- package/lib/inputs2/selectfield/options.js +26 -0
- package/lib/inputs2/selectfield/search.d.ts +1 -1
- package/lib/inputs2/selectfield/search.js +3 -4
- package/lib/inputs2/selectfield/selections.d.ts +1 -1
- package/lib/inputs2/selectfield/selections.js +3 -2
- package/lib/inputs2/selectfield/triggers.js +17 -8
- package/lib/inputs2/selectfield/types.d.ts +0 -1
- package/lib/inputs2/slot/index.d.ts +2 -2
- package/lib/inputs2/{number/Decimal.d.ts → textareafield/index.d.ts} +2 -5
- package/lib/inputs2/textareafield/index.js +194 -0
- package/lib/inputs2/textfield/index.d.ts +1 -1
- package/lib/inputs2/textfield/index.js +18 -17
- package/lib/labelMessages/index.js +4 -6
- package/lib/labels/DefaultLabel.js +2 -6
- package/lib/labels/label_container/index.js +1 -1
- package/lib/list/Header.js +1 -1
- package/lib/list/Item.js +10 -12
- package/lib/list/index.js +2 -4
- package/lib/menus/float/MenuItem.js +3 -4
- package/lib/menus/float/SubMenuContainer.js +2 -3
- package/lib/menus/float/index.js +1 -1
- package/lib/menus/sidenav/ExpandMenu.js +1 -1
- package/lib/menus/sidenav/MenuLink.js +1 -2
- package/lib/menus/sidenav/NavMenuGroup.js +2 -3
- package/lib/menus/sidenav/NavMenuItem.js +10 -9
- package/lib/menus/sidenav/NavSubMenuItem.js +2 -3
- package/lib/menus/sidenav/helpers.js +1 -1
- package/lib/menus/sidenav/index.js +6 -7
- package/lib/menus/sidenav/popup_menu_search/index.js +1 -2
- package/lib/panel/Content.js +9 -8
- package/lib/panel/Default.js +3 -4
- package/lib/panel/Header.js +4 -5
- package/lib/permissionValidations.js +1 -1
- package/lib/popover/PopoverText.js +1 -2
- package/lib/popover/index.js +2 -1
- package/lib/progress/Bar.js +6 -6
- package/lib/radio/index.js +3 -4
- package/lib/shortcuts/index.js +1 -1
- package/lib/skeleton/SkeletonContainer.js +1 -2
- package/lib/skeleton/index.js +1 -4
- package/lib/spinner/index.js +3 -4
- package/lib/split/Split.js +2 -3
- package/lib/split/SplitSide.js +4 -5
- package/lib/table/Body.js +4 -5
- package/lib/table/Header.js +9 -7
- package/lib/table/HeaderColumn.js +2 -3
- package/lib/table/Row.js +4 -5
- package/lib/table/RowColumn.js +2 -3
- package/lib/table/index.js +20 -16
- package/lib/table/types.d.ts +1 -0
- package/lib/tabs/DropdownTabs.js +2 -3
- package/lib/tabs/Menu.js +1 -1
- package/lib/tabs/MenuTabs.js +4 -9
- package/lib/tabs/Panel.js +8 -7
- package/lib/tabs/context.js +7 -5
- package/lib/tabs/index.js +1 -2
- package/lib/textContent/index.js +2 -3
- package/lib/toolbar/ButtonBar.js +2 -3
- package/lib/toolbar/LabelBar.js +1 -2
- package/lib/toolbar/index.js +1 -1
- package/lib/tooltip/TooltipContent.js +8 -9
- package/lib/tooltip/useTooltip.js +8 -8
- package/lib/treetable/Body.js +2 -3
- package/lib/treetable/Header.js +3 -4
- package/lib/treetable/Row.js +9 -10
- package/lib/treeview/Header.js +1 -1
- package/lib/treeview/Node.js +5 -6
- package/lib/treeview/index.js +5 -6
- package/lib/uitour/index.js +9 -8
- package/package.json +1 -1
- package/lib/BaseMask-3d5d581d.d.ts +0 -24
- package/lib/BaseNumber-797088d7.d.ts +0 -23
- package/lib/Cnpj-1602be21.d.ts +0 -18
- package/lib/Cpf-4d6b9079.d.ts +0 -18
- package/lib/Currency-b33d3a22.d.ts +0 -18
- package/lib/Decimal-55e836d5.d.ts +0 -13
- package/lib/Number-9c6aceff.d.ts +0 -20
- package/lib/Phone-79e5e3b4.d.ts +0 -18
- package/lib/ZipCode-8c2e9d8b.d.ts +0 -13
- package/lib/calendar/base/Day.d.ts +0 -8
- package/lib/calendar/base/Day.js +0 -36
- package/lib/calendar/base/Month.d.ts +0 -8
- package/lib/calendar/base/Month.js +0 -39
- package/lib/calendar/base/Week.d.ts +0 -8
- package/lib/calendar/base/Week.js +0 -35
- package/lib/index-18a64236.d.ts +0 -23
- package/lib/index-43ad8140.d.ts +0 -41
- package/lib/index-772f9f1a.d.ts +0 -44
- package/lib/index-8a59cf4b.d.ts +0 -23
- package/lib/inputs2/number/Currency.d.ts +0 -11
- package/lib/inputs2/number/Currency.js +0 -47
- package/lib/inputs2/number/Decimal.js +0 -36
- package/lib/inputs2/number/Number.js +0 -49
- package/lib/inputs2/number/format_number.d.ts +0 -5
- package/lib/inputs2/number/format_number.js +0 -29
|
@@ -8,24 +8,24 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _avatar = _interopRequireDefault(require("../../avatar"));
|
|
9
9
|
var _icons = _interopRequireDefault(require("../../icons"));
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
function
|
|
12
|
-
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; }
|
|
11
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
13
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; }
|
|
14
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; }
|
|
15
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; }
|
|
16
15
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
17
16
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
18
17
|
const returnDropdownDynamicStyles = (selectFieldRef, dropdownMaxHeight) => {
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
const
|
|
18
|
+
var _selectFieldRef$curre, _selectFieldRef$curre2, _selectFieldRef$curre3;
|
|
19
|
+
const selectFieldRects = selectFieldRef === null || selectFieldRef === void 0 ? void 0 : (_selectFieldRef$curre = selectFieldRef.current) === null || _selectFieldRef$curre === void 0 ? void 0 : _selectFieldRef$curre.getBoundingClientRect();
|
|
20
|
+
const bottom = selectFieldRects !== null && selectFieldRects !== void 0 && selectFieldRects.bottom ? selectFieldRects === null || selectFieldRects === void 0 ? void 0 : selectFieldRects.bottom : 0;
|
|
21
|
+
const offsetTop = selectFieldRef !== null && selectFieldRef !== void 0 && (_selectFieldRef$curre2 = selectFieldRef.current) !== null && _selectFieldRef$curre2 !== void 0 && _selectFieldRef$curre2.offsetTop ? selectFieldRef === null || selectFieldRef === void 0 ? void 0 : (_selectFieldRef$curre3 = selectFieldRef.current) === null || _selectFieldRef$curre3 === void 0 ? void 0 : _selectFieldRef$curre3.offsetTop : 0;
|
|
22
22
|
const dropdownBottomDistance = window.innerHeight - bottom;
|
|
23
23
|
let maxDropdownBottomDistance = 200;
|
|
24
24
|
let height = dropdownMaxHeight;
|
|
25
25
|
let dropdownPosition;
|
|
26
26
|
if (!height || height <= 0) {
|
|
27
27
|
if (dropdownBottomDistance < maxDropdownBottomDistance) {
|
|
28
|
-
height = selectFieldRects
|
|
28
|
+
height = selectFieldRects !== null && selectFieldRects !== void 0 && selectFieldRects.top ? selectFieldRects.top : 0;
|
|
29
29
|
dropdownPosition = window.innerHeight - offsetTop + 10;
|
|
30
30
|
} else {
|
|
31
31
|
height = dropdownBottomDistance;
|
|
@@ -37,8 +37,8 @@ const returnDropdownDynamicStyles = (selectFieldRef, dropdownMaxHeight) => {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
return {
|
|
40
|
-
maxHeight:
|
|
41
|
-
bottom:
|
|
40
|
+
maxHeight: "".concat(height - 30, "px"),
|
|
41
|
+
bottom: "".concat(dropdownPosition, "px")
|
|
42
42
|
};
|
|
43
43
|
};
|
|
44
44
|
const Dropdown = props => {
|
|
@@ -102,11 +102,11 @@ const Dropdown = props => {
|
|
|
102
102
|
customClass: "checkboxicon"
|
|
103
103
|
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
104
104
|
className: "label"
|
|
105
|
-
}, inputValue !== '' ? 'Selecionar todos pesquisados' : 'Selecionar Todos'))), dataCombo
|
|
105
|
+
}, inputValue !== '' ? 'Selecionar todos pesquisados' : 'Selecionar Todos'))), dataCombo === null || dataCombo === void 0 ? void 0 : dataCombo.map(item => {
|
|
106
106
|
const isChecked = selecteds ? selecteds.find(selected => selected[idKey] === item[idKey]) : undefined;
|
|
107
107
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
108
|
-
key:
|
|
109
|
-
className:
|
|
108
|
+
key: "dropdowmItem ".concat(item[idKey], "}"),
|
|
109
|
+
className: "item ".concat(isChecked && '-selected')
|
|
110
110
|
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
111
111
|
className: "menubutton",
|
|
112
112
|
tabIndex: -1,
|
|
@@ -11,10 +11,11 @@ const getFilteredDataCombo = _ref => {
|
|
|
11
11
|
inputText
|
|
12
12
|
} = _ref;
|
|
13
13
|
return dataSource.filter(item => {
|
|
14
|
+
var _descriptionKey;
|
|
14
15
|
if (typeof descriptionKey === 'string') {
|
|
15
16
|
return item[descriptionKey].toLowerCase().indexOf(inputText.toLowerCase()) > -1;
|
|
16
17
|
}
|
|
17
|
-
return descriptionKey(item)
|
|
18
|
+
return ((_descriptionKey = descriptionKey(item)) === null || _descriptionKey === void 0 ? void 0 : _descriptionKey.toLowerCase().indexOf(inputText.toLowerCase())) > -1;
|
|
18
19
|
});
|
|
19
20
|
};
|
|
20
21
|
var _default = exports.default = getFilteredDataCombo;
|
|
@@ -12,8 +12,7 @@ var _ActionButtons = _interopRequireDefault(require("./ActionButtons"));
|
|
|
12
12
|
var _Dropdown = _interopRequireDefault(require("./Dropdown"));
|
|
13
13
|
var _helper = _interopRequireDefault(require("./helper"));
|
|
14
14
|
require("../../assets/styles/multiSelect.scss");
|
|
15
|
-
function
|
|
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; }
|
|
15
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
17
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
17
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
19
18
|
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; }
|
|
@@ -33,7 +32,7 @@ const MultiSelectField = props => {
|
|
|
33
32
|
gridLayout,
|
|
34
33
|
dropdownAlignButton = 'left'
|
|
35
34
|
} = props;
|
|
36
|
-
const componentId =
|
|
35
|
+
const componentId = "multiSelect-component".concat(uuid.v1());
|
|
37
36
|
const [dataCombo, setDataCombo] = (0, _react.useState)(dataSource);
|
|
38
37
|
const [selecteds, setSelecteds] = (0, _react.useState)();
|
|
39
38
|
const [inputValue, setInputValue] = (0, _react.useState)('');
|
|
@@ -68,8 +67,8 @@ const MultiSelectField = props => {
|
|
|
68
67
|
};
|
|
69
68
|
const onMouseMove = event => {
|
|
70
69
|
const target = event.target;
|
|
71
|
-
if (target
|
|
72
|
-
const newInsideComponent = ['item', 'menubutton', 'filterinput', 'filtercontainer', 'label'].includes(target
|
|
70
|
+
if ((target === null || target === void 0 ? void 0 : target.className) === '') return;
|
|
71
|
+
const newInsideComponent = ['item', 'menubutton', 'filterinput', 'filtercontainer', 'label'].includes(target === null || target === void 0 ? void 0 : target.className);
|
|
73
72
|
setInsideComponent(newInsideComponent);
|
|
74
73
|
};
|
|
75
74
|
const onBlurComponent = e => {
|
|
@@ -109,10 +108,11 @@ const MultiSelectField = props => {
|
|
|
109
108
|
if (selectWrapper.current) setDropdownWidth(selectWrapper.current.clientWidth);
|
|
110
109
|
};
|
|
111
110
|
const onClickOutSide = event => {
|
|
111
|
+
var _componentRef$current;
|
|
112
112
|
const {
|
|
113
113
|
target
|
|
114
114
|
} = event;
|
|
115
|
-
if (target !== componentRef.current && !componentRef.current
|
|
115
|
+
if (target !== componentRef.current && !((_componentRef$current = componentRef.current) !== null && _componentRef$current !== void 0 && _componentRef$current.contains(target))) {
|
|
116
116
|
setOpened(false);
|
|
117
117
|
setDataCombo(dataSource);
|
|
118
118
|
setInputValue('');
|
|
@@ -138,7 +138,8 @@ const MultiSelectField = props => {
|
|
|
138
138
|
};
|
|
139
139
|
(0, _react.useEffect)(() => {
|
|
140
140
|
if (gridLayout) {
|
|
141
|
-
|
|
141
|
+
var _selectWrapper$curren;
|
|
142
|
+
const currentGridEl = (_selectWrapper$curren = selectWrapper.current) === null || _selectWrapper$curren === void 0 ? void 0 : _selectWrapper$curren.parentElement;
|
|
142
143
|
if (currentGridEl) setElementStyles(window.getComputedStyle(currentGridEl));
|
|
143
144
|
}
|
|
144
145
|
window.addEventListener('resize', onScreenResize);
|
|
@@ -152,10 +153,10 @@ const MultiSelectField = props => {
|
|
|
152
153
|
}, []);
|
|
153
154
|
(0, _react.useEffect)(() => {
|
|
154
155
|
if (dataSource && dataSource.length > 0) {
|
|
155
|
-
const newSelecteds = dataSource.filter(item => value
|
|
156
|
+
const newSelecteds = dataSource.filter(item => value === null || value === void 0 ? void 0 : value.includes(item[idKey]));
|
|
156
157
|
setSelecteds(newSelecteds);
|
|
157
158
|
}
|
|
158
|
-
}, [value
|
|
159
|
+
}, [value === null || value === void 0 ? void 0 : value.length, dataSource === null || dataSource === void 0 ? void 0 : dataSource.length]);
|
|
159
160
|
(0, _react.useEffect)(() => {
|
|
160
161
|
if (dataSource && dataCombo && !_lodash.default.isEqual(dataSource, dataCombo)) {
|
|
161
162
|
const newDataCombo = (0, _helper.default)(_objectSpread(_objectSpread({}, props), {}, {
|
|
@@ -68,7 +68,7 @@ const BaseNumber = _ref => {
|
|
|
68
68
|
});
|
|
69
69
|
return /*#__PURE__*/_react.default.createElement(_BaseMask.default, _extends({
|
|
70
70
|
mask: Number,
|
|
71
|
-
value: value
|
|
71
|
+
value: value !== null && value !== void 0 ? value : 0,
|
|
72
72
|
thousandsSeparator: ".",
|
|
73
73
|
radix: ",",
|
|
74
74
|
mapToRadix: ['.'],
|
|
@@ -22,8 +22,7 @@ var _Decimal = _interopRequireDefault(require("./Decimal"));
|
|
|
22
22
|
require("../../assets/styles/numbers.scss");
|
|
23
23
|
var _InputTextBase = _interopRequireDefault(require("../base/InputTextBase"));
|
|
24
24
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
25
|
-
function
|
|
26
|
-
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; }
|
|
25
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
27
26
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
28
27
|
const NumberField = props => {
|
|
29
28
|
const {
|
|
@@ -50,7 +49,8 @@ const NumberField = props => {
|
|
|
50
49
|
if (props.onChange) props.onChange(event);
|
|
51
50
|
};
|
|
52
51
|
(0, _react.useEffect)(() => {
|
|
53
|
-
|
|
52
|
+
var _value$toString;
|
|
53
|
+
setNumberValue((_value$toString = value === null || value === void 0 ? void 0 : value.toString()) !== null && _value$toString !== void 0 ? _value$toString : '');
|
|
54
54
|
}, [value]);
|
|
55
55
|
return /*#__PURE__*/_react.default.createElement(_InputTextBase.default, _extends({}, props, {
|
|
56
56
|
value: numberValue,
|
|
@@ -18,18 +18,21 @@ const Dropdown = props => {
|
|
|
18
18
|
const elementRef = (0, _react.useRef)(document.createElement('div'));
|
|
19
19
|
const width = inputDimensions && inputDimensions.width || CALENDAR_MIN_WIDTH;
|
|
20
20
|
(0, _react.useEffect)(() => {
|
|
21
|
+
var _containerRef$current;
|
|
21
22
|
elementRef.current.className = 'datepicker-component';
|
|
22
23
|
elementRef.current.style.width = String(width).concat('px');
|
|
23
|
-
elementRef.current.style.top = String(inputDimensions
|
|
24
|
-
containerRef.current
|
|
24
|
+
elementRef.current.style.top = String(inputDimensions === null || inputDimensions === void 0 ? void 0 : inputDimensions.bottom).concat('px');
|
|
25
|
+
(_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.appendChild(elementRef.current);
|
|
25
26
|
dropdownRef(elementRef.current);
|
|
26
27
|
return () => {
|
|
27
|
-
|
|
28
|
+
var _containerRef$current2;
|
|
29
|
+
(_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.removeChild(elementRef.current);
|
|
28
30
|
};
|
|
29
31
|
}, []);
|
|
30
32
|
(0, _react.useEffect)(() => {
|
|
33
|
+
var _props$inputDimension;
|
|
31
34
|
elementRef.current.style.width = String(width).concat('px');
|
|
32
|
-
elementRef.current.style.top = String(props.inputDimensions
|
|
35
|
+
elementRef.current.style.top = String((_props$inputDimension = props.inputDimensions) === null || _props$inputDimension === void 0 ? void 0 : _props$inputDimension.bottom).concat('px');
|
|
33
36
|
}, [props]);
|
|
34
37
|
return /*#__PURE__*/_reactDom.default.createPortal(children, elementRef.current);
|
|
35
38
|
};
|
|
@@ -38,24 +38,15 @@ const PeriodList = _ref => {
|
|
|
38
38
|
className: "dropdown-period"
|
|
39
39
|
}, periodOptions.map(item => {
|
|
40
40
|
const itemSelected = selected === item.id;
|
|
41
|
-
return /*#__PURE__*/_react.default.createElement("
|
|
42
|
-
|
|
41
|
+
return /*#__PURE__*/_react.default.createElement("button", {
|
|
42
|
+
key: String('item-').concat(item.id),
|
|
43
43
|
tabIndex: -1,
|
|
44
|
-
onKeyDown: () => {},
|
|
45
|
-
key: `item-${item.id}`,
|
|
46
44
|
className: (0, _helper.getDropdownItemCssClass)(itemSelected),
|
|
47
45
|
onClick: () => {
|
|
48
46
|
const dates = item.id !== 'custom' ? (0, _helper.CalcDatesByPeriod)(item.id) : null;
|
|
49
47
|
handleOnSelect(item.id, dates);
|
|
50
48
|
}
|
|
51
|
-
},
|
|
52
|
-
role: "button",
|
|
53
|
-
className: "menubutton",
|
|
54
|
-
tabIndex: -1,
|
|
55
|
-
onKeyPress: () => {}
|
|
56
|
-
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
57
|
-
className: "label"
|
|
58
|
-
}, item.label)));
|
|
49
|
+
}, item.label);
|
|
59
50
|
}));
|
|
60
51
|
};
|
|
61
52
|
var _default = exports.default = PeriodList;
|
|
@@ -12,9 +12,7 @@ const getCalendarDropdownStyle = _ref => {
|
|
|
12
12
|
leftPosition,
|
|
13
13
|
width
|
|
14
14
|
} = _ref;
|
|
15
|
-
return
|
|
16
|
-
left: ${leftPosition}px;
|
|
17
|
-
width:${width}px`;
|
|
15
|
+
return "top: ".concat(topPosition, "px;\n left: ").concat(leftPosition, "px;\n width:").concat(width, "px");
|
|
18
16
|
};
|
|
19
17
|
var _default = exports.default = getCalendarDropdownStyle;
|
|
20
18
|
const getDropdownItemCssClass = function () {
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
require("../../assets/styles/periodpicker.scss");
|
|
7
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
9
|
var _moment = _interopRequireDefault(require("moment"));
|
|
9
10
|
var _PeriodList = _interopRequireDefault(require("./PeriodList"));
|
|
@@ -16,13 +17,11 @@ var _Dialog = _interopRequireDefault(require("./Dialog"));
|
|
|
16
17
|
var _hint = _interopRequireDefault(require("../../hint"));
|
|
17
18
|
var _gridlayout = _interopRequireDefault(require("../../gridlayout"));
|
|
18
19
|
var helperBase = _interopRequireWildcard(require("../base/helpers"));
|
|
19
|
-
require("../../assets/styles/periodpicker.scss");
|
|
20
20
|
var _errorMessage = require("../errorMessage");
|
|
21
21
|
var _textContent = _interopRequireDefault(require("../../textContent"));
|
|
22
22
|
var _popover = _interopRequireDefault(require("../../popover"));
|
|
23
23
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
24
|
-
function
|
|
25
|
-
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; }
|
|
24
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
26
25
|
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; }
|
|
27
26
|
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; }
|
|
28
27
|
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; }
|
|
@@ -66,10 +65,12 @@ const PeriodPicker = props => {
|
|
|
66
65
|
const inputFinalRef = (0, _react.useRef)(null);
|
|
67
66
|
const calendarContainerRef = (0, _react.useRef)(null);
|
|
68
67
|
const onScreenResize = () => {
|
|
69
|
-
|
|
68
|
+
var _inputContainerRef$cu;
|
|
69
|
+
setInputDimensions(inputContainerRef === null || inputContainerRef === void 0 ? void 0 : (_inputContainerRef$cu = inputContainerRef.current) === null || _inputContainerRef$cu === void 0 ? void 0 : _inputContainerRef$cu.getBoundingClientRect());
|
|
70
70
|
};
|
|
71
71
|
const onBlurWithoutWrapper = event => {
|
|
72
|
-
|
|
72
|
+
var _wrapperBaseInputPeri;
|
|
73
|
+
const focusOnAnotherField = !((_wrapperBaseInputPeri = wrapperBaseInputPeriodRef.current) !== null && _wrapperBaseInputPeri !== void 0 && _wrapperBaseInputPeri.contains(event.relatedTarget));
|
|
73
74
|
if (!showCalendarInDialog && showCalendarValueInitial && focusOnAnotherField) {
|
|
74
75
|
setShowCalendarValueInitial(false);
|
|
75
76
|
}
|
|
@@ -87,98 +88,46 @@ const PeriodPicker = props => {
|
|
|
87
88
|
targetElement.focus();
|
|
88
89
|
if (showCalendarValueInitial) {
|
|
89
90
|
if (targetElement.id !== 'valueInitial') {
|
|
90
|
-
|
|
91
|
+
var _inputInitialRef$curr;
|
|
92
|
+
(_inputInitialRef$curr = inputInitialRef.current) === null || _inputInitialRef$curr === void 0 ? void 0 : _inputInitialRef$curr.focus();
|
|
91
93
|
}
|
|
92
94
|
setShowCalendarValueInitial(false);
|
|
93
95
|
}
|
|
94
96
|
if (showCalendarValueFinal) {
|
|
95
97
|
if (targetElement.id !== 'valueFinal') {
|
|
96
|
-
|
|
98
|
+
var _inputFinalRef$curren;
|
|
99
|
+
(_inputFinalRef$curren = inputFinalRef.current) === null || _inputFinalRef$curren === void 0 ? void 0 : _inputFinalRef$curren.focus();
|
|
97
100
|
}
|
|
98
101
|
setShowCalendarValueFinal(false);
|
|
99
102
|
}
|
|
100
103
|
if (showPeriodSelection) {
|
|
104
|
+
var _inputFinalRef$curren2;
|
|
101
105
|
setShowPeriodSelection(false);
|
|
102
|
-
inputFinalRef.current
|
|
106
|
+
(_inputFinalRef$curren2 = inputFinalRef.current) === null || _inputFinalRef$curren2 === void 0 ? void 0 : _inputFinalRef$curren2.focus();
|
|
103
107
|
setShowCalendarValueFinal(false);
|
|
104
108
|
}
|
|
105
109
|
}
|
|
106
|
-
if (calendarContainerRef.current && event && event.key && event.key === 'Tab') {
|
|
107
|
-
const buttonForNavigateCalendar = calendarContainerRef.current?.getElementsByClassName('navbutton');
|
|
108
|
-
const datePicked = calendarContainerRef.current?.getElementsByClassName('-selectedday');
|
|
109
|
-
const buttonDatePicked = datePicked[0].firstChild;
|
|
110
|
-
const buttonsForFocus = Array.from([...buttonForNavigateCalendar, buttonDatePicked]);
|
|
111
|
-
const firstElement = buttonsForFocus[0];
|
|
112
|
-
const lastElement = buttonsForFocus[buttonsForFocus.length - 1];
|
|
113
|
-
const calendarOpenedIsInitial = calendarContainerRef.current.id === 'valueInitial';
|
|
114
|
-
if (!event.shiftKey && showCalendarValueInitial && document.activeElement === inputInitialRef.current) {
|
|
115
|
-
event.preventDefault();
|
|
116
|
-
firstElement.focus();
|
|
117
|
-
}
|
|
118
|
-
if (event.shiftKey && calendarOpenedIsInitial && document.activeElement === firstElement) {
|
|
119
|
-
event.preventDefault();
|
|
120
|
-
inputInitialRef.current?.focus();
|
|
121
|
-
}
|
|
122
|
-
if (!event.shiftKey && calendarOpenedIsInitial && document.activeElement === lastElement) {
|
|
123
|
-
event.preventDefault();
|
|
124
|
-
inputFinalRef.current?.focus();
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
110
|
event.stopPropagation();
|
|
128
111
|
};
|
|
129
112
|
const keepPositionCalendarByScroll = () => {
|
|
130
|
-
|
|
113
|
+
var _inputContainerRef$cu2;
|
|
114
|
+
const inputDateDimensions = (_inputContainerRef$cu2 = inputContainerRef.current) === null || _inputContainerRef$cu2 === void 0 ? void 0 : _inputContainerRef$cu2.getBoundingClientRect();
|
|
131
115
|
const positionTop = inputDateDimensions && inputDateDimensions.bottom;
|
|
132
116
|
if (dropdownCalendarContainer && dropdownCalendarContainer.current && inputDateDimensions) {
|
|
133
117
|
dropdownCalendarContainer.current.style.top = String(positionTop).concat('px');
|
|
134
118
|
}
|
|
135
119
|
};
|
|
136
|
-
(0, _react.useEffect)(() => {
|
|
137
|
-
window.addEventListener('resize', onScreenResize);
|
|
138
|
-
document.addEventListener('scroll', keepPositionCalendarByScroll);
|
|
139
|
-
document.getElementById('modal-dialog-content')?.addEventListener('scroll', keepPositionCalendarByScroll);
|
|
140
|
-
if (inputContainerRef.current) onScreenResize();
|
|
141
|
-
if (inputInitialRef && inputInitialRef.current) inputInitialRef.current.id = idValueInitial;
|
|
142
|
-
if (inputFinalRef && inputFinalRef.current) inputFinalRef.current.id = idValueFinal;
|
|
143
|
-
return () => {
|
|
144
|
-
window.removeEventListener('resize', onScreenResize);
|
|
145
|
-
document.removeEventListener('scroll', keepPositionCalendarByScroll);
|
|
146
|
-
document.getElementById('modal-dialog-content')?.removeEventListener('scroll', keepPositionCalendarByScroll);
|
|
147
|
-
};
|
|
148
|
-
}, []);
|
|
149
|
-
(0, _react.useEffect)(() => {
|
|
150
|
-
document.addEventListener('keydown', onKeyDownPress);
|
|
151
|
-
return () => {
|
|
152
|
-
document.removeEventListener('keydown', onKeyDownPress);
|
|
153
|
-
};
|
|
154
|
-
}, [showCalendarValueFinal, showCalendarValueInitial, showPeriodSelection, calendarContainerRef.current]);
|
|
155
|
-
(0, _react.useEffect)(() => {
|
|
156
|
-
if (props.value && !((0, _moment.default)(props.value.initial).isSame(valueInitial) || (0, _moment.default)(props.value.final).isSame(valueFinal))) {
|
|
157
|
-
const {
|
|
158
|
-
initial: valueInitialProp,
|
|
159
|
-
final: valueFinalProp
|
|
160
|
-
} = props.value;
|
|
161
|
-
let newValueInitial;
|
|
162
|
-
let newValueFinal;
|
|
163
|
-
if ((0, _moment.default)(valueInitialProp, 'YYYY-MM-DD', true).isValid()) {
|
|
164
|
-
newValueInitial = (0, _moment.default)(valueInitialProp, 'YYYY-MM-DD');
|
|
165
|
-
}
|
|
166
|
-
if ((0, _moment.default)(valueFinalProp, 'YYYY-MM-DD', true).isValid()) {
|
|
167
|
-
newValueFinal = (0, _moment.default)(valueFinalProp, 'YYYY-MM-DD');
|
|
168
|
-
}
|
|
169
|
-
setValueInitial(newValueInitial);
|
|
170
|
-
setValueFinal(newValueFinal);
|
|
171
|
-
}
|
|
172
|
-
}, [props.value]);
|
|
173
120
|
const openCalendar = calendarName => {
|
|
174
121
|
if (calendarName === 'valueInitial') {
|
|
175
122
|
setCurrentTypeDate('valueInitial');
|
|
176
123
|
setShowCalendarValueFinal(false);
|
|
177
124
|
if (!showCalendarValueInitial) {
|
|
178
|
-
|
|
125
|
+
var _inputInitialRef$curr2;
|
|
126
|
+
(_inputInitialRef$curr2 = inputInitialRef.current) === null || _inputInitialRef$curr2 === void 0 ? void 0 : _inputInitialRef$curr2.focus();
|
|
179
127
|
if (showCalendarInDialog) {
|
|
180
128
|
setTimeout(() => {
|
|
181
|
-
|
|
129
|
+
var _currentDateButtonRef;
|
|
130
|
+
(_currentDateButtonRef = currentDateButtonRef.current) === null || _currentDateButtonRef === void 0 ? void 0 : _currentDateButtonRef.focus();
|
|
182
131
|
}, 100);
|
|
183
132
|
}
|
|
184
133
|
setShowCalendarValueInitial(true);
|
|
@@ -188,10 +137,12 @@ const PeriodPicker = props => {
|
|
|
188
137
|
setCurrentTypeDate('valueFinal');
|
|
189
138
|
setShowCalendarValueInitial(false);
|
|
190
139
|
if (!showCalendarValueFinal) {
|
|
191
|
-
|
|
140
|
+
var _inputFinalRef$curren3;
|
|
141
|
+
(_inputFinalRef$curren3 = inputFinalRef.current) === null || _inputFinalRef$curren3 === void 0 ? void 0 : _inputFinalRef$curren3.focus();
|
|
192
142
|
if (showCalendarInDialog) {
|
|
193
143
|
setTimeout(() => {
|
|
194
|
-
|
|
144
|
+
var _currentDateButtonRef2;
|
|
145
|
+
(_currentDateButtonRef2 = currentDateButtonRef.current) === null || _currentDateButtonRef2 === void 0 ? void 0 : _currentDateButtonRef2.focus();
|
|
195
146
|
}, 100);
|
|
196
147
|
}
|
|
197
148
|
setShowCalendarValueFinal(true);
|
|
@@ -203,27 +154,41 @@ const PeriodPicker = props => {
|
|
|
203
154
|
};
|
|
204
155
|
const closeCalendar = calendarName => {
|
|
205
156
|
if (calendarName === 'valueInitial') {
|
|
206
|
-
|
|
157
|
+
var _inputInitialRef$curr3;
|
|
158
|
+
(_inputInitialRef$curr3 = inputInitialRef.current) === null || _inputInitialRef$curr3 === void 0 ? void 0 : _inputInitialRef$curr3.focus();
|
|
207
159
|
}
|
|
208
160
|
if (calendarName === 'valueFinal') {
|
|
209
|
-
|
|
161
|
+
var _inputFinalRef$curren4;
|
|
162
|
+
(_inputFinalRef$curren4 = inputFinalRef.current) === null || _inputFinalRef$curren4 === void 0 ? void 0 : _inputFinalRef$curren4.focus();
|
|
210
163
|
}
|
|
211
164
|
setShowCalendarValueInitial(false);
|
|
212
165
|
setShowCalendarValueFinal(false);
|
|
213
166
|
};
|
|
167
|
+
const onDateChange = date => {
|
|
168
|
+
var _props$onChange;
|
|
169
|
+
const initial = date.initial ? date.initial.format('YYYY-MM-DD') : '';
|
|
170
|
+
const final = date.final ? date.final.format('YYYY-MM-DD') : '';
|
|
171
|
+
props === null || props === void 0 ? void 0 : (_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, undefined, '', {
|
|
172
|
+
initial,
|
|
173
|
+
final
|
|
174
|
+
});
|
|
175
|
+
};
|
|
214
176
|
const onCloseDateDialog = calendarName => {
|
|
215
177
|
setTimeout(() => {
|
|
216
178
|
if (calendarName === 'valueInitial') {
|
|
217
|
-
|
|
179
|
+
var _inputInitialRef$curr4;
|
|
180
|
+
(_inputInitialRef$curr4 = inputInitialRef.current) === null || _inputInitialRef$curr4 === void 0 ? void 0 : _inputInitialRef$curr4.focus();
|
|
218
181
|
setShowCalendarValueInitial(false);
|
|
219
182
|
}
|
|
220
183
|
if (calendarName === 'valueFinal') {
|
|
221
|
-
|
|
184
|
+
var _inputFinalRef$curren5;
|
|
185
|
+
(_inputFinalRef$curren5 = inputFinalRef.current) === null || _inputFinalRef$curren5 === void 0 ? void 0 : _inputFinalRef$curren5.focus();
|
|
222
186
|
setShowCalendarValueFinal(false);
|
|
223
187
|
}
|
|
224
188
|
if (calendarName === 'periodSelection') {
|
|
189
|
+
var _inputFinalRef$curren6;
|
|
225
190
|
setShowPeriodSelection(false);
|
|
226
|
-
inputFinalRef.current
|
|
191
|
+
(_inputFinalRef$curren6 = inputFinalRef.current) === null || _inputFinalRef$curren6 === void 0 ? void 0 : _inputFinalRef$curren6.focus();
|
|
227
192
|
setShowCalendarValueFinal(false);
|
|
228
193
|
}
|
|
229
194
|
}, 100);
|
|
@@ -238,12 +203,13 @@ const PeriodPicker = props => {
|
|
|
238
203
|
const onInputBlur = e => {
|
|
239
204
|
if (props.onBlur) props.onBlur(e);
|
|
240
205
|
};
|
|
241
|
-
const onInputChange =
|
|
206
|
+
const onInputChange = event => {
|
|
242
207
|
if (event) {
|
|
243
208
|
const {
|
|
244
|
-
name: changingAux
|
|
209
|
+
name: changingAux,
|
|
210
|
+
value
|
|
245
211
|
} = event.target;
|
|
246
|
-
if (value
|
|
212
|
+
if (String(value).trim().length === 0) {
|
|
247
213
|
if (changingAux === 'valueInitial') {
|
|
248
214
|
setValueInitial(undefined);
|
|
249
215
|
} else {
|
|
@@ -252,43 +218,24 @@ const PeriodPicker = props => {
|
|
|
252
218
|
}
|
|
253
219
|
}
|
|
254
220
|
};
|
|
255
|
-
const onDateChange = date => {
|
|
256
|
-
if (props.onChange) {
|
|
257
|
-
const initial = date.initial ? date.initial.format('YYYY-MM-DD') : '';
|
|
258
|
-
const final = date.final ? date.final.format('YYYY-MM-DD') : '';
|
|
259
|
-
props.onChange(undefined, '', {
|
|
260
|
-
initial,
|
|
261
|
-
final
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
};
|
|
265
221
|
const setValue = function (event, value) {
|
|
222
|
+
var _inputInitialRef$curr5, _inputFinalRef$curren7;
|
|
266
223
|
let shouldOpenDropdown = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
267
224
|
const valueDateName = event ? event.target.name : '';
|
|
268
225
|
const dateObj = (0, _moment.default)(value, 'DD/MM/YYYY');
|
|
269
|
-
if (showCalendarValueInitial) inputInitialRef.current
|
|
270
|
-
if (showCalendarValueFinal) inputFinalRef.current
|
|
271
|
-
if (valueDateName === '
|
|
272
|
-
setValueInitial(dateObj);
|
|
273
|
-
setValueFinal(valueInitial);
|
|
274
|
-
onDateChange({
|
|
275
|
-
initial: dateObj,
|
|
276
|
-
final: valueInitial
|
|
277
|
-
});
|
|
278
|
-
} else if (valueDateName === 'valueInitial' && valueFinal && dateObj.isAfter(valueFinal)) {
|
|
279
|
-
setValueInitial(valueFinal);
|
|
280
|
-
setValueFinal(dateObj);
|
|
281
|
-
onDateChange({
|
|
282
|
-
initial: valueFinal,
|
|
283
|
-
final: dateObj
|
|
284
|
-
});
|
|
285
|
-
} else if (valueDateName === 'valueInitial') {
|
|
226
|
+
if (showCalendarValueInitial) (_inputInitialRef$curr5 = inputInitialRef.current) === null || _inputInitialRef$curr5 === void 0 ? void 0 : _inputInitialRef$curr5.focus();
|
|
227
|
+
if (showCalendarValueFinal) (_inputFinalRef$curren7 = inputFinalRef.current) === null || _inputFinalRef$curren7 === void 0 ? void 0 : _inputFinalRef$curren7.focus();
|
|
228
|
+
if (valueDateName === 'valueInitial') {
|
|
286
229
|
setValueInitial(dateObj);
|
|
287
230
|
onDateChange({
|
|
288
231
|
initial: dateObj,
|
|
289
232
|
final: valueFinal
|
|
290
233
|
});
|
|
291
234
|
} else {
|
|
235
|
+
// if (valueFinal && valueInitial && moment(valueFinal).isBefore(moment(valueInitial))) {
|
|
236
|
+
// setValueInitial(valueFinal);
|
|
237
|
+
// setValueFinal(valueInitial);
|
|
238
|
+
// }
|
|
292
239
|
setValueFinal(dateObj);
|
|
293
240
|
onDateChange({
|
|
294
241
|
initial: valueInitial,
|
|
@@ -296,7 +243,8 @@ const PeriodPicker = props => {
|
|
|
296
243
|
});
|
|
297
244
|
}
|
|
298
245
|
if (valueDateName === 'valueInitial' && !valueFinal && shouldOpenDropdown) {
|
|
299
|
-
|
|
246
|
+
var _inputFinalRef$curren8;
|
|
247
|
+
(_inputFinalRef$curren8 = inputFinalRef.current) === null || _inputFinalRef$curren8 === void 0 ? void 0 : _inputFinalRef$curren8.focus();
|
|
300
248
|
setTimeout(() => setShowCalendarValueFinal(true), 100);
|
|
301
249
|
}
|
|
302
250
|
if (shouldCloseOnSelect) {
|
|
@@ -346,8 +294,9 @@ const PeriodPicker = props => {
|
|
|
346
294
|
}
|
|
347
295
|
};
|
|
348
296
|
const closePeriodSelection = () => {
|
|
297
|
+
var _inputFinalRef$curren9;
|
|
349
298
|
setShowPeriodSelection(false);
|
|
350
|
-
inputFinalRef.current
|
|
299
|
+
(_inputFinalRef$curren9 = inputFinalRef.current) === null || _inputFinalRef$curren9 === void 0 ? void 0 : _inputFinalRef$curren9.focus();
|
|
351
300
|
setShowCalendarValueFinal(false);
|
|
352
301
|
};
|
|
353
302
|
const getButtonSelectPeriod = (0, _react.useCallback)(() => {
|
|
@@ -380,8 +329,10 @@ const PeriodPicker = props => {
|
|
|
380
329
|
currentDateButton: buttonElement => currentDateButtonRef.current = buttonElement
|
|
381
330
|
});
|
|
382
331
|
const setPeriodDates = (selected, dates) => {
|
|
332
|
+
var _inputFinalRef$curren0;
|
|
383
333
|
if (selected === 'custom') {
|
|
384
|
-
|
|
334
|
+
var _inputInitialRef$curr6;
|
|
335
|
+
(_inputInitialRef$curr6 = inputInitialRef.current) === null || _inputInitialRef$curr6 === void 0 ? void 0 : _inputInitialRef$curr6.focus();
|
|
385
336
|
setValuePeriodSelection(selected);
|
|
386
337
|
setShowPeriodSelection(false);
|
|
387
338
|
return;
|
|
@@ -394,7 +345,7 @@ const PeriodPicker = props => {
|
|
|
394
345
|
if (shouldCloseOnSelect) {
|
|
395
346
|
setShowPeriodSelection(false);
|
|
396
347
|
}
|
|
397
|
-
inputFinalRef.current
|
|
348
|
+
(_inputFinalRef$curren0 = inputFinalRef.current) === null || _inputFinalRef$curren0 === void 0 ? void 0 : _inputFinalRef$curren0.focus();
|
|
398
349
|
setShowCalendarValueFinal(false);
|
|
399
350
|
};
|
|
400
351
|
const getCalendarInitial = () => {
|
|
@@ -452,6 +403,58 @@ const PeriodPicker = props => {
|
|
|
452
403
|
}
|
|
453
404
|
}, getPeriodSelection(valuePeriodSelection, setPeriodDates));
|
|
454
405
|
};
|
|
406
|
+
(0, _react.useEffect)(() => {
|
|
407
|
+
var _document$getElementB;
|
|
408
|
+
window.addEventListener('resize', onScreenResize);
|
|
409
|
+
document.addEventListener('scroll', keepPositionCalendarByScroll);
|
|
410
|
+
(_document$getElementB = document.getElementById('modal-dialog-content')) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.addEventListener('scroll', keepPositionCalendarByScroll);
|
|
411
|
+
if (inputContainerRef.current) onScreenResize();
|
|
412
|
+
if (inputInitialRef && inputInitialRef.current) inputInitialRef.current.id = idValueInitial;
|
|
413
|
+
if (inputFinalRef && inputFinalRef.current) inputFinalRef.current.id = idValueFinal;
|
|
414
|
+
return () => {
|
|
415
|
+
var _document$getElementB2;
|
|
416
|
+
window.removeEventListener('resize', onScreenResize);
|
|
417
|
+
document.removeEventListener('scroll', keepPositionCalendarByScroll);
|
|
418
|
+
(_document$getElementB2 = document.getElementById('modal-dialog-content')) === null || _document$getElementB2 === void 0 ? void 0 : _document$getElementB2.removeEventListener('scroll', keepPositionCalendarByScroll);
|
|
419
|
+
};
|
|
420
|
+
}, []);
|
|
421
|
+
(0, _react.useEffect)(() => {
|
|
422
|
+
document.addEventListener('keydown', onKeyDownPress);
|
|
423
|
+
return () => {
|
|
424
|
+
document.removeEventListener('keydown', onKeyDownPress);
|
|
425
|
+
};
|
|
426
|
+
}, [showCalendarValueFinal, showCalendarValueInitial, showPeriodSelection, calendarContainerRef.current]);
|
|
427
|
+
(0, _react.useEffect)(() => {
|
|
428
|
+
if (valueFinal && valueInitial && (0, _moment.default)(valueFinal).isBefore((0, _moment.default)(valueInitial))) {
|
|
429
|
+
setValueInitial(valueFinal);
|
|
430
|
+
setValueFinal(valueInitial);
|
|
431
|
+
} else if (props.onChange) {
|
|
432
|
+
const initial = valueInitial ? valueInitial.format('YYYY-MM-DD') : '';
|
|
433
|
+
const final = valueFinal ? valueFinal.format('YYYY-MM-DD') : '';
|
|
434
|
+
props.onChange(undefined, '', {
|
|
435
|
+
initial,
|
|
436
|
+
final
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
}, [valueInitial, valueFinal]);
|
|
440
|
+
(0, _react.useEffect)(() => {
|
|
441
|
+
if (props.value && !((0, _moment.default)(props.value.initial).isSame(valueInitial) || (0, _moment.default)(props.value.final).isSame(valueFinal))) {
|
|
442
|
+
const {
|
|
443
|
+
initial: valueInitialProp,
|
|
444
|
+
final: valueFinalProp
|
|
445
|
+
} = props.value;
|
|
446
|
+
let newValueInitial;
|
|
447
|
+
let newValueFinal;
|
|
448
|
+
if ((0, _moment.default)(valueInitialProp, 'YYYY-MM-DD', true).isValid()) {
|
|
449
|
+
newValueInitial = (0, _moment.default)(valueInitialProp, 'YYYY-MM-DD');
|
|
450
|
+
}
|
|
451
|
+
if ((0, _moment.default)(valueFinalProp, 'YYYY-MM-DD', true).isValid()) {
|
|
452
|
+
newValueFinal = (0, _moment.default)(valueFinalProp, 'YYYY-MM-DD');
|
|
453
|
+
}
|
|
454
|
+
setValueInitial(newValueInitial);
|
|
455
|
+
setValueFinal(newValueFinal);
|
|
456
|
+
}
|
|
457
|
+
}, [props.value]);
|
|
455
458
|
if (onDenied && onDenied.unvisible) return null;
|
|
456
459
|
const component = () => /*#__PURE__*/_react.default.createElement("div", {
|
|
457
460
|
ref: wrapperBaseInputPeriodRef,
|
|
@@ -469,7 +472,7 @@ const PeriodPicker = props => {
|
|
|
469
472
|
display: 'flex'
|
|
470
473
|
}
|
|
471
474
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
472
|
-
className:
|
|
475
|
+
className: "label ".concat(props.customClassForLabel, " ").concat(props.labelUppercase && ' -uppercase'),
|
|
473
476
|
style: {
|
|
474
477
|
alignSelf: 'center'
|
|
475
478
|
}
|
|
@@ -486,10 +489,10 @@ const PeriodPicker = props => {
|
|
|
486
489
|
width: 20
|
|
487
490
|
}
|
|
488
491
|
}, hint))), /*#__PURE__*/_react.default.createElement(_textContent.default, null)), /*#__PURE__*/_react.default.createElement("div", {
|
|
489
|
-
className:
|
|
492
|
+
className: "periodpicker-component ".concat(helperBase.getInputWrapperClass(_objectSpread(_objectSpread({}, props), {}, {
|
|
490
493
|
value: !valueInitial ? '' : (0, _moment.default)(valueInitial).format('DD/MM/YYYY'),
|
|
491
494
|
disabled: shouldDisable()
|
|
492
|
-
}))
|
|
495
|
+
}))),
|
|
493
496
|
ref: inputContainerRef
|
|
494
497
|
}, /*#__PURE__*/_react.default.createElement(_BaseMask.default, {
|
|
495
498
|
gridLayout: undefined,
|