linear-react-components-ui 1.0.10-beta.10 → 1.0.10-beta.12
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/@types/Align.d.ts +2 -2
- package/lib/@types/ButtonTypes.d.ts +1 -1
- package/lib/@types/ColorStyles.d.ts +1 -1
- package/lib/@types/DataCombo.d.ts +1 -1
- package/lib/@types/Icon.d.ts +1 -1
- package/lib/@types/LabelStyles.d.ts +1 -1
- package/lib/@types/Period.d.ts +1 -1
- package/lib/@types/PermissionAttr.d.ts +2 -2
- package/lib/@types/PointerEvents.d.ts +1 -1
- package/lib/@types/Position.d.ts +1 -1
- package/lib/@types/PositionAlert.d.ts +1 -1
- package/lib/@types/Size.d.ts +1 -1
- package/lib/@types/SizePixels.d.ts +1 -1
- package/lib/alerts/AlertContainer.js +21 -5
- package/lib/alerts/AlertProvider.js +45 -15
- package/lib/alerts/BaseAlert.js +20 -4
- package/lib/alerts/Message.js +32 -21
- package/lib/alerts/alert.spec.js +133 -0
- package/lib/alerts/helpers.js +2 -0
- package/lib/alerts/index.d.ts +1 -4
- package/lib/alerts/index.js +4 -0
- package/lib/alerts/types.d.ts +4 -4
- package/lib/alerts/withAlert.js +12 -1
- package/lib/assets/styles/drawers.scss +0 -9
- package/lib/assets/styles/table.scss +0 -30
- package/lib/avatar/avatar.spec.js +190 -0
- package/lib/avatar/index.js +35 -20
- package/lib/badge/badge.spec.js +127 -0
- package/lib/badge/index.js +14 -9
- package/lib/buttons/ActivateButton.js +6 -0
- package/lib/buttons/AddButton.js +7 -0
- package/lib/buttons/Button.js +15 -2
- package/lib/buttons/ButtonGroups.js +4 -0
- package/lib/buttons/CancelButton.js +11 -1
- package/lib/buttons/DangerButton.js +11 -1
- package/lib/buttons/DefaultButton.js +85 -58
- package/lib/buttons/DestroyButton.js +12 -1
- package/lib/buttons/EditButton.js +6 -0
- package/lib/buttons/InactivateButton.js +6 -0
- package/lib/buttons/InfoButton.js +11 -1
- package/lib/buttons/PrimaryButton.js +11 -1
- package/lib/buttons/RestoreButton.js +6 -0
- package/lib/buttons/SaveButton.js +11 -1
- package/lib/buttons/SpinnerLoading.js +230 -0
- package/lib/buttons/SuccessButton.js +11 -1
- package/lib/buttons/WarningButton.js +11 -1
- package/lib/buttons/button_container/index.js +11 -5
- package/lib/buttons/buttons.spec.js +504 -0
- package/lib/buttons/index.d.ts +1 -4
- package/lib/buttons/index.js +18 -0
- package/lib/buttons/split_button/index.js +17 -11
- package/lib/buttons/types.d.ts +1 -2
- package/lib/calendar/DangerCalendar.js +11 -1
- package/lib/calendar/InfoCalendar.js +11 -1
- package/lib/calendar/PrimaryCalendar.js +11 -1
- package/lib/calendar/SuccessCalendar.js +11 -1
- package/lib/calendar/WarningCalendar.js +11 -1
- package/lib/calendar/base/Day.js +13 -2
- package/lib/calendar/base/Month.js +18 -1
- package/lib/calendar/base/Week.js +18 -2
- package/lib/calendar/base/helpers.js +24 -8
- package/lib/calendar/base/index.js +37 -13
- package/lib/calendar/calendar.spec.js +171 -0
- package/lib/calendar/index.d.ts +1 -4
- package/lib/calendar/index.js +8 -0
- package/lib/checkbox/Label.js +7 -1
- package/lib/checkbox/checkbox.spec.js +215 -0
- package/lib/checkbox/index.js +54 -28
- package/lib/checkbox/types.d.ts +2 -2
- package/lib/dialog/Alert.js +8 -0
- package/lib/dialog/Custom.js +17 -5
- package/lib/dialog/Error.js +8 -0
- package/lib/dialog/Information.js +8 -0
- package/lib/dialog/Question.js +15 -4
- package/lib/dialog/Warning.js +8 -0
- package/lib/dialog/base/Content.js +6 -1
- package/lib/dialog/base/Footer.js +4 -0
- package/lib/dialog/base/Header.js +13 -5
- package/lib/dialog/base/index.js +28 -7
- package/lib/dialog/base/style.js +2 -0
- package/lib/dialog/dialog.spec.js +488 -0
- package/lib/dialog/form/index.js +29 -9
- package/lib/dialog/index.d.ts +1 -4
- package/lib/dialog/index.js +9 -0
- package/lib/drawer/Content.js +13 -2
- package/lib/drawer/Drawer.d.ts +1 -1
- package/lib/drawer/Drawer.js +60 -44
- package/lib/drawer/Drawer.spec.js +258 -0
- package/lib/drawer/Header.js +27 -10
- package/lib/drawer/helpers.js +4 -0
- package/lib/drawer/index.js +8 -0
- package/lib/drawer/types.d.ts +0 -1
- package/lib/dropdown/Popup.js +32 -19
- package/lib/dropdown/dropdown.spec.js +169 -0
- package/lib/dropdown/helper.js +4 -0
- package/lib/dropdown/withDropdown.js +47 -18
- package/lib/fieldset/fieldset.spec.js +329 -0
- package/lib/fieldset/index.js +46 -21
- package/lib/form/Field.js +46 -20
- package/lib/form/FieldArray.js +32 -15
- package/lib/form/FieldNumber.d.ts +2 -2
- package/lib/form/FieldNumber.js +20 -6
- package/lib/form/FieldPeriod.js +21 -9
- package/lib/form/form.spec.js +293 -0
- package/lib/form/helpers.js +30 -5
- package/lib/form/index.d.ts +1 -2
- package/lib/form/index.js +92 -45
- package/lib/form/types.d.ts +11 -8
- package/lib/form/withFieldHOC.js +34 -15
- package/lib/form/withFormSecurity.js +29 -7
- package/lib/gridlayout/GridCol.js +11 -5
- package/lib/gridlayout/GridRow.js +9 -3
- package/lib/gridlayout/gridLayout.spec.js +169 -0
- package/lib/gridlayout/index.d.ts +1 -4
- package/lib/gridlayout/index.js +4 -0
- package/lib/hint/index.js +11 -6
- package/lib/icons/icons.spec.js +86 -0
- package/lib/icons/index.js +26 -16
- package/lib/icons/types.d.ts +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +10 -0
- package/lib/inputs/base/InputTextBase.js +75 -55
- package/lib/inputs/base/base.spec.js +690 -0
- package/lib/inputs/base/helpers.js +19 -6
- package/lib/inputs/base/index.js +1 -0
- package/lib/inputs/color/color_input.spec.js +174 -0
- package/lib/inputs/color/index.js +38 -11
- package/lib/inputs/date/Dialog.js +7 -2
- package/lib/inputs/date/Dropdown.js +8 -1
- package/lib/inputs/date/date.spec.js +354 -0
- package/lib/inputs/date/helpers.js +11 -2
- package/lib/inputs/date/index.js +101 -48
- package/lib/inputs/file/DefaultFile.js +42 -13
- package/lib/inputs/file/DragDropFile.js +90 -37
- package/lib/inputs/file/File.js +25 -4
- package/lib/inputs/file/FileButtonSettings.js +11 -5
- package/lib/inputs/file/helpers.js +5 -0
- package/lib/inputs/file/index.d.ts +1 -4
- package/lib/inputs/file/index.js +6 -0
- package/lib/inputs/file/types.d.ts +1 -1
- package/lib/inputs/inputHOC.js +34 -10
- package/lib/inputs/mask/BaseMask.js +17 -1
- package/lib/inputs/mask/Cnpj.js +37 -12
- package/lib/inputs/mask/Cpf.js +33 -10
- package/lib/inputs/mask/Phone.js +6 -0
- package/lib/inputs/mask/ZipCode.js +6 -0
- package/lib/inputs/mask/helpers.js +20 -8
- package/lib/inputs/mask/imaskHOC.js +84 -53
- package/lib/inputs/mask/index.d.ts +1 -4
- package/lib/inputs/mask/index.js +7 -0
- package/lib/inputs/mask/input_mask.spec.js +607 -0
- package/lib/inputs/multiSelect/ActionButtons.d.ts +1 -1
- package/lib/inputs/multiSelect/ActionButtons.js +13 -7
- package/lib/inputs/multiSelect/Dropdown.js +46 -23
- package/lib/inputs/multiSelect/helper.d.ts +6 -8
- package/lib/inputs/multiSelect/helper.js +5 -7
- package/lib/inputs/multiSelect/index.js +105 -44
- package/lib/inputs/multiSelect/types.d.ts +3 -11
- package/lib/inputs/number/BaseNumber.js +16 -3
- package/lib/inputs/number/Currency.js +7 -1
- package/lib/inputs/number/Decimal.js +5 -0
- package/lib/inputs/number/format_number.js +7 -0
- package/lib/inputs/number/index.js +13 -3
- package/lib/inputs/number/numberfield.spec.js +215 -0
- package/lib/inputs/period/Dialog.js +7 -2
- package/lib/inputs/period/Dropdown.js +7 -0
- package/lib/inputs/period/PeriodList.js +7 -1
- package/lib/inputs/period/helper.js +12 -2
- package/lib/inputs/period/index.js +120 -49
- package/lib/inputs/period/types.d.ts +3 -3
- package/lib/inputs/search/index.js +63 -18
- package/lib/inputs/search/search_input.spec.js +209 -0
- package/lib/inputs/select/ActionButtons.js +12 -4
- package/lib/inputs/select/Dropdown.js +49 -29
- package/lib/inputs/select/helper.d.ts +9 -4
- package/lib/inputs/select/helper.js +27 -20
- package/lib/inputs/select/index.js +23 -9
- package/lib/inputs/select/multiple/Selecteds.js +8 -4
- package/lib/inputs/select/multiple/index.js +106 -50
- package/lib/inputs/select/select.spec.js +395 -0
- package/lib/inputs/select/simple/index.js +123 -59
- package/lib/inputs/select/types.d.ts +8 -22
- package/lib/inputs/text/index.js +5 -1
- package/lib/inputs/text/textfield.spec.js +215 -0
- package/lib/inputs/text/types.d.ts +1 -1
- package/lib/inputs/textarea/index.js +10 -4
- package/lib/inputs/textarea/textarea.spec.js +59 -0
- package/lib/inputs/types.d.ts +1 -2
- package/lib/internals/withTooltip.js +70 -25
- package/lib/labelMessages/index.js +45 -25
- package/lib/labelMessages/labelMessages.spec.js +176 -0
- package/lib/labels/DangerLabel.js +11 -1
- package/lib/labels/DefaultLabel.js +41 -19
- package/lib/labels/InfoLabel.js +11 -1
- package/lib/labels/PrimaryLabel.js +11 -1
- package/lib/labels/SuccessLabel.js +11 -1
- package/lib/labels/WarningLabel.js +11 -1
- package/lib/labels/index.d.ts +1 -4
- package/lib/labels/index.js +10 -0
- package/lib/labels/label.spec.js +162 -0
- package/lib/labels/label_container/index.js +7 -3
- package/lib/list/Header.js +7 -3
- package/lib/list/Item.js +68 -33
- package/lib/list/Separator.js +4 -0
- package/lib/list/helpers.js +4 -0
- package/lib/list/index.js +60 -25
- package/lib/list/list.spec.js +769 -0
- package/lib/list/types.d.ts +1 -1
- package/lib/menus/float/MenuItem.js +26 -9
- package/lib/menus/float/SubMenuContainer.js +17 -5
- package/lib/menus/float/float-menu.spec.js +221 -0
- package/lib/menus/float/helpers.js +4 -0
- package/lib/menus/float/index.js +21 -8
- package/lib/menus/index.d.ts +1 -4
- package/lib/menus/index.js +3 -0
- package/lib/menus/sidenav/ExpandMenu.js +7 -2
- package/lib/menus/sidenav/MenuLink.js +12 -3
- package/lib/menus/sidenav/NavMenuGroup.js +12 -3
- package/lib/menus/sidenav/NavMenuItem.js +56 -27
- package/lib/menus/sidenav/NavSubMenuItem.js +27 -8
- package/lib/menus/sidenav/helpers.js +9 -0
- package/lib/menus/sidenav/index.js +75 -26
- package/lib/menus/sidenav/popup_menu_search/EmptyList.js +7 -2
- package/lib/menus/sidenav/popup_menu_search/index.js +45 -15
- package/lib/menus/sidenav/sidenav.spec.js +379 -0
- package/lib/menus/sidenav/types.d.ts +1 -1
- package/lib/noPermission/index.js +6 -0
- package/lib/panel/Content.d.ts +1 -1
- package/lib/panel/Content.js +22 -7
- package/lib/panel/DangerPanel.d.ts +1 -1
- package/lib/panel/DangerPanel.js +7 -0
- package/lib/panel/Default.d.ts +1 -1
- package/lib/panel/Default.js +44 -20
- package/lib/panel/Header.d.ts +1 -1
- package/lib/panel/Header.js +27 -12
- package/lib/panel/InfoPanel.d.ts +1 -1
- package/lib/panel/InfoPanel.js +7 -0
- package/lib/panel/PrimaryPanel.d.ts +1 -1
- package/lib/panel/PrimaryPanel.js +7 -0
- package/lib/panel/SuccessPanel.d.ts +1 -1
- package/lib/panel/SuccessPanel.js +7 -0
- package/lib/panel/ToolBar.d.ts +1 -1
- package/lib/panel/ToolBar.js +5 -0
- package/lib/panel/WarningPanel.d.ts +1 -1
- package/lib/panel/WarningPanel.js +7 -0
- package/lib/panel/helpers.d.ts +1 -1
- package/lib/panel/helpers.js +10 -2
- package/lib/panel/index.d.ts +2 -5
- package/lib/panel/index.js +11 -0
- package/lib/panel/panel.spec.js +216 -0
- package/lib/panel/types.d.ts +1 -1
- package/lib/permissionValidations.js +15 -3
- package/lib/popover/PopoverText.js +4 -0
- package/lib/popover/PopoverTitle.js +4 -0
- package/lib/popover/index.js +23 -12
- package/lib/popover/popover.spec.js +146 -0
- package/lib/progress/Bar.js +33 -20
- package/lib/progress/index.js +14 -5
- package/lib/progress/progress.spec.js +94 -0
- package/lib/radio/index.js +46 -23
- package/lib/radio/radio.spec.js +189 -0
- package/lib/skeleton/SkeletonContainer.js +9 -3
- package/lib/skeleton/index.js +22 -10
- package/lib/spinner/SpinnerLoading.js +7 -3
- package/lib/spinner/index.js +40 -18
- package/lib/spinner/spinner.spec.js +152 -0
- package/lib/split/Split.js +83 -32
- package/lib/split/SplitSide.js +18 -6
- package/lib/split/helpers.d.ts +1 -1
- package/lib/split/helpers.js +4 -0
- package/lib/split/index.d.ts +1 -4
- package/lib/split/index.js +5 -0
- package/lib/split/split.spec.js +163 -0
- package/lib/table/Body.js +29 -15
- package/lib/table/Header.js +26 -5
- package/lib/table/HeaderColumn.js +21 -10
- package/lib/table/Row.js +30 -37
- package/lib/table/RowColumn.js +29 -12
- package/lib/table/helpers.js +7 -0
- package/lib/table/index.js +62 -32
- package/lib/table/table.spec.js +352 -0
- package/lib/table/types.d.ts +1 -6
- package/lib/tabs/DropdownItems.js +21 -12
- package/lib/tabs/Menu.js +15 -5
- package/lib/tabs/MenuItems.js +33 -23
- package/lib/tabs/Panel.js +39 -14
- package/lib/tabs/index.js +113 -46
- package/lib/tabs/tabHelpers.js +16 -3
- package/lib/tabs/tabs.spec.js +321 -0
- package/lib/toolbar/ButtonBar.js +29 -13
- package/lib/toolbar/LabelBar.js +28 -11
- package/lib/toolbar/Separator.js +4 -0
- package/lib/toolbar/ToolBarGroup.js +6 -2
- package/lib/toolbar/helpers.js +2 -0
- package/lib/toolbar/index.js +23 -7
- package/lib/toolbar/toolbar.spec.js +394 -0
- package/lib/tooltip/index.js +25 -10
- package/lib/tooltip/tooltip.spec.js +215 -0
- package/lib/tooltip/types.d.ts +1 -1
- package/lib/treetable/Body.js +27 -9
- package/lib/treetable/Header.js +11 -1
- package/lib/treetable/Row.js +113 -58
- package/lib/treetable/helpers.js +10 -0
- package/lib/treetable/index.js +11 -0
- package/lib/treeview/Header.js +6 -2
- package/lib/treeview/Node.js +111 -47
- package/lib/treeview/constants.js +4 -0
- package/lib/treeview/index.js +134 -54
- package/lib/treeview/treeview.spec.js +279 -0
- package/lib/treeview/types.d.ts +2 -2
- package/lib/treeview_old/Header.js +6 -1
- package/lib/treeview_old/Node.js +32 -5
- package/lib/treeview_old/index.js +9 -1
- package/lib/{types-90c43ae1.d.ts → types-3c6f1c20.d.ts} +1 -1
- package/lib/uitour/index.js +73 -33
- package/lib/uitour/types.d.ts +1 -1
- package/lib/uitour/uitour.spec.js +176 -0
- package/package.json +1 -1
- package/demo/06c001f4d19c06397d470bb43ff3fe49.png +0 -0
- package/demo/270084ef02ed3bddc3f735fd91ee3cae.png +0 -0
- package/demo/882f8e819d18f5f2dc08d23ebd28a7d5.png +0 -0
- package/demo/bundle.js +0 -2
- package/demo/bundle.js.LICENSE.txt +0 -65
- package/demo/cbc3b4bd6342c551db7afafe26dc458c.jpg +0 -0
- package/demo/edc9476523b940deab91951066981a31.png +0 -0
- package/demo/fb44e7c36db6d95bb85a745d4f060fb2.png +0 -0
- package/demo/fonts/Roboto-Black.woff +0 -0
- package/demo/fonts/Roboto-Black.woff2 +0 -0
- package/demo/fonts/Roboto-Bold.woff +0 -0
- package/demo/fonts/Roboto-Bold.woff2 +0 -0
- package/demo/fonts/Roboto-Light.woff +0 -0
- package/demo/fonts/Roboto-Light.woff2 +0 -0
- package/demo/fonts/Roboto-Medium.woff +0 -0
- package/demo/fonts/Roboto-Medium.woff2 +0 -0
- package/demo/fonts/Roboto-Regular.woff +0 -0
- package/demo/fonts/Roboto-Regular.woff2 +0 -0
- package/demo/fonts/Roboto-Thin.woff +0 -0
- package/demo/fonts/Roboto-Thin.woff2 +0 -0
- package/demo/fonts/TitilliumWeb-Black.woff +0 -0
- package/demo/fonts/TitilliumWeb-Black.woff2 +0 -0
- package/demo/fonts/TitilliumWeb-Bold.woff +0 -0
- package/demo/fonts/TitilliumWeb-Bold.woff2 +0 -0
- package/demo/fonts/TitilliumWeb-ExtraLight.woff +0 -0
- package/demo/fonts/TitilliumWeb-ExtraLight.woff2 +0 -0
- package/demo/fonts/TitilliumWeb-Light.woff +0 -0
- package/demo/fonts/TitilliumWeb-Light.woff2 +0 -0
- package/demo/fonts/TitilliumWeb-Regular.woff +0 -0
- package/demo/fonts/TitilliumWeb-Regular.woff2 +0 -0
- package/demo/fonts/TitilliumWeb-SemiBold.woff +0 -0
- package/demo/fonts/TitilliumWeb-SemiBold.woff2 +0 -0
- package/demo/index.html +0 -1
package/lib/form/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
@@ -22,78 +23,99 @@ Object.defineProperty(exports, "FieldNumber", {
|
|
|
22
23
|
return _FieldNumber.default;
|
|
23
24
|
}
|
|
24
25
|
});
|
|
25
|
-
Object.defineProperty(exports, "FieldPeriod", {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function get() {
|
|
28
|
-
return _FieldPeriod.default;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
26
|
exports.default = void 0;
|
|
27
|
+
|
|
32
28
|
var _react = _interopRequireWildcard(require("react"));
|
|
29
|
+
|
|
33
30
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
31
|
+
|
|
34
32
|
var _helpers = require("./helpers");
|
|
33
|
+
|
|
35
34
|
var _Field = _interopRequireDefault(require("./Field"));
|
|
35
|
+
|
|
36
36
|
var _FieldNumber = _interopRequireDefault(require("./FieldNumber"));
|
|
37
|
+
|
|
37
38
|
var _FieldArray = _interopRequireDefault(require("./FieldArray"));
|
|
38
|
-
|
|
39
|
+
|
|
39
40
|
require("../assets/styles/form.scss");
|
|
41
|
+
|
|
40
42
|
var _dialog = require("../dialog");
|
|
43
|
+
|
|
41
44
|
var _withFormSecurity = require("./withFormSecurity");
|
|
45
|
+
|
|
42
46
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
47
|
+
|
|
43
48
|
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); }
|
|
49
|
+
|
|
44
50
|
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; }
|
|
45
|
-
|
|
46
|
-
function
|
|
47
|
-
|
|
51
|
+
|
|
52
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
53
|
+
|
|
48
54
|
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); }
|
|
55
|
+
|
|
49
56
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
57
|
+
|
|
50
58
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
59
|
+
|
|
51
60
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
61
|
+
|
|
52
62
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
63
|
+
|
|
53
64
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
65
|
+
|
|
54
66
|
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."); }
|
|
67
|
+
|
|
55
68
|
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); }
|
|
56
|
-
|
|
57
|
-
function
|
|
69
|
+
|
|
70
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
71
|
+
|
|
72
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
73
|
+
|
|
58
74
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
75
|
+
|
|
59
76
|
var Form = function Form(_ref) {
|
|
60
77
|
var _ref$submitOnPressEnt = _ref.submitOnPressEnterKey,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
submitOnPressEnterKey = _ref$submitOnPressEnt === void 0 ? true : _ref$submitOnPressEnt,
|
|
79
|
+
dataSource = _ref.dataSource,
|
|
80
|
+
securityBeforeUnload = _ref.securityBeforeUnload,
|
|
81
|
+
handlerReset = _ref.handlerReset,
|
|
82
|
+
handlerSubmit = _ref.handlerSubmit,
|
|
83
|
+
handlerValidates = _ref.handlerValidates,
|
|
84
|
+
style = _ref.style,
|
|
85
|
+
customClass = _ref.customClass,
|
|
86
|
+
securityTitle = _ref.securityTitle,
|
|
87
|
+
securityText = _ref.securityText,
|
|
88
|
+
onDataChange = _ref.onDataChange,
|
|
89
|
+
onValidateForm = _ref.onValidateForm,
|
|
90
|
+
externalFieldErrors = _ref.externalFieldErrors,
|
|
91
|
+
onSubmit = _ref.onSubmit,
|
|
92
|
+
skeletonize = _ref.skeletonize,
|
|
93
|
+
disabled = _ref.disabled,
|
|
94
|
+
children = _ref.children;
|
|
95
|
+
|
|
79
96
|
var _useState = (0, _react.useState)(dataSource),
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
97
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
98
|
+
data = _useState2[0],
|
|
99
|
+
setData = _useState2[1];
|
|
100
|
+
|
|
83
101
|
var _useState3 = (0, _react.useState)(dataSource),
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
102
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
103
|
+
originalData = _useState4[0],
|
|
104
|
+
setOriginalData = _useState4[1];
|
|
105
|
+
|
|
87
106
|
var _useState5 = (0, _react.useState)(submitOnPressEnterKey),
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
107
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
108
|
+
submitFormOnEnter = _useState6[0],
|
|
109
|
+
setSubmitFormOnEnter = _useState6[1];
|
|
110
|
+
|
|
91
111
|
var _useState7 = (0, _react.useState)({}),
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
112
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
113
|
+
fieldErrors = _useState8[0],
|
|
114
|
+
setFieldErrors = _useState8[1];
|
|
115
|
+
|
|
95
116
|
var fieldsValidators = (0, _react.useRef)({});
|
|
96
117
|
var context = (0, _react.useContext)(_withFormSecurity.FormSecurityContext);
|
|
118
|
+
|
|
97
119
|
var getValidatesErrorMessages = function getValidatesErrorMessages(validators, fieldValue) {
|
|
98
120
|
var validatorsArray = !(validators instanceof Array) ? [validators] : validators;
|
|
99
121
|
var errors = [];
|
|
@@ -105,66 +127,85 @@ var Form = function Form(_ref) {
|
|
|
105
127
|
});
|
|
106
128
|
return errors;
|
|
107
129
|
};
|
|
130
|
+
|
|
108
131
|
var checkIsValid = function checkIsValid(value) {
|
|
109
132
|
var updateState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
110
133
|
var dataValidate = value || data;
|
|
111
134
|
var currentFieldErrors = {};
|
|
135
|
+
|
|
112
136
|
_lodash.default.forEach(fieldsValidators.current, function (validators, fieldName) {
|
|
113
137
|
var fieldValue = _lodash.default.get(dataValidate, fieldName);
|
|
138
|
+
|
|
114
139
|
var messages = getValidatesErrorMessages(validators, fieldValue);
|
|
140
|
+
|
|
115
141
|
if (messages.length > 0) {
|
|
116
142
|
currentFieldErrors = _extends({}, fieldErrors, _defineProperty({}, fieldName, messages));
|
|
117
143
|
}
|
|
118
144
|
});
|
|
145
|
+
|
|
119
146
|
if (updateState) setFieldErrors(currentFieldErrors);
|
|
120
147
|
return _lodash.default.isEmpty(currentFieldErrors);
|
|
121
148
|
};
|
|
149
|
+
|
|
122
150
|
var onFieldChange = function onFieldChange(event) {
|
|
123
151
|
var target = event.target;
|
|
124
152
|
setData(function (prevState) {
|
|
125
153
|
return (0, _helpers.changeValue)(prevState, target);
|
|
126
154
|
});
|
|
127
155
|
};
|
|
156
|
+
|
|
128
157
|
var onValidate = function onValidate(fieldName, fieldValue, validators) {
|
|
129
158
|
if (validators) {
|
|
130
159
|
var currentFieldErrors = fieldErrors;
|
|
131
160
|
var errors = getValidatesErrorMessages(validators, fieldValue);
|
|
161
|
+
|
|
132
162
|
if (errors.length === 0) {
|
|
133
163
|
currentFieldErrors = _lodash.default.omit(currentFieldErrors, fieldName);
|
|
134
164
|
} else {
|
|
135
165
|
currentFieldErrors = _extends({}, currentFieldErrors, _defineProperty({}, fieldName, errors));
|
|
136
166
|
}
|
|
167
|
+
|
|
137
168
|
setFieldErrors(currentFieldErrors);
|
|
138
169
|
}
|
|
139
170
|
};
|
|
171
|
+
|
|
140
172
|
var onFormSubmit = function onFormSubmit(event) {
|
|
141
173
|
if (event) event.preventDefault();
|
|
142
174
|
if (checkIsValid(data)) onSubmit(data);
|
|
143
175
|
};
|
|
176
|
+
|
|
144
177
|
var onReset = function onReset() {
|
|
145
178
|
setData(JSON.parse(JSON.stringify(originalData)));
|
|
146
179
|
setFieldErrors({});
|
|
147
180
|
};
|
|
181
|
+
|
|
148
182
|
var onRemoveFieldValidators = function onRemoveFieldValidators(fieldName) {
|
|
149
183
|
var newFieldsValidators = _lodash.default.omit(fieldsValidators.current, fieldName);
|
|
184
|
+
|
|
150
185
|
fieldsValidators.current = newFieldsValidators;
|
|
151
186
|
};
|
|
187
|
+
|
|
152
188
|
var onBeforeUnload = function onBeforeUnload(e) {
|
|
153
189
|
var event = e;
|
|
154
190
|
event.preventDefault();
|
|
191
|
+
|
|
155
192
|
if (_lodash.default.isEqual(data, originalData)) {
|
|
156
193
|
return;
|
|
157
194
|
}
|
|
195
|
+
|
|
158
196
|
event.returnValue = true;
|
|
159
197
|
};
|
|
198
|
+
|
|
160
199
|
var submitOnEnter = function submitOnEnter(event) {
|
|
161
200
|
if (event.key === 'Enter') {
|
|
162
201
|
event.preventDefault();
|
|
163
202
|
if (submitFormOnEnter) onFormSubmit();
|
|
164
203
|
}
|
|
165
204
|
};
|
|
205
|
+
|
|
166
206
|
var formProps = function formProps() {
|
|
167
207
|
var propsForm = null;
|
|
208
|
+
|
|
168
209
|
if (!disabled) {
|
|
169
210
|
propsForm = {
|
|
170
211
|
onSubmit: function onSubmit(event) {
|
|
@@ -175,21 +216,25 @@ var Form = function Form(_ref) {
|
|
|
175
216
|
}
|
|
176
217
|
};
|
|
177
218
|
}
|
|
219
|
+
|
|
178
220
|
return propsForm;
|
|
179
221
|
};
|
|
222
|
+
|
|
180
223
|
(0, _react.useEffect)(function () {
|
|
181
224
|
if (!_lodash.default.isEmpty(context)) {
|
|
182
225
|
var onChangedData = context.onChangedData;
|
|
183
|
-
|
|
226
|
+
|
|
227
|
+
if (!_lodash.default.isEqual(data, originalData)) {
|
|
184
228
|
onChangedData(true);
|
|
185
229
|
} else {
|
|
186
230
|
onChangedData(false);
|
|
187
231
|
}
|
|
188
|
-
}
|
|
232
|
+
} // TODO - Usar debounce para evitar chamada a cada letra digitada
|
|
233
|
+
|
|
189
234
|
|
|
190
|
-
// TODO - Usar debounce para evitar chamada a cada letra digitada
|
|
191
235
|
if (onDataChange) onDataChange(data);
|
|
192
236
|
if (onValidateForm) onValidateForm(checkIsValid(data, false));
|
|
237
|
+
|
|
193
238
|
if (!disabled) {
|
|
194
239
|
handlerSubmit(onFormSubmit);
|
|
195
240
|
if (handlerReset) handlerReset(onReset);
|
|
@@ -201,6 +246,7 @@ var Form = function Form(_ref) {
|
|
|
201
246
|
if (context) context.setSecurityBeforeUnload(true);
|
|
202
247
|
window.addEventListener('beforeunload', onBeforeUnload);
|
|
203
248
|
}
|
|
249
|
+
|
|
204
250
|
return function () {
|
|
205
251
|
return window.removeEventListener('beforeunload', onBeforeUnload);
|
|
206
252
|
};
|
|
@@ -246,5 +292,6 @@ var Form = function Form(_ref) {
|
|
|
246
292
|
onUnconfirmClick: context ? context.onUnconfirmClick : function () {}
|
|
247
293
|
}));
|
|
248
294
|
};
|
|
295
|
+
|
|
249
296
|
var _default = Form;
|
|
250
297
|
exports.default = _default;
|
package/lib/form/types.d.ts
CHANGED
|
@@ -6,15 +6,15 @@ import '../@types/PermissionAttr.js';
|
|
|
6
6
|
import '../inputs/base/types.js';
|
|
7
7
|
import '../@types/Period.js';
|
|
8
8
|
|
|
9
|
-
type Validator = (value: string) => string | undefined;
|
|
10
|
-
type PeriodValidator = (value: {
|
|
9
|
+
declare type Validator = (value: string) => string | undefined;
|
|
10
|
+
declare type PeriodValidator = (value: {
|
|
11
11
|
initialData: string;
|
|
12
12
|
finalData: string;
|
|
13
13
|
}) => string | undefined;
|
|
14
|
-
type OnFielChangeEvent = Event & {
|
|
14
|
+
declare type OnFielChangeEvent = Event & {
|
|
15
15
|
target: HTMLInputElement;
|
|
16
16
|
};
|
|
17
|
-
type CustomKeyboardEvent = ChangeEvent<HTMLInputElement> & {
|
|
17
|
+
declare type CustomKeyboardEvent = ChangeEvent<HTMLInputElement> & {
|
|
18
18
|
keyCode: number;
|
|
19
19
|
};
|
|
20
20
|
interface IFormProps {
|
|
@@ -32,7 +32,6 @@ interface IFormProps {
|
|
|
32
32
|
securityBeforeUnload?: boolean;
|
|
33
33
|
securityTitle?: string;
|
|
34
34
|
securityText?: string;
|
|
35
|
-
securityData?: object;
|
|
36
35
|
externalFieldErrors?: object;
|
|
37
36
|
skeletonize?: boolean;
|
|
38
37
|
disabled?: boolean;
|
|
@@ -68,6 +67,10 @@ interface IFieldProps extends WithFieldProps {
|
|
|
68
67
|
allOptions?: AllOptions;
|
|
69
68
|
searchNotFoundText?: string;
|
|
70
69
|
}
|
|
70
|
+
interface IFieldNumberProps extends IFieldProps {
|
|
71
|
+
min?: number;
|
|
72
|
+
max?: number;
|
|
73
|
+
}
|
|
71
74
|
interface CustomEvent {
|
|
72
75
|
target: {
|
|
73
76
|
value: string[];
|
|
@@ -100,11 +103,11 @@ interface IFieldArrayProps extends WithFieldProps {
|
|
|
100
103
|
multiple?: boolean;
|
|
101
104
|
disabled?: boolean;
|
|
102
105
|
}
|
|
103
|
-
type PeriodChangeEvent = {
|
|
106
|
+
declare type PeriodChangeEvent = {
|
|
104
107
|
initial: string;
|
|
105
108
|
final: string;
|
|
106
109
|
};
|
|
107
|
-
type PeriodFieldChangeEvent = {
|
|
110
|
+
declare type PeriodFieldChangeEvent = {
|
|
108
111
|
target: {
|
|
109
112
|
name: string;
|
|
110
113
|
value: string;
|
|
@@ -180,4 +183,4 @@ interface IGetErrorMessagesParams {
|
|
|
180
183
|
externalMessagesErrors?: string[];
|
|
181
184
|
}
|
|
182
185
|
|
|
183
|
-
export { CustomEvent, CustomKeyboardEvent, FormContextProps, IEventParams, IFieldArrayProps, IFieldPeriodProps, IFieldProps, IFormProps, IFormSecurityContext, IGetErrorMessagesParams, IWithFieldContext, IWithFormSecurity, OnFielChangeEvent, PeriodChangeEvent, PeriodValidator, Validator, WithFieldProps };
|
|
186
|
+
export { CustomEvent, CustomKeyboardEvent, FormContextProps, IEventParams, IFieldArrayProps, IFieldNumberProps, IFieldPeriodProps, IFieldProps, IFormProps, IFormSecurityContext, IGetErrorMessagesParams, IWithFieldContext, IWithFormSecurity, OnFielChangeEvent, PeriodChangeEvent, PeriodValidator, Validator, WithFieldProps };
|
package/lib/form/withFieldHOC.js
CHANGED
|
@@ -1,35 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.default = void 0;
|
|
9
|
+
|
|
8
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
9
12
|
var _helpers = require("./helpers");
|
|
13
|
+
|
|
10
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); }
|
|
15
|
+
|
|
11
16
|
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; }
|
|
17
|
+
|
|
12
18
|
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); }
|
|
19
|
+
|
|
13
20
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
21
|
+
|
|
14
22
|
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."); }
|
|
23
|
+
|
|
15
24
|
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); }
|
|
16
|
-
|
|
17
|
-
function
|
|
25
|
+
|
|
26
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
27
|
+
|
|
28
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
29
|
+
|
|
18
30
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
31
|
+
|
|
19
32
|
var withFieldHOC = function withFieldHOC(WrappedComponent) {
|
|
20
33
|
var EnhancedComponent = function EnhancedComponent(props) {
|
|
21
34
|
var name = props.name,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
35
|
+
validators = props.validators,
|
|
36
|
+
handlerStoreValidators = props.handlerStoreValidators,
|
|
37
|
+
handlerRemoveValidators = props.handlerRemoveValidators;
|
|
38
|
+
|
|
25
39
|
var _useState = (0, _react.useState)(undefined),
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
40
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
41
|
+
validatorFromComponent = _useState2[0],
|
|
42
|
+
setValidatorFromComponent = _useState2[1];
|
|
43
|
+
|
|
29
44
|
var updateValidators = function updateValidators() {
|
|
30
45
|
var validatorsArray = (0, _helpers.getValidatorsArray)(validators, validatorFromComponent);
|
|
31
46
|
if (validatorsArray && handlerStoreValidators) handlerStoreValidators(name, validatorsArray);
|
|
32
47
|
};
|
|
48
|
+
|
|
33
49
|
(0, _react.useEffect)(function () {
|
|
34
50
|
updateValidators();
|
|
35
51
|
return function () {
|
|
@@ -48,16 +64,17 @@ var withFieldHOC = function withFieldHOC(WrappedComponent) {
|
|
|
48
64
|
value: contextValues
|
|
49
65
|
}, /*#__PURE__*/_react.default.createElement(WrappedComponent, props));
|
|
50
66
|
};
|
|
67
|
+
|
|
51
68
|
function forwardRef(props, ref) {
|
|
52
69
|
return /*#__PURE__*/_react.default.createElement(_helpers.FormContext.Consumer, null, function (_ref) {
|
|
53
70
|
var handlerFieldChange = _ref.handlerFieldChange,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
71
|
+
handlerFieldValidade = _ref.handlerFieldValidade,
|
|
72
|
+
data = _ref.data,
|
|
73
|
+
fieldErrors = _ref.fieldErrors,
|
|
74
|
+
externalFieldErrors = _ref.externalFieldErrors,
|
|
75
|
+
handlerStoreValidators = _ref.handlerStoreValidators,
|
|
76
|
+
handlerRemoveValidators = _ref.handlerRemoveValidators,
|
|
77
|
+
skeletonize = _ref.skeletonize;
|
|
61
78
|
return /*#__PURE__*/_react.default.createElement(EnhancedComponent, _extends({}, props, {
|
|
62
79
|
skeletonize: skeletonize,
|
|
63
80
|
handlerFieldChange: handlerFieldChange,
|
|
@@ -71,7 +88,9 @@ var withFieldHOC = function withFieldHOC(WrappedComponent) {
|
|
|
71
88
|
}));
|
|
72
89
|
});
|
|
73
90
|
}
|
|
91
|
+
|
|
74
92
|
return /*#__PURE__*/_react.default.forwardRef(forwardRef);
|
|
75
93
|
};
|
|
94
|
+
|
|
76
95
|
var _default = withFieldHOC;
|
|
77
96
|
exports.default = _default;
|
|
@@ -1,55 +1,75 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.default = exports.FormSecurityContext = void 0;
|
|
9
|
+
|
|
8
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
9
12
|
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); }
|
|
13
|
+
|
|
10
14
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
+
|
|
11
16
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
17
|
+
|
|
12
18
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
19
|
+
|
|
13
20
|
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."); }
|
|
21
|
+
|
|
14
22
|
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); }
|
|
15
|
-
|
|
16
|
-
function
|
|
23
|
+
|
|
24
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
25
|
+
|
|
26
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
27
|
+
|
|
17
28
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
29
|
+
|
|
18
30
|
var FormSecurityContext = /*#__PURE__*/_react.default.createContext({});
|
|
31
|
+
|
|
19
32
|
exports.FormSecurityContext = FormSecurityContext;
|
|
33
|
+
|
|
20
34
|
var withFormSecurity = function withFormSecurity(WrappedComponent) {
|
|
21
35
|
var EnhancedComponent = function EnhancedComponent(props) {
|
|
22
36
|
var handlerClose = props.handlerClose;
|
|
23
37
|
var changedData = (0, _react.useRef)(false);
|
|
24
38
|
var securityBeforeUnload = (0, _react.useRef)(false);
|
|
39
|
+
|
|
25
40
|
var _useState = (0, _react.useState)(false),
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
41
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
42
|
+
showQuestion = _useState2[0],
|
|
43
|
+
setShowQuestion = _useState2[1];
|
|
44
|
+
|
|
29
45
|
var newHandlerClose = function newHandlerClose() {
|
|
30
46
|
if (changedData.current && securityBeforeUnload.current) {
|
|
31
47
|
setShowQuestion(true);
|
|
32
48
|
} else if (handlerClose) handlerClose();
|
|
33
49
|
};
|
|
50
|
+
|
|
34
51
|
var onConfirmClick = function onConfirmClick() {
|
|
35
52
|
if (handlerClose) handlerClose();
|
|
36
53
|
};
|
|
54
|
+
|
|
37
55
|
var onUnconfirmClick = function onUnconfirmClick() {
|
|
38
56
|
setShowQuestion(false);
|
|
39
57
|
};
|
|
58
|
+
|
|
40
59
|
var onChangedData = function onChangedData(value) {
|
|
41
60
|
changedData.current = value;
|
|
42
61
|
};
|
|
62
|
+
|
|
43
63
|
var setSecurityBeforeUnload = function setSecurityBeforeUnload(value) {
|
|
44
64
|
securityBeforeUnload.current = value;
|
|
45
65
|
};
|
|
66
|
+
|
|
46
67
|
var contextValues = {
|
|
47
68
|
onChangedData: onChangedData,
|
|
48
69
|
showQuestion: showQuestion,
|
|
49
70
|
onConfirmClick: onConfirmClick,
|
|
50
71
|
onUnconfirmClick: onUnconfirmClick,
|
|
51
|
-
setSecurityBeforeUnload: setSecurityBeforeUnload
|
|
52
|
-
securityBeforeUnload: securityBeforeUnload.current
|
|
72
|
+
setSecurityBeforeUnload: setSecurityBeforeUnload
|
|
53
73
|
};
|
|
54
74
|
return /*#__PURE__*/_react.default.createElement(FormSecurityContext.Provider, {
|
|
55
75
|
value: contextValues
|
|
@@ -57,7 +77,9 @@ var withFormSecurity = function withFormSecurity(WrappedComponent) {
|
|
|
57
77
|
handlerClose: newHandlerClose
|
|
58
78
|
})));
|
|
59
79
|
};
|
|
80
|
+
|
|
60
81
|
return EnhancedComponent;
|
|
61
82
|
};
|
|
83
|
+
|
|
62
84
|
var _default = withFormSecurity;
|
|
63
85
|
exports.default = _default;
|
|
@@ -4,9 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
|
|
7
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
8
10
|
require("../assets/styles/gridlayout.scss");
|
|
11
|
+
|
|
9
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
10
14
|
var getClass = function getClass(col) {
|
|
11
15
|
var cols = col ? col.split(' ') : [];
|
|
12
16
|
var classes = 'grid-container ';
|
|
@@ -16,13 +20,14 @@ var getClass = function getClass(col) {
|
|
|
16
20
|
if (cols[3]) classes += " col-lg-".concat(cols[3]);
|
|
17
21
|
return classes;
|
|
18
22
|
};
|
|
23
|
+
|
|
19
24
|
var GridCol = function GridCol(props) {
|
|
20
25
|
var cols = props.cols,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
customClass = props.customClass,
|
|
27
|
+
children = props.children,
|
|
28
|
+
style = props.style,
|
|
29
|
+
_props$visible = props.visible,
|
|
30
|
+
visible = _props$visible === void 0 ? true : _props$visible;
|
|
26
31
|
var gridClasses = getClass(cols || '');
|
|
27
32
|
if (!visible) return null;
|
|
28
33
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -30,5 +35,6 @@ var GridCol = function GridCol(props) {
|
|
|
30
35
|
style: style
|
|
31
36
|
}, children);
|
|
32
37
|
};
|
|
38
|
+
|
|
33
39
|
var _default = GridCol;
|
|
34
40
|
exports.default = _default;
|
|
@@ -4,22 +4,28 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
|
|
7
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
8
10
|
require("../assets/styles/gridlayout.scss");
|
|
11
|
+
|
|
9
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
10
14
|
var getClass = function getClass(props) {
|
|
11
15
|
return "row ".concat(props.customClass, "\n ").concat(props.withTrim && ' -withtrim', "\n ").concat(props.verticalAlign && " align-".concat(props.verticalAlign), "\n ").concat(props.horizontalAlign && " justify-content-".concat(props.horizontalAlign));
|
|
12
16
|
};
|
|
17
|
+
|
|
13
18
|
var GridRow = function GridRow(props) {
|
|
14
19
|
var style = props.style,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
children = props.children,
|
|
21
|
+
_props$visible = props.visible,
|
|
22
|
+
visible = _props$visible === void 0 ? true : _props$visible;
|
|
18
23
|
if (!visible) return null;
|
|
19
24
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
20
25
|
style: style,
|
|
21
26
|
className: getClass(props)
|
|
22
27
|
}, children);
|
|
23
28
|
};
|
|
29
|
+
|
|
24
30
|
var _default = GridRow;
|
|
25
31
|
exports.default = _default;
|