@gravity-ui/querieskit 1.3.2 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/components/LazyList/LazyList.js +12 -1
- package/build/cjs/components/LazyList/LazyList.js.map +1 -1
- package/build/cjs/components/RowLink/RowLink.d.ts +4 -4
- package/build/cjs/components/RowLink/RowLink.js +15 -4
- package/build/cjs/components/RowLink/RowLink.js.map +1 -1
- package/build/cjs/components/SearchRowLayout/SearchRowLayout.d.ts +2 -0
- package/build/cjs/components/SearchRowLayout/SearchRowLayout.js +2 -0
- package/build/cjs/components/SearchRowLayout/SearchRowLayout.js.map +1 -1
- package/build/cjs/helpers/getListKey.d.ts +1 -0
- package/build/cjs/helpers/getListKey.js +5 -4
- package/build/cjs/helpers/getListKey.js.map +1 -1
- package/build/cjs/helpers/useListKey.d.ts +2 -0
- package/build/cjs/helpers/useListKey.js +32 -0
- package/build/cjs/helpers/useListKey.js.map +1 -0
- package/build/cjs/helpers/useLoadMoreSentinel.d.ts +1 -1
- package/build/cjs/helpers/useLoadMoreSentinel.js +12 -3
- package/build/cjs/helpers/useLoadMoreSentinel.js.map +1 -1
- package/build/cjs/modules/HistoryHeader/HistoryHeader.d.ts +1 -0
- package/build/cjs/modules/HistoryHeader/HistoryHeader.js +8 -6
- package/build/cjs/modules/HistoryHeader/HistoryHeader.js.map +1 -1
- package/build/cjs/modules/HistoryRow/HistoryRow.d.ts +1 -1
- package/build/cjs/modules/HistoryRow/HistoryRow.js +3 -1
- package/build/cjs/modules/HistoryRow/HistoryRow.js.map +1 -1
- package/build/cjs/modules/HistorySearchRow/HistorySearchRow.d.ts +1 -1
- package/build/cjs/modules/HistorySearchRow/HistorySearchRow.js +3 -1
- package/build/cjs/modules/HistorySearchRow/HistorySearchRow.js.map +1 -1
- package/build/cjs/modules/QueriesList/QueriesList.d.ts +6 -2
- package/build/cjs/modules/QueriesList/QueriesList.js +14 -3
- package/build/cjs/modules/QueriesList/QueriesList.js.map +1 -1
- package/build/cjs/modules/RowsList/RowsList.d.ts +6 -2
- package/build/cjs/modules/RowsList/RowsList.js +13 -7
- package/build/cjs/modules/RowsList/RowsList.js.map +1 -1
- package/build/cjs/modules/RowsList/helpers/prepareRowData.d.ts +3 -2
- package/build/cjs/modules/RowsList/helpers/prepareRowData.js +4 -2
- package/build/cjs/modules/RowsList/helpers/prepareRowData.js.map +1 -1
- package/build/cjs/types/queryList.d.ts +4 -1
- package/build/cjs/types/queryList.js.map +1 -1
- package/build/cjs/widgets/QueriesHistory/QueriesHistory.d.ts +6 -2
- package/build/cjs/widgets/QueriesHistory/QueriesHistory.js +9 -1
- package/build/cjs/widgets/QueriesHistory/QueriesHistory.js.map +1 -1
- package/build/cjs/widgets/QueriesHistory/QueriesHistory.stories.d.ts +5 -0
- package/build/cjs/widgets/QueriesHistory/QueriesHistory.stories.js +200 -6
- package/build/cjs/widgets/QueriesHistory/QueriesHistory.stories.js.map +1 -1
- package/build/cjs/widgets/TutorialsHistory/TutorialsHistory.js +3 -1
- package/build/cjs/widgets/TutorialsHistory/TutorialsHistory.js.map +1 -1
- package/build/esm/components/LazyList/LazyList.js +13 -2
- package/build/esm/components/LazyList/LazyList.js.map +1 -1
- package/build/esm/components/RowLink/RowLink.d.ts +4 -4
- package/build/esm/components/RowLink/RowLink.js +15 -4
- package/build/esm/components/RowLink/RowLink.js.map +1 -1
- package/build/esm/components/SearchRowLayout/SearchRowLayout.d.ts +2 -0
- package/build/esm/components/SearchRowLayout/SearchRowLayout.js +2 -0
- package/build/esm/components/SearchRowLayout/SearchRowLayout.js.map +1 -1
- package/build/esm/helpers/getListKey.d.ts +1 -0
- package/build/esm/helpers/getListKey.js +4 -3
- package/build/esm/helpers/getListKey.js.map +1 -1
- package/build/esm/helpers/useListKey.d.ts +2 -0
- package/build/esm/helpers/useListKey.js +26 -0
- package/build/esm/helpers/useListKey.js.map +1 -0
- package/build/esm/helpers/useLoadMoreSentinel.d.ts +1 -1
- package/build/esm/helpers/useLoadMoreSentinel.js +12 -3
- package/build/esm/helpers/useLoadMoreSentinel.js.map +1 -1
- package/build/esm/modules/HistoryHeader/HistoryHeader.d.ts +1 -0
- package/build/esm/modules/HistoryHeader/HistoryHeader.js +8 -6
- package/build/esm/modules/HistoryHeader/HistoryHeader.js.map +1 -1
- package/build/esm/modules/HistoryRow/HistoryRow.d.ts +1 -1
- package/build/esm/modules/HistoryRow/HistoryRow.js +3 -1
- package/build/esm/modules/HistoryRow/HistoryRow.js.map +1 -1
- package/build/esm/modules/HistorySearchRow/HistorySearchRow.d.ts +1 -1
- package/build/esm/modules/HistorySearchRow/HistorySearchRow.js +3 -1
- package/build/esm/modules/HistorySearchRow/HistorySearchRow.js.map +1 -1
- package/build/esm/modules/QueriesList/QueriesList.d.ts +6 -2
- package/build/esm/modules/QueriesList/QueriesList.js +14 -3
- package/build/esm/modules/QueriesList/QueriesList.js.map +1 -1
- package/build/esm/modules/RowsList/RowsList.d.ts +6 -2
- package/build/esm/modules/RowsList/RowsList.js +13 -7
- package/build/esm/modules/RowsList/RowsList.js.map +1 -1
- package/build/esm/modules/RowsList/helpers/prepareRowData.d.ts +3 -2
- package/build/esm/modules/RowsList/helpers/prepareRowData.js +4 -2
- package/build/esm/modules/RowsList/helpers/prepareRowData.js.map +1 -1
- package/build/esm/types/queryList.d.ts +4 -1
- package/build/esm/types/queryList.js.map +1 -1
- package/build/esm/widgets/QueriesHistory/QueriesHistory.d.ts +6 -2
- package/build/esm/widgets/QueriesHistory/QueriesHistory.js +9 -1
- package/build/esm/widgets/QueriesHistory/QueriesHistory.js.map +1 -1
- package/build/esm/widgets/QueriesHistory/QueriesHistory.stories.d.ts +5 -0
- package/build/esm/widgets/QueriesHistory/QueriesHistory.stories.js +200 -6
- package/build/esm/widgets/QueriesHistory/QueriesHistory.stories.js.map +1 -1
- package/build/esm/widgets/TutorialsHistory/TutorialsHistory.js +3 -1
- package/build/esm/widgets/TutorialsHistory/TutorialsHistory.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,27 +3,32 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = exports.WithHeader = exports.Empty = exports.Default = void 0;
|
|
7
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
6
|
+
exports.default = exports.WithHeader = exports.RouterLinks = exports.Paginated = exports.InitialLoading = exports.FullSearchUnavailable = exports.Empty = exports.Default = exports.CustomRowRenderer = void 0;
|
|
8
7
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
10
11
|
require("core-js/modules/es.array.concat.js");
|
|
11
12
|
require("core-js/modules/es.array.filter.js");
|
|
12
13
|
require("core-js/modules/es.array.find-index.js");
|
|
13
14
|
require("core-js/modules/es.array.includes.js");
|
|
15
|
+
require("core-js/modules/es.array.map.js");
|
|
14
16
|
require("core-js/modules/es.array.slice.js");
|
|
15
17
|
require("core-js/modules/es.date.now.js");
|
|
16
18
|
require("core-js/modules/es.iterator.constructor.js");
|
|
17
19
|
require("core-js/modules/es.iterator.filter.js");
|
|
18
20
|
require("core-js/modules/es.object.to-string.js");
|
|
19
21
|
require("core-js/modules/es.string.includes.js");
|
|
22
|
+
require("core-js/modules/web.timers.js");
|
|
20
23
|
var _react = _interopRequireWildcard(require("react"));
|
|
21
24
|
var _uikit = require("@gravity-ui/uikit");
|
|
25
|
+
var _components = require("../../components");
|
|
22
26
|
var _QueriesHistory = require("./QueriesHistory");
|
|
23
27
|
var _actions = require("storybook/actions");
|
|
24
28
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
29
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
26
30
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
31
|
+
var _excluded = ["onClick"];
|
|
27
32
|
var now = Date.now();
|
|
28
33
|
var min = 60 * 1000;
|
|
29
34
|
var QUERY = "use test;\n\nSELECT\n \"test_session\" AS session_id,\n \"test_task\" AS task_id,\n SUBSTRING(\"test\", 1, 1) AS truncated_char";
|
|
@@ -109,6 +114,12 @@ var BASE_ITEMS = [{
|
|
|
109
114
|
query: QUERY,
|
|
110
115
|
height: 52
|
|
111
116
|
}];
|
|
117
|
+
var LINK_ITEMS = BASE_ITEMS.map(function (item) {
|
|
118
|
+
return 'id' in item ? (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
|
|
119
|
+
href: "/queries/".concat(item.id)
|
|
120
|
+
}) : item;
|
|
121
|
+
});
|
|
122
|
+
var PAGINATION_PAGES = [LINK_ITEMS.slice(0, 3), LINK_ITEMS.slice(3, 6), LINK_ITEMS.slice(6)];
|
|
112
123
|
var activeFields = ['duration', 'mode', 'startTime', 'engine', 'isPrivate'];
|
|
113
124
|
var fields = [{
|
|
114
125
|
id: 'duration',
|
|
@@ -150,6 +161,21 @@ var filterFields = [{
|
|
|
150
161
|
}];
|
|
151
162
|
var logFilterApply = (0, _actions.action)('onFilterApply');
|
|
152
163
|
var logFilterReset = (0, _actions.action)('onFilterReset');
|
|
164
|
+
var renderRouterLink = function renderRouterLink(_ref) {
|
|
165
|
+
var _onClick = _ref.onClick,
|
|
166
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
167
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("a", (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
|
|
168
|
+
"data-router-link": true,
|
|
169
|
+
onClick: function onClick(event) {
|
|
170
|
+
_onClick === null || _onClick === void 0 || _onClick(event);
|
|
171
|
+
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
event.preventDefault();
|
|
175
|
+
(0, _actions.action)('routerNavigate')(props.href);
|
|
176
|
+
}
|
|
177
|
+
}));
|
|
178
|
+
};
|
|
153
179
|
var meta = {
|
|
154
180
|
title: 'Widgets/QueriesHistory',
|
|
155
181
|
component: _QueriesHistory.QueriesHistory,
|
|
@@ -167,7 +193,7 @@ var operationFilterOptions = [{
|
|
|
167
193
|
}];
|
|
168
194
|
var _default = exports.default = meta;
|
|
169
195
|
var DefaultStory = function DefaultStory() {
|
|
170
|
-
var _useState = (0, _react.useState)(
|
|
196
|
+
var _useState = (0, _react.useState)((0, _toConsumableArray2.default)(LINK_ITEMS)),
|
|
171
197
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
172
198
|
items = _useState2[0],
|
|
173
199
|
setItems = _useState2[1];
|
|
@@ -226,10 +252,10 @@ var DefaultStory = function DefaultStory() {
|
|
|
226
252
|
var handleOnSearch = function handleOnSearch(data) {
|
|
227
253
|
setSearch(data);
|
|
228
254
|
if (!data.value) {
|
|
229
|
-
setItems(
|
|
255
|
+
setItems(LINK_ITEMS);
|
|
230
256
|
return;
|
|
231
257
|
}
|
|
232
|
-
var newItems =
|
|
258
|
+
var newItems = LINK_ITEMS.filter(function (item) {
|
|
233
259
|
var _item$query;
|
|
234
260
|
if (!('id' in item)) return false;
|
|
235
261
|
var title = item.title.toLowerCase();
|
|
@@ -291,7 +317,8 @@ var DefaultStory = function DefaultStory() {
|
|
|
291
317
|
rowId: editingId,
|
|
292
318
|
onSubmit: handleEditSubmit,
|
|
293
319
|
onCancel: handleEditCancel
|
|
294
|
-
}
|
|
320
|
+
},
|
|
321
|
+
renderLink: renderRouterLink
|
|
295
322
|
})
|
|
296
323
|
});
|
|
297
324
|
};
|
|
@@ -361,6 +388,134 @@ var WithHeaderStory = function WithHeaderStory() {
|
|
|
361
388
|
})
|
|
362
389
|
});
|
|
363
390
|
};
|
|
391
|
+
var PaginatedStory = function PaginatedStory() {
|
|
392
|
+
var _useState17 = (0, _react.useState)(PAGINATION_PAGES[0]),
|
|
393
|
+
_useState18 = (0, _slicedToArray2.default)(_useState17, 2),
|
|
394
|
+
items = _useState18[0],
|
|
395
|
+
setItems = _useState18[1];
|
|
396
|
+
var _useState19 = (0, _react.useState)(1),
|
|
397
|
+
_useState20 = (0, _slicedToArray2.default)(_useState19, 2),
|
|
398
|
+
page = _useState20[0],
|
|
399
|
+
setPage = _useState20[1];
|
|
400
|
+
var _useState21 = (0, _react.useState)(false),
|
|
401
|
+
_useState22 = (0, _slicedToArray2.default)(_useState21, 2),
|
|
402
|
+
loading = _useState22[0],
|
|
403
|
+
setLoading = _useState22[1];
|
|
404
|
+
var handleLoadMore = function handleLoadMore() {
|
|
405
|
+
var nextPage = PAGINATION_PAGES[page];
|
|
406
|
+
if (loading || !nextPage) {
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
(0, _actions.action)('onLoadMore')(page);
|
|
410
|
+
setLoading(true);
|
|
411
|
+
window.setTimeout(function () {
|
|
412
|
+
setItems(function (currentItems) {
|
|
413
|
+
return [].concat((0, _toConsumableArray2.default)(currentItems), (0, _toConsumableArray2.default)(nextPage));
|
|
414
|
+
});
|
|
415
|
+
setPage(function (currentPage) {
|
|
416
|
+
return currentPage + 1;
|
|
417
|
+
});
|
|
418
|
+
setLoading(false);
|
|
419
|
+
}, 700);
|
|
420
|
+
};
|
|
421
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
422
|
+
style: {
|
|
423
|
+
width: 300,
|
|
424
|
+
height: 300
|
|
425
|
+
},
|
|
426
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_QueriesHistory.QueriesHistory, {
|
|
427
|
+
title: "Paginated history",
|
|
428
|
+
items: items,
|
|
429
|
+
selectedRowId: 2,
|
|
430
|
+
loading: loading,
|
|
431
|
+
hasMore: page < PAGINATION_PAGES.length,
|
|
432
|
+
onLoadMore: handleLoadMore,
|
|
433
|
+
search: {
|
|
434
|
+
onUpdate: (0, _actions.action)('onSearchUpdate')
|
|
435
|
+
}
|
|
436
|
+
})
|
|
437
|
+
});
|
|
438
|
+
};
|
|
439
|
+
var FullSearchUnavailableStory = function FullSearchUnavailableStory() {
|
|
440
|
+
var _useState23 = (0, _react.useState)({
|
|
441
|
+
value: 'Query',
|
|
442
|
+
fullSearch: true
|
|
443
|
+
}),
|
|
444
|
+
_useState24 = (0, _slicedToArray2.default)(_useState23, 2),
|
|
445
|
+
search = _useState24[0],
|
|
446
|
+
setSearch = _useState24[1];
|
|
447
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
448
|
+
style: {
|
|
449
|
+
width: 300,
|
|
450
|
+
height: 500
|
|
451
|
+
},
|
|
452
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_QueriesHistory.QueriesHistory, {
|
|
453
|
+
title: "Basic search only",
|
|
454
|
+
items: LINK_ITEMS,
|
|
455
|
+
search: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, search), {}, {
|
|
456
|
+
fullSearchAvailable: false,
|
|
457
|
+
hasClear: true,
|
|
458
|
+
onUpdate: function onUpdate(data) {
|
|
459
|
+
(0, _actions.action)('onSearchUpdate')(data);
|
|
460
|
+
setSearch(data);
|
|
461
|
+
}
|
|
462
|
+
})
|
|
463
|
+
})
|
|
464
|
+
});
|
|
465
|
+
};
|
|
466
|
+
var RouterLinksStory = function RouterLinksStory() {
|
|
467
|
+
var _useState25 = (0, _react.useState)({
|
|
468
|
+
value: '',
|
|
469
|
+
fullSearch: false
|
|
470
|
+
}),
|
|
471
|
+
_useState26 = (0, _slicedToArray2.default)(_useState25, 2),
|
|
472
|
+
search = _useState26[0],
|
|
473
|
+
setSearch = _useState26[1];
|
|
474
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
475
|
+
style: {
|
|
476
|
+
width: 500,
|
|
477
|
+
height: 500
|
|
478
|
+
},
|
|
479
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_QueriesHistory.QueriesHistory, {
|
|
480
|
+
title: "Router links",
|
|
481
|
+
items: LINK_ITEMS,
|
|
482
|
+
renderLink: renderRouterLink,
|
|
483
|
+
search: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, search), {}, {
|
|
484
|
+
hasClear: true,
|
|
485
|
+
onUpdate: setSearch
|
|
486
|
+
})
|
|
487
|
+
})
|
|
488
|
+
});
|
|
489
|
+
};
|
|
490
|
+
var CustomRowRendererStory = function CustomRowRendererStory() {
|
|
491
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
492
|
+
style: {
|
|
493
|
+
width: 300,
|
|
494
|
+
height: 300
|
|
495
|
+
},
|
|
496
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_QueriesHistory.QueriesHistory, {
|
|
497
|
+
title: "Custom row renderer",
|
|
498
|
+
items: LINK_ITEMS.slice(0, 3),
|
|
499
|
+
renderLink: renderRouterLink,
|
|
500
|
+
renderRowItem: function renderRowItem(_ref2) {
|
|
501
|
+
var item = _ref2.item,
|
|
502
|
+
renderLink = _ref2.renderLink;
|
|
503
|
+
return 'header' in item ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.HistoryGroupHeader, {
|
|
504
|
+
title: item.header
|
|
505
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.RowLink, {
|
|
506
|
+
href: item.href,
|
|
507
|
+
renderLink: renderLink,
|
|
508
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_uikit.Text, {
|
|
509
|
+
children: item.title
|
|
510
|
+
})
|
|
511
|
+
});
|
|
512
|
+
},
|
|
513
|
+
search: {
|
|
514
|
+
onUpdate: (0, _actions.action)('onSearchUpdate')
|
|
515
|
+
}
|
|
516
|
+
})
|
|
517
|
+
});
|
|
518
|
+
};
|
|
364
519
|
var Default = exports.Default = {
|
|
365
520
|
render: function render() {
|
|
366
521
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(DefaultStory, {});
|
|
@@ -371,6 +526,45 @@ var Empty = exports.Empty = {
|
|
|
371
526
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(EmptyStory, {});
|
|
372
527
|
}
|
|
373
528
|
};
|
|
529
|
+
var InitialLoading = exports.InitialLoading = {
|
|
530
|
+
args: {
|
|
531
|
+
title: 'Loading history',
|
|
532
|
+
items: [],
|
|
533
|
+
loading: true,
|
|
534
|
+
search: {
|
|
535
|
+
onUpdate: (0, _actions.action)('onSearchUpdate')
|
|
536
|
+
}
|
|
537
|
+
},
|
|
538
|
+
decorators: [function (StoryComponent) {
|
|
539
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
540
|
+
style: {
|
|
541
|
+
width: 300,
|
|
542
|
+
height: 500
|
|
543
|
+
},
|
|
544
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(StoryComponent, {})
|
|
545
|
+
});
|
|
546
|
+
}]
|
|
547
|
+
};
|
|
548
|
+
var Paginated = exports.Paginated = {
|
|
549
|
+
render: function render() {
|
|
550
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(PaginatedStory, {});
|
|
551
|
+
}
|
|
552
|
+
};
|
|
553
|
+
var FullSearchUnavailable = exports.FullSearchUnavailable = {
|
|
554
|
+
render: function render() {
|
|
555
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(FullSearchUnavailableStory, {});
|
|
556
|
+
}
|
|
557
|
+
};
|
|
558
|
+
var RouterLinks = exports.RouterLinks = {
|
|
559
|
+
render: function render() {
|
|
560
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(RouterLinksStory, {});
|
|
561
|
+
}
|
|
562
|
+
};
|
|
563
|
+
var CustomRowRenderer = exports.CustomRowRenderer = {
|
|
564
|
+
render: function render() {
|
|
565
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(CustomRowRendererStory, {});
|
|
566
|
+
}
|
|
567
|
+
};
|
|
374
568
|
var WithHeader = exports.WithHeader = {
|
|
375
569
|
render: function render() {
|
|
376
570
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(WithHeaderStory, {});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_uikit","_QueriesHistory","_actions","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_interopRequireDefault","now","Date","min","QUERY","BASE_ITEMS","header","height","id","title","status","engine","mode","startTime","endTime","query","activeFields","fields","filterFields","type","initialValue","items","logFilterApply","action","logFilterReset","meta","component","QueriesHistory","tags","parameters","layout","operationFilterOptions","value","content","_default","exports","DefaultStory","_useState","useState","concat","_useState2","_slicedToArray","setItems","_useState3","fullSearch","_useState4","search","setSearch","_useState5","_useState6","visibleFields","setVisibleFields","_useState7","_useState8","compareMode","setCompareMode","_useState9","_useState0","comparedRows","setComparedRows","_useState1","undefined","_useState10","editingId","setEditingId","handleCompareChange","item","selected","result","_toConsumableArray","slice","filter","length","handleCompareCancel","handleEditSubmit","index","findIndex","_objectSpread","handleEditCancel","handleCompare","handleOnSearch","data","newItems","_item$query","toLowerCase","searchValue","includes","_jsx","style","width","children","onChange","hasClear","onUpdate","onApply","onReset","getRowActions","text","onClick","comparison","enabled","comparedRowIds","onCancel","onCompare","editing","rowId","onSubmit","EmptyStory","_useState11","_useState12","WithHeaderStory","_useState13","_useState14","_useState15","_useState16","logo","SegmentedRadioGroup","options","Default","render","Empty","WithHeader"],"sources":["QueriesHistory.stories.tsx"],"sourcesContent":["import React, {useState} from 'react';\nimport type {Meta, StoryObj} from '@storybook/react';\nimport {SegmentedRadioGroup} from '@gravity-ui/uikit';\nimport {QueriesHistory} from './QueriesHistory';\nimport {\n QueryListFieldKey,\n QueryListFilterConfig,\n QueryListItem,\n QueryListVisibleFieldsConfig,\n} from '../../types/queryList';\nimport {QueryHistoryRow} from '../../types/history';\nimport {action} from 'storybook/actions';\n\nconst now = Date.now();\nconst min = 60 * 1000;\n\nconst QUERY = `use test;\n\nSELECT\n \"test_session\" AS session_id,\n \"test_task\" AS task_id,\n SUBSTRING(\"test\", 1, 1) AS truncated_char`;\n\nconst BASE_ITEMS: QueryListItem<QueryHistoryRow>[] = [\n {header: 'Today', height: 28},\n {\n id: 1,\n title: 'Query 1',\n status: 'completed',\n engine: 'YQL',\n mode: 'Validation',\n startTime: now - 2 * min,\n endTime: now - min,\n query: QUERY,\n height: 52,\n },\n {\n id: 2,\n title: 'Query 2',\n status: 'failed',\n engine: 'YQL',\n mode: 'Test',\n startTime: now - 10 * min,\n endTime: now - 9 * min,\n query: QUERY,\n height: 52,\n },\n {\n id: 3,\n title: 'Query 3',\n status: 'running',\n engine: 'YQL',\n mode: 'Test',\n startTime: now - min,\n query: QUERY,\n height: 52,\n },\n {header: 'Yesterday', height: 28},\n {\n id: 4,\n title: 'Query 4',\n status: 'aborted',\n engine: 'YQL',\n mode: 'Validation',\n startTime: now - 25 * 60 * min,\n endTime: now - 24 * 60 * min,\n query: 'SELECT 1',\n height: 52,\n },\n {\n id: 5,\n title: 'Query 5',\n status: 'draft',\n engine: 'YQL',\n mode: 'Test',\n startTime: now - 30 * 60 * min,\n query: QUERY,\n height: 52,\n },\n {\n id: 6,\n title: 'Query 6',\n status: 'draft',\n engine: 'YQL',\n mode: 'Test',\n startTime: now - 30 * 60 * min,\n query: QUERY,\n height: 52,\n },\n {\n id: 7,\n title: 'Query 7',\n status: 'draft',\n engine: 'YQL',\n mode: 'Test',\n startTime: now - 30 * 60 * min,\n query: QUERY,\n height: 52,\n },\n {\n id: 8,\n title: 'Query 8',\n status: 'draft',\n engine: 'YQL',\n mode: 'Test',\n startTime: now - 30 * 60 * min,\n query: QUERY,\n height: 52,\n },\n];\n\ntype VisibleFields = QueryListVisibleFieldsConfig<QueryHistoryRow>['fields'];\nconst activeFields: QueryListFieldKey<QueryHistoryRow>[] = [\n 'duration',\n 'mode',\n 'startTime',\n 'engine',\n 'isPrivate',\n];\nconst fields: VisibleFields = [\n {\n id: 'duration',\n title: 'Duration',\n },\n {\n id: 'mode',\n title: 'Mode',\n },\n {\n id: 'startTime',\n title: 'Start time',\n },\n {\n id: 'engine',\n title: 'Engine',\n },\n {\n id: 'isPrivate',\n title: 'ACO',\n },\n];\n\nconst filterFields: QueryListFilterConfig['fields'] = [\n {id: 'onlyMine', type: 'switch', title: 'My queries only', initialValue: true},\n {id: 'range', type: 'rangeDatePicker', title: 'Period'},\n {\n id: 'dialect',\n type: 'checkboxGroup',\n title: 'Dialect',\n initialValue: [],\n items: [\n {id: 'yql', title: 'YQL'},\n {id: 'sql', title: 'SQL'},\n ],\n },\n];\n\nconst logFilterApply = action('onFilterApply');\nconst logFilterReset = action('onFilterReset');\n\nconst meta: Meta<typeof QueriesHistory> = {\n title: 'Widgets/QueriesHistory',\n component: QueriesHistory,\n tags: ['autodocs'],\n parameters: {\n layout: 'padded',\n },\n};\n\nconst operationFilterOptions = [\n {\n value: 'My',\n content: 'My',\n },\n {\n value: 'All',\n content: 'All',\n },\n];\n\nexport default meta;\ntype Story = StoryObj<typeof QueriesHistory>;\n\nconst DefaultStory = () => {\n const [items, setItems] = useState([...BASE_ITEMS]);\n const [search, setSearch] = useState({value: '', fullSearch: false});\n const [visibleFields, setVisibleFields] =\n useState<QueryListFieldKey<QueryHistoryRow>[]>(activeFields);\n const [compareMode, setCompareMode] = useState(false);\n const [comparedRows, setComparedRows] = useState<(number | string)[]>([]);\n const [editingId, setEditingId] = useState<number | string | undefined>(undefined);\n\n const handleCompareChange = (item: QueryHistoryRow, selected: boolean) => {\n const result = selected\n ? [...comparedRows.slice(0, 1), item.id]\n : comparedRows.filter((id) => id !== item.id);\n setComparedRows(result);\n\n if (!result.length) setCompareMode(false);\n };\n\n const handleCompareCancel = () => {\n setComparedRows([]);\n setCompareMode(false);\n };\n\n const handleEditSubmit = (item: QueryHistoryRow, title: string) => {\n const index = items.findIndex((i) => 'id' in i && i.id === item.id);\n if (index < 0) return;\n\n const result = [...items];\n result[index] = {...result[index], title};\n setItems(result);\n setEditingId(undefined);\n };\n\n const handleEditCancel = () => {\n setEditingId(undefined);\n };\n\n const handleCompare = () => {\n action('onCompare')(comparedRows);\n };\n\n const handleOnSearch = (data: {value: string; fullSearch: boolean}) => {\n setSearch(data);\n\n if (!data.value) {\n setItems(BASE_ITEMS);\n return;\n }\n\n const newItems = BASE_ITEMS.filter((item) => {\n if (!('id' in item)) return false;\n\n const title = item.title.toLowerCase();\n const query = item.query?.toLowerCase();\n const searchValue = data.value.toLowerCase();\n\n if (data.fullSearch) {\n return title.includes(searchValue) || query?.includes(searchValue);\n }\n\n return title.includes(searchValue);\n });\n setItems(newItems);\n };\n\n return (\n <div style={{width: 300, height: 500}}>\n <QueriesHistory\n title=\"History\"\n items={items}\n visibleFields={{value: visibleFields, fields, onChange: setVisibleFields}}\n search={{\n value: search.value,\n fullSearch: search.fullSearch,\n hasClear: true,\n onUpdate: handleOnSearch,\n }}\n filter={{\n fields: filterFields,\n onApply: logFilterApply,\n onReset: logFilterReset('reset'),\n }}\n getRowActions={() => [\n {\n text: 'Compare',\n onClick: (item) => {\n setCompareMode(true);\n setComparedRows([item.id]);\n },\n },\n {\n text: 'Edit',\n onClick: (item) => {\n setEditingId(item.id);\n },\n },\n ]}\n comparison={{\n enabled: compareMode,\n comparedRowIds: comparedRows,\n onChange: handleCompareChange,\n onCancel: handleCompareCancel,\n onCompare: handleCompare,\n }}\n editing={{\n rowId: editingId,\n onSubmit: handleEditSubmit,\n onCancel: handleEditCancel,\n }}\n />\n </div>\n );\n};\n\nconst EmptyStory = () => {\n const [search, setSearch] = useState({value: '', fullSearch: false});\n\n return (\n <div style={{width: 300, height: 500}}>\n <QueriesHistory\n title=\"History\"\n items={[]}\n search={{\n value: search.value,\n fullSearch: search.fullSearch,\n hasClear: true,\n onUpdate: setSearch,\n }}\n />\n </div>\n );\n};\n\nconst WithHeaderStory = () => {\n const [search, setSearch] = useState({value: '', fullSearch: false});\n const [visibleFields, setVisibleFields] =\n useState<QueryListFieldKey<QueryHistoryRow>[]>(activeFields);\n\n return (\n <div style={{width: 300, height: 500}}>\n <QueriesHistory\n items={BASE_ITEMS}\n logo={<SegmentedRadioGroup options={operationFilterOptions} />}\n visibleFields={{value: visibleFields, fields, onChange: setVisibleFields}}\n filter={{\n fields: filterFields,\n onApply: logFilterApply,\n onReset: logFilterReset('reset'),\n }}\n search={{\n value: search.value,\n fullSearch: search.fullSearch,\n hasClear: true,\n onUpdate: setSearch,\n }}\n />\n </div>\n );\n};\n\nexport const Default: Story = {render: () => <DefaultStory />};\nexport const Empty: Story = {render: () => <EmptyStory />};\nexport const WithHeader: Story = {render: () => <WithHeaderStory />};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AAQA,IAAAG,QAAA,GAAAH,OAAA;AAAyC,IAAAI,WAAA,GAAAJ,OAAA;AAAA,SAAAD,wBAAAM,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAR,uBAAA,YAAAA,CAAAM,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK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,GAAAnF,OAAA,CAAAmF,OAAA,GAAG;EAACC,MAAM,EAAE,SAARA,MAAMA,CAAA;IAAA,oBAAQ,IAAAhC,eAAA,EAACnD,YAAY,IAAE,CAAC;EAAA;AAAA,CAAC;AACvD,IAAMoF,KAAY,GAAArF,OAAA,CAAAqF,KAAA,GAAG;EAACD,MAAM,EAAE,SAARA,MAAMA,CAAA;IAAA,oBAAQ,IAAAhC,eAAA,EAACoB,UAAU,IAAE,CAAC;EAAA;AAAA,CAAC;AACnD,IAAMc,UAAiB,GAAAtF,OAAA,CAAAsF,UAAA,GAAG;EAACF,MAAM,EAAE,SAARA,MAAMA,CAAA;IAAA,oBAAQ,IAAAhC,eAAA,EAACuB,eAAe,IAAE,CAAC;EAAA;AAAA,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_uikit","_components","_QueriesHistory","_actions","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_interopRequireDefault","now","Date","min","QUERY","BASE_ITEMS","header","height","id","title","status","engine","mode","startTime","endTime","query","LINK_ITEMS","map","item","_objectSpread","href","concat","PAGINATION_PAGES","slice","activeFields","fields","filterFields","type","initialValue","items","logFilterApply","action","logFilterReset","renderRouterLink","_ref","_onClick","onClick","props","_objectWithoutProperties","_excluded","_jsx","event","defaultPrevented","button","metaKey","ctrlKey","shiftKey","altKey","preventDefault","meta","component","QueriesHistory","tags","parameters","layout","operationFilterOptions","value","content","_default","exports","DefaultStory","_useState","useState","_toConsumableArray","_useState2","_slicedToArray","setItems","_useState3","fullSearch","_useState4","search","setSearch","_useState5","_useState6","visibleFields","setVisibleFields","_useState7","_useState8","compareMode","setCompareMode","_useState9","_useState0","comparedRows","setComparedRows","_useState1","undefined","_useState10","editingId","setEditingId","handleCompareChange","selected","result","filter","length","handleCompareCancel","handleEditSubmit","index","findIndex","handleEditCancel","handleCompare","handleOnSearch","data","newItems","_item$query","toLowerCase","searchValue","includes","style","width","children","onChange","hasClear","onUpdate","onApply","onReset","getRowActions","text","comparison","enabled","comparedRowIds","onCancel","onCompare","editing","rowId","onSubmit","renderLink","EmptyStory","_useState11","_useState12","WithHeaderStory","_useState13","_useState14","_useState15","_useState16","logo","SegmentedRadioGroup","options","PaginatedStory","_useState17","_useState18","_useState19","_useState20","page","setPage","_useState21","_useState22","loading","setLoading","handleLoadMore","nextPage","window","setTimeout","currentItems","currentPage","selectedRowId","hasMore","onLoadMore","FullSearchUnavailableStory","_useState23","_useState24","fullSearchAvailable","RouterLinksStory","_useState25","_useState26","CustomRowRendererStory","renderRowItem","_ref2","HistoryGroupHeader","RowLink","Text","Default","render","Empty","InitialLoading","args","decorators","StoryComponent","Paginated","FullSearchUnavailable","RouterLinks","CustomRowRenderer","WithHeader"],"sources":["QueriesHistory.stories.tsx"],"sourcesContent":["import React, {useState} from 'react';\nimport type {Meta, StoryObj} from '@storybook/react';\nimport {SegmentedRadioGroup, Text} from '@gravity-ui/uikit';\nimport {HistoryGroupHeader, RowLink} from '../../components';\nimport {QueriesHistory} from './QueriesHistory';\nimport {\n QueryListFieldKey,\n QueryListFilterConfig,\n QueryListItem,\n QueryListLinkRenderer,\n QueryListVisibleFieldsConfig,\n} from '../../types/queryList';\nimport {QueryHistoryRow} from '../../types/history';\nimport {action} from 'storybook/actions';\n\nconst now = Date.now();\nconst min = 60 * 1000;\n\nconst QUERY = `use test;\n\nSELECT\n \"test_session\" AS session_id,\n \"test_task\" AS task_id,\n SUBSTRING(\"test\", 1, 1) AS truncated_char`;\n\nconst BASE_ITEMS: QueryListItem<QueryHistoryRow>[] = [\n {header: 'Today', height: 28},\n {\n id: 1,\n title: 'Query 1',\n status: 'completed',\n engine: 'YQL',\n mode: 'Validation',\n startTime: now - 2 * min,\n endTime: now - min,\n query: QUERY,\n height: 52,\n },\n {\n id: 2,\n title: 'Query 2',\n status: 'failed',\n engine: 'YQL',\n mode: 'Test',\n startTime: now - 10 * min,\n endTime: now - 9 * min,\n query: QUERY,\n height: 52,\n },\n {\n id: 3,\n title: 'Query 3',\n status: 'running',\n engine: 'YQL',\n mode: 'Test',\n startTime: now - min,\n query: QUERY,\n height: 52,\n },\n {header: 'Yesterday', height: 28},\n {\n id: 4,\n title: 'Query 4',\n status: 'aborted',\n engine: 'YQL',\n mode: 'Validation',\n startTime: now - 25 * 60 * min,\n endTime: now - 24 * 60 * min,\n query: 'SELECT 1',\n height: 52,\n },\n {\n id: 5,\n title: 'Query 5',\n status: 'draft',\n engine: 'YQL',\n mode: 'Test',\n startTime: now - 30 * 60 * min,\n query: QUERY,\n height: 52,\n },\n {\n id: 6,\n title: 'Query 6',\n status: 'draft',\n engine: 'YQL',\n mode: 'Test',\n startTime: now - 30 * 60 * min,\n query: QUERY,\n height: 52,\n },\n {\n id: 7,\n title: 'Query 7',\n status: 'draft',\n engine: 'YQL',\n mode: 'Test',\n startTime: now - 30 * 60 * min,\n query: QUERY,\n height: 52,\n },\n {\n id: 8,\n title: 'Query 8',\n status: 'draft',\n engine: 'YQL',\n mode: 'Test',\n startTime: now - 30 * 60 * min,\n query: QUERY,\n height: 52,\n },\n];\n\nconst LINK_ITEMS = BASE_ITEMS.map((item) =>\n 'id' in item ? {...item, href: `/queries/${item.id}`} : item,\n);\n\nconst PAGINATION_PAGES = [LINK_ITEMS.slice(0, 3), LINK_ITEMS.slice(3, 6), LINK_ITEMS.slice(6)];\n\ntype VisibleFields = QueryListVisibleFieldsConfig<QueryHistoryRow>['fields'];\nconst activeFields: QueryListFieldKey<QueryHistoryRow>[] = [\n 'duration',\n 'mode',\n 'startTime',\n 'engine',\n 'isPrivate',\n];\nconst fields: VisibleFields = [\n {\n id: 'duration',\n title: 'Duration',\n },\n {\n id: 'mode',\n title: 'Mode',\n },\n {\n id: 'startTime',\n title: 'Start time',\n },\n {\n id: 'engine',\n title: 'Engine',\n },\n {\n id: 'isPrivate',\n title: 'ACO',\n },\n];\n\nconst filterFields: QueryListFilterConfig['fields'] = [\n {id: 'onlyMine', type: 'switch', title: 'My queries only', initialValue: true},\n {id: 'range', type: 'rangeDatePicker', title: 'Period'},\n {\n id: 'dialect',\n type: 'checkboxGroup',\n title: 'Dialect',\n initialValue: [],\n items: [\n {id: 'yql', title: 'YQL'},\n {id: 'sql', title: 'SQL'},\n ],\n },\n];\n\nconst logFilterApply = action('onFilterApply');\nconst logFilterReset = action('onFilterReset');\n\nconst renderRouterLink: QueryListLinkRenderer = ({onClick, ...props}) => (\n <a\n {...props}\n data-router-link\n onClick={(event) => {\n onClick?.(event);\n\n if (\n event.defaultPrevented ||\n event.button !== 0 ||\n event.metaKey ||\n event.ctrlKey ||\n event.shiftKey ||\n event.altKey\n ) {\n return;\n }\n\n event.preventDefault();\n action('routerNavigate')(props.href);\n }}\n />\n);\n\nconst meta: Meta<typeof QueriesHistory> = {\n title: 'Widgets/QueriesHistory',\n component: QueriesHistory,\n tags: ['autodocs'],\n parameters: {\n layout: 'padded',\n },\n};\n\nconst operationFilterOptions = [\n {\n value: 'My',\n content: 'My',\n },\n {\n value: 'All',\n content: 'All',\n },\n];\n\nexport default meta;\ntype Story = StoryObj<typeof QueriesHistory>;\n\nconst DefaultStory = () => {\n const [items, setItems] = useState([...LINK_ITEMS]);\n const [search, setSearch] = useState({value: '', fullSearch: false});\n const [visibleFields, setVisibleFields] =\n useState<QueryListFieldKey<QueryHistoryRow>[]>(activeFields);\n const [compareMode, setCompareMode] = useState(false);\n const [comparedRows, setComparedRows] = useState<(number | string)[]>([]);\n const [editingId, setEditingId] = useState<number | string | undefined>(undefined);\n\n const handleCompareChange = (item: QueryHistoryRow, selected: boolean) => {\n const result = selected\n ? [...comparedRows.slice(0, 1), item.id]\n : comparedRows.filter((id) => id !== item.id);\n setComparedRows(result);\n\n if (!result.length) setCompareMode(false);\n };\n\n const handleCompareCancel = () => {\n setComparedRows([]);\n setCompareMode(false);\n };\n\n const handleEditSubmit = (item: QueryHistoryRow, title: string) => {\n const index = items.findIndex((i) => 'id' in i && i.id === item.id);\n if (index < 0) return;\n\n const result = [...items];\n result[index] = {...result[index], title};\n setItems(result);\n setEditingId(undefined);\n };\n\n const handleEditCancel = () => {\n setEditingId(undefined);\n };\n\n const handleCompare = () => {\n action('onCompare')(comparedRows);\n };\n\n const handleOnSearch = (data: {value: string; fullSearch: boolean}) => {\n setSearch(data);\n\n if (!data.value) {\n setItems(LINK_ITEMS);\n return;\n }\n\n const newItems = LINK_ITEMS.filter((item) => {\n if (!('id' in item)) return false;\n\n const title = item.title.toLowerCase();\n const query = item.query?.toLowerCase();\n const searchValue = data.value.toLowerCase();\n\n if (data.fullSearch) {\n return title.includes(searchValue) || query?.includes(searchValue);\n }\n\n return title.includes(searchValue);\n });\n setItems(newItems);\n };\n\n return (\n <div style={{width: 300, height: 500}}>\n <QueriesHistory\n title=\"History\"\n items={items}\n visibleFields={{value: visibleFields, fields, onChange: setVisibleFields}}\n search={{\n value: search.value,\n fullSearch: search.fullSearch,\n hasClear: true,\n onUpdate: handleOnSearch,\n }}\n filter={{\n fields: filterFields,\n onApply: logFilterApply,\n onReset: logFilterReset('reset'),\n }}\n getRowActions={() => [\n {\n text: 'Compare',\n onClick: (item) => {\n setCompareMode(true);\n setComparedRows([item.id]);\n },\n },\n {\n text: 'Edit',\n onClick: (item) => {\n setEditingId(item.id);\n },\n },\n ]}\n comparison={{\n enabled: compareMode,\n comparedRowIds: comparedRows,\n onChange: handleCompareChange,\n onCancel: handleCompareCancel,\n onCompare: handleCompare,\n }}\n editing={{\n rowId: editingId,\n onSubmit: handleEditSubmit,\n onCancel: handleEditCancel,\n }}\n renderLink={renderRouterLink}\n />\n </div>\n );\n};\n\nconst EmptyStory = () => {\n const [search, setSearch] = useState({value: '', fullSearch: false});\n\n return (\n <div style={{width: 300, height: 500}}>\n <QueriesHistory\n title=\"History\"\n items={[]}\n search={{\n value: search.value,\n fullSearch: search.fullSearch,\n hasClear: true,\n onUpdate: setSearch,\n }}\n />\n </div>\n );\n};\n\nconst WithHeaderStory = () => {\n const [search, setSearch] = useState({value: '', fullSearch: false});\n const [visibleFields, setVisibleFields] =\n useState<QueryListFieldKey<QueryHistoryRow>[]>(activeFields);\n\n return (\n <div style={{width: 300, height: 500}}>\n <QueriesHistory\n items={BASE_ITEMS}\n logo={<SegmentedRadioGroup options={operationFilterOptions} />}\n visibleFields={{value: visibleFields, fields, onChange: setVisibleFields}}\n filter={{\n fields: filterFields,\n onApply: logFilterApply,\n onReset: logFilterReset('reset'),\n }}\n search={{\n value: search.value,\n fullSearch: search.fullSearch,\n hasClear: true,\n onUpdate: setSearch,\n }}\n />\n </div>\n );\n};\n\nconst PaginatedStory = () => {\n const [items, setItems] = useState<QueryListItem<QueryHistoryRow>[]>(PAGINATION_PAGES[0]);\n const [page, setPage] = useState(1);\n const [loading, setLoading] = useState(false);\n\n const handleLoadMore = () => {\n const nextPage = PAGINATION_PAGES[page];\n\n if (loading || !nextPage) {\n return;\n }\n\n action('onLoadMore')(page);\n setLoading(true);\n\n window.setTimeout(() => {\n setItems((currentItems) => [...currentItems, ...nextPage]);\n setPage((currentPage) => currentPage + 1);\n setLoading(false);\n }, 700);\n };\n\n return (\n <div style={{width: 300, height: 300}}>\n <QueriesHistory\n title=\"Paginated history\"\n items={items}\n selectedRowId={2}\n loading={loading}\n hasMore={page < PAGINATION_PAGES.length}\n onLoadMore={handleLoadMore}\n search={{onUpdate: action('onSearchUpdate')}}\n />\n </div>\n );\n};\n\nconst FullSearchUnavailableStory = () => {\n const [search, setSearch] = useState({value: 'Query', fullSearch: true});\n\n return (\n <div style={{width: 300, height: 500}}>\n <QueriesHistory\n title=\"Basic search only\"\n items={LINK_ITEMS}\n search={{\n ...search,\n fullSearchAvailable: false,\n hasClear: true,\n onUpdate: (data) => {\n action('onSearchUpdate')(data);\n setSearch(data);\n },\n }}\n />\n </div>\n );\n};\n\nconst RouterLinksStory = () => {\n const [search, setSearch] = useState({value: '', fullSearch: false});\n\n return (\n <div style={{width: 500, height: 500}}>\n <QueriesHistory\n title=\"Router links\"\n items={LINK_ITEMS}\n renderLink={renderRouterLink}\n search={{...search, hasClear: true, onUpdate: setSearch}}\n />\n </div>\n );\n};\n\nconst CustomRowRendererStory = () => (\n <div style={{width: 300, height: 300}}>\n <QueriesHistory\n title=\"Custom row renderer\"\n items={LINK_ITEMS.slice(0, 3)}\n renderLink={renderRouterLink}\n renderRowItem={({item, renderLink}) =>\n 'header' in item ? (\n <HistoryGroupHeader title={item.header} />\n ) : (\n <RowLink href={item.href} renderLink={renderLink}>\n <Text>{item.title}</Text>\n </RowLink>\n )\n }\n search={{onUpdate: action('onSearchUpdate')}}\n />\n </div>\n);\n\nexport const Default: Story = {render: () => <DefaultStory />};\nexport const Empty: Story = {render: () => <EmptyStory />};\nexport const InitialLoading: Story = {\n args: {\n title: 'Loading history',\n items: [],\n loading: true,\n search: {onUpdate: action('onSearchUpdate')},\n },\n decorators: [\n (StoryComponent) => (\n <div style={{width: 300, height: 500}}>\n <StoryComponent />\n </div>\n ),\n ],\n};\nexport const Paginated: Story = {render: () => <PaginatedStory />};\nexport const FullSearchUnavailable: Story = {\n render: () => <FullSearchUnavailableStory />,\n};\nexport const RouterLinks: Story = {render: () => <RouterLinksStory />};\nexport const CustomRowRenderer: Story = {render: () => <CustomRowRendererStory />};\nexport const WithHeader: Story = {render: () => <WithHeaderStory />};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AASA,IAAAI,QAAA,GAAAJ,OAAA;AAAyC,IAAAK,WAAA,GAAAL,OAAA;AAAA,SAAAD,wBAAAO,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAT,uBAAA,YAAAA,CAAAO,CAAA,EAAAC,CA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H,OAAA,CAAAuH,qBAAA,GAAG;EACxCP,MAAM,EAAE,SAARA,MAAMA,CAAA;IAAA,oBAAQ,IAAAnI,eAAA,EAACqH,0BAA0B,IAAE,CAAC;EAAA;AAChD,CAAC;AACM,IAAMsB,WAAkB,GAAAxH,OAAA,CAAAwH,WAAA,GAAG;EAACR,MAAM,EAAE,SAARA,MAAMA,CAAA;IAAA,oBAAQ,IAAAnI,eAAA,EAACyH,gBAAgB,IAAE,CAAC;EAAA;AAAA,CAAC;AAC/D,IAAMmB,iBAAwB,GAAAzH,OAAA,CAAAyH,iBAAA,GAAG;EAACT,MAAM,EAAE,SAARA,MAAMA,CAAA;IAAA,oBAAQ,IAAAnI,eAAA,EAAC4H,sBAAsB,IAAE,CAAC;EAAA;AAAA,CAAC;AAC3E,IAAMiB,UAAiB,GAAA1H,OAAA,CAAA0H,UAAA,GAAG;EAACV,MAAM,EAAE,SAARA,MAAMA,CAAA;IAAA,oBAAQ,IAAAnI,eAAA,EAACyF,eAAe,IAAE,CAAC;EAAA;AAAA,CAAC","ignoreList":[]}
|
|
@@ -32,7 +32,8 @@ var TutorialsHistory = exports.TutorialsHistory = function TutorialsHistory(_ref
|
|
|
32
32
|
selectedRowId = _ref.selectedRowId,
|
|
33
33
|
onListItemClick = _ref.onListItemClick,
|
|
34
34
|
className = _ref.className;
|
|
35
|
-
var
|
|
35
|
+
var fullSearchAvailable = search.fullSearchAvailable !== false;
|
|
36
|
+
var showSearchResults = Boolean(fullSearchAvailable && search.fullSearch && ((_search$value = search.value) === null || _search$value === void 0 ? void 0 : _search$value.trim()));
|
|
36
37
|
var rowVariant = showSearchResults ? 'search' : 'default';
|
|
37
38
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_modules.HistoryLayout, {
|
|
38
39
|
className: block(null, className),
|
|
@@ -41,6 +42,7 @@ var TutorialsHistory = exports.TutorialsHistory = function TutorialsHistory(_ref
|
|
|
41
42
|
header: /*#__PURE__*/(0, _jsxRuntime.jsx)(_modules.HistoryHeader, {
|
|
42
43
|
search: search.value,
|
|
43
44
|
fullSearch: search.fullSearch,
|
|
45
|
+
fullSearchAvailable: fullSearchAvailable,
|
|
44
46
|
hasClear: search.hasClear,
|
|
45
47
|
filter: filter,
|
|
46
48
|
onUpdate: search.onUpdate
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_modules","_i18n","_getListKey","_TutorialRowContent","_bemCnLite","_jsxRuntime","e","__esModule","default","block","cn","TutorialsHistory","exports","_ref","_search$value","title","logo","search","filter","items","selectedRowId","onListItemClick","className","showSearchResults","Boolean","fullSearch","value","trim","rowVariant","_jsx","HistoryLayout","i18n","header","HistoryHeader","hasClear","onUpdate","children","RowsList","renderRow","data","TutorialRowContent","_objectSpread","showFiltersHint","onItemClick","getListKey"],"sources":["TutorialsHistory.tsx"],"sourcesContent":["import React from 'react';\nimport {HistoryHeader, HistoryLayout, RowsList} from '../../modules';\nimport i18n from './i18n';\nimport {QueryListFilterConfig, QueryListItem, QueryListSearchConfig} from '../../types/queryList';\nimport {TutorialHistoryRow} from '../../types/tutorial';\nimport {getListKey} from '../../helpers/getListKey';\nimport {TutorialRowContent} from './TutorialRowContent';\nimport cn from 'bem-cn-lite';\nimport './TutorialsHistory.scss';\n\nexport type TutorialsHistoryProps<T extends TutorialHistoryRow = TutorialHistoryRow> = {\n className?: string;\n title?: string;\n logo?: React.ReactNode;\n search: QueryListSearchConfig;\n filter?: QueryListFilterConfig;\n items: QueryListItem<T>[];\n selectedRowId?: T['id'];\n onListItemClick?: (item: QueryListItem<T>) => void;\n};\n\nconst block = cn('qp-tutorials-history');\n\nexport const TutorialsHistory = <T extends TutorialHistoryRow>({\n title,\n logo,\n search,\n filter,\n items,\n selectedRowId,\n onListItemClick,\n className,\n}: TutorialsHistoryProps<T>) => {\n const showSearchResults = Boolean(search.fullSearch && search.value?.trim());\n const rowVariant = showSearchResults ? 'search' : 'default';\n\n return (\n <HistoryLayout\n className={block(null, className)}\n title={title || i18n('title_tutorials')}\n logo={logo}\n header={\n <HistoryHeader\n search={search.value}\n fullSearch={search.fullSearch}\n hasClear={search.hasClear}\n filter={filter}\n onUpdate={search.onUpdate}\n />\n }\n >\n <RowsList\n key={getListKey(items, rowVariant)}\n items={items}\n rowVariant={rowVariant}\n selectedRowId={selectedRowId}\n renderRow={(data) => <TutorialRowContent {...data} />}\n showFiltersHint={Boolean(filter)}\n onItemClick={onListItemClick}\n />\n </HistoryLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAH,sBAAA,CAAAC,OAAA;AAGA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,mBAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAN,sBAAA,CAAAC,OAAA;AACAA,OAAA;AAAiC,IAAAM,WAAA,GAAAN,OAAA;AAAA,SAAAD,uBAAAQ,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAajC,IAAMG,KAAK,GAAG,IAAAC,kBAAE,EAAC,sBAAsB,CAAC;AAEjC,IAAMC,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG,SAAnBA,gBAAgBA,CAAAE,IAAA,EASG;EAAA,IAAAC,aAAA;EAAA,IAR5BC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,IAAI,GAAAH,IAAA,CAAJG,IAAI;IACJC,MAAM,GAAAJ,IAAA,CAANI,MAAM;IACNC,MAAM,GAAAL,IAAA,CAANK,MAAM;IACNC,KAAK,GAAAN,IAAA,CAALM,KAAK;IACLC,aAAa,GAAAP,IAAA,CAAbO,aAAa;IACbC,eAAe,GAAAR,IAAA,CAAfQ,eAAe;IACfC,SAAS,GAAAT,IAAA,CAATS,SAAS;EAET,IAAMC,iBAAiB,GAAGC,OAAO,
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_modules","_i18n","_getListKey","_TutorialRowContent","_bemCnLite","_jsxRuntime","e","__esModule","default","block","cn","TutorialsHistory","exports","_ref","_search$value","title","logo","search","filter","items","selectedRowId","onListItemClick","className","fullSearchAvailable","showSearchResults","Boolean","fullSearch","value","trim","rowVariant","_jsx","HistoryLayout","i18n","header","HistoryHeader","hasClear","onUpdate","children","RowsList","renderRow","data","TutorialRowContent","_objectSpread","showFiltersHint","onItemClick","getListKey"],"sources":["TutorialsHistory.tsx"],"sourcesContent":["import React from 'react';\nimport {HistoryHeader, HistoryLayout, RowsList} from '../../modules';\nimport i18n from './i18n';\nimport {QueryListFilterConfig, QueryListItem, QueryListSearchConfig} from '../../types/queryList';\nimport {TutorialHistoryRow} from '../../types/tutorial';\nimport {getListKey} from '../../helpers/getListKey';\nimport {TutorialRowContent} from './TutorialRowContent';\nimport cn from 'bem-cn-lite';\nimport './TutorialsHistory.scss';\n\nexport type TutorialsHistoryProps<T extends TutorialHistoryRow = TutorialHistoryRow> = {\n className?: string;\n title?: string;\n logo?: React.ReactNode;\n search: QueryListSearchConfig;\n filter?: QueryListFilterConfig;\n items: QueryListItem<T>[];\n selectedRowId?: T['id'];\n onListItemClick?: (item: QueryListItem<T>) => void;\n};\n\nconst block = cn('qp-tutorials-history');\n\nexport const TutorialsHistory = <T extends TutorialHistoryRow>({\n title,\n logo,\n search,\n filter,\n items,\n selectedRowId,\n onListItemClick,\n className,\n}: TutorialsHistoryProps<T>) => {\n const fullSearchAvailable = search.fullSearchAvailable !== false;\n const showSearchResults = Boolean(\n fullSearchAvailable && search.fullSearch && search.value?.trim(),\n );\n const rowVariant = showSearchResults ? 'search' : 'default';\n\n return (\n <HistoryLayout\n className={block(null, className)}\n title={title || i18n('title_tutorials')}\n logo={logo}\n header={\n <HistoryHeader\n search={search.value}\n fullSearch={search.fullSearch}\n fullSearchAvailable={fullSearchAvailable}\n hasClear={search.hasClear}\n filter={filter}\n onUpdate={search.onUpdate}\n />\n }\n >\n <RowsList\n key={getListKey(items, rowVariant)}\n items={items}\n rowVariant={rowVariant}\n selectedRowId={selectedRowId}\n renderRow={(data) => <TutorialRowContent {...data} />}\n showFiltersHint={Boolean(filter)}\n onItemClick={onListItemClick}\n />\n </HistoryLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAH,sBAAA,CAAAC,OAAA;AAGA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,mBAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAN,sBAAA,CAAAC,OAAA;AACAA,OAAA;AAAiC,IAAAM,WAAA,GAAAN,OAAA;AAAA,SAAAD,uBAAAQ,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAajC,IAAMG,KAAK,GAAG,IAAAC,kBAAE,EAAC,sBAAsB,CAAC;AAEjC,IAAMC,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG,SAAnBA,gBAAgBA,CAAAE,IAAA,EASG;EAAA,IAAAC,aAAA;EAAA,IAR5BC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,IAAI,GAAAH,IAAA,CAAJG,IAAI;IACJC,MAAM,GAAAJ,IAAA,CAANI,MAAM;IACNC,MAAM,GAAAL,IAAA,CAANK,MAAM;IACNC,KAAK,GAAAN,IAAA,CAALM,KAAK;IACLC,aAAa,GAAAP,IAAA,CAAbO,aAAa;IACbC,eAAe,GAAAR,IAAA,CAAfQ,eAAe;IACfC,SAAS,GAAAT,IAAA,CAATS,SAAS;EAET,IAAMC,mBAAmB,GAAGN,MAAM,CAACM,mBAAmB,KAAK,KAAK;EAChE,IAAMC,iBAAiB,GAAGC,OAAO,CAC7BF,mBAAmB,IAAIN,MAAM,CAACS,UAAU,MAAAZ,aAAA,GAAIG,MAAM,CAACU,KAAK,cAAAb,aAAA,uBAAZA,aAAA,CAAcc,IAAI,CAAC,CAAC,CACpE,CAAC;EACD,IAAMC,UAAU,GAAGL,iBAAiB,GAAG,QAAQ,GAAG,SAAS;EAE3D,oBACI,IAAAM,eAAA,EAACC,sBAAa;IACVT,SAAS,EAAEb,KAAK,CAAC,IAAI,EAAEa,SAAS,CAAE;IAClCP,KAAK,EAAEA,KAAK,IAAI,IAAAiB,aAAI,EAAC,iBAAiB,CAAE;IACxChB,IAAI,EAAEA,IAAK;IACXiB,MAAM,eACF,IAAAH,eAAA,EAACI,sBAAa;MACVjB,MAAM,EAAEA,MAAM,CAACU,KAAM;MACrBD,UAAU,EAAET,MAAM,CAACS,UAAW;MAC9BH,mBAAmB,EAAEA,mBAAoB;MACzCY,QAAQ,EAAElB,MAAM,CAACkB,QAAS;MAC1BjB,MAAM,EAAEA,MAAO;MACfkB,QAAQ,EAAEnB,MAAM,CAACmB;IAAS,CAC7B,CACJ;IAAAC,QAAA,eAED,IAAAP,eAAA,EAACQ,iBAAQ;MAELnB,KAAK,EAAEA,KAAM;MACbU,UAAU,EAAEA,UAAW;MACvBT,aAAa,EAAEA,aAAc;MAC7BmB,SAAS,EAAE,SAAXA,SAASA,CAAGC,IAAI;QAAA,oBAAK,IAAAV,eAAA,EAACW,sCAAkB,MAAAC,sBAAA,MAAKF,IAAI,CAAG,CAAC;MAAA,CAAC;MACtDG,eAAe,EAAElB,OAAO,CAACP,MAAM,CAAE;MACjC0B,WAAW,EAAEvB;IAAgB,GANxB,IAAAwB,sBAAU,EAAC1B,KAAK,EAAEU,UAAU,CAOpC;EAAC,CACS,CAAC;AAExB,CAAC","ignoreList":[]}
|
|
@@ -5,7 +5,7 @@ import "core-js/modules/es.array.reduce.js";
|
|
|
5
5
|
import "core-js/modules/es.iterator.constructor.js";
|
|
6
6
|
import "core-js/modules/es.iterator.reduce.js";
|
|
7
7
|
import "core-js/modules/es.object.to-string.js";
|
|
8
|
-
import React, { useMemo } from 'react';
|
|
8
|
+
import React, { useLayoutEffect, useMemo, useRef } from 'react';
|
|
9
9
|
import { List } from '@gravity-ui/uikit';
|
|
10
10
|
import cn from 'bem-cn-lite';
|
|
11
11
|
import { useLoadMoreSentinel } from "../../helpers/useLoadMoreSentinel";
|
|
@@ -32,7 +32,9 @@ export var LazyList = function LazyList(_ref) {
|
|
|
32
32
|
emptyContent = _ref.emptyContent,
|
|
33
33
|
isEmpty = _ref.isEmpty,
|
|
34
34
|
className = _ref.className;
|
|
35
|
-
var
|
|
35
|
+
var listRef = useRef(null);
|
|
36
|
+
var previousItemsLengthRef = useRef(items.length);
|
|
37
|
+
var sentinelRef = useLoadMoreSentinel(hasMore, onLoadMore, loading, items.length);
|
|
36
38
|
var rows = useMemo(function () {
|
|
37
39
|
return hasMore ? [].concat(_toConsumableArray(items), [{
|
|
38
40
|
__sentinel: true
|
|
@@ -41,6 +43,14 @@ export var LazyList = function LazyList(_ref) {
|
|
|
41
43
|
var getRowHeight = function getRowHeight(row) {
|
|
42
44
|
return isSentinelRow(row) ? SENTINEL_ROW_HEIGHT : itemHeight(row);
|
|
43
45
|
};
|
|
46
|
+
useLayoutEffect(function () {
|
|
47
|
+
var previousItemsLength = previousItemsLengthRef.current;
|
|
48
|
+
if (previousItemsLength !== items.length) {
|
|
49
|
+
var _listRef$current;
|
|
50
|
+
(_listRef$current = listRef.current) === null || _listRef$current === void 0 || (_listRef$current = _listRef$current.refContainer.current) === null || _listRef$current === void 0 || _listRef$current.resetAfterIndex(Math.min(previousItemsLength, items.length), true);
|
|
51
|
+
previousItemsLengthRef.current = items.length;
|
|
52
|
+
}
|
|
53
|
+
}, [items.length]);
|
|
44
54
|
if (error) {
|
|
45
55
|
return /*#__PURE__*/_jsx(React.Fragment, {
|
|
46
56
|
children: error
|
|
@@ -58,6 +68,7 @@ export var LazyList = function LazyList(_ref) {
|
|
|
58
68
|
});
|
|
59
69
|
}
|
|
60
70
|
return /*#__PURE__*/_jsx(List, {
|
|
71
|
+
ref: listRef,
|
|
61
72
|
className: block(null, className),
|
|
62
73
|
filterable: filterable,
|
|
63
74
|
items: rows,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useMemo","List","cn","useLoadMoreSentinel","ListSpinner","jsx","_jsx","block","SENTINEL_ROW_HEIGHT","isSentinelRow","row","Boolean","_typeof","LazyList","_ref","items","itemHeight","renderItem","hasMore","onLoadMore","onItemClick","selectedItemIndex","_ref$filterable","filterable","loading","error","emptyContent","isEmpty","className","sentinelRef","rows","concat","_toConsumableArray","__sentinel","getRowHeight","Fragment","children","empty","
|
|
1
|
+
{"version":3,"names":["React","useLayoutEffect","useMemo","useRef","List","cn","useLoadMoreSentinel","ListSpinner","jsx","_jsx","block","SENTINEL_ROW_HEIGHT","isSentinelRow","row","Boolean","_typeof","LazyList","_ref","items","itemHeight","renderItem","hasMore","onLoadMore","onItemClick","selectedItemIndex","_ref$filterable","filterable","loading","error","emptyContent","isEmpty","className","listRef","previousItemsLengthRef","length","sentinelRef","rows","concat","_toConsumableArray","__sentinel","getRowHeight","previousItemsLength","current","_listRef$current","refContainer","resetAfterIndex","Math","min","Fragment","children","empty","ref","itemsHeight","listRows","reduce","total","isActive","index"],"sources":["LazyList.tsx"],"sourcesContent":["import React, {useLayoutEffect, useMemo, useRef} from 'react';\nimport {List} from '@gravity-ui/uikit';\nimport cn from 'bem-cn-lite';\nimport {useLoadMoreSentinel} from '../../helpers/useLoadMoreSentinel';\nimport {ListSpinner} from '../ListSpinner';\nimport './LazyList.scss';\n\nconst block = cn('qp-lazy-list');\n\nconst SENTINEL_ROW_HEIGHT = 1;\n\ntype SentinelRow = {__sentinel: true};\ntype LazyListRow<T> = T | SentinelRow;\n\nconst isSentinelRow = <T,>(row: LazyListRow<T>): row is SentinelRow =>\n Boolean(row) && typeof row === 'object' && '__sentinel' in (row as object);\n\nexport type LazyListProps<T extends object> = {\n items: T[];\n itemHeight: (item: T) => number;\n renderItem: (item: T, isActive: boolean, index: number) => React.ReactNode;\n hasMore?: boolean;\n onLoadMore?: () => void;\n onItemClick?: (item: T, index: number) => void;\n selectedItemIndex?: T[keyof T] | number;\n filterable?: boolean;\n loading?: boolean;\n error?: React.ReactNode;\n emptyContent?: React.ReactNode;\n isEmpty?: boolean;\n className?: string;\n};\n\nexport const LazyList = <T extends object>({\n items,\n itemHeight,\n renderItem,\n hasMore,\n onLoadMore,\n onItemClick,\n selectedItemIndex,\n filterable = false,\n loading,\n error,\n emptyContent,\n isEmpty,\n className,\n}: LazyListProps<T>) => {\n const listRef = useRef<List<LazyListRow<T>>>(null);\n const previousItemsLengthRef = useRef(items.length);\n const sentinelRef = useLoadMoreSentinel(hasMore, onLoadMore, loading, items.length);\n\n const rows: LazyListRow<T>[] = useMemo(\n () => (hasMore ? [...items, {__sentinel: true}] : items),\n [items, hasMore],\n );\n\n const getRowHeight = (row: LazyListRow<T>) =>\n isSentinelRow(row) ? SENTINEL_ROW_HEIGHT : itemHeight(row);\n\n useLayoutEffect(() => {\n const previousItemsLength = previousItemsLengthRef.current;\n\n if (previousItemsLength !== items.length) {\n listRef.current?.refContainer.current?.resetAfterIndex(\n Math.min(previousItemsLength, items.length),\n true,\n );\n previousItemsLengthRef.current = items.length;\n }\n }, [items.length]);\n\n if (error) {\n return <React.Fragment>{error}</React.Fragment>;\n }\n\n const empty = isEmpty ?? !items.length;\n\n if (loading && empty) {\n return <ListSpinner className={block('spinner', className)} />;\n }\n\n if (empty) {\n return <React.Fragment>{emptyContent}</React.Fragment>;\n }\n\n return (\n <List<LazyListRow<T>>\n ref={listRef}\n className={block(null, className)}\n filterable={filterable}\n items={rows}\n itemHeight={getRowHeight}\n itemsHeight={(listRows) =>\n listRows.reduce((total, row) => total + getRowHeight(row), 0)\n }\n renderItem={(row, isActive, index) =>\n isSentinelRow(row) ? (\n <div ref={sentinelRef} className={block('sentinel')} />\n ) : (\n renderItem(row, isActive, index)\n )\n }\n selectedItemIndex={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,GAAG,EAAE4C,KAAK,CAAC;MAC7B;IACJ;EAAE,CACL,CAAC;AAEV,CAAC","ignoreList":[]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { FC
|
|
1
|
+
import React, { FC } from 'react';
|
|
2
|
+
import { QueryListLinkRenderer } from '../../types/queryList';
|
|
2
3
|
import './RowLink.scss';
|
|
3
|
-
export type RowLinkProps = {
|
|
4
|
+
export type RowLinkProps = Omit<React.ComponentPropsWithoutRef<'a'>, 'href'> & {
|
|
4
5
|
href?: string;
|
|
5
6
|
disabled?: boolean;
|
|
6
|
-
|
|
7
|
-
children: ReactNode;
|
|
7
|
+
renderLink?: QueryListLinkRenderer;
|
|
8
8
|
};
|
|
9
9
|
export declare const RowLink: FC<RowLinkProps>;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["href", "disabled", "renderLink", "className", "children"];
|
|
1
4
|
import React from 'react';
|
|
2
5
|
import cn from 'bem-cn-lite';
|
|
3
6
|
import "./RowLink.css";
|
|
@@ -6,14 +9,22 @@ var block = cn('qp-row-link');
|
|
|
6
9
|
export var RowLink = function RowLink(_ref) {
|
|
7
10
|
var href = _ref.href,
|
|
8
11
|
disabled = _ref.disabled,
|
|
12
|
+
renderLink = _ref.renderLink,
|
|
9
13
|
className = _ref.className,
|
|
10
|
-
children = _ref.children
|
|
14
|
+
children = _ref.children,
|
|
15
|
+
linkProps = _objectWithoutProperties(_ref, _excluded);
|
|
11
16
|
var isLink = Boolean(href) && !disabled;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
17
|
+
if (!isLink) {
|
|
18
|
+
return /*#__PURE__*/_jsx("div", {
|
|
19
|
+
className: block(null, className),
|
|
20
|
+
children: children
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
var props = _objectSpread(_objectSpread({}, linkProps), {}, {
|
|
24
|
+
href: href,
|
|
15
25
|
className: block(null, className),
|
|
16
26
|
children: children
|
|
17
27
|
});
|
|
28
|
+
return renderLink ? renderLink(props) : /*#__PURE__*/_jsx("a", _objectSpread({}, props));
|
|
18
29
|
};
|
|
19
30
|
// #sourceMappingURL=RowLink.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","cn","jsx","_jsx","block","RowLink","_ref","href","disabled","className","children","isLink","Boolean","
|
|
1
|
+
{"version":3,"names":["React","cn","jsx","_jsx","block","RowLink","_ref","href","disabled","renderLink","className","children","linkProps","_objectWithoutProperties","_excluded","isLink","Boolean","props","_objectSpread"],"sources":["RowLink.tsx"],"sourcesContent":["import React, {FC} from 'react';\nimport cn from 'bem-cn-lite';\nimport {QueryListLinkRenderer} from '../../types/queryList';\nimport './RowLink.scss';\n\nconst block = cn('qp-row-link');\n\nexport type RowLinkProps = Omit<React.ComponentPropsWithoutRef<'a'>, 'href'> & {\n href?: string;\n disabled?: boolean;\n renderLink?: QueryListLinkRenderer;\n};\n\nexport const RowLink: FC<RowLinkProps> = ({\n href,\n disabled,\n renderLink,\n className,\n children,\n ...linkProps\n}) => {\n const isLink = Boolean(href) && !disabled;\n\n if (!isLink) {\n return <div className={block(null, className)}>{children}</div>;\n }\n\n const props: React.ComponentPropsWithoutRef<'a'> = {\n ...linkProps,\n href,\n className: block(null, className),\n children,\n };\n\n return renderLink ? renderLink(props) : <a {...props} />;\n};\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAY,OAAO;AAC/B,OAAOC,EAAE,MAAM,aAAa;AAE5B;AAAwB,SAAAC,GAAA,IAAAC,IAAA;AAExB,IAAMC,KAAK,GAAGH,EAAE,CAAC,aAAa,CAAC;AAQ/B,OAAO,IAAMI,OAAyB,GAAG,SAA5BA,OAAyBA,CAAAC,IAAA,EAOhC;EAAA,IANFC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IACJC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,UAAU,GAAAH,IAAA,CAAVG,UAAU;IACVC,SAAS,GAAAJ,IAAA,CAATI,SAAS;IACTC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;IACLC,SAAS,GAAAC,wBAAA,CAAAP,IAAA,EAAAQ,SAAA;EAEZ,IAAMC,MAAM,GAAGC,OAAO,CAACT,IAAI,CAAC,IAAI,CAACC,QAAQ;EAEzC,IAAI,CAACO,MAAM,EAAE;IACT,oBAAOZ,IAAA;MAAKO,SAAS,EAAEN,KAAK,CAAC,IAAI,EAAEM,SAAS,CAAE;MAAAC,QAAA,EAAEA;IAAQ,CAAM,CAAC;EACnE;EAEA,IAAMM,KAA0C,GAAAC,aAAA,CAAAA,aAAA,KACzCN,SAAS;IACZL,IAAI,EAAJA,IAAI;IACJG,SAAS,EAAEN,KAAK,CAAC,IAAI,EAAEM,SAAS,CAAC;IACjCC,QAAQ,EAARA;EAAQ,EACX;EAED,OAAOF,UAAU,GAAGA,UAAU,CAACQ,KAAK,CAAC,gBAAGd,IAAA,MAAAe,aAAA,KAAOD,KAAK,CAAG,CAAC;AAC5D,CAAC","ignoreList":[]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { QueryListLinkRenderer } from '../../types/queryList';
|
|
2
3
|
import './SearchRowLayout.scss';
|
|
3
4
|
export type SearchRowLayoutProps = {
|
|
4
5
|
header: ReactNode;
|
|
@@ -6,6 +7,7 @@ export type SearchRowLayoutProps = {
|
|
|
6
7
|
language: string;
|
|
7
8
|
href?: string;
|
|
8
9
|
disabled?: boolean;
|
|
10
|
+
renderLink?: QueryListLinkRenderer;
|
|
9
11
|
className?: string;
|
|
10
12
|
};
|
|
11
13
|
export declare const SearchRowLayout: FC<SearchRowLayoutProps>;
|