@pingux/astro 2.121.1-alpha.1 → 2.121.1-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/MultivaluesField/CondensedMultivaluesField.js +9 -1
- package/lib/cjs/components/MultivaluesField/MultivaluesField.stories.js +147 -59
- package/lib/cjs/components/MultivaluesField/MultivaluesField.test.js +23 -4
- package/lib/components/MultivaluesField/CondensedMultivaluesField.js +9 -1
- package/lib/components/MultivaluesField/MultivaluesField.stories.js +145 -58
- package/lib/components/MultivaluesField/MultivaluesField.test.js +23 -4
- package/package.json +1 -1
@@ -37,6 +37,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
37
37
|
var _ = require("../..");
|
38
38
|
var _MultivaluesContext = require("../../context/MultivaluesContext");
|
39
39
|
var _hooks = require("../../hooks");
|
40
|
+
var _loadingStates = _interopRequireDefault(require("../../utils/devUtils/constants/loadingStates"));
|
40
41
|
var _pendoID = require("../../utils/devUtils/constants/pendoID");
|
41
42
|
var _isIterable = require("../../utils/devUtils/props/isIterable");
|
42
43
|
var _ariaAttributes = require("../../utils/docUtils/ariaAttributes");
|
@@ -44,7 +45,7 @@ var _fieldAttributes = require("../../utils/docUtils/fieldAttributes");
|
|
44
45
|
var _statusProp = require("../../utils/docUtils/statusProp");
|
45
46
|
var _ListBox = _interopRequireDefault(require("../ListBox"));
|
46
47
|
var _react2 = require("@emotion/react");
|
47
|
-
var _excluded = ["defaultSelectedKeys", "direction", "disabledKeys", "containerProps", "hasAutoFocus", "hasNoSelectAll", "hasNoStatusIndicator", "helperText", "inputProps", "isDisabled", "isNotFlippable", "isReadOnly", "isRequired", "items", "label", "mode", "onBlur", "onFocus", "onInputChange", "onKeyDown", "onKeyUp", "onOpenChange", "onSelectionChange", "placeholder", "selectedKeys", "selectedOptionText", "scrollBoxProps", "status"];
|
48
|
+
var _excluded = ["defaultSelectedKeys", "direction", "disabledKeys", "containerProps", "hasAutoFocus", "hasNoSelectAll", "hasNoStatusIndicator", "helperText", "inputProps", "isDisabled", "isNotFlippable", "isReadOnly", "isRequired", "items", "label", "loadingState", "mode", "onBlur", "onFocus", "onInputChange", "onKeyDown", "onKeyUp", "onLoadMore", "onLoadPrev", "onOpenChange", "onSelectionChange", "placeholder", "selectedKeys", "selectedOptionText", "scrollBoxProps", "status"];
|
48
49
|
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); }
|
49
50
|
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; }
|
50
51
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty2(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
@@ -67,12 +68,15 @@ var CondensedMultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (pr
|
|
67
68
|
isRequired = props.isRequired,
|
68
69
|
items = props.items,
|
69
70
|
label = props.label,
|
71
|
+
loadingState = props.loadingState,
|
70
72
|
mode = props.mode,
|
71
73
|
_onBlur = props.onBlur,
|
72
74
|
_onFocus = props.onFocus,
|
73
75
|
onInputChange = props.onInputChange,
|
74
76
|
onKeyDown = props.onKeyDown,
|
75
77
|
_onKeyUp = props.onKeyUp,
|
78
|
+
onLoadMore = props.onLoadMore,
|
79
|
+
onLoadPrev = props.onLoadPrev,
|
76
80
|
onOpenChange = props.onOpenChange,
|
77
81
|
onSelectionChange = props.onSelectionChange,
|
78
82
|
placeholder = props.placeholder,
|
@@ -292,6 +296,10 @@ var CondensedMultivaluesField = /*#__PURE__*/(0, _react.forwardRef)(function (pr
|
|
292
296
|
hasAutoFocus: hasAutoFocus,
|
293
297
|
hasNoEmptySelection: true,
|
294
298
|
state: state,
|
299
|
+
onLoadMore: onLoadMore,
|
300
|
+
onLoadPrev: onLoadPrev,
|
301
|
+
loadingState: loadingState,
|
302
|
+
isLoading: loadingState === _loadingStates["default"].LOADING_MORE,
|
295
303
|
"aria-label": "List of options",
|
296
304
|
isCondensed: mode === 'condensed'
|
297
305
|
}, overlayProps))), (0, _react2.jsx)(_reactAria.DismissButton, {
|
@@ -21,7 +21,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
21
21
|
_Object$defineProperty(exports, "__esModule", {
|
22
22
|
value: true
|
23
23
|
});
|
24
|
-
exports["default"] = exports.Uncontrolled = exports.ReadOnlyValues = exports.ReadOnlyField = exports.OnLoadPrev = exports.IconSlotsInBadge = exports.Error = exports.DisabledKeys = exports.Default = exports.CustomValues = exports.CustomSize = exports.Controlled = exports.CondensedWithSection = exports.CondensedWithCustomText = exports.Condensed = void 0;
|
24
|
+
exports["default"] = exports.Uncontrolled = exports.ReadOnlyValues = exports.ReadOnlyField = exports.OnLoadPrev = exports.IconSlotsInBadge = exports.Error = exports.DisabledKeys = exports.Default = exports.CustomValues = exports.CustomSize = exports.Controlled = exports.CondensedWithSection = exports.CondensedWithCustomText = exports.CondensedAsyncLoading = exports.Condensed = void 0;
|
25
25
|
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
26
26
|
var _fill = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/fill"));
|
27
27
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
@@ -42,9 +42,9 @@ var _MultivaluesField = _interopRequireDefault(require("./MultivaluesField.mdx")
|
|
42
42
|
var _react2 = require("@emotion/react");
|
43
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); }
|
44
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; }
|
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 _context13; _forEachInstanceProperty(_context13 = ["next", "throw", "return"]).call(_context13, 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 _context14; 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(_context14 = this.tryEntries).call(_context14, 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 _context19; _forEachInstanceProperty(_context19 = ["next", "throw", "return"]).call(_context19, 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 _context20; 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(_context20 = this.tryEntries).call(_context20, 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; }
|
46
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; }
|
47
|
-
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 _context17, _context18; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context17 = ownKeys(Object(source), !0)).call(_context17, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context18 = ownKeys(Object(source))).call(_context18, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
48
48
|
var _default = {
|
49
49
|
title: 'Form/MultivaluesField',
|
50
50
|
component: _index.MultivaluesField,
|
@@ -672,11 +672,99 @@ var Condensed = function Condensed(args) {
|
|
672
672
|
}));
|
673
673
|
};
|
674
674
|
exports.Condensed = Condensed;
|
675
|
-
var
|
676
|
-
var
|
675
|
+
var CondensedAsyncLoading = function CondensedAsyncLoading(args) {
|
676
|
+
var _context, _context2;
|
677
|
+
var direction = args.direction;
|
678
|
+
var initialItems = (0, _map["default"])(_context = (0, _fill["default"])(_context2 = new Array(10)).call(_context2, {
|
679
|
+
key: 'string',
|
680
|
+
name: 'string'
|
681
|
+
})).call(_context, function (_, index) {
|
682
|
+
return {
|
683
|
+
name: "name: ".concat(index),
|
684
|
+
key: "name: ".concat(index),
|
685
|
+
id: index
|
686
|
+
};
|
687
|
+
});
|
688
|
+
var _useState25 = (0, _react.useState)(10),
|
677
689
|
_useState26 = (0, _slicedToArray2["default"])(_useState25, 2),
|
678
|
-
|
679
|
-
|
690
|
+
maxNum = _useState26[0],
|
691
|
+
setMaxNum = _useState26[1];
|
692
|
+
var _useState27 = (0, _react.useState)(initialItems),
|
693
|
+
_useState28 = (0, _slicedToArray2["default"])(_useState27, 2),
|
694
|
+
listItems = _useState28[0],
|
695
|
+
setListItems = _useState28[1];
|
696
|
+
var _useState29 = (0, _react.useState)(false),
|
697
|
+
_useState30 = (0, _slicedToArray2["default"])(_useState29, 2),
|
698
|
+
isOpen = _useState30[0],
|
699
|
+
setIsOpen = _useState30[1];
|
700
|
+
var _useState31 = (0, _react.useState)(_loadingStates["default"].IDLE),
|
701
|
+
_useState32 = (0, _slicedToArray2["default"])(_useState31, 2),
|
702
|
+
loadingState = _useState32[0],
|
703
|
+
setLoadingState = _useState32[1];
|
704
|
+
var onOpenChange = function onOpenChange() {
|
705
|
+
setIsOpen(true);
|
706
|
+
};
|
707
|
+
var onLoadMore = /*#__PURE__*/function () {
|
708
|
+
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
709
|
+
var _context3, _context4, _context5;
|
710
|
+
var newItems;
|
711
|
+
return _regeneratorRuntime().wrap(function _callee$(_context6) {
|
712
|
+
while (1) switch (_context6.prev = _context6.next) {
|
713
|
+
case 0:
|
714
|
+
setLoadingState(_loadingStates["default"].LOADING_MORE);
|
715
|
+
_context6.next = 3;
|
716
|
+
return new _promise["default"](function (resolve) {
|
717
|
+
return (0, _setTimeout2["default"])(resolve, 3000);
|
718
|
+
});
|
719
|
+
case 3:
|
720
|
+
newItems = (0, _map["default"])(_context3 = (0, _fill["default"])(_context4 = new Array(10)).call(_context4, {
|
721
|
+
key: 'string',
|
722
|
+
name: 'string'
|
723
|
+
})).call(_context3, function (_, index) {
|
724
|
+
return {
|
725
|
+
name: "name: ".concat(maxNum + index),
|
726
|
+
key: "name: ".concat(maxNum + index),
|
727
|
+
id: maxNum + index
|
728
|
+
};
|
729
|
+
});
|
730
|
+
setMaxNum(maxNum + 10);
|
731
|
+
setListItems((0, _concat["default"])(_context5 = []).call(_context5, listItems, newItems));
|
732
|
+
setLoadingState(_loadingStates["default"].IDLE);
|
733
|
+
case 7:
|
734
|
+
case "end":
|
735
|
+
return _context6.stop();
|
736
|
+
}
|
737
|
+
}, _callee);
|
738
|
+
}));
|
739
|
+
return function onLoadMore() {
|
740
|
+
return _ref.apply(this, arguments);
|
741
|
+
};
|
742
|
+
}();
|
743
|
+
return (0, _react2.jsx)(_index.OverlayProvider
|
744
|
+
// note: spacing for demo purpose only so that the select list renders in the right place
|
745
|
+
, {
|
746
|
+
style: setOverlayStyle(direction, isOpen, '25%', '25%', '75%')
|
747
|
+
}, (0, _react2.jsx)(_index.MultivaluesField, (0, _extends2["default"])({
|
748
|
+
items: listItems
|
749
|
+
}, args, {
|
750
|
+
mode: "condensed",
|
751
|
+
onOpenChange: onOpenChange,
|
752
|
+
loadingState: loadingState,
|
753
|
+
onLoadMore: onLoadMore
|
754
|
+
}), function (item) {
|
755
|
+
return (0, _react2.jsx)(_index.Item, {
|
756
|
+
key: item.key,
|
757
|
+
"data-id": item.name,
|
758
|
+
"aria-label": item.name
|
759
|
+
}, item.name);
|
760
|
+
}));
|
761
|
+
};
|
762
|
+
exports.CondensedAsyncLoading = CondensedAsyncLoading;
|
763
|
+
var CondensedWithSection = function CondensedWithSection(args) {
|
764
|
+
var _useState33 = (0, _react.useState)(false),
|
765
|
+
_useState34 = (0, _slicedToArray2["default"])(_useState33, 2),
|
766
|
+
isOpen = _useState34[0],
|
767
|
+
setIsOpen = _useState34[1];
|
680
768
|
var direction = args.direction;
|
681
769
|
var onOpenChange = function onOpenChange() {
|
682
770
|
setIsOpen(true);
|
@@ -704,14 +792,14 @@ var CondensedWithSection = function CondensedWithSection(args) {
|
|
704
792
|
};
|
705
793
|
exports.CondensedWithSection = CondensedWithSection;
|
706
794
|
var CondensedWithCustomText = function CondensedWithCustomText(args) {
|
707
|
-
var
|
708
|
-
|
709
|
-
isOpen =
|
710
|
-
setIsOpen =
|
711
|
-
var
|
712
|
-
|
713
|
-
selectedKeys =
|
714
|
-
setSelectedKeys =
|
795
|
+
var _useState35 = (0, _react.useState)(false),
|
796
|
+
_useState36 = (0, _slicedToArray2["default"])(_useState35, 2),
|
797
|
+
isOpen = _useState36[0],
|
798
|
+
setIsOpen = _useState36[1];
|
799
|
+
var _useState37 = (0, _react.useState)([]),
|
800
|
+
_useState38 = (0, _slicedToArray2["default"])(_useState37, 2),
|
801
|
+
selectedKeys = _useState38[0],
|
802
|
+
setSelectedKeys = _useState38[1];
|
715
803
|
var direction = args.direction;
|
716
804
|
var onOpenChange = function onOpenChange() {
|
717
805
|
setIsOpen(true);
|
@@ -743,57 +831,57 @@ var CondensedWithCustomText = function CondensedWithCustomText(args) {
|
|
743
831
|
};
|
744
832
|
exports.CondensedWithCustomText = CondensedWithCustomText;
|
745
833
|
var OnLoadPrev = function OnLoadPrev() {
|
746
|
-
var
|
747
|
-
var initialItems = (0, _map["default"])(
|
834
|
+
var _context7, _context8;
|
835
|
+
var initialItems = (0, _map["default"])(_context7 = (0, _fill["default"])(_context8 = new Array(10)).call(_context8, {
|
748
836
|
key: 'string',
|
749
837
|
name: 'string'
|
750
|
-
})).call(
|
838
|
+
})).call(_context7, function (_, index) {
|
751
839
|
return {
|
752
840
|
name: "name: ".concat(index),
|
753
841
|
key: "name: ".concat(index),
|
754
842
|
id: index
|
755
843
|
};
|
756
844
|
});
|
757
|
-
var
|
758
|
-
_useState32 = (0, _slicedToArray2["default"])(_useState31, 2),
|
759
|
-
minNum = _useState32[0],
|
760
|
-
setMinNum = _useState32[1];
|
761
|
-
var _useState33 = (0, _react.useState)(10),
|
762
|
-
_useState34 = (0, _slicedToArray2["default"])(_useState33, 2),
|
763
|
-
maxNum = _useState34[0],
|
764
|
-
setMaxNum = _useState34[1];
|
765
|
-
var _useState35 = (0, _react.useState)(initialItems),
|
766
|
-
_useState36 = (0, _slicedToArray2["default"])(_useState35, 2),
|
767
|
-
listItems = _useState36[0],
|
768
|
-
setListItems = _useState36[1];
|
769
|
-
var _useState37 = (0, _react.useState)(false),
|
770
|
-
_useState38 = (0, _slicedToArray2["default"])(_useState37, 2),
|
771
|
-
isOpen = _useState38[0],
|
772
|
-
setIsOpen = _useState38[1];
|
773
|
-
var _useState39 = (0, _react.useState)(_loadingStates["default"].IDLE),
|
845
|
+
var _useState39 = (0, _react.useState)(0),
|
774
846
|
_useState40 = (0, _slicedToArray2["default"])(_useState39, 2),
|
775
|
-
|
776
|
-
|
847
|
+
minNum = _useState40[0],
|
848
|
+
setMinNum = _useState40[1];
|
849
|
+
var _useState41 = (0, _react.useState)(10),
|
850
|
+
_useState42 = (0, _slicedToArray2["default"])(_useState41, 2),
|
851
|
+
maxNum = _useState42[0],
|
852
|
+
setMaxNum = _useState42[1];
|
853
|
+
var _useState43 = (0, _react.useState)(initialItems),
|
854
|
+
_useState44 = (0, _slicedToArray2["default"])(_useState43, 2),
|
855
|
+
listItems = _useState44[0],
|
856
|
+
setListItems = _useState44[1];
|
857
|
+
var _useState45 = (0, _react.useState)(false),
|
858
|
+
_useState46 = (0, _slicedToArray2["default"])(_useState45, 2),
|
859
|
+
isOpen = _useState46[0],
|
860
|
+
setIsOpen = _useState46[1];
|
861
|
+
var _useState47 = (0, _react.useState)(_loadingStates["default"].IDLE),
|
862
|
+
_useState48 = (0, _slicedToArray2["default"])(_useState47, 2),
|
863
|
+
loadingState = _useState48[0],
|
864
|
+
setLoadingState = _useState48[1];
|
777
865
|
var onOpenChange = function onOpenChange() {
|
778
866
|
setIsOpen(true);
|
779
867
|
};
|
780
868
|
var onLoadMore = /*#__PURE__*/function () {
|
781
|
-
var
|
782
|
-
var
|
869
|
+
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
870
|
+
var _context9, _context10, _context11;
|
783
871
|
var newItems;
|
784
|
-
return _regeneratorRuntime().wrap(function
|
785
|
-
while (1) switch (
|
872
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context12) {
|
873
|
+
while (1) switch (_context12.prev = _context12.next) {
|
786
874
|
case 0:
|
787
875
|
setLoadingState(_loadingStates["default"].LOADING_MORE);
|
788
|
-
|
876
|
+
_context12.next = 3;
|
789
877
|
return new _promise["default"](function (resolve) {
|
790
878
|
return (0, _setTimeout2["default"])(resolve, 3000);
|
791
879
|
});
|
792
880
|
case 3:
|
793
|
-
newItems = (0, _map["default"])(
|
881
|
+
newItems = (0, _map["default"])(_context9 = (0, _fill["default"])(_context10 = new Array(10)).call(_context10, {
|
794
882
|
key: 'string',
|
795
883
|
name: 'string'
|
796
|
-
})).call(
|
884
|
+
})).call(_context9, function (_, index) {
|
797
885
|
return {
|
798
886
|
name: "name: ".concat(maxNum + index),
|
799
887
|
key: "name: ".concat(maxNum + index),
|
@@ -801,35 +889,35 @@ var OnLoadPrev = function OnLoadPrev() {
|
|
801
889
|
};
|
802
890
|
});
|
803
891
|
setMaxNum(maxNum + 10);
|
804
|
-
setListItems((0, _concat["default"])(
|
892
|
+
setListItems((0, _concat["default"])(_context11 = []).call(_context11, listItems, newItems));
|
805
893
|
setLoadingState(_loadingStates["default"].IDLE);
|
806
894
|
case 7:
|
807
895
|
case "end":
|
808
|
-
return
|
896
|
+
return _context12.stop();
|
809
897
|
}
|
810
|
-
},
|
898
|
+
}, _callee2);
|
811
899
|
}));
|
812
900
|
return function onLoadMore() {
|
813
|
-
return
|
901
|
+
return _ref2.apply(this, arguments);
|
814
902
|
};
|
815
903
|
}();
|
816
904
|
var onLoadPrev = /*#__PURE__*/function () {
|
817
|
-
var
|
818
|
-
var
|
905
|
+
var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
906
|
+
var _context13, _context14, _context15;
|
819
907
|
var newItems;
|
820
|
-
return _regeneratorRuntime().wrap(function
|
821
|
-
while (1) switch (
|
908
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context16) {
|
909
|
+
while (1) switch (_context16.prev = _context16.next) {
|
822
910
|
case 0:
|
823
911
|
setLoadingState(_loadingStates["default"].LOADING_MORE_PREPEND);
|
824
|
-
|
912
|
+
_context16.next = 3;
|
825
913
|
return new _promise["default"](function (resolve) {
|
826
914
|
return (0, _setTimeout2["default"])(resolve, 3000);
|
827
915
|
});
|
828
916
|
case 3:
|
829
|
-
newItems = (0, _map["default"])(
|
917
|
+
newItems = (0, _map["default"])(_context13 = (0, _fill["default"])(_context14 = new Array(10)).call(_context14, {
|
830
918
|
key: 'string',
|
831
919
|
name: 'string'
|
832
|
-
})).call(
|
920
|
+
})).call(_context13, function (_, index) {
|
833
921
|
return {
|
834
922
|
name: "name: ".concat(minNum - (index + 1)),
|
835
923
|
key: "name: ".concat(minNum - (index + 1)),
|
@@ -837,16 +925,16 @@ var OnLoadPrev = function OnLoadPrev() {
|
|
837
925
|
};
|
838
926
|
});
|
839
927
|
setMinNum(minNum - 10);
|
840
|
-
setListItems((0, _concat["default"])(
|
928
|
+
setListItems((0, _concat["default"])(_context15 = []).call(_context15, newItems, listItems));
|
841
929
|
setLoadingState(_loadingStates["default"].IDLE);
|
842
930
|
case 7:
|
843
931
|
case "end":
|
844
|
-
return
|
932
|
+
return _context16.stop();
|
845
933
|
}
|
846
|
-
},
|
934
|
+
}, _callee3);
|
847
935
|
}));
|
848
936
|
return function onLoadPrev() {
|
849
|
-
return
|
937
|
+
return _ref3.apply(this, arguments);
|
850
938
|
};
|
851
939
|
}();
|
852
940
|
return (0, _react2.jsx)(_index.OverlayProvider
|
@@ -136,7 +136,7 @@ var getSectionsComponent = function getSectionsComponent() {
|
|
136
136
|
});
|
137
137
|
})));
|
138
138
|
};
|
139
|
-
var ComponentOnPrevLoad = function ComponentOnPrevLoad() {
|
139
|
+
var ComponentOnPrevLoad = function ComponentOnPrevLoad(props) {
|
140
140
|
var _context, _context2;
|
141
141
|
var initialItems = (0, _map["default"])(_context = (0, _fill["default"])(_context2 = new Array(10)).call(_context2, {
|
142
142
|
key: 'string',
|
@@ -185,12 +185,12 @@ var ComponentOnPrevLoad = function ComponentOnPrevLoad() {
|
|
185
185
|
return _ref5.apply(this, arguments);
|
186
186
|
};
|
187
187
|
}();
|
188
|
-
return (0, _react2.jsx)(_index.OverlayProvider, null, (0, _react2.jsx)(_index.MultivaluesField, {
|
188
|
+
return (0, _react2.jsx)(_index.OverlayProvider, null, (0, _react2.jsx)(_index.MultivaluesField, (0, _extends2["default"])({
|
189
189
|
items: listItems,
|
190
190
|
label: "Field Label",
|
191
191
|
onLoadMore: onLoadMore,
|
192
192
|
onLoadPrev: onLoadPrev
|
193
|
-
}, function (item) {
|
193
|
+
}, props), function (item) {
|
194
194
|
return (0, _react2.jsx)(_index.Item, {
|
195
195
|
key: item.key,
|
196
196
|
"data-id": item.name,
|
@@ -929,6 +929,25 @@ test('in non-restrictive mode the partial string values should be accepted', fun
|
|
929
929
|
expect(input).not.toHaveValue('');
|
930
930
|
expect(input).toHaveValue(value);
|
931
931
|
});
|
932
|
+
test('in condensed mode, onLoadMore and onLoadPrev callbacks are called', function () {
|
933
|
+
(0, _testWrapper.render)((0, _react2.jsx)(ComponentOnPrevLoad, {
|
934
|
+
mode: "condensed"
|
935
|
+
}));
|
936
|
+
_userEvent["default"].tab();
|
937
|
+
var listBox = _testWrapper.screen.getAllByRole('listbox');
|
938
|
+
_testWrapper.fireEvent.scroll(listBox[0], {
|
939
|
+
target: {
|
940
|
+
scrollY: 450
|
941
|
+
}
|
942
|
+
});
|
943
|
+
expect(onLoadMoreFunc).toHaveBeenCalled();
|
944
|
+
_testWrapper.fireEvent.scroll(listBox[0], {
|
945
|
+
target: {
|
946
|
+
scrollY: 0
|
947
|
+
}
|
948
|
+
});
|
949
|
+
expect(onLoadPrevFunc).toHaveBeenCalled();
|
950
|
+
});
|
932
951
|
test('in condensed mode, hasNoSelectAll hides the select all button', function () {
|
933
952
|
getComponent({
|
934
953
|
mode: 'condensed',
|
@@ -1215,7 +1234,7 @@ test('renders with error without key on item groups ', function () {
|
|
1215
1234
|
}
|
1216
1235
|
expect(errorMessage).toMatch(/No key found for item/);
|
1217
1236
|
});
|
1218
|
-
test('
|
1237
|
+
test('onLoadMore and onLoadPrev callbacks are called', function () {
|
1219
1238
|
(0, _testWrapper.render)((0, _react2.jsx)(ComponentOnPrevLoad, null));
|
1220
1239
|
_userEvent["default"].tab();
|
1221
1240
|
var listBox = _testWrapper.screen.getAllByRole('listbox');
|
@@ -9,7 +9,7 @@ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
|
9
9
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
10
10
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
11
11
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
12
|
-
var _excluded = ["defaultSelectedKeys", "direction", "disabledKeys", "containerProps", "hasAutoFocus", "hasNoSelectAll", "hasNoStatusIndicator", "helperText", "inputProps", "isDisabled", "isNotFlippable", "isReadOnly", "isRequired", "items", "label", "mode", "onBlur", "onFocus", "onInputChange", "onKeyDown", "onKeyUp", "onOpenChange", "onSelectionChange", "placeholder", "selectedKeys", "selectedOptionText", "scrollBoxProps", "status"];
|
12
|
+
var _excluded = ["defaultSelectedKeys", "direction", "disabledKeys", "containerProps", "hasAutoFocus", "hasNoSelectAll", "hasNoStatusIndicator", "helperText", "inputProps", "isDisabled", "isNotFlippable", "isReadOnly", "isRequired", "items", "label", "loadingState", "mode", "onBlur", "onFocus", "onInputChange", "onKeyDown", "onKeyUp", "onLoadMore", "onLoadPrev", "onOpenChange", "onSelectionChange", "placeholder", "selectedKeys", "selectedOptionText", "scrollBoxProps", "status"];
|
13
13
|
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; }
|
14
14
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context3, _context4; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context3 = ownKeys(Object(source), !0)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context4 = ownKeys(Object(source))).call(_context4, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
15
15
|
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
@@ -30,6 +30,7 @@ import PropTypes from 'prop-types';
|
|
30
30
|
import { Box, Button, Icon, PopoverContainer, ScrollBox, Text, TextField } from '../..';
|
31
31
|
import { MultivaluesContext } from '../../context/MultivaluesContext';
|
32
32
|
import { usePropWarning } from '../../hooks';
|
33
|
+
import loadingStates from '../../utils/devUtils/constants/loadingStates';
|
33
34
|
import { getPendoID } from '../../utils/devUtils/constants/pendoID';
|
34
35
|
import { isIterableProp } from '../../utils/devUtils/props/isIterable';
|
35
36
|
import { ariaAttributesBasePropTypes } from '../../utils/docUtils/ariaAttributes';
|
@@ -55,12 +56,15 @@ var CondensedMultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
55
56
|
isRequired = props.isRequired,
|
56
57
|
items = props.items,
|
57
58
|
label = props.label,
|
59
|
+
loadingState = props.loadingState,
|
58
60
|
mode = props.mode,
|
59
61
|
_onBlur = props.onBlur,
|
60
62
|
_onFocus = props.onFocus,
|
61
63
|
onInputChange = props.onInputChange,
|
62
64
|
onKeyDown = props.onKeyDown,
|
63
65
|
_onKeyUp = props.onKeyUp,
|
66
|
+
onLoadMore = props.onLoadMore,
|
67
|
+
onLoadPrev = props.onLoadPrev,
|
64
68
|
onOpenChange = props.onOpenChange,
|
65
69
|
onSelectionChange = props.onSelectionChange,
|
66
70
|
placeholder = props.placeholder,
|
@@ -280,6 +284,10 @@ var CondensedMultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
280
284
|
hasAutoFocus: hasAutoFocus,
|
281
285
|
hasNoEmptySelection: true,
|
282
286
|
state: state,
|
287
|
+
onLoadMore: onLoadMore,
|
288
|
+
onLoadPrev: onLoadPrev,
|
289
|
+
loadingState: loadingState,
|
290
|
+
isLoading: loadingState === loadingStates.LOADING_MORE,
|
283
291
|
"aria-label": "List of options",
|
284
292
|
isCondensed: mode === 'condensed'
|
285
293
|
}, overlayProps))), ___EmotionJSX(DismissButton, {
|
@@ -17,14 +17,14 @@ import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerat
|
|
17
17
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
18
18
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
19
19
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
20
|
-
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 _context13; _forEachInstanceProperty(_context13 = ["next", "throw", "return"]).call(_context13, 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 _context14; 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(_context14 = this.tryEntries).call(_context14, 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; }
|
20
|
+
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 _context19; _forEachInstanceProperty(_context19 = ["next", "throw", "return"]).call(_context19, 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 _context20; 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(_context20 = this.tryEntries).call(_context20, resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty(name).call(name, 1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
21
21
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
22
22
|
import _fillInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/fill";
|
23
23
|
import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
|
24
24
|
import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
|
25
25
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
26
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; }
|
27
|
-
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 _context17, _context18; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context17 = ownKeys(Object(source), !0)).call(_context17, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context18 = ownKeys(Object(source))).call(_context18, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
28
28
|
import React, { useState } from 'react';
|
29
29
|
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
30
30
|
import { Box, Icon, Item, MultivaluesField, OverlayProvider, Section } from '../../index';
|
@@ -650,11 +650,98 @@ export var Condensed = function Condensed(args) {
|
|
650
650
|
}, item.name);
|
651
651
|
}));
|
652
652
|
};
|
653
|
-
export var
|
654
|
-
var
|
653
|
+
export var CondensedAsyncLoading = function CondensedAsyncLoading(args) {
|
654
|
+
var _context, _context2;
|
655
|
+
var direction = args.direction;
|
656
|
+
var initialItems = _mapInstanceProperty(_context = _fillInstanceProperty(_context2 = new Array(10)).call(_context2, {
|
657
|
+
key: 'string',
|
658
|
+
name: 'string'
|
659
|
+
})).call(_context, function (_, index) {
|
660
|
+
return {
|
661
|
+
name: "name: ".concat(index),
|
662
|
+
key: "name: ".concat(index),
|
663
|
+
id: index
|
664
|
+
};
|
665
|
+
});
|
666
|
+
var _useState25 = useState(10),
|
655
667
|
_useState26 = _slicedToArray(_useState25, 2),
|
656
|
-
|
657
|
-
|
668
|
+
maxNum = _useState26[0],
|
669
|
+
setMaxNum = _useState26[1];
|
670
|
+
var _useState27 = useState(initialItems),
|
671
|
+
_useState28 = _slicedToArray(_useState27, 2),
|
672
|
+
listItems = _useState28[0],
|
673
|
+
setListItems = _useState28[1];
|
674
|
+
var _useState29 = useState(false),
|
675
|
+
_useState30 = _slicedToArray(_useState29, 2),
|
676
|
+
isOpen = _useState30[0],
|
677
|
+
setIsOpen = _useState30[1];
|
678
|
+
var _useState31 = useState(loadingStates.IDLE),
|
679
|
+
_useState32 = _slicedToArray(_useState31, 2),
|
680
|
+
loadingState = _useState32[0],
|
681
|
+
setLoadingState = _useState32[1];
|
682
|
+
var onOpenChange = function onOpenChange() {
|
683
|
+
setIsOpen(true);
|
684
|
+
};
|
685
|
+
var onLoadMore = /*#__PURE__*/function () {
|
686
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
687
|
+
var _context3, _context4, _context5;
|
688
|
+
var newItems;
|
689
|
+
return _regeneratorRuntime().wrap(function _callee$(_context6) {
|
690
|
+
while (1) switch (_context6.prev = _context6.next) {
|
691
|
+
case 0:
|
692
|
+
setLoadingState(loadingStates.LOADING_MORE);
|
693
|
+
_context6.next = 3;
|
694
|
+
return new _Promise(function (resolve) {
|
695
|
+
return _setTimeout(resolve, 3000);
|
696
|
+
});
|
697
|
+
case 3:
|
698
|
+
newItems = _mapInstanceProperty(_context3 = _fillInstanceProperty(_context4 = new Array(10)).call(_context4, {
|
699
|
+
key: 'string',
|
700
|
+
name: 'string'
|
701
|
+
})).call(_context3, function (_, index) {
|
702
|
+
return {
|
703
|
+
name: "name: ".concat(maxNum + index),
|
704
|
+
key: "name: ".concat(maxNum + index),
|
705
|
+
id: maxNum + index
|
706
|
+
};
|
707
|
+
});
|
708
|
+
setMaxNum(maxNum + 10);
|
709
|
+
setListItems(_concatInstanceProperty(_context5 = []).call(_context5, listItems, newItems));
|
710
|
+
setLoadingState(loadingStates.IDLE);
|
711
|
+
case 7:
|
712
|
+
case "end":
|
713
|
+
return _context6.stop();
|
714
|
+
}
|
715
|
+
}, _callee);
|
716
|
+
}));
|
717
|
+
return function onLoadMore() {
|
718
|
+
return _ref.apply(this, arguments);
|
719
|
+
};
|
720
|
+
}();
|
721
|
+
return ___EmotionJSX(OverlayProvider
|
722
|
+
// note: spacing for demo purpose only so that the select list renders in the right place
|
723
|
+
, {
|
724
|
+
style: setOverlayStyle(direction, isOpen, '25%', '25%', '75%')
|
725
|
+
}, ___EmotionJSX(MultivaluesField, _extends({
|
726
|
+
items: listItems
|
727
|
+
}, args, {
|
728
|
+
mode: "condensed",
|
729
|
+
onOpenChange: onOpenChange,
|
730
|
+
loadingState: loadingState,
|
731
|
+
onLoadMore: onLoadMore
|
732
|
+
}), function (item) {
|
733
|
+
return ___EmotionJSX(Item, {
|
734
|
+
key: item.key,
|
735
|
+
"data-id": item.name,
|
736
|
+
"aria-label": item.name
|
737
|
+
}, item.name);
|
738
|
+
}));
|
739
|
+
};
|
740
|
+
export var CondensedWithSection = function CondensedWithSection(args) {
|
741
|
+
var _useState33 = useState(false),
|
742
|
+
_useState34 = _slicedToArray(_useState33, 2),
|
743
|
+
isOpen = _useState34[0],
|
744
|
+
setIsOpen = _useState34[1];
|
658
745
|
var direction = args.direction;
|
659
746
|
var onOpenChange = function onOpenChange() {
|
660
747
|
setIsOpen(true);
|
@@ -681,14 +768,14 @@ export var CondensedWithSection = function CondensedWithSection(args) {
|
|
681
768
|
}));
|
682
769
|
};
|
683
770
|
export var CondensedWithCustomText = function CondensedWithCustomText(args) {
|
684
|
-
var
|
685
|
-
|
686
|
-
isOpen =
|
687
|
-
setIsOpen =
|
688
|
-
var
|
689
|
-
|
690
|
-
selectedKeys =
|
691
|
-
setSelectedKeys =
|
771
|
+
var _useState35 = useState(false),
|
772
|
+
_useState36 = _slicedToArray(_useState35, 2),
|
773
|
+
isOpen = _useState36[0],
|
774
|
+
setIsOpen = _useState36[1];
|
775
|
+
var _useState37 = useState([]),
|
776
|
+
_useState38 = _slicedToArray(_useState37, 2),
|
777
|
+
selectedKeys = _useState38[0],
|
778
|
+
setSelectedKeys = _useState38[1];
|
692
779
|
var direction = args.direction;
|
693
780
|
var onOpenChange = function onOpenChange() {
|
694
781
|
setIsOpen(true);
|
@@ -719,57 +806,57 @@ export var CondensedWithCustomText = function CondensedWithCustomText(args) {
|
|
719
806
|
}));
|
720
807
|
};
|
721
808
|
export var OnLoadPrev = function OnLoadPrev() {
|
722
|
-
var
|
723
|
-
var initialItems = _mapInstanceProperty(
|
809
|
+
var _context7, _context8;
|
810
|
+
var initialItems = _mapInstanceProperty(_context7 = _fillInstanceProperty(_context8 = new Array(10)).call(_context8, {
|
724
811
|
key: 'string',
|
725
812
|
name: 'string'
|
726
|
-
})).call(
|
813
|
+
})).call(_context7, function (_, index) {
|
727
814
|
return {
|
728
815
|
name: "name: ".concat(index),
|
729
816
|
key: "name: ".concat(index),
|
730
817
|
id: index
|
731
818
|
};
|
732
819
|
});
|
733
|
-
var
|
734
|
-
_useState32 = _slicedToArray(_useState31, 2),
|
735
|
-
minNum = _useState32[0],
|
736
|
-
setMinNum = _useState32[1];
|
737
|
-
var _useState33 = useState(10),
|
738
|
-
_useState34 = _slicedToArray(_useState33, 2),
|
739
|
-
maxNum = _useState34[0],
|
740
|
-
setMaxNum = _useState34[1];
|
741
|
-
var _useState35 = useState(initialItems),
|
742
|
-
_useState36 = _slicedToArray(_useState35, 2),
|
743
|
-
listItems = _useState36[0],
|
744
|
-
setListItems = _useState36[1];
|
745
|
-
var _useState37 = useState(false),
|
746
|
-
_useState38 = _slicedToArray(_useState37, 2),
|
747
|
-
isOpen = _useState38[0],
|
748
|
-
setIsOpen = _useState38[1];
|
749
|
-
var _useState39 = useState(loadingStates.IDLE),
|
820
|
+
var _useState39 = useState(0),
|
750
821
|
_useState40 = _slicedToArray(_useState39, 2),
|
751
|
-
|
752
|
-
|
822
|
+
minNum = _useState40[0],
|
823
|
+
setMinNum = _useState40[1];
|
824
|
+
var _useState41 = useState(10),
|
825
|
+
_useState42 = _slicedToArray(_useState41, 2),
|
826
|
+
maxNum = _useState42[0],
|
827
|
+
setMaxNum = _useState42[1];
|
828
|
+
var _useState43 = useState(initialItems),
|
829
|
+
_useState44 = _slicedToArray(_useState43, 2),
|
830
|
+
listItems = _useState44[0],
|
831
|
+
setListItems = _useState44[1];
|
832
|
+
var _useState45 = useState(false),
|
833
|
+
_useState46 = _slicedToArray(_useState45, 2),
|
834
|
+
isOpen = _useState46[0],
|
835
|
+
setIsOpen = _useState46[1];
|
836
|
+
var _useState47 = useState(loadingStates.IDLE),
|
837
|
+
_useState48 = _slicedToArray(_useState47, 2),
|
838
|
+
loadingState = _useState48[0],
|
839
|
+
setLoadingState = _useState48[1];
|
753
840
|
var onOpenChange = function onOpenChange() {
|
754
841
|
setIsOpen(true);
|
755
842
|
};
|
756
843
|
var onLoadMore = /*#__PURE__*/function () {
|
757
|
-
var
|
758
|
-
var
|
844
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
845
|
+
var _context9, _context10, _context11;
|
759
846
|
var newItems;
|
760
|
-
return _regeneratorRuntime().wrap(function
|
761
|
-
while (1) switch (
|
847
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context12) {
|
848
|
+
while (1) switch (_context12.prev = _context12.next) {
|
762
849
|
case 0:
|
763
850
|
setLoadingState(loadingStates.LOADING_MORE);
|
764
|
-
|
851
|
+
_context12.next = 3;
|
765
852
|
return new _Promise(function (resolve) {
|
766
853
|
return _setTimeout(resolve, 3000);
|
767
854
|
});
|
768
855
|
case 3:
|
769
|
-
newItems = _mapInstanceProperty(
|
856
|
+
newItems = _mapInstanceProperty(_context9 = _fillInstanceProperty(_context10 = new Array(10)).call(_context10, {
|
770
857
|
key: 'string',
|
771
858
|
name: 'string'
|
772
|
-
})).call(
|
859
|
+
})).call(_context9, function (_, index) {
|
773
860
|
return {
|
774
861
|
name: "name: ".concat(maxNum + index),
|
775
862
|
key: "name: ".concat(maxNum + index),
|
@@ -777,35 +864,35 @@ export var OnLoadPrev = function OnLoadPrev() {
|
|
777
864
|
};
|
778
865
|
});
|
779
866
|
setMaxNum(maxNum + 10);
|
780
|
-
setListItems(_concatInstanceProperty(
|
867
|
+
setListItems(_concatInstanceProperty(_context11 = []).call(_context11, listItems, newItems));
|
781
868
|
setLoadingState(loadingStates.IDLE);
|
782
869
|
case 7:
|
783
870
|
case "end":
|
784
|
-
return
|
871
|
+
return _context12.stop();
|
785
872
|
}
|
786
|
-
},
|
873
|
+
}, _callee2);
|
787
874
|
}));
|
788
875
|
return function onLoadMore() {
|
789
|
-
return
|
876
|
+
return _ref2.apply(this, arguments);
|
790
877
|
};
|
791
878
|
}();
|
792
879
|
var onLoadPrev = /*#__PURE__*/function () {
|
793
|
-
var
|
794
|
-
var
|
880
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
881
|
+
var _context13, _context14, _context15;
|
795
882
|
var newItems;
|
796
|
-
return _regeneratorRuntime().wrap(function
|
797
|
-
while (1) switch (
|
883
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context16) {
|
884
|
+
while (1) switch (_context16.prev = _context16.next) {
|
798
885
|
case 0:
|
799
886
|
setLoadingState(loadingStates.LOADING_MORE_PREPEND);
|
800
|
-
|
887
|
+
_context16.next = 3;
|
801
888
|
return new _Promise(function (resolve) {
|
802
889
|
return _setTimeout(resolve, 3000);
|
803
890
|
});
|
804
891
|
case 3:
|
805
|
-
newItems = _mapInstanceProperty(
|
892
|
+
newItems = _mapInstanceProperty(_context13 = _fillInstanceProperty(_context14 = new Array(10)).call(_context14, {
|
806
893
|
key: 'string',
|
807
894
|
name: 'string'
|
808
|
-
})).call(
|
895
|
+
})).call(_context13, function (_, index) {
|
809
896
|
return {
|
810
897
|
name: "name: ".concat(minNum - (index + 1)),
|
811
898
|
key: "name: ".concat(minNum - (index + 1)),
|
@@ -813,16 +900,16 @@ export var OnLoadPrev = function OnLoadPrev() {
|
|
813
900
|
};
|
814
901
|
});
|
815
902
|
setMinNum(minNum - 10);
|
816
|
-
setListItems(_concatInstanceProperty(
|
903
|
+
setListItems(_concatInstanceProperty(_context15 = []).call(_context15, newItems, listItems));
|
817
904
|
setLoadingState(loadingStates.IDLE);
|
818
905
|
case 7:
|
819
906
|
case "end":
|
820
|
-
return
|
907
|
+
return _context16.stop();
|
821
908
|
}
|
822
|
-
},
|
909
|
+
}, _callee3);
|
823
910
|
}));
|
824
911
|
return function onLoadPrev() {
|
825
|
-
return
|
912
|
+
return _ref3.apply(this, arguments);
|
826
913
|
};
|
827
914
|
}();
|
828
915
|
return ___EmotionJSX(OverlayProvider
|
@@ -129,7 +129,7 @@ var getSectionsComponent = function getSectionsComponent() {
|
|
129
129
|
});
|
130
130
|
})));
|
131
131
|
};
|
132
|
-
var ComponentOnPrevLoad = function ComponentOnPrevLoad() {
|
132
|
+
var ComponentOnPrevLoad = function ComponentOnPrevLoad(props) {
|
133
133
|
var _context, _context2;
|
134
134
|
var initialItems = _mapInstanceProperty(_context = _fillInstanceProperty(_context2 = new Array(10)).call(_context2, {
|
135
135
|
key: 'string',
|
@@ -178,12 +178,12 @@ var ComponentOnPrevLoad = function ComponentOnPrevLoad() {
|
|
178
178
|
return _ref5.apply(this, arguments);
|
179
179
|
};
|
180
180
|
}();
|
181
|
-
return ___EmotionJSX(OverlayProvider, null, ___EmotionJSX(MultivaluesField, {
|
181
|
+
return ___EmotionJSX(OverlayProvider, null, ___EmotionJSX(MultivaluesField, _extends({
|
182
182
|
items: listItems,
|
183
183
|
label: "Field Label",
|
184
184
|
onLoadMore: onLoadMore,
|
185
185
|
onLoadPrev: onLoadPrev
|
186
|
-
}, function (item) {
|
186
|
+
}, props), function (item) {
|
187
187
|
return ___EmotionJSX(Item, {
|
188
188
|
key: item.key,
|
189
189
|
"data-id": item.name,
|
@@ -922,6 +922,25 @@ test('in non-restrictive mode the partial string values should be accepted', fun
|
|
922
922
|
expect(input).not.toHaveValue('');
|
923
923
|
expect(input).toHaveValue(value);
|
924
924
|
});
|
925
|
+
test('in condensed mode, onLoadMore and onLoadPrev callbacks are called', function () {
|
926
|
+
render(___EmotionJSX(ComponentOnPrevLoad, {
|
927
|
+
mode: "condensed"
|
928
|
+
}));
|
929
|
+
userEvent.tab();
|
930
|
+
var listBox = screen.getAllByRole('listbox');
|
931
|
+
fireEvent.scroll(listBox[0], {
|
932
|
+
target: {
|
933
|
+
scrollY: 450
|
934
|
+
}
|
935
|
+
});
|
936
|
+
expect(onLoadMoreFunc).toHaveBeenCalled();
|
937
|
+
fireEvent.scroll(listBox[0], {
|
938
|
+
target: {
|
939
|
+
scrollY: 0
|
940
|
+
}
|
941
|
+
});
|
942
|
+
expect(onLoadPrevFunc).toHaveBeenCalled();
|
943
|
+
});
|
925
944
|
test('in condensed mode, hasNoSelectAll hides the select all button', function () {
|
926
945
|
getComponent({
|
927
946
|
mode: 'condensed',
|
@@ -1208,7 +1227,7 @@ test('renders with error without key on item groups ', function () {
|
|
1208
1227
|
}
|
1209
1228
|
expect(errorMessage).toMatch(/No key found for item/);
|
1210
1229
|
});
|
1211
|
-
test('
|
1230
|
+
test('onLoadMore and onLoadPrev callbacks are called', function () {
|
1212
1231
|
render(___EmotionJSX(ComponentOnPrevLoad, null));
|
1213
1232
|
userEvent.tab();
|
1214
1233
|
var listBox = screen.getAllByRole('listbox');
|