@zohodesk/components 1.4.6 → 1.4.8
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/.cli/propValidation_report.html +1 -1
- package/README.md +13 -2
- package/es/Accordion/Accordion.js +1 -1
- package/es/Card/Card.js +48 -14
- package/es/Card/__tests__/Card.spec.js +81 -2
- package/es/Card/__tests__/__snapshots__/Card.spec.js.snap +44 -0
- package/es/Card/props/defaultProps.js +2 -1
- package/es/Card/props/propTypes.js +2 -1
- package/es/DropBox/DropBoxElement/css/DropBoxElement.module.css +7 -0
- package/es/MultiSelect/MultiSelect.js +1 -1
- package/es/Popup/Popup.js +45 -17
- package/es/Popup/Registry.js +1 -0
- package/es/Select/Select.js +1 -1
- package/es/Select/__tests__/Select.spec.js +8 -1
- package/es/common/basic.module.css +0 -2
- package/es/components_layer.module.css +1 -0
- package/es/css.js +4 -4
- package/es/v1/Popup/Popup.js +1 -1
- package/es/v1/Select/Select.js +1 -1
- package/lib/Accordion/Accordion.js +2 -2
- package/lib/Card/Card.js +64 -30
- package/lib/Card/__tests__/Card.spec.js +118 -1
- package/lib/Card/__tests__/__snapshots__/Card.spec.js.snap +44 -0
- package/lib/Card/props/defaultProps.js +2 -1
- package/lib/Card/props/propTypes.js +2 -1
- package/lib/DropBox/DropBoxElement/css/DropBoxElement.module.css +7 -0
- package/lib/MultiSelect/MultiSelect.js +2 -2
- package/lib/Popup/Popup.js +54 -18
- package/lib/Popup/Registry.js +1 -0
- package/lib/Select/Select.js +2 -2
- package/lib/Select/__tests__/Select.spec.js +8 -1
- package/lib/common/basic.module.css +0 -2
- package/lib/components_layer.module.css +1 -0
- package/lib/css.js +4 -4
- package/lib/v1/Popup/Popup.js +2 -2
- package/lib/v1/Select/Select.js +2 -2
- package/package.json +21 -13
- package/css_error.log +0 -1
- package/install.md +0 -10
- package/postPublish.js +0 -8
- package/prePublish.js +0 -70
- package/react-cli.config.js +0 -24
- package/result.json +0 -1
- /package/.cli/{stringContains.js → themeValidate/stringContains.js} +0 -0
package/lib/Card/Card.js
CHANGED
|
@@ -175,15 +175,17 @@ var Card = /*#__PURE__*/function (_Component3) {
|
|
|
175
175
|
_this2.to = from + 3 * limit;
|
|
176
176
|
_this2.isFetching = false;
|
|
177
177
|
_this2.lastScrollTop = 0;
|
|
178
|
-
_this2.onScroll = _this2.onScroll.bind(_assertThisInitialized(_this2));
|
|
178
|
+
_this2.onScroll = _this2.onScroll.bind(_assertThisInitialized(_this2));
|
|
179
|
+
_this2.setScrollRef = _this2.setScrollRef.bind(_assertThisInitialized(_this2));
|
|
180
|
+
_this2.childEleRef = null; //this.onSetScroll = debounce(this.setScroll.bind(this, true), 10, true);
|
|
179
181
|
//this.onClearScroll = debounce(this.setScroll.bind(this, false), 500);
|
|
180
182
|
|
|
181
183
|
return _this2;
|
|
182
184
|
}
|
|
183
185
|
|
|
184
186
|
_createClass(Card, [{
|
|
185
|
-
key: "
|
|
186
|
-
value: function
|
|
187
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
188
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
187
189
|
if (this.from !== nextProps.from) {
|
|
188
190
|
this.from = nextProps.from;
|
|
189
191
|
}
|
|
@@ -204,24 +206,35 @@ var Card = /*#__PURE__*/function (_Component3) {
|
|
|
204
206
|
noMoreData = _this$props3.noMoreData,
|
|
205
207
|
scrollAt = _this$props3.scrollAt,
|
|
206
208
|
noNeedUpScroll = _this$props3.noNeedUpScroll,
|
|
207
|
-
isPercentageScroll = _this$props3.isPercentageScroll
|
|
209
|
+
isPercentageScroll = _this$props3.isPercentageScroll,
|
|
210
|
+
scrollDirection = _this$props3.scrollDirection;
|
|
211
|
+
var scrollLimitHeight = scrollHeight - scrollAt;
|
|
212
|
+
var currentVisibleBottom = scrollTop + offsetHeight;
|
|
208
213
|
|
|
209
214
|
if (scrollTop > this.lastScrollTop) {
|
|
210
|
-
this.
|
|
215
|
+
this.scrollingDirection = 'down';
|
|
211
216
|
} else {
|
|
212
|
-
this.
|
|
217
|
+
this.scrollingDirection = 'up';
|
|
213
218
|
}
|
|
214
219
|
|
|
215
220
|
this.lastScrollTop = scrollTop;
|
|
216
221
|
|
|
217
222
|
if (fetchData && !this.isFetching) {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
223
|
+
var fetchDirection = scrollDirection === 'bottomToTop' ? 'up' : 'down';
|
|
224
|
+
|
|
225
|
+
if (this.scrollingDirection === fetchDirection && !noMoreData) {
|
|
226
|
+
var prefetch = false;
|
|
227
|
+
|
|
228
|
+
if (isPercentageScroll) {
|
|
229
|
+
var scrollingPercentage = scrollDirection === 'bottomToTop' ? (scrollHeight - scrollTop) / scrollLimitHeight * 100 : currentVisibleBottom / scrollLimitHeight * 100;
|
|
230
|
+
prefetch = scrollingPercentage >= (0, _Config.getLibraryConfig)('scrollFetchLimit');
|
|
231
|
+
} else {
|
|
232
|
+
prefetch = scrollDirection === 'bottomToTop' ? scrollTop <= scrollAt : scrollLimitHeight <= currentVisibleBottom;
|
|
233
|
+
}
|
|
221
234
|
|
|
222
235
|
if (prefetch) {
|
|
223
236
|
this.isFetching = true;
|
|
224
|
-
fetchData(this.from + this.limit, this.limit + this.to, this.
|
|
237
|
+
fetchData(this.from + this.limit, this.limit + this.to, this.scrollingDirection).then(function () {
|
|
225
238
|
_this3.to = _this3.limit + _this3.to;
|
|
226
239
|
_this3.isFetching = false;
|
|
227
240
|
}, function () {
|
|
@@ -229,9 +242,11 @@ var Card = /*#__PURE__*/function (_Component3) {
|
|
|
229
242
|
});
|
|
230
243
|
}
|
|
231
244
|
} else {
|
|
232
|
-
|
|
245
|
+
var _prefetch = scrollDirection === 'bottomToTop' ? scrollLimitHeight <= currentVisibleBottom : 0 >= scrollTop - scrollAt;
|
|
246
|
+
|
|
247
|
+
if (_prefetch && this.from !== 0 && !noNeedUpScroll) {
|
|
233
248
|
this.isFetching = true;
|
|
234
|
-
fetchData(this.from - this.limit, this.to - this.limit, this.
|
|
249
|
+
fetchData(this.from - this.limit, this.to - this.limit, this.scrollingDirection).then(function () {
|
|
235
250
|
_this3.to = _this3.to - _this3.limit;
|
|
236
251
|
_this3.isFetching = false;
|
|
237
252
|
}, function () {
|
|
@@ -242,9 +257,12 @@ var Card = /*#__PURE__*/function (_Component3) {
|
|
|
242
257
|
}
|
|
243
258
|
|
|
244
259
|
if (fetchData && !noNeedUpScroll) {
|
|
245
|
-
|
|
260
|
+
var topFetch = scrollDirection === 'bottomToTop' ? !noMoreData : !noNeedUpScroll && this.from !== 0;
|
|
261
|
+
var bottomFetch = scrollDirection === 'bottomToTop' ? !noNeedUpScroll && this.from !== 0 : !noMoreData;
|
|
262
|
+
|
|
263
|
+
if (scrollTop === 0 && topFetch) {
|
|
246
264
|
scrollContainerObj.scrollTop = scrollTop + offsetHeight / 3;
|
|
247
|
-
} else if (scrollHeight ===
|
|
265
|
+
} else if (scrollHeight === currentVisibleBottom && bottomFetch) {
|
|
248
266
|
scrollContainerObj.scrollTop = scrollTop - offsetHeight / 2;
|
|
249
267
|
}
|
|
250
268
|
} // if (isScrollShadow) {
|
|
@@ -262,21 +280,36 @@ var Card = /*#__PURE__*/function (_Component3) {
|
|
|
262
280
|
// }
|
|
263
281
|
// }
|
|
264
282
|
|
|
283
|
+
}, {
|
|
284
|
+
key: "setScrollRef",
|
|
285
|
+
value: function setScrollRef(el) {
|
|
286
|
+
var _this$props4 = this.props,
|
|
287
|
+
scrollAt = _this$props4.scrollAt,
|
|
288
|
+
scrollDirection = _this$props4.scrollDirection;
|
|
289
|
+
|
|
290
|
+
if (el && scrollDirection === 'bottomToTop') {
|
|
291
|
+
requestAnimationFrame(function () {
|
|
292
|
+
el.scrollTop = el.scrollHeight + Number(scrollAt);
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
this.childEleRef && this.childEleRef(el);
|
|
297
|
+
}
|
|
265
298
|
}, {
|
|
266
299
|
key: "render",
|
|
267
300
|
value: function render() {
|
|
268
301
|
var _this4 = this;
|
|
269
302
|
|
|
270
|
-
var _this$
|
|
271
|
-
onClick = _this$
|
|
272
|
-
children = _this$
|
|
273
|
-
isScrollAttribute = _this$
|
|
274
|
-
dataId = _this$
|
|
275
|
-
eleRef = _this$
|
|
276
|
-
_this$
|
|
277
|
-
customClass = _this$
|
|
278
|
-
htmlId = _this$
|
|
279
|
-
a11y = _this$
|
|
303
|
+
var _this$props5 = this.props,
|
|
304
|
+
onClick = _this$props5.onClick,
|
|
305
|
+
children = _this$props5.children,
|
|
306
|
+
isScrollAttribute = _this$props5.isScrollAttribute,
|
|
307
|
+
dataId = _this$props5.dataId,
|
|
308
|
+
eleRef = _this$props5.eleRef,
|
|
309
|
+
_this$props5$customCl = _this$props5.customClass,
|
|
310
|
+
customClass = _this$props5$customCl === void 0 ? '' : _this$props5$customCl,
|
|
311
|
+
htmlId = _this$props5.htmlId,
|
|
312
|
+
a11y = _this$props5.a11y;
|
|
280
313
|
var isScroll = this.state.isScroll;
|
|
281
314
|
var role = a11y.role;
|
|
282
315
|
return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
@@ -295,6 +328,7 @@ var Card = /*#__PURE__*/function (_Component3) {
|
|
|
295
328
|
isScroll: isScroll
|
|
296
329
|
});
|
|
297
330
|
} else if (child.type === CardContent || _this4.props.childTypes && child.type === _this4.props.childTypes.cardContent) {
|
|
331
|
+
_this4.childEleRef = child.props.eleRef;
|
|
298
332
|
return /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
299
333
|
id: htmlId,
|
|
300
334
|
role: role,
|
|
@@ -302,7 +336,7 @@ var Card = /*#__PURE__*/function (_Component3) {
|
|
|
302
336
|
scroll: child.props.scroll,
|
|
303
337
|
preventParentScroll: child.props.preventParentScroll,
|
|
304
338
|
onScroll: _this4.onScroll,
|
|
305
|
-
eleRef:
|
|
339
|
+
eleRef: _this4.setScrollRef,
|
|
306
340
|
isScrollAttribute: child.props.isScrollAttribute,
|
|
307
341
|
dataId: child.props.dataId,
|
|
308
342
|
shrink: child.props.shrink,
|
|
@@ -344,11 +378,11 @@ var CardFooter = /*#__PURE__*/function (_Component4) {
|
|
|
344
378
|
_createClass(CardFooter, [{
|
|
345
379
|
key: "render",
|
|
346
380
|
value: function render() {
|
|
347
|
-
var _this$
|
|
348
|
-
children = _this$
|
|
349
|
-
dataId = _this$
|
|
350
|
-
customClass = _this$
|
|
351
|
-
dataSelectorId = _this$
|
|
381
|
+
var _this$props6 = this.props,
|
|
382
|
+
children = _this$props6.children,
|
|
383
|
+
dataId = _this$props6.dataId,
|
|
384
|
+
customClass = _this$props6.customClass,
|
|
385
|
+
dataSelectorId = _this$props6.dataSelectorId;
|
|
352
386
|
return /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
353
387
|
className: "".concat(customClass),
|
|
354
388
|
dataId: dataId,
|
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
var _react = _interopRequireDefault(require("react"));
|
|
4
6
|
|
|
5
7
|
var _react2 = require("@testing-library/react");
|
|
6
8
|
|
|
7
|
-
var _Card =
|
|
9
|
+
var _Card = _interopRequireWildcard(require("../Card"));
|
|
10
|
+
|
|
11
|
+
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); }
|
|
12
|
+
|
|
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; }
|
|
8
14
|
|
|
9
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
10
16
|
|
|
17
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
18
|
+
|
|
19
|
+
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); } }
|
|
20
|
+
|
|
21
|
+
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); }); }; }
|
|
22
|
+
|
|
11
23
|
describe('Card', function () {
|
|
12
24
|
test('rendering the defult props', function () {
|
|
13
25
|
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Card["default"], null)),
|
|
@@ -15,4 +27,109 @@ describe('Card', function () {
|
|
|
15
27
|
|
|
16
28
|
expect(asFragment()).toMatchSnapshot();
|
|
17
29
|
});
|
|
30
|
+
test('should trigger fetch, when scroll to the bottom of the card while isRecentOnBottom = false', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
31
|
+
var mockGetNextOptions, _render2, getByTestId, asFragment, cardContent;
|
|
32
|
+
|
|
33
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
34
|
+
while (1) {
|
|
35
|
+
switch (_context.prev = _context.next) {
|
|
36
|
+
case 0:
|
|
37
|
+
mockGetNextOptions = jest.fn(function () {
|
|
38
|
+
return new Promise(function (resolve) {
|
|
39
|
+
resolve();
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
_render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Card["default"], {
|
|
43
|
+
from: 0,
|
|
44
|
+
limit: 10,
|
|
45
|
+
fetchData: mockGetNextOptions
|
|
46
|
+
}, /*#__PURE__*/_react["default"].createElement(_Card.CardContent, {
|
|
47
|
+
dataId: "scrollToBottomCardContent"
|
|
48
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, "Hello Zam")))), getByTestId = _render2.getByTestId, asFragment = _render2.asFragment;
|
|
49
|
+
cardContent = getByTestId('scrollToBottomCardContent');
|
|
50
|
+
Object.defineProperty(cardContent, 'scrollHeight', {
|
|
51
|
+
value: 1000,
|
|
52
|
+
writable: true
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(cardContent, 'clientHeight', {
|
|
55
|
+
value: 600,
|
|
56
|
+
writable: true
|
|
57
|
+
});
|
|
58
|
+
Object.defineProperty(cardContent, 'offsetHeight', {
|
|
59
|
+
value: 600,
|
|
60
|
+
writable: true
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
_react2.fireEvent.scroll(cardContent, {
|
|
64
|
+
target: {
|
|
65
|
+
scrollTop: 401
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
_context.next = 9;
|
|
70
|
+
return (0, _react2.waitFor)(function () {
|
|
71
|
+
expect(asFragment()).toMatchSnapshot();
|
|
72
|
+
expect(mockGetNextOptions).toHaveBeenCalledWith(10, 40, 'down');
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
case 9:
|
|
76
|
+
case "end":
|
|
77
|
+
return _context.stop();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}, _callee);
|
|
81
|
+
})));
|
|
82
|
+
test('should trigger fetch, when scroll to the top of the card while scrollDirection = bottomToTop', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
83
|
+
var mockGetNextOptions, _render3, getByTestId, asFragment, cardContent;
|
|
84
|
+
|
|
85
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
86
|
+
while (1) {
|
|
87
|
+
switch (_context2.prev = _context2.next) {
|
|
88
|
+
case 0:
|
|
89
|
+
mockGetNextOptions = jest.fn(function () {
|
|
90
|
+
return new Promise(function (resolve) {
|
|
91
|
+
resolve();
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
_render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Card["default"], {
|
|
95
|
+
from: 0,
|
|
96
|
+
limit: 10,
|
|
97
|
+
scrollDirection: "bottomToTop",
|
|
98
|
+
fetchData: mockGetNextOptions
|
|
99
|
+
}, /*#__PURE__*/_react["default"].createElement(_Card.CardContent, {
|
|
100
|
+
dataId: "scrollToTopCardContent"
|
|
101
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, "Hello Zam")))), getByTestId = _render3.getByTestId, asFragment = _render3.asFragment;
|
|
102
|
+
cardContent = getByTestId('scrollToTopCardContent');
|
|
103
|
+
Object.defineProperty(cardContent, 'scrollHeight', {
|
|
104
|
+
value: 1000,
|
|
105
|
+
writable: true
|
|
106
|
+
});
|
|
107
|
+
Object.defineProperty(cardContent, 'clientHeight', {
|
|
108
|
+
value: 600,
|
|
109
|
+
writable: true
|
|
110
|
+
});
|
|
111
|
+
Object.defineProperty(cardContent, 'offsetHeight', {
|
|
112
|
+
value: 600,
|
|
113
|
+
writable: true
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
_react2.fireEvent.scroll(cardContent, {
|
|
117
|
+
target: {
|
|
118
|
+
scrollTop: 0
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
_context2.next = 9;
|
|
123
|
+
return (0, _react2.waitFor)(function () {
|
|
124
|
+
expect(asFragment()).toMatchSnapshot();
|
|
125
|
+
expect(mockGetNextOptions).toHaveBeenCalledWith(10, 40, 'up');
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
case 9:
|
|
129
|
+
case "end":
|
|
130
|
+
return _context2.stop();
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}, _callee2);
|
|
134
|
+
})));
|
|
18
135
|
});
|
|
@@ -10,3 +10,47 @@ exports[`Card rendering the defult props 1`] = `
|
|
|
10
10
|
/>
|
|
11
11
|
</DocumentFragment>
|
|
12
12
|
`;
|
|
13
|
+
|
|
14
|
+
exports[`Card should trigger fetch, when scroll to the bottom of the card while isRecentOnBottom = false 1`] = `
|
|
15
|
+
<DocumentFragment>
|
|
16
|
+
<div
|
|
17
|
+
class="flex cover coldir"
|
|
18
|
+
data-id="containerComponent"
|
|
19
|
+
data-selector-id="container"
|
|
20
|
+
data-test-id="containerComponent"
|
|
21
|
+
>
|
|
22
|
+
<div
|
|
23
|
+
class="grow basis shrinkOff scrolly"
|
|
24
|
+
data-id="scrollToBottomCardContent"
|
|
25
|
+
data-selector-id="cardContent"
|
|
26
|
+
data-test-id="scrollToBottomCardContent"
|
|
27
|
+
>
|
|
28
|
+
<div>
|
|
29
|
+
Hello Zam
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</DocumentFragment>
|
|
34
|
+
`;
|
|
35
|
+
|
|
36
|
+
exports[`Card should trigger fetch, when scroll to the top of the card while scrollDirection = bottomToTop 1`] = `
|
|
37
|
+
<DocumentFragment>
|
|
38
|
+
<div
|
|
39
|
+
class="flex cover coldir"
|
|
40
|
+
data-id="containerComponent"
|
|
41
|
+
data-selector-id="container"
|
|
42
|
+
data-test-id="containerComponent"
|
|
43
|
+
>
|
|
44
|
+
<div
|
|
45
|
+
class="grow basis shrinkOff scrolly"
|
|
46
|
+
data-id="scrollToTopCardContent"
|
|
47
|
+
data-selector-id="cardContent"
|
|
48
|
+
data-test-id="scrollToTopCardContent"
|
|
49
|
+
>
|
|
50
|
+
<div>
|
|
51
|
+
Hello Zam
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
</DocumentFragment>
|
|
56
|
+
`;
|
|
@@ -10,7 +10,8 @@ var Card_defaultProps = {
|
|
|
10
10
|
onClick: null,
|
|
11
11
|
scrollAt: '10',
|
|
12
12
|
a11y: {},
|
|
13
|
-
isPercentageScroll: false
|
|
13
|
+
isPercentageScroll: false,
|
|
14
|
+
scrollDirection: 'topToBottom'
|
|
14
15
|
};
|
|
15
16
|
exports.Card_defaultProps = Card_defaultProps;
|
|
16
17
|
var CardHeader_defaultProps = {
|
|
@@ -50,7 +50,8 @@ var Card_propTypes = {
|
|
|
50
50
|
role: _propTypes["default"].string
|
|
51
51
|
}),
|
|
52
52
|
isPercentageScroll: _propTypes["default"].bool,
|
|
53
|
-
eleRef: _propTypes["default"].func
|
|
53
|
+
eleRef: _propTypes["default"].func,
|
|
54
|
+
scrollDirection: _propTypes["default"].oneOf(['topToBottom', 'bottomToTop'])
|
|
54
55
|
};
|
|
55
56
|
exports.Card_propTypes = Card_propTypes;
|
|
56
57
|
var CardFooter_propTypes = {
|
|
@@ -18,6 +18,11 @@
|
|
|
18
18
|
box-shadow: var(--dropbox_box_shadow);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
.defaultPalette,
|
|
22
|
+
.darkPalette {
|
|
23
|
+
/*css:theme-validation:ignore*/
|
|
24
|
+
}
|
|
25
|
+
|
|
21
26
|
.defaultPalette, .darkPalette {
|
|
22
27
|
background-color: var(--dropbox_bg_color);
|
|
23
28
|
}
|
|
@@ -207,6 +212,7 @@
|
|
|
207
212
|
height: var(--zd_size10) ;
|
|
208
213
|
width: var(--zd_size10) ;
|
|
209
214
|
box-shadow: 1px -1px 2px 0 var(--dropbox_arrow_box_shadow_color);
|
|
215
|
+
/*css:theme-validation:ignore*/
|
|
210
216
|
background-color: var(--dropbox_bg_color);
|
|
211
217
|
-webkit-transform: rotateZ(-45deg);
|
|
212
218
|
transform: rotateZ(-45deg);
|
|
@@ -419,6 +425,7 @@
|
|
|
419
425
|
.closeBar {
|
|
420
426
|
/* Variable:Ignore */
|
|
421
427
|
height: 6px;
|
|
428
|
+
/*css:theme-validation:ignore*/
|
|
422
429
|
width: 20% ;
|
|
423
430
|
border-radius: 5px;
|
|
424
431
|
background-color: var(--dropbox_mob_close_bg_color);
|
|
@@ -172,8 +172,8 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
172
172
|
// suggestionContainer.addEventListener('scroll', this.handleScroll);
|
|
173
173
|
}
|
|
174
174
|
}, {
|
|
175
|
-
key: "
|
|
176
|
-
value: function
|
|
175
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
176
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
177
177
|
var _this2 = this;
|
|
178
178
|
|
|
179
179
|
var selectedOptions = nextProps.selectedOptions,
|
package/lib/Popup/Popup.js
CHANGED
|
@@ -236,7 +236,11 @@ var Popup = function Popup(Component) {
|
|
|
236
236
|
_this.handleDropElementStyleUpdate = _this.handleDropElementStyleUpdate.bind(_assertThisInitialized(_this));
|
|
237
237
|
_this.positionRef = /*#__PURE__*/_react["default"].createRef();
|
|
238
238
|
_this.rootElement = _Registry["default"].getRootElement();
|
|
239
|
-
_this.popupObserver = new _ResizeObserver["default"](_this.handlePopupResize);
|
|
239
|
+
_this.popupObserver = new _ResizeObserver["default"](_this.handlePopupResize);
|
|
240
|
+
_this.cancelRaf = _this.cancelRaf.bind(_assertThisInitialized(_this));
|
|
241
|
+
_this.cancelPendingAnimationFrames = _this.cancelPendingAnimationFrames.bind(_assertThisInitialized(_this));
|
|
242
|
+
_this.setPositionRafId = null;
|
|
243
|
+
_this.resizePositionRafId = null; //dropBoxSize
|
|
240
244
|
|
|
241
245
|
_this.size = null;
|
|
242
246
|
_this.isTargetElementVisible = false;
|
|
@@ -262,18 +266,21 @@ var Popup = function Popup(Component) {
|
|
|
262
266
|
groupPopups.push(this);
|
|
263
267
|
_Registry["default"].popups[group] = groupPopups;
|
|
264
268
|
|
|
265
|
-
if (Object.keys(_Registry["default"].popups).length === 1 && groupPopups.length === 1) {
|
|
266
|
-
|
|
267
|
-
document.addEventListener('keyup', this.documentKeyupHandler, false); // document.addEventListener('scroll', this.handleScroll, true);
|
|
269
|
+
if (Object.keys(_Registry["default"].popups).length === 1 && groupPopups.length === 1 && _Registry["default"].listenerPopupRef === undefined) {
|
|
270
|
+
_Registry["default"].listenerPopupRef = this;
|
|
268
271
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
document.addEventListener('
|
|
272
|
+
_Registry["default"].listenerPopupRef.updateListeners(true, CLICK_EVENTS, document);
|
|
273
|
+
|
|
274
|
+
document.addEventListener('keyup', _Registry["default"].listenerPopupRef.documentKeyupHandler, false); // document.addEventListener('scroll', Registry.listenerPopupRef.handleScroll, true);
|
|
275
|
+
|
|
276
|
+
window.addEventListener('resize', _Registry["default"].listenerPopupRef.handleResize);
|
|
277
|
+
document.addEventListener('mousedown', _Registry["default"].listenerPopupRef.handleDocumentMouseDown, true);
|
|
278
|
+
document.addEventListener('focus', _Registry["default"].listenerPopupRef.handleDocumentFocus, true);
|
|
272
279
|
}
|
|
273
280
|
}
|
|
274
281
|
}, {
|
|
275
|
-
key: "
|
|
276
|
-
value: function
|
|
282
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
283
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
277
284
|
var isPopupOpen = this.state.isPopupOpen;
|
|
278
285
|
|
|
279
286
|
if (typeof nextProps.isPopupOpen !== 'undefined' && nextProps.isPopupOpen !== isPopupOpen) {
|
|
@@ -337,6 +344,22 @@ var Popup = function Popup(Component) {
|
|
|
337
344
|
this.handleIframeEventListeners(shouldAdd, CLICK_EVENTS);
|
|
338
345
|
}
|
|
339
346
|
}
|
|
347
|
+
}, {
|
|
348
|
+
key: "cancelRaf",
|
|
349
|
+
value: function cancelRaf(refName) {
|
|
350
|
+
var id = this[refName];
|
|
351
|
+
|
|
352
|
+
if (id) {
|
|
353
|
+
cancelAnimationFrame(id);
|
|
354
|
+
this[refName] = null;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}, {
|
|
358
|
+
key: "cancelPendingAnimationFrames",
|
|
359
|
+
value: function cancelPendingAnimationFrames() {
|
|
360
|
+
this.cancelRaf('setPositionRafId');
|
|
361
|
+
this.cancelRaf('resizePositionRafId');
|
|
362
|
+
}
|
|
340
363
|
}, {
|
|
341
364
|
key: "componentWillUnmount",
|
|
342
365
|
value: function componentWillUnmount() {
|
|
@@ -371,14 +394,18 @@ var Popup = function Popup(Component) {
|
|
|
371
394
|
this.popupObserver.disconnect();
|
|
372
395
|
}
|
|
373
396
|
|
|
374
|
-
if (noPopups) {
|
|
375
|
-
|
|
376
|
-
document.removeEventListener('keyup', this.documentKeyupHandler); // document.removeEventListener('scroll', this.handleScroll);
|
|
397
|
+
if (noPopups && _Registry["default"].listenerPopupRef !== undefined) {
|
|
398
|
+
_Registry["default"].listenerPopupRef.updateListeners(false, CLICK_EVENTS, document);
|
|
377
399
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
400
|
+
document.removeEventListener('keyup', _Registry["default"].listenerPopupRef.documentKeyupHandler); // document.removeEventListener('scroll', Registry.listenerPopupRef.handleScroll);
|
|
401
|
+
|
|
402
|
+
window.removeEventListener('resize', _Registry["default"].listenerPopupRef.handleResize);
|
|
403
|
+
document.removeEventListener('mousedown', _Registry["default"].listenerPopupRef.handleDocumentMouseDown, true);
|
|
404
|
+
document.removeEventListener('focus', _Registry["default"].listenerPopupRef.handleDocumentFocus, true);
|
|
405
|
+
_Registry["default"].listenerPopupRef = undefined;
|
|
381
406
|
}
|
|
407
|
+
|
|
408
|
+
this.cancelPendingAnimationFrames();
|
|
382
409
|
}
|
|
383
410
|
}, {
|
|
384
411
|
key: "handleAddingScrollBlock",
|
|
@@ -906,13 +933,15 @@ var Popup = function Popup(Component) {
|
|
|
906
933
|
}
|
|
907
934
|
|
|
908
935
|
var setPosition = function setPosition() {
|
|
909
|
-
|
|
936
|
+
_this6.cancelRaf('setPositionRafId');
|
|
937
|
+
|
|
938
|
+
_this6.setPositionRafId = requestAnimationFrame(function () {
|
|
910
939
|
var placeHolderElement = _this6.placeHolderElement,
|
|
911
940
|
dropElement = _this6.dropElement;
|
|
912
941
|
var _this6$state = _this6.state,
|
|
913
942
|
position = _this6$state.position,
|
|
914
943
|
isPopupReady = _this6$state.isPopupReady;
|
|
915
|
-
var scrollContainer = placeHolderElement.closest('[data-scroll=true]') || document.body;
|
|
944
|
+
var scrollContainer = placeHolderElement ? placeHolderElement.closest('[data-scroll=true]') || document.body : document.body;
|
|
916
945
|
|
|
917
946
|
var betterPosition = _viewPort["default"].betterView(dropElement, placeHolderElement, defaultPosition, scrollContainer, {
|
|
918
947
|
needArrow: needArrow,
|
|
@@ -942,6 +971,8 @@ var Popup = function Popup(Component) {
|
|
|
942
971
|
_this6.updatePopupState(view, views, viewsOffset, targetOffset, popupOffset, isAbsolute);
|
|
943
972
|
}
|
|
944
973
|
}
|
|
974
|
+
|
|
975
|
+
_this6.setPositionRafId = null;
|
|
945
976
|
});
|
|
946
977
|
};
|
|
947
978
|
|
|
@@ -974,7 +1005,10 @@ var Popup = function Popup(Component) {
|
|
|
974
1005
|
|
|
975
1006
|
if (placeHolderElement && dropElement) {
|
|
976
1007
|
var scrollContainer = placeHolderElement.closest('[data-scroll=true]') || document.body;
|
|
977
|
-
|
|
1008
|
+
|
|
1009
|
+
_this7.cancelRaf('resizePositionRafId');
|
|
1010
|
+
|
|
1011
|
+
_this7.resizePositionRafId = requestAnimationFrame(function () {
|
|
978
1012
|
var needArrow = _this7.getNeedArrow(popup);
|
|
979
1013
|
|
|
980
1014
|
var isAbsolute = _this7.getIsAbsolutePopup(popup);
|
|
@@ -1045,6 +1079,8 @@ var Popup = function Popup(Component) {
|
|
|
1045
1079
|
// });
|
|
1046
1080
|
// }
|
|
1047
1081
|
|
|
1082
|
+
|
|
1083
|
+
_this7.resizePositionRafId = null;
|
|
1048
1084
|
});
|
|
1049
1085
|
}
|
|
1050
1086
|
}
|
package/lib/Popup/Registry.js
CHANGED
|
@@ -10,6 +10,7 @@ var _Config = require("../Provider/Config.js");
|
|
|
10
10
|
var Registry = {
|
|
11
11
|
lastOpenedGroup: [],
|
|
12
12
|
popups: {},
|
|
13
|
+
listenerPopupRef: undefined,
|
|
13
14
|
scrollBlockedListenerPopupRef: undefined,
|
|
14
15
|
scrollableListenerPopupRef: undefined,
|
|
15
16
|
getOpenedPopups: function getOpenedPopups() {
|
package/lib/Select/Select.js
CHANGED
|
@@ -184,8 +184,8 @@ var SelectComponent = /*#__PURE__*/function (_Component) {
|
|
|
184
184
|
// suggestionContainer.addEventListener('scroll', this.handleScroll);
|
|
185
185
|
}
|
|
186
186
|
}, {
|
|
187
|
-
key: "
|
|
188
|
-
value: function
|
|
187
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
188
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
189
189
|
var selectedValue = nextProps.selectedValue,
|
|
190
190
|
isDefaultSelectValue = nextProps.isDefaultSelectValue,
|
|
191
191
|
valueField = nextProps.valueField,
|
|
@@ -294,7 +294,14 @@ describe('Select -', function () {
|
|
|
294
294
|
|
|
295
295
|
expect(getAllByRole(listItemRole)).toHaveLength(1);
|
|
296
296
|
expect(asFragment()).toMatchSnapshot();
|
|
297
|
-
});
|
|
297
|
+
}); // test('Should render the only options matching search value even with additional spaces before and after', () => {
|
|
298
|
+
// const { getByRole, getAllByRole, asFragment, getByTestId } = render(<Select needSearch options={options} />);
|
|
299
|
+
// userEvent.click(getByRole(selectInputRole));
|
|
300
|
+
// userEvent.type(within(getByTestId(dropboxTestId)).getByRole('textbox'), ' 2 ');
|
|
301
|
+
// expect(getAllByRole(listItemRole)).toHaveLength(1);
|
|
302
|
+
// expect(asFragment()).toMatchSnapshot();
|
|
303
|
+
// });
|
|
304
|
+
|
|
298
305
|
test('Should trigger given onSearch, when type on the search input', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
299
306
|
var mockOnSearch, _render15, getByRole, getByTestId;
|
|
300
307
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer dot-components, dot-components.theme, dot-components.core, dot-components.reset, dot-components.base, dot-components.animation, dot-components.transition, dot-components.utility, dot-components.layout, dot-components.semantic, dot-components.atom, dot-components.molecule, dot-components.organism, dot-components.page, dot-components.effect;
|
package/lib/css.js
CHANGED
|
@@ -4,13 +4,13 @@ require("./common/reset.module.css");
|
|
|
4
4
|
|
|
5
5
|
require("./common/basic.module.css");
|
|
6
6
|
|
|
7
|
-
require("@zohodesk/variables/
|
|
7
|
+
require("@zohodesk/variables/lib/colorVariables.module.css");
|
|
8
8
|
|
|
9
|
-
require("@zohodesk/variables/
|
|
9
|
+
require("@zohodesk/variables/lib/sizeVariables.module.css");
|
|
10
10
|
|
|
11
|
-
require("@zohodesk/variables/
|
|
11
|
+
require("@zohodesk/variables/lib/fontFamilyVariables.module.css");
|
|
12
12
|
|
|
13
|
-
require("@zohodesk/icons/
|
|
13
|
+
require("@zohodesk/icons/lib/Icon/Icon.module.css");
|
|
14
14
|
|
|
15
15
|
require("./common/animation.module.css");
|
|
16
16
|
|