@vkontakte/vkui 4.33.1 → 4.33.2
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/.cache/.eslintcache +1 -1
- package/.cache/.stylelintcache +1 -1
- package/.cache/.tsbuildinfo +5 -6
- package/.cache/ts/src/components/Typography/Title/Title.d.ts +1 -1
- package/dist/cjs/components/ModalRoot/ModalRoot.js +8 -2
- package/dist/cjs/components/ModalRoot/ModalRoot.js.map +1 -1
- package/dist/cjs/components/Typography/Title/Title.d.ts +1 -1
- package/dist/cjs/components/Typography/Title/Title.js.map +1 -1
- package/dist/cjs/components/WriteBar/WriteBar.js +9 -29
- package/dist/cjs/components/WriteBar/WriteBar.js.map +1 -1
- package/dist/cjs/lib/polyfills.js +20 -0
- package/dist/cjs/lib/polyfills.js.map +1 -1
- package/dist/components/ModalRoot/ModalRoot.js +8 -2
- package/dist/components/ModalRoot/ModalRoot.js.map +1 -1
- package/dist/components/Typography/Title/Title.d.ts +1 -1
- package/dist/components/Typography/Title/Title.js.map +1 -1
- package/dist/components/WriteBar/WriteBar.js +9 -28
- package/dist/components/WriteBar/WriteBar.js.map +1 -1
- package/dist/components.css +1 -1
- package/dist/components.css.map +1 -1
- package/dist/cssm/components/ModalCard/ModalCard.css +1 -1
- package/dist/cssm/components/ModalRoot/ModalRoot.js +8 -2
- package/dist/cssm/components/ModalRoot/ModalRoot.js.map +1 -1
- package/dist/cssm/components/Typography/Title/Title.d.ts +1 -1
- package/dist/cssm/components/Typography/Title/Title.js.map +1 -1
- package/dist/cssm/components/WriteBar/WriteBar.js +9 -28
- package/dist/cssm/components/WriteBar/WriteBar.js.map +1 -1
- package/dist/cssm/lib/polyfills.js +20 -0
- package/dist/cssm/lib/polyfills.js.map +1 -1
- package/dist/cssm/styles/components.css +1 -1
- package/dist/lib/polyfills.js +20 -0
- package/dist/lib/polyfills.js.map +1 -1
- package/dist/vkui.css +1 -1
- package/dist/vkui.css.map +1 -1
- package/package.json +1 -1
- package/src/components/ModalCard/ModalCard.css +1 -1
- package/src/components/ModalRoot/ModalRoot.tsx +7 -1
- package/src/components/Typography/Title/Title.tsx +1 -1
- package/src/components/WriteBar/WriteBar.tsx +13 -27
- package/src/lib/polyfills.ts +17 -0
package/package.json
CHANGED
|
@@ -362,7 +362,7 @@ class ModalRootTouchComponent extends React.Component<
|
|
|
362
362
|
|
|
363
363
|
if (!this.state.touchDown) {
|
|
364
364
|
modalState.touchStartContentScrollTop =
|
|
365
|
-
modalState.contentElement?.scrollTop;
|
|
365
|
+
modalState.contentElement?.scrollTop ?? 0;
|
|
366
366
|
this.setState({ touchDown: true });
|
|
367
367
|
}
|
|
368
368
|
|
|
@@ -830,6 +830,12 @@ function initPageModal(modalState: ModalsStateEntry) {
|
|
|
830
830
|
translateY = 0;
|
|
831
831
|
}
|
|
832
832
|
|
|
833
|
+
// Если модалка уже раскрыта обновляем состояния
|
|
834
|
+
if (translateY === 0) {
|
|
835
|
+
expanded = true;
|
|
836
|
+
collapsed = false;
|
|
837
|
+
}
|
|
838
|
+
|
|
833
839
|
modalState.expandedRange = expandedRange;
|
|
834
840
|
modalState.collapsedRange = collapsedRange;
|
|
835
841
|
modalState.hiddenRange = hiddenRange;
|
|
@@ -2,7 +2,6 @@ import * as React from "react";
|
|
|
2
2
|
import { usePlatform } from "../../hooks/usePlatform";
|
|
3
3
|
import { useExternRef } from "../../hooks/useExternRef";
|
|
4
4
|
import { hasReactNode, isFunction } from "../../lib/utils";
|
|
5
|
-
import { useDOM } from "../../lib/dom";
|
|
6
5
|
import { getClassName } from "../../helpers/getClassName";
|
|
7
6
|
import { HasRef, HasRootRef } from "../../types";
|
|
8
7
|
import "./WriteBar.css";
|
|
@@ -55,9 +54,8 @@ export const WriteBar: React.FC<WriteBarProps> = (props: WriteBarProps) => {
|
|
|
55
54
|
|
|
56
55
|
const isControlledOutside = value != null;
|
|
57
56
|
|
|
58
|
-
const { window } = useDOM();
|
|
59
57
|
const textareaRef = useExternRef(getRef);
|
|
60
|
-
const
|
|
58
|
+
const currentScrollHeight = React.useRef<number>();
|
|
61
59
|
|
|
62
60
|
const resize = React.useCallback(() => {
|
|
63
61
|
const textareaEl = textareaRef.current;
|
|
@@ -65,31 +63,19 @@ export const WriteBar: React.FC<WriteBarProps> = (props: WriteBarProps) => {
|
|
|
65
63
|
return;
|
|
66
64
|
}
|
|
67
65
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if (scrollHeight + diff <= offsetHeight) {
|
|
80
|
-
diff = 0;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
textareaEl.style.height = "0px";
|
|
84
|
-
|
|
85
|
-
const height = textareaEl.scrollHeight - diff / 4;
|
|
86
|
-
textareaEl.style.height =
|
|
87
|
-
String(Math.max(height, textareaMinHeightRef.current)) + "px";
|
|
88
|
-
|
|
89
|
-
if (isFunction(onHeightChange)) {
|
|
90
|
-
onHeightChange();
|
|
66
|
+
if (textareaEl.offsetParent) {
|
|
67
|
+
textareaEl.style.height = "";
|
|
68
|
+
textareaEl.style.height = `${textareaEl.scrollHeight}px`;
|
|
69
|
+
|
|
70
|
+
if (
|
|
71
|
+
textareaEl.scrollHeight !== currentScrollHeight.current &&
|
|
72
|
+
onHeightChange
|
|
73
|
+
) {
|
|
74
|
+
onHeightChange();
|
|
75
|
+
currentScrollHeight.current = textareaEl.scrollHeight;
|
|
76
|
+
}
|
|
91
77
|
}
|
|
92
|
-
}, [onHeightChange, textareaRef
|
|
78
|
+
}, [onHeightChange, textareaRef]);
|
|
93
79
|
|
|
94
80
|
const onTextareaChange: React.ChangeEventHandler<HTMLTextAreaElement> = (
|
|
95
81
|
event
|
package/src/lib/polyfills.ts
CHANGED
|
@@ -94,3 +94,20 @@ if (!Array.prototype.find) {
|
|
|
94
94
|
},
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
|
+
|
|
98
|
+
// String.prototype.padStart
|
|
99
|
+
if (!String.prototype.padStart) {
|
|
100
|
+
String.prototype.padStart = function padStart(targetLength, padString) {
|
|
101
|
+
targetLength = targetLength >> 0;
|
|
102
|
+
padString = String(padString || " ");
|
|
103
|
+
if (this.length > targetLength) {
|
|
104
|
+
return String(this);
|
|
105
|
+
} else {
|
|
106
|
+
targetLength = targetLength - this.length;
|
|
107
|
+
if (targetLength > padString.length) {
|
|
108
|
+
padString += padString.repeat(targetLength / padString.length);
|
|
109
|
+
}
|
|
110
|
+
return padString.slice(0, targetLength) + String(this);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
}
|