@pingux/astro 2.92.0-alpha.0 → 2.92.0-alpha.2
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/CodeView/CodeView.js +6 -3
- package/lib/cjs/components/CodeView/CodeView.stories.js +6 -1
- package/lib/cjs/components/CopyText/CopyButton.d.ts +1 -1
- package/lib/cjs/components/DataTable/DataTable.js +35 -10
- package/lib/cjs/components/DataTable/DataTable.stories.d.ts +32 -0
- package/lib/cjs/components/DataTable/DataTable.stories.js +204 -14
- package/lib/cjs/components/DataTable/DataTable.styles.d.ts +29 -0
- package/lib/cjs/components/DataTable/DataTable.styles.js +17 -0
- package/lib/cjs/components/DataTable/DataTable.test.js +144 -2
- package/lib/cjs/types/codeView.d.ts +2 -0
- package/lib/cjs/types/copyText.d.ts +1 -4
- package/lib/cjs/types/dataTable.d.ts +4 -0
- package/lib/components/CodeView/CodeView.js +6 -3
- package/lib/components/CodeView/CodeView.stories.js +6 -1
- package/lib/components/DataTable/DataTable.js +35 -10
- package/lib/components/DataTable/DataTable.stories.js +201 -13
- package/lib/components/DataTable/DataTable.styles.js +17 -0
- package/lib/components/DataTable/DataTable.test.js +141 -2
- package/package.json +1 -1
@@ -31,7 +31,7 @@ var _useGetTheme = _interopRequireDefault(require("../../hooks/useGetTheme"));
|
|
31
31
|
var _codeView = _interopRequireDefault(require("../../styles/themes/next-gen/codeView/codeView"));
|
32
32
|
var _CodeView = _interopRequireDefault(require("./CodeView.styles"));
|
33
33
|
var _react2 = require("@emotion/react");
|
34
|
-
var _excluded = ["children", "className", "hasLineNumbers", "hasNoCopyButton", "language", "Prism", "stylesProp"];
|
34
|
+
var _excluded = ["children", "className", "hasLineNumbers", "hasNoCopyButton", "language", "Prism", "stylesProp", "iconButtonProps"];
|
35
35
|
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); }
|
36
36
|
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; }
|
37
37
|
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; }
|
@@ -44,6 +44,7 @@ var CodeView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
44
44
|
language = props.language,
|
45
45
|
customPrism = props.Prism,
|
46
46
|
stylesProp = props.stylesProp,
|
47
|
+
iconButtonProps = props.iconButtonProps,
|
47
48
|
others = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
48
49
|
var _useFocusRing = (0, _focus.useFocusRing)(),
|
49
50
|
isFocusVisible = _useFocusRing.isFocusVisible,
|
@@ -126,7 +127,8 @@ var CodeView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
126
127
|
}, language === null || language === void 0 ? void 0 : language.toUpperCase()), (0, _react2.jsx)(_.CopyText, {
|
127
128
|
ref: ref,
|
128
129
|
mode: "rightText",
|
129
|
-
textToCopy: children
|
130
|
+
textToCopy: children,
|
131
|
+
iconButtonProps: iconButtonProps
|
130
132
|
}, "Copy")), content);
|
131
133
|
}
|
132
134
|
if (hasNoCopyButton) {
|
@@ -148,7 +150,8 @@ var CodeView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
148
150
|
wrapperProps: _objectSpread({
|
149
151
|
className: classNames,
|
150
152
|
variant: 'codeView.wrapper'
|
151
|
-
}, others)
|
153
|
+
}, others),
|
154
|
+
iconButtonProps: iconButtonProps
|
152
155
|
}, content);
|
153
156
|
});
|
154
157
|
CodeView.defaultProps = {
|
@@ -7,6 +7,7 @@ _Object$defineProperty(exports, "__esModule", {
|
|
7
7
|
});
|
8
8
|
exports["default"] = exports.WithLineNumbers = exports.WithCustomSize = exports.WithAdditionalLanguage = exports.Default = void 0;
|
9
9
|
var _trim = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/trim"));
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
10
11
|
var _react = _interopRequireDefault(require("react"));
|
11
12
|
var _prismjs = _interopRequireDefault(require("prismjs"));
|
12
13
|
var _storybookAddonDesigns = require("storybook-addon-designs");
|
@@ -59,7 +60,11 @@ var _default = {
|
|
59
60
|
};
|
60
61
|
exports["default"] = _default;
|
61
62
|
var Default = function Default(args) {
|
62
|
-
return (0, _react2.jsx)(_index.CodeView, args
|
63
|
+
return (0, _react2.jsx)(_index.CodeView, (0, _extends2["default"])({}, args, {
|
64
|
+
iconButtonProps: {
|
65
|
+
'data-testid': 'custom_data_id'
|
66
|
+
}
|
67
|
+
}));
|
63
68
|
};
|
64
69
|
exports.Default = Default;
|
65
70
|
Default.parameters = {
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { CopyButtonProps } from '../../types';
|
3
|
-
declare const CopyButton: React.ForwardRefExoticComponent<CopyButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
3
|
+
declare const CopyButton: React.ForwardRefExoticComponent<Omit<CopyButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
4
4
|
export default CopyButton;
|
@@ -16,12 +16,13 @@ _Object$defineProperty(exports, "__esModule", {
|
|
16
16
|
});
|
17
17
|
exports["default"] = void 0;
|
18
18
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
19
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
|
20
19
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
21
20
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
22
21
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
22
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
|
23
23
|
var _react = _interopRequireWildcard(require("react"));
|
24
24
|
var _reactAria = require("react-aria");
|
25
|
+
var _interactions = require("@react-aria/interactions");
|
25
26
|
var _table = require("@react-aria/table");
|
26
27
|
var _virtualizer = require("@react-aria/virtualizer");
|
27
28
|
var _layout = require("@react-stately/layout");
|
@@ -32,9 +33,10 @@ var _useGetTheme2 = _interopRequireDefault(require("../../hooks/useGetTheme"));
|
|
32
33
|
var _index = require("../../index");
|
33
34
|
var _DataTableVirtualizer = _interopRequireDefault(require("./DataTableVirtualizer"));
|
34
35
|
var _react2 = require("@emotion/react");
|
35
|
-
var _excluded = ["
|
36
|
+
var _excluded = ["defaultSelectedKeys", "selectionMode", "selectedKeys"],
|
36
37
|
_excluded2 = ["children"],
|
37
|
-
_excluded3 = ["
|
38
|
+
_excluded3 = ["children"],
|
39
|
+
_excluded4 = ["item", "children", "hasActions"];
|
38
40
|
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); }
|
39
41
|
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; }
|
40
42
|
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; }
|
@@ -63,6 +65,11 @@ var ROW_HEIGHTS = {
|
|
63
65
|
}
|
64
66
|
};
|
65
67
|
var DataTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
68
|
+
var _props$defaultSelecte = props.defaultSelectedKeys,
|
69
|
+
defaultSelectedKeys = _props$defaultSelecte === void 0 ? [] : _props$defaultSelecte,
|
70
|
+
selectionMode = props.selectionMode,
|
71
|
+
selectedKeys = props.selectedKeys,
|
72
|
+
others = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
66
73
|
var direction = 'ltr';
|
67
74
|
var onAction = props.onAction,
|
68
75
|
_props$scale = props.scale,
|
@@ -90,7 +97,14 @@ var DataTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
90
97
|
setIsInResizeMode = _useState2[1];
|
91
98
|
// entering resizing/exiting resizing doesn't trigger a render
|
92
99
|
// with table layout, so we need to track it here
|
93
|
-
|
100
|
+
|
101
|
+
// there appears to be a quirky feature in useTableState where uncontrolled selection
|
102
|
+
// will not work unless the defaultSelectedKeys array is supplied.
|
103
|
+
var state = (0, _table2.useTableState)(_objectSpread(_objectSpread({}, others), {}, {
|
104
|
+
selectionMode: selectionMode,
|
105
|
+
selectedKeys: selectedKeys,
|
106
|
+
defaultSelectedKeys: selectedKeys ? undefined : defaultSelectedKeys
|
107
|
+
}));
|
94
108
|
var domRef = (0, _hooks.useLocalOrForwardRef)(ref);
|
95
109
|
var headerRef = (0, _react.useRef)(null);
|
96
110
|
var bodyRef = (0, _react.useRef)(null);
|
@@ -249,7 +263,7 @@ var DataTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
249
263
|
});
|
250
264
|
var TableHeader = function TableHeader(_ref2) {
|
251
265
|
var children = _ref2.children,
|
252
|
-
otherProps = (0, _objectWithoutProperties2["default"])(_ref2,
|
266
|
+
otherProps = (0, _objectWithoutProperties2["default"])(_ref2, _excluded2);
|
253
267
|
var _useTableRowGroup = (0, _table.useTableRowGroup)(),
|
254
268
|
rowGroupProps = _useTableRowGroup.rowGroupProps;
|
255
269
|
return (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({}, rowGroupProps, otherProps), children);
|
@@ -303,7 +317,7 @@ var TableColumnHeader = function TableColumnHeader(props) {
|
|
303
317
|
};
|
304
318
|
var TableRowGroup = function TableRowGroup(_ref3) {
|
305
319
|
var children = _ref3.children,
|
306
|
-
otherProps = (0, _objectWithoutProperties2["default"])(_ref3,
|
320
|
+
otherProps = (0, _objectWithoutProperties2["default"])(_ref3, _excluded3);
|
307
321
|
var _useTableRowGroup2 = (0, _table.useTableRowGroup)(),
|
308
322
|
rowGroupProps = _useTableRowGroup2.rowGroupProps;
|
309
323
|
return (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({}, rowGroupProps, otherProps), children);
|
@@ -312,7 +326,7 @@ var TableRow = function TableRow(_ref4) {
|
|
312
326
|
var item = _ref4.item,
|
313
327
|
children = _ref4.children,
|
314
328
|
hasActions = _ref4.hasActions,
|
315
|
-
otherProps = (0, _objectWithoutProperties2["default"])(_ref4,
|
329
|
+
otherProps = (0, _objectWithoutProperties2["default"])(_ref4, _excluded4);
|
316
330
|
var ref = (0, _react.useRef)(null);
|
317
331
|
var _useDataTableContext2 = (0, _DataTableContext.useDataTableContext)(),
|
318
332
|
state = _useDataTableContext2.state;
|
@@ -321,6 +335,9 @@ var TableRow = function TableRow(_ref4) {
|
|
321
335
|
isVirtualized: true
|
322
336
|
}, state, ref),
|
323
337
|
rowProps = _useTableRow.rowProps;
|
338
|
+
var isSelectable = state.selectionManager.selectionMode !== 'none';
|
339
|
+
var isSelected = state.selectionManager.isSelected(item.key);
|
340
|
+
var isDisabled = state.disabledKeys.has(item.key);
|
324
341
|
var _useFocusRing2 = (0, _reactAria.useFocusRing)({
|
325
342
|
within: true
|
326
343
|
}),
|
@@ -329,14 +346,22 @@ var TableRow = function TableRow(_ref4) {
|
|
329
346
|
var _useFocusRing3 = (0, _reactAria.useFocusRing)(),
|
330
347
|
isFocusVisible = _useFocusRing3.isFocusVisible,
|
331
348
|
focusProps = _useFocusRing3.focusProps;
|
332
|
-
var
|
349
|
+
var _useHover = (0, _interactions.useHover)({}),
|
350
|
+
hoverProps = _useHover.hoverProps,
|
351
|
+
isHovered = _useHover.isHovered;
|
352
|
+
var props = (0, _reactAria.mergeProps)(otherProps, focusWithinProps, focusProps, rowProps, hoverProps);
|
333
353
|
var _useStatusClasses3 = (0, _hooks.useStatusClasses)('', {
|
334
|
-
'is-row-focus-visible': isFocusVisible || isFocusVisibleWithin
|
354
|
+
'is-row-focus-visible': isFocusVisible || isFocusVisibleWithin,
|
355
|
+
isSelectable: isSelectable,
|
356
|
+
isSelected: isSelected,
|
357
|
+
isHovered: isHovered,
|
358
|
+
isDisabled: isDisabled
|
335
359
|
}),
|
336
360
|
classNames = _useStatusClasses3.classNames;
|
361
|
+
var variant = isSelectable ? 'dataTable.selectableTableRow' : 'dataTable.tableRow';
|
337
362
|
return (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({}, props, {
|
338
363
|
ref: ref,
|
339
|
-
variant:
|
364
|
+
variant: variant,
|
340
365
|
className: classNames
|
341
366
|
}), children);
|
342
367
|
};
|
@@ -93,6 +93,36 @@ declare const _default: {
|
|
93
93
|
disable: boolean;
|
94
94
|
};
|
95
95
|
};
|
96
|
+
selectedKeys: {
|
97
|
+
description: string;
|
98
|
+
control: {
|
99
|
+
disable: boolean;
|
100
|
+
};
|
101
|
+
};
|
102
|
+
disabledKeys: {
|
103
|
+
description: string;
|
104
|
+
control: {
|
105
|
+
disable: boolean;
|
106
|
+
};
|
107
|
+
};
|
108
|
+
defaultSelectedKeys: {
|
109
|
+
description: string;
|
110
|
+
control: {
|
111
|
+
disable: boolean;
|
112
|
+
};
|
113
|
+
};
|
114
|
+
onSelectionChange: {
|
115
|
+
description: string;
|
116
|
+
control: {
|
117
|
+
disable: boolean;
|
118
|
+
};
|
119
|
+
};
|
120
|
+
selectionMode: {
|
121
|
+
description: string;
|
122
|
+
control: {
|
123
|
+
disable: boolean;
|
124
|
+
};
|
125
|
+
};
|
96
126
|
width: {
|
97
127
|
description: string;
|
98
128
|
control: {
|
@@ -187,6 +217,8 @@ export declare const Sortable: {
|
|
187
217
|
};
|
188
218
|
};
|
189
219
|
};
|
220
|
+
export declare const Selection: (args: any) => React.JSX.Element;
|
221
|
+
export declare const ControlledSelection: (args: any) => React.JSX.Element;
|
190
222
|
export declare const AsyncLoading: {
|
191
223
|
(args: any): React.JSX.Element;
|
192
224
|
parameters: {
|
@@ -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.Sortable = exports.Dynamic = exports.Default = exports.AsyncLoading = void 0;
|
24
|
+
exports["default"] = exports.Sortable = exports.Selection = exports.Dynamic = exports.Default = exports.ControlledSelection = exports.AsyncLoading = void 0;
|
25
25
|
var _isNan = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/number/is-nan"));
|
26
26
|
var _parseFloat2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/parse-float"));
|
27
27
|
var _sort = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/sort"));
|
@@ -42,9 +42,9 @@ var _DataTable = _interopRequireDefault(require("./DataTable.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 _context7; _forEachInstanceProperty(_context7 = ["next", "throw", "return"]).call(_context7, function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], _forEachInstanceProperty(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return _Object$setPrototypeOf ? _Object$setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = _Object$create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = _Promise2); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return _reverseInstanceProperty(keys).call(keys), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { var _context8; if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty(_context8 = this.tryEntries).call(_context8, resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty(name).call(name, 1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
45
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = _Object$defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof _Symbol ? _Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return _Object$defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = _Object$create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = _Object$getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = _Object$create(IteratorPrototype); function defineIteratorMethods(prototype) { var _context8; _forEachInstanceProperty(_context8 = ["next", "throw", "return"]).call(_context8, function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], _forEachInstanceProperty(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return _Object$setPrototypeOf ? _Object$setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = _Object$create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = _Promise2); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return _reverseInstanceProperty(keys).call(keys), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { var _context9; if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty(_context9 = this.tryEntries).call(_context9, resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty(name).call(name, 1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
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 _context6, _context7; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context6 = ownKeys(Object(source), !0)).call(_context6, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context7 = ownKeys(Object(source))).call(_context7, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
48
48
|
var _default = {
|
49
49
|
title: 'Components/DataTable',
|
50
50
|
component: _index.DataTable,
|
@@ -69,6 +69,36 @@ var _default = {
|
|
69
69
|
disable: true
|
70
70
|
}
|
71
71
|
},
|
72
|
+
selectedKeys: {
|
73
|
+
description: 'The array of keys that is currently selected. (Controlled version).',
|
74
|
+
control: {
|
75
|
+
disable: true
|
76
|
+
}
|
77
|
+
},
|
78
|
+
disabledKeys: {
|
79
|
+
description: 'The array of keys that are unabled to be selected.',
|
80
|
+
control: {
|
81
|
+
disable: true
|
82
|
+
}
|
83
|
+
},
|
84
|
+
defaultSelectedKeys: {
|
85
|
+
description: 'The array of keys that is selected by default. (Uncontrolled version).',
|
86
|
+
control: {
|
87
|
+
disable: true
|
88
|
+
}
|
89
|
+
},
|
90
|
+
onSelectionChange: {
|
91
|
+
description: 'A callback function that fires when the selection changes.',
|
92
|
+
control: {
|
93
|
+
disable: true
|
94
|
+
}
|
95
|
+
},
|
96
|
+
selectionMode: {
|
97
|
+
description: 'Options are "none" and "single". Whether or not the DataTable support selection',
|
98
|
+
control: {
|
99
|
+
disable: true
|
100
|
+
}
|
101
|
+
},
|
72
102
|
width: {
|
73
103
|
description: 'Sets the width of the data table.',
|
74
104
|
control: {
|
@@ -485,6 +515,166 @@ Sortable.parameters = {
|
|
485
515
|
}
|
486
516
|
}
|
487
517
|
};
|
518
|
+
var Selection = function Selection(args) {
|
519
|
+
var columns = [{
|
520
|
+
name: 'Country',
|
521
|
+
key: 'country'
|
522
|
+
}, {
|
523
|
+
name: 'Population',
|
524
|
+
key: 'population'
|
525
|
+
}, {
|
526
|
+
name: 'Continent',
|
527
|
+
key: 'continent'
|
528
|
+
}];
|
529
|
+
var rows = [{
|
530
|
+
id: 1,
|
531
|
+
country: 'USA',
|
532
|
+
population: '320,000,000',
|
533
|
+
continent: 'North America'
|
534
|
+
}, {
|
535
|
+
id: 2,
|
536
|
+
country: 'Canada',
|
537
|
+
population: '37,000,000',
|
538
|
+
continent: 'North America'
|
539
|
+
}, {
|
540
|
+
id: 3,
|
541
|
+
country: 'China',
|
542
|
+
population: '1,398,000,000',
|
543
|
+
continent: 'Asia'
|
544
|
+
}, {
|
545
|
+
id: 4,
|
546
|
+
country: 'France',
|
547
|
+
population: '67,000,000',
|
548
|
+
continent: 'Europe'
|
549
|
+
}, {
|
550
|
+
id: 5,
|
551
|
+
country: 'Mexico',
|
552
|
+
population: '126,000,000',
|
553
|
+
continent: 'South America'
|
554
|
+
}, {
|
555
|
+
id: 6,
|
556
|
+
country: 'Ethiopia',
|
557
|
+
population: '120,000,000',
|
558
|
+
continent: 'Africa'
|
559
|
+
}, {
|
560
|
+
id: 7,
|
561
|
+
country: 'Austria',
|
562
|
+
population: '25,000,000',
|
563
|
+
continent: 'Oceania'
|
564
|
+
}];
|
565
|
+
return (0, _react2.jsx)(_index.DataTable, (0, _extends2["default"])({}, args, {
|
566
|
+
"aria-label": "Dynamic table",
|
567
|
+
density: "compact",
|
568
|
+
scale: "medium",
|
569
|
+
selectionMode: "single",
|
570
|
+
disabledKeys: [3],
|
571
|
+
defaultSelectedKeys: [1]
|
572
|
+
}), (0, _react2.jsx)(_index.DataTableHeader, {
|
573
|
+
columns: columns
|
574
|
+
}, function (column) {
|
575
|
+
return (0, _react2.jsx)(_index.DataTableColumn, (0, _extends2["default"])({}, getCellProps(column.key, 'center'), {
|
576
|
+
minWidth: 155
|
577
|
+
}), column.name);
|
578
|
+
}), (0, _react2.jsx)(_index.DataTableBody, {
|
579
|
+
items: rows
|
580
|
+
}, function (item) {
|
581
|
+
return (0, _react2.jsx)(_index.DataTableRow, null, function (columnKey) {
|
582
|
+
return (0, _react2.jsx)(_index.DataTableCell, getCellProps(columnKey, 'left'), item[columnKey]);
|
583
|
+
});
|
584
|
+
}));
|
585
|
+
};
|
586
|
+
exports.Selection = Selection;
|
587
|
+
var ControlledSelection = function ControlledSelection(args) {
|
588
|
+
var _useState3 = (0, _react.useState)([2]),
|
589
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
590
|
+
selectedKeys = _useState4[0],
|
591
|
+
setSelectedKeys = _useState4[1];
|
592
|
+
var columns = [{
|
593
|
+
name: 'Country',
|
594
|
+
key: 'country'
|
595
|
+
}, {
|
596
|
+
name: 'Population',
|
597
|
+
key: 'population'
|
598
|
+
}, {
|
599
|
+
name: 'Continent',
|
600
|
+
key: 'continent'
|
601
|
+
}];
|
602
|
+
var rows = [{
|
603
|
+
id: 1,
|
604
|
+
country: 'USA',
|
605
|
+
population: '320,000,000',
|
606
|
+
continent: 'North America'
|
607
|
+
}, {
|
608
|
+
id: 2,
|
609
|
+
country: 'Canada',
|
610
|
+
population: '37,000,000',
|
611
|
+
continent: 'North America'
|
612
|
+
}, {
|
613
|
+
id: 3,
|
614
|
+
country: 'China',
|
615
|
+
population: '1,398,000,000',
|
616
|
+
continent: 'Asia'
|
617
|
+
}, {
|
618
|
+
id: 4,
|
619
|
+
country: 'France',
|
620
|
+
population: '67,000,000',
|
621
|
+
continent: 'Europe'
|
622
|
+
}, {
|
623
|
+
id: 5,
|
624
|
+
country: 'Mexico',
|
625
|
+
population: '126,000,000',
|
626
|
+
continent: 'South America'
|
627
|
+
}, {
|
628
|
+
id: 6,
|
629
|
+
country: 'Ethiopia',
|
630
|
+
population: '120,000,000',
|
631
|
+
continent: 'Africa'
|
632
|
+
}, {
|
633
|
+
id: 7,
|
634
|
+
country: 'Austria',
|
635
|
+
population: '25,000,000',
|
636
|
+
continent: 'Oceania'
|
637
|
+
}];
|
638
|
+
var list = (0, _reactStately.useAsyncList)({
|
639
|
+
load: function load() {
|
640
|
+
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
641
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
642
|
+
while (1) switch (_context4.prev = _context4.next) {
|
643
|
+
case 0:
|
644
|
+
return _context4.abrupt("return", {
|
645
|
+
items: rows
|
646
|
+
});
|
647
|
+
case 1:
|
648
|
+
case "end":
|
649
|
+
return _context4.stop();
|
650
|
+
}
|
651
|
+
}, _callee4);
|
652
|
+
}))();
|
653
|
+
}
|
654
|
+
});
|
655
|
+
return (0, _react2.jsx)(_index.DataTable, (0, _extends2["default"])({}, args, {
|
656
|
+
"aria-label": "Dynamic table",
|
657
|
+
density: "compact",
|
658
|
+
scale: "medium",
|
659
|
+
selectionMode: "single",
|
660
|
+
disabledKeys: [3],
|
661
|
+
selectedKeys: selectedKeys,
|
662
|
+
onSelectionChange: setSelectedKeys
|
663
|
+
}), (0, _react2.jsx)(_index.DataTableHeader, {
|
664
|
+
columns: columns
|
665
|
+
}, function (column) {
|
666
|
+
return (0, _react2.jsx)(_index.DataTableColumn, (0, _extends2["default"])({}, getCellProps(column.key, 'center'), {
|
667
|
+
minWidth: 155
|
668
|
+
}), column.name);
|
669
|
+
}), (0, _react2.jsx)(_index.DataTableBody, {
|
670
|
+
items: list.items
|
671
|
+
}, function (item) {
|
672
|
+
return (0, _react2.jsx)(_index.DataTableRow, null, function (columnKey) {
|
673
|
+
return (0, _react2.jsx)(_index.DataTableCell, getCellProps(columnKey, 'left'), item[columnKey]);
|
674
|
+
});
|
675
|
+
}));
|
676
|
+
};
|
677
|
+
exports.ControlledSelection = ControlledSelection;
|
488
678
|
var AsyncLoading = function AsyncLoading(args) {
|
489
679
|
/**
|
490
680
|
* isChromatic checks if the code is running in Chromatic environment
|
@@ -507,40 +697,40 @@ var AsyncLoading = function AsyncLoading(args) {
|
|
507
697
|
}];
|
508
698
|
var list = (0, _reactStately.useAsyncList)({
|
509
699
|
load: function load(_ref2) {
|
510
|
-
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function
|
700
|
+
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
511
701
|
var signal, cursor, res, json;
|
512
|
-
return _regeneratorRuntime().wrap(function
|
513
|
-
while (1) switch (
|
702
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
703
|
+
while (1) switch (_context5.prev = _context5.next) {
|
514
704
|
case 0:
|
515
705
|
signal = _ref2.signal, cursor = _ref2.cursor;
|
516
706
|
if (cursor) {
|
517
707
|
// eslint-disable-next-line no-param-reassign
|
518
708
|
cursor = cursor.replace(/^http:\/\//i, 'https://');
|
519
709
|
}
|
520
|
-
|
710
|
+
_context5.next = 4;
|
521
711
|
return fetch(cursor || 'https://swapi.py4e.com/api/people/?search=', {
|
522
712
|
signal: signal
|
523
713
|
});
|
524
714
|
case 4:
|
525
|
-
res =
|
526
|
-
|
715
|
+
res = _context5.sent;
|
716
|
+
_context5.next = 7;
|
527
717
|
return res.json();
|
528
718
|
case 7:
|
529
|
-
json =
|
530
|
-
|
719
|
+
json = _context5.sent;
|
720
|
+
_context5.next = 10;
|
531
721
|
return new _promise["default"](function (resolve) {
|
532
722
|
return (0, _setTimeout2["default"])(resolve, cursor ? 2000 : 3000);
|
533
723
|
});
|
534
724
|
case 10:
|
535
|
-
return
|
725
|
+
return _context5.abrupt("return", {
|
536
726
|
items: json.results,
|
537
727
|
cursor: json.next
|
538
728
|
});
|
539
729
|
case 11:
|
540
730
|
case "end":
|
541
|
-
return
|
731
|
+
return _context5.stop();
|
542
732
|
}
|
543
|
-
},
|
733
|
+
}, _callee5);
|
544
734
|
}))();
|
545
735
|
}
|
546
736
|
});
|
@@ -1,4 +1,33 @@
|
|
1
1
|
declare const _default: {
|
2
|
+
selectableTableRow: {
|
3
|
+
bg: string;
|
4
|
+
'&.is-selected': {
|
5
|
+
bg: string;
|
6
|
+
};
|
7
|
+
'&.is-hovered': {
|
8
|
+
bg: string;
|
9
|
+
cursor: string;
|
10
|
+
};
|
11
|
+
'&.is-focused': {
|
12
|
+
boxShadow: string;
|
13
|
+
};
|
14
|
+
'&.is-disabled': {
|
15
|
+
opacity: string;
|
16
|
+
};
|
17
|
+
position: string;
|
18
|
+
cursor: string;
|
19
|
+
borderBottom: string;
|
20
|
+
outline: string;
|
21
|
+
borderBottomStyle: string;
|
22
|
+
borderBottomColor: string;
|
23
|
+
'&.is-row-focus-visible': {
|
24
|
+
border: string;
|
25
|
+
borderColor: string;
|
26
|
+
borderBottom: string;
|
27
|
+
borderBottomColor: string;
|
28
|
+
backgroundColor: string;
|
29
|
+
};
|
30
|
+
};
|
2
31
|
tableBody: {
|
3
32
|
position: string;
|
4
33
|
overflow: string;
|
@@ -68,6 +68,22 @@ var tableRow = {
|
|
68
68
|
backgroundColor: 'white'
|
69
69
|
}
|
70
70
|
};
|
71
|
+
var selectableTableRow = _objectSpread(_objectSpread({}, tableRow), {}, {
|
72
|
+
bg: 'accent.99',
|
73
|
+
'&.is-selected': {
|
74
|
+
bg: 'white'
|
75
|
+
},
|
76
|
+
'&.is-hovered': {
|
77
|
+
bg: 'white',
|
78
|
+
cursor: 'pointer'
|
79
|
+
},
|
80
|
+
'&.is-focused': {
|
81
|
+
boxShadow: '0 0 0 1px inset #D033FF'
|
82
|
+
},
|
83
|
+
'&.is-disabled': {
|
84
|
+
opacity: '0.5 !important'
|
85
|
+
}
|
86
|
+
});
|
71
87
|
var tableHeadWrapper = {
|
72
88
|
borderLeftWidth: '0px',
|
73
89
|
borderLeftStyle: 'solid',
|
@@ -144,6 +160,7 @@ var tableMenu = {
|
|
144
160
|
mr: 'md'
|
145
161
|
};
|
146
162
|
var _default = {
|
163
|
+
selectableTableRow: selectableTableRow,
|
147
164
|
tableBody: tableBody,
|
148
165
|
tableHeadWrapper: tableHeadWrapper,
|
149
166
|
tableCenteredWrapper: tableCenteredWrapper,
|