@topconsultnpm/sdkui-react-beta 6.12.23 → 6.12.25
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/TMFileManager.js +1 -1
- package/lib/components/choosers/TMDcmtTypeChooser.js +1 -1
- package/lib/components/choosers/TMUserChooser.js +1 -1
- package/lib/components/forms/TMChooserForm.js +9 -4
- package/lib/helper/Enum_Localizator.js +5 -4
- package/lib/stories/TMHtmlContentDisplay.stories.js +23 -7
- package/lib/stories/TMHtmlEditor.stories.d.ts +6 -0
- package/lib/stories/TMHtmlEditor.stories.js +36 -0
- package/package.json +52 -52
@@ -159,7 +159,7 @@ const TMFileManager = (props) => {
|
|
159
159
|
// Render each TreeView item (directories) with custom styling/icons
|
160
160
|
const renderTreeViewItem = (itemData) => {
|
161
161
|
const isSelected = selectedFolder && selectedFolder.id === itemData.id;
|
162
|
-
return (_jsxs("div", { style: { whiteSpace: "nowrap" }, className: isSelected ? 'treeview-selected-item-manager' : '', children: [_jsx(IconFolder, { style: { marginRight: 5, color: '#e6c200' } }), itemData.text, " (", itemData.subFileFolderCount, ")"] }));
|
162
|
+
return (_jsxs("div", { style: { whiteSpace: "nowrap", display: "flex", alignItems: "center" }, className: isSelected ? 'treeview-selected-item-manager' : '', children: [_jsx(IconFolder, { style: { marginRight: 5, color: '#e6c200' } }), itemData.text, " (", itemData.subFileFolderCount, ")"] }));
|
163
163
|
};
|
164
164
|
// Function to handle item click event in the TreeView
|
165
165
|
const handleTreeViewItemClick = (e) => {
|
@@ -42,5 +42,5 @@ export const TMDcmtTypeChooserForm = (props) => {
|
|
42
42
|
return dtdList?.filter(d => d.templateTID && props.filterTemplateTID?.includes(d.templateTID));
|
43
43
|
return dtdList;
|
44
44
|
};
|
45
|
-
return (_jsx(TMChooserForm, { title: SDK_Localizator.ListDcmtTypeOrView, allowMultipleSelection: props.allowMultipleSelection, hasShowOnlySelectedItems:
|
45
|
+
return (_jsx(TMChooserForm, { title: SDK_Localizator.ListDcmtTypeOrView, allowMultipleSelection: props.allowMultipleSelection, hasShowOnlySelectedItems: true, width: props.width, height: props.height, selectedIDs: props.selectedIDs, cellRenderIcon: cellRenderIcon, cellRenderNameAndDesc: cellRenderNameAndDesc, dataSource: props.dataSource, getItems: getItems, onClose: props.onClose, onChoose: (IDs) => props.onChoose?.(IDs) }));
|
46
46
|
};
|
@@ -15,7 +15,7 @@ const TMUserChooser = ({ labelColor, titleForm, filter, readOnly = false, icon,
|
|
15
15
|
return (_jsxs(StyledDivHorizontal, { style: { minWidth: '125px' }, children: [values && values.length > 0 && _jsx(TMUserIdViewer, { userId: values?.[0], showIcon: true, noneSelectionText: '' }), values && values.length > 1 && _jsx("p", { style: { marginLeft: '10px' }, children: `(+${values.length - 1} ${values.length == 2 ? 'altro' : 'altri'})` })] }));
|
16
16
|
};
|
17
17
|
return (_jsxs(_Fragment, { children: [_jsx(TMSummary, { disabled: disabled, placeHolder: placeHolder, readOnly: readOnly, labelColor: labelColor, icon: icon, backgroundColor: backgroundColor, buttons: buttons, showBorder: showBorder, hasValue: values && values.length > 0, showClearButton: showClearButton, iconEditButton: _jsx(IconSearch, { fontSize: 16 }), onEditorClick: () => !readOnly && setShowChooser(true), elementStyle: elementStyle, isModifiedWhen: isModifiedWhen, openEditorOnSummaryClick: openChooserBySingleClick, label: label, template: renderTemplate(), onClearClick: showClearButton ? () => { onValueChanged?.([]); } : undefined, validationItems: validationItems }), showChooser &&
|
18
|
-
_jsx(TMUserChooserForm, { title: titleForm, allowMultipleSelection: allowMultipleSelection, hasShowOnlySelectedItems:
|
18
|
+
_jsx(TMUserChooserForm, { title: titleForm, allowMultipleSelection: allowMultipleSelection, hasShowOnlySelectedItems: true, dataSource: dataSource, filter: filter, selectedIDs: values, hideRefresh: hideRefresh, hideShowId: hideShowId, onClose: () => setShowChooser(false), onChoose: (IDs) => { onValueChanged?.(IDs); } })] }));
|
19
19
|
};
|
20
20
|
export default TMUserChooser;
|
21
21
|
export const TMUserChooserForm = ({ allowMultipleSelection, hideRefresh = false, hideShowId = false, startWithShowOnlySelectedItems = true, filter, title, hasShowOnlySelectedItems, width, height, selectedIDs, dataSource, onClose, onChoose }) => {
|
@@ -8,13 +8,14 @@ import TMModal from '../base/TMModal';
|
|
8
8
|
import TMLayoutContainer, { TMLayoutItem } from '../base/TMLayout';
|
9
9
|
import { TMColors } from '../../utils/theme';
|
10
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 }) => {
|
11
|
+
const TMChooserForm = ({ children, title, allowMultipleSelection = false, 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(hasShowOnlySelectedItems && startWithShowOnlySelectedItems && selectedIDs != undefined && selectedIDs.length > 0);
|
13
|
+
const [showOnlySelectedItems, setShowOnlySelectedItems] = useState(allowMultipleSelection && hasShowOnlySelectedItems && startWithShowOnlySelectedItems && selectedIDs != undefined && selectedIDs.length > 0);
|
14
14
|
const [allItems, setAllItems] = useState([]);
|
15
15
|
const [filteredItems, setFilteredItems] = useState([]);
|
16
16
|
const [selectedRowKeys, setSelectedRowKeys] = useState(selectedIDs ?? []);
|
17
17
|
const [focusedRowKey, setFocusedRowKey] = useState(selectedIDs?.[0]);
|
18
|
+
const [selectedRowCounter, setSelectedRowCounter] = useState([]);
|
18
19
|
useEffect(() => { doGetItems(false); }, [getItems]);
|
19
20
|
useEffect(() => {
|
20
21
|
if (showOnlySelectedItems)
|
@@ -22,9 +23,12 @@ const TMChooserForm = ({ children, title, allowMultipleSelection, startWithShowO
|
|
22
23
|
else
|
23
24
|
setFilteredItems(allItems);
|
24
25
|
}, [showOnlySelectedItems, allItems, selectedRowKeys, keyName]);
|
26
|
+
useEffect(() => {
|
27
|
+
setSelectedRowCounter(selectedRowKeys);
|
28
|
+
}, [selectedRowKeys]);
|
25
29
|
const getSelectedIDs = () => { return filteredItems.filter((o) => selectedRowKeys?.includes(o[keyName])).map((item) => { return convertID ? convertID(item) : item[keyName]; }); };
|
26
30
|
const getFocusedIDs = () => { return filteredItems.filter((o) => o[keyName] == focusedRowKey).map((item) => { return convertID ? convertID(item) : item[keyName]; }); };
|
27
|
-
const renderTitle = () => { return title ? `${title} (${
|
31
|
+
const renderTitle = () => { return title ? `${title} (${selectedRowCounter.length}/${filteredItems.length})` : SDKUI_Localizator.Select; };
|
28
32
|
const doGetItems = (refreshCache) => {
|
29
33
|
if (dataSource) {
|
30
34
|
setAllItems(dataSource);
|
@@ -35,10 +39,11 @@ const TMChooserForm = ({ children, title, allowMultipleSelection, startWithShowO
|
|
35
39
|
});
|
36
40
|
};
|
37
41
|
const ToolbarButtons = () => {
|
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:
|
42
|
+
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: selectedRowCounter.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) })] }));
|
39
43
|
};
|
40
44
|
const handleSelectionChanged = useCallback((e) => {
|
41
45
|
const selectedKeys = e.component.getSelectedRowKeys() ?? [];
|
46
|
+
setSelectedRowCounter(selectedKeys);
|
42
47
|
if (JSON.stringify(selectedKeys) === JSON.stringify(selectedRowKeys))
|
43
48
|
return;
|
44
49
|
setSelectedRowKeys(selectedKeys);
|
@@ -20,26 +20,27 @@ export function LocalizeFormModes(value) {
|
|
20
20
|
}
|
21
21
|
}
|
22
22
|
export function LocalizeJobTypes(value) {
|
23
|
+
let cultureID = SDK_Globals.tmSession?.SessionDescr?.cultureID ?? CultureIDs.It_IT;
|
23
24
|
switch (value) {
|
24
25
|
case JobTypes.FileExec: return "CustomExec";
|
25
26
|
case JobTypes.Signer: return "DcmtSigner";
|
26
27
|
case JobTypes.CassettoFiscaleQuery:
|
27
|
-
switch (
|
28
|
+
switch (cultureID) {
|
28
29
|
case CultureIDs.It_IT: return value?.toString();
|
29
30
|
default: return "TaxDrawerQuery";
|
30
31
|
}
|
31
32
|
case JobTypes.CassettoFiscaleSender:
|
32
|
-
switch (
|
33
|
+
switch (cultureID) {
|
33
34
|
case CultureIDs.It_IT: return value?.toString();
|
34
35
|
default: return "TaxDrawerSender";
|
35
36
|
}
|
36
37
|
case JobTypes.CassettoDoganale:
|
37
|
-
switch (
|
38
|
+
switch (cultureID) {
|
38
39
|
case CultureIDs.It_IT: return value?.toString();
|
39
40
|
default: return "CustomsDrawer";
|
40
41
|
}
|
41
42
|
case JobTypes.CassettoDoganalePlus:
|
42
|
-
switch (
|
43
|
+
switch (cultureID) {
|
43
44
|
case CultureIDs.It_IT: return value?.toString();
|
44
45
|
default: return "CustomsDrawerPlus";
|
45
46
|
}
|
@@ -1,25 +1,41 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { useState } from 'react';
|
1
3
|
import TMHtmlContentDisplay from '../components/editors/TMHtmlContentDisplay';
|
2
4
|
const sampleMarkup = `
|
3
5
|
<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>
|
6
|
+
<p>Another paragraph with the word <u>sample</u> and some <em>emphasized</em> content.</p>
|
5
7
|
<ul>
|
6
8
|
<li>First item</li>
|
7
|
-
<li>Second item</li>
|
9
|
+
<li>Second item with <u>underline</u> and <em>emphasis</em></li>
|
8
10
|
</ul>
|
11
|
+
<ol>
|
12
|
+
<li>Ordered item one</li>
|
13
|
+
<li>Ordered item <em>two</em> with a sample word</li>
|
14
|
+
</ol>
|
15
|
+
<p>Check out this URL: https://www.example.com</p>
|
9
16
|
`;
|
10
17
|
const meta = {
|
11
18
|
title: 'Components/TMHtmlContentDisplay',
|
12
19
|
component: TMHtmlContentDisplay,
|
13
|
-
|
14
|
-
|
15
|
-
isSelected: false,
|
16
|
-
searchText: '',
|
20
|
+
argTypes: {
|
21
|
+
searchText: { control: false }, // Disable default control
|
17
22
|
},
|
18
23
|
};
|
19
24
|
export default meta;
|
20
25
|
export const Default = {
|
26
|
+
render: (args) => {
|
27
|
+
const [searchText, setSearchText] = useState(args.searchText || '');
|
28
|
+
return (_jsxs("div", { style: { padding: 20 }, children: [_jsx("input", { type: "text", placeholder: "Search text...", value: searchText, onChange: (e) => setSearchText(e.target.value), style: {
|
29
|
+
marginBottom: '1rem',
|
30
|
+
padding: '0.5rem',
|
31
|
+
width: '100%',
|
32
|
+
maxWidth: '300px',
|
33
|
+
fontSize: '1rem',
|
34
|
+
} }), _jsx(TMHtmlContentDisplay, { ...args, searchText: searchText })] }));
|
35
|
+
},
|
21
36
|
args: {
|
37
|
+
markup: sampleMarkup,
|
22
38
|
isSelected: false,
|
23
|
-
searchText: '
|
39
|
+
searchText: '',
|
24
40
|
},
|
25
41
|
};
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
2
|
+
import TMHtmlEditor from '../components/editors/TMHtmlEditor';
|
3
|
+
declare const meta: Meta<typeof TMHtmlEditor>;
|
4
|
+
export default meta;
|
5
|
+
type Story = StoryObj<typeof TMHtmlEditor>;
|
6
|
+
export declare const Default: Story;
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { useEffect, useState } from 'react';
|
3
|
+
import TMHtmlEditor from '../components/editors/TMHtmlEditor';
|
4
|
+
const meta = {
|
5
|
+
title: 'Components/TMHtmlEditor',
|
6
|
+
component: TMHtmlEditor,
|
7
|
+
argTypes: {
|
8
|
+
onValueChanged: { control: false },
|
9
|
+
},
|
10
|
+
};
|
11
|
+
export default meta;
|
12
|
+
export const Default = {
|
13
|
+
render: (args) => {
|
14
|
+
const [content, setContent] = useState('');
|
15
|
+
const [mentionsConfig, setMentionsConfig] = useState([]);
|
16
|
+
useEffect(() => {
|
17
|
+
const mentions = [{
|
18
|
+
dataSource: [{ text: 'John Doe', icon: '👤' }, { text: 'Jane Smith', icon: '👩' },],
|
19
|
+
searchExpr: 'text',
|
20
|
+
displayExpr: 'text',
|
21
|
+
valueExpr: 'text',
|
22
|
+
itemTemplate: function (itemData) {
|
23
|
+
return `<div style="display: flex; align-items: center; justify-content: center; gap: 8px; height: 100%;">
|
24
|
+
${itemData.icon}
|
25
|
+
<span>${itemData.text}</span>
|
26
|
+
</div>`;
|
27
|
+
},
|
28
|
+
}];
|
29
|
+
setMentionsConfig(mentions);
|
30
|
+
}, []);
|
31
|
+
const handleValueChange = (e) => {
|
32
|
+
setContent(e.value);
|
33
|
+
};
|
34
|
+
return (_jsxs("div", { style: { padding: 20 }, children: [_jsx(TMHtmlEditor, { ...args, onValueChanged: handleValueChange, isEditorEnabled: true, mentionsConfig: mentionsConfig }), _jsxs("div", { style: { marginTop: '1rem', padding: '0.5rem', backgroundColor: '#f5f5f5' }, children: [_jsx("h4", { children: "Editor Output:" }), _jsx("div", { dangerouslySetInnerHTML: { __html: content } })] })] }));
|
35
|
+
},
|
36
|
+
};
|
package/package.json
CHANGED
@@ -1,54 +1,54 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
2
|
+
"name": "@topconsultnpm/sdkui-react-beta",
|
3
|
+
"version": "6.12.25",
|
4
|
+
"description": "",
|
5
|
+
"scripts": {
|
6
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
7
|
+
"clean": "powershell Remove-Item lib/ -recurse",
|
8
|
+
"copy-files": "copyfiles -u 1 src/assets/*.* src/assets/ImageLibrary/*.* src/assets/thumbnails/*.* src/assets/Metadata/*.* src/css/tm-sdkui.css lib/",
|
9
|
+
"tm-build": "npm run clean && tsc && npm run copy-files",
|
10
|
+
"tm-publish": "npm publish",
|
11
|
+
"storybook": "storybook dev -p 6006",
|
12
|
+
"build-storybook": "storybook build"
|
13
|
+
},
|
14
|
+
"author": "TopConsult",
|
15
|
+
"license": "ISC",
|
16
|
+
"devDependencies": {
|
17
|
+
"@chromatic-com/storybook": "^3.2.6",
|
18
|
+
"@storybook/addon-essentials": "^8.6.12",
|
19
|
+
"@storybook/addon-interactions": "^8.6.12",
|
20
|
+
"@storybook/addon-onboarding": "^8.6.12",
|
21
|
+
"@storybook/blocks": "^8.6.12",
|
22
|
+
"@storybook/react": "^8.6.12",
|
23
|
+
"@storybook/react-vite": "^8.6.12",
|
24
|
+
"@storybook/test": "^8.6.12",
|
25
|
+
"@types/node": "^20.2.5",
|
26
|
+
"@types/react": "^18.2.7",
|
27
|
+
"@types/react-dom": "^18.2.4",
|
28
|
+
"copyfiles": "^2.4.1",
|
29
|
+
"esbuild": "^0.25.0",
|
30
|
+
"react": "^18.2.0",
|
31
|
+
"react-dom": "^18.2.0",
|
32
|
+
"storybook": "^8.6.12",
|
33
|
+
"typescript": "^5.3.2",
|
34
|
+
"vite": "^6.1.1"
|
35
|
+
},
|
36
|
+
"main": "dist/cjs/index.js",
|
37
|
+
"types": "./index.d.ts",
|
38
|
+
"module": "lib/esm/index.js",
|
39
|
+
"files": [
|
40
|
+
"dist",
|
41
|
+
"lib"
|
42
|
+
],
|
43
|
+
"dependencies": {
|
44
|
+
"@topconsultnpm/sdk-ts-beta": "^6.12.0",
|
45
|
+
"buffer": "^6.0.3",
|
46
|
+
"devextreme": "24.2.6",
|
47
|
+
"devextreme-react": "24.2.6",
|
48
|
+
"react-router-dom": "^6.15.0",
|
49
|
+
"styled-components": "^6.1.1"
|
50
|
+
},
|
51
|
+
"overrides": {
|
52
|
+
"esbuild": "^0.25.0"
|
53
|
+
}
|
54
54
|
}
|