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