@redneckz/wildless-cms-uni-blocks 0.14.668 → 0.14.670
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/bundle/bundle.umd.js +21 -21
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/ui-kit/YandexMap/YandexMap.d.ts +0 -1
- package/dist/components/CreditCardForm/CreditCardForm.js +5 -1
- package/dist/components/CreditCardForm/CreditCardForm.js.map +1 -1
- package/dist/components/CreditForm/CreditForm.js +5 -1
- package/dist/components/CreditForm/CreditForm.js.map +1 -1
- package/dist/ui-kit/FormField/Fields/AddressRetailField.js +2 -1
- package/dist/ui-kit/FormField/Fields/AddressRetailField.js.map +1 -1
- package/dist/ui-kit/FormField/validators.js +1 -1
- package/dist/ui-kit/FormField/validators.js.map +1 -1
- package/dist/ui-kit/YandexMap/YandexMap.d.ts +0 -1
- package/dist/ui-kit/YandexMap/YandexMap.js +6 -15
- package/dist/ui-kit/YandexMap/YandexMap.js.map +1 -1
- package/lib/components/CreditCardForm/CreditCardForm.js +6 -2
- package/lib/components/CreditCardForm/CreditCardForm.js.map +1 -1
- package/lib/components/CreditForm/CreditForm.js +6 -2
- package/lib/components/CreditForm/CreditForm.js.map +1 -1
- package/lib/ui-kit/FormField/Fields/AddressRetailField.js +2 -1
- package/lib/ui-kit/FormField/Fields/AddressRetailField.js.map +1 -1
- package/lib/ui-kit/FormField/validators.js +1 -1
- package/lib/ui-kit/FormField/validators.js.map +1 -1
- package/lib/ui-kit/YandexMap/YandexMap.d.ts +0 -1
- package/lib/ui-kit/YandexMap/YandexMap.js +6 -15
- package/lib/ui-kit/YandexMap/YandexMap.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +21 -21
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/ui-kit/YandexMap/YandexMap.d.ts +0 -1
- package/mobile/dist/components/CreditCardForm/CreditCardForm.js +5 -1
- package/mobile/dist/components/CreditCardForm/CreditCardForm.js.map +1 -1
- package/mobile/dist/components/CreditForm/CreditForm.js +5 -1
- package/mobile/dist/components/CreditForm/CreditForm.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/AddressRetailField.js +2 -1
- package/mobile/dist/ui-kit/FormField/Fields/AddressRetailField.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/validators.js +1 -1
- package/mobile/dist/ui-kit/FormField/validators.js.map +1 -1
- package/mobile/dist/ui-kit/YandexMap/YandexMap.d.ts +0 -1
- package/mobile/dist/ui-kit/YandexMap/YandexMap.js +6 -15
- package/mobile/dist/ui-kit/YandexMap/YandexMap.js.map +1 -1
- package/mobile/lib/components/CreditCardForm/CreditCardForm.js +6 -2
- package/mobile/lib/components/CreditCardForm/CreditCardForm.js.map +1 -1
- package/mobile/lib/components/CreditForm/CreditForm.js +6 -2
- package/mobile/lib/components/CreditForm/CreditForm.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/AddressRetailField.js +2 -1
- package/mobile/lib/ui-kit/FormField/Fields/AddressRetailField.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/validators.js +1 -1
- package/mobile/lib/ui-kit/FormField/validators.js.map +1 -1
- package/mobile/lib/ui-kit/YandexMap/YandexMap.d.ts +0 -1
- package/mobile/lib/ui-kit/YandexMap/YandexMap.js +6 -15
- package/mobile/lib/ui-kit/YandexMap/YandexMap.js.map +1 -1
- package/mobile/src/components/CreditCardForm/CreditCardForm.tsx +10 -2
- package/mobile/src/components/CreditForm/CreditForm.tsx +10 -2
- package/mobile/src/ui-kit/FormField/Fields/AddressRetailField.tsx +2 -6
- package/mobile/src/ui-kit/FormField/validators.ts +1 -1
- package/mobile/src/ui-kit/YandexMap/YandexMap.tsx +47 -59
- package/package.json +1 -1
- package/src/components/CreditCardForm/CreditCardForm.tsx +10 -2
- package/src/components/CreditForm/CreditForm.tsx +10 -2
- package/src/ui-kit/FormField/Fields/AddressRetailField.tsx +2 -6
- package/src/ui-kit/FormField/validators.ts +1 -1
- package/src/ui-kit/YandexMap/YandexMap.tsx +47 -59
package/bundle/bundle.umd.js
CHANGED
|
@@ -1456,7 +1456,7 @@
|
|
|
1456
1456
|
const snilsValidator = (errorMsg) => validator(snilsValidate)(errorMsg);
|
|
1457
1457
|
const emailValidate = (email) => /^[^\s@]+@[^\s@]+\.[a-zA-Z]{2,4}$/.test(email);
|
|
1458
1458
|
const emailValidator = (errorMsg) => validator((_) => emailValidate(_))(errorMsg);
|
|
1459
|
-
const addressDaDataValidate = (address) => Boolean(address.
|
|
1459
|
+
const addressDaDataValidate = (address) => Boolean(address.region && address.city && address.house);
|
|
1460
1460
|
const addressDaDataValidator = () => validator(addressDaDataValidate)('Укажите регион, город/населенный пункт, улицу, дом, квартиру');
|
|
1461
1461
|
const addressOrganizationValidator = () => validator((address) => Boolean(address.fiasCode && address.city && address.house))('Укажите регион, город/населенный пункт, улицу, дом');
|
|
1462
1462
|
const codeWordValidator = (errorMsg) => validator((_) => typeof _ === 'string' && _.length >= 3 && _.length <= 21 && /^[\u0400-\u04FF\d]+$/u.test(_))(errorMsg ?? ERROR_MESSAGE);
|
|
@@ -1975,12 +1975,13 @@
|
|
|
1975
1975
|
// Сейчас реализован поиск среди тестовых данных
|
|
1976
1976
|
// TODO: Также выяснить что делать когда ничего не найдено
|
|
1977
1977
|
// TODO: На макетах также когда есть поле поиска нет кнопки открыть на карте.
|
|
1978
|
-
const YandexMap = JSX(({ points, className = '', zoom = 5, isLoad
|
|
1978
|
+
const YandexMap = JSX(({ points, className = '', zoom = 5, isLoad }) => {
|
|
1979
1979
|
const map = useRef(null);
|
|
1980
|
+
const parentDiv = useRef(null);
|
|
1980
1981
|
const yandexMaps = useYandexMaps();
|
|
1981
1982
|
useEffect(() => {
|
|
1982
1983
|
if (map.current) {
|
|
1983
|
-
renderClusterer({ yandexMaps, map: map.current, points, isLoad
|
|
1984
|
+
renderClusterer({ yandexMaps, map: map.current, points, isLoad });
|
|
1984
1985
|
}
|
|
1985
1986
|
else {
|
|
1986
1987
|
yandexMaps?.ready(() => {
|
|
@@ -1989,7 +1990,7 @@
|
|
|
1989
1990
|
renderClusterer({ yandexMaps, map: map.current, points, isLoad });
|
|
1990
1991
|
return;
|
|
1991
1992
|
}
|
|
1992
|
-
map.current = new yandexMaps.Map(
|
|
1993
|
+
map.current = new yandexMaps.Map(parentDiv.current, {
|
|
1993
1994
|
center: getCenterPoint(points),
|
|
1994
1995
|
zoom,
|
|
1995
1996
|
controls: [],
|
|
@@ -1998,22 +1999,12 @@
|
|
|
1998
1999
|
renderClusterer({ yandexMaps, map: map.current, points, isLoad });
|
|
1999
2000
|
});
|
|
2000
2001
|
}
|
|
2001
|
-
}, [yandexMaps, points, zoom, isLoad
|
|
2002
|
-
useEffect(() => {
|
|
2003
|
-
if (map.current && selectedAddress) {
|
|
2004
|
-
yandexMaps?.geocode(selectedAddress).then((res) => {
|
|
2005
|
-
const firstGeoObject = res.geoObjects.get(0);
|
|
2006
|
-
const coords = firstGeoObject.geometry.getCoordinates();
|
|
2007
|
-
map.current.setCenter(coords);
|
|
2008
|
-
map.current.setZoom(18);
|
|
2009
|
-
});
|
|
2010
|
-
}
|
|
2011
|
-
}, [selectedAddress]);
|
|
2002
|
+
}, [yandexMaps, points, zoom, isLoad]);
|
|
2012
2003
|
if (!yandexMaps) {
|
|
2013
2004
|
return null;
|
|
2014
2005
|
}
|
|
2015
2006
|
const zIndex = 'z-10';
|
|
2016
|
-
return (jsxs("div", {
|
|
2007
|
+
return (jsxs("div", { ref: parentDiv, className: style('relative', 'w-full', className), children: [isLoad ? jsx(Loader, {}) : null, jsxs("div", { className: style('absolute right-2 top-52 z-10 w-12 overflow-hidden border border-transparent rounded-md', zIndex), children: [jsx(ZoomButton, { yandexMaps: map }), jsx(ZoomButton, { yandexMaps: map, direction: "out" })] }), renderUserGeolocation(map, yandexMaps, style('right-2 top-80', zIndex))] }));
|
|
2017
2008
|
});
|
|
2018
2009
|
const getCenterPoint = (points) => {
|
|
2019
2010
|
const centerCoords = [
|
|
@@ -2476,7 +2467,8 @@
|
|
|
2476
2467
|
const [offices, setOffices] = useState([]);
|
|
2477
2468
|
const { data } = useLeadFormData('REGION_RF');
|
|
2478
2469
|
const regionValue = field('regionRetail')?.value || {};
|
|
2479
|
-
|
|
2470
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2471
|
+
field('addressRetail');
|
|
2480
2472
|
useEffect(() => {
|
|
2481
2473
|
(async () => {
|
|
2482
2474
|
const officesList = await regionOffices(regionValue?.key ?? '');
|
|
@@ -2496,7 +2488,7 @@
|
|
|
2496
2488
|
return (jsxs("div", { children: [jsx(SelectControl, { label: "\u0410\u0434\u0440\u0435\u0441 \u043E\u0442\u0434\u0435\u043B\u0435\u043D\u0438\u044F", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043E\u0442\u0434\u0435\u043B\u0435\u043D\u0438\u0435", options: offices.map(({ id, address = '' }) => ({
|
|
2497
2489
|
key: id?.toString() || '',
|
|
2498
2490
|
text: address,
|
|
2499
|
-
})), ...getValidation(field('addressRetail'), validatorObj.addressRetail, input?.required && isRegionSelected), isSearch: true }), jsx("div", { className: "h-[600px]", children: jsx(ClientOnly, { children: jsx(YandexMap, { points: points, isLoad: !data, className: "h-full"
|
|
2491
|
+
})), ...getValidation(field('addressRetail'), validatorObj.addressRetail, input?.required && isRegionSelected), isSearch: true }), jsx("div", { className: "h-[600px]", children: jsx(ClientOnly, { children: jsx(YandexMap, { points: points, isLoad: !data, className: "h-full" }) }) })] }));
|
|
2500
2492
|
});
|
|
2501
2493
|
|
|
2502
2494
|
const useNormalizedInput = (props, { normalize, format }) => {
|
|
@@ -6917,17 +6909,21 @@
|
|
|
6917
6909
|
];
|
|
6918
6910
|
const CreditCardForm = JSX(({ className, ...rest }) => {
|
|
6919
6911
|
const [step, setStep] = useState(0);
|
|
6912
|
+
const formContainerRef = useRef(null);
|
|
6913
|
+
const scrollToTop = useCallback(() => formContainerRef?.current?.scrollIntoView({ behavior: 'smooth' }), [formContainerRef]);
|
|
6920
6914
|
useEffect(updateRefreshToken, []);
|
|
6921
6915
|
const handleNextStep = useCallback(() => {
|
|
6922
6916
|
setStep((_) => Math.min(_ + 1, WIZARD_STEPS$1));
|
|
6917
|
+
scrollToTop();
|
|
6923
6918
|
}, []);
|
|
6924
6919
|
const handlePrevStep = useCallback(() => {
|
|
6925
6920
|
//TODO search hook - 1,
|
|
6926
6921
|
setStep((_) => Math.max(_ - 1, 0));
|
|
6922
|
+
scrollToTop();
|
|
6927
6923
|
}, []);
|
|
6928
6924
|
const sections = useMemo(() => stepsSectionsMap$1[step], [step]);
|
|
6929
6925
|
const [isFormFinished, setIsFormFinished] = useState(false);
|
|
6930
|
-
return (jsx(BlockWrapper, { className: style('bg-transparent', className), defaultPadding: "p-0", ...rest, children: jsxs("div", { className: "container grid grid-cols-12", children: [isFormFinished ? null : (jsx(CreditCardFormProgress, { stepsTitles: WIZARD_TITLES$1, step: step, totalSteps: WIZARD_STEPS$1 })), jsx("div", { className: "py-lg px-5xl mt-2xs bg-white col-span-12", children: jsx(CreditCardFormStep, { step: step, sections: sections, onNextStep: handleNextStep, onPrevStep: handlePrevStep, isFormFinished: isFormFinished, finishForm: setIsFormFinished }, String(step)) })] }) }));
|
|
6926
|
+
return (jsx(BlockWrapper, { className: style('bg-transparent', className), defaultPadding: "p-0", ...rest, children: jsxs("div", { ref: formContainerRef, className: "container grid grid-cols-12", children: [isFormFinished ? null : (jsx(CreditCardFormProgress, { stepsTitles: WIZARD_TITLES$1, step: step, totalSteps: WIZARD_STEPS$1 })), jsx("div", { className: "py-lg px-5xl mt-2xs bg-white col-span-12", children: jsx(CreditCardFormStep, { step: step, sections: sections, onNextStep: handleNextStep, onPrevStep: handlePrevStep, isFormFinished: isFormFinished, finishForm: setIsFormFinished }, String(step)) })] }) }));
|
|
6931
6927
|
});
|
|
6932
6928
|
|
|
6933
6929
|
const CreditFormProgress = JSX(({ step = 1, totalSteps = 5, stepsTitles = [] }) => {
|
|
@@ -7698,18 +7694,22 @@
|
|
|
7698
7694
|
];
|
|
7699
7695
|
const CreditForm = JSX(({ className, ...rest }) => {
|
|
7700
7696
|
const [step, setStep] = useState(0);
|
|
7697
|
+
const formContainerRef = useRef(null);
|
|
7698
|
+
const scrollToTop = useCallback(() => formContainerRef?.current?.scrollIntoView({ behavior: 'smooth' }), [formContainerRef]);
|
|
7701
7699
|
useEffect(updateRefreshToken, []);
|
|
7702
7700
|
const handleNextStep = useCallback(() => {
|
|
7703
7701
|
setStep((_) => Math.min(_ + 1, WIZARD_STEPS));
|
|
7702
|
+
scrollToTop();
|
|
7704
7703
|
}, []);
|
|
7705
7704
|
const handlePrevStep = useCallback(() => {
|
|
7706
7705
|
//TODO search hook - 1,
|
|
7707
7706
|
setStep((_) => Math.max(_ - 1, 0));
|
|
7707
|
+
scrollToTop();
|
|
7708
7708
|
}, []);
|
|
7709
7709
|
const sections = useMemo(() => stepsSectionsMap[step], [step]);
|
|
7710
7710
|
const isStartStep = step === 0;
|
|
7711
7711
|
const [isFormFinished, setIsFormFinished] = useState(false);
|
|
7712
|
-
return (jsx(BlockWrapper, { className: style('bg-transparent', className), defaultPadding: "p-0", ...rest, children: jsxs("div", { className: "container grid grid-cols-12", children: [isStartStep || isFormFinished ? null : (jsx(CreditFormProgress, { stepsTitles: WIZARD_TITLES, step: step, totalSteps: WIZARD_STEPS })), jsx("div", { className: "py-lg px-5xl mt-2xs bg-white col-span-12", children: jsx(CreditFormStep, { step: step, sections: sections, onNextStep: handleNextStep, onPrevStep: handlePrevStep, isFormFinished: isFormFinished, finishForm: setIsFormFinished, renderStep: isStartStep
|
|
7712
|
+
return (jsx(BlockWrapper, { className: style('bg-transparent', className), defaultPadding: "p-0", ...rest, children: jsxs("div", { ref: formContainerRef, className: "container grid grid-cols-12", children: [isStartStep || isFormFinished ? null : (jsx(CreditFormProgress, { stepsTitles: WIZARD_TITLES, step: step, totalSteps: WIZARD_STEPS })), jsx("div", { className: "py-lg px-5xl mt-2xs bg-white col-span-12", children: jsx(CreditFormStep, { step: step, sections: sections, onNextStep: handleNextStep, onPrevStep: handlePrevStep, isFormFinished: isFormFinished, finishForm: setIsFormFinished, renderStep: isStartStep
|
|
7713
7713
|
? ({ registerSubmit, field }) => (jsx(CalculatorCredit, { ...{
|
|
7714
7714
|
defaultParams: {
|
|
7715
7715
|
sum: field('moneyValue').value,
|
|
@@ -9985,7 +9985,7 @@
|
|
|
9985
9985
|
slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
|
|
9986
9986
|
});
|
|
9987
9987
|
|
|
9988
|
-
const packageVersion = "0.14.
|
|
9988
|
+
const packageVersion = "0.14.669";
|
|
9989
9989
|
|
|
9990
9990
|
exports.Blocks = Blocks;
|
|
9991
9991
|
exports.ContentPage = ContentPage;
|