intelicoreact 1.3.19 → 1.3.21
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 +23 -15
- package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.js +23 -15
- package/dist/Atomic/FormElements/Calendar/Calendar.js +124 -69
- package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.js +36 -27
- package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.js +39 -23
- package/dist/Atomic/FormElements/Datepicker/Datepicker.js +246 -110
- package/dist/Atomic/FormElements/Datepicker/components/Calendar.js +85 -44
- package/dist/Atomic/FormElements/Dropdown/Dropdown.js +414 -246
- package/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.js +9 -5
- package/dist/Atomic/FormElements/DropdownLiveSearch/DropdownLiveSearch.js +165 -93
- package/dist/Atomic/FormElements/FileLoader/FileLoader.js +64 -39
- package/dist/Atomic/FormElements/FileLoader/partial/LoadZone.js +132 -51
- package/dist/Atomic/FormElements/FileLoader/partial/LoadedContent.js +73 -34
- package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.js +75 -54
- package/dist/Atomic/FormElements/FileLoaderLocalGroup/FileLoaderLocalGroup.js +110 -67
- package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN.js +83 -33
- package/dist/Atomic/FormElements/Input/Input.js +253 -161
- package/dist/Atomic/FormElements/InputCalendar/InputCalendar.js +102 -48
- package/dist/Atomic/FormElements/InputColor/InputColor.js +40 -27
- package/dist/Atomic/FormElements/InputCurrency/InputCurrency.js +58 -28
- package/dist/Atomic/FormElements/InputDateRange/InputDateRange.js +176 -108
- package/dist/Atomic/FormElements/InputDateRange/components/DateInput.js +57 -32
- package/dist/Atomic/FormElements/InputDateRange/components/Datepicker.js +302 -184
- package/dist/Atomic/FormElements/InputDateRange/components/OpenedPart.js +157 -85
- package/dist/Atomic/FormElements/InputDateRange/components/SelectItem.js +16 -11
- package/dist/Atomic/FormElements/InputDateRange/dependencies.js +193 -76
- package/dist/Atomic/FormElements/InputLink/InputLink.js +58 -34
- package/dist/Atomic/FormElements/InputMask/InputCarretPosition.js +12 -8
- package/dist/Atomic/FormElements/InputMask/InputMask.js +964 -554
- package/dist/Atomic/FormElements/InputMask/config.js +1 -1
- package/dist/Atomic/FormElements/InputMask/functions.js +43 -17
- package/dist/Atomic/FormElements/InputMask2/InputMask2.js +404 -268
- package/dist/Atomic/FormElements/InputMask2/config.js +1 -1
- package/dist/Atomic/FormElements/InputMask2/functions.js +43 -17
- package/dist/Atomic/FormElements/InputMask3/InputMask3.js +459 -299
- package/dist/Atomic/FormElements/InputMask3/config.js +1 -1
- package/dist/Atomic/FormElements/InputMask3/functions.js +43 -17
- package/dist/Atomic/FormElements/InputWithAction/InputWithAction.js +113 -53
- package/dist/Atomic/FormElements/InputsRow/InputsRow.js +118 -64
- package/dist/Atomic/FormElements/Label/Label.js +23 -13
- package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.js +349 -217
- package/dist/Atomic/FormElements/MultiSelect/MultiSelect.js +47 -25
- package/dist/Atomic/FormElements/NumericInput/NumericInput.js +207 -133
- package/dist/Atomic/FormElements/RadioGroup/RadioGroup.js +61 -29
- package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.js +42 -20
- package/dist/Atomic/FormElements/RadioInput/RadioInput.js +33 -22
- package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.js +43 -20
- package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +101 -54
- package/dist/Atomic/FormElements/RangeInputs/RangeInputs.js +102 -59
- package/dist/Atomic/FormElements/RangeList/RangeList.js +150 -89
- package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.js +29 -23
- package/dist/Atomic/FormElements/RangeSlider/RangeSlider.js +300 -135
- package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.js +571 -381
- package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.js +24 -14
- package/dist/Atomic/FormElements/Switcher/Switcher.js +29 -24
- package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.js +47 -25
- package/dist/Atomic/FormElements/SwitcherHide/SwitcherHide.js +32 -20
- package/dist/Atomic/FormElements/SwitcherRadio/SwitcherRadio.js +55 -32
- package/dist/Atomic/FormElements/SwitcherRange/SwitcherRange.js +42 -22
- package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.js +33 -23
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.js +120 -51
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/partial/States.js +3 -2
- package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.js +46 -23
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js +417 -253
- package/dist/Atomic/FormElements/Text/Text.js +53 -47
- package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.js +31 -21
- package/dist/Atomic/FormElements/Textarea/Textarea.js +27 -16
- package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.js +128 -68
- package/dist/Atomic/FormElements/TieredCheckboxes/partial/AccordionWithCheckbox.js +36 -25
- package/dist/Atomic/FormElements/TimeRange/TimeRange.js +70 -33
- package/dist/Atomic/FormElements/UserContacts/UserContacts.js +124 -58
- package/dist/Atomic/FormElements/UserContacts/partial/defaultIcons.js +91 -0
- package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.js +80 -48
- package/dist/Atomic/FormElements/VariantsListRadio/partials/VariantsListRadioItem.js +42 -32
- package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.js +60 -40
- package/dist/Atomic/FormElements/WidgetPseudoTable/partial/constructor.js +3 -2
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.js +69 -50
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/partial/constructor.js +3 -3
- package/dist/Atomic/Layout/Header/Header.js +48 -21
- package/dist/Atomic/Layout/MainMenu/MainMenu.js +79 -36
- package/dist/Atomic/Layout/Spinner/Spinner.js +14 -8
- package/dist/Atomic/UI/Accordion/Accordion.js +48 -18
- package/dist/Atomic/UI/Accordion/AccordionItem.js +60 -35
- package/dist/Atomic/UI/AccordionTable/AccordionTable.js +106 -49
- package/dist/Atomic/UI/AccordionText/AccordionText.js +37 -13
- package/dist/Atomic/UI/AdvancedTag/AdvTag.js +94 -48
- package/dist/Atomic/UI/AdvancedTag/AdvancedTags.js +50 -22
- package/dist/Atomic/UI/Alert/Alert.js +44 -20
- package/dist/Atomic/UI/Arrow/Arrow.js +35 -15
- package/dist/Atomic/UI/Box/Box.js +21 -14
- package/dist/Atomic/UI/Button/Button.js +35 -26
- package/dist/Atomic/UI/ButtonsBar/ButtonsBar.js +31 -22
- package/dist/Atomic/UI/Chart/Chart.js +86 -45
- package/dist/Atomic/UI/Chart/partial/Chart.constants.js +24 -14
- package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.js +22 -13
- package/dist/Atomic/UI/Chart/partial/datasetSetters.js +113 -68
- package/dist/Atomic/UI/Chart/partial/optionsConstructor.js +140 -158
- package/dist/Atomic/UI/Chart/partial/optionsSetters.js +42 -26
- package/dist/Atomic/UI/Chart/partial/utils.js +48 -20
- package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.js +42 -22
- package/dist/Atomic/UI/DateTime/DateTime.js +38 -23
- package/dist/Atomic/UI/DebugContainer/DebugContainer.js +36 -12
- package/dist/Atomic/UI/DebugContainer/useDebugContainer.js +21 -5
- package/dist/Atomic/UI/DoubleString/DoubleString.js +50 -27
- package/dist/Atomic/UI/DynamicIcon/DynamicIcon.js +63 -15
- package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.js +157 -62
- package/dist/Atomic/UI/ExampleChartIntegration/partial/utils.js +110 -47
- package/dist/Atomic/UI/Hint/Hint.js +94 -49
- package/dist/Atomic/UI/Modal/Modal.js +179 -149
- package/dist/Atomic/UI/Modal/ModalHOC.js +21 -12
- package/dist/Atomic/UI/Modal/partials/ModalFooter.js +12 -7
- package/dist/Atomic/UI/Modal/partials/ModalTitle.js +21 -17
- package/dist/Atomic/UI/Modal/partials/useMobileModal.js +167 -94
- package/dist/Atomic/UI/ModalBackup/Modal.js +90 -65
- package/dist/Atomic/UI/ModalBackup/ModalHOC.js +21 -12
- package/dist/Atomic/UI/ModalBackup/partials/ModalFooter.js +11 -6
- package/dist/Atomic/UI/ModalBackup/partials/ModalTitle.js +19 -15
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion.js +62 -32
- package/dist/Atomic/UI/NavLine/NavLine.js +211 -120
- package/dist/Atomic/UI/NavLine/Tabs.js +3 -2
- package/dist/Atomic/UI/PageTitle/PageTitle.js +17 -13
- package/dist/Atomic/UI/PieChart/PieChart.js +21 -11
- package/dist/Atomic/UI/Price/Price.js +13 -10
- package/dist/Atomic/UI/PriceRange/PriceRange.js +11 -7
- package/dist/Atomic/UI/ProgressLine/ProgressLine.js +56 -27
- package/dist/Atomic/UI/Status/Status.js +30 -19
- package/dist/Atomic/UI/Table/Partials/TdCell.js +71 -28
- package/dist/Atomic/UI/Table/Partials/TdHeader.js +16 -7
- package/dist/Atomic/UI/Table/Partials/TdRow.js +65 -29
- package/dist/Atomic/UI/Table/Partials/TdTitle.js +40 -16
- package/dist/Atomic/UI/Table/Table.js +47 -27
- package/dist/Atomic/UI/Table/TdTypes/TdActions.js +48 -18
- package/dist/Atomic/UI/Table/TdTypes/TdPriority.js +19 -9
- package/dist/Atomic/UI/Table/TdTypes/TdRange.js +8 -5
- package/dist/Atomic/UI/Table/TdTypes/TdWeight.js +47 -25
- package/dist/Atomic/UI/Tag/Tag.js +48 -20
- package/dist/Atomic/UI/TagList/TagList.js +150 -80
- package/dist/Atomic/UI/UserBox/UserBox.js +26 -14
- package/dist/Classes/AbortableFetch.js +422 -283
- package/dist/Classes/AnimatedHandler.js +56 -44
- package/dist/Classes/RESTAPI/index.js +433 -154
- package/dist/Classes/RESTAPI/partials/AbortableFetch.js +428 -290
- package/dist/Classes/RESTAPI/partials/ApiBase.js +67 -24
- package/dist/Classes/RESTAPI/partials/ApiRequestCreators.js +275 -57
- package/dist/Classes/RESTAPI/partials/ApiUtils.js +377 -146
- package/dist/Classes/RESTAPI/partials/CredentialsProcessing.js +403 -155
- package/dist/Classes/RESTAPI/partials/Utils.js +135 -81
- package/dist/Classes/RESTAPI/partials/_outerDependencies.js +6 -2
- package/dist/Classes/RESTAPI/partials/_utils.js +395 -101
- package/dist/Constants/index.constants.js +15 -8
- package/dist/Functions/Portal.js +33 -14
- package/dist/Functions/customEventListener.js +20 -5
- package/dist/Functions/fieldValueFormatters.js +211 -148
- package/dist/Functions/hooks/useFormFieldsChangesManager.js +137 -75
- package/dist/Functions/locale/createTranslator.js +27 -13
- package/dist/Functions/operations.js +49 -35
- package/dist/Functions/presets/inputMaskPresets.js +27 -25
- package/dist/Functions/presets/inputPresets.js +22 -19
- package/dist/Functions/presets/mobileKeyboardTypesPresets.js +9 -7
- package/dist/Functions/schemas.js +15 -6
- package/dist/Functions/useClickOutside.js +7 -3
- package/dist/Functions/useDebounce.js +25 -11
- package/dist/Functions/useFieldFocus.js +67 -42
- package/dist/Functions/useFormTools/form-drivers/ArrayWithObjects.js +54 -35
- package/dist/Functions/useFormTools/form-drivers/ObjectWithIterableObjects.js +95 -74
- package/dist/Functions/useFormTools/form-drivers/ObjectWithNamedKeyObjects.js +91 -55
- package/dist/Functions/useFormTools/functions/General.js +99 -80
- package/dist/Functions/useFormTools/functions/RenderFields.js +72 -45
- package/dist/Functions/useFormTools/functions/usePrevious.js +7 -3
- package/dist/Functions/useFormTools/index.js +598 -382
- package/dist/Functions/useInputHighlightError.js +52 -27
- package/dist/Functions/useIsMobile.js +36 -13
- package/dist/Functions/useLocalStorage.js +22 -7
- package/dist/Functions/useLocationParams.js +27 -16
- package/dist/Functions/useMetaInfo.js +50 -19
- package/dist/Functions/useMouseUpOutside.js +5 -2
- package/dist/Functions/useOnlineStatus.js +26 -7
- package/dist/Functions/usePasswordChecker.js +77 -42
- package/dist/Functions/usePrevious.js +7 -3
- package/dist/Functions/useResize.js +32 -12
- package/dist/Functions/useScrollTo.js +20 -6
- package/dist/Functions/useToggle.js +30 -10
- package/dist/Functions/utils.js +366 -186
- package/dist/Molecular/CustomIcons/components/AffiliateNetworks.js +32 -21
- package/dist/Molecular/CustomIcons/components/AlertCircle.js +32 -21
- package/dist/Molecular/CustomIcons/components/AppStore.js +36 -25
- package/dist/Molecular/CustomIcons/components/Arrow.js +42 -31
- package/dist/Molecular/CustomIcons/components/ArrowDown.js +24 -13
- package/dist/Molecular/CustomIcons/components/ArrowLeft.js +27 -16
- package/dist/Molecular/CustomIcons/components/ArrowRight.js +27 -16
- package/dist/Molecular/CustomIcons/components/ArrowUp.js +24 -13
- package/dist/Molecular/CustomIcons/components/Bell.js +22 -11
- package/dist/Molecular/CustomIcons/components/Button.js +22 -11
- package/dist/Molecular/CustomIcons/components/Campaigns.js +23 -12
- package/dist/Molecular/CustomIcons/components/Check.js +23 -12
- package/dist/Molecular/CustomIcons/components/Check2.js +22 -11
- package/dist/Molecular/CustomIcons/components/ChevronDown.js +22 -11
- package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.js +22 -11
- package/dist/Molecular/CustomIcons/components/ChevronLeft.js +22 -11
- package/dist/Molecular/CustomIcons/components/ChevronRight.js +22 -11
- package/dist/Molecular/CustomIcons/components/ChevronUp.js +22 -11
- package/dist/Molecular/CustomIcons/components/ChevronUpDown.js +37 -26
- package/dist/Molecular/CustomIcons/components/Close.js +24 -13
- package/dist/Molecular/CustomIcons/components/ColumnsOrder.js +49 -38
- package/dist/Molecular/CustomIcons/components/Delete.js +23 -12
- package/dist/Molecular/CustomIcons/components/Edit.js +22 -11
- package/dist/Molecular/CustomIcons/components/Email.js +40 -29
- package/dist/Molecular/CustomIcons/components/FinturfLogo.js +30 -19
- package/dist/Molecular/CustomIcons/components/FinturfLogo2.js +38 -27
- package/dist/Molecular/CustomIcons/components/Flows.js +22 -11
- package/dist/Molecular/CustomIcons/components/Gift.js +27 -16
- package/dist/Molecular/CustomIcons/components/GoogleAuth.js +36 -25
- package/dist/Molecular/CustomIcons/components/GooglePlay.js +36 -25
- package/dist/Molecular/CustomIcons/components/HelpCircle.js +25 -14
- package/dist/Molecular/CustomIcons/components/HelpCircle2.js +26 -15
- package/dist/Molecular/CustomIcons/components/HelpCircleFilled.js +25 -14
- package/dist/Molecular/CustomIcons/components/Home.js +25 -14
- package/dist/Molecular/CustomIcons/components/Home2.js +28 -17
- package/dist/Molecular/CustomIcons/components/Key.js +30 -19
- package/dist/Molecular/CustomIcons/components/Landers.js +26 -15
- package/dist/Molecular/CustomIcons/components/Lock.js +22 -11
- package/dist/Molecular/CustomIcons/components/Mail.js +30 -19
- package/dist/Molecular/CustomIcons/components/Mastercard.js +72 -61
- package/dist/Molecular/CustomIcons/components/Minus.js +35 -24
- package/dist/Molecular/CustomIcons/components/Offers.js +23 -12
- package/dist/Molecular/CustomIcons/components/Pause.js +35 -24
- package/dist/Molecular/CustomIcons/components/PayPal.js +49 -38
- package/dist/Molecular/CustomIcons/components/PayPalLightLarge.js +36 -25
- package/dist/Molecular/CustomIcons/components/Phone.js +37 -26
- package/dist/Molecular/CustomIcons/components/Play.js +35 -24
- package/dist/Molecular/CustomIcons/components/Plus.js +35 -24
- package/dist/Molecular/CustomIcons/components/Profile.js +27 -16
- package/dist/Molecular/CustomIcons/components/QRCode.js +37 -26
- package/dist/Molecular/CustomIcons/components/Rectangle.js +22 -11
- package/dist/Molecular/CustomIcons/components/Revert.js +25 -14
- package/dist/Molecular/CustomIcons/components/Star.js +21 -10
- package/dist/Molecular/CustomIcons/components/Star2.js +23 -12
- package/dist/Molecular/CustomIcons/components/TrafficSources.js +25 -14
- package/dist/Molecular/CustomIcons/components/Trash.js +22 -11
- package/dist/Molecular/CustomIcons/components/TrashRed.js +22 -11
- package/dist/Molecular/CustomIcons/components/Triggers.js +22 -11
- package/dist/Molecular/CustomIcons/components/User.js +27 -16
- package/dist/Molecular/CustomIcons/components/Visa.js +38 -27
- package/dist/Molecular/CustomIcons/components/X.js +22 -11
- package/dist/Molecular/CustomIcons/index.js +183 -61
- package/dist/Molecular/FormElement/FormElement.js +27 -18
- package/dist/Molecular/FormWithDependOn/FormWithDependOn.js +108 -86
- package/dist/Molecular/FormWithDependOn/partials/_utils.js +34 -29
- package/dist/Molecular/InputAddress/InputAddress.js +312 -176
- package/dist/Molecular/InputPassword/InputPassword.js +39 -15
- package/dist/index.js +3 -1
- package/package.json +1 -1
|
@@ -1,59 +1,79 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports.default = ObjectWithIterableObjects;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
+
|
|
14
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
15
|
+
|
|
16
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
17
|
+
|
|
18
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
19
|
+
|
|
7
20
|
function ObjectWithIterableObjects(_ref) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const joinData = function () {
|
|
21
|
+
var form = _ref.form,
|
|
22
|
+
setForm = _ref.setForm,
|
|
23
|
+
FormFields = _ref.FormFields;
|
|
24
|
+
|
|
25
|
+
var joinData = function joinData() {
|
|
14
26
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
15
27
|
args[_key] = arguments[_key];
|
|
16
28
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
29
|
+
|
|
30
|
+
var mainArg = args[0];
|
|
31
|
+
var MainArgProto = Array.isArray(mainArg) ? 'Array' : (0, _typeof2.default)(mainArg) === 'object' ? 'Object' : undefined;
|
|
32
|
+
var template = Array.isArray(mainArg) ? [] : (0, _typeof2.default)(mainArg) === 'object' ? {} : null;
|
|
20
33
|
if (!template) return undefined;
|
|
21
|
-
return args.reduce((result, item)
|
|
34
|
+
return args.reduce(function (result, item) {
|
|
22
35
|
if (MainArgProto === 'Array') {
|
|
23
36
|
if (Array.isArray(item)) {
|
|
24
|
-
return [
|
|
37
|
+
return [].concat((0, _toConsumableArray2.default)(result), (0, _toConsumableArray2.default)(item));
|
|
25
38
|
} else {
|
|
26
|
-
return [
|
|
39
|
+
return [].concat((0, _toConsumableArray2.default)(result), [item]);
|
|
27
40
|
}
|
|
28
41
|
} else if (MainArgProto === 'Object') {
|
|
29
|
-
return {
|
|
30
|
-
...result,
|
|
31
|
-
...item
|
|
32
|
-
};
|
|
42
|
+
return _objectSpread(_objectSpread({}, result), item);
|
|
33
43
|
} else {
|
|
34
44
|
return template;
|
|
35
45
|
}
|
|
36
46
|
}, template);
|
|
37
47
|
};
|
|
38
|
-
|
|
48
|
+
|
|
49
|
+
var getFieldData = function getFieldData(key) {
|
|
39
50
|
if (Array.isArray(FormFields)) {
|
|
40
|
-
return FormFields[key] || FormFields.find(
|
|
41
|
-
|
|
42
|
-
|
|
51
|
+
return FormFields[key] || FormFields.find(function (f) {
|
|
52
|
+
return f.key === key;
|
|
53
|
+
});
|
|
54
|
+
} else if ((0, _typeof2.default)(FormFields) === 'object') {
|
|
55
|
+
return FormFields[key] || Object.values(FormFields).find(function (f) {
|
|
56
|
+
return f.key === key;
|
|
57
|
+
});
|
|
43
58
|
} else {
|
|
44
59
|
return undefined;
|
|
45
60
|
}
|
|
46
61
|
};
|
|
47
|
-
|
|
62
|
+
|
|
63
|
+
var getFormFields = function getFormFields() {
|
|
48
64
|
return form.fields || form;
|
|
49
65
|
};
|
|
50
|
-
|
|
66
|
+
|
|
67
|
+
var getFormField = function getFormField(key) {
|
|
51
68
|
// eslint-disable-next-line no-undef
|
|
52
69
|
if (FormProto === 'Array') {
|
|
53
|
-
return getFormFields().find(
|
|
54
|
-
|
|
70
|
+
return getFormFields().find(function (field) {
|
|
71
|
+
return field.key === key;
|
|
72
|
+
}); // eslint-disable-next-line no-undef
|
|
55
73
|
} else if (FormProto === 'Object') {
|
|
56
|
-
return Object.values(getFormFields()).find(
|
|
74
|
+
return Object.values(getFormFields()).find(function (field) {
|
|
75
|
+
return field.key === key;
|
|
76
|
+
}) || Object.keys(getFormFields()).reduce(function (result, field) {
|
|
57
77
|
if (field === key) result = getFormFields()[field];
|
|
58
78
|
return result;
|
|
59
79
|
}, {});
|
|
@@ -61,85 +81,86 @@ function ObjectWithIterableObjects(_ref) {
|
|
|
61
81
|
return undefined;
|
|
62
82
|
}
|
|
63
83
|
};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
84
|
+
|
|
85
|
+
var setFormFields = function setFormFields(data) {
|
|
86
|
+
var isFunction = typeof data === 'function';
|
|
87
|
+
setForm(function (state) {
|
|
67
88
|
if (state.fields) {
|
|
68
|
-
return {
|
|
69
|
-
...state,
|
|
89
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
70
90
|
fields: isFunction ? data(state.fields) : data
|
|
71
|
-
};
|
|
91
|
+
});
|
|
72
92
|
} else {
|
|
73
93
|
return isFunction ? data(state) : data;
|
|
74
94
|
}
|
|
75
95
|
});
|
|
76
96
|
};
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
97
|
+
|
|
98
|
+
var setFormField = function setFormField(data) {
|
|
99
|
+
var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
100
|
+
var isFunction = typeof data === 'function';
|
|
101
|
+
setFormFields(function (fields) {
|
|
102
|
+
var pop = function pop(fields, key) {
|
|
103
|
+
var result = {
|
|
104
|
+
fields: fields,
|
|
84
105
|
item: undefined
|
|
85
106
|
};
|
|
86
|
-
result.item = fields[key] || fields.find(
|
|
107
|
+
result.item = fields[key] || fields.find(function (f) {
|
|
108
|
+
return f.key === key;
|
|
109
|
+
});
|
|
87
110
|
if (!result.item) return result;
|
|
111
|
+
|
|
88
112
|
if (Array.isArray(fields)) {
|
|
89
|
-
|
|
113
|
+
var index = parseInt(key);
|
|
114
|
+
|
|
90
115
|
if (!isNaN(index)) {
|
|
91
116
|
result.fields.splice(key, 1);
|
|
92
117
|
} else {
|
|
93
|
-
result.fields = result.fields.filter(
|
|
118
|
+
result.fields = result.fields.filter(function (f) {
|
|
119
|
+
return f.key !== key;
|
|
120
|
+
});
|
|
94
121
|
}
|
|
95
|
-
} else if (
|
|
96
|
-
result.fields = Object.values(fields).reduce((object, _ref2)
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
} = _ref2;
|
|
122
|
+
} else if ((0, _typeof2.default)(fields) === 'object') {
|
|
123
|
+
result.fields = Object.values(fields).reduce(function (object, _ref2) {
|
|
124
|
+
var fKey = _ref2.key;
|
|
125
|
+
|
|
100
126
|
if (key !== fKey) {
|
|
101
127
|
object[key] = fields[key];
|
|
102
128
|
}
|
|
129
|
+
|
|
103
130
|
return object;
|
|
104
131
|
}, {});
|
|
105
132
|
}
|
|
133
|
+
|
|
106
134
|
return result;
|
|
107
135
|
};
|
|
108
|
-
|
|
136
|
+
|
|
137
|
+
var update = function update(fields) {
|
|
109
138
|
//KEY is NULLable
|
|
110
139
|
if (!key) {
|
|
111
|
-
return data.key ? Object.values(fields).reduce((result, field, i)
|
|
112
|
-
|
|
113
|
-
return {
|
|
114
|
-
|
|
115
|
-
[index]: data.key === field.key ? isFunction ? data(field) : data : field
|
|
116
|
-
};
|
|
117
|
-
}, {}) : {
|
|
118
|
-
...fields,
|
|
119
|
-
[fields.length || 0]: isFunction ? data({}) : data
|
|
120
|
-
};
|
|
140
|
+
return data.key ? Object.values(fields).reduce(function (result, field, i) {
|
|
141
|
+
var index = fields[field.key] ? field.key : i;
|
|
142
|
+
return _objectSpread(_objectSpread({}, result), {}, (0, _defineProperty2.default)({}, index, data.key === field.key ? isFunction ? data(field) : data : field));
|
|
143
|
+
}, {}) : _objectSpread(_objectSpread({}, fields), {}, (0, _defineProperty2.default)({}, fields.length || 0, isFunction ? data({}) : data));
|
|
121
144
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
};
|
|
130
|
-
return joinData(filtered, fields[key] ? {
|
|
131
|
-
[key]: updatedField
|
|
132
|
-
} : updatedField);
|
|
145
|
+
|
|
146
|
+
var _pop = pop(fields, key),
|
|
147
|
+
filtered = _pop.fields,
|
|
148
|
+
field = _pop.item;
|
|
149
|
+
|
|
150
|
+
var updatedField = isFunction ? data(field || {}) : _objectSpread(_objectSpread({}, field), data);
|
|
151
|
+
return joinData(filtered, fields[key] ? (0, _defineProperty2.default)({}, key, updatedField) : updatedField);
|
|
133
152
|
};
|
|
153
|
+
|
|
134
154
|
return update(fields);
|
|
135
155
|
});
|
|
136
156
|
};
|
|
157
|
+
|
|
137
158
|
return {
|
|
138
|
-
joinData,
|
|
139
|
-
getFieldData,
|
|
140
|
-
getFormFields,
|
|
141
|
-
getFormField,
|
|
142
|
-
setFormFields,
|
|
143
|
-
setFormField
|
|
159
|
+
joinData: joinData,
|
|
160
|
+
getFieldData: getFieldData,
|
|
161
|
+
getFormFields: getFormFields,
|
|
162
|
+
getFormField: getFormField,
|
|
163
|
+
setFormFields: setFormFields,
|
|
164
|
+
setFormField: setFormField
|
|
144
165
|
};
|
|
145
166
|
}
|
|
@@ -1,78 +1,114 @@
|
|
|
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;
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
var _toArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toArray"));
|
|
11
|
+
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
|
|
14
|
+
var _General2 = _interopRequireDefault(require("../functions/General"));
|
|
15
|
+
|
|
16
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
17
|
+
|
|
18
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
19
|
+
|
|
20
|
+
var noop = function noop() {};
|
|
21
|
+
|
|
10
22
|
function ObjectWithNamedKeyObjects() {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
var _ref4;
|
|
24
|
+
|
|
25
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
26
|
+
form = _ref.form,
|
|
27
|
+
_ref$setForm = _ref.setForm,
|
|
28
|
+
setForm = _ref$setForm === void 0 ? noop : _ref$setForm,
|
|
29
|
+
FormFields = _ref.FormFields;
|
|
30
|
+
|
|
31
|
+
var _General = (0, _General2.default)({
|
|
32
|
+
FormFields: FormFields
|
|
33
|
+
}),
|
|
34
|
+
joinData = _General.joinData,
|
|
35
|
+
getFieldData = _General.getFieldData,
|
|
36
|
+
updateFormField = _General.updateFormField,
|
|
37
|
+
_getFormFields = _General.getFormFields,
|
|
38
|
+
_getFormFieldsAsArray = _General.getFormFieldsAsArray,
|
|
39
|
+
_getFormFieldsKeys = _General.getFormFieldsKeys;
|
|
40
|
+
|
|
41
|
+
var getFormField = function getFormField(key) {
|
|
27
42
|
var _Object$values, _Object$keys;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
43
|
+
|
|
44
|
+
var argForm = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : form;
|
|
45
|
+
return ((_Object$values = Object.values(_getFormFields(argForm))) === null || _Object$values === void 0 ? void 0 : _Object$values.find(function (field) {
|
|
46
|
+
return (field === null || field === void 0 ? void 0 : field.key) === key;
|
|
47
|
+
})) || ((_Object$keys = Object.keys(_getFormFields(argForm))) === null || _Object$keys === void 0 ? void 0 : _Object$keys.reduce(function (result, field) {
|
|
48
|
+
if (field === key) result = _getFormFields(argForm)[field];
|
|
31
49
|
return result;
|
|
32
50
|
}, null));
|
|
33
51
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
52
|
+
|
|
53
|
+
var setFormFields = function setFormFields(data) {
|
|
54
|
+
var isFunction = typeof data === 'function';
|
|
55
|
+
setForm(function (state) {
|
|
37
56
|
if (state.fields) {
|
|
38
|
-
return {
|
|
39
|
-
...state,
|
|
57
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
40
58
|
fields: isFunction ? data(state.fields) : data
|
|
41
|
-
};
|
|
59
|
+
});
|
|
42
60
|
} else {
|
|
43
61
|
return isFunction ? data(state) : data;
|
|
44
62
|
}
|
|
45
63
|
});
|
|
46
64
|
};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
65
|
+
|
|
66
|
+
var setFormField = function setFormField(data) {
|
|
67
|
+
var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
68
|
+
return setFormFields(function (fields) {
|
|
69
|
+
return updateFormField(fields, data, key);
|
|
70
|
+
});
|
|
50
71
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
[key]: state[key]
|
|
55
|
-
}), {}));
|
|
56
|
-
const removeFormFields = _ref => {
|
|
57
|
-
let [...keys] = _ref;
|
|
58
|
-
return setFormFields(state => Object.keys(state).filter(fKey => !keys.includes(fKey)).reduce((obj, key) => ({
|
|
59
|
-
...obj,
|
|
60
|
-
[key]: state[key]
|
|
61
|
-
}), {}));
|
|
72
|
+
|
|
73
|
+
var removeAllFormFields = function removeAllFormFields() {
|
|
74
|
+
return setFormFields({});
|
|
62
75
|
};
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
getFormFieldsAsArray: () => getFormFieldsAsArray(getFormFields(form)),
|
|
73
|
-
getFormFieldsKeys: () => getFormFieldsKeys(getFormFields(form)),
|
|
74
|
-
removeAllFormFields,
|
|
75
|
-
removeFormField,
|
|
76
|
-
removeFormFields
|
|
76
|
+
|
|
77
|
+
var removeFormField = function removeFormField(key) {
|
|
78
|
+
return setFormFields(function (state) {
|
|
79
|
+
return Object.keys(state).filter(function (fKey) {
|
|
80
|
+
return fKey !== key;
|
|
81
|
+
}).reduce(function (obj, key) {
|
|
82
|
+
return _objectSpread(_objectSpread({}, obj), {}, (0, _defineProperty2.default)({}, key, state[key]));
|
|
83
|
+
}, {});
|
|
84
|
+
});
|
|
77
85
|
};
|
|
86
|
+
|
|
87
|
+
var removeFormFields = function removeFormFields(_ref2) {
|
|
88
|
+
var _ref3 = (0, _toArray2.default)(_ref2),
|
|
89
|
+
keys = _ref3.slice(0);
|
|
90
|
+
|
|
91
|
+
return setFormFields(function (state) {
|
|
92
|
+
return Object.keys(state).filter(function (fKey) {
|
|
93
|
+
return !keys.includes(fKey);
|
|
94
|
+
}).reduce(function (obj, key) {
|
|
95
|
+
return _objectSpread(_objectSpread({}, obj), {}, (0, _defineProperty2.default)({}, key, state[key]));
|
|
96
|
+
}, {});
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
return _ref4 = {
|
|
101
|
+
joinData: joinData,
|
|
102
|
+
getFieldData: getFieldData,
|
|
103
|
+
getFormFields: _getFormFields,
|
|
104
|
+
getFormField: getFormField,
|
|
105
|
+
setFormFields: setFormFields,
|
|
106
|
+
setFormField: setFormField
|
|
107
|
+
}, (0, _defineProperty2.default)(_ref4, "getFormFields", function getFormFields() {
|
|
108
|
+
return _getFormFields(form);
|
|
109
|
+
}), (0, _defineProperty2.default)(_ref4, "getFormFieldsAsArray", function getFormFieldsAsArray() {
|
|
110
|
+
return _getFormFieldsAsArray(_getFormFields(form));
|
|
111
|
+
}), (0, _defineProperty2.default)(_ref4, "getFormFieldsKeys", function getFormFieldsKeys() {
|
|
112
|
+
return _getFormFieldsKeys(_getFormFields(form));
|
|
113
|
+
}), (0, _defineProperty2.default)(_ref4, "removeAllFormFields", removeAllFormFields), (0, _defineProperty2.default)(_ref4, "removeFormField", removeFormField), (0, _defineProperty2.default)(_ref4, "removeFormFields", removeFormFields), _ref4;
|
|
78
114
|
}
|
|
@@ -1,139 +1,158 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports.default = General;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
+
|
|
14
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
15
|
+
|
|
16
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
17
|
+
|
|
18
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
19
|
+
|
|
7
20
|
function General() {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
21
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
22
|
+
form = _ref.form,
|
|
23
|
+
_ref$FormFields = _ref.FormFields,
|
|
24
|
+
FormFields = _ref$FormFields === void 0 ? [] : _ref$FormFields;
|
|
25
|
+
|
|
26
|
+
var joinData = function joinData() {
|
|
13
27
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
14
28
|
args[_key] = arguments[_key];
|
|
15
29
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
30
|
+
|
|
31
|
+
var mainArg = args[0];
|
|
32
|
+
var MainArgProto = Array.isArray(mainArg) ? 'Array' : (0, _typeof2.default)(mainArg) === 'object' ? 'Object' : undefined;
|
|
33
|
+
var template = Array.isArray(mainArg) ? [] : (0, _typeof2.default)(mainArg) === 'object' ? {} : null;
|
|
19
34
|
if (!template) return undefined;
|
|
20
|
-
return args.reduce((result, item)
|
|
35
|
+
return args.reduce(function (result, item) {
|
|
21
36
|
if (MainArgProto === 'Array') {
|
|
22
37
|
if (Array.isArray(item)) {
|
|
23
|
-
return [
|
|
38
|
+
return [].concat((0, _toConsumableArray2.default)(result), (0, _toConsumableArray2.default)(item));
|
|
24
39
|
} else {
|
|
25
|
-
return [
|
|
40
|
+
return [].concat((0, _toConsumableArray2.default)(result), [item]);
|
|
26
41
|
}
|
|
27
42
|
} else if (MainArgProto === 'Object') {
|
|
28
|
-
return {
|
|
29
|
-
...result,
|
|
30
|
-
...item
|
|
31
|
-
};
|
|
43
|
+
return _objectSpread(_objectSpread({}, result), item);
|
|
32
44
|
} else {
|
|
33
45
|
return template;
|
|
34
46
|
}
|
|
35
47
|
}, template);
|
|
36
48
|
};
|
|
37
|
-
|
|
49
|
+
|
|
50
|
+
var getFieldData = function getFieldData(key) {
|
|
38
51
|
if (Array.isArray(FormFields)) {
|
|
39
52
|
if (FormFields[key]) {
|
|
40
|
-
return {
|
|
41
|
-
...FormFields[key]
|
|
42
|
-
};
|
|
53
|
+
return _objectSpread({}, FormFields[key]);
|
|
43
54
|
} else {
|
|
44
|
-
return {
|
|
45
|
-
|
|
46
|
-
};
|
|
55
|
+
return _objectSpread({}, FormFields.find(function (f) {
|
|
56
|
+
return f.key === key;
|
|
57
|
+
}));
|
|
47
58
|
}
|
|
48
|
-
} else if (
|
|
49
|
-
return {
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
...Object.values(FormFields).find(f => f.key === key)
|
|
53
|
-
};
|
|
59
|
+
} else if ((0, _typeof2.default)(FormFields) === 'object') {
|
|
60
|
+
return _objectSpread({}, FormFields[key]) || _objectSpread({}, Object.values(FormFields).find(function (f) {
|
|
61
|
+
return f.key === key;
|
|
62
|
+
}));
|
|
54
63
|
} else {
|
|
55
64
|
return undefined;
|
|
56
65
|
}
|
|
57
66
|
};
|
|
58
|
-
|
|
59
|
-
|
|
67
|
+
|
|
68
|
+
var getFormFields = function getFormFields() {
|
|
69
|
+
var argForm = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : form;
|
|
60
70
|
return (argForm === null || argForm === void 0 ? void 0 : argForm.fields) || argForm;
|
|
61
71
|
};
|
|
62
|
-
|
|
72
|
+
|
|
73
|
+
var getFormFieldsAsArray = function getFormFieldsAsArray(fields) {
|
|
63
74
|
if (Array.isArray(fields)) return fields;
|
|
64
|
-
|
|
75
|
+
|
|
76
|
+
if ((0, _typeof2.default)(fields) === 'object') {
|
|
65
77
|
return Object.values(fields);
|
|
66
78
|
}
|
|
79
|
+
|
|
67
80
|
return fields;
|
|
68
81
|
};
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
} = _ref;
|
|
82
|
+
|
|
83
|
+
var getFormFieldsKeys = function getFormFieldsKeys() {
|
|
84
|
+
var fields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getFormFields();
|
|
85
|
+
if (Array.isArray(fields)) return fields.map(function (_ref2) {
|
|
86
|
+
var key = _ref2.key;
|
|
75
87
|
return key;
|
|
76
88
|
});
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
} = _ref2;
|
|
89
|
+
|
|
90
|
+
if ((0, _typeof2.default)(fields) === 'object') {
|
|
91
|
+
return Object.values(fields).map(function (_ref3) {
|
|
92
|
+
var key = _ref3.key;
|
|
82
93
|
return key;
|
|
83
94
|
});
|
|
84
95
|
}
|
|
96
|
+
|
|
85
97
|
return fields;
|
|
86
98
|
};
|
|
87
|
-
|
|
88
|
-
|
|
99
|
+
|
|
100
|
+
var popFormField = function popFormField(fields, key) {
|
|
101
|
+
var result = {
|
|
89
102
|
item: undefined,
|
|
90
103
|
itemIndex: undefined
|
|
91
104
|
};
|
|
105
|
+
|
|
92
106
|
if (Array.isArray(fields)) {
|
|
93
|
-
result.item = fields === null || fields === void 0 ? void 0 : fields.find(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
result.
|
|
97
|
-
|
|
107
|
+
result.item = fields === null || fields === void 0 ? void 0 : fields.find(function (f) {
|
|
108
|
+
return f.key === key;
|
|
109
|
+
});
|
|
110
|
+
result.itemIndex = result.item ? fields.findIndex(function (f) {
|
|
111
|
+
return f.key === key;
|
|
112
|
+
}) : fields.length;
|
|
113
|
+
} else if ((0, _typeof2.default)(fields) === 'object') {
|
|
114
|
+
result.item = fields[key] || Object.values(fields).find(function (f) {
|
|
115
|
+
return f.key === key;
|
|
116
|
+
});
|
|
117
|
+
result.itemIndex = result.item ? fields[key] ? key : Object.values(fields).findIndex(function (f) {
|
|
118
|
+
return f.key === key;
|
|
119
|
+
}) : key;
|
|
98
120
|
}
|
|
121
|
+
|
|
99
122
|
return result;
|
|
100
123
|
};
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
//KEY is NULLable
|
|
124
|
+
|
|
125
|
+
var updateFormField = function updateFormField(fields, data, key) {
|
|
126
|
+
var isFunction = typeof data === 'function'; //KEY is NULLable
|
|
127
|
+
|
|
104
128
|
if (!key) {
|
|
105
|
-
return data.key ? Object.values(fields).reduce((result, field, i)
|
|
106
|
-
|
|
107
|
-
return {
|
|
108
|
-
|
|
109
|
-
[index]: data.key === field.key ? isFunction ? data(field) : data : field
|
|
110
|
-
};
|
|
111
|
-
}, {}) : {
|
|
112
|
-
...fields,
|
|
113
|
-
[fields.length || 0]: isFunction ? data({}) : data
|
|
114
|
-
};
|
|
129
|
+
return data.key ? Object.values(fields).reduce(function (result, field, i) {
|
|
130
|
+
var index = fields[field.key] ? field.key : i;
|
|
131
|
+
return _objectSpread(_objectSpread({}, result), {}, (0, _defineProperty2.default)({}, index, data.key === field.key ? isFunction ? data(field) : data : field));
|
|
132
|
+
}, {}) : _objectSpread(_objectSpread({}, fields), {}, (0, _defineProperty2.default)({}, fields.length || 0, isFunction ? data({}) : data));
|
|
115
133
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
};
|
|
134
|
+
|
|
135
|
+
var _popFormField = popFormField(fields, key),
|
|
136
|
+
_popFormField$item = _popFormField.item,
|
|
137
|
+
field = _popFormField$item === void 0 ? data : _popFormField$item,
|
|
138
|
+
itemIndex = _popFormField.itemIndex;
|
|
139
|
+
|
|
140
|
+
fields[itemIndex] = isFunction ? data(field || {}) : _objectSpread(_objectSpread({}, field), data);
|
|
124
141
|
return fields;
|
|
125
142
|
};
|
|
126
|
-
|
|
143
|
+
|
|
144
|
+
var getFieldClassName = function getFieldClassName(key, type) {
|
|
127
145
|
return "form-".concat(type, "_field-").concat(key);
|
|
128
146
|
};
|
|
147
|
+
|
|
129
148
|
return {
|
|
130
|
-
joinData,
|
|
131
|
-
getFieldData,
|
|
132
|
-
popFormField,
|
|
133
|
-
updateFormField,
|
|
134
|
-
getFormFields,
|
|
135
|
-
getFormFieldsAsArray,
|
|
136
|
-
getFieldClassName,
|
|
137
|
-
getFormFieldsKeys
|
|
149
|
+
joinData: joinData,
|
|
150
|
+
getFieldData: getFieldData,
|
|
151
|
+
popFormField: popFormField,
|
|
152
|
+
updateFormField: updateFormField,
|
|
153
|
+
getFormFields: getFormFields,
|
|
154
|
+
getFormFieldsAsArray: getFormFieldsAsArray,
|
|
155
|
+
getFieldClassName: getFieldClassName,
|
|
156
|
+
getFormFieldsKeys: getFormFieldsKeys
|
|
138
157
|
};
|
|
139
158
|
}
|