@topconsultnpm/sdkui-react-beta 6.12.145 → 6.12.147
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.
@@ -186,7 +186,7 @@ const ImageViewer = ({ fileBlob, alt = 'Image', className }) => {
|
|
186
186
|
return () => { };
|
187
187
|
}, [imageUrl]);
|
188
188
|
const fullZoom = baseZoom * zoomFactor;
|
189
|
-
const zoomPercent = Math.round(fullZoom * 100);
|
189
|
+
// const zoomPercent = Math.round(fullZoom * 100);
|
190
190
|
const clampTranslation = (tx, ty, zoom) => {
|
191
191
|
const container = containerRef.current;
|
192
192
|
const image = imageRef.current;
|
@@ -314,15 +314,15 @@ const ImageViewer = ({ fileBlob, alt = 'Image', className }) => {
|
|
314
314
|
}
|
315
315
|
}, 1000);
|
316
316
|
};
|
317
|
-
const btnDisabled = useMemo(() => {
|
318
|
-
|
319
|
-
}, [zoomFactor, translateX, translateY, rotation])
|
317
|
+
// const btnDisabled = useMemo<boolean>(() => {
|
318
|
+
// return zoomFactor === 1 && translateX === 0 && translateY === 0 && rotation === 0
|
319
|
+
// }, [zoomFactor, translateX, translateY, rotation])
|
320
320
|
const cursor = useMemo(() => {
|
321
321
|
if (zoomFactor <= 1)
|
322
322
|
return 'default';
|
323
323
|
return isDragging ? 'grabbing' : 'grab';
|
324
324
|
}, [zoomFactor, isDragging]);
|
325
|
-
return (_jsxs("div", { style: { position: 'relative', width: '100%', height: '100%' }, children: [_jsx(TopToolbar, { children: _jsxs(ToolbarCenter, { children: [_jsx(ToolbarIconButton, { title: 'Diminuisci lo zoom', onClick: handleZoomOut, disabled: zoomFactor <= 0.5, children: _jsx(IconZoomOutLinear, {}) }),
|
325
|
+
return (_jsxs("div", { style: { position: 'relative', width: '100%', height: '100%' }, children: [_jsx(TopToolbar, { children: _jsxs(ToolbarCenter, { children: [_jsx(ToolbarIconButton, { title: 'Diminuisci lo zoom', onClick: handleZoomOut, disabled: zoomFactor <= 0.5, children: _jsx(IconZoomOutLinear, {}) }), _jsx(ToolbarIconButton, { title: 'Aumenta lo zoom', onClick: handleZoomIn, disabled: zoomFactor >= 3, children: _jsx(IconZoomInLinear, {}) }), _jsx(Divider, {}), _jsx(ToolbarIconButton, { title: 'Stampa', onClick: handlePrint, children: _jsx(IconPrintOutline, {}) })] }) }), _jsx(ImageContainer, { ref: containerRef, onMouseDown: onMouseDown, onTouchStart: onMouseDown, "$cursor": cursor, className: className, children: imageUrl && (_jsx(StyledImage, { ref: imageRef, src: imageUrl, alt: alt, "$scale": fullZoom, "$tx": translateX, "$ty": translateY, "$rotate": rotation })) })] }));
|
326
326
|
};
|
327
327
|
export const TMNothingToShow = ({ text = '', secondText, fileExt, icon = _jsx(IconPreview, { fontSize: 96 }) }) => {
|
328
328
|
return (_jsx(StyledAnimatedComponentOpacity, { style: { width: '100%', height: '100%' }, children: _jsxs(StyledPanelStatusContainer, { children: [icon, _jsxs(StyledPreviewNotAvailable, { children: [text && _jsx("div", { children: text }), _jsxs("div", { children: [" ", secondText ?? 'Anteprima non disponibile.', fileExt && _jsx("b", { children: ` (*.${fileExt})` })] })] })] }) }));
|
@@ -346,11 +346,11 @@ const StyledPreviewContainer = styled.div `display: flex; justify-content: cente
|
|
346
346
|
export const StyledHeaderIcon = styled.div ` color: ${props => props.$color}; cursor: pointer; display: flex; align-items: center; justify-content: center; &:hover{ color: white ; transition: 200ms ease; } `;
|
347
347
|
export const StyledPanelStatusContainer = styled.div ` width: 100%; height: 100%; padding: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; `;
|
348
348
|
const StyledPreviewNotAvailable = styled.div ` display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; `;
|
349
|
-
const ImageContainer = styled.div ` width: 100%; height: 100%; position: absolute; top:
|
349
|
+
const ImageContainer = styled.div ` width: 100%; height: 100%; position: absolute; top:40px; overflow: hidden; background: #f5f5f5; touch-action: none; user-select: none; cursor: ${({ $cursor }) => $cursor ?? 'default'}; `;
|
350
350
|
const ResetButton = styled.button ` display: flex; align-items: center; justify-content: center; background: #707070; color: #f1f1f1; border: none; padding: 6px; border-radius: 4px; cursor: pointer; font-size: 14px; &:disabled { background: #ccc; cursor: not-allowed; } `;
|
351
|
-
const TopToolbar = styled.div ` position: absolute; top: 0; width: 100%; height:
|
351
|
+
const TopToolbar = styled.div ` position: absolute; top: 0; width: 100%; height: 40px; background-color: #e4e4e4; display: flex; justify-content: center; align-items: center; z-index: 10; `;
|
352
352
|
const ToolbarCenter = styled.div ` display: flex; align-items: center; gap: 12px;`;
|
353
|
-
const ToolbarIconButton = styled.button ` background:
|
353
|
+
const ToolbarIconButton = styled.button ` background: #f0f0f0; border: none; color: #313131; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; height: 32px; width: 32px; padding: 0; border-radius: 50px; &:hover{ background-color: #c4c4c4; } &:disabled { color: #c2c2c2; cursor: not-allowed; } `;
|
354
354
|
const ZoomDisplay = styled.div ` color: #535353; font-size: 14px; min-width: 40px; text-align: center; background-color: #f8f8f8; border: 1px solid lightgray; padding: 0 3px; border-radius: 1px; `;
|
355
355
|
const Divider = styled.div `width:1px; height: 20px; background-color: darkgray; `;
|
356
356
|
const StyledImage = styled.img.attrs(props => ({
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import { ITMChooserFormProps } from '../../ts';
|
2
|
-
declare const TMChooserForm: <T>({ children, title, allowMultipleSelection, startWithShowOnlySelectedItems, hasShowOnlySelectedItems, allowGrouping, allowSorting, width, height, dataSource, selectedIDs, manageUseLocalizedName, hasShowId, hideRefresh, keyName, customButtons, showDefaultColumns, columns, summaryItems, convertID, customFilter, getItems, cellRenderIcon, cellRenderNameAndDesc, onChoose, onClose, onShowIdChanged }: ITMChooserFormProps<T>) => import("react/jsx-runtime").JSX.Element;
|
2
|
+
declare const TMChooserForm: <T>({ children, title, allowMultipleSelection, allowApplyWithZeroSelection, startWithShowOnlySelectedItems, hasShowOnlySelectedItems, allowGrouping, allowSorting, width, height, dataSource, selectedIDs, manageUseLocalizedName, hasShowId, hideRefresh, keyName, customButtons, showDefaultColumns, columns, summaryItems, convertID, customFilter, getItems, cellRenderIcon, cellRenderNameAndDesc, onChoose, onClose, onShowIdChanged }: ITMChooserFormProps<T>) => import("react/jsx-runtime").JSX.Element;
|
3
3
|
export default TMChooserForm;
|
@@ -8,7 +8,7 @@ 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 = 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 }) => {
|
11
|
+
const TMChooserForm = ({ children, title, allowMultipleSelection = false, allowApplyWithZeroSelection = 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
13
|
const [showOnlySelectedItems, setShowOnlySelectedItems] = useState(allowMultipleSelection && hasShowOnlySelectedItems && startWithShowOnlySelectedItems && selectedIDs != undefined && selectedIDs.length > 0);
|
14
14
|
const [allItems, setAllItems] = useState([]);
|
@@ -39,7 +39,7 @@ const TMChooserForm = ({ children, title, allowMultipleSelection = false, startW
|
|
39
39
|
});
|
40
40
|
};
|
41
41
|
const ToolbarButtons = () => {
|
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) })] }));
|
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 && !allowApplyWithZeroSelection, 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) })] }));
|
43
43
|
};
|
44
44
|
/** check if it's possible to manage double-click to choose */
|
45
45
|
const allowChooseDoubleClick = () => {
|
package/lib/ts/types.d.ts
CHANGED
@@ -203,6 +203,7 @@ export interface ITMChooserFormProps<T> {
|
|
203
203
|
allowSorting?: boolean;
|
204
204
|
allowGrouping?: boolean;
|
205
205
|
allowMultipleSelection?: boolean;
|
206
|
+
allowApplyWithZeroSelection?: boolean;
|
206
207
|
hasShowOnlySelectedItems?: boolean;
|
207
208
|
startWithShowOnlySelectedItems?: boolean;
|
208
209
|
keyName?: string;
|