intelicoreact 1.3.83 → 1.3.85
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/dist/Atomic/FormElements/ActionAlert/ActionAlert.js +9 -1
- package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.js +10 -1
- package/dist/Atomic/FormElements/Calendar/Calendar.js +24 -4
- package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.js +10 -1
- package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.js +14 -2
- package/dist/Atomic/FormElements/Datepicker/Datepicker.js +54 -5
- package/dist/Atomic/FormElements/Datepicker/components/Calendar.js +21 -3
- package/dist/Atomic/FormElements/Dropdown/Dropdown.js +144 -51
- package/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.js +7 -1
- package/dist/Atomic/FormElements/DropdownLiveSearch/DropdownLiveSearch.js +52 -11
- package/dist/Atomic/FormElements/FileLoader/FileLoader.js +15 -3
- package/dist/Atomic/FormElements/FileLoader/partial/LoadZone.js +29 -15
- package/dist/Atomic/FormElements/FileLoader/partial/LoadedContent.js +15 -5
- package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.js +26 -6
- package/dist/Atomic/FormElements/FileLoaderLocalGroup/FileLoaderLocalGroup.js +35 -19
- package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN.js +38 -9
- package/dist/Atomic/FormElements/Input/Input.js +57 -24
- package/dist/Atomic/FormElements/InputCalendar/InputCalendar.js +31 -4
- package/dist/Atomic/FormElements/InputColor/InputColor.js +14 -4
- package/dist/Atomic/FormElements/InputCurrency/InputCurrency.js +29 -6
- package/dist/Atomic/FormElements/InputDateRange/InputDateRange.js +43 -8
- package/dist/Atomic/FormElements/InputDateRange/components/DateInput.js +21 -3
- package/dist/Atomic/FormElements/InputDateRange/components/Datepicker.js +81 -58
- package/dist/Atomic/FormElements/InputDateRange/components/OpenedPart.js +41 -6
- package/dist/Atomic/FormElements/InputDateRange/components/SelectItem.js +8 -1
- package/dist/Atomic/FormElements/InputDateRange/dependencies.js +46 -16
- package/dist/Atomic/FormElements/InputLink/InputLink.js +23 -6
- package/dist/Atomic/FormElements/InputMask/InputCarretPosition.js +4 -0
- package/dist/Atomic/FormElements/InputMask/InputMask.js +208 -77
- package/dist/Atomic/FormElements/InputMask/functions.js +28 -2
- package/dist/Atomic/FormElements/InputMask2/InputMask2.js +119 -43
- package/dist/Atomic/FormElements/InputMask2/functions.js +28 -2
- package/dist/Atomic/FormElements/InputMask3/InputMask3.js +137 -44
- package/dist/Atomic/FormElements/InputMask3/functions.js +28 -2
- package/dist/Atomic/FormElements/InputWithAction/InputWithAction.js +17 -3
- package/dist/Atomic/FormElements/InputsRow/InputsRow.js +24 -5
- package/dist/Atomic/FormElements/Label/Label.js +9 -1
- package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.js +73 -35
- package/dist/Atomic/FormElements/MultiSelect/MultiSelect.js +15 -3
- package/dist/Atomic/FormElements/NumericInput/NumericInput.js +44 -23
- package/dist/Atomic/FormElements/RadioGroup/RadioGroup.js +17 -7
- package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.js +14 -3
- package/dist/Atomic/FormElements/RadioInput/RadioInput.js +10 -1
- package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.js +14 -3
- package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +23 -3
- package/dist/Atomic/FormElements/RangeInputs/RangeInputs.js +34 -17
- package/dist/Atomic/FormElements/RangeList/RangeList.js +25 -6
- package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.js +11 -1
- package/dist/Atomic/FormElements/RangeSlider/RangeSlider.js +72 -14
- package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.js +180 -53
- package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.js +10 -1
- package/dist/Atomic/FormElements/Switcher/Switcher.js +10 -1
- package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.js +13 -1
- package/dist/Atomic/FormElements/SwitcherHide/SwitcherHide.js +10 -1
- package/dist/Atomic/FormElements/SwitcherRadio/SwitcherRadio.js +17 -2
- package/dist/Atomic/FormElements/SwitcherRange/SwitcherRange.js +17 -3
- package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.js +11 -1
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.js +29 -6
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/partial/States.js +3 -2
- package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.js +12 -1
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js +151 -55
- package/dist/Atomic/FormElements/Text/Text.js +16 -10
- package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.js +9 -1
- package/dist/Atomic/FormElements/Textarea/Textarea.js +16 -3
- package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.js +35 -6
- package/dist/Atomic/FormElements/TieredCheckboxes/partial/AccordionWithCheckbox.js +13 -4
- package/dist/Atomic/FormElements/TimeRange/TimeRange.js +21 -7
- package/dist/Atomic/FormElements/UserContacts/UserContacts.js +35 -8
- package/dist/Atomic/FormElements/UserContacts/partial/defaultIcons.js +91 -0
- package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.js +18 -5
- package/dist/Atomic/FormElements/VariantsListRadio/partials/VariantsListRadioItem.js +10 -3
- package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.js +11 -3
- package/dist/Atomic/FormElements/WidgetPseudoTable/partial/constructor.js +2 -1
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.js +12 -5
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/partial/constructor.js +3 -3
- package/dist/Atomic/Layout/Header/Header.js +15 -3
- package/dist/Atomic/Layout/MainMenu/MainMenu.js +20 -3
- package/dist/Atomic/Layout/Spinner/Spinner.js +8 -1
- package/dist/Atomic/UI/Accordion/Accordion.js +19 -3
- package/dist/Atomic/UI/Accordion/AccordionItem.js +23 -9
- package/dist/Atomic/UI/AccordionTable/AccordionTable.js +32 -7
- package/dist/Atomic/UI/AccordionText/AccordionText.js +15 -3
- package/dist/Atomic/UI/AdvancedTag/AdvTag.js +21 -4
- package/dist/Atomic/UI/AdvancedTag/AdvancedTags.js +15 -3
- package/dist/Atomic/UI/Alert/Alert.js +19 -3
- package/dist/Atomic/UI/Arrow/Arrow.js +16 -3
- package/dist/Atomic/UI/Box/Box.js +9 -3
- package/dist/Atomic/UI/Button/Button.js +11 -2
- package/dist/Atomic/UI/ButtonsBar/ButtonsBar.js +10 -1
- package/dist/Atomic/UI/Chart/Chart.js +29 -4
- package/dist/Atomic/UI/Chart/partial/Chart.constants.js +19 -11
- package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.js +12 -1
- package/dist/Atomic/UI/Chart/partial/datasetSetters.js +34 -11
- package/dist/Atomic/UI/Chart/partial/optionsConstructor.js +56 -82
- package/dist/Atomic/UI/Chart/partial/optionsSetters.js +19 -15
- package/dist/Atomic/UI/Chart/partial/utils.js +20 -6
- package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.js +13 -3
- package/dist/Atomic/UI/DateTime/DateTime.js +14 -3
- package/dist/Atomic/UI/DebugContainer/DebugContainer.js +16 -4
- package/dist/Atomic/UI/DebugContainer/useDebugContainer.js +11 -3
- package/dist/Atomic/UI/DoubleString/DoubleString.js +17 -5
- package/dist/Atomic/UI/DynamicIcon/DynamicIcon.js +10 -3
- package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.js +52 -17
- package/dist/Atomic/UI/ExampleChartIntegration/partial/utils.js +29 -1
- package/dist/Atomic/UI/Hint/Hint.js +31 -5
- package/dist/Atomic/UI/Hint/Hint.scss +1 -3
- package/dist/Atomic/UI/Modal/Modal.js +28 -6
- package/dist/Atomic/UI/Modal/ModalHOC.js +9 -1
- package/dist/Atomic/UI/Modal/partials/ModalFooter.js +7 -1
- package/dist/Atomic/UI/Modal/partials/ModalTitle.js +8 -1
- package/dist/Atomic/UI/Modal/partials/useMobileModal.js +49 -32
- package/dist/Atomic/UI/ModalBackup/Modal.js +174 -0
- package/dist/Atomic/UI/ModalBackup/Modal.scss +333 -0
- package/dist/Atomic/UI/ModalBackup/ModalHOC.js +51 -0
- package/dist/Atomic/UI/ModalBackup/partials/ModalFooter.js +24 -0
- package/dist/Atomic/UI/ModalBackup/partials/ModalTitle.js +41 -0
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion.js +21 -6
- package/dist/Atomic/UI/NavLine/NavLine.js +55 -26
- package/dist/Atomic/UI/NavLine/Tabs.js +3 -2
- package/dist/Atomic/UI/PageTitle/PageTitle.js +10 -2
- package/dist/Atomic/UI/PieChart/PieChart.js +10 -1
- package/dist/Atomic/UI/Price/Price.js +8 -3
- package/dist/Atomic/UI/PriceRange/PriceRange.js +7 -1
- package/dist/Atomic/UI/ProgressLine/ProgressLine.js +16 -1
- package/dist/Atomic/UI/Status/Status.js +8 -1
- package/dist/Atomic/UI/Table/Partials/TdCell.js +29 -5
- package/dist/Atomic/UI/Table/Partials/TdHeader.js +11 -1
- package/dist/Atomic/UI/Table/Partials/TdRow.js +17 -5
- package/dist/Atomic/UI/Table/Partials/TdTitle.js +14 -3
- package/dist/Atomic/UI/Table/Table.js +12 -1
- package/dist/Atomic/UI/Table/TdTypes/TdActions.js +18 -2
- package/dist/Atomic/UI/Table/TdTypes/TdPriority.js +9 -1
- package/dist/Atomic/UI/Table/TdTypes/TdRange.js +4 -1
- package/dist/Atomic/UI/Table/TdTypes/TdWeight.js +13 -1
- package/dist/Atomic/UI/Tag/Tag.js +14 -3
- package/dist/Atomic/UI/TagList/TagList.js +35 -19
- package/dist/Atomic/UI/UserBox/UserBox.js +13 -1
- package/dist/Classes/AbortableFetch.js +93 -36
- package/dist/Classes/AnimatedHandler.js +7 -3
- package/dist/Classes/RESTAPI/index.js +44 -39
- package/dist/Classes/RESTAPI/partials/AbortableFetch.js +93 -35
- package/dist/Classes/RESTAPI/partials/ApiBase.js +9 -1
- package/dist/Classes/RESTAPI/partials/ApiRequestCreators.js +32 -24
- package/dist/Classes/RESTAPI/partials/ApiUtils.js +38 -29
- package/dist/Classes/RESTAPI/partials/CredentialsProcessing.js +44 -21
- package/dist/Classes/RESTAPI/partials/Utils.js +19 -6
- package/dist/Classes/RESTAPI/partials/_outerDependencies.js +6 -2
- package/dist/Classes/RESTAPI/partials/_utils.js +36 -13
- package/dist/Constants/index.constants.js +15 -8
- package/dist/Functions/Portal.js +16 -5
- package/dist/Functions/customEventListener.js +17 -4
- package/dist/Functions/fieldValueFormatters.js +83 -43
- package/dist/Functions/hooks/useFormFieldsChangesManager.js +26 -23
- package/dist/Functions/locale/createTranslator.js +9 -4
- package/dist/Functions/operations.js +22 -12
- package/dist/Functions/presets/inputMaskPresets.js +11 -9
- package/dist/Functions/presets/inputPresets.js +11 -8
- package/dist/Functions/presets/mobileKeyboardTypesPresets.js +9 -7
- package/dist/Functions/schemas.js +13 -6
- package/dist/Functions/useBodyScrollLock.js +6 -1
- package/dist/Functions/useClickOutside.js +4 -0
- package/dist/Functions/useDebounce.js +7 -2
- package/dist/Functions/useFieldFocus.js +18 -6
- package/dist/Functions/useFormTools/form-drivers/ArrayWithObjects.js +9 -0
- package/dist/Functions/useFormTools/form-drivers/ObjectWithIterableObjects.js +23 -12
- package/dist/Functions/useFormTools/form-drivers/ObjectWithNamedKeyObjects.js +15 -6
- package/dist/Functions/useFormTools/functions/General.js +28 -18
- package/dist/Functions/useFormTools/functions/RenderFields.js +11 -2
- package/dist/Functions/useFormTools/functions/usePrevious.js +5 -1
- package/dist/Functions/useFormTools/index.js +144 -85
- package/dist/Functions/useInputHighlightError.js +12 -3
- package/dist/Functions/useIsMobile.js +13 -7
- package/dist/Functions/useKeyPress/useHandleKeyPress.js +7 -1
- package/dist/Functions/useKeyPress/useKeyPress.js +9 -1
- package/dist/Functions/useLocalStorage.js +9 -1
- package/dist/Functions/useLocationParams.js +5 -4
- package/dist/Functions/useMediaQuery.js +9 -3
- package/dist/Functions/useMetaInfo.js +10 -3
- package/dist/Functions/useMouseUpOutside.js +3 -0
- package/dist/Functions/useOnlineStatus.js +9 -1
- package/dist/Functions/usePasswordChecker.js +20 -4
- package/dist/Functions/usePrevious.js +5 -1
- package/dist/Functions/useResize.js +10 -2
- package/dist/Functions/useScrollTo.js +7 -2
- package/dist/Functions/useToggle.js +5 -1
- package/dist/Functions/utils.js +131 -56
- package/dist/Molecular/CustomIcons/components/AffiliateNetworks.js +9 -2
- package/dist/Molecular/CustomIcons/components/AlertCircle.js +9 -2
- package/dist/Molecular/CustomIcons/components/AppStore.js +9 -2
- package/dist/Molecular/CustomIcons/components/Arrow.js +9 -2
- package/dist/Molecular/CustomIcons/components/ArrowDown.js +9 -2
- package/dist/Molecular/CustomIcons/components/ArrowLeft.js +9 -2
- package/dist/Molecular/CustomIcons/components/ArrowRight.js +9 -2
- package/dist/Molecular/CustomIcons/components/ArrowUp.js +9 -2
- package/dist/Molecular/CustomIcons/components/Bell.js +9 -2
- package/dist/Molecular/CustomIcons/components/Button.js +9 -2
- package/dist/Molecular/CustomIcons/components/Campaigns.js +9 -2
- package/dist/Molecular/CustomIcons/components/Check.js +9 -2
- package/dist/Molecular/CustomIcons/components/Check2.js +9 -2
- package/dist/Molecular/CustomIcons/components/ChevronDown.js +9 -2
- package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.js +9 -2
- package/dist/Molecular/CustomIcons/components/ChevronLeft.js +9 -2
- package/dist/Molecular/CustomIcons/components/ChevronRight.js +9 -2
- package/dist/Molecular/CustomIcons/components/ChevronUp.js +9 -2
- package/dist/Molecular/CustomIcons/components/ChevronUpDown.js +9 -2
- package/dist/Molecular/CustomIcons/components/Close.js +9 -2
- package/dist/Molecular/CustomIcons/components/ColumnsOrder.js +9 -2
- package/dist/Molecular/CustomIcons/components/Delete.js +9 -2
- package/dist/Molecular/CustomIcons/components/Edit.js +9 -2
- package/dist/Molecular/CustomIcons/components/Email.js +9 -2
- package/dist/Molecular/CustomIcons/components/FinturfLogo.js +9 -2
- package/dist/Molecular/CustomIcons/components/FinturfLogo2.js +9 -2
- package/dist/Molecular/CustomIcons/components/Flows.js +9 -2
- package/dist/Molecular/CustomIcons/components/Gift.js +9 -2
- package/dist/Molecular/CustomIcons/components/GoogleAuth.js +9 -2
- package/dist/Molecular/CustomIcons/components/GooglePlay.js +9 -2
- package/dist/Molecular/CustomIcons/components/HelpCircle.js +9 -2
- package/dist/Molecular/CustomIcons/components/HelpCircle2.js +9 -2
- package/dist/Molecular/CustomIcons/components/HelpCircleFilled.js +9 -2
- package/dist/Molecular/CustomIcons/components/Home.js +9 -2
- package/dist/Molecular/CustomIcons/components/Home2.js +9 -2
- package/dist/Molecular/CustomIcons/components/Key.js +9 -2
- package/dist/Molecular/CustomIcons/components/Landers.js +9 -2
- package/dist/Molecular/CustomIcons/components/Lock.js +9 -2
- package/dist/Molecular/CustomIcons/components/Mail.js +9 -2
- package/dist/Molecular/CustomIcons/components/Mastercard.js +9 -2
- package/dist/Molecular/CustomIcons/components/Minus.js +9 -2
- package/dist/Molecular/CustomIcons/components/Offers.js +9 -2
- package/dist/Molecular/CustomIcons/components/Pause.js +9 -2
- package/dist/Molecular/CustomIcons/components/PayPal.js +9 -2
- package/dist/Molecular/CustomIcons/components/PayPalLightLarge.js +9 -2
- package/dist/Molecular/CustomIcons/components/Phone.js +9 -2
- package/dist/Molecular/CustomIcons/components/Play.js +9 -2
- package/dist/Molecular/CustomIcons/components/Plus.js +9 -2
- package/dist/Molecular/CustomIcons/components/Profile.js +9 -2
- package/dist/Molecular/CustomIcons/components/QRCode.js +9 -2
- package/dist/Molecular/CustomIcons/components/Rectangle.js +9 -2
- package/dist/Molecular/CustomIcons/components/Revert.js +9 -2
- package/dist/Molecular/CustomIcons/components/Star.js +9 -2
- package/dist/Molecular/CustomIcons/components/Star2.js +9 -2
- package/dist/Molecular/CustomIcons/components/TrafficSources.js +9 -2
- package/dist/Molecular/CustomIcons/components/Trash.js +9 -2
- package/dist/Molecular/CustomIcons/components/TrashRed.js +9 -2
- package/dist/Molecular/CustomIcons/components/Triggers.js +9 -2
- package/dist/Molecular/CustomIcons/components/User.js +9 -2
- package/dist/Molecular/CustomIcons/components/Visa.js +9 -2
- package/dist/Molecular/CustomIcons/components/X.js +9 -2
- package/dist/Molecular/CustomIcons/index.js +122 -0
- package/dist/Molecular/FormElement/FormElement.js +12 -1
- package/dist/Molecular/FormWithDependOn/FormWithDependOn.js +31 -30
- package/dist/Molecular/FormWithDependOn/partials/_utils.js +12 -9
- package/dist/Molecular/InputAddress/InputAddress.js +114 -65
- package/dist/Molecular/InputPassword/InputPassword.js +19 -5
- package/dist/index.js +2 -0
- package/package.json +1 -1
|
@@ -4,16 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = ObjectWithIterableObjects;
|
|
7
|
+
|
|
7
8
|
function ObjectWithIterableObjects(_ref) {
|
|
8
9
|
let {
|
|
9
10
|
form,
|
|
10
11
|
setForm,
|
|
11
12
|
FormFields
|
|
12
13
|
} = _ref;
|
|
14
|
+
|
|
13
15
|
const joinData = function () {
|
|
14
16
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
15
17
|
args[_key] = arguments[_key];
|
|
16
18
|
}
|
|
19
|
+
|
|
17
20
|
const [mainArg] = args;
|
|
18
21
|
const MainArgProto = Array.isArray(mainArg) ? "Array" : typeof mainArg === "object" ? "Object" : undefined;
|
|
19
22
|
const template = Array.isArray(mainArg) ? [] : typeof mainArg === "object" ? {} : null;
|
|
@@ -26,8 +29,7 @@ function ObjectWithIterableObjects(_ref) {
|
|
|
26
29
|
return [...result, item];
|
|
27
30
|
}
|
|
28
31
|
} else if (MainArgProto === "Object") {
|
|
29
|
-
return {
|
|
30
|
-
...result,
|
|
32
|
+
return { ...result,
|
|
31
33
|
...item
|
|
32
34
|
};
|
|
33
35
|
} else {
|
|
@@ -35,6 +37,7 @@ function ObjectWithIterableObjects(_ref) {
|
|
|
35
37
|
}
|
|
36
38
|
}, template);
|
|
37
39
|
};
|
|
40
|
+
|
|
38
41
|
const getFieldData = key => {
|
|
39
42
|
if (Array.isArray(FormFields)) {
|
|
40
43
|
return FormFields[key] || FormFields.find(f => f.key === key);
|
|
@@ -44,14 +47,15 @@ function ObjectWithIterableObjects(_ref) {
|
|
|
44
47
|
return undefined;
|
|
45
48
|
}
|
|
46
49
|
};
|
|
50
|
+
|
|
47
51
|
const getFormFields = () => {
|
|
48
52
|
return form.fields || form;
|
|
49
53
|
};
|
|
54
|
+
|
|
50
55
|
const getFormField = key => {
|
|
51
56
|
// eslint-disable-next-line no-undef
|
|
52
57
|
if (FormProto === "Array") {
|
|
53
|
-
return getFormFields().find(field => field.key === key);
|
|
54
|
-
// eslint-disable-next-line no-undef
|
|
58
|
+
return getFormFields().find(field => field.key === key); // eslint-disable-next-line no-undef
|
|
55
59
|
} else if (FormProto === "Object") {
|
|
56
60
|
return Object.values(getFormFields()).find(field => field.key === key) || Object.keys(getFormFields()).reduce((result, field) => {
|
|
57
61
|
if (field === key) result = getFormFields()[field];
|
|
@@ -61,12 +65,12 @@ function ObjectWithIterableObjects(_ref) {
|
|
|
61
65
|
return undefined;
|
|
62
66
|
}
|
|
63
67
|
};
|
|
68
|
+
|
|
64
69
|
const setFormFields = data => {
|
|
65
70
|
const isFunction = typeof data === "function";
|
|
66
71
|
setForm(state => {
|
|
67
72
|
if (state.fields) {
|
|
68
|
-
return {
|
|
69
|
-
...state,
|
|
73
|
+
return { ...state,
|
|
70
74
|
fields: isFunction ? data(state.fields) : data
|
|
71
75
|
};
|
|
72
76
|
} else {
|
|
@@ -74,6 +78,7 @@ function ObjectWithIterableObjects(_ref) {
|
|
|
74
78
|
}
|
|
75
79
|
});
|
|
76
80
|
};
|
|
81
|
+
|
|
77
82
|
const setFormField = function (data) {
|
|
78
83
|
let key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
79
84
|
const isFunction = typeof data === "function";
|
|
@@ -85,8 +90,10 @@ function ObjectWithIterableObjects(_ref) {
|
|
|
85
90
|
};
|
|
86
91
|
result.item = fields[key] || fields.find(f => f.key === key);
|
|
87
92
|
if (!result.item) return result;
|
|
93
|
+
|
|
88
94
|
if (Array.isArray(fields)) {
|
|
89
95
|
const index = parseInt(key, 10);
|
|
96
|
+
|
|
90
97
|
if (!isNaN(index)) {
|
|
91
98
|
result.fields.splice(key, 1);
|
|
92
99
|
} else {
|
|
@@ -97,43 +104,47 @@ function ObjectWithIterableObjects(_ref) {
|
|
|
97
104
|
let {
|
|
98
105
|
key: fKey
|
|
99
106
|
} = _ref2;
|
|
107
|
+
|
|
100
108
|
if (key !== fKey) {
|
|
101
109
|
object[key] = fields[key];
|
|
102
110
|
}
|
|
111
|
+
|
|
103
112
|
return object;
|
|
104
113
|
}, {});
|
|
105
114
|
}
|
|
115
|
+
|
|
106
116
|
return result;
|
|
107
117
|
};
|
|
118
|
+
|
|
108
119
|
const update = fields => {
|
|
109
120
|
//KEY is NULLable
|
|
110
121
|
if (!key) {
|
|
111
122
|
return data.key ? Object.values(fields).reduce((result, field, i) => {
|
|
112
123
|
const index = fields[field.key] ? field.key : i;
|
|
113
|
-
return {
|
|
114
|
-
...result,
|
|
124
|
+
return { ...result,
|
|
115
125
|
[index]: data.key === field.key ? isFunction ? data(field) : data : field
|
|
116
126
|
};
|
|
117
|
-
}, {}) : {
|
|
118
|
-
...fields,
|
|
127
|
+
}, {}) : { ...fields,
|
|
119
128
|
[fields.length || 0]: isFunction ? data({}) : data
|
|
120
129
|
};
|
|
121
130
|
}
|
|
131
|
+
|
|
122
132
|
const {
|
|
123
133
|
fields: filtered,
|
|
124
134
|
item: field
|
|
125
135
|
} = pop(fields, key);
|
|
126
|
-
const updatedField = isFunction ? data(field || {}) : {
|
|
127
|
-
...field,
|
|
136
|
+
const updatedField = isFunction ? data(field || {}) : { ...field,
|
|
128
137
|
...data
|
|
129
138
|
};
|
|
130
139
|
return joinData(filtered, fields[key] ? {
|
|
131
140
|
[key]: updatedField
|
|
132
141
|
} : updatedField);
|
|
133
142
|
};
|
|
143
|
+
|
|
134
144
|
return update(fields);
|
|
135
145
|
});
|
|
136
146
|
};
|
|
147
|
+
|
|
137
148
|
return {
|
|
138
149
|
joinData,
|
|
139
150
|
getFieldData,
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.default = ObjectWithNamedKeyObjects;
|
|
9
|
+
|
|
8
10
|
var _General = _interopRequireDefault(require("../functions/General"));
|
|
11
|
+
|
|
9
12
|
const noop = () => {};
|
|
13
|
+
|
|
10
14
|
function ObjectWithNamedKeyObjects() {
|
|
11
15
|
let {
|
|
12
16
|
form,
|
|
@@ -23,20 +27,22 @@ function ObjectWithNamedKeyObjects() {
|
|
|
23
27
|
} = (0, _General.default)({
|
|
24
28
|
FormFields
|
|
25
29
|
});
|
|
30
|
+
|
|
26
31
|
const getFormField = function (key) {
|
|
27
32
|
var _Object$values, _Object$keys;
|
|
33
|
+
|
|
28
34
|
let argForm = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : form;
|
|
29
35
|
return ((_Object$values = Object.values(getFormFields(argForm))) === null || _Object$values === void 0 ? void 0 : _Object$values.find(field => (field === null || field === void 0 ? void 0 : field.key) === key)) || ((_Object$keys = Object.keys(getFormFields(argForm))) === null || _Object$keys === void 0 ? void 0 : _Object$keys.reduce((result, field) => {
|
|
30
36
|
if (field === key) result = getFormFields(argForm)[field];
|
|
31
37
|
return result;
|
|
32
38
|
}, null));
|
|
33
39
|
};
|
|
40
|
+
|
|
34
41
|
const setFormFields = data => {
|
|
35
42
|
const isFunction = typeof data === "function";
|
|
36
43
|
setForm(state => {
|
|
37
44
|
if (state.fields) {
|
|
38
|
-
return {
|
|
39
|
-
...state,
|
|
45
|
+
return { ...state,
|
|
40
46
|
fields: isFunction ? data(state.fields) : data
|
|
41
47
|
};
|
|
42
48
|
} else {
|
|
@@ -44,22 +50,25 @@ function ObjectWithNamedKeyObjects() {
|
|
|
44
50
|
}
|
|
45
51
|
});
|
|
46
52
|
};
|
|
53
|
+
|
|
47
54
|
const setFormField = function (data) {
|
|
48
55
|
let key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
49
56
|
return setFormFields(fields => updateFormField(fields, data, key));
|
|
50
57
|
};
|
|
58
|
+
|
|
51
59
|
const removeAllFormFields = () => setFormFields({});
|
|
52
|
-
|
|
53
|
-
|
|
60
|
+
|
|
61
|
+
const removeFormField = key => setFormFields(state => Object.keys(state).filter(fKey => fKey !== key).reduce((obj, key) => ({ ...obj,
|
|
54
62
|
[key]: state[key]
|
|
55
63
|
}), {}));
|
|
64
|
+
|
|
56
65
|
const removeFormFields = _ref => {
|
|
57
66
|
let [...keys] = _ref;
|
|
58
|
-
return setFormFields(state => Object.keys(state).filter(fKey => !keys.includes(fKey)).reduce((obj, key) => ({
|
|
59
|
-
...obj,
|
|
67
|
+
return setFormFields(state => Object.keys(state).filter(fKey => !keys.includes(fKey)).reduce((obj, key) => ({ ...obj,
|
|
60
68
|
[key]: state[key]
|
|
61
69
|
}), {}));
|
|
62
70
|
};
|
|
71
|
+
|
|
63
72
|
return {
|
|
64
73
|
joinData,
|
|
65
74
|
getFieldData,
|
|
@@ -4,15 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = General;
|
|
7
|
+
|
|
7
8
|
function General() {
|
|
8
9
|
let {
|
|
9
10
|
form,
|
|
10
11
|
FormFields = []
|
|
11
12
|
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
13
|
+
|
|
12
14
|
const joinData = function () {
|
|
13
15
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
14
16
|
args[_key] = arguments[_key];
|
|
15
17
|
}
|
|
18
|
+
|
|
16
19
|
const [mainArg] = args;
|
|
17
20
|
const MainArgProto = Array.isArray(mainArg) ? "Array" : typeof mainArg === "object" ? "Object" : undefined;
|
|
18
21
|
const template = Array.isArray(mainArg) ? [] : typeof mainArg === "object" ? {} : null;
|
|
@@ -25,8 +28,7 @@ function General() {
|
|
|
25
28
|
return [...result, item];
|
|
26
29
|
}
|
|
27
30
|
} else if (MainArgProto === "Object") {
|
|
28
|
-
return {
|
|
29
|
-
...result,
|
|
31
|
+
return { ...result,
|
|
30
32
|
...item
|
|
31
33
|
};
|
|
32
34
|
} else {
|
|
@@ -34,38 +36,40 @@ function General() {
|
|
|
34
36
|
}
|
|
35
37
|
}, template);
|
|
36
38
|
};
|
|
39
|
+
|
|
37
40
|
const getFieldData = key => {
|
|
38
41
|
if (Array.isArray(FormFields)) {
|
|
39
42
|
if (FormFields[key]) {
|
|
40
|
-
return {
|
|
41
|
-
...FormFields[key]
|
|
43
|
+
return { ...FormFields[key]
|
|
42
44
|
};
|
|
43
45
|
} else {
|
|
44
|
-
return {
|
|
45
|
-
...FormFields.find(f => f.key === key)
|
|
46
|
+
return { ...FormFields.find(f => f.key === key)
|
|
46
47
|
};
|
|
47
48
|
}
|
|
48
49
|
} else if (typeof FormFields === "object") {
|
|
49
|
-
return {
|
|
50
|
-
|
|
51
|
-
} || {
|
|
52
|
-
...Object.values(FormFields).find(f => f.key === key)
|
|
50
|
+
return { ...FormFields[key]
|
|
51
|
+
} || { ...Object.values(FormFields).find(f => f.key === key)
|
|
53
52
|
};
|
|
54
53
|
} else {
|
|
55
54
|
return undefined;
|
|
56
55
|
}
|
|
57
56
|
};
|
|
57
|
+
|
|
58
58
|
const getFormFields = function () {
|
|
59
59
|
let argForm = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : form;
|
|
60
60
|
return (argForm === null || argForm === void 0 ? void 0 : argForm.fields) || argForm;
|
|
61
61
|
};
|
|
62
|
+
|
|
62
63
|
const getFormFieldsAsArray = fields => {
|
|
63
64
|
if (Array.isArray(fields)) return fields;
|
|
65
|
+
|
|
64
66
|
if (typeof fields === "object") {
|
|
65
67
|
return Object.values(fields);
|
|
66
68
|
}
|
|
69
|
+
|
|
67
70
|
return fields;
|
|
68
71
|
};
|
|
72
|
+
|
|
69
73
|
const getFormFieldsKeys = function () {
|
|
70
74
|
let fields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getFormFields();
|
|
71
75
|
if (Array.isArray(fields)) return fields.map(_ref => {
|
|
@@ -74,6 +78,7 @@ function General() {
|
|
|
74
78
|
} = _ref;
|
|
75
79
|
return key;
|
|
76
80
|
});
|
|
81
|
+
|
|
77
82
|
if (typeof fields === "object") {
|
|
78
83
|
return Object.values(fields).map(_ref2 => {
|
|
79
84
|
let {
|
|
@@ -82,13 +87,16 @@ function General() {
|
|
|
82
87
|
return key;
|
|
83
88
|
});
|
|
84
89
|
}
|
|
90
|
+
|
|
85
91
|
return fields;
|
|
86
92
|
};
|
|
93
|
+
|
|
87
94
|
const popFormField = (fields, key) => {
|
|
88
95
|
const result = {
|
|
89
96
|
item: undefined,
|
|
90
97
|
itemIndex: undefined
|
|
91
98
|
};
|
|
99
|
+
|
|
92
100
|
if (Array.isArray(fields)) {
|
|
93
101
|
result.item = fields === null || fields === void 0 ? void 0 : fields.find(f => f.key === key);
|
|
94
102
|
result.itemIndex = result.item ? fields.findIndex(f => f.key === key) : fields.length;
|
|
@@ -96,36 +104,38 @@ function General() {
|
|
|
96
104
|
result.item = fields[key] || Object.values(fields).find(f => f.key === key);
|
|
97
105
|
result.itemIndex = result.item ? fields[key] ? key : Object.values(fields).findIndex(f => f.key === key) : key;
|
|
98
106
|
}
|
|
107
|
+
|
|
99
108
|
return result;
|
|
100
109
|
};
|
|
110
|
+
|
|
101
111
|
const updateFormField = (fields, data, key) => {
|
|
102
|
-
const isFunction = typeof data === "function";
|
|
103
|
-
|
|
112
|
+
const isFunction = typeof data === "function"; //KEY is NULLable
|
|
113
|
+
|
|
104
114
|
if (!key) {
|
|
105
115
|
return data.key ? Object.values(fields).reduce((result, field, i) => {
|
|
106
116
|
const index = fields[field.key] ? field.key : i;
|
|
107
|
-
return {
|
|
108
|
-
...result,
|
|
117
|
+
return { ...result,
|
|
109
118
|
[index]: data.key === field.key ? isFunction ? data(field) : data : field
|
|
110
119
|
};
|
|
111
|
-
}, {}) : {
|
|
112
|
-
...fields,
|
|
120
|
+
}, {}) : { ...fields,
|
|
113
121
|
[fields.length || 0]: isFunction ? data({}) : data
|
|
114
122
|
};
|
|
115
123
|
}
|
|
124
|
+
|
|
116
125
|
const {
|
|
117
126
|
item: field = data,
|
|
118
127
|
itemIndex
|
|
119
128
|
} = popFormField(fields, key);
|
|
120
|
-
fields[itemIndex] = isFunction ? data(field || {}) : {
|
|
121
|
-
...field,
|
|
129
|
+
fields[itemIndex] = isFunction ? data(field || {}) : { ...field,
|
|
122
130
|
...data
|
|
123
131
|
};
|
|
124
132
|
return fields;
|
|
125
133
|
};
|
|
134
|
+
|
|
126
135
|
const getFieldClassName = (key, type) => {
|
|
127
136
|
return "form-".concat(type, "_field-").concat(key);
|
|
128
137
|
};
|
|
138
|
+
|
|
129
139
|
return {
|
|
130
140
|
joinData,
|
|
131
141
|
getFieldData,
|
|
@@ -4,26 +4,31 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = RenderFields;
|
|
7
|
+
|
|
7
8
|
const defaultRenderFieldComponent = () => {
|
|
8
9
|
// eslint-disable-next-line no-console
|
|
9
10
|
console.error("RenderFields: RenderFieldComponent Property is not recieved!");
|
|
10
11
|
return null;
|
|
11
12
|
};
|
|
13
|
+
|
|
12
14
|
const defaultFormDataDriver = () => {
|
|
13
15
|
// eslint-disable-next-line no-console
|
|
14
16
|
console.error("RenderFields: FormDataDriver Property is not recieved!");
|
|
15
17
|
return null;
|
|
16
18
|
};
|
|
19
|
+
|
|
17
20
|
const defaultOnFieldChange = () => {
|
|
18
21
|
// eslint-disable-next-line no-console
|
|
19
22
|
console.warn("RenderFields: Be careful, onFieldChange handler is not recieved!");
|
|
20
23
|
return null;
|
|
21
24
|
};
|
|
25
|
+
|
|
22
26
|
const defaultOnFieldBlur = () => {
|
|
23
27
|
// eslint-disable-next-line no-console
|
|
24
28
|
console.warn("RenderFields: Be careful, defaultOnFieldBlur handler is not recieved!");
|
|
25
29
|
return null;
|
|
26
30
|
};
|
|
31
|
+
|
|
27
32
|
function RenderFields() {
|
|
28
33
|
let {
|
|
29
34
|
form,
|
|
@@ -41,13 +46,14 @@ function RenderFields() {
|
|
|
41
46
|
} = FormDataDriver({
|
|
42
47
|
form
|
|
43
48
|
});
|
|
49
|
+
|
|
44
50
|
const getColumnsQty = () => {
|
|
45
51
|
return cols > maxColumns ? maxColumns : cols;
|
|
46
52
|
};
|
|
53
|
+
|
|
47
54
|
const renderFormField = key => {
|
|
48
55
|
try {
|
|
49
|
-
const field = {
|
|
50
|
-
...getFormField(key),
|
|
56
|
+
const field = { ...getFormField(key),
|
|
51
57
|
key
|
|
52
58
|
};
|
|
53
59
|
const {
|
|
@@ -69,9 +75,11 @@ function RenderFields() {
|
|
|
69
75
|
return null;
|
|
70
76
|
}
|
|
71
77
|
};
|
|
78
|
+
|
|
72
79
|
const renderSingleColumn = () => {
|
|
73
80
|
return fields.map(renderFormField);
|
|
74
81
|
};
|
|
82
|
+
|
|
75
83
|
const renderSplitColumns = () => {
|
|
76
84
|
const fieldsLen = (fields === null || fields === void 0 ? void 0 : fields.length) || 0;
|
|
77
85
|
const columnsQty = getColumnsQty() > fieldsLen ? fieldsLen : getColumnsQty();
|
|
@@ -88,6 +96,7 @@ function RenderFields() {
|
|
|
88
96
|
className: "col-12 col-lg-".concat(parseInt(maxWidth / columnsQty, 10))
|
|
89
97
|
}, part.map(renderFormField))));
|
|
90
98
|
};
|
|
99
|
+
|
|
91
100
|
const render = cols === 1 ? renderSingleColumn : renderSplitColumns;
|
|
92
101
|
return render();
|
|
93
102
|
}
|
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
|
|
7
8
|
var _react = require("react");
|
|
9
|
+
|
|
8
10
|
function usePrevious(value) {
|
|
9
11
|
const ref = (0, _react.useRef)();
|
|
10
12
|
(0, _react.useEffect)(() => {
|
|
@@ -12,4 +14,6 @@ function usePrevious(value) {
|
|
|
12
14
|
}, [value]);
|
|
13
15
|
return ref.current;
|
|
14
16
|
}
|
|
15
|
-
|
|
17
|
+
|
|
18
|
+
var _default = usePrevious;
|
|
19
|
+
exports.default = _default;
|