intelicoreact 1.8.8 → 1.8.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.jsx +18 -1
- package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN_old.jsx +121 -1
- package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.jsx +507 -1
- package/dist/Atomic/FormElements/MultiSelect/MultiSelect.jsx +46 -1
- package/dist/Atomic/FormElements/NumericInput/NumericInput.jsx +337 -1
- package/dist/Atomic/FormElements/RadioGroup/RadioGroup.jsx +66 -1
- package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.jsx +78 -1
- package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.jsx +54 -1
- package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.jsx +183 -1
- package/dist/Atomic/FormElements/RangeList/RangeList.jsx +181 -1
- package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.jsx +41 -1
- package/dist/Atomic/FormElements/RangeSlider/RangeSlider.jsx +449 -1
- package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.jsx +865 -1
- package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.jsx +37 -1
- package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.jsx +48 -1
- package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.jsx +62 -1
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.jsx +175 -1
- package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.jsx +65 -1
- package/dist/Atomic/FormElements/TagListToDropdown/TagListToDropdown.jsx +118 -1
- package/dist/Atomic/FormElements/Text/Text.jsx +126 -1
- package/dist/Atomic/FormElements/Textarea/Textarea.jsx +61 -1
- package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.jsx +181 -1
- package/dist/Atomic/FormElements/TieredCheckboxes/partial/AccordionWithCheckbox.jsx +60 -1
- package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.jsx +83 -1
- package/dist/Atomic/FormElements/VariantsListRadio/partials/VariantsListRadioItem.jsx +80 -1
- package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.jsx +103 -1
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.jsx +115 -1
- package/dist/Atomic/Layout/Header/Header.jsx +86 -1
- package/dist/Atomic/Layout/MainMenu/MainMenu.jsx +164 -1
- package/dist/Atomic/UI/AccordionTable/AccordionTable.jsx +250 -1
- package/dist/Atomic/UI/AccordionText/AccordionText.jsx +68 -1
- package/dist/Atomic/UI/Arrow/Arrow.jsx +134 -1
- package/dist/Atomic/UI/Box/Box.jsx +53 -1
- package/dist/Atomic/UI/Chart/Chart.jsx +178 -1
- package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.jsx +78 -1
- package/dist/Atomic/UI/Chart/partial/optionsConstructor.jsx +334 -1
- package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.jsx +111 -1
- package/dist/Atomic/UI/DateTime/DateTime.jsx +57 -1
- package/dist/Atomic/UI/DebugContainer/DebugContainer.jsx +44 -1
- package/dist/Atomic/UI/DebugContainer/useDebugContainer.jsx +15 -1
- package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.jsx +223 -1
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion._test.jsx +75 -1
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion.jsx +86 -1
- package/dist/Atomic/UI/PieChart/PieChart.jsx +41 -1
- package/dist/Atomic/UI/Table/Partials/TdCell.jsx +87 -1
- package/dist/Atomic/UI/Table/Partials/TdHeader.jsx +36 -1
- package/dist/Atomic/UI/Table/Partials/TdRow.jsx +103 -1
- package/dist/Atomic/UI/Table/Partials/TdTitle.jsx +55 -1
- package/dist/Atomic/UI/Table/Table.jsx +63 -1
- package/dist/Atomic/UI/Table/TdTypes/TdActions.jsx +80 -1
- package/dist/Atomic/UI/Table/TdTypes/TdPriority.jsx +26 -1
- package/dist/Atomic/UI/Table/TdTypes/TdRange.jsx +13 -1
- package/dist/Atomic/UI/Table/TdTypes/TdWeight.jsx +56 -1
- package/dist/Atomic/UI/TagList/TagList.jsx +256 -1
- package/dist/Atomic/UI/WizardStepper/constructor.jsx +86 -1
- package/dist/Classes/RESTAPI/partials/CredentialsProcessing.jsx +254 -1
- package/dist/Functions/customEventListener.jsx +96 -1
- package/dist/Functions/operations.jsx +138 -1
- package/dist/Functions/useFormTools/functions/RenderFields.jsx +108 -1
- package/dist/Functions/useFormTools/index.jsx +777 -1
- package/dist/Functions/usePasswordChecker.jsx +128 -1
- package/dist/Functions/utils.jsx +492 -1
- package/dist/Molecular/CustomIcons/components/AffiliateNetworks.jsx +22 -1
- package/dist/Molecular/CustomIcons/components/AlertCircle.jsx +24 -1
- package/dist/Molecular/CustomIcons/components/AppStore.jsx +30 -1
- package/dist/Molecular/CustomIcons/components/Arrow.jsx +33 -1
- package/dist/Molecular/CustomIcons/components/ArrowDown.jsx +18 -1
- package/dist/Molecular/CustomIcons/components/ArrowLeft.jsx +23 -1
- package/dist/Molecular/CustomIcons/components/ArrowRight.jsx +23 -1
- package/dist/Molecular/CustomIcons/components/ArrowUp.jsx +18 -1
- package/dist/Molecular/CustomIcons/components/Bell.jsx +16 -1
- package/dist/Molecular/CustomIcons/components/Button.jsx +13 -1
- package/dist/Molecular/CustomIcons/components/Campaigns.jsx +17 -1
- package/dist/Molecular/CustomIcons/components/Check.jsx +15 -1
- package/dist/Molecular/CustomIcons/components/Check2.jsx +13 -1
- package/dist/Molecular/CustomIcons/components/ChevronDown.jsx +13 -1
- package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.jsx +12 -1
- package/dist/Molecular/CustomIcons/components/ChevronLeft.jsx +12 -1
- package/dist/Molecular/CustomIcons/components/ChevronRight.jsx +12 -1
- package/dist/Molecular/CustomIcons/components/ChevronUp.jsx +12 -1
- package/dist/Molecular/CustomIcons/components/ChevronUpDown.jsx +28 -1
- package/dist/Molecular/CustomIcons/components/Close.jsx +15 -1
- package/dist/Molecular/CustomIcons/components/ColumnsOrder.jsx +18 -1
- package/dist/Molecular/CustomIcons/components/Delete.jsx +17 -1
- package/dist/Molecular/CustomIcons/components/Edit.jsx +16 -1
- package/dist/Molecular/CustomIcons/components/Email.jsx +32 -1
- package/dist/Molecular/CustomIcons/components/FinturfLogo.jsx +19 -1
- package/dist/Molecular/CustomIcons/components/FinturfLogo2.jsx +36 -1
- package/dist/Molecular/CustomIcons/components/Flows.jsx +16 -1
- package/dist/Molecular/CustomIcons/components/Gift.jsx +26 -1
- package/dist/Molecular/CustomIcons/components/GoogleAuth.jsx +30 -1
- package/dist/Molecular/CustomIcons/components/GooglePlay.jsx +30 -1
- package/dist/Molecular/CustomIcons/components/HelpCircle.jsx +20 -1
- package/dist/Molecular/CustomIcons/components/HelpCircle2.jsx +21 -1
- package/dist/Molecular/CustomIcons/components/HelpCircleFilled.jsx +20 -1
- package/dist/Molecular/CustomIcons/components/Home.jsx +17 -1
- package/dist/Molecular/CustomIcons/components/Home2.jsx +23 -1
- package/dist/Molecular/CustomIcons/components/Key.jsx +24 -1
- package/dist/Molecular/CustomIcons/components/Landers.jsx +21 -1
- package/dist/Molecular/CustomIcons/components/Lock.jsx +16 -1
- package/dist/Molecular/CustomIcons/components/Mail.jsx +27 -1
- package/dist/Molecular/CustomIcons/components/Mastercard.jsx +74 -1
- package/dist/Molecular/CustomIcons/components/Minus.jsx +26 -1
- package/dist/Molecular/CustomIcons/components/Offers.jsx +17 -1
- package/dist/Molecular/CustomIcons/components/Pause.jsx +29 -1
- package/dist/Molecular/CustomIcons/components/PayPal.jsx +42 -1
- package/dist/Molecular/CustomIcons/components/PayPalLightLarge.jsx +29 -1
- package/dist/Molecular/CustomIcons/components/Phone.jsx +31 -1
- package/dist/Molecular/CustomIcons/components/Play.jsx +26 -1
- package/dist/Molecular/CustomIcons/components/Plus.jsx +26 -1
- package/dist/Molecular/CustomIcons/components/Profile.jsx +17 -1
- package/dist/Molecular/CustomIcons/components/QRCode.jsx +30 -1
- package/dist/Molecular/CustomIcons/components/Rectangle.jsx +13 -1
- package/dist/Molecular/CustomIcons/components/Revert.jsx +14 -1
- package/dist/Molecular/CustomIcons/components/Star.jsx +15 -1
- package/dist/Molecular/CustomIcons/components/Star2.jsx +17 -1
- package/dist/Molecular/CustomIcons/components/TrafficSources.jsx +15 -1
- package/dist/Molecular/CustomIcons/components/Trash.jsx +16 -1
- package/dist/Molecular/CustomIcons/components/TrashRed.jsx +16 -1
- package/dist/Molecular/CustomIcons/components/Triggers.jsx +16 -1
- package/dist/Molecular/CustomIcons/components/User.jsx +26 -1
- package/dist/Molecular/CustomIcons/components/Visa.jsx +32 -1
- package/dist/Molecular/CustomIcons/components/X.jsx +13 -1
- package/dist/Molecular/FormElement/FormElement.jsx +52 -1
- package/dist/Molecular/FormWithDependOn/FormWithDependOn.jsx +161 -1
- package/dist/Molecular/InputAddress/InputAddress.jsx +641 -1
- package/dist/Molecular/InputPassword/InputPassword.jsx +50 -1
- package/package.json +1 -1
|
@@ -1 +1,161 @@
|
|
|
1
|
-
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
|
|
3
|
+
// global
|
|
4
|
+
import { useEffect, useState } from 'react';
|
|
5
|
+
|
|
6
|
+
import useFormFieldsChangesManager from '../../Functions/hooks/useFormFieldsChangesManager';
|
|
7
|
+
import { clone, getIsOnlyAnObject } from '../../Functions/utils';
|
|
8
|
+
|
|
9
|
+
// local functions
|
|
10
|
+
import { getDependOnStarter } from './partials/_utils';
|
|
11
|
+
|
|
12
|
+
const RC = 'form-with-depend-on';
|
|
13
|
+
|
|
14
|
+
function FormWithDependOn({ ref, form, formId, setForm, getActualForm: getActualFormOuter, onChange, renderField, getAnotherActions, className, isInitializeByDependOn, isFormDisabled, typeOfUse = 'default' }) {
|
|
15
|
+
// ? Прихраниваем состояние формы на момент входа
|
|
16
|
+
const [initialForm] = useState(clone(form));
|
|
17
|
+
|
|
18
|
+
const safelySetForm = typeof setForm === 'function' ? setForm : () => {};
|
|
19
|
+
const safelyOnChange = typeof onChange === 'function' ? onChange : () => {};
|
|
20
|
+
|
|
21
|
+
const getActualForm = typeof getActualFormOuter === 'function' ? getActualFormOuter : () => form;
|
|
22
|
+
|
|
23
|
+
const { assignChangesToField } = useFormFieldsChangesManager({
|
|
24
|
+
form: Array.isArray(form) ? form : [],
|
|
25
|
+
setForm: safelySetForm,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const assign = assignChangesToField;
|
|
29
|
+
|
|
30
|
+
// ***** handlers *****
|
|
31
|
+
|
|
32
|
+
const anotherActions = typeof getAnotherActions === 'function'
|
|
33
|
+
? getAnotherActions({ setForm, assign, getActualForm })
|
|
34
|
+
: {};
|
|
35
|
+
|
|
36
|
+
const getMainOfAdditional = (onChange, additionalOfOnChange) => ({
|
|
37
|
+
formId,
|
|
38
|
+
actions: anotherActions,
|
|
39
|
+
isInit: true,
|
|
40
|
+
...(getIsOnlyAnObject(additionalOfOnChange) ? additionalOfOnChange : {}),
|
|
41
|
+
onChange,
|
|
42
|
+
setForm: safelySetForm,
|
|
43
|
+
assign,
|
|
44
|
+
getActualForm,
|
|
45
|
+
initialForm,
|
|
46
|
+
typeOfUse,
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const startDependOn = getDependOnStarter({ assign, getActualForm });
|
|
50
|
+
|
|
51
|
+
// ? Местный handleChange добавляет логику dependOn к верхнему onChange,
|
|
52
|
+
// ? а так же запускает прочие экшены, из объекта методов, возвращаемым getAnotherActions
|
|
53
|
+
const handleChange = (
|
|
54
|
+
newValue,
|
|
55
|
+
fieldKey,
|
|
56
|
+
propKey,
|
|
57
|
+
additionalOfOnChange,
|
|
58
|
+
) => {
|
|
59
|
+
const {
|
|
60
|
+
updatedForm = null,
|
|
61
|
+
isMakeChangesAnyway = false,
|
|
62
|
+
isUseActualForm = false,
|
|
63
|
+
} = getIsOnlyAnObject(additionalOfOnChange) ? additionalOfOnChange : {};
|
|
64
|
+
|
|
65
|
+
const currentForm = clone(
|
|
66
|
+
(() => {
|
|
67
|
+
if (isUseActualForm) return getActualForm();
|
|
68
|
+
return Array.isArray(updatedForm) ? updatedForm : form;
|
|
69
|
+
})(),
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
const currField = clone(currentForm.find(field => field.key === fieldKey));
|
|
73
|
+
|
|
74
|
+
// ? Защита от дублирующих вызовов onChange снизу
|
|
75
|
+
// ? "Если newValue такое же как уже есть и нет флага "применять изменения всегда""
|
|
76
|
+
// ! (*) - Важно !
|
|
77
|
+
// ! Отключайте прямую мутацию на уровне проектного FormItem (в каждом филде указать isNotUseInnerHandler: true)
|
|
78
|
+
// ! т.к. тот хендлер запускатся раньше и сюда филд доходит с измененным значением,
|
|
79
|
+
// ! а значит не пройдет эту if-ку
|
|
80
|
+
if (currField[propKey || 'value'] === newValue && !isMakeChangesAnyway) return;
|
|
81
|
+
|
|
82
|
+
// ? Сразу же мутируем
|
|
83
|
+
safelyOnChange(newValue, fieldKey, propKey, { ...additionalOfOnChange, updatedForm: currentForm });
|
|
84
|
+
|
|
85
|
+
// ? Механика dependOn (обработка зависимостей)
|
|
86
|
+
// ? В текущей реализации отделил от экшена all.
|
|
87
|
+
|
|
88
|
+
startDependOn({
|
|
89
|
+
newValue,
|
|
90
|
+
fieldKey,
|
|
91
|
+
propKey,
|
|
92
|
+
field: currField,
|
|
93
|
+
form: currentForm,
|
|
94
|
+
additional: getMainOfAdditional(handleChange, additionalOfOnChange),
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// ? Если в объекте методов возвращаемом getAnotherActions есть метод all, то он запускается отдельно
|
|
98
|
+
if (typeof anotherActions.all === 'function') {
|
|
99
|
+
anotherActions.all({
|
|
100
|
+
newValue,
|
|
101
|
+
fieldKey,
|
|
102
|
+
propKey,
|
|
103
|
+
field: currField,
|
|
104
|
+
form: currentForm,
|
|
105
|
+
additional: getMainOfAdditional(handleChange, additionalOfOnChange),
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (fieldKey in anotherActions && typeof anotherActions[fieldKey] === 'function') {
|
|
110
|
+
const postChanges = anotherActions[fieldKey]({
|
|
111
|
+
newValue,
|
|
112
|
+
fieldKey,
|
|
113
|
+
propKey,
|
|
114
|
+
field: currField,
|
|
115
|
+
form: currentForm,
|
|
116
|
+
additional: getMainOfAdditional(handleChange, additionalOfOnChange),
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
if (postChanges) assign(postChanges, fieldKey);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
// ***** useEffects *****
|
|
124
|
+
|
|
125
|
+
useEffect(() => {
|
|
126
|
+
if (isInitializeByDependOn && typeof setForm === 'function' && typeof onChange === 'function') {
|
|
127
|
+
form.forEach((field) => {
|
|
128
|
+
startDependOn({
|
|
129
|
+
newValue: field.value,
|
|
130
|
+
fieldKey: field.key,
|
|
131
|
+
field,
|
|
132
|
+
form,
|
|
133
|
+
additional: {
|
|
134
|
+
...getMainOfAdditional(handleChange),
|
|
135
|
+
isInitialization: true,
|
|
136
|
+
isInit: false,
|
|
137
|
+
},
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}, [isInitializeByDependOn]);
|
|
142
|
+
|
|
143
|
+
// ***** output *****
|
|
144
|
+
return (
|
|
145
|
+
<div {...(formId ? { id: formId } : {})} className={cn(RC, className)}>
|
|
146
|
+
{typeof renderField === 'function'
|
|
147
|
+
? form.map(field =>
|
|
148
|
+
renderField({
|
|
149
|
+
...getMainOfAdditional(handleChange),
|
|
150
|
+
field: {
|
|
151
|
+
...field,
|
|
152
|
+
disabled: Boolean(isFormDisabled || field.disabled),
|
|
153
|
+
},
|
|
154
|
+
}),
|
|
155
|
+
)
|
|
156
|
+
: null}
|
|
157
|
+
</div>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export default FormWithDependOn;
|