@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
|
@@ -40,7 +40,9 @@ var LazyList = exports.LazyList = function LazyList(_ref) {
|
|
|
40
40
|
emptyContent = _ref.emptyContent,
|
|
41
41
|
isEmpty = _ref.isEmpty,
|
|
42
42
|
className = _ref.className;
|
|
43
|
-
var
|
|
43
|
+
var listRef = (0, _react.useRef)(null);
|
|
44
|
+
var previousItemsLengthRef = (0, _react.useRef)(items.length);
|
|
45
|
+
var sentinelRef = (0, _useLoadMoreSentinel.useLoadMoreSentinel)(hasMore, onLoadMore, loading, items.length);
|
|
44
46
|
var rows = (0, _react.useMemo)(function () {
|
|
45
47
|
return hasMore ? [].concat((0, _toConsumableArray2.default)(items), [{
|
|
46
48
|
__sentinel: true
|
|
@@ -49,6 +51,14 @@ var LazyList = exports.LazyList = function LazyList(_ref) {
|
|
|
49
51
|
var getRowHeight = function getRowHeight(row) {
|
|
50
52
|
return isSentinelRow(row) ? SENTINEL_ROW_HEIGHT : itemHeight(row);
|
|
51
53
|
};
|
|
54
|
+
(0, _react.useLayoutEffect)(function () {
|
|
55
|
+
var previousItemsLength = previousItemsLengthRef.current;
|
|
56
|
+
if (previousItemsLength !== items.length) {
|
|
57
|
+
var _listRef$current;
|
|
58
|
+
(_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);
|
|
59
|
+
previousItemsLengthRef.current = items.length;
|
|
60
|
+
}
|
|
61
|
+
}, [items.length]);
|
|
52
62
|
if (error) {
|
|
53
63
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.default.Fragment, {
|
|
54
64
|
children: error
|
|
@@ -66,6 +76,7 @@ var LazyList = exports.LazyList = function LazyList(_ref) {
|
|
|
66
76
|
});
|
|
67
77
|
}
|
|
68
78
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_uikit.List, {
|
|
79
|
+
ref: listRef,
|
|
69
80
|
className: block(null, className),
|
|
70
81
|
filterable: filterable,
|
|
71
82
|
items: rows,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_uikit","_bemCnLite","_interopRequireDefault","_useLoadMoreSentinel","_ListSpinner","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","block","cn","SENTINEL_ROW_HEIGHT","isSentinelRow","row","Boolean","_typeof","LazyList","exports","_ref","items","itemHeight","renderItem","hasMore","onLoadMore","onItemClick","selectedItemIndex","_ref$filterable","filterable","loading","error","emptyContent","isEmpty","className","sentinelRef","useLoadMoreSentinel","rows","useMemo","concat","_toConsumableArray","__sentinel","getRowHeight","_jsx","React","Fragment","children","empty","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_uikit","_bemCnLite","_interopRequireDefault","_useLoadMoreSentinel","_ListSpinner","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","block","cn","SENTINEL_ROW_HEIGHT","isSentinelRow","row","Boolean","_typeof","LazyList","exports","_ref","items","itemHeight","renderItem","hasMore","onLoadMore","onItemClick","selectedItemIndex","_ref$filterable","filterable","loading","error","emptyContent","isEmpty","className","listRef","useRef","previousItemsLengthRef","length","sentinelRef","useLoadMoreSentinel","rows","useMemo","concat","_toConsumableArray","__sentinel","getRowHeight","useLayoutEffect","previousItemsLength","current","_listRef$current","refContainer","resetAfterIndex","Math","min","_jsx","React","Fragment","children","empty","ListSpinner","List","ref","itemsHeight","listRows","reduce","total","isActive","index","_renderItem","_onItemClick"],"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={selectedItemIndex as never}\n onItemClick={(row, index) => {\n if (!isSentinelRow(row)) {\n onItemClick?.(row, index);\n }\n }}\n />\n );\n};\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,oBAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACAA,OAAA;AAAyB,IAAAM,WAAA,GAAAN,OAAA;AAAA,SAAAD,wBAAAQ,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAV,uBAAA,YAAAA,CAAAQ,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,C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AEC,KAAK,CAClC;IAAA,CACJ;IACDzC,iBAAiB,EAAEA,iBAA2B;IAC9CD,WAAW,EAAE,SAAbA,WAAWA,CAAGX,GAAG,EAAEqD,KAAK,EAAK;MACzB,IAAI,CAACtD,aAAa,CAACC,GAAG,CAAC,EAAE;QACrBuD,YAAW,aAAXA,YAAW,eAAXA,YAAW,CAAGvD,GAAG,EAAEqD,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>;
|
|
@@ -4,23 +4,34 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.RowLink = void 0;
|
|
7
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
8
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
7
9
|
var _react = _interopRequireDefault(require("react"));
|
|
8
10
|
var _bemCnLite = _interopRequireDefault(require("bem-cn-lite"));
|
|
9
11
|
require("./RowLink.css");
|
|
10
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
var _excluded = ["href", "disabled", "renderLink", "className", "children"];
|
|
12
15
|
var block = (0, _bemCnLite.default)('qp-row-link');
|
|
13
16
|
var RowLink = exports.RowLink = function RowLink(_ref) {
|
|
14
17
|
var href = _ref.href,
|
|
15
18
|
disabled = _ref.disabled,
|
|
19
|
+
renderLink = _ref.renderLink,
|
|
16
20
|
className = _ref.className,
|
|
17
|
-
children = _ref.children
|
|
21
|
+
children = _ref.children,
|
|
22
|
+
linkProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
18
23
|
var isLink = Boolean(href) && !disabled;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
if (!isLink) {
|
|
25
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
26
|
+
className: block(null, className),
|
|
27
|
+
children: children
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
var props = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, linkProps), {}, {
|
|
31
|
+
href: href,
|
|
22
32
|
className: block(null, className),
|
|
23
33
|
children: children
|
|
24
34
|
});
|
|
35
|
+
return renderLink ? renderLink(props) : /*#__PURE__*/(0, _jsxRuntime.jsx)("a", (0, _objectSpread2.default)({}, props));
|
|
25
36
|
};
|
|
26
37
|
// #sourceMappingURL=RowLink.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_bemCnLite","_jsxRuntime","e","__esModule","default","block","cn","RowLink","exports","_ref","href","disabled","className","children","isLink","Boolean","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_bemCnLite","_jsxRuntime","e","__esModule","default","block","cn","RowLink","exports","_ref","href","disabled","renderLink","className","children","linkProps","_objectWithoutProperties","_excluded","isLink","Boolean","_jsx","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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEAA,OAAA;AAAwB,IAAAE,WAAA,GAAAF,OAAA;AAAA,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;;AAExB,IAAMG,KAAK,GAAG,IAAAC,kBAAE,EAAC,aAAa,CAAC;AAQxB,IAAMC,OAAyB,GAAAC,OAAA,CAAAD,OAAA,GAAG,SAA5BA,OAAyBA,CAAAE,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,OAAAC,iCAAA,EAAAP,IAAA,EAAAQ,SAAA;EAEZ,IAAMC,MAAM,GAAGC,OAAO,CAACT,IAAI,CAAC,IAAI,CAACC,QAAQ;EAEzC,IAAI,CAACO,MAAM,EAAE;IACT,oBAAO,IAAAE,eAAA;MAAKP,SAAS,EAAER,KAAK,CAAC,IAAI,EAAEQ,SAAS,CAAE;MAAAC,QAAA,EAAEA;IAAQ,CAAM,CAAC;EACnE;EAEA,IAAMO,KAA0C,OAAAC,sBAAA,MAAAA,sBAAA,MACzCP,SAAS;IACZL,IAAI,EAAJA,IAAI;IACJG,SAAS,EAAER,KAAK,CAAC,IAAI,EAAEQ,SAAS,CAAC;IACjCC,QAAQ,EAARA;EAAQ,EACX;EAED,OAAOF,UAAU,GAAGA,UAAU,CAACS,KAAK,CAAC,gBAAG,IAAAD,eAAA,WAAAE,sBAAA,MAAOD,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>;
|
|
@@ -21,10 +21,12 @@ var SearchRowLayout = exports.SearchRowLayout = function SearchRowLayout(_ref) {
|
|
|
21
21
|
language = _ref.language,
|
|
22
22
|
href = _ref.href,
|
|
23
23
|
disabled = _ref.disabled,
|
|
24
|
+
renderLink = _ref.renderLink,
|
|
24
25
|
className = _ref.className;
|
|
25
26
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_RowLink.RowLink, {
|
|
26
27
|
href: href,
|
|
27
28
|
disabled: disabled,
|
|
29
|
+
renderLink: renderLink,
|
|
28
30
|
className: block(null, className),
|
|
29
31
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_uikit.Flex, {
|
|
30
32
|
direction: "column",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_uikit","_bemCnLite","_MonacoEditor","_RowLink","_fitQueryToVisibleLines","_monacoConfig","_jsxRuntime","e","__esModule","default","block","cn","SearchRowLayout","exports","_ref","header","query","language","href","disabled","className","_jsx","RowLink","children","_jsxs","Flex","direction","gap","alignItems","MonacoEditor","value","fitQueryToVisibleLines","readOnly","monacoConfig","MONACO_CONFIG"],"sources":["SearchRowLayout.tsx"],"sourcesContent":["import React, {FC, ReactNode} from 'react';\nimport {Flex} from '@gravity-ui/uikit';\nimport cn from 'bem-cn-lite';\nimport {MonacoEditor} from '../MonacoEditor';\nimport {RowLink} from '../RowLink';\nimport {fitQueryToVisibleLines} from './helpers/fitQueryToVisibleLines';\nimport {MONACO_CONFIG} from './helpers/monacoConfig';\nimport './SearchRowLayout.scss';\n\nconst block = cn('qp-search-row-layout');\n\nexport type SearchRowLayoutProps = {\n header: ReactNode;\n query?: string;\n language: string;\n href?: string;\n disabled?: boolean;\n className?: string;\n};\n\nexport const SearchRowLayout: FC<SearchRowLayoutProps> = ({\n header,\n query,\n language,\n href,\n disabled,\n className,\n}) => {\n return (\n <RowLink
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_uikit","_bemCnLite","_MonacoEditor","_RowLink","_fitQueryToVisibleLines","_monacoConfig","_jsxRuntime","e","__esModule","default","block","cn","SearchRowLayout","exports","_ref","header","query","language","href","disabled","renderLink","className","_jsx","RowLink","children","_jsxs","Flex","direction","gap","alignItems","MonacoEditor","value","fitQueryToVisibleLines","readOnly","monacoConfig","MONACO_CONFIG"],"sources":["SearchRowLayout.tsx"],"sourcesContent":["import React, {FC, ReactNode} from 'react';\nimport {Flex} from '@gravity-ui/uikit';\nimport cn from 'bem-cn-lite';\nimport {MonacoEditor} from '../MonacoEditor';\nimport {RowLink} from '../RowLink';\nimport {QueryListLinkRenderer} from '../../types/queryList';\nimport {fitQueryToVisibleLines} from './helpers/fitQueryToVisibleLines';\nimport {MONACO_CONFIG} from './helpers/monacoConfig';\nimport './SearchRowLayout.scss';\n\nconst block = cn('qp-search-row-layout');\n\nexport type SearchRowLayoutProps = {\n header: ReactNode;\n query?: string;\n language: string;\n href?: string;\n disabled?: boolean;\n renderLink?: QueryListLinkRenderer;\n className?: string;\n};\n\nexport const SearchRowLayout: FC<SearchRowLayoutProps> = ({\n header,\n query,\n language,\n href,\n disabled,\n renderLink,\n className,\n}) => {\n return (\n <RowLink\n href={href}\n disabled={disabled}\n renderLink={renderLink}\n className={block(null, className)}\n >\n <Flex direction=\"column\" gap={2} className={block('content')}>\n <Flex gap={2} alignItems=\"center\">\n {header}\n </Flex>\n <MonacoEditor\n value={fitQueryToVisibleLines(query)}\n language={language}\n readOnly\n monacoConfig={MONACO_CONFIG}\n className={block('monaco')}\n />\n </Flex>\n </RowLink>\n );\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAEA,IAAAK,uBAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AACAA,OAAA;AAAgC,IAAAO,WAAA,GAAAP,OAAA;AAAA,SAAAD,uBAAAS,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEhC,IAAMG,KAAK,GAAG,IAAAC,kBAAE,EAAC,sBAAsB,CAAC;AAYjC,IAAMC,eAAyC,GAAAC,OAAA,CAAAD,eAAA,GAAG,SAA5CA,eAAyCA,CAAAE,IAAA,EAQhD;EAAA,IAPFC,MAAM,GAAAD,IAAA,CAANC,MAAM;IACNC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;IACRC,IAAI,GAAAJ,IAAA,CAAJI,IAAI;IACJC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;IACRC,UAAU,GAAAN,IAAA,CAAVM,UAAU;IACVC,SAAS,GAAAP,IAAA,CAATO,SAAS;EAET,oBACI,IAAAC,eAAA,EAACC,gBAAO;IACJL,IAAI,EAAEA,IAAK;IACXC,QAAQ,EAAEA,QAAS;IACnBC,UAAU,EAAEA,UAAW;IACvBC,SAAS,EAAEX,KAAK,CAAC,IAAI,EAAEW,SAAS,CAAE;IAAAG,QAAA,eAElC,IAAAC,gBAAA,EAACC,WAAI;MAACC,SAAS,EAAC,QAAQ;MAACC,GAAG,EAAE,CAAE;MAACP,SAAS,EAAEX,KAAK,CAAC,SAAS,CAAE;MAAAc,QAAA,gBACzD,IAAAF,eAAA,EAACI,WAAI;QAACE,GAAG,EAAE,CAAE;QAACC,UAAU,EAAC,QAAQ;QAAAL,QAAA,EAC5BT;MAAM,CACL,CAAC,eACP,IAAAO,eAAA,EAACQ,0BAAY;QACTC,KAAK,EAAE,IAAAC,8CAAsB,EAAChB,KAAK,CAAE;QACrCC,QAAQ,EAAEA,QAAS;QACnBgB,QAAQ;QACRC,YAAY,EAAEC,2BAAc;QAC5Bd,SAAS,EAAEX,KAAK,CAAC,QAAQ;MAAE,CAC9B,CAAC;IAAA,CACA;EAAC,CACF,CAAC;AAElB,CAAC","ignoreList":[]}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { QueryListItem, QueryListRow, QueryListRowVariant } from '../types/queryList';
|
|
2
|
+
export declare const getListItemKey: <T extends QueryListRow>(item: QueryListItem<T>) => string;
|
|
2
3
|
export declare const getListKey: <T extends QueryListRow>(items: QueryListItem<T>[], variant: QueryListRowVariant) => string;
|
|
@@ -3,17 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getListKey = void 0;
|
|
6
|
+
exports.getListKey = exports.getListItemKey = void 0;
|
|
7
7
|
require("core-js/modules/es.array.concat.js");
|
|
8
8
|
require("core-js/modules/es.array.join.js");
|
|
9
9
|
require("core-js/modules/es.array.map.js");
|
|
10
10
|
require("core-js/modules/es.iterator.constructor.js");
|
|
11
11
|
require("core-js/modules/es.iterator.map.js");
|
|
12
12
|
require("core-js/modules/es.object.to-string.js");
|
|
13
|
+
var getListItemKey = exports.getListItemKey = function getListItemKey(item) {
|
|
14
|
+
return 'header' in item ? "h:".concat(item.header) : "r:".concat(item.id);
|
|
15
|
+
};
|
|
13
16
|
var getListKey = exports.getListKey = function getListKey(items, variant) {
|
|
14
|
-
var itemsKey = items.map(
|
|
15
|
-
return 'header' in item ? "h:".concat(item.header) : "r:".concat(item.id);
|
|
16
|
-
}).join(',');
|
|
17
|
+
var itemsKey = items.map(getListItemKey).join(',');
|
|
17
18
|
return "".concat(variant, ":").concat(itemsKey);
|
|
18
19
|
};
|
|
19
20
|
// #sourceMappingURL=getListKey.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["getListItemKey","exports","item","concat","header","id","getListKey","items","variant","itemsKey","map","join"],"sources":["getListKey.ts"],"sourcesContent":["import {QueryListItem, QueryListRow, QueryListRowVariant} from '../types/queryList';\n\nexport const getListItemKey = <T extends QueryListRow>(item: QueryListItem<T>): string =>\n 'header' in item ? `h:${item.header}` : `r:${item.id}`;\n\nexport const getListKey = <T extends QueryListRow>(\n items: QueryListItem<T>[],\n variant: QueryListRowVariant,\n): string => {\n const itemsKey = items.map(getListItemKey).join(',');\n\n return `${variant}:${itemsKey}`;\n};\n"],"mappings":";;;;;;;;;;;;AAEO,IAAMA,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAG,SAAjBA,cAAcA,CAA4BE,IAAsB;EAAA,OACzE,QAAQ,IAAIA,IAAI,QAAAC,MAAA,CAAQD,IAAI,CAACE,MAAM,SAAAD,MAAA,CAAUD,IAAI,CAACG,EAAE,CAAE;AAAA;AAEnD,IAAMC,UAAU,GAAAL,OAAA,CAAAK,UAAA,GAAG,SAAbA,UAAUA,CACnBC,KAAyB,EACzBC,OAA4B,EACnB;EACT,IAAMC,QAAQ,GAAGF,KAAK,CAACG,GAAG,CAACV,cAAc,CAAC,CAACW,IAAI,CAAC,GAAG,CAAC;EAEpD,UAAAR,MAAA,CAAUK,OAAO,OAAAL,MAAA,CAAIM,QAAQ;AACjC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useListKey = void 0;
|
|
7
|
+
require("core-js/modules/es.array.every.js");
|
|
8
|
+
require("core-js/modules/es.array.map.js");
|
|
9
|
+
require("core-js/modules/es.iterator.constructor.js");
|
|
10
|
+
require("core-js/modules/es.iterator.every.js");
|
|
11
|
+
require("core-js/modules/es.iterator.map.js");
|
|
12
|
+
require("core-js/modules/es.object.to-string.js");
|
|
13
|
+
var _react = require("react");
|
|
14
|
+
var _getListKey = require("./getListKey");
|
|
15
|
+
var useListKey = exports.useListKey = function useListKey(items, rowVariant, paginationEnabled) {
|
|
16
|
+
var itemKeys = items.map(_getListKey.getListItemKey);
|
|
17
|
+
var currentKey = (0, _getListKey.getListKey)(items, rowVariant);
|
|
18
|
+
var stateRef = (0, _react.useRef)(undefined);
|
|
19
|
+
var previousState = stateRef.current;
|
|
20
|
+
var isAppend = (previousState === null || previousState === void 0 ? void 0 : previousState.paginationEnabled) && previousState.rowVariant === rowVariant && previousState.itemKeys.length <= itemKeys.length && previousState.itemKeys.every(function (key, index) {
|
|
21
|
+
return key === itemKeys[index];
|
|
22
|
+
});
|
|
23
|
+
var key = paginationEnabled && isAppend ? previousState.key : currentKey;
|
|
24
|
+
stateRef.current = {
|
|
25
|
+
key: key,
|
|
26
|
+
itemKeys: itemKeys,
|
|
27
|
+
rowVariant: rowVariant,
|
|
28
|
+
paginationEnabled: paginationEnabled
|
|
29
|
+
};
|
|
30
|
+
return key;
|
|
31
|
+
};
|
|
32
|
+
// #sourceMappingURL=useListKey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_getListKey","useListKey","exports","items","rowVariant","paginationEnabled","itemKeys","map","getListItemKey","currentKey","getListKey","stateRef","useRef","undefined","previousState","current","isAppend","length","every","key","index"],"sources":["useListKey.ts"],"sourcesContent":["import {useRef} from 'react';\nimport {getListItemKey, getListKey} from './getListKey';\nimport {QueryListItem, QueryListRow, QueryListRowVariant} from '../types/queryList';\n\ntype ListKeyState = {\n key: string;\n itemKeys: string[];\n rowVariant: QueryListRowVariant;\n paginationEnabled: boolean;\n};\n\nexport const useListKey = <T extends QueryListRow>(\n items: QueryListItem<T>[],\n rowVariant: QueryListRowVariant,\n paginationEnabled: boolean,\n) => {\n const itemKeys = items.map(getListItemKey);\n const currentKey = getListKey(items, rowVariant);\n const stateRef = useRef<ListKeyState | undefined>(undefined);\n const previousState = stateRef.current;\n const isAppend =\n previousState?.paginationEnabled &&\n previousState.rowVariant === rowVariant &&\n previousState.itemKeys.length <= itemKeys.length &&\n previousState.itemKeys.every((key, index) => key === itemKeys[index]);\n const key = paginationEnabled && isAppend ? previousState.key : currentKey;\n\n stateRef.current = {key, itemKeys, rowVariant, paginationEnabled};\n\n return key;\n};\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAUO,IAAME,UAAU,GAAAC,OAAA,CAAAD,UAAA,GAAG,SAAbA,UAAUA,CACnBE,KAAyB,EACzBC,UAA+B,EAC/BC,iBAA0B,EACzB;EACD,IAAMC,QAAQ,GAAGH,KAAK,CAACI,GAAG,CAACC,0BAAc,CAAC;EAC1C,IAAMC,UAAU,GAAG,IAAAC,sBAAU,EAACP,KAAK,EAAEC,UAAU,CAAC;EAChD,IAAMO,QAAQ,GAAG,IAAAC,aAAM,EAA2BC,SAAS,CAAC;EAC5D,IAAMC,aAAa,GAAGH,QAAQ,CAACI,OAAO;EACtC,IAAMC,QAAQ,GACV,CAAAF,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAET,iBAAiB,KAChCS,aAAa,CAACV,UAAU,KAAKA,UAAU,IACvCU,aAAa,CAACR,QAAQ,CAACW,MAAM,IAAIX,QAAQ,CAACW,MAAM,IAChDH,aAAa,CAACR,QAAQ,CAACY,KAAK,CAAC,UAACC,GAAG,EAAEC,KAAK;IAAA,OAAKD,GAAG,KAAKb,QAAQ,CAACc,KAAK,CAAC;EAAA,EAAC;EACzE,IAAMD,GAAG,GAAGd,iBAAiB,IAAIW,QAAQ,GAAGF,aAAa,CAACK,GAAG,GAAGV,UAAU;EAE1EE,QAAQ,CAACI,OAAO,GAAG;IAACI,GAAG,EAAHA,GAAG;IAAEb,QAAQ,EAARA,QAAQ;IAAEF,UAAU,EAAVA,UAAU;IAAEC,iBAAiB,EAAjBA;EAAiB,CAAC;EAEjE,OAAOc,GAAG;AACd,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useLoadMoreSentinel(hasMore: boolean | undefined, onLoadMore?: () => void): (node: HTMLElement | null) => void;
|
|
1
|
+
export declare function useLoadMoreSentinel(hasMore: boolean | undefined, onLoadMore?: () => void, loading?: boolean, itemsCount?: number): (node: HTMLElement | null) => void;
|
|
@@ -9,18 +9,26 @@ require("core-js/modules/es.iterator.constructor.js");
|
|
|
9
9
|
require("core-js/modules/es.iterator.some.js");
|
|
10
10
|
require("core-js/modules/es.object.to-string.js");
|
|
11
11
|
var _react = require("react");
|
|
12
|
-
function useLoadMoreSentinel(hasMore, onLoadMore) {
|
|
12
|
+
function useLoadMoreSentinel(hasMore, onLoadMore, loading, itemsCount) {
|
|
13
13
|
var observerRef = (0, _react.useRef)(null);
|
|
14
|
+
var loadRequestedRef = (0, _react.useRef)(false);
|
|
14
15
|
var hasMoreRef = (0, _react.useRef)(hasMore);
|
|
15
16
|
hasMoreRef.current = hasMore;
|
|
16
17
|
var onLoadMoreRef = (0, _react.useRef)(onLoadMore);
|
|
17
18
|
onLoadMoreRef.current = onLoadMore;
|
|
19
|
+
var preventRepeatedLoad = loading !== undefined;
|
|
18
20
|
(0, _react.useEffect)(function () {
|
|
19
21
|
return function () {
|
|
20
22
|
var _observerRef$current;
|
|
21
23
|
(_observerRef$current = observerRef.current) === null || _observerRef$current === void 0 || _observerRef$current.disconnect();
|
|
22
24
|
};
|
|
23
25
|
}, []);
|
|
26
|
+
(0, _react.useEffect)(function () {
|
|
27
|
+
if (!loading) {
|
|
28
|
+
// Cached pages can add items without changing the loading state.
|
|
29
|
+
loadRequestedRef.current = false;
|
|
30
|
+
}
|
|
31
|
+
}, [loading, itemsCount]);
|
|
24
32
|
return (0, _react.useCallback)(function (node) {
|
|
25
33
|
var _observerRef$current2;
|
|
26
34
|
(_observerRef$current2 = observerRef.current) === null || _observerRef$current2 === void 0 || _observerRef$current2.disconnect();
|
|
@@ -30,12 +38,13 @@ function useLoadMoreSentinel(hasMore, onLoadMore) {
|
|
|
30
38
|
observerRef.current = new IntersectionObserver(function (entries) {
|
|
31
39
|
if (entries.some(function (entry) {
|
|
32
40
|
return entry.isIntersecting;
|
|
33
|
-
}) && hasMoreRef.current) {
|
|
41
|
+
}) && hasMoreRef.current && !loading && (!preventRepeatedLoad || !loadRequestedRef.current) && onLoadMoreRef.current) {
|
|
34
42
|
var _onLoadMoreRef$curren;
|
|
43
|
+
loadRequestedRef.current = preventRepeatedLoad;
|
|
35
44
|
(_onLoadMoreRef$curren = onLoadMoreRef.current) === null || _onLoadMoreRef$curren === void 0 || _onLoadMoreRef$curren.call(onLoadMoreRef);
|
|
36
45
|
}
|
|
37
46
|
});
|
|
38
47
|
observerRef.current.observe(node);
|
|
39
|
-
}, []);
|
|
48
|
+
}, [loading, preventRepeatedLoad]);
|
|
40
49
|
}
|
|
41
50
|
// #sourceMappingURL=useLoadMoreSentinel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","useLoadMoreSentinel","hasMore","onLoadMore","observerRef","useRef","hasMoreRef","current","onLoadMoreRef","useEffect","_observerRef$current","disconnect","useCallback","node","_observerRef$current2","IntersectionObserver","entries","some","entry","isIntersecting","_onLoadMoreRef$curren","call","observe"],"sources":["useLoadMoreSentinel.ts"],"sourcesContent":["import {useCallback, useEffect, useRef} from 'react';\n\nexport function useLoadMoreSentinel(hasMore: boolean | undefined
|
|
1
|
+
{"version":3,"names":["_react","require","useLoadMoreSentinel","hasMore","onLoadMore","loading","itemsCount","observerRef","useRef","loadRequestedRef","hasMoreRef","current","onLoadMoreRef","preventRepeatedLoad","undefined","useEffect","_observerRef$current","disconnect","useCallback","node","_observerRef$current2","IntersectionObserver","entries","some","entry","isIntersecting","_onLoadMoreRef$curren","call","observe"],"sources":["useLoadMoreSentinel.ts"],"sourcesContent":["import {useCallback, useEffect, useRef} from 'react';\n\nexport function useLoadMoreSentinel(\n hasMore: boolean | undefined,\n onLoadMore?: () => void,\n loading?: boolean,\n itemsCount?: number,\n) {\n const observerRef = useRef<IntersectionObserver | null>(null);\n const loadRequestedRef = useRef(false);\n const hasMoreRef = useRef(hasMore);\n hasMoreRef.current = hasMore;\n const onLoadMoreRef = useRef(onLoadMore);\n onLoadMoreRef.current = onLoadMore;\n const preventRepeatedLoad = loading !== undefined;\n\n useEffect(() => {\n return () => {\n observerRef.current?.disconnect();\n };\n }, []);\n\n useEffect(() => {\n if (!loading) {\n // Cached pages can add items without changing the loading state.\n loadRequestedRef.current = false;\n }\n }, [loading, itemsCount]);\n\n return useCallback(\n (node: HTMLElement | null) => {\n observerRef.current?.disconnect();\n\n if (!node) {\n return;\n }\n\n observerRef.current = new IntersectionObserver((entries) => {\n if (\n entries.some((entry) => entry.isIntersecting) &&\n hasMoreRef.current &&\n !loading &&\n (!preventRepeatedLoad || !loadRequestedRef.current) &&\n onLoadMoreRef.current\n ) {\n loadRequestedRef.current = preventRepeatedLoad;\n onLoadMoreRef.current?.();\n }\n });\n\n observerRef.current.observe(node);\n },\n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C,UAACC,KAAK;QAAA,OAAKA,KAAK,CAACC,cAAc;MAAA,EAAC,IAC7Cf,UAAU,CAACC,OAAO,IAClB,CAACN,OAAO,KACP,CAACQ,mBAAmB,IAAI,CAACJ,gBAAgB,CAACE,OAAO,CAAC,IACnDC,aAAa,CAACD,OAAO,EACvB;QAAA,IAAAe,qBAAA;QACEjB,gBAAgB,CAACE,OAAO,GAAGE,mBAAmB;QAC9C,CAAAa,qBAAA,GAAAd,aAAa,CAACD,OAAO,cAAAe,qBAAA,eAArBA,qBAAA,CAAAC,IAAA,CAAAf,aAAwB,CAAC;MAC7B;IACJ,CAAC,CAAC;IAEFL,WAAW,CAACI,OAAO,CAACiB,OAAO,CAACT,IAAI,CAAC;EACrC,CAAC,EACD,CAACd,OAAO,EAAEQ,mBAAmB,CACjC,CAAC;AACL","ignoreList":[]}
|
|
@@ -21,6 +21,8 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
21
21
|
var HistoryHeader = exports.HistoryHeader = function HistoryHeader(_ref) {
|
|
22
22
|
var search = _ref.search,
|
|
23
23
|
fullSearch = _ref.fullSearch,
|
|
24
|
+
_ref$fullSearchAvaila = _ref.fullSearchAvailable,
|
|
25
|
+
fullSearchAvailable = _ref$fullSearchAvaila === void 0 ? true : _ref$fullSearchAvaila,
|
|
24
26
|
hasClear = _ref.hasClear,
|
|
25
27
|
filter = _ref.filter,
|
|
26
28
|
onUpdate = _ref.onUpdate,
|
|
@@ -29,19 +31,19 @@ var HistoryHeader = exports.HistoryHeader = function HistoryHeader(_ref) {
|
|
|
29
31
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
30
32
|
searchValue = _useState2[0],
|
|
31
33
|
setSearchValue = _useState2[1];
|
|
32
|
-
var _useState3 = (0, _react.useState)(
|
|
34
|
+
var _useState3 = (0, _react.useState)(fullSearchAvailable && Boolean(fullSearch)),
|
|
33
35
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
34
36
|
isFullSearch = _useState4[0],
|
|
35
37
|
setFullSearch = _useState4[1];
|
|
36
38
|
(0, _react.useEffect)(function () {
|
|
37
39
|
setSearchValue(search || '');
|
|
38
|
-
setFullSearch(
|
|
39
|
-
}, [search, fullSearch]);
|
|
40
|
+
setFullSearch(fullSearchAvailable && Boolean(fullSearch));
|
|
41
|
+
}, [search, fullSearch, fullSearchAvailable]);
|
|
40
42
|
var handleOnUpdate = function handleOnUpdate(newValue) {
|
|
41
43
|
setSearchValue(newValue);
|
|
42
44
|
onUpdate({
|
|
43
45
|
value: newValue,
|
|
44
|
-
fullSearch: isFullSearch
|
|
46
|
+
fullSearch: fullSearchAvailable && isFullSearch
|
|
45
47
|
});
|
|
46
48
|
};
|
|
47
49
|
var handleModeChange = function handleModeChange() {
|
|
@@ -57,10 +59,10 @@ var HistoryHeader = exports.HistoryHeader = function HistoryHeader(_ref) {
|
|
|
57
59
|
value: searchValue,
|
|
58
60
|
hasClear: hasClear,
|
|
59
61
|
onUpdate: handleOnUpdate,
|
|
60
|
-
innerButtons: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_FullSearchToggleButton.FullSearchToggleButton, {
|
|
62
|
+
innerButtons: fullSearchAvailable ? [/*#__PURE__*/(0, _jsxRuntime.jsx)(_FullSearchToggleButton.FullSearchToggleButton, {
|
|
61
63
|
active: isFullSearch,
|
|
62
64
|
onClick: handleModeChange
|
|
63
|
-
}, "full-search")],
|
|
65
|
+
}, "full-search")] : undefined,
|
|
64
66
|
endButtons: filter ? [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.HistoryFilter, (0, _objectSpread2.default)({}, filter), "filter")] : undefined
|
|
65
67
|
});
|
|
66
68
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_FullSearchToggleButton","_components","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_interopRequireDefault","HistoryHeader","exports","_ref","search","fullSearch","hasClear","filter","onUpdate","className","_useState","useState","_useState2","_slicedToArray","searchValue","setSearchValue","_useState3","_useState4","isFullSearch","setFullSearch","useEffect","handleOnUpdate","newValue","value","handleModeChange","_jsx","SearchWithButtons","innerButtons","FullSearchToggleButton","active","onClick","endButtons","HistoryFilter","_objectSpread"
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_FullSearchToggleButton","_components","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_interopRequireDefault","HistoryHeader","exports","_ref","search","fullSearch","_ref$fullSearchAvaila","fullSearchAvailable","hasClear","filter","onUpdate","className","_useState","useState","_useState2","_slicedToArray","searchValue","setSearchValue","_useState3","Boolean","_useState4","isFullSearch","setFullSearch","useEffect","handleOnUpdate","newValue","value","handleModeChange","_jsx","SearchWithButtons","innerButtons","FullSearchToggleButton","active","onClick","undefined","endButtons","HistoryFilter","_objectSpread"],"sources":["HistoryHeader.tsx"],"sourcesContent":["import React, {FC, useEffect, useState} from 'react';\nimport {FullSearchToggleButton} from './internal/FullSearchToggleButton';\nimport {HistoryFilter, SearchWithButtons} from '../../components';\nimport {QueryListFilterConfig} from '../../types/queryList';\n\ntype Props = {\n search?: string;\n fullSearch?: boolean;\n fullSearchAvailable?: boolean;\n hasClear?: boolean;\n filter?: QueryListFilterConfig;\n onUpdate: (data: {value: string; fullSearch: boolean}) => void;\n className?: string;\n};\n\nexport const HistoryHeader: FC<Props> = ({\n search,\n fullSearch,\n fullSearchAvailable = true,\n hasClear,\n filter,\n onUpdate,\n className,\n}) => {\n const [searchValue, setSearchValue] = useState(search || '');\n const [isFullSearch, setFullSearch] = useState(fullSearchAvailable && Boolean(fullSearch));\n\n useEffect(() => {\n setSearchValue(search || '');\n setFullSearch(fullSearchAvailable && Boolean(fullSearch));\n }, [search, fullSearch, fullSearchAvailable]);\n\n const handleOnUpdate = (newValue: string) => {\n setSearchValue(newValue);\n onUpdate({value: newValue, fullSearch: fullSearchAvailable && isFullSearch});\n };\n\n const handleModeChange = () => {\n const newValue = !isFullSearch;\n setFullSearch(newValue);\n onUpdate({value: searchValue, fullSearch: newValue});\n };\n\n return (\n <SearchWithButtons\n className={className}\n value={searchValue}\n hasClear={hasClear}\n onUpdate={handleOnUpdate}\n innerButtons={\n fullSearchAvailable\n ? [\n <FullSearchToggleButton\n key=\"full-search\"\n active={isFullSearch}\n onClick={handleModeChange}\n />,\n ]\n : undefined\n }\n endButtons={filter ? [<HistoryFilter key=\"filter\" {...filter} />] : undefined}\n />\n );\n};\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAAkE,IAAAG,WAAA,GAAAH,OAAA;AAAA,SAAAD,wBAAAK,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAP,uBAAA,YAAAA,CAAAK,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IA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variant'>;
|
|
8
|
-
export declare const HistoryRow: <T extends QueryHistoryRow>({ item, actions, isActive, comparison, editing, visibleFields, }: Props<T>) => React.JSX.Element;
|
|
8
|
+
export declare const HistoryRow: <T extends QueryHistoryRow>({ item, actions, isActive, comparison, editing, visibleFields, renderLink, }: Props<T>) => React.JSX.Element;
|
|
@@ -21,7 +21,8 @@ var HistoryRow = exports.HistoryRow = function HistoryRow(_ref) {
|
|
|
21
21
|
isActive = _ref.isActive,
|
|
22
22
|
comparison = _ref.comparison,
|
|
23
23
|
editing = _ref.editing,
|
|
24
|
-
visibleFields = _ref.visibleFields
|
|
24
|
+
visibleFields = _ref.visibleFields,
|
|
25
|
+
renderLink = _ref.renderLink;
|
|
25
26
|
var href = item.href,
|
|
26
27
|
status = item.status,
|
|
27
28
|
mode = item.mode,
|
|
@@ -36,6 +37,7 @@ var HistoryRow = exports.HistoryRow = function HistoryRow(_ref) {
|
|
|
36
37
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.RowLink, {
|
|
37
38
|
href: href,
|
|
38
39
|
disabled: isEditing || isComparisonMode,
|
|
40
|
+
renderLink: renderLink,
|
|
39
41
|
className: block((0, _defineProperty2.default)((0, _defineProperty2.default)({}, status, true), "compared", isChecked)),
|
|
40
42
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.QueryStatusIcon, {
|
|
41
43
|
status: status
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_uikit","_bemCnLite","_components","_time","_isFieldVisible","_jsxRuntime","e","__esModule","default","block","cn","HistoryRow","exports","_ref","item","actions","isActive","comparison","editing","visibleFields","href","status","mode","startTime","endTime","engine","isPrivate","isEditing","Boolean","enabled","isComparisonMode","isChecked","checked","showMenu","length","_jsxs","RowLink","disabled","className","_defineProperty","children","_jsx","QueryStatusIcon","Flex","direction","gap","justifyContent","EditableRowTitle","RowActionsMenu","isFieldVisible","QueryDuration","Text","color","formatTime","HistoryPrivateIcon"],"sources":["HistoryRow.tsx"],"sourcesContent":["import React from 'react';\nimport {QueryListRowRenderData} from '../../types/queryList';\nimport {QueryHistoryRow} from '../../types/history';\nimport {Flex, Text} from '@gravity-ui/uikit';\nimport './HistoryRow.scss';\nimport cn from 'bem-cn-lite';\nimport {\n EditableRowTitle,\n HistoryPrivateIcon,\n QueryDuration,\n QueryStatusIcon,\n RowActionsMenu,\n RowLink,\n} from '../../components';\nimport {formatTime} from '../../helpers/time';\nimport {isFieldVisible} from '../../helpers/isFieldVisible';\n\nexport type Props<T extends QueryHistoryRow> = {\n item: T;\n} & Omit<QueryListRowRenderData<T>, 'item' | 'variant'>;\n\nconst block = cn('qp-history-row');\n\nexport const HistoryRow = <T extends QueryHistoryRow>({\n item,\n actions,\n isActive,\n comparison,\n editing,\n visibleFields,\n}: Props<T>) => {\n const {href, status, mode, startTime, endTime, engine, isPrivate} = item;\n const isEditing = Boolean(editing?.enabled);\n const isComparisonMode = Boolean(comparison?.enabled);\n const isChecked = Boolean(comparison?.checked);\n const showMenu = isActive && Boolean(actions?.length) && !isComparisonMode;\n\n return (\n <RowLink\n href={href}\n disabled={isEditing || isComparisonMode}\n className={block({[status]: true, compared: isChecked})}\n >\n <QueryStatusIcon status={status} />\n <Flex direction=\"column\" gap={1} className={block('right-column')}>\n <Flex justifyContent=\"space-between\" className={block('header')}>\n <EditableRowTitle item={item} editing={editing} />\n {showMenu && <RowActionsMenu item={item} actions={actions} />}\n </Flex>\n <div className={block('data')}>\n {isFieldVisible(visibleFields, 'duration') && startTime && (\n <QueryDuration\n className={block('duration')}\n status={status}\n startTime={startTime}\n endTime={endTime}\n />\n )}\n <Flex gap={2}>\n {isFieldVisible(visibleFields, 'mode') && mode && (\n <Text color=\"complementary\">{mode}</Text>\n )}\n {isFieldVisible(visibleFields, 'startTime') && startTime && (\n <Text color=\"complementary\">{formatTime(startTime)}</Text>\n )}\n {isFieldVisible(visibleFields, 'engine') && engine && (\n <Text color=\"complementary\">{engine}</Text>\n )}\n {isFieldVisible(visibleFields, 'isPrivate') && (\n <HistoryPrivateIcon isPrivate={isPrivate} />\n )}\n </Flex>\n </div>\n </Flex>\n </RowLink>\n );\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,MAAA,GAAAD,OAAA;AACAA,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAQA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAL,OAAA;AAA4D,IAAAM,WAAA,GAAAN,OAAA;AAAA,SAAAD,uBAAAQ,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAM5D,IAAMG,KAAK,GAAG,IAAAC,kBAAE,EAAC,gBAAgB,CAAC;AAE3B,IAAMC,UAAU,GAAAC,OAAA,CAAAD,UAAA,GAAG,SAAbA,UAAUA,CAAAE,IAAA,
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_uikit","_bemCnLite","_components","_time","_isFieldVisible","_jsxRuntime","e","__esModule","default","block","cn","HistoryRow","exports","_ref","item","actions","isActive","comparison","editing","visibleFields","renderLink","href","status","mode","startTime","endTime","engine","isPrivate","isEditing","Boolean","enabled","isComparisonMode","isChecked","checked","showMenu","length","_jsxs","RowLink","disabled","className","_defineProperty","children","_jsx","QueryStatusIcon","Flex","direction","gap","justifyContent","EditableRowTitle","RowActionsMenu","isFieldVisible","QueryDuration","Text","color","formatTime","HistoryPrivateIcon"],"sources":["HistoryRow.tsx"],"sourcesContent":["import React from 'react';\nimport {QueryListRowRenderData} from '../../types/queryList';\nimport {QueryHistoryRow} from '../../types/history';\nimport {Flex, Text} from '@gravity-ui/uikit';\nimport './HistoryRow.scss';\nimport cn from 'bem-cn-lite';\nimport {\n EditableRowTitle,\n HistoryPrivateIcon,\n QueryDuration,\n QueryStatusIcon,\n RowActionsMenu,\n RowLink,\n} from '../../components';\nimport {formatTime} from '../../helpers/time';\nimport {isFieldVisible} from '../../helpers/isFieldVisible';\n\nexport type Props<T extends QueryHistoryRow> = {\n item: T;\n} & Omit<QueryListRowRenderData<T>, 'item' | 'variant'>;\n\nconst block = cn('qp-history-row');\n\nexport const HistoryRow = <T extends QueryHistoryRow>({\n item,\n actions,\n isActive,\n comparison,\n editing,\n visibleFields,\n renderLink,\n}: Props<T>) => {\n const {href, status, mode, startTime, endTime, engine, isPrivate} = item;\n const isEditing = Boolean(editing?.enabled);\n const isComparisonMode = Boolean(comparison?.enabled);\n const isChecked = Boolean(comparison?.checked);\n const showMenu = isActive && Boolean(actions?.length) && !isComparisonMode;\n\n return (\n <RowLink\n href={href}\n disabled={isEditing || isComparisonMode}\n renderLink={renderLink}\n className={block({[status]: true, compared: isChecked})}\n >\n <QueryStatusIcon status={status} />\n <Flex direction=\"column\" gap={1} className={block('right-column')}>\n <Flex justifyContent=\"space-between\" className={block('header')}>\n <EditableRowTitle item={item} editing={editing} />\n {showMenu && <RowActionsMenu item={item} actions={actions} />}\n </Flex>\n <div className={block('data')}>\n {isFieldVisible(visibleFields, 'duration') && startTime && (\n <QueryDuration\n className={block('duration')}\n status={status}\n startTime={startTime}\n endTime={endTime}\n />\n )}\n <Flex gap={2}>\n {isFieldVisible(visibleFields, 'mode') && mode && (\n <Text color=\"complementary\">{mode}</Text>\n )}\n {isFieldVisible(visibleFields, 'startTime') && startTime && (\n <Text color=\"complementary\">{formatTime(startTime)}</Text>\n )}\n {isFieldVisible(visibleFields, 'engine') && engine && (\n <Text color=\"complementary\">{engine}</Text>\n )}\n {isFieldVisible(visibleFields, 'isPrivate') && (\n <HistoryPrivateIcon isPrivate={isPrivate} />\n )}\n </Flex>\n </div>\n </Flex>\n </RowLink>\n );\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,MAAA,GAAAD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SAAS,EAAE9B,KAAK,CAAC,UAAU,CAAE;UAC7Ba,MAAM,EAAEA,MAAO;UACfE,SAAS,EAAEA,SAAU;UACrBC,OAAO,EAAEA;QAAQ,CACpB,CACJ,eACD,IAAAW,gBAAA,EAACQ,WAAI;UAACE,GAAG,EAAE,CAAE;UAAAL,QAAA,GACR,IAAAS,8BAAc,EAAC/B,aAAa,EAAE,MAAM,CAAC,IAAII,IAAI,iBAC1C,IAAAmB,eAAA,EAACU,WAAI;YAACC,KAAK,EAAC,eAAe;YAAAZ,QAAA,EAAElB;UAAI,CAAO,CAC3C,EACA,IAAA2B,8BAAc,EAAC/B,aAAa,EAAE,WAAW,CAAC,IAAIK,SAAS,iBACpD,IAAAkB,eAAA,EAACU,WAAI;YAACC,KAAK,EAAC,eAAe;YAAAZ,QAAA,EAAE,IAAAa,gBAAU,EAAC9B,SAAS;UAAC,CAAO,CAC5D,EACA,IAAA0B,8BAAc,EAAC/B,aAAa,EAAE,QAAQ,CAAC,IAAIO,MAAM,iBAC9C,IAAAgB,eAAA,EAACU,WAAI;YAACC,KAAK,EAAC,eAAe;YAAAZ,QAAA,EAAEf;UAAM,CAAO,CAC7C,EACA,IAAAwB,8BAAc,EAAC/B,aAAa,EAAE,WAAW,CAAC,iBACvC,IAAAuB,eAAA,EAACa,8BAAkB;YAAC5B,SAAS,EAAEA;UAAU,CAAE,CAC9C;QAAA,CACC,CAAC;MAAA,CACN,CAAC;IAAA,CACJ,CAAC;EAAA,CACF,CAAC;AAElB,CAAC","ignoreList":[]}
|
|
@@ -5,4 +5,4 @@ import './HistorySearchRow.scss';
|
|
|
5
5
|
export type Props<T extends QueryHistoryRow> = {
|
|
6
6
|
item: T;
|
|
7
7
|
} & Omit<QueryListRowRenderData<T>, 'item' | 'variant'>;
|
|
8
|
-
export declare const HistorySearchRow: <T extends QueryHistoryRow>({ item, visibleFields, editing, comparison, }: Props<T>) => React.JSX.Element;
|
|
8
|
+
export declare const HistorySearchRow: <T extends QueryHistoryRow>({ item, visibleFields, editing, comparison, renderLink, }: Props<T>) => React.JSX.Element;
|
|
@@ -19,7 +19,8 @@ var HistorySearchRow = exports.HistorySearchRow = function HistorySearchRow(_ref
|
|
|
19
19
|
var item = _ref.item,
|
|
20
20
|
visibleFields = _ref.visibleFields,
|
|
21
21
|
editing = _ref.editing,
|
|
22
|
-
comparison = _ref.comparison
|
|
22
|
+
comparison = _ref.comparison,
|
|
23
|
+
renderLink = _ref.renderLink;
|
|
23
24
|
var href = item.href,
|
|
24
25
|
status = item.status,
|
|
25
26
|
startTime = item.startTime,
|
|
@@ -33,6 +34,7 @@ var HistorySearchRow = exports.HistorySearchRow = function HistorySearchRow(_ref
|
|
|
33
34
|
language: (0, _resolveMonacoLanguage.resolveMonacoLanguage)(engine),
|
|
34
35
|
href: href,
|
|
35
36
|
disabled: Boolean(editing === null || editing === void 0 ? void 0 : editing.enabled) || Boolean(comparison === null || comparison === void 0 ? void 0 : comparison.enabled),
|
|
37
|
+
renderLink: renderLink,
|
|
36
38
|
className: block(),
|
|
37
39
|
header: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_uikit.Flex, {
|
|
38
40
|
gap: 2,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_uikit","_components","_time","_isFieldVisible","_resolveMonacoLanguage","_bemCnLite","_jsxRuntime","e","__esModule","default","block","cn","HistorySearchRow","exports","_ref","item","visibleFields","editing","comparison","href","status","startTime","endTime","engine","mode","isPrivate","query","_jsx","SearchRowLayout","language","resolveMonacoLanguage","disabled","Boolean","enabled","className","header","_jsxs","Flex","gap","alignItems","children","QueryStatusIcon","isFieldVisible","QueryDuration","Text","color","formatTimeCanonical","HistoryPrivateIcon"],"sources":["HistorySearchRow.tsx"],"sourcesContent":["import React from 'react';\nimport {Flex, Text} from '@gravity-ui/uikit';\nimport {QueryListRowRenderData} from '../../types/queryList';\nimport {QueryHistoryRow} from '../../types/history';\nimport {\n HistoryPrivateIcon,\n QueryDuration,\n QueryStatusIcon,\n SearchRowLayout,\n} from '../../components';\nimport {formatTimeCanonical} from '../../helpers/time';\nimport {isFieldVisible} from '../../helpers/isFieldVisible';\nimport {resolveMonacoLanguage} from './helpers/resolveMonacoLanguage';\nimport './HistorySearchRow.scss';\nimport cn from 'bem-cn-lite';\n\nconst block = cn('qp-history-search-row');\n\nexport type Props<T extends QueryHistoryRow> = {\n item: T;\n} & Omit<QueryListRowRenderData<T>, 'item' | 'variant'>;\n\nexport const HistorySearchRow = <T extends QueryHistoryRow>({\n item,\n visibleFields,\n editing,\n comparison,\n}: Props<T>) => {\n const {href, status, startTime, endTime, engine, mode, isPrivate, query} = item;\n\n return (\n <SearchRowLayout\n query={query}\n language={resolveMonacoLanguage(engine)}\n href={href}\n disabled={Boolean(editing?.enabled) || Boolean(comparison?.enabled)}\n className={block()}\n header={\n <Flex gap={2} alignItems=\"center\" className={block('header')}>\n <QueryStatusIcon status={status} className={block('icon')} />\n {isFieldVisible(visibleFields, 'duration') && startTime && (\n <QueryDuration status={status} startTime={startTime} endTime={endTime} />\n )}\n {isFieldVisible(visibleFields, 'mode') && mode && (\n <Text color=\"complementary\">{mode}</Text>\n )}\n {isFieldVisible(visibleFields, 'startTime') && startTime && (\n <Text color=\"complementary\" className={block('start-time')}>\n {formatTimeCanonical(startTime)}\n </Text>\n )}\n {isFieldVisible(visibleFields, 'engine') && engine && (\n <Text color=\"complementary\">{engine}</Text>\n )}\n {isFieldVisible(visibleFields, 'isPrivate') && (\n <HistoryPrivateIcon isPrivate={isPrivate} />\n )}\n </Flex>\n }\n />\n );\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAGA,IAAAE,WAAA,GAAAF,OAAA;AAMA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,sBAAA,GAAAL,OAAA;AACAA,OAAA;AACA,IAAAM,UAAA,GAAAP,sBAAA,CAAAC,OAAA;AAA6B,IAAAO,WAAA,GAAAP,OAAA;AAAA,SAAAD,uBAAAS,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE7B,IAAMG,KAAK,GAAG,IAAAC,kBAAE,EAAC,uBAAuB,CAAC;AAMlC,IAAMC,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG,SAAnBA,gBAAgBA,CAAAE,IAAA,
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_uikit","_components","_time","_isFieldVisible","_resolveMonacoLanguage","_bemCnLite","_jsxRuntime","e","__esModule","default","block","cn","HistorySearchRow","exports","_ref","item","visibleFields","editing","comparison","renderLink","href","status","startTime","endTime","engine","mode","isPrivate","query","_jsx","SearchRowLayout","language","resolveMonacoLanguage","disabled","Boolean","enabled","className","header","_jsxs","Flex","gap","alignItems","children","QueryStatusIcon","isFieldVisible","QueryDuration","Text","color","formatTimeCanonical","HistoryPrivateIcon"],"sources":["HistorySearchRow.tsx"],"sourcesContent":["import React from 'react';\nimport {Flex, Text} from '@gravity-ui/uikit';\nimport {QueryListRowRenderData} from '../../types/queryList';\nimport {QueryHistoryRow} from '../../types/history';\nimport {\n HistoryPrivateIcon,\n QueryDuration,\n QueryStatusIcon,\n SearchRowLayout,\n} from '../../components';\nimport {formatTimeCanonical} from '../../helpers/time';\nimport {isFieldVisible} from '../../helpers/isFieldVisible';\nimport {resolveMonacoLanguage} from './helpers/resolveMonacoLanguage';\nimport './HistorySearchRow.scss';\nimport cn from 'bem-cn-lite';\n\nconst block = cn('qp-history-search-row');\n\nexport type Props<T extends QueryHistoryRow> = {\n item: T;\n} & Omit<QueryListRowRenderData<T>, 'item' | 'variant'>;\n\nexport const HistorySearchRow = <T extends QueryHistoryRow>({\n item,\n visibleFields,\n editing,\n comparison,\n renderLink,\n}: Props<T>) => {\n const {href, status, startTime, endTime, engine, mode, isPrivate, query} = item;\n\n return (\n <SearchRowLayout\n query={query}\n language={resolveMonacoLanguage(engine)}\n href={href}\n disabled={Boolean(editing?.enabled) || Boolean(comparison?.enabled)}\n renderLink={renderLink}\n className={block()}\n header={\n <Flex gap={2} alignItems=\"center\" className={block('header')}>\n <QueryStatusIcon status={status} className={block('icon')} />\n {isFieldVisible(visibleFields, 'duration') && startTime && (\n <QueryDuration status={status} startTime={startTime} endTime={endTime} />\n )}\n {isFieldVisible(visibleFields, 'mode') && mode && (\n <Text color=\"complementary\">{mode}</Text>\n )}\n {isFieldVisible(visibleFields, 'startTime') && startTime && (\n <Text color=\"complementary\" className={block('start-time')}>\n {formatTimeCanonical(startTime)}\n </Text>\n )}\n {isFieldVisible(visibleFields, 'engine') && engine && (\n <Text color=\"complementary\">{engine}</Text>\n )}\n {isFieldVisible(visibleFields, 'isPrivate') && (\n <HistoryPrivateIcon isPrivate={isPrivate} />\n )}\n </Flex>\n }\n />\n );\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAGA,IAAAE,WAAA,GAAAF,OAAA;AAMA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,sBAAA,GAAAL,OAAA;AACAA,OAAA;AACA,IAAAM,UAAA,GAAAP,sBAAA,CAAAC,OAAA;AAA6B,IAAAO,WAAA,GAAAP,OAAA;AAAA,SAAAD,uBAAAS,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE7B,IAAMG,KAAK,GAAG,IAAAC,kBAAE,EAAC,uBAAuB,CAAC;AAMlC,IAAMC,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG,SAAnBA,gBAAgBA,CAAAE,IAAA,EAMb;EAAA,IALZC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IACJC,a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BAAa;QAACvB,MAAM,EAAEA,MAAO;QAACC,SAAS,EAAEA,SAAU;QAACC,OAAO,EAAEA;MAAQ,CAAE,CAC3E,EACA,IAAAoB,8BAAc,EAAC3B,aAAa,EAAE,MAAM,CAAC,IAAIS,IAAI,iBAC1C,IAAAG,eAAA,EAACiB,WAAI;QAACC,KAAK,EAAC,eAAe;QAAAL,QAAA,EAAEhB;MAAI,CAAO,CAC3C,EACA,IAAAkB,8BAAc,EAAC3B,aAAa,EAAE,WAAW,CAAC,IAAIM,SAAS,iBACpD,IAAAM,eAAA,EAACiB,WAAI;QAACC,KAAK,EAAC,eAAe;QAACX,SAAS,EAAEzB,KAAK,CAAC,YAAY,CAAE;QAAA+B,QAAA,EACtD,IAAAM,yBAAmB,EAACzB,SAAS;MAAC,CAC7B,CACT,EACA,IAAAqB,8BAAc,EAAC3B,aAAa,EAAE,QAAQ,CAAC,IAAIQ,MAAM,iBAC9C,IAAAI,eAAA,EAACiB,WAAI;QAACC,KAAK,EAAC,eAAe;QAAAL,QAAA,EAAEjB;MAAM,CAAO,CAC7C,EACA,IAAAmB,8BAAc,EAAC3B,aAAa,EAAE,WAAW,CAAC,iBACvC,IAAAY,eAAA,EAACoB,8BAAkB;QAACtB,SAAS,EAAEA;MAAU,CAAE,CAC9C;IAAA,CACC;EACT,CACJ,CAAC;AAEV,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { QueryListComparisonConfig, QueryListEditingConfig, QueryListFilterConfig, QueryListItem, QueryListRow, QueryListRowAction, QueryListRowRenderData, QueryListSearchConfig, QueryListVisibleFieldsConfig } from '../../types/queryList';
|
|
2
|
+
import { QueryListComparisonConfig, QueryListEditingConfig, QueryListFilterConfig, QueryListItem, QueryListLinkRenderer, QueryListRow, QueryListRowAction, QueryListRowRenderData, QueryListSearchConfig, QueryListVisibleFieldsConfig } from '../../types/queryList';
|
|
3
3
|
import './QueriesList.scss';
|
|
4
4
|
export type QueriesListProps<T extends QueryListRow> = {
|
|
5
5
|
className?: string;
|
|
@@ -15,5 +15,9 @@ export type QueriesListProps<T extends QueryListRow> = {
|
|
|
15
15
|
getRowActions?: (item: T) => QueryListRowAction<T>[];
|
|
16
16
|
renderRow: (data: QueryListRowRenderData<T>) => React.ReactNode;
|
|
17
17
|
onListItemClick?: (item: QueryListItem<T>) => void;
|
|
18
|
+
hasMore?: boolean;
|
|
19
|
+
loading?: boolean;
|
|
20
|
+
onLoadMore?: () => void;
|
|
21
|
+
renderLink?: QueryListLinkRenderer;
|
|
18
22
|
};
|
|
19
|
-
export declare const QueriesList: <T extends QueryListRow>({ title, logo, search, filter, items, selectedRowId, editing, comparison, visibleFields, getRowActions, renderRow, onListItemClick, className, }: QueriesListProps<T>) => React.JSX.Element;
|
|
23
|
+
export declare const QueriesList: <T extends QueryListRow>({ title, logo, search, filter, items, selectedRowId, editing, comparison, visibleFields, getRowActions, renderRow, onListItemClick, hasMore, loading, onLoadMore, renderLink, className, }: QueriesListProps<T>) => React.JSX.Element;
|