@topconsultnpm/sdkui-react-beta 6.11.8 → 6.11.10
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/lib/components/base/TMToolbarCard.js +1 -1
- package/lib/components/choosers/TMDiskChooser.d.ts +10 -0
- package/lib/components/choosers/TMDiskChooser.js +40 -0
- package/lib/components/choosers/TMUserChooser.js +1 -1
- package/lib/stories/TMDataGrid.stories.d.ts +0 -1
- package/lib/stories/TMDataGrid.stories.js +1 -1
- package/package.json +1 -1
|
@@ -45,7 +45,7 @@ const StyledSearchCardContent = styled.div `
|
|
|
45
45
|
`;
|
|
46
46
|
const TMToolbarCard = ({ items = [], onItemClick, selectedItem, showPanel, color = TMColors.colorHeader, backgroundColor = TMColors.backgroundColorHeader, children, showHeader = true, title, totalItems, displayedItemsCount, toolbar, padding = '3px', onBack, onClose, onHeaderDoubleClick }) => {
|
|
47
47
|
return (_jsxs(StyledSearchCard, { children: [showHeader && _jsx(StyledSearchCardHeader, { "$backgroundColor": backgroundColor, "$color": color, onDoubleClick: () => { if (onHeaderDoubleClick)
|
|
48
|
-
onHeaderDoubleClick(); }, children: _jsxs("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', width: '100%' }, children: [_jsxs("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center', gap: '8px' }, children: [onBack && _jsx(TMButton, { btnStyle: 'icon', icon: _jsx("div", { style: { backgroundColor: 'white', minWidth: '24px', minHeight: '24px', borderRadius: '24px', display: 'flex', alignItems: 'center', justifyContent: 'center' }, children: _jsx(IconArrowLeft, { color: TMColors.primaryColor }) }), caption: 'Torna indietro', onClick: onBack }), _jsxs("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center' }, children: [_jsx("p", { children: title }), (displayedItemsCount && displayedItemsCount > 0) && (_jsxs(_Fragment, { children: [_jsx(StyledBadge, { "$backgroundColor": '#679CE8', children: displayedItemsCount }), (totalItems && totalItems > 0) && _jsx("span", { children: "\u00A0\u00A0/\u00A0" })] })), (totalItems && totalItems > 0) && _jsx(StyledBadge, { "$backgroundColor": '#679CE8', children: totalItems })] })] }), _jsxs("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center', gap: '5px' }, children: [toolbar, onClose && _jsx(TMButton, { color: 'primaryOutline', caption: SDKUI_Localizator.Close, icon: _jsx("i", { className: 'dx-icon-remove', style: { color: "white" } }), btnStyle: 'icon', onClick: () => onClose?.() })] })] }) }), _jsxs(StyledSearchCardContent, { "$height": showHeader ? "calc(100% - 35px)" : "100%", "$padding": padding, "$backgroundColor": `${TMColors.backgroundColorHeader}12`, children: [_jsx("div", { style: { width: items.length > 0 ? 'calc(100% - 30px)' : '100%' }, children: children }), items.length > 0 &&
|
|
48
|
+
onHeaderDoubleClick(); }, children: _jsxs("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', width: '100%' }, children: [_jsxs("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center', gap: '8px' }, children: [onBack && _jsx(TMButton, { btnStyle: 'icon', icon: _jsx("div", { style: { backgroundColor: 'white', minWidth: '24px', minHeight: '24px', borderRadius: '24px', display: 'flex', alignItems: 'center', justifyContent: 'center' }, children: _jsx(IconArrowLeft, { color: TMColors.primaryColor }) }), caption: 'Torna indietro', onClick: onBack }), _jsxs("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center' }, children: [_jsx("p", { children: title }), Boolean(displayedItemsCount && displayedItemsCount > 0) && (_jsxs(_Fragment, { children: [_jsx(StyledBadge, { "$backgroundColor": '#679CE8', children: displayedItemsCount }), Boolean(totalItems && totalItems > 0) && _jsx("span", { children: "\u00A0\u00A0/\u00A0" })] })), Boolean(totalItems && totalItems > 0) && _jsx(StyledBadge, { "$backgroundColor": '#679CE8', children: totalItems })] })] }), _jsxs("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center', gap: '5px' }, children: [toolbar, onClose && _jsx(TMButton, { color: 'primaryOutline', caption: SDKUI_Localizator.Close, icon: _jsx("i", { className: 'dx-icon-remove', style: { color: "white" } }), btnStyle: 'icon', onClick: () => onClose?.() })] })] }) }), _jsxs(StyledSearchCardContent, { "$height": showHeader ? "calc(100% - 35px)" : "100%", "$padding": padding, "$backgroundColor": `${TMColors.backgroundColorHeader}12`, children: [_jsx("div", { style: { width: items.length > 0 ? 'calc(100% - 30px)' : '100%' }, children: children }), items.length > 0 &&
|
|
49
49
|
_jsx(TMRightSidebar, { items: items, onItemClick: onItemClick, selectedItem: selectedItem, showPanel: showPanel })] })] }));
|
|
50
50
|
};
|
|
51
51
|
export default TMToolbarCard;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DiskDescriptor } from '@topconsultnpm/sdk-ts-beta';
|
|
3
|
+
import { ITMChooserProps, ITMChooserFormProps } from '../../ts';
|
|
4
|
+
interface ITMDiskChooserProps extends ITMChooserProps {
|
|
5
|
+
/** Contiene i values selezionati -> attualmente sempre e solo 1 elemento */
|
|
6
|
+
values?: number[];
|
|
7
|
+
}
|
|
8
|
+
declare const TMDiskChooser: React.FunctionComponent<ITMDiskChooserProps>;
|
|
9
|
+
export default TMDiskChooser;
|
|
10
|
+
export declare const TMDiskChooserForm: React.FunctionComponent<ITMChooserFormProps<DiskDescriptor>>;
|
|
@@ -0,0 +1,40 @@
|
|
|
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';
|
|
4
|
+
import { SDK_Localizator, SDK_Globals } from '@topconsultnpm/sdk-ts-beta';
|
|
5
|
+
import { StyledDivHorizontal } from '../base/Styled';
|
|
6
|
+
import TMSummary from '../editors/TMSummary';
|
|
7
|
+
import { IconDisk, IconSearch, SDKUI_Localizator } from '../../helper';
|
|
8
|
+
import TMSpinner from '../base/TMSpinner';
|
|
9
|
+
import TMChooserForm from '../forms/TMChooserForm';
|
|
10
|
+
const TMDiskChooser = ({ backgroundColor, elementStyle, values, dataSource, isModifiedWhen, label, placeHolder, validationItems = [], onValueChanged }) => {
|
|
11
|
+
const [showChooser, setShowChooser] = useState(false);
|
|
12
|
+
const [disk, setDisk] = useState();
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (dataSource && values && values.length > 0) {
|
|
15
|
+
let d = dataSource.find(d => d.id == values[0]);
|
|
16
|
+
if (d)
|
|
17
|
+
setDisk(d);
|
|
18
|
+
}
|
|
19
|
+
}, [values]);
|
|
20
|
+
const renderTemplate = () => {
|
|
21
|
+
return (_jsx(StyledDivHorizontal, { style: { minWidth: '125px' }, children: placeHolder && (!values || values.length <= 0)
|
|
22
|
+
? _jsx("p", { children: placeHolder })
|
|
23
|
+
: _jsx("p", { style: { marginLeft: '10px' }, children: disk ? disk.name : placeHolder }) }));
|
|
24
|
+
};
|
|
25
|
+
return (_jsxs(_Fragment, { children: [_jsx(TMSummary, { backgroundColor: backgroundColor, iconEditButton: _jsx(IconSearch, {}), onEditorClick: () => setShowChooser(true), onClearClick: () => { onValueChanged?.([]); }, elementStyle: elementStyle, isModifiedWhen: isModifiedWhen, label: label, template: renderTemplate(), showClearButton: true, hasValue: values && values.length > 0, validationItems: validationItems }), showChooser &&
|
|
26
|
+
_jsx(TMDiskChooserForm, { selectedIDs: values, dataSource: dataSource, onClose: () => setShowChooser(false), onChoose: (IDs) => { onValueChanged?.(IDs); } })] }));
|
|
27
|
+
};
|
|
28
|
+
export default TMDiskChooser;
|
|
29
|
+
export const TMDiskChooserForm = (props) => {
|
|
30
|
+
const getItems = async (refreshCache) => {
|
|
31
|
+
TMSpinner.show({ description: `${SDKUI_Localizator.Loading} - ${SDK_Localizator.Disks} ...` });
|
|
32
|
+
let items = await SDK_Globals.tmSession?.NewDiskEngine().RetrieveAllAdminAsync();
|
|
33
|
+
TMSpinner.hide();
|
|
34
|
+
return items ?? [];
|
|
35
|
+
};
|
|
36
|
+
const renderDataGridColumns = [
|
|
37
|
+
_jsx(Column, { dataField: "uncPath", caption: 'Percorso UNC' }, 3),
|
|
38
|
+
];
|
|
39
|
+
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); } }));
|
|
40
|
+
};
|
|
@@ -106,7 +106,7 @@ function User_IsExpired(d) {
|
|
|
106
106
|
return false;
|
|
107
107
|
let ud = d;
|
|
108
108
|
const today = new Date();
|
|
109
|
-
return (ud.validFrom && today < ud.validFrom) || (ud.validTo && today > ud.validTo);
|
|
109
|
+
return (ud.validFrom && today < ud.validFrom) || (ud.validTo && today > ud.validTo) || ud.disabled;
|
|
110
110
|
}
|
|
111
111
|
const getUserIcon = (userLevel, level, isExpired) => {
|
|
112
112
|
let ownershipColor = "";
|
|
@@ -5,7 +5,7 @@ import { TMDataGridPageSize } from '../components/base/TMDataGrid';
|
|
|
5
5
|
// Importing the DevExtreme library's Material Design theme in light blue color scheme
|
|
6
6
|
import 'devextreme/dist/css/dx.fluent.blue.light.compact.css';
|
|
7
7
|
// Importing custom styles for the tm-sdkui library
|
|
8
|
-
import '/lib/css/tm-sdkui.css';
|
|
8
|
+
// import '/lib/css/tm-sdkui.css';
|
|
9
9
|
import { sortArgTypes } from './TMStoriesUtils';
|
|
10
10
|
const generateData = (count) => {
|
|
11
11
|
const data = [];
|