@topconsultnpm/sdkui-react-beta 6.12.15 → 6.12.16

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.
@@ -1,7 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useState } from 'react';
2
+ import { useMemo, useState } from 'react';
3
3
  import { SDK_Localizator, DataListCacheService } from '@topconsultnpm/sdk-ts-beta';
4
- import { Column } from 'devextreme-react/cjs/data-grid';
5
4
  import { StyledDivHorizontal } from '../base/Styled';
6
5
  import { IconSearch, SDKUI_Localizator, TMImageLibrary } from '../../helper';
7
6
  import TMSpinner from '../base/TMSpinner';
@@ -19,10 +18,12 @@ const TMDataListItemChooser = ({ labelColor, dataListId, icon, backgroundColor,
19
18
  export default TMDataListItemChooser;
20
19
  const cellRenderIcon = (data) => _jsx(TMImageLibrary, { imageID: data.data?.imageID });
21
20
  export const TMDataListItemChooserForm = (props) => {
22
- const renderDataGridColumns = [
23
- _jsx(Column, { dataField: "value", caption: SDKUI_Localizator.Value }, 0),
24
- _jsx(Column, { dataField: "name", caption: SDKUI_Localizator.Description }, 1)
25
- ];
21
+ const dataColumns = useMemo(() => {
22
+ return [
23
+ { key: 0, dataField: 'value', caption: SDKUI_Localizator.Value },
24
+ { key: 1, dataField: 'name', caption: SDKUI_Localizator.Description }
25
+ ];
26
+ }, []);
26
27
  const getItems = async (refreshCache) => {
27
28
  if (!props.dataListId)
28
29
  return [];
@@ -39,5 +40,5 @@ export const TMDataListItemChooserForm = (props) => {
39
40
  title += `: ${props.title}`;
40
41
  return title;
41
42
  };
42
- return (_jsx(TMChooserForm, { title: getTitle(), allowMultipleSelection: props.allowMultipleSelection, width: props.width, height: props.height, keyName: 'value', showDefaultColumns: false, hasShowId: false, columns: renderDataGridColumns, selectedIDs: props.selectedIDs, cellRenderIcon: cellRenderIcon, dataSource: props.dataSource, getItems: getItems, onClose: props.onClose, onChoose: (IDs) => props.onChoose?.(IDs) }));
43
+ return (_jsx(TMChooserForm, { title: getTitle(), allowMultipleSelection: props.allowMultipleSelection, width: props.width, height: props.height, keyName: 'value', showDefaultColumns: false, hasShowId: false, columns: dataColumns, selectedIDs: props.selectedIDs, cellRenderIcon: cellRenderIcon, dataSource: props.dataSource, getItems: getItems, onClose: props.onClose, onChoose: (IDs) => props.onChoose?.(IDs) }));
43
44
  };
@@ -1,6 +1,5 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useState } from 'react';
3
- import { Column } from 'devextreme-react/cjs/data-grid';
2
+ import { useEffect, useMemo, useState } from 'react';
4
3
  import { SDK_Localizator, SDK_Globals } from '@topconsultnpm/sdk-ts-beta';
5
4
  import { StyledDivHorizontal } from '../base/Styled';
6
5
  import TMSummary from '../editors/TMSummary';
@@ -25,6 +24,7 @@ const TMDiskChooser = ({ backgroundColor, elementStyle, values, dataSource, isMo
25
24
  _jsx(TMDiskChooserForm, { selectedIDs: values, dataSource: dataSource, onClose: () => setShowChooser(false), onChoose: (IDs) => { onValueChanged?.(IDs); } })] }));
26
25
  };
27
26
  export default TMDiskChooser;
27
+ const cellRenderIcon = () => _jsx(IconDisk, { color: '#767676' });
28
28
  export const TMDiskChooserForm = (props) => {
29
29
  const getItems = async (refreshCache) => {
30
30
  TMSpinner.show({ description: `${SDKUI_Localizator.Loading} - ${SDK_Localizator.Disks} ...` });
@@ -32,8 +32,10 @@ export const TMDiskChooserForm = (props) => {
32
32
  TMSpinner.hide();
33
33
  return items ?? [];
34
34
  };
35
- const renderDataGridColumns = [
36
- _jsx(Column, { dataField: "uncPath", caption: 'Percorso UNC' }, 3),
37
- ];
38
- return (_jsx(TMChooserForm, { title: SDK_Localizator.Disks, allowMultipleSelection: false, hasShowId: true, showDefaultColumns: true, cellRenderIcon: () => _jsx(IconDisk, { color: '#767676' }), columns: renderDataGridColumns, manageUseLocalizedName: false, getItems: getItems, onClose: props.onClose, onChoose: (IDs) => { props.onChoose?.(IDs); } }));
35
+ const dataColumns = useMemo(() => {
36
+ return [
37
+ { dataField: 'uncPath', caption: 'Percorso UNC' }
38
+ ];
39
+ }, []);
40
+ return (_jsx(TMChooserForm, { title: SDK_Localizator.Disks, allowMultipleSelection: false, hasShowId: true, showDefaultColumns: true, cellRenderIcon: cellRenderIcon, columns: dataColumns, manageUseLocalizedName: false, getItems: getItems, onClose: props.onClose, onChoose: (IDs) => { props.onChoose?.(IDs); } }));
39
41
  };
@@ -1,7 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useEffect, useState } from 'react';
3
3
  import { DataColumnTypes, SDK_Localizator, DataListCacheService, SDK_Globals, LayoutModes } from '@topconsultnpm/sdk-ts-beta';
4
- import { Column } from 'devextreme-react/cjs/data-grid';
5
4
  import { IconDetails, IconSearch, getDataColumnName, Globalization, SDKUI_Localizator, searchResultDescriptorToSimpleArray, IsParametricQuery, IconWarning } from '../../helper';
6
5
  import { StyledDivHorizontal } from '../base/Styled';
7
6
  import TMSpinner from '../base/TMSpinner';
@@ -116,8 +115,9 @@ const TMDynDataListItemChooser = ({ tid, md, titleForm, openChooserBySingleClick
116
115
  } })] }));
117
116
  };
118
117
  export default TMDynDataListItemChooser;
118
+ const cellRenderIcon = () => _jsx(IconDetails, {});
119
119
  export const TMDynDataListItemChooserForm = (props) => {
120
- const renderDataGridColumns = props.searchResult?.dtdResult?.columns?.map((col, index) => {
120
+ const dataColumns = props.searchResult?.dtdResult?.columns?.map((col, index) => {
121
121
  let keyField = getDataColumnName(props.searchResult?.fromTID, col);
122
122
  const isVisible = col.extendedProperties?.["Visibility"] != "Hidden";
123
123
  const dataType = () => {
@@ -128,7 +128,7 @@ export const TMDynDataListItemChooserForm = (props) => {
128
128
  default: return "string";
129
129
  }
130
130
  };
131
- return (_jsx(Column, { dataField: keyField, caption: col.caption, visible: isVisible, dataType: dataType(), format: col.dataType === DataColumnTypes.DateTime ? Globalization.getDateDisplayFormat() : "" }, col.caption + index.toString()));
131
+ return { key: col.caption + index.toString(), dataField: keyField, caption: col.caption, visible: isVisible, dataType: dataType(), format: col.dataType === DataColumnTypes.DateTime ? Globalization.getDateDisplayFormat() : "" };
132
132
  });
133
133
  const keyValue = props.searchResult ? getDataColumnName(props.searchResult?.fromTID, props.searchResult?.dtdResult?.columns?.[props.dynDL?.selectItemForValue ?? 0]) : '';
134
134
  const getItems = async (refreshCache) => {
@@ -147,5 +147,5 @@ export const TMDynDataListItemChooserForm = (props) => {
147
147
  title += `: ${props.title}`;
148
148
  return title;
149
149
  };
150
- return (_jsx(TMChooserForm, { title: getTitle(), allowMultipleSelection: props.allowMultipleSelection, width: props.width, height: props.height, keyName: keyValue ?? '', showDefaultColumns: false, hasShowId: false, columns: renderDataGridColumns, selectedIDs: props.selectedIDs, cellRenderIcon: () => { return (_jsx(IconDetails, {})); }, dataSource: searchResultDescriptorToSimpleArray(props.searchResult) ?? [], getItems: getItems, onClose: props.onClose, onChoose: (IDs) => props.onChoose?.(IDs) }));
150
+ return (_jsx(TMChooserForm, { title: getTitle(), allowMultipleSelection: props.allowMultipleSelection, width: props.width, height: props.height, keyName: keyValue ?? '', showDefaultColumns: false, hasShowId: false, columns: dataColumns, selectedIDs: props.selectedIDs, cellRenderIcon: cellRenderIcon, dataSource: searchResultDescriptorToSimpleArray(props.searchResult) ?? [], getItems: getItems, onClose: props.onClose, onChoose: (IDs) => props.onChoose?.(IDs) }));
151
151
  };
@@ -3,39 +3,45 @@ import { MetadataDescriptor, QueryDescriptor, ValidationItem } from '@topconsult
3
3
  import { ITMChooserFormProps, ITMChooserProps, TID_MID } from '../../ts';
4
4
  import { TID_Alias } from '../../helper/queryHelper';
5
5
  interface ITMMetadataChooserProps extends ITMChooserProps {
6
- /** Consente di visualizzare anche i metadati di sistema */
6
+ /** Allows you to view system metadata */
7
7
  allowSysMetadata?: boolean;
8
- /** TIDs dei tipi documento da cui recuperare i metadati */
8
+ /** TIDs of document types to retrieve metadata from */
9
9
  tids?: number[];
10
- /** Qd da cui recuperare i metadati */
10
+ /** Qd to retrieve metadata from */
11
11
  qd?: QueryDescriptor;
12
- /** Contiene i TID / MID selezionati */
12
+ /** List of selected TIDs / MIDs */
13
13
  values?: TID_MID[];
14
- /** Visualizza anche il nome del tipo documento */
14
+ /** Displays the document type name */
15
15
  showCompleteMetadataName?: boolean;
16
- /** Se input è qd, visualizza solo i metadati presenti nella clausola Select */
16
+ /** Valid only if input is "qd". Displays only metadata present in the Select clause */
17
17
  qdShowOnlySelectItems?: boolean;
18
- /** predicate function per filtrare i metadati. Significativo per un solo tid (tids) */
19
- filterMetadata?: (value: MetadataDescriptor, index: number, array: MetadataDescriptor[]) => unknown;
20
- getColorIndex?: (tid: TID_Alias) => string;
18
+ /** show component border edge */
21
19
  showBorder?: boolean;
20
+ /** rounds the corners of border edge */
22
21
  borderRadius?: string;
22
+ /** if true, opens the form with a single click */
23
23
  openEditorOnSummaryClick?: boolean;
24
+ /** list of validation items */
24
25
  validationItems?: ValidationItem[];
26
+ /** predicate function to filter metadata. Meaningful for only one tid (tids) */
27
+ filterMetadata?: (value: MetadataDescriptor, index: number, array: MetadataDescriptor[]) => unknown;
28
+ /** Gets the color related to the document type */
29
+ getColorIndex?: (tid: TID_Alias) => string;
25
30
  }
26
31
  declare const TMMetadataChooser: React.FunctionComponent<ITMMetadataChooserProps>;
27
32
  export default TMMetadataChooser;
28
33
  interface ITMMetadataChooserFormProps extends ITMChooserFormProps<MetadataDescriptor> {
29
- /** Consente di visualizzare anche i metadati di sistema */
34
+ /** Allows you to view system metadata */
30
35
  allowSysMetadata?: boolean;
31
- /** TIDs dei tipi documento da cui recuperare i metadati */
36
+ /** TIDs of document types to retrieve metadata from */
32
37
  tids?: number[];
33
- /** predicate function per filtrare i metadati. Significativo per un solo tid (tids) */
34
- filterMetadata?: (value: MetadataDescriptor, index: number, array: MetadataDescriptor[]) => unknown;
35
- /** Qd da cui recuperare i metadati */
38
+ /** Query to retrieve metadata from */
36
39
  qd?: QueryDescriptor;
37
- /** Se input è qd, visualizza solo i metadati presenti nella clausola Select */
40
+ /** Valid only if input is "qd". Displays only metadata present in the Select clause */
38
41
  qdShowOnlySelectItems?: boolean;
42
+ /** predicate function to filter metadata. Meaningful for only one tid (tids) */
43
+ filterMetadata?: (value: MetadataDescriptor, index: number, array: MetadataDescriptor[]) => unknown;
44
+ /** Gets the color related to the document type */
39
45
  getColorIndex?: (tid: TID_Alias) => string;
40
46
  }
41
47
  export declare const TMMetadataChooserForm: React.FunctionComponent<ITMMetadataChooserFormProps>;
@@ -1,7 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useState } from 'react';
2
+ import { useCallback, useMemo, useState } from 'react';
3
3
  import { DcmtTypeDescriptor, DcmtTypeListCacheService, SDK_Globals, SDK_Localizator } from '@topconsultnpm/sdk-ts-beta';
4
- import { Column, GroupItem } from 'devextreme-react/cjs/data-grid';
5
4
  import { TMMetadataIcon, TMMidViewer, getDisplayAlias } from '../viewers/TMMidViewer';
6
5
  import { getTIDsByQd } from '../../helper/queryHelper';
7
6
  import { TMDcmtTypeIcon } from '../viewers/TMTidViewer';
@@ -22,10 +21,10 @@ const TMMetadataChooser = ({ tmSession, dataSource, showEditButton = true, butto
22
21
  };
23
22
  export default TMMetadataChooser;
24
23
  export const TMMetadataChooserForm = ({ tmSession, tids, qd, filterMetadata, qdShowOnlySelectItems, selectedIDs, dataSource, allowMultipleSelection, allowSysMetadata = true, width, height, getColorIndex, onClose, onChoose }) => {
25
- const [showSysMetadata, setShowSysMetadata] = useState(false);
24
+ const [showSysMetadata, setShowSysMetadata] = useState(allowSysMetadata && selectedIDs != undefined && selectedIDs.findIndex(o => o.mid < 150) >= 0);
26
25
  const [hasSysMetadata, setHasSysMetadata] = useState(false);
27
26
  const [dcmtTypes, setDcmtTypes] = useState([]);
28
- const getItems = async (refreshCache) => {
27
+ const getItems = useCallback(async (refreshCache) => {
29
28
  let dtdList = [];
30
29
  let metadata = [];
31
30
  let checkProps = qd != undefined ? dataSource != undefined || tids != undefined : dataSource != undefined && tids != undefined;
@@ -85,9 +84,8 @@ export const TMMetadataChooserForm = ({ tmSession, tids, qd, filterMetadata, qdS
85
84
  }
86
85
  setDcmtTypes(dtdList);
87
86
  setHasSysMetadata(allowSysMetadata && metadata.findIndex(md => md.isSystem == 1) >= 0);
88
- setShowSysMetadata(allowSysMetadata && selectedIDs != undefined && selectedIDs.findIndex(o => o.mid < 150) >= 0);
89
- return metadata;
90
- };
87
+ return showSysMetadata ? metadata : metadata.filter(o => o.isSystem != 1);
88
+ }, [showSysMetadata]);
91
89
  const cellRenderIcon = (data) => {
92
90
  let md = data.data;
93
91
  return (_jsx(TMMetadataIcon, { tid: md.customData1 ?? 0, md: md }));
@@ -97,20 +95,22 @@ export const TMMetadataChooserForm = ({ tmSession, tids, qd, filterMetadata, qdS
97
95
  let dtd = dcmtTypes?.find(o => o.id == tid_alias.tid);
98
96
  return _jsxs(StyledDxGridGroupHeader, { "$backgroundColor": getColorIndex?.(tid_alias), children: [_jsx(TMDcmtTypeIcon, { dtd: dtd }), _jsx("p", { children: getDisplayAlias(SDK_Globals.useLocalizedName ? dtd?.nameLoc : dtd?.name, tid_alias.alias) }), data.summaryItems && data.summaryItems.length > 0 && _jsx(StyledBadge, { "$backgroundColor": TMColors.info, children: data.summaryItems[0].value })] });
99
97
  };
100
- const renderDataGridColumns = [
101
- _jsx(Column, { dataField: 'isSystem', visible: false, width: 30 }, 0),
102
- _jsx(Column, { dataField: 'customData2', visible: false, groupIndex: dcmtTypes.length > 1 ? 0 : undefined, calculateCellValue: (rowData) => {
103
- let tid_alias = { tid: rowData.customData1, alias: rowData.customData2 };
104
- return JSON.stringify(tid_alias);
105
- }, groupCellRender: groupCellRender }, 1)
106
- ];
107
- const renderSummaryItems = [
108
- _jsx(GroupItem, { column: "id", summaryType: "count" }, 2)
109
- ];
110
- const renderCustomButtons = () => {
98
+ const dataColumns = useMemo(() => {
99
+ return [
100
+ { dataField: 'isSystem', visible: false },
101
+ {
102
+ dataField: 'customData2', visible: false, groupIndex: dcmtTypes.length > 1 ? 0 : undefined, groupCellRender: groupCellRender,
103
+ calculateCellValue: (rowData) => {
104
+ let tid_alias = { tid: rowData.customData1, alias: rowData.customData2 };
105
+ return JSON.stringify(tid_alias);
106
+ }
107
+ }
108
+ ];
109
+ }, [dcmtTypes, groupCellRender]);
110
+ const renderSummaryItems = { groupItems: [{ column: 'id', summaryType: 'count' }] };
111
+ const renderCustomButtons = useCallback(() => {
111
112
  return (_jsx(StyledDivHorizontal, { children: hasSysMetadata && _jsx(TMButton, { caption: SDKUI_Localizator.ShowHideMetadataSystemDesc, icon: _jsx(IconSettings, {}), btnStyle: 'toolbar', fontSize: '1.3rem', onClick: () => setShowSysMetadata(!showSysMetadata) }) }));
112
- };
113
- const convertID = (md) => { return { tid: md.customData1, mid: md.id, aliasTID: md.customData2 }; };
114
- const customFilter = (items) => { return showSysMetadata ? items : items.filter(o => o.isSystem != 1); };
115
- return (_jsx(TMChooserForm, { title: SDK_Localizator.Metadatas, allowMultipleSelection: allowMultipleSelection, allowSorting: false, allowGrouping: dcmtTypes.length > 1, width: width, height: height, selectedIDs: selectedIDs?.map((item) => item.mid), convertID: convertID, customFilter: customFilter, cellRenderIcon: cellRenderIcon, cellRenderNameAndDesc: (data) => { return _jsx("p", { style: { textAlign: 'left', color: data.data.isRequired == 1 ? 'red' : '' }, children: data.value }); }, dataSource: dataSource, getItems: getItems, customButtons: renderCustomButtons(), columns: renderDataGridColumns, summaryItems: renderSummaryItems, onClose: onClose, onChoose: (IDs) => onChoose?.(IDs) }));
113
+ }, [hasSysMetadata, showSysMetadata]);
114
+ const convertID = useCallback((md) => { return { tid: md.customData1, mid: md.id, aliasTID: md.customData2 }; }, []);
115
+ return (_jsx(TMChooserForm, { title: SDK_Localizator.Metadatas, allowMultipleSelection: allowMultipleSelection, allowSorting: false, allowGrouping: dcmtTypes.length > 1, width: width, height: height, selectedIDs: selectedIDs?.map((item) => item.mid), convertID: convertID, cellRenderIcon: cellRenderIcon, cellRenderNameAndDesc: (data) => { return _jsx("p", { style: { textAlign: 'left', color: data.data.isRequired == 1 ? 'red' : '' }, children: data.value }); }, dataSource: dataSource, getItems: getItems, customButtons: renderCustomButtons(), columns: dataColumns, summaryItems: renderSummaryItems, onClose: onClose, onChoose: (IDs) => { onChoose?.(IDs); } }));
116
116
  };
@@ -1,10 +1,9 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useState } from 'react';
2
+ import { useEffect, useMemo, useState } from 'react';
3
3
  import { SDK_Globals, RelationTypes, RelationCacheService, DcmtTypeListCacheService, SDK_Localizator } from '@topconsultnpm/sdk-ts-beta';
4
4
  import { IconSearch, IconRelationManyToMany, IconRelationOneToMany, SDKUI_Localizator } from '../../helper';
5
5
  import TMChooserForm from '../forms/TMChooserForm';
6
6
  import { StyledDivHorizontal, StyledTooltipContainer, StyledTooltipItem, StyledTooltipSeparatorItem } from '../base/Styled';
7
- import { Column } from 'devextreme-react/cjs/data-grid';
8
7
  import TMSpinner from '../base/TMSpinner';
9
8
  import TMSummary from '../editors/TMSummary';
10
9
  import TMTooltip from '../base/TMTooltip';
@@ -24,6 +23,12 @@ const TMRelationChooser = ({ tmSession, icon, dataSource, disabled, backgroundCo
24
23
  };
25
24
  export default TMRelationChooser;
26
25
  export const TMRelationChooserForm = (props) => {
26
+ // const [showId, setShowId] = useState<boolean>(false);
27
+ const dataColumns = useMemo(() => {
28
+ return [
29
+ { dataField: 'name', width: 'max' }
30
+ ];
31
+ }, []);
27
32
  const getItems = async (refreshCache) => {
28
33
  let tms = SDK_Globals.tmSession;
29
34
  if (refreshCache)
@@ -37,15 +42,8 @@ export const TMRelationChooserForm = (props) => {
37
42
  rels = rels.filter((r) => r.relationType == props.relationType).slice();
38
43
  return rels;
39
44
  };
40
- const [showId, setShowId] = useState(false);
41
- const handleShowIdChanged = () => { setShowId(!showId); };
42
- return (_jsx(TMChooserForm, { title: SDKUI_Localizator.Relations, allowMultipleSelection: props.allowMultipleSelection, hasShowOnlySelectedItems: true, width: props.width, height: props.height, selectedIDs: props.selectedIDs,
43
- //cellRenderIcon={(data: any) => { return props.relationType == RelationTypes.ManyToMany ? <IconRelationManyToMany /> : <IconRelationOneToMany /> }}
44
- cellRenderIcon: (data) => { return _jsx(TMRelationIcon, { rd: data.data, relationType: props.relationType }); }, showDefaultColumns: false,
45
- //cellRenderNameAndDesc={in questo caso utilizzare data.data ==> es.: data.data.name}
46
- columns: showId ?
47
- [_jsx(Column, { dataField: 'id', visible: true, width: 'auto' }, 1), _jsx(Column, { dataField: 'name', visible: true, width: 'max' }, 2)] :
48
- [_jsx(Column, { dataField: 'name', visible: true, width: 'max' }, 2)], dataSource: props.dataSource, getItems: getItems, onClose: props.onClose, onChoose: (IDs) => props.onChoose?.(IDs), onShowIdChanged: handleShowIdChanged, showId: props.showId }));
45
+ // const handleShowIdChanged = () => { setShowId(!showId); };
46
+ return (_jsx(TMChooserForm, { title: SDKUI_Localizator.Relations, allowMultipleSelection: props.allowMultipleSelection, hasShowOnlySelectedItems: true, width: props.width, height: props.height, selectedIDs: props.selectedIDs, cellRenderIcon: (data) => { return _jsx(TMRelationIcon, { rd: data.data, relationType: props.relationType }); }, showDefaultColumns: false, hasShowId: true, columns: dataColumns, dataSource: props.dataSource, getItems: getItems, onClose: props.onClose, onChoose: (IDs) => props.onChoose?.(IDs) }));
49
47
  };
50
48
  export const TMRelationIdViewer = ({ relationType, relationId, showIcon = false, noneSelectionText = `<${SDKUI_Localizator.NoneSelection}>` }) => {
51
49
  const [rel, setRel] = useState();
@@ -1,7 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useEffect, useState } from 'react';
2
+ import { useEffect, useMemo, useState } from 'react';
3
3
  import { OwnershipLevels, SDK_Localizator, UserLevels, UserListCacheService } from '@topconsultnpm/sdk-ts-beta';
4
- import { Column } from 'devextreme-react/cjs/data-grid';
5
4
  import { SDKUI_Localizator, IconSearch, IconUserLevelMember, IconUserLevelAdministrator, IconUserLevelSystemAdministrator, IconUserLevelAutonomousAdministrator, IconWarning, LocalizeOwnershipLevels, LocalizeUserLevels } from '../../helper';
6
5
  import { StyledDivHorizontal, StyledTooltipContainer, StyledTooltipSeparatorItem } from '../base/Styled';
7
6
  import TMSpinner from '../base/TMSpinner';
@@ -20,10 +19,12 @@ const TMUserChooser = ({ labelColor, titleForm, filter, readOnly = false, icon,
20
19
  };
21
20
  export default TMUserChooser;
22
21
  export const TMUserChooserForm = ({ allowMultipleSelection, hideRefresh = false, hideShowId = false, startWithShowOnlySelectedItems = true, filter, title, hasShowOnlySelectedItems, width, height, selectedIDs, dataSource, onClose, onChoose }) => {
23
- const renderDataGridColumns = [
24
- _jsx(Column, { dataField: "domain", caption: SDKUI_Localizator.Domain, dataType: 'string' }, 2),
25
- _jsx(Column, { dataField: "name", caption: SDKUI_Localizator.UserName, dataType: 'string' }, 3)
26
- ];
22
+ const dataColumns = useMemo(() => {
23
+ return [
24
+ { key: 2, dataField: 'domain', caption: SDKUI_Localizator.Domain, dataType: 'string' },
25
+ { key: 2, dataField: 'name', caption: SDKUI_Localizator.UserName, dataType: 'string' }
26
+ ];
27
+ }, []);
27
28
  const getItems = async (refreshCache) => {
28
29
  TMSpinner.show({ description: `${SDKUI_Localizator.Loading} - ${SDK_Localizator.Users} ...` });
29
30
  if (refreshCache)
@@ -40,7 +41,7 @@ export const TMUserChooserForm = ({ allowMultipleSelection, hideRefresh = false,
40
41
  return title;
41
42
  };
42
43
  const cellRenderIcon = (data) => _jsx(TMUserIcon, { ud: data.data });
43
- return (_jsx(TMChooserForm, { title: getTitle(), allowMultipleSelection: allowMultipleSelection, startWithShowOnlySelectedItems: startWithShowOnlySelectedItems, hasShowOnlySelectedItems: hasShowOnlySelectedItems, width: width, height: height, manageUseLocalizedName: false, showDefaultColumns: false, columns: renderDataGridColumns, selectedIDs: selectedIDs, cellRenderIcon: cellRenderIcon, dataSource: dataSource, getItems: getItems, hasShowId: !hideShowId, hideRefresh: hideRefresh, onClose: onClose, onChoose: (IDs) => onChoose?.(IDs) }));
44
+ return (_jsx(TMChooserForm, { title: getTitle(), allowMultipleSelection: allowMultipleSelection, startWithShowOnlySelectedItems: startWithShowOnlySelectedItems, hasShowOnlySelectedItems: hasShowOnlySelectedItems, width: width, height: height, manageUseLocalizedName: false, showDefaultColumns: false, columns: dataColumns, selectedIDs: selectedIDs, cellRenderIcon: cellRenderIcon, dataSource: dataSource, getItems: getItems, hasShowId: !hideShowId, hideRefresh: hideRefresh, onClose: onClose, onChoose: (IDs) => onChoose?.(IDs) }));
44
45
  };
45
46
  export const TMUserIdViewer = ({ userId, showIcon = false, noneSelectionText = `<${SDKUI_Localizator.NoneSelection}>` }) => {
46
47
  const [ud, setUd] = useState();
@@ -102,19 +103,17 @@ const getUserIcon = (userLevel, level, isExpired) => {
102
103
  let ownershipColor = "";
103
104
  if (isExpired)
104
105
  ownershipColor = "grey";
105
- else {
106
- if (level) {
107
- switch (level) {
108
- case OwnershipLevels.DirectOwner:
109
- ownershipColor = "green";
110
- break;
111
- case OwnershipLevels.IndirectOwner:
112
- ownershipColor = "gold";
113
- break;
114
- case OwnershipLevels.NotOwner:
115
- ownershipColor = "red";
116
- break;
117
- }
106
+ else if (level) {
107
+ switch (level) {
108
+ case OwnershipLevels.DirectOwner:
109
+ ownershipColor = "green";
110
+ break;
111
+ case OwnershipLevels.IndirectOwner:
112
+ ownershipColor = "gold";
113
+ break;
114
+ case OwnershipLevels.NotOwner:
115
+ ownershipColor = "red";
116
+ break;
118
117
  }
119
118
  }
120
119
  switch (userLevel) {
@@ -25,5 +25,3 @@ export interface ITMHtmlEditor {
25
25
  /** If true, enables rich text editing mode */
26
26
  isEditorEnabled?: boolean;
27
27
  }
28
- declare const TMHtmlEditor: (props: ITMHtmlEditor) => import("react/jsx-runtime").JSX.Element;
29
- export default TMHtmlEditor;
@@ -23,6 +23,5 @@ const TMHtmlEditor = (props) => {
23
23
  const hasValidationErrors = useMemo(() => {
24
24
  return validationItems && validationItems.length > 0;
25
25
  }, [validationItems]);
26
- return (_jsxs("div", { style: { height: validationItems.length > 0 ? `calc(${height} - 30px)` : "100%", width: width }, children: [_jsx("div", { style: { borderWidth: '1px', borderStyle: 'solid', borderColor: hasValidationErrors ? "red" : "#e0e0e0 #e0e0e0 #616161", width: "100%", height: "100%" }, children: _jsx(HtmlEditor, { placeholder: SDKUI_Localizator.TypeAMessage + "...", ref: editorRef, width: "100%", height: "100%", value: markup, onValueChange: onValueChangeCallback, mentions: mentionsConfig, style: { overflow: 'hidden', outline: "none" }, children: isEditorEnabled && (_jsxs(Toolbar, { multiline: false, children: [_jsx(Item, { name: "undo" }), _jsx(Item, { name: "redo" }), _jsx(Item, { name: "separator" }), _jsx(Item, { name: "separator" }), _jsx(Item, { name: "bold" }), _jsx(Item, { name: "italic" }), _jsx(Item, { name: "underline" }), _jsx(Item, { name: "separator" }), _jsx(Item, { name: "alignLeft" }), _jsx(Item, { name: "alignCenter" }), _jsx(Item, { name: "alignRight" }), _jsx(Item, { name: "alignJustify" }), _jsx(Item, { name: "separator" }), _jsx(Item, { name: "orderedList" }), _jsx(Item, { name: "bulletList" }), _jsx(Item, { name: "separator" }), _jsx(Item, { name: "color" }), _jsx(Item, { name: "background" }), _jsx(Item, { name: "separator" }), _jsx(Item, { name: "link" })] })) }) }), _jsx("div", { style: { width: "100%", height: validationItems.length > 0 ? "30px" : '0px' }, children: _jsx(TMVilViewer, { vil: validationItems }) })] }));
26
+ return (_jsxs("div", { style: { height: validationItems.length > 0 ? `calc(${height} - 30px)` : "100%", width: width }, children: [_jsx("div", { style: { borderWidth: '1px', borderStyle: 'solid', borderColor: hasValidationErrors ? "red" : "#e0e0e0 #e0e0e0 #616161", width: "100%", height: "100%" }, children: _jsx(HtmlEditor, { placeholder: SDKUI_Localizator.TypeAMessage + "...", ref: editorRef, width: "100%", height: "100%", value: markup, onValueChange: onValueChangeCallback, mentions: mentionsConfig, style: { overflow: 'hidden', outline: "none" }, children: isEditorEnabled && (_jsxs(Toolbar, { multiline: false, children: [_jsx(Item, { name: "undo" }), _jsx(Item, { name: "redo" }), _jsx(Item, { name: "separator" }), _jsx(Item, { name: "bold" }), _jsx(Item, { name: "italic" }), _jsx(Item, { name: "underline" }), _jsx(Item, { name: "separator" }), _jsx(Item, { name: "orderedList" }), _jsx(Item, { name: "bulletList" })] })) }) }), _jsx("div", { style: { width: "100%", height: validationItems.length > 0 ? "30px" : '0px' }, children: _jsx(TMVilViewer, { vil: validationItems }) })] }));
27
27
  };
28
- export default TMHtmlEditor;
@@ -1,7 +1,6 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useState } from 'react';
2
+ import { useEffect, useMemo, useState } from 'react';
3
3
  import { DcmtTypeListCacheService } from '@topconsultnpm/sdk-ts-beta';
4
- import { Column } from 'devextreme-react/cjs/data-grid';
5
4
  import { IconClear, IconColumns, IconDataList, SDKUI_Localizator, stringIsNullOrEmpty } from '../../helper';
6
5
  import { TMExceptionBoxManager } from '../base/TMPopUp';
7
6
  import { TMMetadataChooserForm } from '../choosers/TMMetadataChooser';
@@ -117,9 +116,14 @@ const TMTextExpression = (props) => {
117
116
  props.onValueChanged?.(list);
118
117
  } }) : _jsx(_Fragment, {}));
119
118
  };
119
+ const dataColumns = useMemo(() => {
120
+ return [
121
+ { dataField: 'paramName', caption: props.captionColumnChooser ?? SDKUI_Localizator.Name, dataType: 'string', sortOrder: 'asc', alignment: 'left' }
122
+ ];
123
+ }, []);
120
124
  const openFormulaChooseForm = () => {
121
125
  return (showFormulaChooser ?
122
- _jsx(TMChooserForm, { title: props.titleChooser ? props.titleChooser : SDKUI_Localizator.Parameters, height: props.higthChooser ? props.higthChooser : '350', width: props.widthChooser ? props.widthChooser : '300', hasShowId: false, showDefaultColumns: false, allowMultipleSelection: props.disableMultipleSelection === true ? false : true, columns: [_jsx(Column, { caption: props.captionColumnChooser ? props.captionColumnChooser : SDKUI_Localizator.Name, dataField: "paramName", sortOrder: 'asc', alignment: 'left' }, 0)], dataSource: getFormulaDataSorce(), onClose: () => { setShowFormulaChooser(false); }, onChoose: (IDs) => {
126
+ _jsx(TMChooserForm, { title: props.titleChooser ?? SDKUI_Localizator.Parameters, height: props.higthChooser ?? '350', width: props.widthChooser ?? '300', hasShowId: false, showDefaultColumns: false, allowMultipleSelection: props.disableMultipleSelection !== true, columns: dataColumns, dataSource: getFormulaDataSorce(), onClose: () => { setShowFormulaChooser(false); }, onChoose: (IDs) => {
123
127
  let expr = props.value ?? '';
124
128
  IDs.map(i => expr += props.formulaItems[i]);
125
129
  props.onValueChanged?.(expr);
@@ -1,6 +1,5 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useState } from 'react';
3
- import DataGrid, { Column, Paging, Scrolling, Selection, LoadPanel, SearchPanel, Summary, TotalItem, HeaderFilter, Grouping, Pager } from 'devextreme-react/cjs/data-grid';
2
+ import { useCallback, useEffect, useMemo, useState } from 'react';
4
3
  import { SDK_Globals } from '@topconsultnpm/sdk-ts-beta';
5
4
  import { IconApply, IconHide, IconRefresh, IconShow, SDKUI_Globals, SDKUI_Localizator } from '../../helper';
6
5
  import TMButton from '../base/TMButton';
@@ -8,53 +7,70 @@ import TMToggleButton from '../base/TMToggleButton';
8
7
  import TMModal from '../base/TMModal';
9
8
  import TMLayoutContainer, { TMLayoutItem } from '../base/TMLayout';
10
9
  import { TMColors } from '../../utils/theme';
11
- const TMChooserForm = ({ children, title, allowMultipleSelection, startWithShowOnlySelectedItems = true, hasShowOnlySelectedItems = false, allowGrouping, allowSorting = true, width, height, dataSource, selectedIDs, manageUseLocalizedName = true, hasShowId = true, hideRefresh = false, keyName = "id", customButtons, showDefaultColumns = true, columns, summaryItems, convertID, customFilter, getItems, cellRenderIcon, cellRenderNameAndDesc, onChoose, onClose, onShowIdChanged }) => {
10
+ import TMDataGrid from '../base/TMDataGrid';
11
+ const TMChooserForm = ({ children, title, allowMultipleSelection, startWithShowOnlySelectedItems = true, hasShowOnlySelectedItems = false, allowGrouping, allowSorting = true, width, height, dataSource, selectedIDs, manageUseLocalizedName = true, hasShowId = true, hideRefresh = false, keyName = "id", customButtons, showDefaultColumns = true, columns = [], summaryItems, convertID, customFilter, getItems, cellRenderIcon, cellRenderNameAndDesc, onChoose, onClose, onShowIdChanged }) => {
12
12
  const [showId, setShowId] = useState(false);
13
- const [showOnlySelectedItems, setShowOnlySelectedItems] = useState(startWithShowOnlySelectedItems && selectedIDs != undefined && selectedIDs.length > 0);
14
- const [selectedItems, setSelectedItems] = useState([]);
15
- const [items, setItems] = useState([]);
16
- const [isInitialized, setIsInitialized] = useState(false);
17
- let gridInstance;
18
- const getDataSource = () => { return (allowMultipleSelection && hasShowOnlySelectedItems && showOnlySelectedItems && selectedItems.length > 0) ? selectedItems : customFilter ? customFilter(items) : items; };
19
- const getSelectedIDs = () => { return selectedItems.map((item) => { return convertID ? convertID(item) : item[keyName]; }); };
20
- const renderTitle = () => { return title ? `${title} (${selectedItems.length}/${customFilter ? customFilter(items).length : items.length})` : SDKUI_Localizator.Select; };
13
+ const [showOnlySelectedItems, setShowOnlySelectedItems] = useState(hasShowOnlySelectedItems && startWithShowOnlySelectedItems && selectedIDs != undefined && selectedIDs.length > 0);
14
+ const [allItems, setAllItems] = useState([]);
15
+ const [filteredItems, setFilteredItems] = useState([]);
16
+ const [selectedRowKeys, setSelectedRowKeys] = useState(selectedIDs ?? []);
17
+ const [focusedRowKey, setFocusedRowKey] = useState(undefined);
18
+ useEffect(() => { doGetItems(false); }, [getItems]);
19
+ useEffect(() => {
20
+ if (showOnlySelectedItems)
21
+ setFilteredItems(allItems.filter((o) => selectedRowKeys?.includes(o[keyName])));
22
+ else
23
+ setFilteredItems(allItems);
24
+ }, [showOnlySelectedItems, allItems, selectedRowKeys, keyName]);
25
+ const getSelectedIDs = () => { return filteredItems.filter((o) => selectedRowKeys?.includes(o[keyName])).map((item) => { return convertID ? convertID(item) : item[keyName]; }); };
26
+ const getFocusedIDs = () => { return filteredItems.filter((o) => o[keyName] == focusedRowKey).map((item) => { return convertID ? convertID(item) : item[keyName]; }); };
27
+ const renderTitle = () => { return title ? `${title} (${selectedRowKeys.length}/${filteredItems.length})` : SDKUI_Localizator.Select; };
21
28
  const doGetItems = (refreshCache) => {
22
29
  if (dataSource) {
23
- setItems(dataSource);
24
- setSelectedItems(dataSource.filter((o) => selectedIDs?.includes(o[keyName])));
30
+ setAllItems(dataSource);
25
31
  return;
26
32
  }
27
33
  getItems?.(refreshCache).then((result) => {
28
- setItems(result);
29
- if (!refreshCache) {
30
- setSelectedItems(result.filter((o) => selectedIDs?.includes(o[keyName])));
31
- }
34
+ setAllItems(result);
32
35
  });
33
36
  };
34
37
  const ToolbarButtons = () => {
35
- return (_jsxs("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start', gap: '2px' }, children: [_jsx(TMButton, { btnStyle: 'toolbar', caption: SDKUI_Localizator.Apply, disabled: selectedItems.length <= 0, icon: _jsx(IconApply, {}), color: 'success', fontSize: '1.3rem', onClick: () => { onChoose?.(getSelectedIDs()); onClose?.(); } }), hasShowId ? _jsx(TMButton, { btnStyle: 'toolbar', caption: showId ? SDKUI_Localizator.ID_Hide : SDKUI_Localizator.ID_Show, icon: showId ? _jsx(IconHide, {}) : _jsx(IconShow, {}), fontSize: '1.3rem', onClick: () => { setShowId(!showId); onShowIdChanged?.(); } }) : _jsx(_Fragment, {}), !hideRefresh && _jsx(TMButton, { btnStyle: 'toolbar', caption: SDKUI_Localizator.Refresh, icon: _jsx(IconRefresh, {}), fontSize: '1.3rem', onClick: () => { doGetItems(true); } }), customButtons, hasShowOnlySelectedItems && allowMultipleSelection && _jsx(TMToggleButton, { value: showOnlySelectedItems, elementStyle: { marginLeft: '10px' }, label: 'Mostra solo selezionati', onValueChanged: () => setShowOnlySelectedItems(!showOnlySelectedItems) })] }));
38
+ return (_jsxs("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start', gap: '2px' }, children: [_jsx(TMButton, { btnStyle: 'toolbar', caption: SDKUI_Localizator.Apply, disabled: selectedRowKeys.length <= 0, icon: _jsx(IconApply, {}), color: 'success', fontSize: '1.3rem', onClick: () => { onChoose?.(getSelectedIDs()); onClose?.(); } }), hasShowId ? _jsx(TMButton, { btnStyle: 'toolbar', caption: showId ? SDKUI_Localizator.ID_Hide : SDKUI_Localizator.ID_Show, icon: showId ? _jsx(IconHide, {}) : _jsx(IconShow, {}), fontSize: '1.3rem', onClick: () => { setShowId(!showId); onShowIdChanged?.(); } }) : _jsx(_Fragment, {}), !hideRefresh && _jsx(TMButton, { btnStyle: 'toolbar', caption: SDKUI_Localizator.Refresh, icon: _jsx(IconRefresh, {}), fontSize: '1.3rem', onClick: () => { doGetItems(true); } }), customButtons, hasShowOnlySelectedItems && allowMultipleSelection && _jsx(TMToggleButton, { value: showOnlySelectedItems, elementStyle: { marginLeft: '10px' }, label: 'Mostra solo selezionati', onValueChanged: () => setShowOnlySelectedItems(!showOnlySelectedItems) })] }));
36
39
  };
37
- useEffect(() => { doGetItems(false); }, []);
40
+ const handleSelectionChanged = useCallback((e) => {
41
+ const selectedKeys = e.component.getSelectedRowKeys() ?? [];
42
+ setSelectedRowKeys(selectedKeys);
43
+ }, []);
44
+ const handleRowDoubleClick = () => {
45
+ if (allowMultipleSelection && selectedRowKeys.length > 1)
46
+ return;
47
+ onChoose?.(getFocusedIDs());
48
+ onClose?.();
49
+ };
50
+ const handleFocusedRowChange = useCallback((e) => {
51
+ setFocusedRowKey(e.row?.key);
52
+ }, []);
53
+ const dataColumns = useMemo(() => {
54
+ let dtColumns = [];
55
+ if (cellRenderIcon)
56
+ dtColumns.push({ width: 30, allowResizing: false, allowFiltering: false, allowSorting: false, cellRender: cellRenderIcon });
57
+ if (hasShowId)
58
+ dtColumns.push({ dataField: "id", visible: showId, dataType: 'number' });
59
+ if (showDefaultColumns)
60
+ dtColumns.push({ dataField: SDK_Globals.useLocalizedName && manageUseLocalizedName ? "nameLoc" : "name", caption: SDKUI_Localizator.Name, dataType: 'string', defaultSortOrder: allowSorting ? "asc" : undefined, cellRender: cellRenderNameAndDesc });
61
+ if (showDefaultColumns)
62
+ dtColumns.push({ dataField: "description", caption: SDKUI_Localizator.Description, dataType: 'string', cellRender: cellRenderNameAndDesc });
63
+ return dtColumns.concat(columns);
64
+ }, [columns, showId, cellRenderIcon, cellRenderNameAndDesc]);
65
+ const customSummary = useMemo(() => {
66
+ return ({
67
+ totalItems: [{ column: SDK_Globals.useLocalizedName && manageUseLocalizedName ? "nameLoc" : "name", summaryType: 'count' }],
68
+ ...summaryItems ?? {}
69
+ });
70
+ }, [manageUseLocalizedName, summaryItems]);
38
71
  return (_jsx(TMModal, { title: renderTitle(), width: width ?? '550px', height: height ?? '600px', toolbar: _jsx(ToolbarButtons, {}), onClose: onClose, children: (children ??
39
- items.length > 0) ?
40
- _jsxs(DataGrid, { ref: (grid) => (gridInstance = grid), dataSource: getDataSource(), keyExpr: keyName, allowColumnResizing: true, columnResizingMode: "widget", columnAutoWidth: true, allowColumnReordering: true, showBorders: true, showColumnLines: SDKUI_Globals.dataGridShowColumnLines, showRowLines: SDKUI_Globals.dataGridShowRowLines, height: "100%",
41
- // selectedRowKeys={selectedItems.map((item: any) => { return item.id })}
42
- onContentReady: (e) => {
43
- if (!isInitialized && items && items.length > 0) {
44
- let selection = selectedItems.map((item) => { return item[keyName]; }) ?? [];
45
- if (selection.length > 0) {
46
- gridInstance?.instance().selectRows(selection, false);
47
- if (!allowMultipleSelection)
48
- gridInstance?.instance().navigateToRow(selection[0]);
49
- setIsInitialized(true);
50
- }
51
- }
52
- }, onRowDblClick: () => {
53
- onChoose?.(getSelectedIDs());
54
- onClose?.();
55
- }, onSelectionChanged: (e) => { setSelectedItems(e.selectedRowsData); }, onToolbarPreparing: (e) => { e.toolbarOptions.items.forEach((item) => { if (item.name === "searchPanel")
56
- item.location = "before"; }); }, children: [cellRenderIcon && _jsx(Column, { width: 30, allowResizing: false, allowFiltering: false, allowSorting: false, cellRender: cellRenderIcon }, 0), hasShowId && _jsx(Column, { dataField: "id", visible: showId, dataType: 'number' }, 1), showDefaultColumns && _jsx(Column, { dataField: SDK_Globals.useLocalizedName && manageUseLocalizedName ? "nameLoc" : "name", caption: SDKUI_Localizator.Name, dataType: 'string', defaultSortOrder: allowSorting ? "asc" : undefined, cellRender: cellRenderNameAndDesc }, 2), showDefaultColumns && _jsx(Column, { dataField: "description", dataType: 'string', caption: SDKUI_Localizator.Description, cellRender: cellRenderNameAndDesc }, 3), columns, allowGrouping && _jsx(Grouping, { autoExpandAll: false, expandMode: 'rowClick' }), _jsx(HeaderFilter, { visible: true }), _jsx(Selection, { mode: allowMultipleSelection ? "multiple" : "single", showCheckBoxesMode: "onClick", selectAllMode: 'allPages' }), _jsx(Scrolling, { mode: "standard", useNative: SDKUI_Globals.dataGridUseNativeScrollbar }), _jsx(LoadPanel, { enabled: true }), _jsx(SearchPanel, { visible: true }), _jsx(Paging, { pageSize: 100 }), _jsx(Pager, { visible: true, showInfo: true, showNavigationButtons: true }), _jsxs(Summary, { children: [_jsx(TotalItem, { column: SDK_Globals.useLocalizedName && manageUseLocalizedName ? "nameLoc" : "name", summaryType: "count" }), summaryItems] })] })
57
- :
58
- _jsx(TMLayoutContainer, { gap: 30, alignItems: 'center', justifyContent: 'center', children: _jsx(TMLayoutItem, { children: _jsx("p", { style: { height: "100%", color: TMColors.primaryColor, fontSize: "1.5rem", display: 'flex', alignItems: 'center', justifyContent: 'center' }, children: SDKUI_Localizator.NoDataToDisplay }) }) }) }));
72
+ filteredItems.length > 0)
73
+ ? _jsx(TMDataGrid, { dataSource: filteredItems, keyExpr: keyName, dataColumns: dataColumns, focusedRowKey: focusedRowKey, selectedRowKeys: [...selectedRowKeys], showRowLines: SDKUI_Globals.dataGridShowRowLines, showColumnLines: SDKUI_Globals.dataGridShowColumnLines, headerFilter: { visible: true }, selection: { mode: allowMultipleSelection ? 'multiple' : 'single', showCheckBoxesMode: 'always', selectAllMode: 'allPages' }, grouping: allowGrouping ? { autoExpandAll: false, expandMode: 'rowClick' } : undefined, summary: customSummary, onFocusedRowChanged: handleFocusedRowChange, onSelectionChanged: handleSelectionChanged, onRowDblClick: handleRowDoubleClick })
74
+ : _jsx(TMLayoutContainer, { gap: 30, alignItems: 'center', justifyContent: 'center', children: _jsx(TMLayoutItem, { children: _jsx("p", { style: { height: "100%", color: TMColors.primaryColor, fontSize: "1.5rem", display: 'flex', alignItems: 'center', justifyContent: 'center' }, children: SDKUI_Localizator.NoDataToDisplay }) }) }) }));
59
75
  };
60
76
  export default TMChooserForm;
@@ -0,0 +1,6 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import TMHtmlContentDisplay from '../components/editors/TMHtmlContentDisplay';
3
+ declare const meta: Meta<typeof TMHtmlContentDisplay>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof TMHtmlContentDisplay>;
6
+ export declare const Default: Story;
@@ -0,0 +1,25 @@
1
+ import TMHtmlContentDisplay from '../components/editors/TMHtmlContentDisplay';
2
+ const sampleMarkup = `
3
+ <p>This is a <strong>sample</strong> paragraph with <a target="_blank" href="https://www.google.com/">a link</a>.</p>
4
+ <p>Another paragraph with the word</p>
5
+ <ul>
6
+ <li>First item</li>
7
+ <li>Second item</li>
8
+ </ul>
9
+ `;
10
+ const meta = {
11
+ title: 'Components/TMHtmlContentDisplay',
12
+ component: TMHtmlContentDisplay,
13
+ args: {
14
+ markup: sampleMarkup,
15
+ isSelected: false,
16
+ searchText: '',
17
+ },
18
+ };
19
+ export default meta;
20
+ export const Default = {
21
+ args: {
22
+ isSelected: false,
23
+ searchText: 'sample',
24
+ },
25
+ };
package/lib/ts/types.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { ReactNode } from "react";
2
2
  import { ITopMediaSession, ValidationItem } from "@topconsultnpm/sdk-ts-beta";
3
3
  import { ITMEditorBase } from "../components/base/TMEditorBase";
4
+ import { IColumnProps } from "devextreme-react/cjs/data-grid";
4
5
  export declare enum FormModes {
5
6
  None = 0,
6
7
  Create = 1,
@@ -119,7 +120,6 @@ export interface ITMChooserFormProps<T> {
119
120
  children?: React.ReactNode;
120
121
  dataSource?: T[];
121
122
  selectedIDs?: any[];
122
- getItems?: (refreshCache: boolean) => Promise<T[]>;
123
123
  width?: string;
124
124
  height?: string;
125
125
  allowSorting?: boolean;
@@ -129,15 +129,15 @@ export interface ITMChooserFormProps<T> {
129
129
  startWithShowOnlySelectedItems?: boolean;
130
130
  keyName?: string;
131
131
  customButtons?: React.ReactNode;
132
- columns?: JSX.Element[];
133
- summaryItems?: JSX.Element[];
132
+ columns?: IColumnProps[];
133
+ summaryItems?: any;
134
134
  showDefaultColumns?: boolean;
135
135
  hasShowId?: boolean;
136
- showId?: boolean;
137
136
  hideRefresh?: boolean;
138
137
  title?: any;
139
138
  manageUseLocalizedName?: boolean;
140
139
  tmSession?: ITopMediaSession;
140
+ getItems?: (refreshCache: boolean) => Promise<T[]>;
141
141
  convertID?: (item: T) => any;
142
142
  customFilter?: (items: T[]) => T[];
143
143
  cellRenderIcon?: (data: any) => JSX.Element | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.12.15",
3
+ "version": "6.12.16",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",