@enact/ui 4.0.11 → 4.0.13
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/CHANGELOG.md +12 -0
- package/Marquee/MarqueeBase.js +6 -3
- package/Marquee/MarqueeDecorator.js +25 -10
- package/Marquee/tests/Marquee-specs.js +14 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
The following is a curated list of changes in the Enact ui module, newest changes on the top.
|
|
4
4
|
|
|
5
|
+
## [4.0.13] - 2022-11-29
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- `ui/Marquee.MarqueeDecorator` to re-render when its size changed
|
|
10
|
+
|
|
11
|
+
## [4.0.12] - 2022-09-16
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- `ui/Marquee.MarqueeDecorator` to have proper spacing for bidirectional text
|
|
16
|
+
|
|
5
17
|
## [4.0.11] - 2022-04-25
|
|
6
18
|
|
|
7
19
|
No significant changes.
|
package/Marquee/MarqueeBase.js
CHANGED
|
@@ -288,14 +288,14 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
288
288
|
css = _ref6.css,
|
|
289
289
|
duplicate = _ref6.duplicate,
|
|
290
290
|
onMarqueeComplete = _ref6.onMarqueeComplete,
|
|
291
|
-
|
|
291
|
+
rtl = _ref6.rtl,
|
|
292
|
+
rest = _objectWithoutProperties(_ref6, ["applyOffset", "children", "clientClassName", "clientRef", "clientStyle", "css", "duplicate", "onMarqueeComplete", "rtl"]);
|
|
292
293
|
|
|
293
294
|
delete rest.alignment;
|
|
294
295
|
delete rest.animating;
|
|
295
296
|
delete rest.distance;
|
|
296
297
|
delete rest.onMarqueeComplete;
|
|
297
298
|
delete rest.overflow;
|
|
298
|
-
delete rest.rtl;
|
|
299
299
|
delete rest.spacing;
|
|
300
300
|
delete rest.speed;
|
|
301
301
|
delete rest.willAnimate;
|
|
@@ -309,7 +309,10 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
309
309
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
310
310
|
className: css.spacing,
|
|
311
311
|
ref: applyOffset
|
|
312
|
-
}),
|
|
312
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
313
|
+
dir: rtl ? 'rtl' : 'ltr',
|
|
314
|
+
children: children
|
|
315
|
+
})]
|
|
313
316
|
}) : null]
|
|
314
317
|
})
|
|
315
318
|
}));
|
|
@@ -450,12 +450,15 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
450
450
|
_this.distance = null;
|
|
451
451
|
_this.contentFits = null;
|
|
452
452
|
_this.resizeRegistry = null;
|
|
453
|
+
_this.resizeObserver = null;
|
|
453
454
|
return _this;
|
|
454
455
|
}
|
|
455
456
|
|
|
456
457
|
_createClass(_class, [{
|
|
457
458
|
key: "componentDidMount",
|
|
458
459
|
value: function componentDidMount() {
|
|
460
|
+
var _this2 = this;
|
|
461
|
+
|
|
459
462
|
if (this.context && this.context.register) {
|
|
460
463
|
this.sync = true;
|
|
461
464
|
this.context.register(this, {
|
|
@@ -466,6 +469,13 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
466
469
|
|
|
467
470
|
this.validateTextDirection();
|
|
468
471
|
|
|
472
|
+
if (typeof ResizeObserver === 'function' && this.node) {
|
|
473
|
+
this.resizeObserver = new ResizeObserver(function () {
|
|
474
|
+
_this2.handleResize();
|
|
475
|
+
});
|
|
476
|
+
this.resizeObserver.observe(this.node);
|
|
477
|
+
}
|
|
478
|
+
|
|
469
479
|
if (this.props.marqueeOn === 'render') {
|
|
470
480
|
this.startAnimation(this.props.marqueeOnRenderDelay);
|
|
471
481
|
}
|
|
@@ -519,6 +529,11 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
519
529
|
this.resizeRegistry.unregister(this.handleResize);
|
|
520
530
|
}
|
|
521
531
|
|
|
532
|
+
if (this.resizeObserver) {
|
|
533
|
+
this.resizeObserver.disconnect();
|
|
534
|
+
this.resizeObserver = null;
|
|
535
|
+
}
|
|
536
|
+
|
|
522
537
|
(0, _dispatcher.off)('keydown', this.handlePointerHide, document);
|
|
523
538
|
}
|
|
524
539
|
}, {
|
|
@@ -564,7 +579,7 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
564
579
|
}, {
|
|
565
580
|
key: "setTimeout",
|
|
566
581
|
value: function setTimeout(fn) {
|
|
567
|
-
var
|
|
582
|
+
var _this3 = this;
|
|
568
583
|
|
|
569
584
|
var time = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
570
585
|
var state = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : TimerState.CLEAR;
|
|
@@ -573,7 +588,7 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
573
588
|
if (window) {
|
|
574
589
|
this.timerState = state;
|
|
575
590
|
this.timer = window.setTimeout(function () {
|
|
576
|
-
|
|
591
|
+
_this3.timerState = TimerState.CLEAR;
|
|
577
592
|
fn();
|
|
578
593
|
}, time);
|
|
579
594
|
}
|
|
@@ -769,10 +784,10 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
769
784
|
}, {
|
|
770
785
|
key: "validateTextDirection",
|
|
771
786
|
value: function validateTextDirection() {
|
|
772
|
-
var
|
|
787
|
+
var _this4 = this;
|
|
773
788
|
|
|
774
789
|
this.setState(function (state, props) {
|
|
775
|
-
var rtl = determineTextDirection(
|
|
790
|
+
var rtl = determineTextDirection(_this4.node, props.rtl, props.forceDirection);
|
|
776
791
|
return state.rtl === rtl ? null : {
|
|
777
792
|
rtl: rtl
|
|
778
793
|
};
|
|
@@ -859,18 +874,18 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
859
874
|
}, {
|
|
860
875
|
key: "render",
|
|
861
876
|
value: function render() {
|
|
862
|
-
var
|
|
877
|
+
var _this5 = this;
|
|
863
878
|
|
|
864
879
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Resizable.ResizeContext.Consumer, {
|
|
865
880
|
children: function children(register) {
|
|
866
|
-
if (!
|
|
867
|
-
|
|
881
|
+
if (!_this5.resizeRegistry && register) {
|
|
882
|
+
_this5.resizeRegistry = register(_this5.handleResize);
|
|
868
883
|
}
|
|
869
884
|
|
|
870
|
-
if (
|
|
871
|
-
return
|
|
885
|
+
if (_this5.props.marqueeDisabled) {
|
|
886
|
+
return _this5.renderWrapped();
|
|
872
887
|
} else {
|
|
873
|
-
return
|
|
888
|
+
return _this5.renderMarquee();
|
|
874
889
|
}
|
|
875
890
|
}
|
|
876
891
|
});
|
|
@@ -140,6 +140,20 @@ describe('Marquee', function () {
|
|
|
140
140
|
done();
|
|
141
141
|
}, 100);
|
|
142
142
|
});
|
|
143
|
+
test('should creates and observes with ResizeObserver', function () {
|
|
144
|
+
var observe = jest.fn();
|
|
145
|
+
global.ResizeObserver = jest.fn(function () {
|
|
146
|
+
return {
|
|
147
|
+
observe: observe,
|
|
148
|
+
disconnect: jest.fn()
|
|
149
|
+
};
|
|
150
|
+
});
|
|
151
|
+
(0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Marquee, {
|
|
152
|
+
children: ltrText
|
|
153
|
+
}));
|
|
154
|
+
expect(global.ResizeObserver).toHaveBeenCalled();
|
|
155
|
+
expect(observe).toHaveBeenCalled();
|
|
156
|
+
});
|
|
143
157
|
});
|
|
144
158
|
describe('MarqueeBase', function () {
|
|
145
159
|
// Computed Property Tests
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enact/ui",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.13",
|
|
4
4
|
"description": "A collection of simplified unstyled cross-platform UI components for Enact",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@enact/core": "^4.0.
|
|
28
|
+
"@enact/core": "^4.0.13",
|
|
29
29
|
"classnames": "^2.2.5",
|
|
30
30
|
"direction": "^1.0.1",
|
|
31
31
|
"invariant": "^2.2.2",
|