@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
|
@@ -15,7 +15,7 @@ require("core-js/modules/es.string.trim.js");
|
|
|
15
15
|
var _react = _interopRequireDefault(require("react"));
|
|
16
16
|
var _bemCnLite = _interopRequireDefault(require("bem-cn-lite"));
|
|
17
17
|
var _components = require("../../components");
|
|
18
|
-
var
|
|
18
|
+
var _useListKey = require("../../helpers/useListKey");
|
|
19
19
|
var _HistoryComparisonActions = require("../HistoryComparisonActions");
|
|
20
20
|
var _HistoryHeader = require("../HistoryHeader");
|
|
21
21
|
var _HistoryLayout = require("../HistoryLayout");
|
|
@@ -38,9 +38,15 @@ var QueriesList = exports.QueriesList = function QueriesList(_ref) {
|
|
|
38
38
|
getRowActions = _ref.getRowActions,
|
|
39
39
|
renderRow = _ref.renderRow,
|
|
40
40
|
onListItemClick = _ref.onListItemClick,
|
|
41
|
+
hasMore = _ref.hasMore,
|
|
42
|
+
loading = _ref.loading,
|
|
43
|
+
onLoadMore = _ref.onLoadMore,
|
|
44
|
+
renderLink = _ref.renderLink,
|
|
41
45
|
className = _ref.className;
|
|
42
|
-
var
|
|
46
|
+
var fullSearchAvailable = search.fullSearchAvailable !== false;
|
|
47
|
+
var showSearchResults = Boolean(fullSearchAvailable && search.fullSearch && ((_search$value = search.value) === null || _search$value === void 0 ? void 0 : _search$value.trim()));
|
|
43
48
|
var rowVariant = showSearchResults ? 'search' : 'default';
|
|
49
|
+
var listKey = (0, _useListKey.useListKey)(items, rowVariant, Boolean(onLoadMore));
|
|
44
50
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_HistoryLayout.HistoryLayout, {
|
|
45
51
|
className: block(null, className),
|
|
46
52
|
title: title,
|
|
@@ -50,6 +56,7 @@ var QueriesList = exports.QueriesList = function QueriesList(_ref) {
|
|
|
50
56
|
className: block('header'),
|
|
51
57
|
search: search.value,
|
|
52
58
|
fullSearch: search.fullSearch,
|
|
59
|
+
fullSearchAvailable: fullSearchAvailable,
|
|
53
60
|
hasClear: search.hasClear,
|
|
54
61
|
filter: filter,
|
|
55
62
|
onUpdate: search.onUpdate
|
|
@@ -68,8 +75,12 @@ var QueriesList = exports.QueriesList = function QueriesList(_ref) {
|
|
|
68
75
|
getRowActions: getRowActions,
|
|
69
76
|
renderRow: renderRow,
|
|
70
77
|
showFiltersHint: Boolean(filter),
|
|
78
|
+
hasMore: hasMore,
|
|
79
|
+
loading: loading,
|
|
80
|
+
onLoadMore: onLoadMore,
|
|
81
|
+
renderLink: renderLink,
|
|
71
82
|
onItemClick: onListItemClick
|
|
72
|
-
},
|
|
83
|
+
}, listKey)
|
|
73
84
|
});
|
|
74
85
|
};
|
|
75
86
|
// #sourceMappingURL=QueriesList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_bemCnLite","_components","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_bemCnLite","_components","_useListKey","_HistoryComparisonActions","_HistoryHeader","_HistoryLayout","_RowsList","_jsxRuntime","e","__esModule","default","block","cn","QueriesList","exports","_ref","_search$value","title","logo","search","filter","items","selectedRowId","editing","comparison","visibleFields","getRowActions","renderRow","onListItemClick","hasMore","loading","onLoadMore","renderLink","className","fullSearchAvailable","showSearchResults","Boolean","fullSearch","value","trim","rowVariant","listKey","useListKey","_jsx","HistoryLayout","actions","FieldsSelector","_objectSpread","header","HistoryHeader","hasClear","onUpdate","footer","HistoryComparisonActions","children","RowsList","showFiltersHint","onItemClick"],"sources":["QueriesList.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'bem-cn-lite';\nimport {FieldsSelector} from '../../components';\nimport {useListKey} from '../../helpers/useListKey';\nimport {\n QueryListComparisonConfig,\n QueryListEditingConfig,\n QueryListFilterConfig,\n QueryListItem,\n QueryListLinkRenderer,\n QueryListRow,\n QueryListRowAction,\n QueryListRowRenderData,\n QueryListSearchConfig,\n QueryListVisibleFieldsConfig,\n} from '../../types/queryList';\nimport {HistoryComparisonActions} from '../HistoryComparisonActions';\nimport {HistoryHeader} from '../HistoryHeader';\nimport {HistoryLayout} from '../HistoryLayout';\nimport {RowsList} from '../RowsList';\nimport './QueriesList.scss';\n\nconst block = cn('qp-queries-list');\n\nexport type QueriesListProps<T extends QueryListRow> = {\n className?: string;\n title: React.ReactNode;\n logo?: React.ReactNode;\n search: QueryListSearchConfig;\n filter?: QueryListFilterConfig;\n items: QueryListItem<T>[];\n selectedRowId?: T['id'];\n editing?: QueryListEditingConfig<T>;\n comparison?: QueryListComparisonConfig<T>;\n visibleFields?: QueryListVisibleFieldsConfig<T>;\n getRowActions?: (item: T) => QueryListRowAction<T>[];\n renderRow: (data: QueryListRowRenderData<T>) => React.ReactNode;\n onListItemClick?: (item: QueryListItem<T>) => void;\n hasMore?: boolean;\n loading?: boolean;\n onLoadMore?: () => void;\n renderLink?: QueryListLinkRenderer;\n};\n\nexport const QueriesList = <T extends QueryListRow>({\n title,\n logo,\n search,\n filter,\n items,\n selectedRowId,\n editing,\n comparison,\n visibleFields,\n getRowActions,\n renderRow,\n onListItemClick,\n hasMore,\n loading,\n onLoadMore,\n renderLink,\n className,\n}: QueriesListProps<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 const listKey = useListKey(items, rowVariant, Boolean(onLoadMore));\n\n return (\n <HistoryLayout\n className={block(null, className)}\n title={title}\n logo={logo}\n actions={visibleFields && <FieldsSelector {...visibleFields} />}\n header={\n <HistoryHeader\n className={block('header')}\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 footer={\n comparison && (\n <HistoryComparisonActions\n comparison={comparison}\n className={block('comparison-actions')}\n />\n )\n }\n >\n <RowsList\n key={listKey}\n items={items}\n rowVariant={rowVariant}\n selectedRowId={selectedRowId}\n visibleFields={visibleFields}\n editing={editing}\n comparison={comparison}\n getRowActions={getRowActions}\n renderRow={renderRow}\n showFiltersHint={Boolean(filter)}\n hasMore={hasMore}\n loading={loading}\n onLoadMore={onLoadMore}\n renderLink={renderLink}\n onItemClick={onListItemClick}\n />\n </HistoryLayout>\n );\n};\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { QueryListComparisonConfig, QueryListEditingConfig, QueryListItem, QueryListRow, QueryListRowAction, QueryListRowRenderData, QueryListRowVariant, QueryListVisibleFieldsConfig } from '../../types/queryList';
|
|
2
|
+
import { QueryListComparisonConfig, QueryListEditingConfig, QueryListItem, QueryListLinkRenderer, QueryListRow, QueryListRowAction, QueryListRowRenderData, QueryListRowVariant, QueryListVisibleFieldsConfig } from '../../types/queryList';
|
|
3
3
|
import './RowsList.scss';
|
|
4
4
|
export type RowsListProps<T extends QueryListRow> = {
|
|
5
5
|
items: QueryListItem<T>[];
|
|
@@ -11,7 +11,11 @@ export type RowsListProps<T extends QueryListRow> = {
|
|
|
11
11
|
getRowActions?: (item: T) => QueryListRowAction<T>[];
|
|
12
12
|
renderRow: (data: QueryListRowRenderData<T>) => React.ReactNode;
|
|
13
13
|
showFiltersHint?: boolean;
|
|
14
|
+
hasMore?: boolean;
|
|
15
|
+
loading?: boolean;
|
|
16
|
+
onLoadMore?: () => void;
|
|
17
|
+
renderLink?: QueryListLinkRenderer;
|
|
14
18
|
className?: string;
|
|
15
19
|
onItemClick?: (item: QueryListItem<T>, index: number) => void;
|
|
16
20
|
};
|
|
17
|
-
export declare const RowsList: <T extends QueryListRow>({ items, selectedRowId, rowVariant, visibleFields, editing, comparison, getRowActions, renderRow, showFiltersHint, className, onItemClick, }: RowsListProps<T>) => React.JSX.Element;
|
|
21
|
+
export declare const RowsList: <T extends QueryListRow>({ items, selectedRowId, rowVariant, visibleFields, editing, comparison, getRowActions, renderRow, showFiltersHint, hasMore, loading, onLoadMore, renderLink, className, onItemClick, }: RowsListProps<T>) => React.JSX.Element;
|
|
@@ -27,6 +27,10 @@ var RowsList = exports.RowsList = function RowsList(_ref) {
|
|
|
27
27
|
getRowActions = _ref.getRowActions,
|
|
28
28
|
renderRow = _ref.renderRow,
|
|
29
29
|
showFiltersHint = _ref.showFiltersHint,
|
|
30
|
+
hasMore = _ref.hasMore,
|
|
31
|
+
loading = _ref.loading,
|
|
32
|
+
onLoadMore = _ref.onLoadMore,
|
|
33
|
+
renderLink = _ref.renderLink,
|
|
30
34
|
className = _ref.className,
|
|
31
35
|
onItemClick = _ref.onItemClick;
|
|
32
36
|
var getItemHeight = function getItemHeight(item) {
|
|
@@ -43,12 +47,6 @@ var RowsList = exports.RowsList = function RowsList(_ref) {
|
|
|
43
47
|
var selected = comparison.comparedRowIds.includes(item.id);
|
|
44
48
|
comparison.onChange(item, !selected);
|
|
45
49
|
};
|
|
46
|
-
if (!items.length) {
|
|
47
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.EmptyContent, {
|
|
48
|
-
variant: showFiltersHint ? 'nothing-found' : 'no-files',
|
|
49
|
-
className: className
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
50
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.LazyList, {
|
|
53
51
|
className: block(null, className),
|
|
54
52
|
items: items,
|
|
@@ -62,10 +60,18 @@ var RowsList = exports.RowsList = function RowsList(_ref) {
|
|
|
62
60
|
visibleFields: visibleFields,
|
|
63
61
|
editing: editing,
|
|
64
62
|
comparison: comparison,
|
|
65
|
-
getRowActions: getRowActions
|
|
63
|
+
getRowActions: getRowActions,
|
|
64
|
+
renderLink: renderLink
|
|
66
65
|
}));
|
|
67
66
|
},
|
|
68
67
|
selectedItemIndex: selectedItemIndex,
|
|
68
|
+
hasMore: hasMore,
|
|
69
|
+
loading: loading,
|
|
70
|
+
onLoadMore: onLoadMore,
|
|
71
|
+
emptyContent: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.EmptyContent, {
|
|
72
|
+
variant: showFiltersHint ? 'nothing-found' : 'no-files',
|
|
73
|
+
className: className
|
|
74
|
+
}),
|
|
69
75
|
onItemClick: handleItemClick
|
|
70
76
|
});
|
|
71
77
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_bemCnLite","_components","_prepareRowData","_row","_jsxRuntime","e","__esModule","default","block","cn","RowsList","exports","_ref","items","selectedRowId","_ref$rowVariant","rowVariant","visibleFields","editing","comparison","getRowActions","renderRow","showFiltersHint","className","onItemClick","getItemHeight","item","SEARCH_ROW_HEIGHT","height","selectedItemIndex","undefined","findIndex","id","handleItemClick","index","enabled","selected","comparedRowIds","includes","onChange","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_bemCnLite","_components","_prepareRowData","_row","_jsxRuntime","e","__esModule","default","block","cn","RowsList","exports","_ref","items","selectedRowId","_ref$rowVariant","rowVariant","visibleFields","editing","comparison","getRowActions","renderRow","showFiltersHint","hasMore","loading","onLoadMore","renderLink","className","onItemClick","getItemHeight","item","SEARCH_ROW_HEIGHT","height","selectedItemIndex","undefined","findIndex","id","handleItemClick","index","enabled","selected","comparedRowIds","includes","onChange","_jsx","LazyList","itemHeight","renderItem","isActive","prepareRowData","variant","emptyContent","EmptyContent"],"sources":["RowsList.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'bem-cn-lite';\nimport {\n QueryListComparisonConfig,\n QueryListEditingConfig,\n QueryListItem,\n QueryListLinkRenderer,\n QueryListRow,\n QueryListRowAction,\n QueryListRowRenderData,\n QueryListRowVariant,\n QueryListVisibleFieldsConfig,\n} from '../../types/queryList';\nimport {EmptyContent, LazyList} from '../../components';\nimport {prepareRowData} from './helpers/prepareRowData';\nimport {SEARCH_ROW_HEIGHT} from '../../constants/row';\nimport './RowsList.scss';\n\nconst block = cn('qp-rows-list');\n\nexport type RowsListProps<T extends QueryListRow> = {\n items: QueryListItem<T>[];\n selectedRowId?: T['id'];\n rowVariant?: QueryListRowVariant;\n visibleFields?: QueryListVisibleFieldsConfig<T>;\n editing?: QueryListEditingConfig<T>;\n comparison?: QueryListComparisonConfig<T>;\n getRowActions?: (item: T) => QueryListRowAction<T>[];\n renderRow: (data: QueryListRowRenderData<T>) => React.ReactNode;\n showFiltersHint?: boolean;\n hasMore?: boolean;\n loading?: boolean;\n onLoadMore?: () => void;\n renderLink?: QueryListLinkRenderer;\n className?: string;\n onItemClick?: (item: QueryListItem<T>, index: number) => void;\n};\n\nexport const RowsList = <T extends QueryListRow>({\n items,\n selectedRowId,\n rowVariant = 'default',\n visibleFields,\n editing,\n comparison,\n getRowActions,\n renderRow,\n showFiltersHint,\n hasMore,\n loading,\n onLoadMore,\n renderLink,\n className,\n onItemClick,\n}: RowsListProps<T>) => {\n const getItemHeight = (item: QueryListItem<T>) =>\n rowVariant === 'search' && !('header' in item) ? SEARCH_ROW_HEIGHT : item.height;\n const selectedItemIndex =\n selectedRowId === undefined\n ? undefined\n : items.findIndex((item) => !('header' in item) && item.id === selectedRowId);\n\n const handleItemClick = (item: QueryListItem<T>, index: number) => {\n if ('header' in item || !comparison?.enabled) {\n onItemClick?.(item, index);\n return;\n }\n\n const selected = comparison.comparedRowIds.includes(item.id);\n comparison.onChange(item, !selected);\n };\n\n return (\n <LazyList<QueryListItem<T>>\n className={block(null, className)}\n items={items}\n itemHeight={getItemHeight}\n renderItem={(item, isActive, index) =>\n renderRow(\n prepareRowData({\n item,\n isActive,\n index,\n variant: rowVariant,\n visibleFields,\n editing,\n comparison,\n getRowActions,\n renderLink,\n }),\n )\n }\n selectedItemIndex={selectedItemIndex}\n hasMore={hasMore}\n loading={loading}\n onLoadMore={onLoadMore}\n emptyContent={\n <EmptyContent\n variant={showFiltersHint ? 'nothing-found' : 'no-files'}\n className={className}\n />\n }\n onItemClick={handleItemClick}\n />\n );\n};\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { QueryListComparisonConfig, QueryListEditingConfig, QueryListItem, QueryListRow, QueryListRowAction, QueryListRowRenderData, QueryListRowVariant, QueryListVisibleFieldsConfig } from '../../../types/queryList';
|
|
1
|
+
import { QueryListComparisonConfig, QueryListEditingConfig, QueryListItem, QueryListLinkRenderer, QueryListRow, QueryListRowAction, QueryListRowRenderData, QueryListRowVariant, QueryListVisibleFieldsConfig } from '../../../types/queryList';
|
|
2
2
|
type Props<T extends QueryListRow> = {
|
|
3
3
|
item: QueryListItem<T>;
|
|
4
4
|
isActive: boolean;
|
|
@@ -8,6 +8,7 @@ type Props<T extends QueryListRow> = {
|
|
|
8
8
|
editing?: QueryListEditingConfig<T>;
|
|
9
9
|
comparison?: QueryListComparisonConfig<T>;
|
|
10
10
|
getRowActions?: (item: T) => QueryListRowAction<T>[];
|
|
11
|
+
renderLink?: QueryListLinkRenderer;
|
|
11
12
|
};
|
|
12
|
-
export declare const prepareRowData: <T extends QueryListRow>({ item, isActive, index, variant, visibleFields, editing, comparison, getRowActions, }: Props<T>) => QueryListRowRenderData<T>;
|
|
13
|
+
export declare const prepareRowData: <T extends QueryListRow>({ item, isActive, index, variant, visibleFields, editing, comparison, getRowActions, renderLink, }: Props<T>) => QueryListRowRenderData<T>;
|
|
13
14
|
export {};
|
|
@@ -14,7 +14,8 @@ var prepareRowData = exports.prepareRowData = function prepareRowData(_ref) {
|
|
|
14
14
|
visibleFields = _ref.visibleFields,
|
|
15
15
|
editing = _ref.editing,
|
|
16
16
|
comparison = _ref.comparison,
|
|
17
|
-
getRowActions = _ref.getRowActions
|
|
17
|
+
getRowActions = _ref.getRowActions,
|
|
18
|
+
renderLink = _ref.renderLink;
|
|
18
19
|
var isRow = !('header' in item);
|
|
19
20
|
var actions = isRow && getRowActions ? getRowActions(item) : undefined;
|
|
20
21
|
var editingData = isRow && editing ? {
|
|
@@ -34,7 +35,8 @@ var prepareRowData = exports.prepareRowData = function prepareRowData(_ref) {
|
|
|
34
35
|
visibleFields: visibleFields,
|
|
35
36
|
actions: actions,
|
|
36
37
|
editing: editingData,
|
|
37
|
-
comparison: comparisonData
|
|
38
|
+
comparison: comparisonData,
|
|
39
|
+
renderLink: renderLink
|
|
38
40
|
};
|
|
39
41
|
};
|
|
40
42
|
// #sourceMappingURL=prepareRowData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["prepareRowData","exports","_ref","item","isActive","index","variant","visibleFields","editing","comparison","getRowActions","isRow","actions","undefined","editingData","enabled","rowId","id","onSubmit","onCancel","comparisonData","checked","comparedRowIds","includes"],"sources":["prepareRowData.ts"],"sourcesContent":["import {\n QueryListComparisonConfig,\n QueryListEditingConfig,\n QueryListItem,\n QueryListRow,\n QueryListRowAction,\n QueryListRowRenderData,\n QueryListRowVariant,\n QueryListVisibleFieldsConfig,\n} from '../../../types/queryList';\n\ntype Props<T extends QueryListRow> = {\n item: QueryListItem<T>;\n isActive: boolean;\n index: number;\n variant: QueryListRowVariant;\n visibleFields?: QueryListVisibleFieldsConfig<T>;\n editing?: QueryListEditingConfig<T>;\n comparison?: QueryListComparisonConfig<T>;\n getRowActions?: (item: T) => QueryListRowAction<T>[];\n};\n\nexport const prepareRowData = <T extends QueryListRow>({\n item,\n isActive,\n index,\n variant,\n visibleFields,\n editing,\n comparison,\n getRowActions,\n}: Props<T>): QueryListRowRenderData<T> => {\n const isRow = !('header' in item);\n const actions = isRow && getRowActions ? getRowActions(item) : undefined;\n const editingData =\n isRow && editing\n ? {\n enabled: editing.rowId === item.id,\n onSubmit: editing.onSubmit,\n onCancel: editing.onCancel,\n }\n : undefined;\n const comparisonData =\n isRow && comparison && comparison.enabled\n ? {\n enabled: true,\n checked: comparison.comparedRowIds.includes(item.id),\n }\n : undefined;\n\n return {\n item,\n index,\n isActive,\n variant,\n visibleFields,\n actions,\n editing: editingData,\n comparison: comparisonData,\n };\n};\n"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"names":["prepareRowData","exports","_ref","item","isActive","index","variant","visibleFields","editing","comparison","getRowActions","renderLink","isRow","actions","undefined","editingData","enabled","rowId","id","onSubmit","onCancel","comparisonData","checked","comparedRowIds","includes"],"sources":["prepareRowData.ts"],"sourcesContent":["import {\n QueryListComparisonConfig,\n QueryListEditingConfig,\n QueryListItem,\n QueryListLinkRenderer,\n QueryListRow,\n QueryListRowAction,\n QueryListRowRenderData,\n QueryListRowVariant,\n QueryListVisibleFieldsConfig,\n} from '../../../types/queryList';\n\ntype Props<T extends QueryListRow> = {\n item: QueryListItem<T>;\n isActive: boolean;\n index: number;\n variant: QueryListRowVariant;\n visibleFields?: QueryListVisibleFieldsConfig<T>;\n editing?: QueryListEditingConfig<T>;\n comparison?: QueryListComparisonConfig<T>;\n getRowActions?: (item: T) => QueryListRowAction<T>[];\n renderLink?: QueryListLinkRenderer;\n};\n\nexport const prepareRowData = <T extends QueryListRow>({\n item,\n isActive,\n index,\n variant,\n visibleFields,\n editing,\n comparison,\n getRowActions,\n renderLink,\n}: Props<T>): QueryListRowRenderData<T> => {\n const isRow = !('header' in item);\n const actions = isRow && getRowActions ? getRowActions(item) : undefined;\n const editingData =\n isRow && editing\n ? {\n enabled: editing.rowId === item.id,\n onSubmit: editing.onSubmit,\n onCancel: editing.onCancel,\n }\n : undefined;\n const comparisonData =\n isRow && comparison && comparison.enabled\n ? {\n enabled: true,\n checked: comparison.comparedRowIds.includes(item.id),\n }\n : undefined;\n\n return {\n item,\n index,\n isActive,\n variant,\n visibleFields,\n actions,\n editing: editingData,\n comparison: comparisonData,\n renderLink,\n };\n};\n"],"mappings":";;;;;;;;AAwBO,IAAMA,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAG,SAAjBA,cAAcA,CAAAE,IAAA,EAUgB;EAAA,IATvCC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IACJC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,KAAK,GAAAH,IAAA,CAALG,KAAK;IACLC,OAAO,GAAAJ,IAAA,CAAPI,OAAO;IACPC,aAAa,GAAAL,IAAA,CAAbK,aAAa;IACbC,OAAO,GAAAN,IAAA,CAAPM,OAAO;IACPC,UAAU,GAAAP,IAAA,CAAVO,UAAU;IACVC,aAAa,GAAAR,IAAA,CAAbQ,aAAa;IACbC,UAAU,GAAAT,IAAA,CAAVS,UAAU;EAEV,IAAMC,KAAK,GAAG,EAAE,QAAQ,IAAIT,IAAI,CAAC;EACjC,IAAMU,OAAO,GAAGD,KAAK,IAAIF,aAAa,GAAGA,aAAa,CAACP,IAAI,CAAC,GAAGW,SAAS;EACxE,IAAMC,WAAW,GACbH,KAAK,IAAIJ,OAAO,GACV;IACIQ,OAAO,EAAER,OAAO,CAACS,KAAK,KAAKd,IAAI,CAACe,EAAE;IAClCC,QAAQ,EAAEX,OAAO,CAACW,QAAQ;IAC1BC,QAAQ,EAAEZ,OAAO,CAACY;EACtB,CAAC,GACDN,SAAS;EACnB,IAAMO,cAAc,GAChBT,KAAK,IAAIH,UAAU,IAAIA,UAAU,CAACO,OAAO,GACnC;IACIA,OAAO,EAAE,IAAI;IACbM,OAAO,EAAEb,UAAU,CAACc,cAAc,CAACC,QAAQ,CAACrB,IAAI,CAACe,EAAE;EACvD,CAAC,GACDJ,SAAS;EAEnB,OAAO;IACHX,IAAI,EAAJA,IAAI;IACJE,KAAK,EAALA,KAAK;IACLD,QAAQ,EAARA,QAAQ;IACRE,OAAO,EAAPA,OAAO;IACPC,aAAa,EAAbA,aAAa;IACbM,OAAO,EAAPA,OAAO;IACPL,OAAO,EAAEO,WAAW;IACpBN,UAAU,EAAEY,cAAc;IAC1BV,UAAU,EAAVA;EACJ,CAAC;AACL,CAAC","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import type { ComponentPropsWithoutRef, ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { RegisteredFormFields } from './forms';
|
|
3
3
|
/** ISO 8601 date string or Unix timestamp in milliseconds. */
|
|
4
4
|
export type QueryTimestamp = string | number;
|
|
@@ -16,6 +16,7 @@ export type QueryListRow = {
|
|
|
16
16
|
} & QueryListRowRenderProps;
|
|
17
17
|
export type QueryListItem<T extends QueryListRow = QueryListRow> = QueryListHeader | T;
|
|
18
18
|
export type QueryListRowVariant = 'default' | 'search';
|
|
19
|
+
export type QueryListLinkRenderer = (props: ComponentPropsWithoutRef<'a'>) => ReactElement;
|
|
19
20
|
export type QueryListRowAction<T extends QueryListRow = QueryListRow> = {
|
|
20
21
|
text: ReactNode;
|
|
21
22
|
icon?: ReactNode;
|
|
@@ -27,6 +28,7 @@ export type QueryListRowAction<T extends QueryListRow = QueryListRow> = {
|
|
|
27
28
|
export type QueryListSearchConfig = {
|
|
28
29
|
value?: string;
|
|
29
30
|
fullSearch?: boolean;
|
|
31
|
+
fullSearchAvailable?: boolean;
|
|
30
32
|
hasClear?: boolean;
|
|
31
33
|
onUpdate: (data: {
|
|
32
34
|
value: string;
|
|
@@ -79,5 +81,6 @@ export type QueryListRowRenderData<T extends QueryListRow = QueryListRow> = {
|
|
|
79
81
|
visibleFields?: QueryListVisibleFieldsConfig<T>;
|
|
80
82
|
actions?: QueryListRowAction<T>[];
|
|
81
83
|
editing?: QueryListEditingRenderData<T>;
|
|
84
|
+
renderLink?: QueryListLinkRenderer;
|
|
82
85
|
};
|
|
83
86
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["queryList.ts"],"sourcesContent":["import {ReactNode} from 'react';\nimport {RegisteredFormFields} from './forms';\n\n/** ISO 8601 date string or Unix timestamp in milliseconds. */\nexport type QueryTimestamp = string | number;\n\nexport type QueryListRowRenderProps = {height: number};\n\nexport type QueryListHeader = {header: string} & QueryListRowRenderProps;\n\nexport type QueryListRow = {\n id: number | string;\n title: string;\n query?: string;\n href?: string;\n} & QueryListRowRenderProps;\n\nexport type QueryListItem<T extends QueryListRow = QueryListRow> = QueryListHeader | T;\n\nexport type QueryListRowVariant = 'default' | 'search';\n\nexport type QueryListRowAction<T extends QueryListRow = QueryListRow> = {\n text: ReactNode;\n icon?: ReactNode;\n theme?: 'normal' | 'danger';\n hidden?: boolean;\n disabled?: boolean;\n onClick: (item: T) => void;\n};\n\nexport type QueryListSearchConfig = {\n value?: string;\n fullSearch?: boolean;\n hasClear?: boolean;\n onUpdate: (data: {value: string; fullSearch: boolean}) => void;\n};\n\nexport type QueryListFilterConfig = {\n fields?: RegisteredFormFields[];\n values?: Record<string, any>;\n initialValues?: Record<string, any>;\n isChanged?: boolean;\n onApply?: (values: Record<string, any>) => void;\n onReset?: () => void;\n};\n\nexport type QueryListEditingConfig<T extends QueryListRow = QueryListRow> = {\n rowId?: T['id'];\n onSubmit?: (item: T, title: string) => void;\n onCancel?: (item: T) => void;\n};\n\nexport type QueryListComparisonConfig<T extends QueryListRow = QueryListRow> = {\n enabled: boolean;\n comparedRowIds: T['id'][];\n onChange: (item: T, selected: boolean) => void;\n onCancel: () => void;\n onCompare: () => void;\n};\n\ntype RowFieldKey<T extends QueryListRow> = Exclude<keyof T & string, keyof QueryListRowRenderProps>;\n\nexport type QueryListFieldKey<T extends QueryListRow = QueryListRow> = RowFieldKey<T> | 'duration';\n\nexport type QueryListFieldOption<K extends string = string> = {\n id: K;\n title: ReactNode;\n};\n\nexport type QueryListVisibleFieldsConfig<T extends QueryListRow = QueryListRow> = {\n value: QueryListFieldKey<T>[];\n fields: QueryListFieldOption<QueryListFieldKey<T>>[];\n onChange: (value: QueryListFieldKey<T>[]) => void;\n};\n\nexport type QueryListEditingRenderData<T extends QueryListRow = QueryListRow> = {\n enabled: boolean;\n} & Pick<QueryListEditingConfig<T>, 'onSubmit' | 'onCancel'>;\n\nexport type QueryListRowRenderData<T extends QueryListRow = QueryListRow> = {\n item: QueryListItem<T>;\n index: number;\n isActive: boolean;\n variant: QueryListRowVariant;\n comparison?: {\n enabled: boolean;\n checked: boolean;\n };\n visibleFields?: QueryListVisibleFieldsConfig<T>;\n actions?: QueryListRowAction<T>[];\n editing?: QueryListEditingRenderData<T>;\n};\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["queryList.ts"],"sourcesContent":["import type {ComponentPropsWithoutRef, ReactElement, ReactNode} from 'react';\nimport {RegisteredFormFields} from './forms';\n\n/** ISO 8601 date string or Unix timestamp in milliseconds. */\nexport type QueryTimestamp = string | number;\n\nexport type QueryListRowRenderProps = {height: number};\n\nexport type QueryListHeader = {header: string} & QueryListRowRenderProps;\n\nexport type QueryListRow = {\n id: number | string;\n title: string;\n query?: string;\n href?: string;\n} & QueryListRowRenderProps;\n\nexport type QueryListItem<T extends QueryListRow = QueryListRow> = QueryListHeader | T;\n\nexport type QueryListRowVariant = 'default' | 'search';\n\nexport type QueryListLinkRenderer = (props: ComponentPropsWithoutRef<'a'>) => ReactElement;\n\nexport type QueryListRowAction<T extends QueryListRow = QueryListRow> = {\n text: ReactNode;\n icon?: ReactNode;\n theme?: 'normal' | 'danger';\n hidden?: boolean;\n disabled?: boolean;\n onClick: (item: T) => void;\n};\n\nexport type QueryListSearchConfig = {\n value?: string;\n fullSearch?: boolean;\n fullSearchAvailable?: boolean;\n hasClear?: boolean;\n onUpdate: (data: {value: string; fullSearch: boolean}) => void;\n};\n\nexport type QueryListFilterConfig = {\n fields?: RegisteredFormFields[];\n values?: Record<string, any>;\n initialValues?: Record<string, any>;\n isChanged?: boolean;\n onApply?: (values: Record<string, any>) => void;\n onReset?: () => void;\n};\n\nexport type QueryListEditingConfig<T extends QueryListRow = QueryListRow> = {\n rowId?: T['id'];\n onSubmit?: (item: T, title: string) => void;\n onCancel?: (item: T) => void;\n};\n\nexport type QueryListComparisonConfig<T extends QueryListRow = QueryListRow> = {\n enabled: boolean;\n comparedRowIds: T['id'][];\n onChange: (item: T, selected: boolean) => void;\n onCancel: () => void;\n onCompare: () => void;\n};\n\ntype RowFieldKey<T extends QueryListRow> = Exclude<keyof T & string, keyof QueryListRowRenderProps>;\n\nexport type QueryListFieldKey<T extends QueryListRow = QueryListRow> = RowFieldKey<T> | 'duration';\n\nexport type QueryListFieldOption<K extends string = string> = {\n id: K;\n title: ReactNode;\n};\n\nexport type QueryListVisibleFieldsConfig<T extends QueryListRow = QueryListRow> = {\n value: QueryListFieldKey<T>[];\n fields: QueryListFieldOption<QueryListFieldKey<T>>[];\n onChange: (value: QueryListFieldKey<T>[]) => void;\n};\n\nexport type QueryListEditingRenderData<T extends QueryListRow = QueryListRow> = {\n enabled: boolean;\n} & Pick<QueryListEditingConfig<T>, 'onSubmit' | 'onCancel'>;\n\nexport type QueryListRowRenderData<T extends QueryListRow = QueryListRow> = {\n item: QueryListItem<T>;\n index: number;\n isActive: boolean;\n variant: QueryListRowVariant;\n comparison?: {\n enabled: boolean;\n checked: boolean;\n };\n visibleFields?: QueryListVisibleFieldsConfig<T>;\n actions?: QueryListRowAction<T>[];\n editing?: QueryListEditingRenderData<T>;\n renderLink?: QueryListLinkRenderer;\n};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { QueryListComparisonConfig, QueryListEditingConfig, QueryListFilterConfig, QueryListItem, QueryListRowAction, QueryListRowRenderData, QueryListSearchConfig, QueryListVisibleFieldsConfig } from '../../types/queryList';
|
|
2
|
+
import { QueryListComparisonConfig, QueryListEditingConfig, QueryListFilterConfig, QueryListItem, QueryListLinkRenderer, QueryListRowAction, QueryListRowRenderData, QueryListSearchConfig, QueryListVisibleFieldsConfig } from '../../types/queryList';
|
|
3
3
|
import { QueryHistoryRow } from '../../types/history';
|
|
4
4
|
import './QueriesHistory.scss';
|
|
5
5
|
export type QueriesHistoryProps<T extends QueryHistoryRow = QueryHistoryRow> = {
|
|
@@ -16,5 +16,9 @@ export type QueriesHistoryProps<T extends QueryHistoryRow = QueryHistoryRow> = {
|
|
|
16
16
|
renderRowItem?: (data: QueryListRowRenderData<T>) => React.ReactNode;
|
|
17
17
|
getRowActions?: (item: T) => QueryListRowAction<T>[];
|
|
18
18
|
onListItemClick?: (item: QueryListItem<T>) => void;
|
|
19
|
+
hasMore?: boolean;
|
|
20
|
+
loading?: boolean;
|
|
21
|
+
onLoadMore?: () => void;
|
|
22
|
+
renderLink?: QueryListLinkRenderer;
|
|
19
23
|
};
|
|
20
|
-
export declare const QueriesHistory: <T extends QueryHistoryRow>({ title, logo, search, filter, items, selectedRowId, editing, comparison, visibleFields, renderRowItem, getRowActions, onListItemClick, className, }: QueriesHistoryProps<T>) => React.JSX.Element;
|
|
24
|
+
export declare const QueriesHistory: <T extends QueryHistoryRow>({ title, logo, search, filter, items, selectedRowId, editing, comparison, visibleFields, renderRowItem, getRowActions, onListItemClick, hasMore, loading, onLoadMore, renderLink, className, }: QueriesHistoryProps<T>) => React.JSX.Element;
|
|
@@ -32,6 +32,10 @@ var QueriesHistory = exports.QueriesHistory = function QueriesHistory(_ref) {
|
|
|
32
32
|
renderRowItem = _ref.renderRowItem,
|
|
33
33
|
getRowActions = _ref.getRowActions,
|
|
34
34
|
onListItemClick = _ref.onListItemClick,
|
|
35
|
+
hasMore = _ref.hasMore,
|
|
36
|
+
loading = _ref.loading,
|
|
37
|
+
onLoadMore = _ref.onLoadMore,
|
|
38
|
+
renderLink = _ref.renderLink,
|
|
35
39
|
className = _ref.className;
|
|
36
40
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_modules.QueriesList, {
|
|
37
41
|
className: block(null, className),
|
|
@@ -48,7 +52,11 @@ var QueriesHistory = exports.QueriesHistory = function QueriesHistory(_ref) {
|
|
|
48
52
|
renderRow: function renderRow(data) {
|
|
49
53
|
return renderRowItem ? renderRowItem(data) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_HistoryRowContent.HistoryRowContent, (0, _objectSpread2.default)({}, data));
|
|
50
54
|
},
|
|
51
|
-
onListItemClick: onListItemClick
|
|
55
|
+
onListItemClick: onListItemClick,
|
|
56
|
+
hasMore: hasMore,
|
|
57
|
+
loading: loading,
|
|
58
|
+
onLoadMore: onLoadMore,
|
|
59
|
+
renderLink: renderLink
|
|
52
60
|
});
|
|
53
61
|
};
|
|
54
62
|
// #sourceMappingURL=QueriesHistory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_bemCnLite","_modules","_HistoryRowContent","_jsxRuntime","e","__esModule","default","block","cn","QueriesHistory","exports","_ref","title","logo","search","filter","items","selectedRowId","editing","comparison","visibleFields","renderRowItem","getRowActions","onListItemClick","className","_jsx","QueriesList","renderRow","data","HistoryRowContent","_objectSpread"],"sources":["QueriesHistory.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'bem-cn-lite';\nimport {QueriesList} from '../../modules';\nimport {\n QueryListComparisonConfig,\n QueryListEditingConfig,\n QueryListFilterConfig,\n QueryListItem,\n QueryListRowAction,\n QueryListRowRenderData,\n QueryListSearchConfig,\n QueryListVisibleFieldsConfig,\n} from '../../types/queryList';\nimport {QueryHistoryRow} from '../../types/history';\nimport {HistoryRowContent} from './internal/HistoryRowContent';\nimport './QueriesHistory.scss';\n\nexport type QueriesHistoryProps<T extends QueryHistoryRow = QueryHistoryRow> = {\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 editing?: QueryListEditingConfig<T>;\n comparison?: QueryListComparisonConfig<T>;\n visibleFields?: QueryListVisibleFieldsConfig<T>;\n renderRowItem?: (data: QueryListRowRenderData<T>) => React.ReactNode;\n getRowActions?: (item: T) => QueryListRowAction<T>[];\n onListItemClick?: (item: QueryListItem<T>) => void;\n};\n\nconst block = cn('qp-query-history');\n\nexport const QueriesHistory = <T extends QueryHistoryRow>({\n title,\n logo,\n search,\n filter,\n items,\n selectedRowId,\n editing,\n comparison,\n visibleFields,\n renderRowItem,\n getRowActions,\n onListItemClick,\n className,\n}: QueriesHistoryProps<T>) => {\n return (\n <QueriesList\n className={block(null, className)}\n title={title}\n logo={logo}\n search={search}\n filter={filter}\n items={items}\n selectedRowId={selectedRowId}\n visibleFields={visibleFields}\n editing={editing}\n comparison={comparison}\n getRowActions={getRowActions}\n renderRow={(data) =>\n renderRowItem ? renderRowItem(data) : <HistoryRowContent {...data} />\n }\n onListItemClick={onListItemClick}\n />\n );\n};\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_bemCnLite","_modules","_HistoryRowContent","_jsxRuntime","e","__esModule","default","block","cn","QueriesHistory","exports","_ref","title","logo","search","filter","items","selectedRowId","editing","comparison","visibleFields","renderRowItem","getRowActions","onListItemClick","hasMore","loading","onLoadMore","renderLink","className","_jsx","QueriesList","renderRow","data","HistoryRowContent","_objectSpread"],"sources":["QueriesHistory.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'bem-cn-lite';\nimport {QueriesList} from '../../modules';\nimport {\n QueryListComparisonConfig,\n QueryListEditingConfig,\n QueryListFilterConfig,\n QueryListItem,\n QueryListLinkRenderer,\n QueryListRowAction,\n QueryListRowRenderData,\n QueryListSearchConfig,\n QueryListVisibleFieldsConfig,\n} from '../../types/queryList';\nimport {QueryHistoryRow} from '../../types/history';\nimport {HistoryRowContent} from './internal/HistoryRowContent';\nimport './QueriesHistory.scss';\n\nexport type QueriesHistoryProps<T extends QueryHistoryRow = QueryHistoryRow> = {\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 editing?: QueryListEditingConfig<T>;\n comparison?: QueryListComparisonConfig<T>;\n visibleFields?: QueryListVisibleFieldsConfig<T>;\n renderRowItem?: (data: QueryListRowRenderData<T>) => React.ReactNode;\n getRowActions?: (item: T) => QueryListRowAction<T>[];\n onListItemClick?: (item: QueryListItem<T>) => void;\n hasMore?: boolean;\n loading?: boolean;\n onLoadMore?: () => void;\n renderLink?: QueryListLinkRenderer;\n};\n\nconst block = cn('qp-query-history');\n\nexport const QueriesHistory = <T extends QueryHistoryRow>({\n title,\n logo,\n search,\n filter,\n items,\n selectedRowId,\n editing,\n comparison,\n visibleFields,\n renderRowItem,\n getRowActions,\n onListItemClick,\n hasMore,\n loading,\n onLoadMore,\n renderLink,\n className,\n}: QueriesHistoryProps<T>) => {\n return (\n <QueriesList\n className={block(null, className)}\n title={title}\n logo={logo}\n search={search}\n filter={filter}\n items={items}\n selectedRowId={selectedRowId}\n visibleFields={visibleFields}\n editing={editing}\n comparison={comparison}\n getRowActions={getRowActions}\n renderRow={(data) =>\n renderRowItem ? renderRowItem(data) : <HistoryRowContent {...data} />\n }\n onListItemClick={onListItemClick}\n hasMore={hasMore}\n loading={loading}\n onLoadMore={onLoadMore}\n renderLink={renderLink}\n />\n );\n};\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAaA,IAAAG,kBAAA,GAAAH,OAAA;AACAA,OAAA;AAA+B,IAAAI,WAAA,GAAAJ,OAAA;AAAA,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAsB/B,IAAMG,KAAK,GAAG,IAAAC,kBAAE,EAAC,kBAAkB,CAAC;AAE7B,IAAMC,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAG,SAAjBA,cAAcA,CAAAE,IAAA,EAkBG;EAAA,IAjB1BC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,IAAI,GAAAF,IAAA,CAAJE,IAAI;IACJC,MAAM,GAAAH,IAAA,CAANG,MAAM;IACNC,MAAM,GAAAJ,IAAA,CAANI,MAAM;IACNC,KAAK,GAAAL,IAAA,CAALK,KAAK;IACLC,aAAa,GAAAN,IAAA,CAAbM,aAAa;IACbC,OAAO,GAAAP,IAAA,CAAPO,OAAO;IACPC,UAAU,GAAAR,IAAA,CAAVQ,UAAU;IACVC,aAAa,GAAAT,IAAA,CAAbS,aAAa;IACbC,aAAa,GAAAV,IAAA,CAAbU,aAAa;IACbC,aAAa,GAAAX,IAAA,CAAbW,aAAa;IACbC,eAAe,GAAAZ,IAAA,CAAfY,eAAe;IACfC,OAAO,GAAAb,IAAA,CAAPa,OAAO;IACPC,OAAO,GAAAd,IAAA,CAAPc,OAAO;IACPC,UAAU,GAAAf,IAAA,CAAVe,UAAU;IACVC,UAAU,GAAAhB,IAAA,CAAVgB,UAAU;IACVC,SAAS,GAAAjB,IAAA,CAATiB,SAAS;EAET,oBACI,IAAAC,eAAA,EAACC,oBAAW;IACRF,SAAS,EAAErB,KAAK,CAAC,IAAI,EAAEqB,SAAS,CAAE;IAClChB,KAAK,EAAEA,KAAM;IACbC,IAAI,EAAEA,IAAK;IACXC,MAAM,EAAEA,MAAO;IACfC,MAAM,EAAEA,MAAO;IACfC,KAAK,EAAEA,KAAM;IACbC,aAAa,EAAEA,aAAc;IAC7BG,aAAa,EAAEA,aAAc;IAC7BF,OAAO,EAAEA,OAAQ;IACjBC,UAAU,EAAEA,UAAW;IACvBG,aAAa,EAAEA,aAAc;IAC7BS,SAAS,EAAE,SAAXA,SAASA,CAAGC,IAAI;MAAA,OACZX,aAAa,GAAGA,aAAa,CAACW,IAAI,CAAC,gBAAG,IAAAH,eAAA,EAACI,oCAAiB,MAAAC,sBAAA,MAAKF,IAAI,CAAG,CAAC;IAAA,CACxE;IACDT,eAAe,EAAEA,eAAgB;IACjCC,OAAO,EAAEA,OAAQ;IACjBC,OAAO,EAAEA,OAAQ;IACjBC,UAAU,EAAEA,UAAW;IACvBC,UAAU,EAAEA;EAAW,CAC1B,CAAC;AAEV,CAAC","ignoreList":[]}
|
|
@@ -5,4 +5,9 @@ export default meta;
|
|
|
5
5
|
type Story = StoryObj<typeof QueriesHistory>;
|
|
6
6
|
export declare const Default: Story;
|
|
7
7
|
export declare const Empty: Story;
|
|
8
|
+
export declare const InitialLoading: Story;
|
|
9
|
+
export declare const Paginated: Story;
|
|
10
|
+
export declare const FullSearchUnavailable: Story;
|
|
11
|
+
export declare const RouterLinks: Story;
|
|
12
|
+
export declare const CustomRowRenderer: Story;
|
|
8
13
|
export declare const WithHeader: Story;
|