@sima-land/ui-nucleons 43.0.1 → 43.0.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/carousel/draggable.d.ts +2 -4
- package/carousel/draggable.js +3 -3
- package/carousel/index.js +2 -1
- package/helpers/center-of.d.ts +1 -1
- package/package.json +1 -1
- package/range/index.d.ts +1 -1
- package/range/index.js +2 -2
package/carousel/draggable.d.ts
CHANGED
|
@@ -22,7 +22,6 @@ export interface DraggableProps {
|
|
|
22
22
|
transitionDuration?: number;
|
|
23
23
|
containerProps?: React.HTMLProps<HTMLDivElement>;
|
|
24
24
|
}
|
|
25
|
-
declare type Cb = () => void;
|
|
26
25
|
/**
|
|
27
26
|
* Компонент области, которую можно прокручивать перетаскиванием.
|
|
28
27
|
*/
|
|
@@ -33,7 +32,7 @@ export default class Draggable extends Component<DraggableProps> {
|
|
|
33
32
|
currentOffset: IPoint;
|
|
34
33
|
clientPosition: IPoint;
|
|
35
34
|
draggableRef: React.RefObject<HTMLDivElement>;
|
|
36
|
-
offList: Array<
|
|
35
|
+
offList: Array<VoidFunction>;
|
|
37
36
|
/**
|
|
38
37
|
* Конструктор компонента области, которую можно прокручивать перетаскиванием.
|
|
39
38
|
* @param props Свойства.
|
|
@@ -76,7 +75,7 @@ export default class Draggable extends Component<DraggableProps> {
|
|
|
76
75
|
* Предотвращает клик если было произведено смещение мышью.
|
|
77
76
|
* @param event Событие окончания захвата.
|
|
78
77
|
*/
|
|
79
|
-
|
|
78
|
+
handleClickCapture(event: React.MouseEvent<HTMLDivElement>): void;
|
|
80
79
|
/**
|
|
81
80
|
* Возвращает разницу последней сохраненной позиции и позиции в переданном событии.
|
|
82
81
|
* @param event Touch- или mouse-событие.
|
|
@@ -116,4 +115,3 @@ export default class Draggable extends Component<DraggableProps> {
|
|
|
116
115
|
*/
|
|
117
116
|
render(): JSX.Element;
|
|
118
117
|
}
|
|
119
|
-
export {};
|
package/carousel/draggable.js
CHANGED
|
@@ -51,7 +51,7 @@ class Draggable extends react_1.Component {
|
|
|
51
51
|
this.currentOffset = (0, point_1.default)();
|
|
52
52
|
this.clientPosition = (0, point_1.default)();
|
|
53
53
|
this.draggableRef = (0, react_1.createRef)();
|
|
54
|
-
this.
|
|
54
|
+
this.handleClickCapture = this.handleClickCapture.bind(this);
|
|
55
55
|
this.startCapture = this.startCapture.bind(this);
|
|
56
56
|
this.offList = [];
|
|
57
57
|
}
|
|
@@ -166,7 +166,7 @@ class Draggable extends react_1.Component {
|
|
|
166
166
|
* Предотвращает клик если было произведено смещение мышью.
|
|
167
167
|
* @param event Событие окончания захвата.
|
|
168
168
|
*/
|
|
169
|
-
|
|
169
|
+
handleClickCapture(event) {
|
|
170
170
|
if (this.needPreventClick) {
|
|
171
171
|
event.preventDefault();
|
|
172
172
|
this.togglePreventClickNeed(false);
|
|
@@ -240,7 +240,7 @@ class Draggable extends react_1.Component {
|
|
|
240
240
|
const { x, y } = this.currentOffset;
|
|
241
241
|
return (react_1.default.createElement("div", Object.assign({}, containerProps, { className: cx('draggable-container', containerProps.className),
|
|
242
242
|
// обрабатываем захват чтобы при обработке клика на дочернем элементе defaultPrevented уже был true
|
|
243
|
-
onClickCapture: this.
|
|
243
|
+
onClickCapture: this.handleClickCapture, onMouseDown: this.startCapture, onTouchStart: this.startCapture }),
|
|
244
244
|
react_1.default.createElement("div", { ref: this.draggableRef, style: {
|
|
245
245
|
transform: (0, styles_1.getTranslateStyle)(x, y),
|
|
246
246
|
transition: this.hasTransition ? (0, styles_1.getTransitionStyle)(duration, 'transform') : '',
|
package/carousel/index.js
CHANGED
|
@@ -36,6 +36,7 @@ const arrow_button_1 = require("../arrow-button");
|
|
|
36
36
|
const on_1 = __importDefault(require("../helpers/on"));
|
|
37
37
|
const bind_1 = __importDefault(require("classnames/bind"));
|
|
38
38
|
const carousel_module_scss_1 = __importDefault(require("./carousel.module.scss"));
|
|
39
|
+
const is_browser_1 = __importDefault(require("../helpers/is-browser"));
|
|
39
40
|
const CLONE_FACTOR = 3;
|
|
40
41
|
const cx = bind_1.default.bind(carousel_module_scss_1.default);
|
|
41
42
|
const isAuto = (0, fp_1.eq)('auto');
|
|
@@ -531,7 +532,7 @@ class Carousel extends react_1.Component {
|
|
|
531
532
|
* @return Данные прямоугольной области видимости карусели.
|
|
532
533
|
*/
|
|
533
534
|
getViewport() {
|
|
534
|
-
return (0, bounds_of_1.default)(this.wrapperRef.current);
|
|
535
|
+
return (0, is_browser_1.default)() ? (0, bounds_of_1.default)(this.wrapperRef.current) : null;
|
|
535
536
|
}
|
|
536
537
|
/**
|
|
537
538
|
* Сохраняет смещение карусели и позицию из события при старте захвата.
|
package/helpers/center-of.d.ts
CHANGED
package/package.json
CHANGED
package/range/index.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export declare class Range extends Component<RangeProps> {
|
|
|
35
35
|
start: Container<number>;
|
|
36
36
|
finish: Container<number>;
|
|
37
37
|
activeBounds: [number, number];
|
|
38
|
-
|
|
38
|
+
unsubscribeList?: Array<() => void>;
|
|
39
39
|
activeThumbEl?: HTMLElement;
|
|
40
40
|
isGrabbed?: boolean;
|
|
41
41
|
/**
|
package/range/index.js
CHANGED
|
@@ -77,7 +77,7 @@ class Range extends react_1.Component {
|
|
|
77
77
|
/** @inheritdoc */
|
|
78
78
|
componentDidMount() {
|
|
79
79
|
const { current: containerElem } = this.containerRef;
|
|
80
|
-
this.
|
|
80
|
+
this.unsubscribeList = [
|
|
81
81
|
(0, on_1.default)(window, 'mousemove', this.updateValues),
|
|
82
82
|
(0, on_1.default)(window, 'touchmove', this.updateValues),
|
|
83
83
|
(0, on_1.default)(window, 'mouseup', this.handleDragEnd),
|
|
@@ -103,7 +103,7 @@ class Range extends react_1.Component {
|
|
|
103
103
|
}
|
|
104
104
|
/** @inheritdoc */
|
|
105
105
|
componentWillUnmount() {
|
|
106
|
-
this.
|
|
106
|
+
this.unsubscribeList.forEach(fn => fn());
|
|
107
107
|
}
|
|
108
108
|
/**
|
|
109
109
|
* Обрабатывает событие как начало слежения за указателем/пальцем.
|