@gravity-ui/querieskit 1.3.2 → 1.5.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.css +4 -0
- package/build/cjs/components/LazyList/LazyList.css.map +1 -1
- package/build/cjs/components/LazyList/LazyList.js +38 -5
- package/build/cjs/components/LazyList/LazyList.js.map +1 -1
- package/build/cjs/components/QueryDuration/QueryDuration.stories.js +7 -0
- package/build/cjs/components/QueryDuration/QueryDuration.stories.js.map +1 -1
- package/build/cjs/components/QueryDuration/useQueryDuration.d.ts +1 -1
- package/build/cjs/components/QueryDuration/useQueryDuration.js +22 -16
- package/build/cjs/components/QueryDuration/useQueryDuration.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/time.d.ts +1 -1
- package/build/cjs/helpers/time.js +17 -12
- package/build/cjs/helpers/time.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.css +2 -1
- package/build/cjs/modules/HistoryRow/HistoryRow.css.map +1 -1
- package/build/cjs/modules/HistoryRow/HistoryRow.d.ts +1 -1
- package/build/cjs/modules/HistoryRow/HistoryRow.js +5 -3
- 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 +7 -0
- package/build/cjs/widgets/QueriesHistory/QueriesHistory.stories.js +279 -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.css +4 -0
- package/build/esm/components/LazyList/LazyList.css.map +1 -1
- package/build/esm/components/LazyList/LazyList.js +40 -7
- package/build/esm/components/LazyList/LazyList.js.map +1 -1
- package/build/esm/components/LazyList/LazyList.scss +5 -0
- package/build/esm/components/QueryDuration/QueryDuration.stories.js +7 -0
- package/build/esm/components/QueryDuration/QueryDuration.stories.js.map +1 -1
- package/build/esm/components/QueryDuration/useQueryDuration.d.ts +1 -1
- package/build/esm/components/QueryDuration/useQueryDuration.js +22 -16
- package/build/esm/components/QueryDuration/useQueryDuration.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/time.d.ts +1 -1
- package/build/esm/helpers/time.js +18 -13
- package/build/esm/helpers/time.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.css +2 -1
- package/build/esm/modules/HistoryRow/HistoryRow.css.map +1 -1
- package/build/esm/modules/HistoryRow/HistoryRow.d.ts +1 -1
- package/build/esm/modules/HistoryRow/HistoryRow.js +5 -3
- package/build/esm/modules/HistoryRow/HistoryRow.js.map +1 -1
- package/build/esm/modules/HistoryRow/HistoryRow.scss +2 -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 +7 -0
- package/build/esm/widgets/QueriesHistory/QueriesHistory.stories.js +279 -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 +7 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useCallback","useEffect","useRef","useLoadMoreSentinel","hasMore","onLoadMore","observerRef","hasMoreRef","current","onLoadMoreRef","_observerRef$current","disconnect","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":["useCallback","useEffect","useRef","useLoadMoreSentinel","hasMore","onLoadMore","loading","itemsCount","observerRef","loadRequestedRef","hasMoreRef","current","onLoadMoreRef","preventRepeatedLoad","undefined","_observerRef$current","disconnect","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 [loading, preventRepeatedLoad],\n );\n}\n"],"mappings":";;;;AAAA,SAAQA,WAAW,EAAEC,SAAS,EAAEC,MAAM,QAAO,OAAO;AAEpD,OAAO,SAASC,mBAAmBA,CAC/BC,OAA4B,EAC5BC,UAAuB,EACvBC,OAAiB,EACjBC,UAAmB,EACrB;EACE,IAAMC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AAgB,CAACE,OAAO,GAAGE,mBAAmB;QAC9C,CAAAW,qBAAA,GAAAZ,aAAa,CAACD,OAAO,cAAAa,qBAAA,eAArBA,qBAAA,CAAAC,IAAA,CAAAb,aAAwB,CAAC;MAC7B;IACJ,CAAC,CAAC;IAEFJ,WAAW,CAACG,OAAO,CAACe,OAAO,CAACT,IAAI,CAAC;EACrC,CAAC,EACD,CAACX,OAAO,EAAEO,mBAAmB,CACjC,CAAC;AACL","ignoreList":[]}
|
|
@@ -13,6 +13,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
13
13
|
export var HistoryHeader = function HistoryHeader(_ref) {
|
|
14
14
|
var search = _ref.search,
|
|
15
15
|
fullSearch = _ref.fullSearch,
|
|
16
|
+
_ref$fullSearchAvaila = _ref.fullSearchAvailable,
|
|
17
|
+
fullSearchAvailable = _ref$fullSearchAvaila === void 0 ? true : _ref$fullSearchAvaila,
|
|
16
18
|
hasClear = _ref.hasClear,
|
|
17
19
|
filter = _ref.filter,
|
|
18
20
|
onUpdate = _ref.onUpdate,
|
|
@@ -21,19 +23,19 @@ export var HistoryHeader = function HistoryHeader(_ref) {
|
|
|
21
23
|
_useState2 = _slicedToArray(_useState, 2),
|
|
22
24
|
searchValue = _useState2[0],
|
|
23
25
|
setSearchValue = _useState2[1];
|
|
24
|
-
var _useState3 = useState(
|
|
26
|
+
var _useState3 = useState(fullSearchAvailable && Boolean(fullSearch)),
|
|
25
27
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
26
28
|
isFullSearch = _useState4[0],
|
|
27
29
|
setFullSearch = _useState4[1];
|
|
28
30
|
useEffect(function () {
|
|
29
31
|
setSearchValue(search || '');
|
|
30
|
-
setFullSearch(
|
|
31
|
-
}, [search, fullSearch]);
|
|
32
|
+
setFullSearch(fullSearchAvailable && Boolean(fullSearch));
|
|
33
|
+
}, [search, fullSearch, fullSearchAvailable]);
|
|
32
34
|
var handleOnUpdate = function handleOnUpdate(newValue) {
|
|
33
35
|
setSearchValue(newValue);
|
|
34
36
|
onUpdate({
|
|
35
37
|
value: newValue,
|
|
36
|
-
fullSearch: isFullSearch
|
|
38
|
+
fullSearch: fullSearchAvailable && isFullSearch
|
|
37
39
|
});
|
|
38
40
|
};
|
|
39
41
|
var handleModeChange = function handleModeChange() {
|
|
@@ -49,10 +51,10 @@ export var HistoryHeader = function HistoryHeader(_ref) {
|
|
|
49
51
|
value: searchValue,
|
|
50
52
|
hasClear: hasClear,
|
|
51
53
|
onUpdate: handleOnUpdate,
|
|
52
|
-
innerButtons: [/*#__PURE__*/_jsx(FullSearchToggleButton, {
|
|
54
|
+
innerButtons: fullSearchAvailable ? [/*#__PURE__*/_jsx(FullSearchToggleButton, {
|
|
53
55
|
active: isFullSearch,
|
|
54
56
|
onClick: handleModeChange
|
|
55
|
-
}, "full-search")],
|
|
57
|
+
}, "full-search")] : undefined,
|
|
56
58
|
endButtons: filter ? [/*#__PURE__*/_jsx(HistoryFilter, _objectSpread({}, filter), "filter")] : undefined
|
|
57
59
|
});
|
|
58
60
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","useState","FullSearchToggleButton","HistoryFilter","SearchWithButtons","jsx","_jsx","HistoryHeader","_ref","search","fullSearch","hasClear","filter","onUpdate","className","_useState","_useState2","_slicedToArray","searchValue","setSearchValue","_useState3","_useState4","isFullSearch","setFullSearch","handleOnUpdate","newValue","value","handleModeChange","innerButtons","active","onClick","
|
|
1
|
+
{"version":3,"names":["React","useEffect","useState","FullSearchToggleButton","HistoryFilter","SearchWithButtons","jsx","_jsx","HistoryHeader","_ref","search","fullSearch","_ref$fullSearchAvaila","fullSearchAvailable","hasClear","filter","onUpdate","className","_useState","_useState2","_slicedToArray","searchValue","setSearchValue","_useState3","Boolean","_useState4","isFullSearch","setFullSearch","handleOnUpdate","newValue","value","handleModeChange","innerButtons","active","onClick","undefined","endButtons","_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,OAAOA,KAAK,IAAOC,SAAS,EAAEC,QAAQ,QAAO,OAAO;AACpD,SAAQC,sBAAsB;AAC9B,SAAQC,aAAa,EAAEC,iBAAiB;AAA0B,SAAAC,GAAA,IAAAC,IAAA;AAalE,OAAO,IAAMC,aAAwB,GAAG,SAA3BA,aAAwBA,CAAAC,IAAA,EAQ/B;EAAA,IAPFC,MAAM,GAAAD,IAAA,CAANC,MAAM;IACNC,UAA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AAEkB;IAAQ,CAAC,CAAC;EACxD,CAAC;EAED,oBACItB,IAAA,CAACF,iBAAiB;IACdY,SAAS,EAAEA,SAAU;IACrBa,KAAK,EAAET,WAAY;IACnBP,QAAQ,EAAEA,QAAS;IACnBE,QAAQ,EAAEY,cAAe;IACzBI,YAAY,EACRnB,mBAAmB,GACb,cACIN,IAAA,CAACJ,sBAAsB;MAEnB8B,MAAM,EAAEP,YAAa;MACrBQ,OAAO,EAAEH;IAAiB,GAFtB,aAGP,CAAC,CACL,GACDI,SACT;IACDC,UAAU,EAAErB,MAAM,GAAG,cAACR,IAAA,CAACH,aAAa,EAAAiC,aAAA,KAAkBtB,MAAM,GAAnB,QAAsB,CAAC,CAAC,GAAGoB;EAAU,CACjF,CAAC;AAEV,CAAC","ignoreList":[]}
|
|
@@ -19,10 +19,11 @@
|
|
|
19
19
|
}
|
|
20
20
|
.qp-history-row__data {
|
|
21
21
|
display: grid;
|
|
22
|
-
grid-template-columns:
|
|
22
|
+
grid-template-columns: minmax(64px, max-content) 1fr;
|
|
23
23
|
grid-gap: 8px;
|
|
24
24
|
}
|
|
25
25
|
.qp-history-row__duration {
|
|
26
26
|
text-align: center;
|
|
27
|
+
white-space: nowrap;
|
|
27
28
|
}
|
|
28
29
|
/*# sourceMappingURL=HistoryRow.css.map */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["HistoryRow.scss"],"names":[],"mappings":"AAAA;EACE,YAAA;EACA,aAAA;EACA,+BAAA;EACA,aAAA;EAAA,QAAA;AACF;AACE;EACE,mDAAA;AACJ;AAEE;EACE,cAAA;AAAJ;AAGE;EACE,YAAA;AADJ;AAIE;EACE,gBAAA;AAFJ;AAKE;EACE,aAAA;EACA
|
|
1
|
+
{"version":3,"sources":["HistoryRow.scss"],"names":[],"mappings":"AAAA;EACE,YAAA;EACA,aAAA;EACA,+BAAA;EACA,aAAA;EAAA,QAAA;AACF;AACE;EACE,mDAAA;AACJ;AAEE;EACE,cAAA;AAAJ;AAGE;EACE,YAAA;AADJ;AAIE;EACE,gBAAA;AAFJ;AAKE;EACE,aAAA;EACA,oDAAA;EACA,aAAA;AAHJ;AAME;EACE,kBAAA;EACA,mBAAA;AAJJ","file":"HistoryRow.css","sourcesContent":[".qp-history-row {\n height: 100%;\n display: grid;\n grid-template-columns: 20px 1fr;\n gap: 4px;\n\n &_compared {\n background-color: var(--g-color-base-utility-light);\n }\n\n &__icon {\n flex: 0 0 20px;\n }\n\n &__header {\n height: 20px;\n }\n\n &__right-column {\n overflow: hidden;\n }\n\n &__data {\n display: grid;\n grid-template-columns: minmax(64px, max-content) 1fr;\n grid-gap: 8px;\n }\n\n &__duration {\n text-align: center;\n white-space: nowrap;\n }\n}\n"],"sourceRoot":""}
|
|
@@ -5,4 +5,4 @@ import './HistoryRow.scss';
|
|
|
5
5
|
export type Props<T extends QueryHistoryRow> = {
|
|
6
6
|
item: T;
|
|
7
7
|
} & Omit<QueryListRowRenderData<T>, 'item' | '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;
|
|
@@ -14,7 +14,8 @@ export var HistoryRow = function HistoryRow(_ref) {
|
|
|
14
14
|
isActive = _ref.isActive,
|
|
15
15
|
comparison = _ref.comparison,
|
|
16
16
|
editing = _ref.editing,
|
|
17
|
-
visibleFields = _ref.visibleFields
|
|
17
|
+
visibleFields = _ref.visibleFields,
|
|
18
|
+
renderLink = _ref.renderLink;
|
|
18
19
|
var href = item.href,
|
|
19
20
|
status = item.status,
|
|
20
21
|
mode = item.mode,
|
|
@@ -29,6 +30,7 @@ export var HistoryRow = function HistoryRow(_ref) {
|
|
|
29
30
|
return /*#__PURE__*/_jsxs(RowLink, {
|
|
30
31
|
href: href,
|
|
31
32
|
disabled: isEditing || isComparisonMode,
|
|
33
|
+
renderLink: renderLink,
|
|
32
34
|
className: block(_defineProperty(_defineProperty({}, status, true), "compared", isChecked)),
|
|
33
35
|
children: [/*#__PURE__*/_jsx(QueryStatusIcon, {
|
|
34
36
|
status: status
|
|
@@ -48,7 +50,7 @@ export var HistoryRow = function HistoryRow(_ref) {
|
|
|
48
50
|
})]
|
|
49
51
|
}), /*#__PURE__*/_jsxs("div", {
|
|
50
52
|
className: block('data'),
|
|
51
|
-
children: [isFieldVisible(visibleFields, 'duration') && startTime && /*#__PURE__*/_jsx(QueryDuration, {
|
|
53
|
+
children: [isFieldVisible(visibleFields, 'duration') && startTime !== undefined && /*#__PURE__*/_jsx(QueryDuration, {
|
|
52
54
|
className: block('duration'),
|
|
53
55
|
status: status,
|
|
54
56
|
startTime: startTime,
|
|
@@ -58,7 +60,7 @@ export var HistoryRow = function HistoryRow(_ref) {
|
|
|
58
60
|
children: [isFieldVisible(visibleFields, 'mode') && mode && /*#__PURE__*/_jsx(Text, {
|
|
59
61
|
color: "complementary",
|
|
60
62
|
children: mode
|
|
61
|
-
}), isFieldVisible(visibleFields, 'startTime') && startTime && /*#__PURE__*/_jsx(Text, {
|
|
63
|
+
}), isFieldVisible(visibleFields, 'startTime') && startTime !== undefined && /*#__PURE__*/_jsx(Text, {
|
|
62
64
|
color: "complementary",
|
|
63
65
|
children: formatTime(startTime)
|
|
64
66
|
}), isFieldVisible(visibleFields, 'engine') && engine && /*#__PURE__*/_jsx(Text, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Flex","Text","cn","EditableRowTitle","HistoryPrivateIcon","QueryDuration","QueryStatusIcon","RowActionsMenu","RowLink","formatTime","isFieldVisible","jsx","_jsx","jsxs","_jsxs","block","HistoryRow","_ref","item","actions","isActive","comparison","editing","visibleFields","href","status","mode","startTime","endTime","engine","isPrivate","isEditing","Boolean","enabled","isComparisonMode","isChecked","checked","showMenu","length","disabled","className","_defineProperty","children","direction","gap","justifyContent","color"],"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,OAAOA,KAAK,MAAM,OAAO;AAGzB,SAAQC,IAAI,EAAEC,IAAI,QAAO,mBAAmB;AAC5C;AACA,OAAOC,EAAE,MAAM,aAAa;AAC5B,SACIC,gBAAgB,EAChBC,kBAAkB,EAClBC,aAAa,EACbC,eAAe,EACfC,cAAc,EACdC,OAAO;AAEX,SAAQC,UAAU;AAClB,SAAQC,cAAc;AAAsC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAM5D,IAAMC,KAAK,GAAGb,EAAE,CAAC,gBAAgB,CAAC;AAElC,OAAO,IAAMc,UAAU,GAAG,SAAbA,UAAUA,CAAAC,IAAA,
|
|
1
|
+
{"version":3,"names":["React","Flex","Text","cn","EditableRowTitle","HistoryPrivateIcon","QueryDuration","QueryStatusIcon","RowActionsMenu","RowLink","formatTime","isFieldVisible","jsx","_jsx","jsxs","_jsxs","block","HistoryRow","_ref","item","actions","isActive","comparison","editing","visibleFields","renderLink","href","status","mode","startTime","endTime","engine","isPrivate","isEditing","Boolean","enabled","isComparisonMode","isChecked","checked","showMenu","length","disabled","className","_defineProperty","children","direction","gap","justifyContent","undefined","color"],"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 !== undefined && (\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 !== undefined && (\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,OAAOA,KAAK,MAAM,OAAO;AAGzB,SAAQC,IAAI,EAAEC,IAAI,QAAO,mBAAmB;AAC5C;AACA,OAAOC,EAAE,MAAM,aAAa;AAC5B,SACIC,gBAAgB,EAChBC,kBAAkB,EAClBC,aAAa,EACbC,eAAe,EACfC,cAAc,EACdC,OAAO;AAEX,SAAQC,UAAU;AAClB,SAAQC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AAA,EAAEhB;UAAI,CAAO,CAC3C,EACAjB,cAAc,CAACa,aAAa,EAAE,WAAW,CAAC,IAAIK,SAAS,KAAKmB,SAAS,iBAClEnC,IAAA,CAACX,IAAI;YAAC+C,KAAK,EAAC,eAAe;YAAAL,QAAA,EAAElC,UAAU,CAACmB,SAAS;UAAC,CAAO,CAC5D,EACAlB,cAAc,CAACa,aAAa,EAAE,QAAQ,CAAC,IAAIO,MAAM,iBAC9ClB,IAAA,CAACX,IAAI;YAAC+C,KAAK,EAAC,eAAe;YAAAL,QAAA,EAAEb;UAAM,CAAO,CAC7C,EACApB,cAAc,CAACa,aAAa,EAAE,WAAW,CAAC,iBACvCX,IAAA,CAACR,kBAAkB;YAAC2B,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;
|
|
@@ -12,7 +12,8 @@ export var HistorySearchRow = function HistorySearchRow(_ref) {
|
|
|
12
12
|
var item = _ref.item,
|
|
13
13
|
visibleFields = _ref.visibleFields,
|
|
14
14
|
editing = _ref.editing,
|
|
15
|
-
comparison = _ref.comparison
|
|
15
|
+
comparison = _ref.comparison,
|
|
16
|
+
renderLink = _ref.renderLink;
|
|
16
17
|
var href = item.href,
|
|
17
18
|
status = item.status,
|
|
18
19
|
startTime = item.startTime,
|
|
@@ -26,6 +27,7 @@ export var HistorySearchRow = function HistorySearchRow(_ref) {
|
|
|
26
27
|
language: resolveMonacoLanguage(engine),
|
|
27
28
|
href: href,
|
|
28
29
|
disabled: Boolean(editing === null || editing === void 0 ? void 0 : editing.enabled) || Boolean(comparison === null || comparison === void 0 ? void 0 : comparison.enabled),
|
|
30
|
+
renderLink: renderLink,
|
|
29
31
|
className: block(),
|
|
30
32
|
header: /*#__PURE__*/_jsxs(Flex, {
|
|
31
33
|
gap: 2,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Flex","Text","HistoryPrivateIcon","QueryDuration","QueryStatusIcon","SearchRowLayout","formatTimeCanonical","isFieldVisible","resolveMonacoLanguage","cn","jsx","_jsx","jsxs","_jsxs","block","HistorySearchRow","_ref","item","visibleFields","editing","comparison","href","status","startTime","endTime","engine","mode","isPrivate","query","language","disabled","Boolean","enabled","className","header","gap","alignItems","children","color"],"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,OAAOA,KAAK,MAAM,OAAO;AACzB,SAAQC,IAAI,EAAEC,IAAI,QAAO,mBAAmB;AAG5C,SACIC,kBAAkB,EAClBC,aAAa,EACbC,eAAe,EACfC,eAAe;AAEnB,SAAQC,mBAAmB;AAC3B,SAAQC,cAAc;AACtB,SAAQC,qBAAqB;AAC7B;AACA,OAAOC,EAAE,MAAM,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE7B,IAAMC,KAAK,GAAGL,EAAE,CAAC,uBAAuB,CAAC;AAMzC,OAAO,IAAMM,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAAC,IAAA,
|
|
1
|
+
{"version":3,"names":["React","Flex","Text","HistoryPrivateIcon","QueryDuration","QueryStatusIcon","SearchRowLayout","formatTimeCanonical","isFieldVisible","resolveMonacoLanguage","cn","jsx","_jsx","jsxs","_jsxs","block","HistorySearchRow","_ref","item","visibleFields","editing","comparison","renderLink","href","status","startTime","endTime","engine","mode","isPrivate","query","language","disabled","Boolean","enabled","className","header","gap","alignItems","children","color"],"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,OAAOA,KAAK,MAAM,OAAO;AACzB,SAAQC,IAAI,EAAEC,IAAI,QAAO,mBAAmB;AAG5C,SACIC,kBAAkB,EAClBC,aAAa,EACbC,eAAe,E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ACb,IAAI;MAACoC,GAAG,EAAE,CAAE;MAACC,UAAU,EAAC,QAAQ;MAACH,SAAS,EAAEpB,KAAK,CAAC,QAAQ,CAAE;MAAAwB,QAAA,gBACzD3B,IAAA,CAACP,eAAe;QAACmB,MAAM,EAAEA,MAAO;QAACW,SAAS,EAAEpB,KAAK,CAAC,MAAM;MAAE,CAAE,CAAC,EAC5DP,cAAc,CAACW,aAAa,EAAE,UAAU,CAAC,IAAIM,SAAS,iBACnDb,IAAA,CAACR,aAAa;QAACoB,MAAM,EAAEA,MAAO;QAACC,SAAS,EAAEA,SAAU;QAACC,OAAO,EAAEA;MAAQ,CAAE,CAC3E,EACAlB,cAAc,CAACW,aAAa,EAAE,MAAM,CAAC,IAAIS,IAAI,iBAC1ChB,IAAA,CAACV,IAAI;QAACsC,KAAK,EAAC,eAAe;QAAAD,QAAA,EAAEX;MAAI,CAAO,CAC3C,EACApB,cAAc,CAACW,aAAa,EAAE,WAAW,CAAC,IAAIM,SAAS,iBACpDb,IAAA,CAACV,IAAI;QAACsC,KAAK,EAAC,eAAe;QAACL,SAAS,EAAEpB,KAAK,CAAC,YAAY,CAAE;QAAAwB,QAAA,EACtDhC,mBAAmB,CAACkB,SAAS;MAAC,CAC7B,CACT,EACAjB,cAAc,CAACW,aAAa,EAAE,QAAQ,CAAC,IAAIQ,MAAM,iBAC9Cf,IAAA,CAACV,IAAI;QAACsC,KAAK,EAAC,eAAe;QAAAD,QAAA,EAAEZ;MAAM,CAAO,CAC7C,EACAnB,cAAc,CAACW,aAAa,EAAE,WAAW,CAAC,iBACvCP,IAAA,CAACT,kBAAkB;QAAC0B,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;
|
|
@@ -9,7 +9,7 @@ import "core-js/modules/es.string.trim.js";
|
|
|
9
9
|
import React from 'react';
|
|
10
10
|
import cn from 'bem-cn-lite';
|
|
11
11
|
import { FieldsSelector } from "../../components";
|
|
12
|
-
import {
|
|
12
|
+
import { useListKey } from "../../helpers/useListKey";
|
|
13
13
|
import { HistoryComparisonActions } from "../HistoryComparisonActions";
|
|
14
14
|
import { HistoryHeader } from "../HistoryHeader";
|
|
15
15
|
import { HistoryLayout } from "../HistoryLayout";
|
|
@@ -31,9 +31,15 @@ export var QueriesList = function QueriesList(_ref) {
|
|
|
31
31
|
getRowActions = _ref.getRowActions,
|
|
32
32
|
renderRow = _ref.renderRow,
|
|
33
33
|
onListItemClick = _ref.onListItemClick,
|
|
34
|
+
hasMore = _ref.hasMore,
|
|
35
|
+
loading = _ref.loading,
|
|
36
|
+
onLoadMore = _ref.onLoadMore,
|
|
37
|
+
renderLink = _ref.renderLink,
|
|
34
38
|
className = _ref.className;
|
|
35
|
-
var
|
|
39
|
+
var fullSearchAvailable = search.fullSearchAvailable !== false;
|
|
40
|
+
var showSearchResults = Boolean(fullSearchAvailable && search.fullSearch && ((_search$value = search.value) === null || _search$value === void 0 ? void 0 : _search$value.trim()));
|
|
36
41
|
var rowVariant = showSearchResults ? 'search' : 'default';
|
|
42
|
+
var listKey = useListKey(items, rowVariant, Boolean(onLoadMore));
|
|
37
43
|
return /*#__PURE__*/_jsx(HistoryLayout, {
|
|
38
44
|
className: block(null, className),
|
|
39
45
|
title: title,
|
|
@@ -43,6 +49,7 @@ export var QueriesList = function QueriesList(_ref) {
|
|
|
43
49
|
className: block('header'),
|
|
44
50
|
search: search.value,
|
|
45
51
|
fullSearch: search.fullSearch,
|
|
52
|
+
fullSearchAvailable: fullSearchAvailable,
|
|
46
53
|
hasClear: search.hasClear,
|
|
47
54
|
filter: filter,
|
|
48
55
|
onUpdate: search.onUpdate
|
|
@@ -61,8 +68,12 @@ export var QueriesList = function QueriesList(_ref) {
|
|
|
61
68
|
getRowActions: getRowActions,
|
|
62
69
|
renderRow: renderRow,
|
|
63
70
|
showFiltersHint: Boolean(filter),
|
|
71
|
+
hasMore: hasMore,
|
|
72
|
+
loading: loading,
|
|
73
|
+
onLoadMore: onLoadMore,
|
|
74
|
+
renderLink: renderLink,
|
|
64
75
|
onItemClick: onListItemClick
|
|
65
|
-
},
|
|
76
|
+
}, listKey)
|
|
66
77
|
});
|
|
67
78
|
};
|
|
68
79
|
// #sourceMappingURL=QueriesList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","cn","FieldsSelector","
|
|
1
|
+
{"version":3,"names":["React","cn","FieldsSelector","useListKey","HistoryComparisonActions","HistoryHeader","HistoryLayout","RowsList","jsx","_jsx","block","QueriesList","_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","actions","_objectSpread","header","hasClear","onUpdate","footer","children","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":";;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,EAAE,MAAM,aAAa;AAC5B,SAAQC,cAAc;AACtB,SAAQC,UAAU;AAalB,SAAQC,wBAAwB;AAChC,SAAQC,aAAa;AACrB,SAAQC,aAAa;AACrB,SAAQC,QAAQ;AAChB;AAA4B,SAAAC,GAAA,IAAAC,IAAA;AAE5B,IAAMC,KAAK,GAAGT,EAAE,CAAC,iBAAiB,CAAC;AAsBnC,OAAO,IAAMU,WAAW,GAAG,SAAdA,WAAWA,CAAAC,IAAA,EAkBG;EAAA,IAAAC,aAAA;EAAA,IAj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iBAAIb,IAAA,CAACP,cAAc,EAAAsC,aAAA,KAAKlB,aAAa,CAAG,CAAE;IAChEmB,MAAM,eACFhC,IAAA,CAACJ,aAAa;MACVyB,SAAS,EAAEpB,KAAK,CAAC,QAAQ,CAAE;MAC3BM,MAAM,EAAEA,MAAM,CAACmB,KAAM;MACrBD,UAAU,EAAElB,MAAM,CAACkB,UAAW;MAC9BH,mBAAmB,EAAEA,mBAAoB;MACzCW,QAAQ,EAAE1B,MAAM,CAAC0B,QAAS;MAC1BzB,MAAM,EAAEA,MAAO;MACf0B,QAAQ,EAAE3B,MAAM,CAAC2B;IAAS,CAC7B,CACJ;IACDC,MAAM,EACFvB,UAAU,iBACNZ,IAAA,CAACL,wBAAwB;MACrBiB,UAAU,EAAEA,UAAW;MACvBS,SAAS,EAAEpB,KAAK,CAAC,oBAAoB;IAAE,CAC1C,CAER;IAAAmC,QAAA,eAEDpC,IAAA,CAACF,QAAQ;MAELW,KAAK,EAAEA,KAAM;MACbmB,UAAU,EAAEA,UAAW;MACvBlB,aAAa,EAAEA,aAAc;MAC7BG,aAAa,EAAEA,aAAc;MAC7BF,OAAO,EAAEA,OAAQ;MACjBC,UAAU,EAAEA,UAAW;MACvBE,aAAa,EAAEA,aAAc;MAC7BC,SAAS,EAAEA,SAAU;MACrBsB,eAAe,EAAEb,OAAO,CAAChB,MAAM,CAAE;MACjCS,OAAO,EAAEA,OAAQ;MACjBC,OAAO,EAAEA,OAAQ;MACjBC,UAAU,EAAEA,UAAW;MACvBC,UAAU,EAAEA,UAAW;MACvBkB,WAAW,EAAEtB;IAAgB,GAdxBa,OAeR;EAAC,CACS,CAAC;AAExB,CAAC","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;
|
|
@@ -20,6 +20,10 @@ export var RowsList = function RowsList(_ref) {
|
|
|
20
20
|
getRowActions = _ref.getRowActions,
|
|
21
21
|
renderRow = _ref.renderRow,
|
|
22
22
|
showFiltersHint = _ref.showFiltersHint,
|
|
23
|
+
hasMore = _ref.hasMore,
|
|
24
|
+
loading = _ref.loading,
|
|
25
|
+
onLoadMore = _ref.onLoadMore,
|
|
26
|
+
renderLink = _ref.renderLink,
|
|
23
27
|
className = _ref.className,
|
|
24
28
|
onItemClick = _ref.onItemClick;
|
|
25
29
|
var getItemHeight = function getItemHeight(item) {
|
|
@@ -36,12 +40,6 @@ export var RowsList = function RowsList(_ref) {
|
|
|
36
40
|
var selected = comparison.comparedRowIds.includes(item.id);
|
|
37
41
|
comparison.onChange(item, !selected);
|
|
38
42
|
};
|
|
39
|
-
if (!items.length) {
|
|
40
|
-
return /*#__PURE__*/_jsx(EmptyContent, {
|
|
41
|
-
variant: showFiltersHint ? 'nothing-found' : 'no-files',
|
|
42
|
-
className: className
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
43
|
return /*#__PURE__*/_jsx(LazyList, {
|
|
46
44
|
className: block(null, className),
|
|
47
45
|
items: items,
|
|
@@ -55,10 +53,18 @@ export var RowsList = function RowsList(_ref) {
|
|
|
55
53
|
visibleFields: visibleFields,
|
|
56
54
|
editing: editing,
|
|
57
55
|
comparison: comparison,
|
|
58
|
-
getRowActions: getRowActions
|
|
56
|
+
getRowActions: getRowActions,
|
|
57
|
+
renderLink: renderLink
|
|
59
58
|
}));
|
|
60
59
|
},
|
|
61
60
|
selectedItemIndex: selectedItemIndex,
|
|
61
|
+
hasMore: hasMore,
|
|
62
|
+
loading: loading,
|
|
63
|
+
onLoadMore: onLoadMore,
|
|
64
|
+
emptyContent: /*#__PURE__*/_jsx(EmptyContent, {
|
|
65
|
+
variant: showFiltersHint ? 'nothing-found' : 'no-files',
|
|
66
|
+
className: className
|
|
67
|
+
}),
|
|
62
68
|
onItemClick: handleItemClick
|
|
63
69
|
});
|
|
64
70
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","cn","EmptyContent","LazyList","prepareRowData","SEARCH_ROW_HEIGHT","jsx","_jsx","block","RowsList","_ref","items","selectedRowId","_ref$rowVariant","rowVariant","visibleFields","editing","comparison","getRowActions","renderRow","showFiltersHint","className","onItemClick","getItemHeight","item","height","selectedItemIndex","undefined","findIndex","id","handleItemClick","index","enabled","selected","comparedRowIds","includes","onChange","
|
|
1
|
+
{"version":3,"names":["React","cn","EmptyContent","LazyList","prepareRowData","SEARCH_ROW_HEIGHT","jsx","_jsx","block","RowsList","_ref","items","selectedRowId","_ref$rowVariant","rowVariant","visibleFields","editing","comparison","getRowActions","renderRow","showFiltersHint","hasMore","loading","onLoadMore","renderLink","className","onItemClick","getItemHeight","item","height","selectedItemIndex","undefined","findIndex","id","handleItemClick","index","enabled","selected","comparedRowIds","includes","onChange","itemHeight","renderItem","isActive","variant","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":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,EAAE,MAAM,aAAa;AAY5B,SAAQC,YAAY,EAAEC,QAAQ;AAC9B,SAAQC,cAAc;AACtB,SAAQC,iBAAiB;AACzB;AAAyB,SAAAC,GAAA,IAAAC,IAAA;AAEzB,IAAMC,KAAK,GAAGP,EAAE,CAAC,cAAc,CAAC;AAoBhC,OAAO,IAAMQ,QAAQ,GAAG,SAAXA,QAAQA,CAAAC,IAAA,EAgBG;EAAA,IAfpBC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,aAAa,GAAAF,IAAA,CAAbE,aAAa;IAAAC,eAAA,GAAAH,IAAA,CACbI,UAAU;IAAVA,UAAU,GAAAD,eAAA,cAAG,SAAS,GAAAA,eAAA;IACtBE,aAAa,GAAAL,IAAA,CAAbK,aAAa;IACbC,OAAO,GAAAN,IAAA,CAAPM,OAAO;IACPC,UAAU,GAAAP,IAAA,CAAVO,UAAU;IACVC,aAAa,GAAAR,IAAA,CAAbQ,aAAa;IACbC,S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AM;IACb8B,UAAU,EAAEd,aAAc;IAC1Be,UAAU,EAAE,SAAZA,UAAUA,CAAGd,IAAI,EAAEe,QAAQ,EAAER,KAAK;MAAA,OAC9BhB,SAAS,CACLf,cAAc,CAAC;QACXwB,IAAI,EAAJA,IAAI;QACJe,QAAQ,EAARA,QAAQ;QACRR,KAAK,EAALA,KAAK;QACLS,OAAO,EAAE9B,UAAU;QACnBC,aAAa,EAAbA,aAAa;QACbC,OAAO,EAAPA,OAAO;QACPC,UAAU,EAAVA,UAAU;QACVC,aAAa,EAAbA,aAAa;QACbM,UAAU,EAAVA;MACJ,CAAC,CACL,CAAC;IAAA,CACJ;IACDM,iBAAiB,EAAEA,iBAAkB;IACrCT,OAAO,EAAEA,OAAQ;IACjBC,OAAO,EAAEA,OAAQ;IACjBC,UAAU,EAAEA,UAAW;IACvBsB,YAAY,eACRtC,IAAA,CAACL,YAAY;MACT0C,OAAO,EAAExB,eAAe,GAAG,eAAe,GAAG,UAAW;MACxDK,SAAS,EAAEA;IAAU,CACxB,CACJ;IACDC,WAAW,EAAEQ;EAAgB,CAChC,CAAC;AAEV,CAAC","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 {};
|
|
@@ -8,7 +8,8 @@ export var prepareRowData = function prepareRowData(_ref) {
|
|
|
8
8
|
visibleFields = _ref.visibleFields,
|
|
9
9
|
editing = _ref.editing,
|
|
10
10
|
comparison = _ref.comparison,
|
|
11
|
-
getRowActions = _ref.getRowActions
|
|
11
|
+
getRowActions = _ref.getRowActions,
|
|
12
|
+
renderLink = _ref.renderLink;
|
|
12
13
|
var isRow = !('header' in item);
|
|
13
14
|
var actions = isRow && getRowActions ? getRowActions(item) : undefined;
|
|
14
15
|
var editingData = isRow && editing ? {
|
|
@@ -28,7 +29,8 @@ export var prepareRowData = function prepareRowData(_ref) {
|
|
|
28
29
|
visibleFields: visibleFields,
|
|
29
30
|
actions: actions,
|
|
30
31
|
editing: editingData,
|
|
31
|
-
comparison: comparisonData
|
|
32
|
+
comparison: comparisonData,
|
|
33
|
+
renderLink: renderLink
|
|
32
34
|
};
|
|
33
35
|
};
|
|
34
36
|
// #sourceMappingURL=prepareRowData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["prepareRowData","_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","_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":";;AAwBA,OAAO,IAAMA,cAAc,GAAG,SAAjBA,cAAcA,CAAAC,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":[]}
|