@topconsultnpm/sdkui-react-beta 6.11.9 → 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.
@@ -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 = "";
@@ -1,6 +1,5 @@
1
1
  import { Meta } from '@storybook/react';
2
2
  import 'devextreme/dist/css/dx.fluent.blue.light.compact.css';
3
- import '/lib/css/tm-sdkui.css';
4
3
  declare const _default: Meta;
5
4
  export default _default;
6
5
  export declare const DefaultTMDatagrid: any;
@@ -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 = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.11.9",
3
+ "version": "6.11.10",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",