@topconsultnpm/sdkui-react-beta 6.7.87 → 6.7.89

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.
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import { RelationDescriptor, RelationTypes } from '@topconsultnpm/sdk-ts-beta';
3
+ import { ITMChooserFormProps, ITMChooserProps } from '../../ts';
4
+ interface ITMRelationChooser extends ITMChooserProps {
5
+ relationType: RelationTypes;
6
+ values?: number[];
7
+ showBorder?: boolean;
8
+ borderRadius?: string;
9
+ openEditorOnSummaryClick?: boolean;
10
+ }
11
+ declare const TMRelationChooser: React.FunctionComponent<ITMRelationChooser>;
12
+ export default TMRelationChooser;
13
+ interface ITMRelationChooserFormProps extends ITMChooserFormProps<RelationDescriptor> {
14
+ relationType: RelationTypes;
15
+ }
16
+ export declare const TMRelationChooserForm: React.FunctionComponent<ITMRelationChooserFormProps>;
17
+ export declare const TMRelationIdViewer: ({ relationType, relationId, showIcon, noneSelectionText }: {
18
+ relationType: RelationTypes;
19
+ relationId?: number;
20
+ showIcon?: boolean;
21
+ noneSelectionText?: string;
22
+ }) => import("react/jsx-runtime").JSX.Element;
23
+ export declare const TMRelationIcon: ({ rd, relationType }: {
24
+ rd: RelationDescriptor | undefined;
25
+ relationType?: RelationTypes;
26
+ }) => import("react/jsx-runtime").JSX.Element;
27
+ export declare const TMRelationTooltip: ({ rd, relationType, children }: {
28
+ rd?: RelationDescriptor;
29
+ relationType: RelationTypes | undefined;
30
+ children: React.ReactNode;
31
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,96 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useState } from 'react';
3
+ import { SDK_Globals, RelationTypes, RelationCacheService, DcmtTypeListCacheService, SDK_Localizator } from '@topconsultnpm/sdk-ts-beta';
4
+ import { IconSearch, IconRelationManyToMany, IconRelationOneToMany, SDKUI_Localizator } from '../../helper';
5
+ import TMChooserForm from '../forms/TMChooserForm';
6
+ import { StyledDivHorizontal, StyledTooltipContainer, StyledTooltipItem, StyledTooltipSeparatorItem } from '../base/Styled';
7
+ import { Column } from 'devextreme-react/cjs/data-grid';
8
+ import TMSpinner from '../base/TMSpinner';
9
+ import TMSummary from '../editors/TMSummary';
10
+ import TMTooltip from '../base/TMTooltip';
11
+ const TMRelationChooser = ({ tmSession, icon, dataSource, disabled, backgroundColor, borderRadius = '4px', buttons = [], placeHolder = `<${SDKUI_Localizator.NoneSelection}>`, openEditorOnSummaryClick, showBorder = true, showId = false, elementStyle, allowMultipleSelection, values, isModifiedWhen, label, width, height, showClearButton = false, validationItems = [], relationType, onValueChanged }) => {
12
+ const [showChooser, setShowChooser] = useState(false);
13
+ useEffect(() => {
14
+ TMSpinner.show({ description: `${SDKUI_Localizator.Loading} - ${SDKUI_Localizator.Relations} ...` });
15
+ RelationCacheService.GetAllRelationAsync().then(() => { TMSpinner.hide(); });
16
+ }, [values]);
17
+ const renderTemplate = () => {
18
+ return (_jsx(StyledDivHorizontal, { style: { minWidth: '125px' }, children: placeHolder && (!values || values.length <= 0)
19
+ ? _jsx("p", { children: placeHolder })
20
+ : _jsxs(_Fragment, { children: [_jsx(TMRelationIdViewer, { relationType: relationType, relationId: values?.[0], showIcon: true }), values && values.length > 1 && _jsx("p", { style: { marginLeft: '10px' }, children: `(+${values.length - 1} ${values.length == 2 ? 'altro' : 'altri'})` })] }) }));
21
+ };
22
+ return (_jsxs(_Fragment, { children: [_jsx(TMSummary, { icon: icon, backgroundColor: backgroundColor, buttons: buttons, showBorder: showBorder, borderRadius: borderRadius, hasValue: values && values.length > 0, showClearButton: showClearButton, iconEditButton: _jsx(IconSearch, { fontSize: 16 }), onEditorClick: () => !disabled && setShowChooser(true), elementStyle: elementStyle, isModifiedWhen: isModifiedWhen, label: label, width: width, height: showBorder ? height : '24px', template: renderTemplate(), openEditorOnSummaryClick: openEditorOnSummaryClick, onClearClick: showClearButton ? () => { !disabled && onValueChanged?.([]); } : undefined, validationItems: validationItems }), showChooser &&
23
+ _jsx(TMRelationChooserForm, { relationType: relationType, tmSession: tmSession, allowMultipleSelection: allowMultipleSelection, dataSource: dataSource, selectedIDs: values, onClose: () => setShowChooser(false), onChoose: (IDs) => { onValueChanged?.(IDs); } })] }));
24
+ };
25
+ export default TMRelationChooser;
26
+ export const TMRelationChooserForm = (props) => {
27
+ const getItems = async (refreshCache) => {
28
+ let tms = SDK_Globals.tmSession;
29
+ if (refreshCache)
30
+ RelationCacheService.RemoveAllRelation(tms);
31
+ let count = RelationCacheService.CacheAllRelationCount(tms);
32
+ if (count <= 0)
33
+ TMSpinner.show({ description: `${SDKUI_Localizator.Loading} - ${SDKUI_Localizator.Relations} ...` });
34
+ let rels = await RelationCacheService.GetAllRelationAsync(tms, false, refreshCache);
35
+ if (count <= 0)
36
+ TMSpinner.hide();
37
+ rels = rels.filter((r) => r.relationType == props.relationType).slice();
38
+ return rels;
39
+ };
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 }));
49
+ };
50
+ export const TMRelationIdViewer = ({ relationType, relationId, showIcon = false, noneSelectionText = `<${SDKUI_Localizator.NoneSelection}>` }) => {
51
+ const [rel, setRel] = useState();
52
+ let relTemp;
53
+ useEffect(() => {
54
+ if (!relationId || relationId == 0) {
55
+ setRel(undefined);
56
+ return;
57
+ }
58
+ TMSpinner.show({ description: `${SDKUI_Localizator.Loading} - ${SDKUI_Localizator.Relations} ...` });
59
+ RelationCacheService.GetAllRelationAsync().then((rels) => {
60
+ let selectedRels = rels.filter((r) => r.id == relationId);
61
+ if (selectedRels) {
62
+ relTemp = selectedRels[0];
63
+ setRel(relTemp);
64
+ }
65
+ TMSpinner.hide();
66
+ });
67
+ }, [relationId]);
68
+ return (_jsxs(StyledDivHorizontal, { children: [showIcon && _jsx(TMRelationIcon, { rd: rel, relationType: relationType }), _jsx("p", { style: { textAlign: 'left', marginLeft: showIcon ? '5px' : '' }, children: rel ? rel.name : noneSelectionText })] }));
69
+ };
70
+ export const TMRelationIcon = ({ rd, relationType }) => {
71
+ let icon = relationType == RelationTypes.ManyToMany ? _jsx(IconRelationManyToMany, { height: '17px', width: '17px' }) : _jsx(IconRelationOneToMany, { height: '17px', width: '17px' });
72
+ return (_jsx(TMRelationTooltip, { rd: rd, relationType: relationType, children: icon }));
73
+ };
74
+ async function DcmtType_ID2NameAsync(tid) {
75
+ if (tid == undefined)
76
+ return '';
77
+ let dtd = await DcmtTypeListCacheService.GetAsync(tid);
78
+ if (dtd == undefined)
79
+ return '';
80
+ return dtd.name ?? '';
81
+ }
82
+ export const TMRelationTooltip = ({ rd, relationType, children }) => {
83
+ const [masterName, setMasterName] = useState('');
84
+ const [detailName, setDetailName] = useState('');
85
+ useEffect(() => {
86
+ if (rd) {
87
+ DcmtType_ID2NameAsync(rd.masterTID).then((name) => setMasterName(name ?? ''));
88
+ DcmtType_ID2NameAsync(rd.detailTID).then((name) => setDetailName(name ?? ''));
89
+ }
90
+ }, [rd]);
91
+ const renderTooltipContent = (rd) => {
92
+ return (!rd ? null
93
+ : _jsxs(StyledTooltipContainer, { children: [_jsx(StyledTooltipItem, { children: `${rd.name})} (RelationId: ${rd.id})` }), _jsx(StyledTooltipSeparatorItem, {}), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.RelationType}: ${SDKUI_Localizator.RelationManyToMany}` }), _jsx(StyledTooltipItem, { children: `${SDK_Localizator.DcmtType} 'master': ${masterName} - TID: ${rd.masterTID}` }), _jsx(StyledTooltipItem, { children: `${SDK_Localizator.DcmtType} 'detail': ${detailName} - TID: ${rd.detailTID}` })] }));
94
+ };
95
+ return (_jsx(TMTooltip, { content: renderTooltipContent(rd), children: children }));
96
+ };
@@ -9,6 +9,7 @@ interface TMTreeDropDownProps {
9
9
  }>;
10
10
  values: Array<number>;
11
11
  setValues: React.Dispatch<React.SetStateAction<Array<number>>>;
12
+ displayExpr: boolean;
12
13
  isValidKey?: (key: number) => boolean;
13
14
  elementStyle?: React.CSSProperties | undefined;
14
15
  }
@@ -7,7 +7,7 @@ import { SDKUI_Localizator } from '../../helper';
7
7
  // The TMTreeDropDown functional component
8
8
  const TMTreeDropDown = (props) => {
9
9
  // Destructure props for easy access
10
- const { dataSource, values, setValues, isValidKey, elementStyle } = props;
10
+ const { dataSource, values, setValues, displayExpr, isValidKey, elementStyle } = props;
11
11
  // Reference to the TreeView component for programmatic control
12
12
  const treeViewRef = useRef(null);
13
13
  // Helper function to get a comma-separated string of labels for the selected IDs
@@ -49,6 +49,6 @@ const TMTreeDropDown = (props) => {
49
49
  filteredKeys = selectedKeys.filter(isValidKey); // If a validation function is provided, filter the selected keys
50
50
  setValues(filteredKeys);
51
51
  }, []);
52
- return _jsx(TMTooltip, { content: getLabelsByIds(values, 'formatted'), children: _jsx(DropDownBox, { width: "100%", style: elementStyle, valueExpr: "id", displayExpr: "label", value: values, dataSource: dataSource, placeholder: SDKUI_Localizator.SelectDesiredFilters, onContentReady: syncTreeViewSelection, focusStateEnabled: true, contentRender: () => _jsx(TreeView, { ref: treeViewRef, keyExpr: "id", dataSource: dataSource, selectByClick: true, selectNodesRecursive: true, selectionMode: "multiple", displayExpr: "label", parentIdExpr: "categoryId", dataStructure: "plain", showCheckBoxesMode: "normal", onContentReady: syncTreeViewSelection, onItemSelectionChanged: (e) => treeViewItemSelectionChanged(e) }) }) });
52
+ return _jsx(TMTooltip, { content: getLabelsByIds(values, 'formatted'), children: _jsx(DropDownBox, { width: "100%", style: elementStyle, valueExpr: "id", displayExpr: displayExpr ? "label" : () => SDKUI_Localizator.Filters, value: values, dataSource: dataSource, placeholder: SDKUI_Localizator.SelectDesiredFilters, onContentReady: syncTreeViewSelection, focusStateEnabled: true, contentRender: () => _jsx(TreeView, { ref: treeViewRef, keyExpr: "id", dataSource: dataSource, selectByClick: true, selectNodesRecursive: true, selectionMode: "multiple", displayExpr: "label", parentIdExpr: "categoryId", dataStructure: "plain", showCheckBoxesMode: "normal", onContentReady: syncTreeViewSelection, onItemSelectionChanged: (e) => treeViewItemSelectionChanged(e) }) }) });
53
53
  };
54
54
  export default TMTreeDropDown;
@@ -56,6 +56,7 @@ export declare class SDKUI_Localizator {
56
56
  static get Date(): "Datum" | "Date" | "fecha" | "Data";
57
57
  static get Date_Modified(): "Datum geändert" | "Date Modified" | "Fecha modificada" | "Date modifiée" | "Data modificada" | "Data modificata";
58
58
  static get DcmtCount(): "Anzahl der Dokumente" | "Number of documents" | "Número de documentos" | "Nombre de documents" | "Numero documenti";
59
+ static get DcmtType(): "Dokumententyp" | "Document type" | "Tipo de documento" | "Type de document" | "Tipo documento";
59
60
  static get DcmtTypesSelected(): "Ausgewählte Dokumenttypen" | "Selected document types" | "Tipos de documentos seleccionados" | "Types de documents sélectionnés" | "Tipos de documentos selecionados" | "Tipi documento selezionati";
60
61
  static get DcmtTypeSelect(): "Wählen Sie einen Dokumenttyp aus" | "Select a document type" | "Seleccione un tipo de documento" | "Sélectionnez un type de document" | "Selecione um tipo de documento" | "Selezionare un tipo documento";
61
62
  static get Default(): "Standard" | "Default" | "Predeterminado" | "Defaultão";
@@ -162,6 +163,9 @@ export declare class SDKUI_Localizator {
162
163
  static get PhysDelete(): "Physische Stornierung" | "Physical delete" | "Cancelación física" | "Supression" | "Cancelamento física" | "Cancellazione fisica";
163
164
  static get Previous(): "Vorherige" | "Previous" | "Anterior" | "Précédent" | "Precedente";
164
165
  static get Recent(): "Kürzlich" | "Recent" | "Recientes" | "Récents" | "Recentes" | "Recenti";
166
+ static get Relations(): "Korrelationen" | "Correlations" | "Correlaciones" | "Relations" | "Correlacionados" | "Correlazioni";
167
+ static get RelationManyToMany(): "Folge viele mit vielen" | "Relation many to many" | "Correlación muchos a muchos" | "Corrélation plusieurs à plusieurs" | "Muitos para muitos relação" | "Correlazione molti a molti";
168
+ static get RelationType(): "Art der Beziehung" | "Relation type" | "Tipo de relación" | "Type de relation" | "Tipo de relacionamento" | "Tipo di relazione";
165
169
  static get QueryClear(): "Query bereinigen" | "Clear query" | "Limpiar consulta" | "Efface query" | "Limpar query" | "Pulisci query";
166
170
  static get QueryCount(): "Zählanfragen" | "Query count" | "Contar consulta" | "Compte query" | "Count query" | "Conta query";
167
171
  static get QueryDefine(): "Abfrage definieren" | "Query define" | "Definir consulta" | "Défine query" | "Definir query" | "Definisci query";
@@ -238,4 +242,5 @@ export declare class SDKUI_Localizator {
238
242
  static get Export(): "Exportieren" | "Export" | "Exportar" | "Exporter" | "Esporta";
239
243
  static get ErrorParsingFileContent(): "Fehler beim Parsen des Dateiinhalts. Stellen Sie sicher, dass die Datei im richtigen Format vorliegt." | "Error parsing the file content. Ensure the file is in the correct format." | "Error al analizar el contenido del archivo. Asegúrese de que el archivo esté en el formato correcto." | "Erreur lors de l'analyse du contenu du fichier. Assurez-vous que le fichier est dans le bon format." | "Erro ao analisar o conteúdo do arquivo. Certifique-se de que o arquivo está no formato correto." | "Errore durante l'analisi del contenuto del file. Assicurati che il file sia nel formato corretto.";
240
244
  static get SelectDesiredFilters(): "Wählen Sie die gewünschten Filter aus" | "Select the desired filters" | "Selecciona los filtros deseados" | "Sélectionnez les filtres souhaités" | "Selecione os filtros desejados" | "Seleziona i filtri desiderati";
245
+ static get Filters(): "Filter" | "Filters" | "Filtros" | "Filtres" | "Filtri";
241
246
  }
@@ -509,6 +509,16 @@ export class SDKUI_Localizator {
509
509
  default: return "Numero documenti";
510
510
  }
511
511
  }
512
+ static get DcmtType() {
513
+ switch (this._cultureID) {
514
+ case CultureIDs.De_DE: return "Dokumententyp";
515
+ case CultureIDs.En_US: return "Document type";
516
+ case CultureIDs.Es_ES: return "Tipo de documento";
517
+ case CultureIDs.Fr_FR: return "Type de document";
518
+ case CultureIDs.Pt_PT: return "Tipo de documento";
519
+ default: return "Tipo documento";
520
+ }
521
+ }
512
522
  static get DcmtTypesSelected() {
513
523
  switch (this._cultureID) {
514
524
  case CultureIDs.De_DE: return "Ausgewählte Dokumenttypen";
@@ -1569,6 +1579,37 @@ export class SDKUI_Localizator {
1569
1579
  default: return "Recenti";
1570
1580
  }
1571
1581
  }
1582
+ static get Relations() {
1583
+ switch (this._cultureID) {
1584
+ case CultureIDs.De_DE: return "Korrelationen";
1585
+ case CultureIDs.En_US: return "Correlations";
1586
+ case CultureIDs.Es_ES: return "Correlaciones";
1587
+ case CultureIDs.Fr_FR: return "Relations";
1588
+ case CultureIDs.Pt_PT: return "Correlacionados";
1589
+ default: return "Correlazioni";
1590
+ }
1591
+ ;
1592
+ }
1593
+ static get RelationManyToMany() {
1594
+ switch (this._cultureID) {
1595
+ case CultureIDs.De_DE: return "Folge viele mit vielen";
1596
+ case CultureIDs.En_US: return "Relation many to many";
1597
+ case CultureIDs.Es_ES: return "Correlación muchos a muchos";
1598
+ case CultureIDs.Fr_FR: return "Corrélation plusieurs à plusieurs";
1599
+ case CultureIDs.Pt_PT: return "Muitos para muitos relação";
1600
+ default: return "Correlazione molti a molti";
1601
+ }
1602
+ }
1603
+ static get RelationType() {
1604
+ switch (this._cultureID) {
1605
+ case CultureIDs.De_DE: return "Art der Beziehung";
1606
+ case CultureIDs.En_US: return "Relation type";
1607
+ case CultureIDs.Es_ES: return "Tipo de relación";
1608
+ case CultureIDs.Fr_FR: return "Type de relation";
1609
+ case CultureIDs.Pt_PT: return "Tipo de relacionamento";
1610
+ default: return "Tipo di relazione";
1611
+ }
1612
+ }
1572
1613
  static get QueryClear() {
1573
1614
  switch (this._cultureID) {
1574
1615
  case CultureIDs.De_DE: return "Query bereinigen";
@@ -2408,4 +2449,14 @@ export class SDKUI_Localizator {
2408
2449
  default: return "Seleziona i filtri desiderati";
2409
2450
  }
2410
2451
  }
2452
+ static get Filters() {
2453
+ switch (this._cultureID) {
2454
+ case CultureIDs.De_DE: return "Filter";
2455
+ case CultureIDs.En_US: return "Filters";
2456
+ case CultureIDs.Es_ES: return "Filtros";
2457
+ case CultureIDs.Fr_FR: return "Filtres";
2458
+ case CultureIDs.Pt_PT: return "Filtros";
2459
+ default: return "Filtri";
2460
+ }
2461
+ }
2411
2462
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.7.87",
3
+ "version": "6.7.89",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -28,7 +28,7 @@
28
28
  "lib"
29
29
  ],
30
30
  "dependencies": {
31
- "@topconsultnpm/sdk-ts-beta": "^6.7.23",
31
+ "@topconsultnpm/sdk-ts-beta": "^6.7.24",
32
32
  "@topconsultnpm/sdkui-react-beta": "^6.7.37",
33
33
  "buffer": "^6.0.3",
34
34
  "devextreme": "24.1.6",