@pingux/astro 2.65.0 → 2.65.1-alpha.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.
- package/lib/cjs/components/DataTable/DataTable.d.ts +4 -0
- package/lib/cjs/components/DataTable/DataTable.js +28 -108
- package/lib/cjs/components/DataTable/DataTable.stories.d.ts +202 -0
- package/lib/cjs/components/DataTable/DataTable.stories.js +37 -41
- package/lib/cjs/components/DataTable/DataTable.styles.d.ts +141 -0
- package/lib/cjs/components/DataTable/DataTable.test.d.ts +1 -0
- package/lib/cjs/components/DataTable/DataTable.test.js +119 -116
- package/lib/cjs/components/DataTable/DataTableBadge.d.ts +4 -0
- package/lib/cjs/components/DataTable/DataTableBadge.js +2 -6
- package/lib/cjs/components/DataTable/DataTableBadge.test.d.ts +1 -0
- package/lib/cjs/components/DataTable/DataTableMenu.d.ts +3 -0
- package/lib/cjs/components/DataTable/DataTableMenu.test.d.ts +1 -0
- package/lib/cjs/components/DataTable/DataTableMultiLine.d.ts +4 -0
- package/lib/cjs/components/DataTable/DataTableMultiLine.js +2 -2
- package/lib/cjs/components/DataTable/DataTableMultiLine.test.d.ts +1 -0
- package/lib/cjs/components/DataTable/DataTableMultiLine.test.js +1 -2
- package/lib/cjs/components/DataTable/DataTableVirtualizer.d.ts +8 -0
- package/lib/cjs/components/DataTable/DataTableVirtualizer.js +12 -36
- package/lib/cjs/components/DataTable/index.d.ts +5 -0
- package/lib/cjs/types/dataTable.d.ts +88 -0
- package/lib/cjs/types/dataTable.js +6 -0
- package/lib/cjs/types/index.d.ts +1 -0
- package/lib/cjs/types/index.js +45 -34
- package/lib/cjs/types/shared/index.d.ts +1 -0
- package/lib/cjs/types/shared/index.js +16 -5
- package/lib/cjs/types/shared/loadingState.d.ts +1 -0
- package/lib/cjs/types/shared/loadingState.js +6 -0
- package/lib/components/DataTable/DataTable.js +28 -108
- package/lib/components/DataTable/DataTable.stories.js +37 -41
- package/lib/components/DataTable/DataTable.test.js +118 -116
- package/lib/components/DataTable/DataTableBadge.js +2 -6
- package/lib/components/DataTable/DataTableMultiLine.js +2 -2
- package/lib/components/DataTable/DataTableMultiLine.test.js +1 -2
- package/lib/components/DataTable/DataTableVirtualizer.js +13 -37
- package/lib/types/dataTable.js +1 -0
- package/lib/types/index.js +1 -0
- package/lib/types/shared/index.js +1 -0
- package/lib/types/shared/loadingState.js +1 -0
- package/package.json +3 -2
@@ -6,7 +6,6 @@ import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/inst
|
|
6
6
|
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
7
7
|
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
8
8
|
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
9
|
-
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
10
9
|
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
11
10
|
import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
|
12
11
|
import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-method";
|
@@ -16,19 +15,20 @@ import _Object$getPrototypeOf from "@babel/runtime-corejs3/core-js-stable/object
|
|
16
15
|
import _Object$setPrototypeOf from "@babel/runtime-corejs3/core-js-stable/object/set-prototype-of";
|
17
16
|
import _reverseInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/reverse";
|
18
17
|
import _typeof from "@babel/runtime-corejs3/helpers/esm/typeof";
|
19
|
-
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
20
18
|
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerator";
|
19
|
+
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
21
20
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
22
|
-
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, defineProperty = _Object$defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $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 defineProperty(generator, "_invoke", { value: makeInvokeMethod(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) { var _context38; _forEachInstanceProperty(_context38 = ["next", "throw", "return"]).call(_context38, 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; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(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); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), 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" }], _forEachInstanceProperty(tryLocsList).call(tryLocsList, 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, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), 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 (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return _reverseInstanceProperty(keys).call(keys), 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) { var _context39; if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty(_context39 = this.tryEntries).call(_context39, resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty(name).call(name, 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; }
|
21
|
+
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, defineProperty = _Object$defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $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 defineProperty(generator, "_invoke", { value: makeInvokeMethod(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) { var _context40; _forEachInstanceProperty(_context40 = ["next", "throw", "return"]).call(_context40, 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; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(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); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), 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" }], _forEachInstanceProperty(tryLocsList).call(tryLocsList, 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, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), 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 (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return _reverseInstanceProperty(keys).call(keys), 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) { var _context41; if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty(_context41 = this.tryEntries).call(_context41, resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty(name).call(name, 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; }
|
23
22
|
import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
|
24
23
|
import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
|
25
24
|
import _sortInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/sort";
|
26
25
|
import _parseInt from "@babel/runtime-corejs3/core-js-stable/parse-int";
|
26
|
+
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
27
27
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (_Array$isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
28
|
-
function _unsupportedIterableToArray(o, minLen) { var
|
28
|
+
function _unsupportedIterableToArray(o, minLen) { var _context39; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context39 = Object.prototype.toString.call(o)).call(_context39, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
29
29
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
30
30
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
31
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var
|
31
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context37, _context38; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context37 = ownKeys(Object(source), !0)).call(_context37, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context38 = ownKeys(Object(source))).call(_context38, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
32
32
|
/* eslint-disable testing-library/no-node-access */
|
33
33
|
import React from 'react';
|
34
34
|
import { useAsyncList } from 'react-stately';
|
@@ -101,9 +101,11 @@ var focusCell = function focusCell(tree, text) {
|
|
101
101
|
};
|
102
102
|
var moveFocus = function moveFocus(key) {
|
103
103
|
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
104
|
-
|
105
|
-
|
106
|
-
|
104
|
+
if (document.activeElement) {
|
105
|
+
fireEvent.keyDown(document.activeElement, _objectSpread({
|
106
|
+
key: key
|
107
|
+
}, opts));
|
108
|
+
}
|
107
109
|
};
|
108
110
|
describe('Static DataTable', function () {
|
109
111
|
var testId = 'staticTable';
|
@@ -111,16 +113,15 @@ describe('Static DataTable', function () {
|
|
111
113
|
'aria-label': 'Default table with static content',
|
112
114
|
width: '100%',
|
113
115
|
height: '100%',
|
114
|
-
density: 'spacious',
|
115
116
|
'data-testid': testId
|
116
117
|
};
|
117
118
|
var staticDataTable = function staticDataTable() {
|
118
|
-
return render(___EmotionJSX(DataTable,
|
119
|
+
return render(___EmotionJSX(DataTable, _extends({}, defaultProps, {
|
120
|
+
density: "spacious"
|
121
|
+
}), ___EmotionJSX(DataTableHeader, {
|
119
122
|
columns: columns
|
120
123
|
}, function (column) {
|
121
|
-
return ___EmotionJSX(DataTableColumn,
|
122
|
-
align: "center"
|
123
|
-
}, column.name);
|
124
|
+
return ___EmotionJSX(DataTableColumn, null, column.name);
|
124
125
|
}), ___EmotionJSX(DataTableBody, {
|
125
126
|
items: rows
|
126
127
|
}, function (item) {
|
@@ -226,15 +227,14 @@ describe('Async DataTable', function () {
|
|
226
227
|
'aria-label': 'Custom table with loading content',
|
227
228
|
width: '100%',
|
228
229
|
height: 565,
|
229
|
-
density: 'spacious',
|
230
230
|
'data-testid': testId
|
231
231
|
};
|
232
|
-
render(___EmotionJSX(DataTable,
|
232
|
+
render(___EmotionJSX(DataTable, _extends({}, defaultProps, {
|
233
|
+
density: "spacious"
|
234
|
+
}), ___EmotionJSX(DataTableHeader, {
|
233
235
|
columns: columns
|
234
236
|
}, function (column) {
|
235
|
-
return ___EmotionJSX(DataTableColumn,
|
236
|
-
align: "center"
|
237
|
-
}, column.name);
|
237
|
+
return ___EmotionJSX(DataTableColumn, null, column.name);
|
238
238
|
}), ___EmotionJSX(DataTableBody, {
|
239
239
|
loadingState: "loading"
|
240
240
|
}, [])));
|
@@ -256,12 +256,12 @@ describe('Async DataTable', function () {
|
|
256
256
|
expect(spinner).not.toHaveAttribute('aria-valuenow');
|
257
257
|
});
|
258
258
|
test('calls onLoadMore when scrolling near the bottom', function () {
|
259
|
+
var _body$parentNode;
|
259
260
|
var testId = 'onLoadMoreTable';
|
260
261
|
var defaultProps = {
|
261
262
|
'aria-label': 'Custom table with onLoadMore',
|
262
263
|
width: '100%',
|
263
264
|
height: 565,
|
264
|
-
density: 'spacious',
|
265
265
|
'data-testid': testId
|
266
266
|
};
|
267
267
|
var items = [];
|
@@ -274,12 +274,13 @@ describe('Async DataTable', function () {
|
|
274
274
|
});
|
275
275
|
}
|
276
276
|
var onLoadMore = jest.fn();
|
277
|
-
render(___EmotionJSX(DataTable,
|
277
|
+
render(___EmotionJSX(DataTable, _extends({}, defaultProps, {
|
278
|
+
scale: "medium",
|
279
|
+
density: "compact"
|
280
|
+
}), ___EmotionJSX(DataTableHeader, {
|
278
281
|
columns: columns
|
279
282
|
}, function (column) {
|
280
|
-
return ___EmotionJSX(DataTableColumn,
|
281
|
-
align: "center"
|
282
|
-
}, column.name);
|
283
|
+
return ___EmotionJSX(DataTableColumn, null, column.name);
|
283
284
|
}), ___EmotionJSX(DataTableBody, {
|
284
285
|
items: items,
|
285
286
|
onLoadMore: onLoadMore
|
@@ -293,9 +294,11 @@ describe('Async DataTable', function () {
|
|
293
294
|
expect(asyncTable).toBeVisible();
|
294
295
|
expect(asyncTable).toHaveAttribute('aria-label', 'Custom table with onLoadMore');
|
295
296
|
var body = screen.getAllByRole('rowgroup')[1];
|
296
|
-
var scrollView = body.parentNode.parentNode;
|
297
|
-
scrollView
|
298
|
-
|
297
|
+
var scrollView = body === null || body === void 0 || (_body$parentNode = body.parentNode) === null || _body$parentNode === void 0 ? void 0 : _body$parentNode.parentNode;
|
298
|
+
if (scrollView) {
|
299
|
+
scrollView.scrollTop = 250;
|
300
|
+
fireEvent.scroll(scrollView);
|
301
|
+
}
|
299
302
|
act(function () {
|
300
303
|
jest.runAllTimers();
|
301
304
|
});
|
@@ -309,7 +312,7 @@ describe('Async DataTable', function () {
|
|
309
312
|
act(function () {
|
310
313
|
jest.runAllTimers();
|
311
314
|
});
|
312
|
-
expect(onLoadMore).toHaveBeenCalledTimes(
|
315
|
+
expect(onLoadMore).toHaveBeenCalledTimes(3);
|
313
316
|
});
|
314
317
|
test('renders a spinner at the bottom when loading more', function () {
|
315
318
|
var testId = 'loadingMoreTable';
|
@@ -317,15 +320,14 @@ describe('Async DataTable', function () {
|
|
317
320
|
'aria-label': 'Custom table with loadingMore',
|
318
321
|
width: '100%',
|
319
322
|
height: '100%',
|
320
|
-
density: 'spacious',
|
321
323
|
'data-testid': testId
|
322
324
|
};
|
323
|
-
render(___EmotionJSX(DataTable,
|
325
|
+
render(___EmotionJSX(DataTable, _extends({}, defaultProps, {
|
326
|
+
density: "spacious"
|
327
|
+
}), ___EmotionJSX(DataTableHeader, {
|
324
328
|
columns: columns
|
325
329
|
}, function (column) {
|
326
|
-
return ___EmotionJSX(DataTableColumn,
|
327
|
-
align: "center"
|
328
|
-
}, column.name);
|
330
|
+
return ___EmotionJSX(DataTableColumn, null, column.name);
|
329
331
|
}), ___EmotionJSX(DataTableBody, {
|
330
332
|
items: rows,
|
331
333
|
loadingState: "loadingMore"
|
@@ -362,15 +364,15 @@ describe('Sortable DataTable', function () {
|
|
362
364
|
'aria-label': 'Custom table with sortable content',
|
363
365
|
width: '100%',
|
364
366
|
height: '100%',
|
365
|
-
density: 'spacious',
|
366
367
|
'data-testid': testId
|
367
368
|
};
|
368
369
|
test('sorting', function () {
|
369
|
-
render(___EmotionJSX(DataTable,
|
370
|
+
render(___EmotionJSX(DataTable, _extends({}, defaultProps, {
|
371
|
+
density: "spacious"
|
372
|
+
}), ___EmotionJSX(DataTableHeader, {
|
370
373
|
columns: columns
|
371
374
|
}, function (column) {
|
372
375
|
return ___EmotionJSX(DataTableColumn, {
|
373
|
-
align: "center",
|
374
376
|
allowsSorting: true
|
375
377
|
}, column.name);
|
376
378
|
}), ___EmotionJSX(DataTableBody, {
|
@@ -479,14 +481,14 @@ describe('Sortable with useAsyncList', function () {
|
|
479
481
|
load: load,
|
480
482
|
sort: sort,
|
481
483
|
initialSortDescriptor: {
|
482
|
-
direction: '
|
484
|
+
direction: 'ascending'
|
483
485
|
}
|
484
486
|
});
|
485
487
|
}), result = _renderHook2.result;
|
486
488
|
expect(load).toHaveBeenCalledTimes(1);
|
487
489
|
args = load.mock.calls[0][0];
|
488
490
|
expect(args.sortDescriptor).toEqual({
|
489
|
-
direction: '
|
491
|
+
direction: 'ascending'
|
490
492
|
});
|
491
493
|
expect(result.current.items).toEqual([]);
|
492
494
|
_context7.next = 9;
|
@@ -550,7 +552,6 @@ describe('Sortable DataTable with useAsyncList', function () {
|
|
550
552
|
'aria-label': 'Custom table with sortable content',
|
551
553
|
width: '100%',
|
552
554
|
height: '100%',
|
553
|
-
density: 'spacious',
|
554
555
|
'data-testid': testId
|
555
556
|
};
|
556
557
|
function load() {
|
@@ -607,7 +608,6 @@ describe('Sortable DataTable with useAsyncList', function () {
|
|
607
608
|
columns: columns
|
608
609
|
}, function (column) {
|
609
610
|
return ___EmotionJSX(DataTableColumn, {
|
610
|
-
align: "center",
|
611
611
|
allowsSorting: true
|
612
612
|
}, column.name);
|
613
613
|
}), ___EmotionJSX(DataTableBody, {
|
@@ -652,7 +652,9 @@ describe('Sortable DataTable with useAsyncList', function () {
|
|
652
652
|
return _regeneratorRuntime().wrap(function _callee8$(_context10) {
|
653
653
|
while (1) switch (_context10.prev = _context10.next) {
|
654
654
|
case 0:
|
655
|
-
_sortInstanceProperty(_context9 = result.current).call(_context9
|
655
|
+
_sortInstanceProperty(_context9 = result.current).call(_context9, {
|
656
|
+
column: 'country'
|
657
|
+
});
|
656
658
|
case 1:
|
657
659
|
case "end":
|
658
660
|
return _context10.stop();
|
@@ -734,7 +736,10 @@ describe('Sortable DataTable with useAsyncList', function () {
|
|
734
736
|
return _regeneratorRuntime().wrap(function _callee12$(_context15) {
|
735
737
|
while (1) switch (_context15.prev = _context15.next) {
|
736
738
|
case 0:
|
737
|
-
_sortInstanceProperty(_context14 = result.current).call(_context14
|
739
|
+
_sortInstanceProperty(_context14 = result.current).call(_context14, {
|
740
|
+
column: 'country',
|
741
|
+
direction: 'descending'
|
742
|
+
});
|
738
743
|
case 1:
|
739
744
|
case "end":
|
740
745
|
return _context15.stop();
|
@@ -789,19 +794,18 @@ describe('Sortable DataTable with useAsyncList', function () {
|
|
789
794
|
'aria-label': 'Custom table with sortable content',
|
790
795
|
width: '100%',
|
791
796
|
height: '100%',
|
792
|
-
density: 'spacious',
|
793
797
|
'data-testid': testId
|
794
798
|
};
|
795
799
|
var sortableDataTable = function sortableDataTable(_ref16) {
|
796
800
|
var result = _ref16.result;
|
797
801
|
return render(___EmotionJSX(DataTable, _extends({}, defaultProps, {
|
798
802
|
sortDescriptor: result.current.sortDescriptor.direction,
|
799
|
-
onSortChange: _sortInstanceProperty(result.current)
|
803
|
+
onSortChange: _sortInstanceProperty(result.current),
|
804
|
+
density: "spacious"
|
800
805
|
}), ___EmotionJSX(DataTableHeader, {
|
801
806
|
columns: columns
|
802
807
|
}, function (column) {
|
803
808
|
return ___EmotionJSX(DataTableColumn, {
|
804
|
-
align: "center",
|
805
809
|
allowsSorting: true
|
806
810
|
}, column.name);
|
807
811
|
}), ___EmotionJSX(DataTableBody, {
|
@@ -814,8 +818,8 @@ describe('Sortable DataTable with useAsyncList', function () {
|
|
814
818
|
};
|
815
819
|
test('click on column header should sort column A => Z', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
816
820
|
var utils, collator, _renderHook5, result, sortableTable, headers;
|
817
|
-
return _regeneratorRuntime().wrap(function _callee24$(
|
818
|
-
while (1) switch (
|
821
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context29) {
|
822
|
+
while (1) switch (_context29.prev = _context29.next) {
|
819
823
|
case 0:
|
820
824
|
utils = renderHook(function () {
|
821
825
|
return useCollator({
|
@@ -842,26 +846,27 @@ describe('Sortable DataTable with useAsyncList', function () {
|
|
842
846
|
},
|
843
847
|
sort: function sort(_ref18) {
|
844
848
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
849
|
+
var _context22;
|
845
850
|
var items, sortDescriptor;
|
846
|
-
return _regeneratorRuntime().wrap(function _callee18$(
|
847
|
-
while (1) switch (
|
851
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context23) {
|
852
|
+
while (1) switch (_context23.prev = _context23.next) {
|
848
853
|
case 0:
|
849
854
|
items = _ref18.items, sortDescriptor = _ref18.sortDescriptor;
|
850
|
-
return
|
851
|
-
items: _sortInstanceProperty(items).call(items, function (a, b) {
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
cmp
|
855
|
+
return _context23.abrupt("return", {
|
856
|
+
items: _sortInstanceProperty(_context22 = _sliceInstanceProperty(items).call(items)).call(_context22, function (a, b) {
|
857
|
+
if (sortDescriptor.column) {
|
858
|
+
var cmp = a[sortDescriptor.column] < b[sortDescriptor.column] ? -1 : 1;
|
859
|
+
if (sortDescriptor.direction === 'descending') {
|
860
|
+
cmp *= -1;
|
861
|
+
}
|
862
|
+
return cmp;
|
858
863
|
}
|
859
|
-
return
|
864
|
+
return 1;
|
860
865
|
})
|
861
866
|
});
|
862
867
|
case 2:
|
863
868
|
case "end":
|
864
|
-
return
|
869
|
+
return _context23.stop();
|
865
870
|
}
|
866
871
|
}, _callee18);
|
867
872
|
}))();
|
@@ -872,15 +877,15 @@ describe('Sortable DataTable with useAsyncList', function () {
|
|
872
877
|
}
|
873
878
|
});
|
874
879
|
}), result = _renderHook5.result;
|
875
|
-
|
880
|
+
_context29.next = 5;
|
876
881
|
return actHooks( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
877
|
-
return _regeneratorRuntime().wrap(function _callee19$(
|
878
|
-
while (1) switch (
|
882
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context24) {
|
883
|
+
while (1) switch (_context24.prev = _context24.next) {
|
879
884
|
case 0:
|
880
885
|
jest.runOnlyPendingTimers();
|
881
886
|
case 1:
|
882
887
|
case "end":
|
883
|
-
return
|
888
|
+
return _context24.stop();
|
884
889
|
}
|
885
890
|
}, _callee19);
|
886
891
|
})));
|
@@ -888,15 +893,15 @@ describe('Sortable DataTable with useAsyncList', function () {
|
|
888
893
|
sortableDataTable({
|
889
894
|
result: result
|
890
895
|
});
|
891
|
-
|
896
|
+
_context29.next = 8;
|
892
897
|
return actHooks( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
893
|
-
return _regeneratorRuntime().wrap(function _callee20$(
|
894
|
-
while (1) switch (
|
898
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context25) {
|
899
|
+
while (1) switch (_context25.prev = _context25.next) {
|
895
900
|
case 0:
|
896
901
|
jest.runOnlyPendingTimers();
|
897
902
|
case 1:
|
898
903
|
case "end":
|
899
|
-
return
|
904
|
+
return _context25.stop();
|
900
905
|
}
|
901
906
|
}, _callee20);
|
902
907
|
})));
|
@@ -924,15 +929,15 @@ describe('Sortable DataTable with useAsyncList', function () {
|
|
924
929
|
expect(result.current.items[1].continent).toBe('North America');
|
925
930
|
expect(result.current.items[2].continent).toBe('Asia');
|
926
931
|
expect(result.current.items[3].continent).toBe('Europe');
|
927
|
-
|
932
|
+
_context29.next = 33;
|
928
933
|
return actHooks( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
929
|
-
return _regeneratorRuntime().wrap(function _callee21$(
|
930
|
-
while (1) switch (
|
934
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context26) {
|
935
|
+
while (1) switch (_context26.prev = _context26.next) {
|
931
936
|
case 0:
|
932
937
|
fireEvent.click(headers[0]);
|
933
938
|
case 1:
|
934
939
|
case "end":
|
935
|
-
return
|
940
|
+
return _context26.stop();
|
936
941
|
}
|
937
942
|
}, _callee21);
|
938
943
|
})));
|
@@ -941,15 +946,15 @@ describe('Sortable DataTable with useAsyncList', function () {
|
|
941
946
|
expect(result.current.items[1].country).toBe('China');
|
942
947
|
expect(result.current.items[2].country).toBe('France');
|
943
948
|
expect(result.current.items[3].country).toBe('USA');
|
944
|
-
|
949
|
+
_context29.next = 39;
|
945
950
|
return actHooks( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
946
|
-
return _regeneratorRuntime().wrap(function _callee22$(
|
947
|
-
while (1) switch (
|
951
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context27) {
|
952
|
+
while (1) switch (_context27.prev = _context27.next) {
|
948
953
|
case 0:
|
949
954
|
fireEvent.click(headers[1]);
|
950
955
|
case 1:
|
951
956
|
case "end":
|
952
|
-
return
|
957
|
+
return _context27.stop();
|
953
958
|
}
|
954
959
|
}, _callee22);
|
955
960
|
})));
|
@@ -958,15 +963,15 @@ describe('Sortable DataTable with useAsyncList', function () {
|
|
958
963
|
expect(result.current.items[1].population).toBe(67000000);
|
959
964
|
expect(result.current.items[2].population).toBe(320000000);
|
960
965
|
expect(result.current.items[3].population).toBe(1398000000);
|
961
|
-
|
966
|
+
_context29.next = 45;
|
962
967
|
return actHooks( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
963
|
-
return _regeneratorRuntime().wrap(function _callee23$(
|
964
|
-
while (1) switch (
|
968
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context28) {
|
969
|
+
while (1) switch (_context28.prev = _context28.next) {
|
965
970
|
case 0:
|
966
971
|
fireEvent.click(headers[2]);
|
967
972
|
case 1:
|
968
973
|
case "end":
|
969
|
-
return
|
974
|
+
return _context28.stop();
|
970
975
|
}
|
971
976
|
}, _callee23);
|
972
977
|
})));
|
@@ -977,54 +982,55 @@ describe('Sortable DataTable with useAsyncList', function () {
|
|
977
982
|
expect(result.current.items[3].continent).toBe('North America');
|
978
983
|
case 49:
|
979
984
|
case "end":
|
980
|
-
return
|
985
|
+
return _context29.stop();
|
981
986
|
}
|
982
987
|
}, _callee24);
|
983
988
|
})));
|
984
989
|
test('click on column header should sort column Z => A', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
985
990
|
var _renderHook6, result, sortableTable, headers;
|
986
|
-
return _regeneratorRuntime().wrap(function _callee30$(
|
987
|
-
while (1) switch (
|
991
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context36) {
|
992
|
+
while (1) switch (_context36.prev = _context36.next) {
|
988
993
|
case 0:
|
989
994
|
_renderHook6 = renderHook(function () {
|
990
995
|
return useAsyncList({
|
991
996
|
load: function load() {
|
992
997
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
993
|
-
return _regeneratorRuntime().wrap(function _callee25$(
|
994
|
-
while (1) switch (
|
998
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context30) {
|
999
|
+
while (1) switch (_context30.prev = _context30.next) {
|
995
1000
|
case 0:
|
996
|
-
return
|
1001
|
+
return _context30.abrupt("return", {
|
997
1002
|
items: rows
|
998
1003
|
});
|
999
1004
|
case 1:
|
1000
1005
|
case "end":
|
1001
|
-
return
|
1006
|
+
return _context30.stop();
|
1002
1007
|
}
|
1003
1008
|
}, _callee25);
|
1004
1009
|
}))();
|
1005
1010
|
},
|
1006
1011
|
sort: function sort(_ref25) {
|
1007
1012
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
|
1013
|
+
var _context31;
|
1008
1014
|
var items, sortDescriptor;
|
1009
|
-
return _regeneratorRuntime().wrap(function _callee26$(
|
1010
|
-
while (1) switch (
|
1015
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context32) {
|
1016
|
+
while (1) switch (_context32.prev = _context32.next) {
|
1011
1017
|
case 0:
|
1012
1018
|
items = _ref25.items, sortDescriptor = _ref25.sortDescriptor;
|
1013
|
-
return
|
1014
|
-
items: _sortInstanceProperty(items).call(items, function (a, b) {
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
cmp
|
1019
|
+
return _context32.abrupt("return", {
|
1020
|
+
items: _sortInstanceProperty(_context31 = _sliceInstanceProperty(items).call(items)).call(_context31, function (a, b) {
|
1021
|
+
if (sortDescriptor.column) {
|
1022
|
+
var cmp = a[sortDescriptor.column] < b[sortDescriptor.column] ? -1 : 1;
|
1023
|
+
if (sortDescriptor.direction === 'descending') {
|
1024
|
+
cmp *= -1;
|
1025
|
+
}
|
1026
|
+
return cmp;
|
1021
1027
|
}
|
1022
|
-
return
|
1028
|
+
return 1;
|
1023
1029
|
})
|
1024
1030
|
});
|
1025
1031
|
case 2:
|
1026
1032
|
case "end":
|
1027
|
-
return
|
1033
|
+
return _context32.stop();
|
1028
1034
|
}
|
1029
1035
|
}, _callee26);
|
1030
1036
|
}))();
|
@@ -1035,15 +1041,15 @@ describe('Sortable DataTable with useAsyncList', function () {
|
|
1035
1041
|
}
|
1036
1042
|
});
|
1037
1043
|
}), result = _renderHook6.result;
|
1038
|
-
|
1044
|
+
_context36.next = 3;
|
1039
1045
|
return actHooks( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
|
1040
|
-
return _regeneratorRuntime().wrap(function _callee27$(
|
1041
|
-
while (1) switch (
|
1046
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context33) {
|
1047
|
+
while (1) switch (_context33.prev = _context33.next) {
|
1042
1048
|
case 0:
|
1043
1049
|
jest.runOnlyPendingTimers();
|
1044
1050
|
case 1:
|
1045
1051
|
case "end":
|
1046
|
-
return
|
1052
|
+
return _context33.stop();
|
1047
1053
|
}
|
1048
1054
|
}, _callee27);
|
1049
1055
|
})));
|
@@ -1051,15 +1057,15 @@ describe('Sortable DataTable with useAsyncList', function () {
|
|
1051
1057
|
sortableDataTable({
|
1052
1058
|
result: result
|
1053
1059
|
});
|
1054
|
-
|
1060
|
+
_context36.next = 6;
|
1055
1061
|
return actHooks( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
|
1056
|
-
return _regeneratorRuntime().wrap(function _callee28$(
|
1057
|
-
while (1) switch (
|
1062
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context34) {
|
1063
|
+
while (1) switch (_context34.prev = _context34.next) {
|
1058
1064
|
case 0:
|
1059
1065
|
jest.runOnlyPendingTimers();
|
1060
1066
|
case 1:
|
1061
1067
|
case "end":
|
1062
|
-
return
|
1068
|
+
return _context34.stop();
|
1063
1069
|
}
|
1064
1070
|
}, _callee28);
|
1065
1071
|
})));
|
@@ -1087,15 +1093,15 @@ describe('Sortable DataTable with useAsyncList', function () {
|
|
1087
1093
|
expect(result.current.items[1].continent).toBe('North America');
|
1088
1094
|
expect(result.current.items[2].continent).toBe('Asia');
|
1089
1095
|
expect(result.current.items[3].continent).toBe('Europe');
|
1090
|
-
|
1096
|
+
_context36.next = 31;
|
1091
1097
|
return actHooks( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
1092
|
-
return _regeneratorRuntime().wrap(function _callee29$(
|
1093
|
-
while (1) switch (
|
1098
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context35) {
|
1099
|
+
while (1) switch (_context35.prev = _context35.next) {
|
1094
1100
|
case 0:
|
1095
1101
|
fireEvent.click(headers[0]);
|
1096
1102
|
case 1:
|
1097
1103
|
case "end":
|
1098
|
-
return
|
1104
|
+
return _context35.stop();
|
1099
1105
|
}
|
1100
1106
|
}, _callee29);
|
1101
1107
|
})));
|
@@ -1114,7 +1120,7 @@ describe('Sortable DataTable with useAsyncList', function () {
|
|
1114
1120
|
expect(result.current.items[3].population).toBe(320000000);
|
1115
1121
|
case 43:
|
1116
1122
|
case "end":
|
1117
|
-
return
|
1123
|
+
return _context36.stop();
|
1118
1124
|
}
|
1119
1125
|
}, _callee30);
|
1120
1126
|
})));
|
@@ -1126,9 +1132,7 @@ describe('Empty DataTable', function () {
|
|
1126
1132
|
}, ___EmotionJSX(DataTableHeader, {
|
1127
1133
|
columns: columns
|
1128
1134
|
}, function (column) {
|
1129
|
-
return ___EmotionJSX(DataTableColumn,
|
1130
|
-
align: "center"
|
1131
|
-
}, column.name);
|
1135
|
+
return ___EmotionJSX(DataTableColumn, null, column.name);
|
1132
1136
|
}), ___EmotionJSX(DataTableBody, null, [])));
|
1133
1137
|
};
|
1134
1138
|
it('should display header row only when there are no items', function () {
|
@@ -1148,9 +1152,7 @@ universalComponentTests({
|
|
1148
1152
|
"aria-label": "label"
|
1149
1153
|
}), ___EmotionJSX(DataTableHeader, {
|
1150
1154
|
columns: [columns[0]]
|
1151
|
-
}, ___EmotionJSX(DataTableColumn, {
|
1152
|
-
align: "center"
|
1153
|
-
}, columns[0].name)), ___EmotionJSX(DataTableBody, {
|
1155
|
+
}, ___EmotionJSX(DataTableColumn, null, columns[0].name)), ___EmotionJSX(DataTableBody, {
|
1154
1156
|
items: rows
|
1155
1157
|
}, function (item) {
|
1156
1158
|
return ___EmotionJSX(DataTableRow, null, function (columnKey) {
|