@pingux/astro 2.37.0 → 2.37.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.
@@ -21,14 +21,15 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
21
21
|
_Object$defineProperty(exports, "__esModule", {
|
22
22
|
value: true
|
23
23
|
});
|
24
|
-
exports["default"] = exports.
|
24
|
+
exports["default"] = exports.Sortable = exports.Dynamic = exports.Default = exports.AsyncLoading = void 0;
|
25
|
+
var _isNan = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/number/is-nan"));
|
26
|
+
var _parseFloat2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/parse-float"));
|
25
27
|
var _sort = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/sort"));
|
26
28
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
27
29
|
var _setTimeout2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/set-timeout"));
|
28
|
-
var _parseInt2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/parse-int"));
|
29
30
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
30
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
31
31
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
|
32
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
32
33
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
33
34
|
var _react = _interopRequireWildcard(require("react"));
|
34
35
|
var _reactStately = require("react-stately");
|
@@ -41,9 +42,9 @@ var _DataTable = _interopRequireDefault(require("./DataTable.mdx"));
|
|
41
42
|
var _react2 = require("@emotion/react");
|
42
43
|
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); }
|
43
44
|
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; }
|
44
|
-
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 _context8; _forEachInstanceProperty(_context8 = ["next", "throw", "return"]).call(_context8, 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 = _Promise2); 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 _context9; 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(_context9 = this.tryEntries).call(_context9, 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; }
|
45
|
+
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 _context7; _forEachInstanceProperty(_context7 = ["next", "throw", "return"]).call(_context7, 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 = _Promise2); 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 _context8; 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(_context8 = this.tryEntries).call(_context8, 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; }
|
45
46
|
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; }
|
46
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var
|
47
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context5, _context6; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context5 = ownKeys(Object(source), !0)).call(_context5, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context6 = ownKeys(Object(source))).call(_context6, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
47
48
|
var _default = {
|
48
49
|
title: 'Components/DataTable',
|
49
50
|
component: _index.DataTable,
|
@@ -123,8 +124,116 @@ var _default = {
|
|
123
124
|
}
|
124
125
|
};
|
125
126
|
exports["default"] = _default;
|
127
|
+
var getCellProps = function getCellProps(columnKey) {
|
128
|
+
return {
|
129
|
+
pr: columnKey !== 'menu' ? 'lg' : 0,
|
130
|
+
pl: columnKey === 'timestamp' || columnKey === 'menu' ? 0 : 'lg'
|
131
|
+
};
|
132
|
+
};
|
126
133
|
var Default = function Default(args) {
|
127
|
-
var
|
134
|
+
var date = '2023-05-03';
|
135
|
+
var time = '07:16:30 pm UTC';
|
136
|
+
var timestampCell = (0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)(_index.Box, null, date), (0, _react2.jsx)(_index.Box, null, time));
|
137
|
+
var columns = [{
|
138
|
+
name: 'Timestamp',
|
139
|
+
key: 'timestamp'
|
140
|
+
}, {
|
141
|
+
name: 'Event Type',
|
142
|
+
key: 'eventType'
|
143
|
+
}, {
|
144
|
+
name: 'Description',
|
145
|
+
key: 'description'
|
146
|
+
}, {
|
147
|
+
name: 'Status',
|
148
|
+
key: 'status'
|
149
|
+
}, {
|
150
|
+
name: 'User Identity',
|
151
|
+
key: 'userIdentity'
|
152
|
+
}, {
|
153
|
+
name: 'Menu',
|
154
|
+
key: 'menu'
|
155
|
+
}];
|
156
|
+
var rows = [{
|
157
|
+
id: 1,
|
158
|
+
timestamp: timestampCell,
|
159
|
+
eventType: 'User Access Allowed',
|
160
|
+
description: (0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)(_index.Box, null, "Passed Role Access"), (0, _react2.jsx)(_index.Box, null, "Control")),
|
161
|
+
status: (0, _react2.jsx)(_index.DataTableBadge, {
|
162
|
+
cell: "Approved"
|
163
|
+
}),
|
164
|
+
userIdentity: 'Vincent Diep',
|
165
|
+
menu: (0, _react2.jsx)(_index.DataTableMenu, null)
|
166
|
+
}, {
|
167
|
+
id: 2,
|
168
|
+
timestamp: timestampCell,
|
169
|
+
eventType: 'User Access Denied',
|
170
|
+
description: (0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)(_index.Box, {
|
171
|
+
display: "block"
|
172
|
+
}, "Passed Role Access"), (0, _react2.jsx)(_index.Box, {
|
173
|
+
display: "block"
|
174
|
+
}, "Control"), (0, _react2.jsx)(_index.Box, {
|
175
|
+
display: "block"
|
176
|
+
}, "Words Words Words Words Words Words Words Words Words Words Words Words Words Words")),
|
177
|
+
status: (0, _react2.jsx)(_index.DataTableBadge, {
|
178
|
+
cell: "Rejected"
|
179
|
+
}),
|
180
|
+
userIdentity: 'Vincent Diep',
|
181
|
+
menu: (0, _react2.jsx)(_index.DataTableMenu, null)
|
182
|
+
}, {
|
183
|
+
id: 3,
|
184
|
+
timestamp: timestampCell,
|
185
|
+
eventType: 'User Access Allowed',
|
186
|
+
description: 'Words Words Words Words Words Words Words Words Words Words Words Words Words Words Words Words Words Words Words Words',
|
187
|
+
status: (0, _react2.jsx)(_index.DataTableBadge, {
|
188
|
+
cell: "Approved"
|
189
|
+
}),
|
190
|
+
userIdentity: 'Vincent Diep',
|
191
|
+
menu: (0, _react2.jsx)(_index.DataTableMenu, null)
|
192
|
+
}, {
|
193
|
+
id: 4,
|
194
|
+
timestamp: timestampCell,
|
195
|
+
eventType: 'User Access Allowed',
|
196
|
+
description: (0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)(_index.Box, null, "Passed Role Access"), (0, _react2.jsx)(_index.Box, null, "Control")),
|
197
|
+
status: (0, _react2.jsx)(_index.DataTableBadge, {
|
198
|
+
cell: "Approved"
|
199
|
+
}),
|
200
|
+
userIdentity: 'Vincent Diep',
|
201
|
+
menu: (0, _react2.jsx)(_index.DataTableMenu, null)
|
202
|
+
}, {
|
203
|
+
id: 5,
|
204
|
+
timestamp: timestampCell,
|
205
|
+
eventType: 'User Access Allowed',
|
206
|
+
description: (0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)(_index.Box, null, "Passed Role Access"), (0, _react2.jsx)(_index.Box, null, "Control")),
|
207
|
+
status: (0, _react2.jsx)(_index.DataTableBadge, {
|
208
|
+
cell: "Approved"
|
209
|
+
}),
|
210
|
+
userIdentity: 'Vincent Diep',
|
211
|
+
menu: (0, _react2.jsx)(_index.DataTableMenu, null)
|
212
|
+
}];
|
213
|
+
return (0, _react2.jsx)(_index.DataTable, (0, _extends2["default"])({}, args, {
|
214
|
+
"aria-label": "Static table",
|
215
|
+
height: "100%"
|
216
|
+
}), (0, _react2.jsx)(_index.DataTableHeader, {
|
217
|
+
columns: columns
|
218
|
+
}, function (column) {
|
219
|
+
return (0, _react2.jsx)(_index.DataTableColumn, {
|
220
|
+
cellProps: getCellProps(column.key),
|
221
|
+
minWidth: column.key !== 'menu' ? 175 : 32,
|
222
|
+
width: column.key !== 'menu' ? '19.4%' : 32,
|
223
|
+
hideHeader: column.key === 'menu'
|
224
|
+
}, column.name);
|
225
|
+
}), (0, _react2.jsx)(_index.DataTableBody, {
|
226
|
+
items: rows
|
227
|
+
}, function (item) {
|
228
|
+
return (0, _react2.jsx)(_index.DataTableRow, null, function (columnKey) {
|
229
|
+
return (0, _react2.jsx)(_index.DataTableCell, {
|
230
|
+
cellProps: getCellProps(columnKey)
|
231
|
+
}, item[columnKey]);
|
232
|
+
});
|
233
|
+
}));
|
234
|
+
};
|
235
|
+
exports.Default = Default;
|
236
|
+
var Dynamic = function Dynamic(args) {
|
128
237
|
var columns = [{
|
129
238
|
name: 'Country',
|
130
239
|
key: 'country'
|
@@ -171,9 +280,6 @@ var Default = function Default(args) {
|
|
171
280
|
population: '25,000,000',
|
172
281
|
continent: 'Oceania'
|
173
282
|
}];
|
174
|
-
var collator = (0, _i18n.useCollator)({
|
175
|
-
numeric: true
|
176
|
-
});
|
177
283
|
var list = (0, _reactStately.useAsyncList)({
|
178
284
|
load: function load() {
|
179
285
|
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
@@ -189,53 +295,163 @@ var Default = function Default(args) {
|
|
189
295
|
}
|
190
296
|
}, _callee);
|
191
297
|
}))();
|
192
|
-
}
|
193
|
-
|
298
|
+
}
|
299
|
+
});
|
300
|
+
return (0, _react2.jsx)(_index.DataTable, (0, _extends2["default"])({}, args, {
|
301
|
+
"aria-label": "Dynamic table"
|
302
|
+
}), (0, _react2.jsx)(_index.DataTableHeader, {
|
303
|
+
columns: columns
|
304
|
+
}, function (column) {
|
305
|
+
return (0, _react2.jsx)(_index.DataTableColumn, {
|
306
|
+
cellProps: getCellProps(column.key),
|
307
|
+
minWidth: 155,
|
308
|
+
align: "center"
|
309
|
+
}, column.name);
|
310
|
+
}), (0, _react2.jsx)(_index.DataTableBody, {
|
311
|
+
items: list.items
|
312
|
+
}, function (item) {
|
313
|
+
return (0, _react2.jsx)(_index.DataTableRow, null, function (columnKey) {
|
314
|
+
return (0, _react2.jsx)(_index.DataTableCell, {
|
315
|
+
cellProps: getCellProps(columnKey)
|
316
|
+
}, item[columnKey]);
|
317
|
+
});
|
318
|
+
}));
|
319
|
+
};
|
320
|
+
exports.Dynamic = Dynamic;
|
321
|
+
var Sortable = function Sortable(args) {
|
322
|
+
var _useState = (0, _react.useState)(true),
|
323
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
324
|
+
firstSortFlag = _useState2[0],
|
325
|
+
setFirstSortFlag = _useState2[1];
|
326
|
+
var columns = [{
|
327
|
+
name: 'Country',
|
328
|
+
key: 'country',
|
329
|
+
isSortable: true
|
330
|
+
}, {
|
331
|
+
name: 'Population',
|
332
|
+
key: 'population',
|
333
|
+
isSortable: true
|
334
|
+
}, {
|
335
|
+
name: 'Continent',
|
336
|
+
key: 'continent',
|
337
|
+
isSortable: true
|
338
|
+
}];
|
339
|
+
var rows = [{
|
340
|
+
id: 1,
|
341
|
+
country: 'Austria',
|
342
|
+
population: '25,000,000',
|
343
|
+
continent: 'Oceania'
|
344
|
+
}, {
|
345
|
+
id: 2,
|
346
|
+
country: 'Canada',
|
347
|
+
population: '37,000,000',
|
348
|
+
continent: 'North America'
|
349
|
+
}, {
|
350
|
+
id: 3,
|
351
|
+
country: 'China',
|
352
|
+
population: '1,398,000,000',
|
353
|
+
continent: 'Asia'
|
354
|
+
}, {
|
355
|
+
id: 4,
|
356
|
+
country: 'Ethiopia',
|
357
|
+
population: '120,000,000',
|
358
|
+
continent: 'Africa'
|
359
|
+
}, {
|
360
|
+
id: 5,
|
361
|
+
country: 'France',
|
362
|
+
population: '67,000,000',
|
363
|
+
continent: 'Europe'
|
364
|
+
}, {
|
365
|
+
id: 6,
|
366
|
+
country: 'Mexico',
|
367
|
+
population: '126,000,000',
|
368
|
+
continent: 'South America'
|
369
|
+
}, {
|
370
|
+
id: 7,
|
371
|
+
country: 'USA',
|
372
|
+
population: '320,000,000',
|
373
|
+
continent: 'North America'
|
374
|
+
}];
|
375
|
+
var collator = (0, _i18n.useCollator)({
|
376
|
+
numeric: true
|
377
|
+
});
|
378
|
+
var list = (0, _reactStately.useAsyncList)({
|
379
|
+
load: function load() {
|
194
380
|
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
195
|
-
var items, sortDescriptor;
|
196
381
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
197
382
|
while (1) switch (_context2.prev = _context2.next) {
|
198
383
|
case 0:
|
199
|
-
items = _ref.items, sortDescriptor = _ref.sortDescriptor;
|
200
384
|
return _context2.abrupt("return", {
|
385
|
+
items: rows
|
386
|
+
});
|
387
|
+
case 1:
|
388
|
+
case "end":
|
389
|
+
return _context2.stop();
|
390
|
+
}
|
391
|
+
}, _callee2);
|
392
|
+
}))();
|
393
|
+
},
|
394
|
+
sort: function sort(_ref) {
|
395
|
+
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
396
|
+
var items, sortDescriptor, getNumericValue;
|
397
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
398
|
+
while (1) switch (_context3.prev = _context3.next) {
|
399
|
+
case 0:
|
400
|
+
items = _ref.items, sortDescriptor = _ref.sortDescriptor;
|
401
|
+
getNumericValue = function getNumericValue(str) {
|
402
|
+
return !(0, _isNan["default"])(str) && (0, _parseFloat2["default"])(str.replace(/,/g, ''));
|
403
|
+
};
|
404
|
+
return _context3.abrupt("return", {
|
201
405
|
items: (0, _sort["default"])(items).call(items, function (a, b) {
|
202
406
|
var first = a[sortDescriptor.column];
|
203
407
|
var second = b[sortDescriptor.column];
|
204
|
-
var
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
return cmp;
|
408
|
+
var firstNumericValue = getNumericValue(first);
|
409
|
+
var secondNumericValue = getNumericValue(second);
|
410
|
+
var cmp = firstNumericValue && secondNumericValue ? firstNumericValue - secondNumericValue : collator.compare(first, second);
|
411
|
+
return sortDescriptor.direction === 'descending' ? -cmp : cmp;
|
209
412
|
})
|
210
413
|
});
|
211
|
-
case
|
414
|
+
case 3:
|
212
415
|
case "end":
|
213
|
-
return
|
416
|
+
return _context3.stop();
|
214
417
|
}
|
215
|
-
},
|
418
|
+
}, _callee3);
|
216
419
|
}))();
|
217
420
|
}
|
218
421
|
});
|
422
|
+
(0, _react.useEffect)(function () {
|
423
|
+
if (firstSortFlag && !list.isLoading && list.items.length > 0) {
|
424
|
+
(0, _sort["default"])(list).call(list, {
|
425
|
+
column: 'country',
|
426
|
+
direction: 'ascending'
|
427
|
+
});
|
428
|
+
setFirstSortFlag(false);
|
429
|
+
}
|
430
|
+
}, [firstSortFlag, list, list.isLoading, list.items]);
|
219
431
|
return (0, _react2.jsx)(_index.DataTable, (0, _extends2["default"])({}, args, {
|
220
|
-
"aria-label": "
|
221
|
-
sortDescriptor:
|
432
|
+
"aria-label": "Sortable table",
|
433
|
+
sortDescriptor: list.sortDescriptor,
|
222
434
|
onSortChange: (0, _sort["default"])(list)
|
223
435
|
}), (0, _react2.jsx)(_index.DataTableHeader, {
|
224
436
|
columns: columns
|
225
437
|
}, function (column) {
|
226
438
|
return (0, _react2.jsx)(_index.DataTableColumn, {
|
439
|
+
cellProps: getCellProps(column.key),
|
227
440
|
allowsSorting: true,
|
441
|
+
minWidth: 155,
|
228
442
|
align: "center"
|
229
443
|
}, column.name);
|
230
444
|
}), (0, _react2.jsx)(_index.DataTableBody, {
|
231
445
|
items: list.items
|
232
446
|
}, function (item) {
|
233
447
|
return (0, _react2.jsx)(_index.DataTableRow, null, function (columnKey) {
|
234
|
-
return (0, _react2.jsx)(_index.DataTableCell,
|
448
|
+
return (0, _react2.jsx)(_index.DataTableCell, {
|
449
|
+
cellProps: getCellProps(columnKey)
|
450
|
+
}, item[columnKey]);
|
235
451
|
});
|
236
452
|
}));
|
237
453
|
};
|
238
|
-
exports.
|
454
|
+
exports.Sortable = Sortable;
|
239
455
|
var AsyncLoading = function AsyncLoading(args) {
|
240
456
|
/**
|
241
457
|
* isChromatic checks if the code is running in Chromatic environment
|
@@ -258,40 +474,40 @@ var AsyncLoading = function AsyncLoading(args) {
|
|
258
474
|
}];
|
259
475
|
var list = (0, _reactStately.useAsyncList)({
|
260
476
|
load: function load(_ref2) {
|
261
|
-
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function
|
477
|
+
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
262
478
|
var signal, cursor, res, json;
|
263
|
-
return _regeneratorRuntime().wrap(function
|
264
|
-
while (1) switch (
|
479
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
480
|
+
while (1) switch (_context4.prev = _context4.next) {
|
265
481
|
case 0:
|
266
482
|
signal = _ref2.signal, cursor = _ref2.cursor;
|
267
483
|
if (cursor) {
|
268
484
|
// eslint-disable-next-line no-param-reassign
|
269
485
|
cursor = cursor.replace(/^http:\/\//i, 'https://');
|
270
486
|
}
|
271
|
-
|
487
|
+
_context4.next = 4;
|
272
488
|
return fetch(cursor || 'https://swapi.py4e.com/api/people/?search=', {
|
273
489
|
signal: signal
|
274
490
|
});
|
275
491
|
case 4:
|
276
|
-
res =
|
277
|
-
|
492
|
+
res = _context4.sent;
|
493
|
+
_context4.next = 7;
|
278
494
|
return res.json();
|
279
495
|
case 7:
|
280
|
-
json =
|
281
|
-
|
496
|
+
json = _context4.sent;
|
497
|
+
_context4.next = 10;
|
282
498
|
return new _promise["default"](function (resolve) {
|
283
499
|
return (0, _setTimeout2["default"])(resolve, cursor ? 2000 : 3000);
|
284
500
|
});
|
285
501
|
case 10:
|
286
|
-
return
|
502
|
+
return _context4.abrupt("return", {
|
287
503
|
items: json.results,
|
288
504
|
cursor: json.next
|
289
505
|
});
|
290
506
|
case 11:
|
291
507
|
case "end":
|
292
|
-
return
|
508
|
+
return _context4.stop();
|
293
509
|
}
|
294
|
-
},
|
510
|
+
}, _callee4);
|
295
511
|
}))();
|
296
512
|
}
|
297
513
|
});
|
@@ -302,8 +518,8 @@ var AsyncLoading = function AsyncLoading(args) {
|
|
302
518
|
columns: columns
|
303
519
|
}, function (column) {
|
304
520
|
return (0, _react2.jsx)(_index.DataTableColumn, {
|
305
|
-
|
306
|
-
|
521
|
+
cellProps: getCellProps(column.key),
|
522
|
+
minWidth: 155
|
307
523
|
}, column.name);
|
308
524
|
}), (0, _react2.jsx)(_index.DataTableBody, {
|
309
525
|
items: list.items,
|
@@ -313,171 +529,10 @@ var AsyncLoading = function AsyncLoading(args) {
|
|
313
529
|
return (0, _react2.jsx)(_index.DataTableRow, {
|
314
530
|
key: item.name
|
315
531
|
}, function (columnKey) {
|
316
|
-
return (0, _react2.jsx)(_index.DataTableCell, null, item[columnKey]);
|
317
|
-
});
|
318
|
-
}));
|
319
|
-
};
|
320
|
-
exports.AsyncLoading = AsyncLoading;
|
321
|
-
var New = function New(args) {
|
322
|
-
var _useState = (0, _react.useState)(true),
|
323
|
-
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
324
|
-
firstSortFlag = _useState2[0],
|
325
|
-
setFirstSortFlag = _useState2[1];
|
326
|
-
var date = '2023-05-03';
|
327
|
-
var time = '07:16:30 pm UTC';
|
328
|
-
var timestampCell = (0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)(_index.Box, null, date), (0, _react2.jsx)(_index.Box, null, time));
|
329
|
-
var columns = [{
|
330
|
-
name: 'Timestamp',
|
331
|
-
key: 'timestamp',
|
332
|
-
isSortable: true
|
333
|
-
}, {
|
334
|
-
name: 'Event Type',
|
335
|
-
key: 'eventType',
|
336
|
-
isSortable: true
|
337
|
-
}, {
|
338
|
-
name: 'Description',
|
339
|
-
key: 'description',
|
340
|
-
isSortable: true
|
341
|
-
}, {
|
342
|
-
name: 'Console',
|
343
|
-
key: 'console',
|
344
|
-
isSortable: true
|
345
|
-
}, {
|
346
|
-
name: 'User Identity',
|
347
|
-
key: 'userIdentity',
|
348
|
-
isSortable: true
|
349
|
-
}, {
|
350
|
-
name: 'Menu',
|
351
|
-
key: 'menu'
|
352
|
-
}];
|
353
|
-
var rows = [{
|
354
|
-
id: 1,
|
355
|
-
timestamp: timestampCell,
|
356
|
-
eventType: 'User Access Allowed',
|
357
|
-
description: (0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)(_index.Box, null, "Passed Role Access"), (0, _react2.jsx)(_index.Box, null, "Control")),
|
358
|
-
console: 'PingOne Admin Console',
|
359
|
-
userIdentity: 'Vincent Diep',
|
360
|
-
menu: (0, _react2.jsx)(_index.DataTableMenu, null)
|
361
|
-
}, {
|
362
|
-
id: 2,
|
363
|
-
timestamp: timestampCell,
|
364
|
-
eventType: 'User Access Denied',
|
365
|
-
description: (0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)(_index.Box, {
|
366
|
-
display: "block"
|
367
|
-
}, "Passed Role Access"), (0, _react2.jsx)(_index.Box, {
|
368
|
-
display: "block"
|
369
|
-
}, "Control"), (0, _react2.jsx)(_index.Box, {
|
370
|
-
display: "block"
|
371
|
-
}, "Words Words Words Words Words Words Words Words Words Words Words Words Words Words")),
|
372
|
-
console: 'PingOne Admin Console',
|
373
|
-
userIdentity: 'Vincent Diep',
|
374
|
-
menu: (0, _react2.jsx)(_index.DataTableMenu, null)
|
375
|
-
}, {
|
376
|
-
id: 3,
|
377
|
-
timestamp: timestampCell,
|
378
|
-
eventType: 'User Access Allowed',
|
379
|
-
description: 'Words Words Words Words Words Words Words Words Words Words Words Words Words Words Words Words Words Words Words Words',
|
380
|
-
console: 'PingOne Admin Console',
|
381
|
-
userIdentity: 'Vincent Diep',
|
382
|
-
menu: (0, _react2.jsx)(_index.DataTableMenu, null)
|
383
|
-
}, {
|
384
|
-
id: 4,
|
385
|
-
timestamp: timestampCell,
|
386
|
-
eventType: 'User Access Allowed',
|
387
|
-
description: (0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)(_index.Box, null, "Passed Role Access"), (0, _react2.jsx)(_index.Box, null, "Control")),
|
388
|
-
console: 'PingOne Admin Console',
|
389
|
-
userIdentity: 'Vincent Diep',
|
390
|
-
menu: (0, _react2.jsx)(_index.DataTableMenu, null)
|
391
|
-
}, {
|
392
|
-
id: 5,
|
393
|
-
timestamp: timestampCell,
|
394
|
-
eventType: 'User Access Allowed',
|
395
|
-
description: (0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)(_index.Box, null, "Passed Role Access"), (0, _react2.jsx)(_index.Box, null, "Control")),
|
396
|
-
console: 'PingOne Admin Console',
|
397
|
-
userIdentity: 'Vincent Diep',
|
398
|
-
menu: (0, _react2.jsx)(_index.DataTableMenu, null)
|
399
|
-
}];
|
400
|
-
var list = (0, _reactStately.useAsyncList)({
|
401
|
-
load: function load() {
|
402
|
-
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
403
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
404
|
-
while (1) switch (_context4.prev = _context4.next) {
|
405
|
-
case 0:
|
406
|
-
return _context4.abrupt("return", {
|
407
|
-
items: rows
|
408
|
-
});
|
409
|
-
case 1:
|
410
|
-
case "end":
|
411
|
-
return _context4.stop();
|
412
|
-
}
|
413
|
-
}, _callee4);
|
414
|
-
}))();
|
415
|
-
},
|
416
|
-
sort: function sort(_ref3) {
|
417
|
-
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
418
|
-
var items, sortDescriptor, cmp;
|
419
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
420
|
-
while (1) switch (_context5.prev = _context5.next) {
|
421
|
-
case 0:
|
422
|
-
items = _ref3.items, sortDescriptor = _ref3.sortDescriptor;
|
423
|
-
return _context5.abrupt("return", {
|
424
|
-
items: (0, _sort["default"])(items).call(items, function (a, b) {
|
425
|
-
var first = a[sortDescriptor.column];
|
426
|
-
var second = b[sortDescriptor.column];
|
427
|
-
cmp = ((0, _parseInt2["default"])(first, 10) || first) < ((0, _parseInt2["default"])(second, 10) || second) ? -1 : 1;
|
428
|
-
if (sortDescriptor.direction === 'descending') {
|
429
|
-
cmp *= -1;
|
430
|
-
}
|
431
|
-
return cmp;
|
432
|
-
})
|
433
|
-
});
|
434
|
-
case 2:
|
435
|
-
case "end":
|
436
|
-
return _context5.stop();
|
437
|
-
}
|
438
|
-
}, _callee5);
|
439
|
-
}))();
|
440
|
-
}
|
441
|
-
});
|
442
|
-
(0, _react.useEffect)(function () {
|
443
|
-
if (firstSortFlag && !list.isLoading && list.items.length > 0) {
|
444
|
-
(0, _sort["default"])(list).call(list, {
|
445
|
-
column: 'timestamp',
|
446
|
-
direction: 'ascending'
|
447
|
-
});
|
448
|
-
setFirstSortFlag(false);
|
449
|
-
}
|
450
|
-
}, [list.isLoading, list.items]);
|
451
|
-
return (0, _react2.jsx)(_index.DataTable, (0, _extends2["default"])({}, args, {
|
452
|
-
"aria-label": "Static table",
|
453
|
-
height: "100%",
|
454
|
-
sortDescriptor: list.sortDescriptor,
|
455
|
-
onSortChange: (0, _sort["default"])(list)
|
456
|
-
}), (0, _react2.jsx)(_index.DataTableHeader, {
|
457
|
-
columns: columns
|
458
|
-
}, function (column) {
|
459
|
-
return (0, _react2.jsx)(_index.DataTableColumn, {
|
460
|
-
cellProps: {
|
461
|
-
pr: column.key !== 'menu' ? 'lg' : 0,
|
462
|
-
pl: column.key === 'timestamp' || column.key === 'menu' ? 0 : 'lg'
|
463
|
-
},
|
464
|
-
minWidth: column.key !== 'menu' ? 175 : 32,
|
465
|
-
width: column.key !== 'menu' ? '19.4%' : 32,
|
466
|
-
hideHeader: column.key === 'menu',
|
467
|
-
allowsSorting: column.isSortable
|
468
|
-
}, column.name);
|
469
|
-
}), (0, _react2.jsx)(_index.DataTableBody, {
|
470
|
-
items: list.items,
|
471
|
-
loadingState: list.loadingState
|
472
|
-
}, function (item) {
|
473
|
-
return (0, _react2.jsx)(_index.DataTableRow, null, function (columnKey) {
|
474
532
|
return (0, _react2.jsx)(_index.DataTableCell, {
|
475
|
-
cellProps:
|
476
|
-
pr: columnKey !== 'menu' ? 'lg' : 0,
|
477
|
-
pl: columnKey === 'timestamp' || columnKey === 'menu' ? 0 : 'lg'
|
478
|
-
}
|
533
|
+
cellProps: getCellProps(columnKey)
|
479
534
|
}, item[columnKey]);
|
480
535
|
});
|
481
536
|
}));
|
482
537
|
};
|
483
|
-
exports.
|
538
|
+
exports.AsyncLoading = AsyncLoading;
|
@@ -340,13 +340,22 @@ var Default = function Default(args) {
|
|
340
340
|
columns: columns
|
341
341
|
}, function (column) {
|
342
342
|
return (0, _react2.jsx)(_index.DataTableColumn, {
|
343
|
+
cellProps: {
|
344
|
+
pr: 'lg',
|
345
|
+
pl: 'lg'
|
346
|
+
},
|
343
347
|
align: "center"
|
344
348
|
}, column.name);
|
345
349
|
}), (0, _react2.jsx)(_index.DataTableBody, {
|
346
350
|
items: filteredItems
|
347
351
|
}, function (item) {
|
348
352
|
return (0, _react2.jsx)(_index.DataTableRow, null, function (columnKey) {
|
349
|
-
return (0, _react2.jsx)(_index.DataTableCell,
|
353
|
+
return (0, _react2.jsx)(_index.DataTableCell, {
|
354
|
+
cellProps: {
|
355
|
+
pr: 'lg',
|
356
|
+
pl: 'lg'
|
357
|
+
}
|
358
|
+
}, item[columnKey]);
|
350
359
|
});
|
351
360
|
}));
|
352
361
|
};
|
@@ -14,22 +14,23 @@ import _reverseInstanceProperty from "@babel/runtime-corejs3/core-js-stable/inst
|
|
14
14
|
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
15
15
|
import _typeof from "@babel/runtime-corejs3/helpers/esm/typeof";
|
16
16
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
17
|
-
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
18
17
|
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerator";
|
18
|
+
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
19
19
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
20
|
+
import _Number$isNaN from "@babel/runtime-corejs3/core-js-stable/number/is-nan";
|
21
|
+
import _parseFloat from "@babel/runtime-corejs3/core-js-stable/parse-float";
|
20
22
|
import _sortInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/sort";
|
21
23
|
import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
|
22
24
|
import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
|
23
|
-
import _parseInt from "@babel/runtime-corejs3/core-js-stable/parse-int";
|
24
|
-
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 _context8; _forEachInstanceProperty(_context8 = ["next", "throw", "return"]).call(_context8, 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 _context9; 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(_context9 = this.tryEntries).call(_context9, 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; }
|
25
|
+
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 _context7; _forEachInstanceProperty(_context7 = ["next", "throw", "return"]).call(_context7, 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 _context8; 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(_context8 = this.tryEntries).call(_context8, 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; }
|
25
26
|
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; }
|
26
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var
|
27
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context5, _context6; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context5 = ownKeys(Object(source), !0)).call(_context5, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context6 = ownKeys(Object(source))).call(_context6, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
27
28
|
import React, { useEffect, useState } from 'react';
|
28
29
|
import { useAsyncList } from 'react-stately';
|
29
30
|
import { useCollator } from '@react-aria/i18n';
|
30
31
|
import { action } from '@storybook/addon-actions';
|
31
32
|
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
32
|
-
import { Box, DataTable, DataTableBody, DataTableCell, DataTableColumn, DataTableHeader, DataTableMenu, DataTableRow } from '../../index';
|
33
|
+
import { Box, DataTable, DataTableBadge, DataTableBody, DataTableCell, DataTableColumn, DataTableHeader, DataTableMenu, DataTableRow } from '../../index';
|
33
34
|
import { ariaAttributeBaseArgTypes } from '../../utils/docUtils/ariaAttributes';
|
34
35
|
import DataTableReadme from './DataTable.mdx';
|
35
36
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
@@ -111,8 +112,115 @@ export default {
|
|
111
112
|
overflowMode: 'truncate'
|
112
113
|
}
|
113
114
|
};
|
115
|
+
var getCellProps = function getCellProps(columnKey) {
|
116
|
+
return {
|
117
|
+
pr: columnKey !== 'menu' ? 'lg' : 0,
|
118
|
+
pl: columnKey === 'timestamp' || columnKey === 'menu' ? 0 : 'lg'
|
119
|
+
};
|
120
|
+
};
|
114
121
|
export var Default = function Default(args) {
|
115
|
-
var
|
122
|
+
var date = '2023-05-03';
|
123
|
+
var time = '07:16:30 pm UTC';
|
124
|
+
var timestampCell = ___EmotionJSX(React.Fragment, null, ___EmotionJSX(Box, null, date), ___EmotionJSX(Box, null, time));
|
125
|
+
var columns = [{
|
126
|
+
name: 'Timestamp',
|
127
|
+
key: 'timestamp'
|
128
|
+
}, {
|
129
|
+
name: 'Event Type',
|
130
|
+
key: 'eventType'
|
131
|
+
}, {
|
132
|
+
name: 'Description',
|
133
|
+
key: 'description'
|
134
|
+
}, {
|
135
|
+
name: 'Status',
|
136
|
+
key: 'status'
|
137
|
+
}, {
|
138
|
+
name: 'User Identity',
|
139
|
+
key: 'userIdentity'
|
140
|
+
}, {
|
141
|
+
name: 'Menu',
|
142
|
+
key: 'menu'
|
143
|
+
}];
|
144
|
+
var rows = [{
|
145
|
+
id: 1,
|
146
|
+
timestamp: timestampCell,
|
147
|
+
eventType: 'User Access Allowed',
|
148
|
+
description: ___EmotionJSX(React.Fragment, null, ___EmotionJSX(Box, null, "Passed Role Access"), ___EmotionJSX(Box, null, "Control")),
|
149
|
+
status: ___EmotionJSX(DataTableBadge, {
|
150
|
+
cell: "Approved"
|
151
|
+
}),
|
152
|
+
userIdentity: 'Vincent Diep',
|
153
|
+
menu: ___EmotionJSX(DataTableMenu, null)
|
154
|
+
}, {
|
155
|
+
id: 2,
|
156
|
+
timestamp: timestampCell,
|
157
|
+
eventType: 'User Access Denied',
|
158
|
+
description: ___EmotionJSX(React.Fragment, null, ___EmotionJSX(Box, {
|
159
|
+
display: "block"
|
160
|
+
}, "Passed Role Access"), ___EmotionJSX(Box, {
|
161
|
+
display: "block"
|
162
|
+
}, "Control"), ___EmotionJSX(Box, {
|
163
|
+
display: "block"
|
164
|
+
}, "Words Words Words Words Words Words Words Words Words Words Words Words Words Words")),
|
165
|
+
status: ___EmotionJSX(DataTableBadge, {
|
166
|
+
cell: "Rejected"
|
167
|
+
}),
|
168
|
+
userIdentity: 'Vincent Diep',
|
169
|
+
menu: ___EmotionJSX(DataTableMenu, null)
|
170
|
+
}, {
|
171
|
+
id: 3,
|
172
|
+
timestamp: timestampCell,
|
173
|
+
eventType: 'User Access Allowed',
|
174
|
+
description: 'Words Words Words Words Words Words Words Words Words Words Words Words Words Words Words Words Words Words Words Words',
|
175
|
+
status: ___EmotionJSX(DataTableBadge, {
|
176
|
+
cell: "Approved"
|
177
|
+
}),
|
178
|
+
userIdentity: 'Vincent Diep',
|
179
|
+
menu: ___EmotionJSX(DataTableMenu, null)
|
180
|
+
}, {
|
181
|
+
id: 4,
|
182
|
+
timestamp: timestampCell,
|
183
|
+
eventType: 'User Access Allowed',
|
184
|
+
description: ___EmotionJSX(React.Fragment, null, ___EmotionJSX(Box, null, "Passed Role Access"), ___EmotionJSX(Box, null, "Control")),
|
185
|
+
status: ___EmotionJSX(DataTableBadge, {
|
186
|
+
cell: "Approved"
|
187
|
+
}),
|
188
|
+
userIdentity: 'Vincent Diep',
|
189
|
+
menu: ___EmotionJSX(DataTableMenu, null)
|
190
|
+
}, {
|
191
|
+
id: 5,
|
192
|
+
timestamp: timestampCell,
|
193
|
+
eventType: 'User Access Allowed',
|
194
|
+
description: ___EmotionJSX(React.Fragment, null, ___EmotionJSX(Box, null, "Passed Role Access"), ___EmotionJSX(Box, null, "Control")),
|
195
|
+
status: ___EmotionJSX(DataTableBadge, {
|
196
|
+
cell: "Approved"
|
197
|
+
}),
|
198
|
+
userIdentity: 'Vincent Diep',
|
199
|
+
menu: ___EmotionJSX(DataTableMenu, null)
|
200
|
+
}];
|
201
|
+
return ___EmotionJSX(DataTable, _extends({}, args, {
|
202
|
+
"aria-label": "Static table",
|
203
|
+
height: "100%"
|
204
|
+
}), ___EmotionJSX(DataTableHeader, {
|
205
|
+
columns: columns
|
206
|
+
}, function (column) {
|
207
|
+
return ___EmotionJSX(DataTableColumn, {
|
208
|
+
cellProps: getCellProps(column.key),
|
209
|
+
minWidth: column.key !== 'menu' ? 175 : 32,
|
210
|
+
width: column.key !== 'menu' ? '19.4%' : 32,
|
211
|
+
hideHeader: column.key === 'menu'
|
212
|
+
}, column.name);
|
213
|
+
}), ___EmotionJSX(DataTableBody, {
|
214
|
+
items: rows
|
215
|
+
}, function (item) {
|
216
|
+
return ___EmotionJSX(DataTableRow, null, function (columnKey) {
|
217
|
+
return ___EmotionJSX(DataTableCell, {
|
218
|
+
cellProps: getCellProps(columnKey)
|
219
|
+
}, item[columnKey]);
|
220
|
+
});
|
221
|
+
}));
|
222
|
+
};
|
223
|
+
export var Dynamic = function Dynamic(args) {
|
116
224
|
var columns = [{
|
117
225
|
name: 'Country',
|
118
226
|
key: 'country'
|
@@ -159,9 +267,6 @@ export var Default = function Default(args) {
|
|
159
267
|
population: '25,000,000',
|
160
268
|
continent: 'Oceania'
|
161
269
|
}];
|
162
|
-
var collator = useCollator({
|
163
|
-
numeric: true
|
164
|
-
});
|
165
270
|
var list = useAsyncList({
|
166
271
|
load: function load() {
|
167
272
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
@@ -177,49 +282,158 @@ export var Default = function Default(args) {
|
|
177
282
|
}
|
178
283
|
}, _callee);
|
179
284
|
}))();
|
180
|
-
}
|
181
|
-
|
285
|
+
}
|
286
|
+
});
|
287
|
+
return ___EmotionJSX(DataTable, _extends({}, args, {
|
288
|
+
"aria-label": "Dynamic table"
|
289
|
+
}), ___EmotionJSX(DataTableHeader, {
|
290
|
+
columns: columns
|
291
|
+
}, function (column) {
|
292
|
+
return ___EmotionJSX(DataTableColumn, {
|
293
|
+
cellProps: getCellProps(column.key),
|
294
|
+
minWidth: 155,
|
295
|
+
align: "center"
|
296
|
+
}, column.name);
|
297
|
+
}), ___EmotionJSX(DataTableBody, {
|
298
|
+
items: list.items
|
299
|
+
}, function (item) {
|
300
|
+
return ___EmotionJSX(DataTableRow, null, function (columnKey) {
|
301
|
+
return ___EmotionJSX(DataTableCell, {
|
302
|
+
cellProps: getCellProps(columnKey)
|
303
|
+
}, item[columnKey]);
|
304
|
+
});
|
305
|
+
}));
|
306
|
+
};
|
307
|
+
export var Sortable = function Sortable(args) {
|
308
|
+
var _useState = useState(true),
|
309
|
+
_useState2 = _slicedToArray(_useState, 2),
|
310
|
+
firstSortFlag = _useState2[0],
|
311
|
+
setFirstSortFlag = _useState2[1];
|
312
|
+
var columns = [{
|
313
|
+
name: 'Country',
|
314
|
+
key: 'country',
|
315
|
+
isSortable: true
|
316
|
+
}, {
|
317
|
+
name: 'Population',
|
318
|
+
key: 'population',
|
319
|
+
isSortable: true
|
320
|
+
}, {
|
321
|
+
name: 'Continent',
|
322
|
+
key: 'continent',
|
323
|
+
isSortable: true
|
324
|
+
}];
|
325
|
+
var rows = [{
|
326
|
+
id: 1,
|
327
|
+
country: 'Austria',
|
328
|
+
population: '25,000,000',
|
329
|
+
continent: 'Oceania'
|
330
|
+
}, {
|
331
|
+
id: 2,
|
332
|
+
country: 'Canada',
|
333
|
+
population: '37,000,000',
|
334
|
+
continent: 'North America'
|
335
|
+
}, {
|
336
|
+
id: 3,
|
337
|
+
country: 'China',
|
338
|
+
population: '1,398,000,000',
|
339
|
+
continent: 'Asia'
|
340
|
+
}, {
|
341
|
+
id: 4,
|
342
|
+
country: 'Ethiopia',
|
343
|
+
population: '120,000,000',
|
344
|
+
continent: 'Africa'
|
345
|
+
}, {
|
346
|
+
id: 5,
|
347
|
+
country: 'France',
|
348
|
+
population: '67,000,000',
|
349
|
+
continent: 'Europe'
|
350
|
+
}, {
|
351
|
+
id: 6,
|
352
|
+
country: 'Mexico',
|
353
|
+
population: '126,000,000',
|
354
|
+
continent: 'South America'
|
355
|
+
}, {
|
356
|
+
id: 7,
|
357
|
+
country: 'USA',
|
358
|
+
population: '320,000,000',
|
359
|
+
continent: 'North America'
|
360
|
+
}];
|
361
|
+
var collator = useCollator({
|
362
|
+
numeric: true
|
363
|
+
});
|
364
|
+
var list = useAsyncList({
|
365
|
+
load: function load() {
|
182
366
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
183
|
-
var items, sortDescriptor;
|
184
367
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
185
368
|
while (1) switch (_context2.prev = _context2.next) {
|
186
369
|
case 0:
|
187
|
-
items = _ref.items, sortDescriptor = _ref.sortDescriptor;
|
188
370
|
return _context2.abrupt("return", {
|
371
|
+
items: rows
|
372
|
+
});
|
373
|
+
case 1:
|
374
|
+
case "end":
|
375
|
+
return _context2.stop();
|
376
|
+
}
|
377
|
+
}, _callee2);
|
378
|
+
}))();
|
379
|
+
},
|
380
|
+
sort: function sort(_ref) {
|
381
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
382
|
+
var items, sortDescriptor, getNumericValue;
|
383
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
384
|
+
while (1) switch (_context3.prev = _context3.next) {
|
385
|
+
case 0:
|
386
|
+
items = _ref.items, sortDescriptor = _ref.sortDescriptor;
|
387
|
+
getNumericValue = function getNumericValue(str) {
|
388
|
+
return !_Number$isNaN(str) && _parseFloat(str.replace(/,/g, ''));
|
389
|
+
};
|
390
|
+
return _context3.abrupt("return", {
|
189
391
|
items: _sortInstanceProperty(items).call(items, function (a, b) {
|
190
392
|
var first = a[sortDescriptor.column];
|
191
393
|
var second = b[sortDescriptor.column];
|
192
|
-
var
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
return cmp;
|
394
|
+
var firstNumericValue = getNumericValue(first);
|
395
|
+
var secondNumericValue = getNumericValue(second);
|
396
|
+
var cmp = firstNumericValue && secondNumericValue ? firstNumericValue - secondNumericValue : collator.compare(first, second);
|
397
|
+
return sortDescriptor.direction === 'descending' ? -cmp : cmp;
|
197
398
|
})
|
198
399
|
});
|
199
|
-
case
|
400
|
+
case 3:
|
200
401
|
case "end":
|
201
|
-
return
|
402
|
+
return _context3.stop();
|
202
403
|
}
|
203
|
-
},
|
404
|
+
}, _callee3);
|
204
405
|
}))();
|
205
406
|
}
|
206
407
|
});
|
408
|
+
useEffect(function () {
|
409
|
+
if (firstSortFlag && !list.isLoading && list.items.length > 0) {
|
410
|
+
_sortInstanceProperty(list).call(list, {
|
411
|
+
column: 'country',
|
412
|
+
direction: 'ascending'
|
413
|
+
});
|
414
|
+
setFirstSortFlag(false);
|
415
|
+
}
|
416
|
+
}, [firstSortFlag, list, list.isLoading, list.items]);
|
207
417
|
return ___EmotionJSX(DataTable, _extends({}, args, {
|
208
|
-
"aria-label": "
|
209
|
-
sortDescriptor:
|
418
|
+
"aria-label": "Sortable table",
|
419
|
+
sortDescriptor: list.sortDescriptor,
|
210
420
|
onSortChange: _sortInstanceProperty(list)
|
211
421
|
}), ___EmotionJSX(DataTableHeader, {
|
212
422
|
columns: columns
|
213
423
|
}, function (column) {
|
214
424
|
return ___EmotionJSX(DataTableColumn, {
|
425
|
+
cellProps: getCellProps(column.key),
|
215
426
|
allowsSorting: true,
|
427
|
+
minWidth: 155,
|
216
428
|
align: "center"
|
217
429
|
}, column.name);
|
218
430
|
}), ___EmotionJSX(DataTableBody, {
|
219
431
|
items: list.items
|
220
432
|
}, function (item) {
|
221
433
|
return ___EmotionJSX(DataTableRow, null, function (columnKey) {
|
222
|
-
return ___EmotionJSX(DataTableCell,
|
434
|
+
return ___EmotionJSX(DataTableCell, {
|
435
|
+
cellProps: getCellProps(columnKey)
|
436
|
+
}, item[columnKey]);
|
223
437
|
});
|
224
438
|
}));
|
225
439
|
};
|
@@ -245,40 +459,40 @@ export var AsyncLoading = function AsyncLoading(args) {
|
|
245
459
|
}];
|
246
460
|
var list = useAsyncList({
|
247
461
|
load: function load(_ref2) {
|
248
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
462
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
249
463
|
var signal, cursor, res, json;
|
250
|
-
return _regeneratorRuntime().wrap(function
|
251
|
-
while (1) switch (
|
464
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
465
|
+
while (1) switch (_context4.prev = _context4.next) {
|
252
466
|
case 0:
|
253
467
|
signal = _ref2.signal, cursor = _ref2.cursor;
|
254
468
|
if (cursor) {
|
255
469
|
// eslint-disable-next-line no-param-reassign
|
256
470
|
cursor = cursor.replace(/^http:\/\//i, 'https://');
|
257
471
|
}
|
258
|
-
|
472
|
+
_context4.next = 4;
|
259
473
|
return fetch(cursor || 'https://swapi.py4e.com/api/people/?search=', {
|
260
474
|
signal: signal
|
261
475
|
});
|
262
476
|
case 4:
|
263
|
-
res =
|
264
|
-
|
477
|
+
res = _context4.sent;
|
478
|
+
_context4.next = 7;
|
265
479
|
return res.json();
|
266
480
|
case 7:
|
267
|
-
json =
|
268
|
-
|
481
|
+
json = _context4.sent;
|
482
|
+
_context4.next = 10;
|
269
483
|
return new _Promise(function (resolve) {
|
270
484
|
return _setTimeout(resolve, cursor ? 2000 : 3000);
|
271
485
|
});
|
272
486
|
case 10:
|
273
|
-
return
|
487
|
+
return _context4.abrupt("return", {
|
274
488
|
items: json.results,
|
275
489
|
cursor: json.next
|
276
490
|
});
|
277
491
|
case 11:
|
278
492
|
case "end":
|
279
|
-
return
|
493
|
+
return _context4.stop();
|
280
494
|
}
|
281
|
-
},
|
495
|
+
}, _callee4);
|
282
496
|
}))();
|
283
497
|
}
|
284
498
|
});
|
@@ -289,8 +503,8 @@ export var AsyncLoading = function AsyncLoading(args) {
|
|
289
503
|
columns: columns
|
290
504
|
}, function (column) {
|
291
505
|
return ___EmotionJSX(DataTableColumn, {
|
292
|
-
|
293
|
-
|
506
|
+
cellProps: getCellProps(column.key),
|
507
|
+
minWidth: 155
|
294
508
|
}, column.name);
|
295
509
|
}), ___EmotionJSX(DataTableBody, {
|
296
510
|
items: list.items,
|
@@ -300,168 +514,8 @@ export var AsyncLoading = function AsyncLoading(args) {
|
|
300
514
|
return ___EmotionJSX(DataTableRow, {
|
301
515
|
key: item.name
|
302
516
|
}, function (columnKey) {
|
303
|
-
return ___EmotionJSX(DataTableCell, null, item[columnKey]);
|
304
|
-
});
|
305
|
-
}));
|
306
|
-
};
|
307
|
-
export var New = function New(args) {
|
308
|
-
var _useState = useState(true),
|
309
|
-
_useState2 = _slicedToArray(_useState, 2),
|
310
|
-
firstSortFlag = _useState2[0],
|
311
|
-
setFirstSortFlag = _useState2[1];
|
312
|
-
var date = '2023-05-03';
|
313
|
-
var time = '07:16:30 pm UTC';
|
314
|
-
var timestampCell = ___EmotionJSX(React.Fragment, null, ___EmotionJSX(Box, null, date), ___EmotionJSX(Box, null, time));
|
315
|
-
var columns = [{
|
316
|
-
name: 'Timestamp',
|
317
|
-
key: 'timestamp',
|
318
|
-
isSortable: true
|
319
|
-
}, {
|
320
|
-
name: 'Event Type',
|
321
|
-
key: 'eventType',
|
322
|
-
isSortable: true
|
323
|
-
}, {
|
324
|
-
name: 'Description',
|
325
|
-
key: 'description',
|
326
|
-
isSortable: true
|
327
|
-
}, {
|
328
|
-
name: 'Console',
|
329
|
-
key: 'console',
|
330
|
-
isSortable: true
|
331
|
-
}, {
|
332
|
-
name: 'User Identity',
|
333
|
-
key: 'userIdentity',
|
334
|
-
isSortable: true
|
335
|
-
}, {
|
336
|
-
name: 'Menu',
|
337
|
-
key: 'menu'
|
338
|
-
}];
|
339
|
-
var rows = [{
|
340
|
-
id: 1,
|
341
|
-
timestamp: timestampCell,
|
342
|
-
eventType: 'User Access Allowed',
|
343
|
-
description: ___EmotionJSX(React.Fragment, null, ___EmotionJSX(Box, null, "Passed Role Access"), ___EmotionJSX(Box, null, "Control")),
|
344
|
-
console: 'PingOne Admin Console',
|
345
|
-
userIdentity: 'Vincent Diep',
|
346
|
-
menu: ___EmotionJSX(DataTableMenu, null)
|
347
|
-
}, {
|
348
|
-
id: 2,
|
349
|
-
timestamp: timestampCell,
|
350
|
-
eventType: 'User Access Denied',
|
351
|
-
description: ___EmotionJSX(React.Fragment, null, ___EmotionJSX(Box, {
|
352
|
-
display: "block"
|
353
|
-
}, "Passed Role Access"), ___EmotionJSX(Box, {
|
354
|
-
display: "block"
|
355
|
-
}, "Control"), ___EmotionJSX(Box, {
|
356
|
-
display: "block"
|
357
|
-
}, "Words Words Words Words Words Words Words Words Words Words Words Words Words Words")),
|
358
|
-
console: 'PingOne Admin Console',
|
359
|
-
userIdentity: 'Vincent Diep',
|
360
|
-
menu: ___EmotionJSX(DataTableMenu, null)
|
361
|
-
}, {
|
362
|
-
id: 3,
|
363
|
-
timestamp: timestampCell,
|
364
|
-
eventType: 'User Access Allowed',
|
365
|
-
description: 'Words Words Words Words Words Words Words Words Words Words Words Words Words Words Words Words Words Words Words Words',
|
366
|
-
console: 'PingOne Admin Console',
|
367
|
-
userIdentity: 'Vincent Diep',
|
368
|
-
menu: ___EmotionJSX(DataTableMenu, null)
|
369
|
-
}, {
|
370
|
-
id: 4,
|
371
|
-
timestamp: timestampCell,
|
372
|
-
eventType: 'User Access Allowed',
|
373
|
-
description: ___EmotionJSX(React.Fragment, null, ___EmotionJSX(Box, null, "Passed Role Access"), ___EmotionJSX(Box, null, "Control")),
|
374
|
-
console: 'PingOne Admin Console',
|
375
|
-
userIdentity: 'Vincent Diep',
|
376
|
-
menu: ___EmotionJSX(DataTableMenu, null)
|
377
|
-
}, {
|
378
|
-
id: 5,
|
379
|
-
timestamp: timestampCell,
|
380
|
-
eventType: 'User Access Allowed',
|
381
|
-
description: ___EmotionJSX(React.Fragment, null, ___EmotionJSX(Box, null, "Passed Role Access"), ___EmotionJSX(Box, null, "Control")),
|
382
|
-
console: 'PingOne Admin Console',
|
383
|
-
userIdentity: 'Vincent Diep',
|
384
|
-
menu: ___EmotionJSX(DataTableMenu, null)
|
385
|
-
}];
|
386
|
-
var list = useAsyncList({
|
387
|
-
load: function load() {
|
388
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
389
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
390
|
-
while (1) switch (_context4.prev = _context4.next) {
|
391
|
-
case 0:
|
392
|
-
return _context4.abrupt("return", {
|
393
|
-
items: rows
|
394
|
-
});
|
395
|
-
case 1:
|
396
|
-
case "end":
|
397
|
-
return _context4.stop();
|
398
|
-
}
|
399
|
-
}, _callee4);
|
400
|
-
}))();
|
401
|
-
},
|
402
|
-
sort: function sort(_ref3) {
|
403
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
404
|
-
var items, sortDescriptor, cmp;
|
405
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
406
|
-
while (1) switch (_context5.prev = _context5.next) {
|
407
|
-
case 0:
|
408
|
-
items = _ref3.items, sortDescriptor = _ref3.sortDescriptor;
|
409
|
-
return _context5.abrupt("return", {
|
410
|
-
items: _sortInstanceProperty(items).call(items, function (a, b) {
|
411
|
-
var first = a[sortDescriptor.column];
|
412
|
-
var second = b[sortDescriptor.column];
|
413
|
-
cmp = (_parseInt(first, 10) || first) < (_parseInt(second, 10) || second) ? -1 : 1;
|
414
|
-
if (sortDescriptor.direction === 'descending') {
|
415
|
-
cmp *= -1;
|
416
|
-
}
|
417
|
-
return cmp;
|
418
|
-
})
|
419
|
-
});
|
420
|
-
case 2:
|
421
|
-
case "end":
|
422
|
-
return _context5.stop();
|
423
|
-
}
|
424
|
-
}, _callee5);
|
425
|
-
}))();
|
426
|
-
}
|
427
|
-
});
|
428
|
-
useEffect(function () {
|
429
|
-
if (firstSortFlag && !list.isLoading && list.items.length > 0) {
|
430
|
-
_sortInstanceProperty(list).call(list, {
|
431
|
-
column: 'timestamp',
|
432
|
-
direction: 'ascending'
|
433
|
-
});
|
434
|
-
setFirstSortFlag(false);
|
435
|
-
}
|
436
|
-
}, [list.isLoading, list.items]);
|
437
|
-
return ___EmotionJSX(DataTable, _extends({}, args, {
|
438
|
-
"aria-label": "Static table",
|
439
|
-
height: "100%",
|
440
|
-
sortDescriptor: list.sortDescriptor,
|
441
|
-
onSortChange: _sortInstanceProperty(list)
|
442
|
-
}), ___EmotionJSX(DataTableHeader, {
|
443
|
-
columns: columns
|
444
|
-
}, function (column) {
|
445
|
-
return ___EmotionJSX(DataTableColumn, {
|
446
|
-
cellProps: {
|
447
|
-
pr: column.key !== 'menu' ? 'lg' : 0,
|
448
|
-
pl: column.key === 'timestamp' || column.key === 'menu' ? 0 : 'lg'
|
449
|
-
},
|
450
|
-
minWidth: column.key !== 'menu' ? 175 : 32,
|
451
|
-
width: column.key !== 'menu' ? '19.4%' : 32,
|
452
|
-
hideHeader: column.key === 'menu',
|
453
|
-
allowsSorting: column.isSortable
|
454
|
-
}, column.name);
|
455
|
-
}), ___EmotionJSX(DataTableBody, {
|
456
|
-
items: list.items,
|
457
|
-
loadingState: list.loadingState
|
458
|
-
}, function (item) {
|
459
|
-
return ___EmotionJSX(DataTableRow, null, function (columnKey) {
|
460
517
|
return ___EmotionJSX(DataTableCell, {
|
461
|
-
cellProps:
|
462
|
-
pr: columnKey !== 'menu' ? 'lg' : 0,
|
463
|
-
pl: columnKey === 'timestamp' || columnKey === 'menu' ? 0 : 'lg'
|
464
|
-
}
|
518
|
+
cellProps: getCellProps(columnKey)
|
465
519
|
}, item[columnKey]);
|
466
520
|
});
|
467
521
|
}));
|
@@ -328,13 +328,22 @@ export var Default = function Default(args) {
|
|
328
328
|
columns: columns
|
329
329
|
}, function (column) {
|
330
330
|
return ___EmotionJSX(DataTableColumn, {
|
331
|
+
cellProps: {
|
332
|
+
pr: 'lg',
|
333
|
+
pl: 'lg'
|
334
|
+
},
|
331
335
|
align: "center"
|
332
336
|
}, column.name);
|
333
337
|
}), ___EmotionJSX(DataTableBody, {
|
334
338
|
items: filteredItems
|
335
339
|
}, function (item) {
|
336
340
|
return ___EmotionJSX(DataTableRow, null, function (columnKey) {
|
337
|
-
return ___EmotionJSX(DataTableCell,
|
341
|
+
return ___EmotionJSX(DataTableCell, {
|
342
|
+
cellProps: {
|
343
|
+
pr: 'lg',
|
344
|
+
pl: 'lg'
|
345
|
+
}
|
346
|
+
}, item[columnKey]);
|
338
347
|
});
|
339
348
|
}));
|
340
349
|
};
|