pixuireactcomponents 1.5.8 → 1.5.9
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/package.json
CHANGED
|
@@ -130,15 +130,15 @@ export var Slider = function (props) {
|
|
|
130
130
|
var newValue = trimValue(newPercent * (max - min));
|
|
131
131
|
if (newPercent != percent) {
|
|
132
132
|
setPercent(newValue / (max - min));
|
|
133
|
-
if (status == 'move'
|
|
133
|
+
if (status == 'move') {
|
|
134
134
|
onChange && onChange(newValue);
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
// start和end一定要发
|
|
138
|
-
if (status == 'start'
|
|
138
|
+
if (status == 'start') {
|
|
139
139
|
onChangeStart && onChangeStart(newValue);
|
|
140
140
|
}
|
|
141
|
-
if (status == 'end'
|
|
141
|
+
else if (status == 'end') {
|
|
142
142
|
onChangeComplete && onChangeComplete(newValue);
|
|
143
143
|
}
|
|
144
144
|
}
|
|
@@ -170,7 +170,12 @@ export var Slider = function (props) {
|
|
|
170
170
|
setValueByPos(event.clientX, event.clientY, 'end');
|
|
171
171
|
};
|
|
172
172
|
var onMouseDown = function (event) {
|
|
173
|
-
setValueByPos(event.clientX, event.clientY, '
|
|
173
|
+
setValueByPos(event.clientX, event.clientY, 'start');
|
|
174
|
+
setValueByPos(event.clientX, event.clientY, 'move');
|
|
175
|
+
};
|
|
176
|
+
var onMouseUp = function (event) {
|
|
177
|
+
draging.current = false;
|
|
178
|
+
setValueByPos(event.clientX, event.clientY, 'end');
|
|
174
179
|
};
|
|
175
180
|
useEffect(function () {
|
|
176
181
|
if (refRail.current) {
|
|
@@ -182,7 +187,7 @@ export var Slider = function (props) {
|
|
|
182
187
|
var elementStyleOrClass = getElementStyleOrClass();
|
|
183
188
|
var handleStyle = __assign(__assign({}, (typeof elementStyleOrClass.handle === 'object' ? elementStyleOrClass.handle : undefined)), (vertical ? { top: -handleSize / 2 } : { left: '100%', marginLeft: -handleSize / 2 }));
|
|
184
189
|
return (h("div", { id: id, className: rootClassName, style: __assign({}, rowCenterCenter) },
|
|
185
|
-
h("div", { ref: refRail, className: typeof elementStyleOrClass.rail === 'string' ? elementStyleOrClass.rail : '', style: __assign({}, (typeof elementStyleOrClass.rail === 'object' ? elementStyleOrClass.rail : undefined)), draggable: true, onMouseDown: onMouseDown, onDragStart: onDragStart, onDrag: onDrag, onDragEnd: onDragEnd }, refRail.current &&
|
|
190
|
+
h("div", { ref: refRail, className: typeof elementStyleOrClass.rail === 'string' ? elementStyleOrClass.rail : '', style: __assign({}, (typeof elementStyleOrClass.rail === 'object' ? elementStyleOrClass.rail : undefined)), draggable: true, onMouseDown: onMouseDown, onMouseUp: onMouseUp, onDragStart: onDragStart, onDrag: onDrag, onDragEnd: onDragEnd }, refRail.current &&
|
|
186
191
|
h("div", { className: typeof elementStyleOrClass.track === 'string' ? elementStyleOrClass.track : '', style: trackStyle },
|
|
187
192
|
h("div", { ref: handleRef, className: typeof elementStyleOrClass.handle === 'string' ? elementStyleOrClass.handle : '', style: __assign(__assign({}, handleStyle), { position: 'absolute' }) })))));
|
|
188
193
|
};
|