pixuireactcomponents 1.4.13 → 1.5.0

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.
@@ -1,18 +1,3 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
1
  var __assign = (this && this.__assign) || function () {
17
2
  __assign = Object.assign || function(t) {
18
3
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -24,373 +9,179 @@ var __assign = (this && this.__assign) || function () {
24
9
  };
25
10
  return __assign.apply(this, arguments);
26
11
  };
27
- var __rest = (this && this.__rest) || function (s, e) {
28
- var t = {};
29
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
30
- t[p] = s[p];
31
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
32
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
33
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
34
- t[p[i]] = s[p[i]];
35
- }
36
- return t;
37
- };
38
- import { Component, createRef, h } from 'preact';
12
+ import { h } from 'preact';
13
+ import { useEffect, useRef, useState } from 'preact/hooks';
39
14
  var rowCenterCenter = {
15
+ width: '100%',
16
+ height: '100%',
40
17
  display: 'flex',
41
18
  flexDirection: 'row',
42
19
  justifyContent: 'center',
43
20
  alignItems: 'center',
44
21
  };
45
22
  var rowBetweenCenter = {
23
+ position: 'relative',
46
24
  display: 'flex',
47
25
  flexDirection: 'row',
48
- justifyContent: 'space-between',
26
+ justifyContent: 'center',
49
27
  alignItems: 'center',
50
28
  };
51
- var Slider = /** @class */ (function (_super) {
52
- __extends(Slider, _super);
53
- function Slider(props) {
54
- var _this = _super.call(this, props) || this;
55
- _this.lastX = undefined; // 上一次位置的横坐标
56
- _this.count = 0; // 拖动条距离最左端的位置 [0, this.props.wrapperWidth]
57
- _this.rect = undefined; // 滑动区域
58
- _this.discrete = Math.round(_this.props.discrete == null ? 0 : _this.props.discrete);
59
- _this.refWrapper = createRef();
60
- //====================================================================================================
61
- //事件相关
62
- _this.onDragStart = function (event) {
63
- console.log('【Slider】DragStart event.clientX--' +
64
- event.clientX +
65
- '-----percent----' +
66
- _this.state.percent +
67
- '-----currentX----' +
68
- (_this.state.percent / 10000) * _this.props.wrapperWidth);
69
- _this.lastX = event.clentX;
70
- _this.count = (_this.state.percent / 10000) * _this.props.wrapperWidth;
71
- _this.setState({
72
- onDraging: true,
73
- });
74
- if (_this.props.onDragStart) {
75
- _this.props.onDragStart();
76
- }
77
- };
78
- _this.onDrag = function (event) {
79
- // console.log(
80
- // '【Slider】onDrag0 event.clientX--' +
81
- // event.clientX +
82
- // '-----percent----' +
83
- // this.state.percent +
84
- // '-----currentX----' +
85
- // (this.state.percent / 10000) * this.props.wrapperWidth! +
86
- // 'rect.left' +
87
- // this.rect.left +
88
- // 'rect.right' +
89
- // this.rect.right
90
- // );
91
- // if (event.clientX < this.rect.left - 50 || event.clientX > this.rect.right + 50) return;
92
- console.log('【Slider】onDrag1 event.clientX--' +
93
- event.clientX +
94
- '-----percent----' +
95
- _this.state.percent +
96
- '-----currentX----' +
97
- (_this.state.percent / 10000) * _this.props.wrapperWidth);
98
- if (_this.lastX == undefined) {
99
- _this.lastX = event.clientX;
100
- return;
101
- }
102
- console.log('【Slider】onDrag2 event.clientX--' +
103
- event.clientX +
104
- '-----percent----' +
105
- _this.state.percent +
106
- '-----currentX----' +
107
- (_this.state.percent / 10000) * _this.props.wrapperWidth);
108
- var move = Number(event.clientX) - Number(_this.lastX);
109
- _this.count += move;
110
- _this.count = Math.min(_this.props.wrapperWidth, _this.count);
111
- _this.count = Math.max(0, _this.count);
112
- var newPercent = (_this.count / _this.props.wrapperWidth) * 10000;
113
- if (_this.props.isDiscrete == true) {
114
- newPercent = (_this.count / _this.props.wrapperWidth) * _this.props.maxDiscrete;
115
- _this.discrete = Math.round(newPercent);
116
- if (_this.props.rangeControl) {
117
- _this.discrete = Math.min(_this.discrete, _this.props.endRange);
118
- _this.discrete = Math.max(_this.discrete, _this.props.startRange);
29
+ var defaultRail = {
30
+ backgroundColor: 'rgb(240,240,240)',
31
+ width: '400',
32
+ height: '10',
33
+ border: '0px solid #000',
34
+ borderRadius: '5',
35
+ };
36
+ var defaultVerticalRail = {
37
+ backgroundColor: 'rgb(240,240,240)',
38
+ width: '10',
39
+ height: '400',
40
+ border: '0px solid #000',
41
+ borderRadius: '5',
42
+ top: 200
43
+ };
44
+ var defaultTrack = {
45
+ backgroundColor: '#91caff',
46
+ width: '400',
47
+ height: '10',
48
+ border: '0px solid #000',
49
+ borderRadius: '5'
50
+ };
51
+ var defaultVerticalTrack = {
52
+ backgroundColor: '#91caff',
53
+ width: '10',
54
+ height: '400',
55
+ border: '0px solid #000',
56
+ borderRadius: '5'
57
+ };
58
+ var defaultHandle = {
59
+ backgroundColor: '#1677ff',
60
+ borderRadius: '50%',
61
+ width: '20',
62
+ height: '20',
63
+ };
64
+ export var Slider = function (props) {
65
+ var id = props.id, rootClassName = props.rootClassName, _a = props.min, min = _a === void 0 ? 0 : _a, _b = props.max, max = _b === void 0 ? 100 : _b, _c = props.step, step = _c === void 0 ? 1 : _c, _d = props.vertical, vertical = _d === void 0 ? false : _d, _e = props.range, range = _e === void 0 ? false : _e, onChangeStart = props.onChangeStart, onChange = props.onChange, onChangeComplete = props.onChangeComplete, element = props.element;
66
+ var getElementStyleOrClass = function () {
67
+ if (element == undefined) {
68
+ return {
69
+ rail: vertical ? defaultVerticalRail : defaultRail,
70
+ track: vertical ? defaultVerticalTrack : defaultTrack,
71
+ handle: defaultHandle
72
+ };
73
+ }
74
+ else {
75
+ return element;
76
+ }
77
+ };
78
+ var handleRef = useRef(null);
79
+ useEffect(function () {
80
+ if (handleRef.current) {
81
+ var handleSize_1 = 0;
82
+ if (vertical) {
83
+ handleSize_1 = handleRef.current.clientWidth;
84
+ // 对于传递百分比的特殊处理,这里一开始handle尺寸为0
85
+ if (handleRef.current.clientHeight === 0) {
86
+ handleRef.current.style.height = "".concat(handleSize_1, "px");
119
87
  }
120
- newPercent = _this.discrete * (10000 / _this.props.maxDiscrete);
121
- }
122
- _this.setState({
123
- percent: newPercent,
124
- }, function () {
125
- console.log('【Slider】OnDrag event.clientX--' +
126
- event.clientX +
127
- '-----percent----' +
128
- _this.state.percent +
129
- '-----discrete----' +
130
- _this.discrete +
131
- '-----currentX----' +
132
- (_this.state.percent / 10000) * _this.props.wrapperWidth);
133
- if (_this.props.onDrag)
134
- _this.props.onDrag(_this.props.isDiscrete ? _this.discrete : newPercent);
135
- });
136
- _this.lastX = event.clientX;
137
- };
138
- _this.onDragEnd = function (event) {
139
- _this.lastX = undefined;
140
- if (_this.props.isDiscrete == true) {
141
- //console.log("OnDragEnd -----discrete----"+this.state.discrete)
142
- _this.setState({
143
- percent: _this.discrete * (10000 / _this.props.maxDiscrete),
144
- onDraging: false,
145
- }, function () {
146
- console.log('【Slider】DragEnd event.clientX--' +
147
- event.clientX +
148
- '-----percent----' +
149
- _this.state.percent +
150
- '-----discrete----' +
151
- _this.discrete +
152
- '-----currentX----' +
153
- (_this.state.percent / 10000) * _this.props.wrapperWidth);
154
- if (_this.props.onDragEnd) {
155
- _this.props.onDragEnd(_this.props.isDiscrete ? _this.discrete : _this.state.percent);
156
- }
157
- });
88
+ setHandleSize(handleSize_1);
158
89
  }
159
90
  else {
160
- console.log('【Slider】DragEnd event.clientX--' +
161
- event.clientX +
162
- '-----percent----' +
163
- _this.state.percent +
164
- '-----currentX----' +
165
- (_this.state.percent / 10000) * _this.props.wrapperWidth);
166
- _this.setState({
167
- percent: (_this.count / _this.props.wrapperWidth) * 10000,
168
- onDraging: false,
169
- }, function () {
170
- if (_this.props.onDragEnd) {
171
- _this.props.onDragEnd(_this.props.isDiscrete ? _this.discrete : _this.state.percent);
172
- }
173
- });
174
- }
175
- };
176
- _this.onDecClick = function () {
177
- //离散的情况
178
- if (_this.props.isDiscrete) {
179
- if (_this.discrete >= 1) {
180
- _this.discrete -= 1;
181
- if (_this.props.rangeControl) {
182
- _this.discrete = Math.max(_this.discrete, _this.props.startRange);
183
- }
184
- var newPercent = _this.discrete * (10000 / _this.props.maxDiscrete);
185
- _this.setState({
186
- percent: newPercent,
187
- }, function () {
188
- if (_this.props.onDecClick) {
189
- _this.props.onDecClick(_this.discrete);
190
- }
191
- });
91
+ handleSize_1 = handleRef.current.clientHeight;
92
+ if (handleRef.current.clientWidth === 0) {
93
+ handleRef.current.style.width = "".concat(handleSize_1, "px");
192
94
  }
95
+ setHandleSize(handleSize_1);
193
96
  }
194
- //连续的情况
195
- else {
196
- if (_this.state.percent > 0) {
197
- _this.setState({
198
- percent: _this.state.percent - 1,
199
- }, function () {
200
- if (_this.props.onDecClick) {
201
- _this.props.onDecClick(_this.state.percent);
202
- }
203
- });
204
- }
97
+ }
98
+ }, [handleRef.current]);
99
+ var _f = useState(0), handleSize = _f[0], setHandleSize = _f[1];
100
+ var refRail = useRef(null);
101
+ var draging = useRef(false);
102
+ var _g = useState(0), percent = _g[0], setPercent = _g[1];
103
+ var _h = useState(0), delta = _h[0], setDelta = _h[1];
104
+ var _j = useState({}), trackStyle = _j[0], setTrackSytle = _j[1];
105
+ var getDecimalPlaces = function (num) {
106
+ if (num) {
107
+ var numStr = num.toString();
108
+ if (numStr.includes('.')) {
109
+ return numStr.split('.')[1].length;
205
110
  }
206
- };
207
- _this.onIncClick = function () {
208
- //离散的情况
209
- if (_this.props.isDiscrete) {
210
- if (_this.discrete < _this.props.maxDiscrete) {
211
- _this.discrete += 1;
212
- if (_this.props.rangeControl) {
213
- _this.discrete = Math.max(_this.discrete, _this.props.startRange);
214
- }
215
- var newPercent = _this.discrete * (10000 / _this.props.maxDiscrete);
216
- _this.setState({
217
- // discrete: this.state.discrete + 1,
218
- percent: newPercent,
219
- }, function () {
220
- if (_this.props.onIncClick) {
221
- _this.props.onIncClick(_this.discrete);
222
- }
223
- });
224
- }
111
+ }
112
+ return 0;
113
+ };
114
+ var decimalPlaces = getDecimalPlaces(step);
115
+ useEffect(function () {
116
+ // value变化修改
117
+ if (!draging.current) {
118
+ var trueValue = min;
119
+ if (props.value !== undefined) {
120
+ trueValue = props.value;
225
121
  }
226
- //连续的情况
227
- else {
228
- if (_this.state.percent < 10000) {
229
- _this.setState({
230
- percent: _this.state.percent + 1,
231
- }, function () {
232
- if (_this.props.onIncClick) {
233
- _this.props.onIncClick(_this.state.percent);
234
- }
235
- });
122
+ var newValue = trimValue(trueValue);
123
+ setPercent(newValue / (max - min));
124
+ onChange && onChange(newValue);
125
+ }
126
+ }, [props.value]);
127
+ var setValueByPos = function (x, y, status) {
128
+ if (refRail.current) {
129
+ var rect = refRail.current.getBoundingClientRect();
130
+ var newPercent = vertical ? ((rect.y + refRail.current.clientHeight - y) / refRail.current.clientHeight) : (x - rect.x) / refRail.current.clientWidth;
131
+ var newValue = trimValue(newPercent * (max - min));
132
+ if (newPercent != percent) {
133
+ setPercent(newValue / (max - min));
134
+ if (status == 'move') {
135
+ onChange && onChange(newValue);
236
136
  }
237
137
  }
238
- };
239
- //====================================================================================================
240
- //样式相关
241
- _this.wrapperStyle = function () {
242
- var wrapperStyle = __assign({ width: _this.props.wrapperWidth + 'px', height: _this.props.wrapperHeight + 'px' }, rowCenterCenter);
243
- return wrapperStyle;
244
- };
245
- _this.outerStyle = function () {
246
- var outerStyle = {
247
- width: '100%',
248
- height: _this.props.height + 'px',
249
- backgroundImage: "url(".concat(_this.props.outerBg, ")"),
250
- backgroundSize: '100% 100%',
251
- display: 'flex',
252
- flexDirection: 'row',
253
- justifyContent: 'start',
254
- alignItems: 'center',
255
- };
256
- return outerStyle;
257
- };
258
- _this.innerStyle = function () {
259
- var innerStyle = {
260
- // width: innerWidth,
261
- height: _this.props.innerHeight != null ? _this.props.innerHeight + 'px' : '100%',
262
- backgroundImage: "url(".concat(_this.props.innerBg, ")"),
263
- backgroundSize: '100% 100%',
264
- display: 'flex',
265
- flexDirection: 'row',
266
- justifyContent: 'start',
267
- alignItems: 'center',
268
- };
269
- return innerStyle;
270
- };
271
- _this.dotWrapperStyle = function () {
272
- var dotWrapperStyle = __assign({ position: 'absolute', width: _this.props.dotWrapperWidth + 'px', height: _this.props.dotWrapperHeight + 'px' }, rowCenterCenter);
273
- return dotWrapperStyle;
274
- };
275
- _this.dotStyle = function () {
276
- var dotStyle = {
277
- width: _this.props.dotWidth + 'px',
278
- height: _this.props.dotHeight + 'px',
279
- };
280
- return dotStyle;
281
- };
282
- _this.incButtonStyle = function () {
283
- var incButtonStyle = {
284
- width: _this.props.incButtonWidth + 'px',
285
- height: _this.props.incButtonHeight + 'px',
286
- //marginLeft:this.props.incButtonLeft+"px",
287
- //backgroundImage: `url(${this.props.incButtonBg})`,
288
- };
289
- return incButtonStyle;
290
- };
291
- _this.decButtonStyle = function () {
292
- var decButtonStyle = {
293
- width: _this.props.decButtonWidth + 'px',
294
- height: _this.props.decButtonHeight + 'px',
295
- //marginRight:this.props.decButtonRight+"px",
296
- //backgroundImage: `url(${this.props.decButtonBg})`,
297
- };
298
- return decButtonStyle;
299
- };
300
- _this.withButtonStyle = function () {
301
- var withButtonStyle = __assign({ minWidth: _this.props.overallWidth + 'px' }, rowBetweenCenter);
302
- return withButtonStyle;
303
- };
304
- _this.state = {
305
- percent: props.isDiscrete ? _this.props.discrete * (10000 / _this.props.maxDiscrete) : Math.floor(_this.props.percent),
306
- onDraging: false,
307
- wrapperStyle: _this.wrapperStyle(),
308
- outerStyle: _this.outerStyle(),
309
- innerStyle: _this.innerStyle(),
310
- dotStyle: _this.dotStyle(),
311
- dotWrapperStyle: _this.dotWrapperStyle(),
312
- incButtonStyle: _this.incButtonStyle(),
313
- decButtonStyle: _this.decButtonStyle(),
314
- withButtonStyle: _this.withButtonStyle(),
315
- };
316
- return _this;
317
- }
318
- //====================================================================================================
319
- //生命周期相关
320
- Slider.prototype.componentDidMount = function () {
321
- this.rect = this.refWrapper.current.getBoundingClientRect();
322
- };
323
- Slider.prototype.componentWillReceiveProps = function (nextProps) {
324
- if (JSON.stringify(this.props) === JSON.stringify(nextProps))
325
- return;
326
- //用于标识位置的props和其他样式相关的props分开比较
327
- var _a = this.props, percent = _a.percent, discrete = _a.discrete, styleProps = __rest(_a, ["percent", "discrete"]);
328
- var nextPercent = nextProps.percent, nextDiscrete = nextProps.discrete, nextstyleProps = __rest(nextProps, ["percent", "discrete"]);
329
- //拖动状态时,忽略外部传入的percent值,优先用户拖动
330
- var shouldUpdatePercent = !this.state.onDraging && !(percent == nextPercent && discrete == nextDiscrete);
331
- console.log('检查shouldUpdatePercent', shouldUpdatePercent);
332
- if (shouldUpdatePercent) {
333
- //如果从外部传入percent/discrete,则组件可根据新props来更新滑动条位置
334
- //离散情况
335
- if (this.props.isDiscrete == true) {
336
- this.discrete = nextProps.discrete;
337
- this.setState({
338
- percent: this.discrete * (10000 / this.props.maxDiscrete),
339
- });
138
+ // start和end一定要发
139
+ if (status == 'start') {
140
+ onChangeStart && onChangeStart(newValue);
340
141
  }
341
- //连续情况
342
- else {
343
- this.setState({
344
- percent: nextProps.percent,
345
- });
142
+ else if (status == 'end') {
143
+ onChangeComplete && onChangeComplete(newValue);
346
144
  }
347
145
  }
348
- //如果slider传入样式相关props有更改
349
- if (JSON.stringify(styleProps) !== JSON.stringify(nextstyleProps)) {
350
- this.setState({
351
- wrapperStyle: this.wrapperStyle(),
352
- outerStyle: this.outerStyle(),
353
- innerStyle: this.innerStyle(),
354
- dotStyle: this.dotStyle(),
355
- dotWrapperStyle: this.dotWrapperStyle(),
356
- incButtonStyle: this.incButtonStyle(),
357
- decButtonStyle: this.decButtonStyle(),
358
- withButtonStyle: this.withButtonStyle(),
359
- });
146
+ };
147
+ var trimValue = function (value) {
148
+ var newValue = Math.max(min, Math.min(value, max));
149
+ if (range !== null && typeof range !== 'boolean') {
150
+ var minCount = range.minCount, maxCount = range.maxCount;
151
+ newValue = Math.max(minCount, Math.min(newValue, maxCount));
152
+ }
153
+ if (step !== undefined) {
154
+ var beforeCalcuValue = (Math.round((newValue - min) / step) * step) + min;
155
+ newValue = parseFloat(beforeCalcuValue.toFixed(decimalPlaces));
360
156
  }
157
+ return newValue;
361
158
  };
362
- Slider.prototype.render = function () {
363
- var hasDot = this.props.hasDot === undefined || this.props.hasDot === true;
364
- var innerWidth = Math.floor(this.state.percent / 100) + '%';
365
- var dotWrapperMarginLeft = (this.props.wrapperWidth * this.state.percent) / 10000 - this.props.dotWrapperWidth / 2 + 'px';
366
- return (h("div", { style: this.props.hasIncDecButton ? this.state.withButtonStyle : {}, id: this.props.id, className: this.props.className },
367
- this.props.hasIncDecButton && h("img", { src: this.props.decButtonBg, style: this.state.decButtonStyle, onClick: this.onDecClick }),
368
- h("div", { ref: this.refWrapper, style: this.state.wrapperStyle },
369
- h("div", { style: __assign(__assign({}, this.state.outerStyle), this.props.outerCss), draggable: true, onDragStart: this.onDragStart, onDrag: this.onDrag, onDragEnd: this.onDragEnd },
370
- h("div", { style: __assign(__assign(__assign({}, this.state.innerStyle), { width: innerWidth }), this.props.innerCss) },
371
- h("div", { style: __assign(__assign({}, this.state.dotWrapperStyle), { marginLeft: dotWrapperMarginLeft }) }, hasDot && h("img", { src: this.props.dotBg, style: __assign(__assign({}, this.state.dotStyle), this.props.dotCss) }))))),
372
- this.props.hasIncDecButton && h("img", { src: this.props.incButtonBg, style: this.state.incButtonStyle, onClick: this.onIncClick })));
159
+ var onDragStart = function (event) {
160
+ event.stopPropagation();
161
+ draging.current = true;
162
+ setValueByPos(event.clientX, event.clientY, 'start');
373
163
  };
374
- Slider.defaultProps = {
375
- percent: 0,
376
- wrapperHeight: 34,
377
- wrapperWidth: 376,
378
- height: 5,
379
- dotWidth: 26,
380
- dotHeight: 27,
381
- dotWrapperWidth: 56,
382
- dotWrapperHeight: 57,
383
- onDragStart: null,
384
- onDrag: null,
385
- onDragEnd: null,
386
- isDiscrete: true,
387
- discrete: 0,
388
- maxDiscrete: 100,
389
- hasIncDecButton: false,
390
- overallWidth: 500,
391
- rangeControl: false,
392
- hasDot: true,
164
+ var onDrag = function (event) {
165
+ if (draging.current) {
166
+ setValueByPos(event.clientX, event.clientY, 'move');
167
+ }
168
+ };
169
+ var onDragEnd = function (event) {
170
+ draging.current = false;
171
+ setValueByPos(event.clientX, event.clientY, 'end');
393
172
  };
394
- return Slider;
395
- }(Component));
396
- export { Slider };
173
+ useEffect(function () {
174
+ if (refRail.current) {
175
+ var delta_1 = percent * (vertical ? refRail.current.clientHeight : refRail.current.clientWidth);
176
+ setDelta(delta_1);
177
+ var trackStyle_1 = __assign(__assign(__assign({}, (typeof elementStyleOrClass.track === 'object' ? elementStyleOrClass.track : undefined)), rowBetweenCenter), (vertical ? { height: delta_1, transform: "translateY(".concat(refRail.current.clientHeight - delta_1, ")") } : { width: delta_1 }));
178
+ setTrackSytle(trackStyle_1);
179
+ }
180
+ }, [refRail.current, percent]);
181
+ var elementStyleOrClass = getElementStyleOrClass();
182
+ var handleStyle = __assign(__assign({}, (typeof elementStyleOrClass.handle === 'object' ? elementStyleOrClass.handle : undefined)), (vertical ? { top: -handleSize / 2 } : { left: delta - handleSize / 2 }));
183
+ return (h("div", { id: id, className: rootClassName, style: __assign({}, rowCenterCenter) },
184
+ h("div", { ref: refRail, className: typeof elementStyleOrClass.rail === 'string' ? elementStyleOrClass.rail : '', style: __assign({}, (typeof elementStyleOrClass.rail === 'object' ? elementStyleOrClass.rail : undefined)), draggable: true, onDragStart: onDragStart, onDrag: onDrag, onDragEnd: onDragEnd }, refRail.current &&
185
+ h("div", { className: typeof elementStyleOrClass.track === 'string' ? elementStyleOrClass.track : '', style: trackStyle },
186
+ h("div", { ref: handleRef, className: typeof elementStyleOrClass.handle === 'string' ? elementStyleOrClass.handle : '', style: __assign(__assign({}, handleStyle), { position: 'absolute' }) })))));
187
+ };
@@ -1,5 +1,7 @@
1
- import { h } from 'preact';
1
+ import { CSSProperties, h } from 'preact';
2
2
  export interface VideoPlayerProps {
3
+ rootId?: string;
4
+ rootClassName?: string;
3
5
  playUrl: string;
4
6
  autoPlay?: boolean;
5
7
  playEvent?: {
@@ -8,20 +10,20 @@ export interface VideoPlayerProps {
8
10
  onEnded?: () => void;
9
11
  onFirstFrame?: () => void;
10
12
  };
11
- elementClass: {
12
- playIcon: string;
13
- pauseIcon: string;
14
- loadingIcon: string;
15
- reloadIcon: string;
13
+ iconElement?: {
14
+ playIcon?: string | CSSProperties;
15
+ pauseIcon?: string | CSSProperties;
16
+ loadingIcon?: string | CSSProperties;
17
+ reloadIcon?: string | CSSProperties;
16
18
  };
17
- sliderBG?: {
18
- outerBG?: string;
19
- innerBG?: string;
20
- dotBG?: string;
19
+ sliderElement?: {
20
+ rail?: string | CSSProperties;
21
+ track?: string | CSSProperties;
22
+ handle?: string | CSSProperties;
23
+ time?: string | CSSProperties;
21
24
  };
22
25
  hideSliderDuration?: number;
23
26
  videoDuration?: number;
24
27
  compRef?: any;
25
- rootClassName?: string;
26
28
  }
27
29
  export declare const VideoPlayer: (props: VideoPlayerProps) => h.JSX.Element;