@enact/ui 4.7.0 → 4.7.1
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/AnnounceDecorator/Announce.js +10 -11
- package/Button/tests/Button-specs.js +10 -6
- package/CHANGELOG.md +8 -0
- package/Group/tests/Group-specs.js +14 -9
- package/Item/tests/Item-specs.js +10 -6
- package/Marquee/MarqueeController.js +43 -50
- package/Marquee/MarqueeDecorator.js +39 -46
- package/Placeholder/PlaceholderControllerDecorator.js +1 -2
- package/RadioDecorator/RadioDecorator.js +5 -6
- package/RadioDecorator/tests/RadioDecorator-specs.js +28 -20
- package/Resizable/Resizable.js +28 -102
- package/Resizable/ResizeContext.js +17 -0
- package/Resizable/tests/useResize-specs.js +43 -0
- package/Resizable/useResize.js +66 -0
- package/Routable/tests/Routable-specs.js +9 -6
- package/Scrollable/Scrollable.js +14 -20
- package/Scrollable/ScrollableNative.js +19 -26
- package/ToggleIcon/tests/ToggleIcon-specs.js +6 -3
- package/ToggleItem/tests/ToggleItem-specs.js +6 -3
- package/Touchable/Drag.js +2 -2
- package/Touchable/Flick.js +1 -2
- package/Touchable/Hold.js +1 -2
- package/Touchable/Pinch.js +2 -2
- package/ViewManager/View.js +9 -10
- package/VirtualList/UiVirtualListBase.js +3 -8
- package/VirtualList/VirtualListBasic.js +4 -8
- package/package.json +3 -3
|
@@ -99,11 +99,15 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
|
|
|
99
99
|
_this.enqueueForceUpdate();
|
|
100
100
|
});
|
|
101
101
|
};
|
|
102
|
+
// constants
|
|
102
103
|
_this.pixelPerLine = 39;
|
|
103
104
|
_this.scrollWheelMultiplierForDeltaPixel = 1.5;
|
|
105
|
+
// The ratio of wheel 'delta' units to pixels scrolled.
|
|
106
|
+
// status
|
|
104
107
|
_this.deferScrollTo = true;
|
|
105
108
|
_this.isScrollAnimationTargetAccumulated = false;
|
|
106
109
|
_this.isUpdatedScrollThumb = false;
|
|
110
|
+
// overscroll
|
|
107
111
|
_this.lastInputType = null;
|
|
108
112
|
_this.overscrollEnabled = false;
|
|
109
113
|
_this.overscrollStatus = {
|
|
@@ -128,6 +132,7 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
|
|
|
128
132
|
}
|
|
129
133
|
}
|
|
130
134
|
};
|
|
135
|
+
// bounds info
|
|
131
136
|
_this.bounds = {
|
|
132
137
|
clientWidth: 0,
|
|
133
138
|
clientHeight: 0,
|
|
@@ -136,15 +141,20 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
|
|
|
136
141
|
maxTop: 0,
|
|
137
142
|
maxLeft: 0
|
|
138
143
|
};
|
|
144
|
+
// wheel/drag/flick info
|
|
139
145
|
_this.wheelDirection = 0;
|
|
140
146
|
_this.isDragging = false;
|
|
141
147
|
_this.isTouching = false;
|
|
148
|
+
// scroll info
|
|
142
149
|
_this.scrolling = false;
|
|
143
150
|
_this.scrollLeft = 0;
|
|
144
151
|
_this.scrollTop = 0;
|
|
145
152
|
_this.scrollToInfo = null;
|
|
153
|
+
// component info
|
|
146
154
|
_this.childRefCurrent = null;
|
|
155
|
+
// scroll animator
|
|
147
156
|
_this.animator = new _ScrollAnimator["default"]();
|
|
157
|
+
// event handler for browser native scroll
|
|
148
158
|
_this.getRtlX = function (x) {
|
|
149
159
|
return _this.props.rtl ? -x : x;
|
|
150
160
|
};
|
|
@@ -225,6 +235,11 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
|
|
|
225
235
|
(0, _handle.forward)('onFlick', ev, _this.props);
|
|
226
236
|
}
|
|
227
237
|
};
|
|
238
|
+
/*
|
|
239
|
+
* wheel event handler;
|
|
240
|
+
* - for horizontal scroll, supports wheel action on any children nodes since web engine cannot support this
|
|
241
|
+
* - for vertical scroll, supports wheel action on scrollbars only
|
|
242
|
+
*/
|
|
228
243
|
_this.onWheel = function (ev) {
|
|
229
244
|
if (_this.isDragging) {
|
|
230
245
|
ev.preventDefault();
|
|
@@ -348,6 +363,7 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
|
|
|
348
363
|
overscrollEffect: overscrollEffect
|
|
349
364
|
});
|
|
350
365
|
};
|
|
366
|
+
// overscroll effect
|
|
351
367
|
_this.getEdgeFromPosition = function (position, maxPosition) {
|
|
352
368
|
if (position <= 0) {
|
|
353
369
|
return 'before';
|
|
@@ -454,6 +470,7 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
|
|
|
454
470
|
_this.checkAndApplyOverscrollEffect(orientation, edge, overscrollTypeOnce);
|
|
455
471
|
}
|
|
456
472
|
};
|
|
473
|
+
// call scroll callbacks and update scrollbars for native scroll
|
|
457
474
|
_this.scrollStartOnScroll = function () {
|
|
458
475
|
_this.scrolling = true;
|
|
459
476
|
_this.showThumb(_this.getScrollBounds());
|
|
@@ -504,6 +521,7 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
|
|
|
504
521
|
}
|
|
505
522
|
return reachedEdgeInfo;
|
|
506
523
|
};
|
|
524
|
+
// scrollTo API
|
|
507
525
|
_this.getPositionForScrollTo = function (opt) {
|
|
508
526
|
var bounds = _this.getScrollBounds(),
|
|
509
527
|
canScrollHorizontally = _this.canScrollHorizontally(bounds),
|
|
@@ -649,6 +667,7 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
|
|
|
649
667
|
}
|
|
650
668
|
return false;
|
|
651
669
|
};
|
|
670
|
+
// render
|
|
652
671
|
_this.initChildRef = function (ref) {
|
|
653
672
|
if (ref) {
|
|
654
673
|
_this.childRefCurrent = ref.current || ref;
|
|
@@ -750,18 +769,6 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
|
|
|
750
769
|
this.childRefCurrent.calculateMetrics(this.childRefCurrent.props);
|
|
751
770
|
this.forceUpdate();
|
|
752
771
|
}
|
|
753
|
-
|
|
754
|
-
// constants
|
|
755
|
-
|
|
756
|
-
// The ratio of wheel 'delta' units to pixels scrolled.
|
|
757
|
-
// status
|
|
758
|
-
// overscroll
|
|
759
|
-
// bounds info
|
|
760
|
-
// wheel/drag/flick info
|
|
761
|
-
// scroll info
|
|
762
|
-
// component info
|
|
763
|
-
// scroll animator
|
|
764
|
-
// event handler for browser native scroll
|
|
765
772
|
}, {
|
|
766
773
|
key: "calculateDistanceByWheel",
|
|
767
774
|
value: function calculateDistanceByWheel(deltaMode, delta, maxPixel) {
|
|
@@ -776,14 +783,6 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
|
|
|
776
783
|
}
|
|
777
784
|
return delta;
|
|
778
785
|
}
|
|
779
|
-
|
|
780
|
-
/*
|
|
781
|
-
* wheel event handler;
|
|
782
|
-
* - for horizontal scroll, supports wheel action on any children nodes since web engine cannot support this
|
|
783
|
-
* - for vertical scroll, supports wheel action on scrollbars only
|
|
784
|
-
*/
|
|
785
|
-
|
|
786
|
-
// overscroll effect
|
|
787
786
|
}, {
|
|
788
787
|
key: "forwardScrollEvent",
|
|
789
788
|
value:
|
|
@@ -798,8 +797,6 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
|
|
|
798
797
|
reachedEdgeInfo: reachedEdgeInfo
|
|
799
798
|
}, this.props);
|
|
800
799
|
}
|
|
801
|
-
|
|
802
|
-
// call scroll callbacks and update scrollbars for native scroll
|
|
803
800
|
}, {
|
|
804
801
|
key: "setScrollLeft",
|
|
805
802
|
value:
|
|
@@ -891,8 +888,6 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
|
|
|
891
888
|
childRefCurrent.scrollToPosition(this.scrollLeft + 0.1, this.scrollTop + 0.1);
|
|
892
889
|
childContainerRef.current.style.scrollBehavior = 'smooth';
|
|
893
890
|
}
|
|
894
|
-
|
|
895
|
-
// scrollTo API
|
|
896
891
|
}, {
|
|
897
892
|
key: "showThumb",
|
|
898
893
|
value:
|
|
@@ -984,8 +979,6 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
|
|
|
984
979
|
window.removeEventListener('resize', this.handleResizeWindow);
|
|
985
980
|
}
|
|
986
981
|
}
|
|
987
|
-
|
|
988
|
-
// render
|
|
989
982
|
}, {
|
|
990
983
|
key: "render",
|
|
991
984
|
value: function render() {
|
|
@@ -5,6 +5,8 @@ var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
|
5
5
|
var _ToggleIcon = _interopRequireDefault(require("../ToggleIcon"));
|
|
6
6
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
7
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
8
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
9
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
8
10
|
var tap = function tap(node) {
|
|
9
11
|
_react.fireEvent.mouseDown(node);
|
|
10
12
|
_react.fireEvent.mouseUp(node);
|
|
@@ -21,17 +23,18 @@ describe('ToggleIcon Specs', function () {
|
|
|
21
23
|
var expected = 1;
|
|
22
24
|
expect(handleToggle).toHaveBeenCalledTimes(expected);
|
|
23
25
|
});
|
|
24
|
-
test('should call onClick when clicked', function () {
|
|
26
|
+
test('should call onClick when clicked', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
25
27
|
var handleClick = jest.fn();
|
|
28
|
+
var user = _userEvent["default"].setup();
|
|
26
29
|
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_ToggleIcon["default"], {
|
|
27
30
|
onClick: handleClick,
|
|
28
31
|
children: "star"
|
|
29
32
|
}));
|
|
30
33
|
var toggleIcon = _react.screen.getByText('star');
|
|
31
|
-
|
|
34
|
+
yield user.click(toggleIcon);
|
|
32
35
|
var expected = 1;
|
|
33
36
|
expect(handleClick).toHaveBeenCalledTimes(expected);
|
|
34
|
-
});
|
|
37
|
+
}));
|
|
35
38
|
test('should call onTap when tapped', function () {
|
|
36
39
|
var handleTap = jest.fn();
|
|
37
40
|
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_ToggleIcon["default"], {
|
|
@@ -12,6 +12,8 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
12
12
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
13
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
16
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
15
17
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
16
18
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
17
19
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -46,8 +48,9 @@ describe('ToggleItem Specs', function () {
|
|
|
46
48
|
var expected = 1;
|
|
47
49
|
expect(handleToggle).toHaveBeenCalledTimes(expected);
|
|
48
50
|
});
|
|
49
|
-
test('should call onClick when clicked', function () {
|
|
51
|
+
test('should call onClick when clicked', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
50
52
|
var handleClick = jest.fn();
|
|
53
|
+
var user = _userEvent["default"].setup();
|
|
51
54
|
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_ToggleItem.ToggleItemBase, {
|
|
52
55
|
component: SlottedItem,
|
|
53
56
|
iconComponent: CustomIcon,
|
|
@@ -55,10 +58,10 @@ describe('ToggleItem Specs', function () {
|
|
|
55
58
|
children: "Toggle Item"
|
|
56
59
|
}));
|
|
57
60
|
var toggleItem = _react.screen.getByText('star');
|
|
58
|
-
|
|
61
|
+
yield user.click(toggleItem);
|
|
59
62
|
var expected = 1;
|
|
60
63
|
expect(handleClick).toHaveBeenCalledTimes(expected);
|
|
61
|
-
});
|
|
64
|
+
}));
|
|
62
65
|
test('should call onTap when tapped', function () {
|
|
63
66
|
var handleTap = jest.fn();
|
|
64
67
|
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_ToggleItem["default"], {
|
package/Touchable/Drag.js
CHANGED
|
@@ -92,6 +92,7 @@ var Drag = /*#__PURE__*/_createClass(function Drag() {
|
|
|
92
92
|
_this.setContainerBounds(node);
|
|
93
93
|
_this.move(coords);
|
|
94
94
|
};
|
|
95
|
+
// This method will get the `onDrag`, `onDragEnd`, `onDragStart` props.
|
|
95
96
|
this.updateProps = function (_ref2) {
|
|
96
97
|
var onDrag = _ref2.onDrag,
|
|
97
98
|
onDragEnd = _ref2.onDragEnd,
|
|
@@ -152,8 +153,7 @@ var Drag = /*#__PURE__*/_createClass(function Drag() {
|
|
|
152
153
|
_this.tracking = Tracking.Paused;
|
|
153
154
|
}
|
|
154
155
|
};
|
|
155
|
-
}
|
|
156
|
-
);
|
|
156
|
+
});
|
|
157
157
|
exports.Drag = Drag;
|
|
158
158
|
var defaultDragConfig = {
|
|
159
159
|
boxSizing: 'border-box',
|
package/Touchable/Flick.js
CHANGED
|
@@ -30,6 +30,7 @@ var Flick = /*#__PURE__*/function () {
|
|
|
30
30
|
_this.onFlick = onFlick;
|
|
31
31
|
_this.move(coords);
|
|
32
32
|
};
|
|
33
|
+
// This method will get the `onFlick` props.
|
|
33
34
|
this.updateProps = function (_ref2) {
|
|
34
35
|
var onFlick = _ref2.onFlick;
|
|
35
36
|
// Check `tracking` gesture is not in progress. Check if gesture exists before updating the references to the `onFlick`
|
|
@@ -111,8 +112,6 @@ var Flick = /*#__PURE__*/function () {
|
|
|
111
112
|
value: function isTracking() {
|
|
112
113
|
return this.tracking;
|
|
113
114
|
}
|
|
114
|
-
|
|
115
|
-
// This method will get the `onFlick` props.
|
|
116
115
|
}]);
|
|
117
116
|
return Flick;
|
|
118
117
|
}();
|
package/Touchable/Hold.js
CHANGED
|
@@ -61,6 +61,7 @@ var Hold = /*#__PURE__*/function () {
|
|
|
61
61
|
_this.startJob();
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
|
+
// This method will get the `onHoldStart`, `onHoldEnd`, `onHold` props.
|
|
64
65
|
this.updateProps = function (_ref4) {
|
|
65
66
|
var onHoldStart = _ref4.onHoldStart,
|
|
66
67
|
onHoldEnd = _ref4.onHoldEnd,
|
|
@@ -174,8 +175,6 @@ var Hold = /*#__PURE__*/function () {
|
|
|
174
175
|
this.pulsing = false;
|
|
175
176
|
this.next = null;
|
|
176
177
|
}
|
|
177
|
-
|
|
178
|
-
// This method will get the `onHoldStart`, `onHoldEnd`, `onHold` props.
|
|
179
178
|
_createClass(Hold, [{
|
|
180
179
|
key: "startJob",
|
|
181
180
|
value: function startJob() {
|
package/Touchable/Pinch.js
CHANGED
|
@@ -124,6 +124,7 @@ var Pinch = /*#__PURE__*/_createClass(function Pinch() {
|
|
|
124
124
|
});
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
|
+
// This method will get the `onPinch`, `onPinchEnd`, and `onPinchStart` props.
|
|
127
128
|
this.updateProps = function (_ref3) {
|
|
128
129
|
var onPinch = _ref3.onPinch,
|
|
129
130
|
onPinchEnd = _ref3.onPinchEnd,
|
|
@@ -165,8 +166,7 @@ var Pinch = /*#__PURE__*/_createClass(function Pinch() {
|
|
|
165
166
|
}
|
|
166
167
|
_this.pinchConfig = null;
|
|
167
168
|
};
|
|
168
|
-
}
|
|
169
|
-
);
|
|
169
|
+
});
|
|
170
170
|
exports.Pinch = Pinch;
|
|
171
171
|
var defaultPinchConfig = {
|
|
172
172
|
boxSizing: 'border-box',
|
package/ViewManager/View.js
CHANGED
|
@@ -55,6 +55,15 @@ var View = /*#__PURE__*/function (_Component) {
|
|
|
55
55
|
_this.enteringJob = new _util.Job(function () {
|
|
56
56
|
_this.setState(clearEntering);
|
|
57
57
|
});
|
|
58
|
+
/**
|
|
59
|
+
* Initiates a new transition
|
|
60
|
+
*
|
|
61
|
+
* @param {Function} arranger Arranger function to call (enter, leave)
|
|
62
|
+
* @param {Function} callback Completion callback
|
|
63
|
+
* @param {Boolean} [noAnimation] `true` to disable animation for this transition
|
|
64
|
+
* @returns {undefined}
|
|
65
|
+
* @private
|
|
66
|
+
*/
|
|
58
67
|
_this.prepareTransition = function (arranger, callback, noAnimation) {
|
|
59
68
|
var _this$props = _this.props,
|
|
60
69
|
duration = _this$props.duration,
|
|
@@ -215,16 +224,6 @@ var View = /*#__PURE__*/function (_Component) {
|
|
|
215
224
|
callback();
|
|
216
225
|
}
|
|
217
226
|
}
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Initiates a new transition
|
|
221
|
-
*
|
|
222
|
-
* @param {Function} arranger Arranger function to call (enter, leave)
|
|
223
|
-
* @param {Function} callback Completion callback
|
|
224
|
-
* @param {Boolean} [noAnimation] `true` to disable animation for this transition
|
|
225
|
-
* @returns {undefined}
|
|
226
|
-
* @private
|
|
227
|
-
*/
|
|
228
227
|
}, {
|
|
229
228
|
key: "render",
|
|
230
229
|
value: function render() {
|
|
@@ -59,8 +59,6 @@ var VirtualListBaseFactory = function VirtualListBaseFactory(type) {
|
|
|
59
59
|
return _class = /*#__PURE__*/function (_Component) {
|
|
60
60
|
_inherits(VirtualListCore, _Component);
|
|
61
61
|
var _super = _createSuper(VirtualListCore);
|
|
62
|
-
/* No displayName here. We set displayName to returned components of this factory function. */
|
|
63
|
-
|
|
64
62
|
function VirtualListCore(_props) {
|
|
65
63
|
var _this;
|
|
66
64
|
_classCallCheck(this, VirtualListCore);
|
|
@@ -91,6 +89,7 @@ var VirtualListBaseFactory = function VirtualListBaseFactory(type) {
|
|
|
91
89
|
_this.cc = [];
|
|
92
90
|
_this.scrollPosition = 0;
|
|
93
91
|
_this.scrollPositionTarget = 0;
|
|
92
|
+
// For individually sized item
|
|
94
93
|
_this.itemPositions = [];
|
|
95
94
|
_this.indexToScrollIntoView = -1;
|
|
96
95
|
_this.updateScrollPosition = function (_ref) {
|
|
@@ -115,6 +114,7 @@ var VirtualListBaseFactory = function VirtualListBaseFactory(type) {
|
|
|
115
114
|
_this.getMoreInfo = function () {
|
|
116
115
|
return _this.moreInfo;
|
|
117
116
|
};
|
|
117
|
+
// For individually sized item
|
|
118
118
|
_this.getItemBottomPosition = function (index) {
|
|
119
119
|
var itemPosition = _this.itemPositions[index],
|
|
120
120
|
itemSize = _this.props.itemSizes[index];
|
|
@@ -124,6 +124,7 @@ var VirtualListBaseFactory = function VirtualListBaseFactory(type) {
|
|
|
124
124
|
return index * _this.primary.gridSize - _this.props.spacing;
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
|
+
// For individually sized item
|
|
127
128
|
_this.getItemTopPositionFromPreviousItemBottomPosition = function (index, spacing) {
|
|
128
129
|
return index === 0 ? 0 : _this.getItemBottomPosition(index - 1) + spacing;
|
|
129
130
|
};
|
|
@@ -417,8 +418,6 @@ var VirtualListBaseFactory = function VirtualListBaseFactory(type) {
|
|
|
417
418
|
});
|
|
418
419
|
}
|
|
419
420
|
}
|
|
420
|
-
|
|
421
|
-
// For individually sized item
|
|
422
421
|
}, {
|
|
423
422
|
key: "getGridPosition",
|
|
424
423
|
value: function getGridPosition(index) {
|
|
@@ -453,10 +452,6 @@ var VirtualListBaseFactory = function VirtualListBaseFactory(type) {
|
|
|
453
452
|
secondaryPosition: secondaryPosition
|
|
454
453
|
};
|
|
455
454
|
}
|
|
456
|
-
|
|
457
|
-
// For individually sized item
|
|
458
|
-
|
|
459
|
-
// For individually sized item
|
|
460
455
|
}, {
|
|
461
456
|
key: "emitUpdateItems",
|
|
462
457
|
value: function emitUpdateItems() {
|
|
@@ -117,6 +117,7 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
117
117
|
_this.scrollPosition = 0;
|
|
118
118
|
_this.scrollPositionTarget = 0;
|
|
119
119
|
_this.scrollToPositionTarget = -1;
|
|
120
|
+
// For individually sized item
|
|
120
121
|
_this.itemPositions = [];
|
|
121
122
|
_this.indexToScrollIntoView = -1;
|
|
122
123
|
_this.updateScrollPosition = function (_ref, behavior) {
|
|
@@ -144,6 +145,7 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
144
145
|
_this.getCenterItemIndexFromScrollPosition = function (scrollPosition) {
|
|
145
146
|
return Math.floor((scrollPosition + _this.primary.clientSize / 2) / _this.primary.gridSize) * _this.dimensionToExtent + Math.floor(_this.dimensionToExtent / 2);
|
|
146
147
|
};
|
|
148
|
+
// For individually sized item
|
|
147
149
|
_this.getItemBottomPosition = function (index) {
|
|
148
150
|
var itemPosition = _this.itemPositions[index],
|
|
149
151
|
itemSize = _this.props.itemSizes[index];
|
|
@@ -153,6 +155,7 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
153
155
|
return index * _this.primary.gridSize - _this.props.spacing;
|
|
154
156
|
}
|
|
155
157
|
};
|
|
158
|
+
// For individually sized item
|
|
156
159
|
_this.getItemTopPositionFromPreviousItemBottomPosition = function (index, spacing) {
|
|
157
160
|
return index === 0 ? 0 : _this.getItemBottomPosition(index - 1) + spacing;
|
|
158
161
|
};
|
|
@@ -251,6 +254,7 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
251
254
|
_this.contentRef.current.style.height = _this.scrollBounds.scrollHeight + (_this.isPrimaryDirectionVertical ? 0 : -1) + 'px';
|
|
252
255
|
}
|
|
253
256
|
};
|
|
257
|
+
// scrollMode 'native' only
|
|
254
258
|
_this.getRtlPositionX = function (x) {
|
|
255
259
|
if (_this.props.rtl) {
|
|
256
260
|
return _platform.platform.ios || _platform.platform.safari || _platform.platform.chrome >= 85 || _platform.platform.androidChrome >= 85 ? -x : _this.scrollBounds.maxLeft - x;
|
|
@@ -474,8 +478,6 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
474
478
|
this.scrollToPositionTarget = -1;
|
|
475
479
|
}
|
|
476
480
|
}
|
|
477
|
-
|
|
478
|
-
// For individually sized item
|
|
479
481
|
}, {
|
|
480
482
|
key: "getGridPosition",
|
|
481
483
|
value: function getGridPosition(index) {
|
|
@@ -510,10 +512,6 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
510
512
|
secondaryPosition: secondaryPosition
|
|
511
513
|
};
|
|
512
514
|
}
|
|
513
|
-
|
|
514
|
-
// For individually sized item
|
|
515
|
-
|
|
516
|
-
// For individually sized item
|
|
517
515
|
}, {
|
|
518
516
|
key: "emitUpdateItems",
|
|
519
517
|
value: function emitUpdateItems() {
|
|
@@ -721,8 +719,6 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
721
719
|
}
|
|
722
720
|
}
|
|
723
721
|
}
|
|
724
|
-
|
|
725
|
-
// scrollMode 'native' only
|
|
726
722
|
}, {
|
|
727
723
|
key: "scrollToPosition",
|
|
728
724
|
value:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enact/ui",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.1",
|
|
4
4
|
"description": "A collection of simplified unstyled cross-platform UI components for Enact",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@enact/core": "^4.7.
|
|
34
|
+
"@enact/core": "^4.7.1",
|
|
35
35
|
"classnames": "^2.3.2",
|
|
36
36
|
"direction": "^1.0.4",
|
|
37
37
|
"invariant": "^2.2.4",
|
|
38
38
|
"prop-types": "^15.8.1",
|
|
39
|
-
"ramda": "^0.
|
|
39
|
+
"ramda": "^0.29.0",
|
|
40
40
|
"react": "^18.2.0",
|
|
41
41
|
"react-dom": "^18.2.0",
|
|
42
42
|
"react-is": "^18.2.0",
|