@topconsultnpm/sdkui-react-beta 6.12.25 → 6.12.27
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.
@@ -42,6 +42,7 @@ export * from './choosers/TMUserChooser';
|
|
42
42
|
export { default as TMValidationItemsList } from './grids/TMValidationItemsList';
|
43
43
|
export * from './query/TMQueryEditor';
|
44
44
|
export * from './query/TMQueryResultForm';
|
45
|
+
export * from './query/TMQuerySummary';
|
45
46
|
export * from './base/TMTab';
|
46
47
|
export { default as TMHeader } from "./sidebar/TMHeader";
|
47
48
|
export { default as TMSidebar } from "./sidebar/TMSidebar";
|
package/lib/components/index.js
CHANGED
@@ -47,6 +47,7 @@ export { default as TMValidationItemsList } from './grids/TMValidationItemsList'
|
|
47
47
|
//query
|
48
48
|
export * from './query/TMQueryEditor';
|
49
49
|
export * from './query/TMQueryResultForm';
|
50
|
+
export * from './query/TMQuerySummary';
|
50
51
|
//tab
|
51
52
|
export * from './base/TMTab';
|
52
53
|
// others
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { QueryDescriptor, ValidationItem } from '@topconsultnpm/sdk-ts-beta';
|
3
|
+
interface ITMQuerySummary {
|
4
|
+
children?: React.ReactNode;
|
5
|
+
qd?: QueryDescriptor;
|
6
|
+
validationItems?: ValidationItem[];
|
7
|
+
raiseWarningForOnlyMetadataDcmtTypes?: boolean;
|
8
|
+
validateSelect?: boolean;
|
9
|
+
validateOrderBy?: boolean;
|
10
|
+
onValueChanged?: (value: QueryDescriptor | undefined) => void;
|
11
|
+
onEditClick?: () => void;
|
12
|
+
onClose?: () => void;
|
13
|
+
}
|
14
|
+
declare const TMQuerySummary: React.FunctionComponent<ITMQuerySummary>;
|
15
|
+
export default TMQuerySummary;
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { useState } from 'react';
|
3
|
+
import styled from 'styled-components';
|
4
|
+
import { QueryDescriptor, ResultTypes, TMScopeNames } from '@topconsultnpm/sdk-ts-beta';
|
5
|
+
import { FontSize } from '../../utils/theme';
|
6
|
+
import TMQueryEditor from './TMQueryEditor';
|
7
|
+
import TMButton from '../base/TMButton';
|
8
|
+
import { getQueryCountAsync, IconCount, IconEraser, IconPencil, SDKUI_Localizator } from '../../helper';
|
9
|
+
import TMVilViewer from '../base/TMVilViewer';
|
10
|
+
import { FormModes } from '../../ts';
|
11
|
+
// #region Style
|
12
|
+
const StyledWrapper = styled.div `
|
13
|
+
display: flex;
|
14
|
+
flex-direction: row;
|
15
|
+
align-items: flex-start;
|
16
|
+
justify-content: flex-start;
|
17
|
+
width: 100%;
|
18
|
+
font-size: ${FontSize.defaultFontSize};
|
19
|
+
`;
|
20
|
+
const StyledQueryToolbar = styled.div `
|
21
|
+
display: flex;
|
22
|
+
flex-direction: column;
|
23
|
+
width: max-content;
|
24
|
+
gap: 8px;
|
25
|
+
`;
|
26
|
+
const TMQuerySummary = ({ children, qd, validateSelect = true, validateOrderBy = true, raiseWarningForOnlyMetadataDcmtTypes = false, validationItems = [], onValueChanged, onEditClick, onClose }) => {
|
27
|
+
const [showEditor, setShowEditor] = useState(false);
|
28
|
+
const validationItemsQd = validationItems.filter(o => o.PropertyScopes.includes(TMScopeNames.qd) || o.PropertyName == TMScopeNames.qd);
|
29
|
+
return (_jsxs(StyledWrapper, { children: [_jsxs(StyledQueryToolbar, { children: [_jsx(TMButton, { caption: SDKUI_Localizator.QueryDefine, icon: _jsx(IconPencil, { fontSize: 16 }), btnStyle: 'toolbar', onClick: () => onEditClick ? onEditClick() : setShowEditor(!showEditor) }), _jsx(TMButton, { caption: SDKUI_Localizator.QueryCount, icon: _jsx(IconCount, { fontSize: 16 }), disabled: validationItemsQd.filter(o => o.ResultType == ResultTypes.ERROR).length > 0, btnStyle: 'toolbar', onClick: () => getQueryCountAsync(qd, true) }), _jsx(TMButton, { caption: SDKUI_Localizator.QueryClear, icon: _jsx(IconEraser, { fontSize: 16 }), btnStyle: 'toolbar', onClick: () => onValueChanged?.(new QueryDescriptor()) }), children] }), _jsxs("div", { style: { display: 'flex', flexDirection: 'column', width: '100%', overflowX: 'auto' }, children: [qd && qd.from &&
|
30
|
+
_jsx(TMQueryEditor, { formMode: FormModes.ReadOnly, inputData: qd, isModal: false, showToolbar: false, validateSelect: validateSelect, validateOrderBy: validateOrderBy, raiseWarningForOnlyMetadataDcmtTypes: raiseWarningForOnlyMetadataDcmtTypes }), _jsx("div", { style: { padding: '0px 5px' }, children: _jsx(TMVilViewer, { vil: validationItemsQd }) })] })] }));
|
31
|
+
};
|
32
|
+
export default TMQuerySummary;
|