@topconsultnpm/sdkui-react-beta 6.6.19 → 6.6.21
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/editors/TMDateBox.js +4 -12
- package/lib/components/editors/TMTextBox.js +21 -7
- package/lib/components/sidebar/TMSidebar.d.ts +4 -0
- package/lib/components/sidebar/TMSidebar.js +12 -9
- package/lib/components/sidebar/TMSidebarItem.d.ts +7 -0
- package/lib/components/sidebar/TMSidebarItem.js +14 -4
- package/package.json +1 -1
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useRef } from 'react';
|
|
3
3
|
import { DateBox } from 'devextreme-react';
|
|
4
|
-
import {
|
|
5
|
-
import { DateDisplayTypes, Globalization, IconLayerGroup } from '../../helper';
|
|
4
|
+
import { DateDisplayTypes, Globalization } from '../../helper';
|
|
6
5
|
import { TMColors } from '../../utils/theme';
|
|
7
6
|
import TMVilViewer from '../base/TMVilViewer';
|
|
8
|
-
import ReactDOMServer from 'react-dom/server';
|
|
9
7
|
const TMDateBox = (props) => {
|
|
10
8
|
useEffect(() => {
|
|
11
9
|
let htmlElement = dateBoxRef?.current?.instance().element();
|
|
@@ -50,7 +48,7 @@ const TMDateBox = (props) => {
|
|
|
50
48
|
return "datetime";
|
|
51
49
|
return props.dateDisplayType == DateDisplayTypes.Date ? "date" : "time";
|
|
52
50
|
};
|
|
53
|
-
return (_jsxs(_Fragment, { children: [
|
|
51
|
+
return (_jsxs(_Fragment, { children: [_jsx(DateBox, { ref: dateBoxRef,
|
|
54
52
|
// defaultValue={props.defaultValue}
|
|
55
53
|
showClearButton: props.showClearButton, dateSerializationFormat: props.useDateSerializationFormat ? 'yyyy-MM-ddTHH:mm:ss' : undefined, disabled: props.disabled, displayFormat: props.displayFormat ?? Globalization.getDateDisplayFormat(props.dateDisplayType), dropDownOptions: dropDownOptions, label: props.label, labelMode: 'static', type: getType(), useMaskBehavior: true, height: '28px', value: props.value, width: props.width, valueChangeEvent: 'keyup input change', onValueChange: (e) => { props.onValueChange?.(e); }, onKeyUp: (e) => {
|
|
56
54
|
if (e.event?.code == "Space") {
|
|
@@ -67,12 +65,6 @@ const TMDateBox = (props) => {
|
|
|
67
65
|
const currentDate = new Date(e.value);
|
|
68
66
|
currentDate.setHours(0, 0, 0, 0);
|
|
69
67
|
e.component.option("value", currentDate.toISOString());
|
|
70
|
-
},
|
|
71
|
-
return (_jsx(Button, { name: btn.text, location: "after", options: {
|
|
72
|
-
icon: ReactDOMServer.renderToString(_jsx(IconLayerGroup, {})),
|
|
73
|
-
stylingMode: 'text',
|
|
74
|
-
onClick: () => btn?.onClick?.()
|
|
75
|
-
} }, btn.text));
|
|
76
|
-
}), _jsx(Button, { name: "dropDown" })] }), _jsx(TMVilViewer, { vil: props.validationItems })] }));
|
|
68
|
+
} }), _jsx(TMVilViewer, { vil: props.validationItems })] }));
|
|
77
69
|
};
|
|
78
70
|
export default TMDateBox;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useEffect, useRef } from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
|
-
import { StyledEditor,
|
|
4
|
+
import { StyledEditor, StyledEditorContainer, StyledEditorIcon, StyledEditorLabel, editorColorManager } from './TMEditorStyled';
|
|
5
5
|
import { FontSize, TMColors } from '../../utils/theme';
|
|
6
6
|
import { genUniqueId, IconClearButton, IconHide, IconShow, useWindowWidth } from '../../helper';
|
|
7
7
|
import ShowAlert from '../base/TMAlert';
|
|
@@ -18,6 +18,19 @@ const StyledShowPasswordIcon = styled.div `
|
|
|
18
18
|
transform: translateY(-25px);
|
|
19
19
|
cursor: pointer;
|
|
20
20
|
`;
|
|
21
|
+
const StyledTextBoxEditorButton = styled.div `
|
|
22
|
+
color: ${TMColors.button_icon};
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
position: relative;
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
&:focus{
|
|
28
|
+
outline: none;
|
|
29
|
+
background-image: linear-gradient(white, #E4E9F7);
|
|
30
|
+
border-bottom: 2px solid;
|
|
31
|
+
border-bottom-color: ${TMColors.primary};
|
|
32
|
+
}
|
|
33
|
+
`;
|
|
21
34
|
const TMTextBox = ({ autoFocus, maxLength, precision, scale, showClearButton, validationItems = [], label = '', readOnly = false, formulaItems = [], buttons = [], isModifiedWhen, placeHolder, elementStyle, width = '100%', maxValue, fontSize = FontSize.defaultFontSize, icon, labelPosition = 'left', value, disabled = false, type = 'text', onValueChanged, onBlur }) => {
|
|
22
35
|
const [initialType, setInitialType] = useState(type);
|
|
23
36
|
const [currentType, setCurrentType] = useState(type);
|
|
@@ -128,12 +141,13 @@ const TMTextBox = ({ autoFocus, maxLength, precision, scale, showClearButton, va
|
|
|
128
141
|
e.preventDefault();
|
|
129
142
|
}
|
|
130
143
|
}, "$isMobile": screenWidth < 640, "$disabled": disabled, "$vil": validationItems, "$isModified": isModifiedWhen, "$fontSize": fontSize, "$maxValue": maxValue, "$width": width, "$type": currentType }), initialType === 'password' && currentValue && _jsx(StyledShowPasswordIcon, { onClick: toggleShowPassword, "$disabled": disabled, "$vil": validationItems, "$isModified": isModifiedWhen, children: showPasswordIcon() }), initialType !== 'password' &&
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
144
|
+
_jsxs("div", { style: { display: 'flex', flexDirection: 'row', justifyContent: 'flex-start', alignItems: 'center', position: 'absolute', right: '6px', top: '7px', pointerEvents: disabled ? 'none' : 'auto', opacity: disabled ? 0.4 : 1 }, children: [showClearButton && currentValue &&
|
|
145
|
+
_jsx(StyledTextBoxEditorButton, { onClick: () => {
|
|
146
|
+
onValueChanged?.({ target: { value: undefined } });
|
|
147
|
+
onBlur?.(undefined);
|
|
148
|
+
}, children: _jsx(IconClearButton, {}) }), buttons.map((buttonItem, index) => {
|
|
149
|
+
return (_jsx(StyledTextBoxEditorButton, { onClick: buttonItem.onClick, children: _jsx(TMTooltip, { content: buttonItem.text, children: buttonItem.icon }) }, buttonItem.text));
|
|
150
|
+
})] }), formulaItems.length > 0 && (_jsx(ContextMenu, { dataSource: formulaMenuItems, target: `#text-${id}`, onItemClick: (e) => { insertText(e.itemData?.text ?? ''); } })), _jsx(TMVilViewer, { vil: validationItems })] }));
|
|
137
151
|
};
|
|
138
152
|
const renderedLeftLabelTextBox = () => {
|
|
139
153
|
return (_jsxs(TMLayoutContainer, { direction: 'horizontal', children: [icon && _jsx(TMLayoutItem, { width: '20px', children: _jsx(StyledEditorIcon, { "$disabled": disabled, "$vil": validationItems, "$isModified": isModifiedWhen, children: icon }) }), _jsx(TMLayoutItem, { children: _jsxs(StyledEditorContainer, { "$width": width, children: [label && _jsx(StyledEditorLabel, { "$isFocused": isFocused, "$labelPosition": labelPosition, "$disabled": disabled, "$fontSize": fontSize, children: label }), renderInputField()] }) })] }));
|
|
@@ -12,6 +12,10 @@ interface ITMSidebar {
|
|
|
12
12
|
/** Lista di TMSidebarItem che compongono il menù */
|
|
13
13
|
items: JSX.Element[];
|
|
14
14
|
height?: string;
|
|
15
|
+
width?: string;
|
|
16
|
+
top?: string;
|
|
17
|
+
left?: string;
|
|
18
|
+
borderRightRadius?: string;
|
|
15
19
|
}
|
|
16
20
|
declare const TMSidebar: React.FC<ITMSidebar>;
|
|
17
21
|
export default TMSidebar;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { SDK_Globals } from '@topconsultnpm/sdk-ts-beta';
|
|
4
|
+
import { ApplicationThemeColor } from './TMSidebarItem';
|
|
4
5
|
const StyledTMSidebarContainer = styled.div `
|
|
5
|
-
top:
|
|
6
|
-
left: 0px;
|
|
7
|
-
width: 50px;
|
|
8
|
-
height: ${props => props.$height
|
|
9
|
-
background: ${props => props.$appName === 'ORCHESTRATOR' ?
|
|
6
|
+
top: ${props => props.$top ? props.$top : '53px'};
|
|
7
|
+
left: ${props => props.$left ? props.$left : '0px'};
|
|
8
|
+
width: ${props => props.$width ? props.$width : '50px'};
|
|
9
|
+
height: ${props => props.$height ? props.$height : 'calc(100% - 88px)'};
|
|
10
|
+
background: ${props => props.$appName === 'ORCHESTRATOR' ? `${ApplicationThemeColor.ORCHESTRATOR} 0% 0% no-repeat padding-box` : props.$appName === 'SURFER' ? `${ApplicationThemeColor.SURFER} 0% 0% no-repeat padding-box` : `${ApplicationThemeColor.DESIGNER} 0% 0% no-repeat padding-box`};
|
|
10
11
|
box-shadow: 0px 3px 6px #00000029;
|
|
11
|
-
border-radius:
|
|
12
|
+
border-radius: 0;
|
|
12
13
|
opacity: 1;
|
|
13
14
|
display: flex;
|
|
14
15
|
flex-direction: column;
|
|
@@ -16,9 +17,11 @@ const StyledTMSidebarContainer = styled.div `
|
|
|
16
17
|
align-items: center;
|
|
17
18
|
padding: 10px 0px 0px 0px;
|
|
18
19
|
position: absolute;
|
|
20
|
+
border-top-right-radius: 10px;
|
|
21
|
+
border-bottom-right-radius: 10px;
|
|
19
22
|
/* z-index: 20000001; */
|
|
20
23
|
`;
|
|
21
|
-
const TMSidebar = ({ items, height }) => {
|
|
22
|
-
return (
|
|
24
|
+
const TMSidebar = ({ items, height, borderRightRadius, left, top, width }) => {
|
|
25
|
+
return (_jsxs(StyledTMSidebarContainer, { "$borderRightRadius": borderRightRadius, "$left": left, "$top": top, "$width": width, "$appName": SDK_Globals.appModule, "$height": height, children: [items.filter(item => item.props.type !== 'app'), _jsx("div", { style: { position: 'absolute', bottom: '10px', display: 'flex', flexDirection: 'column' }, children: items.filter(item => item.props.type === 'app') })] }));
|
|
23
26
|
};
|
|
24
27
|
export default TMSidebar;
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AppRouteType } from './TMSidebar';
|
|
3
|
+
export declare enum ApplicationThemeColor {
|
|
4
|
+
SURFER = "#0e7418",
|
|
5
|
+
ORCHESTRATOR = "#135596",
|
|
6
|
+
DESIGNER = "#b51678"
|
|
7
|
+
}
|
|
3
8
|
export interface ITMSidebarItem {
|
|
4
9
|
name: string;
|
|
5
10
|
path: string;
|
|
6
11
|
type?: AppRouteType;
|
|
7
12
|
isSelected: boolean;
|
|
8
13
|
icon: any;
|
|
14
|
+
badgeNumber?: number;
|
|
9
15
|
onClick?: (e: ITMSidebarItem) => void;
|
|
16
|
+
isAppIcon?: boolean;
|
|
10
17
|
}
|
|
11
18
|
declare const TMSidebarItem: React.FunctionComponent<ITMSidebarItem>;
|
|
12
19
|
export default TMSidebarItem;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
-
import { TMColors } from '../../utils/theme';
|
|
4
3
|
import TMTooltip from '../base/TMTooltip';
|
|
4
|
+
import { AppModules, SDK_Globals } from '@topconsultnpm/sdk-ts-beta';
|
|
5
|
+
export var ApplicationThemeColor;
|
|
6
|
+
(function (ApplicationThemeColor) {
|
|
7
|
+
ApplicationThemeColor["SURFER"] = "#0e7418";
|
|
8
|
+
ApplicationThemeColor["ORCHESTRATOR"] = "#135596";
|
|
9
|
+
ApplicationThemeColor["DESIGNER"] = "#b51678";
|
|
10
|
+
})(ApplicationThemeColor || (ApplicationThemeColor = {}));
|
|
5
11
|
const StyledTMSidebarItemContainer = styled.div `
|
|
6
12
|
margin-bottom: 10px;
|
|
7
13
|
background-color: transparent;
|
|
@@ -9,7 +15,9 @@ const StyledTMSidebarItemContainer = styled.div `
|
|
|
9
15
|
transition: all 200ms ease;
|
|
10
16
|
user-select: none;
|
|
11
17
|
cursor: pointer;
|
|
12
|
-
color: ${(props) => props.$isSelected ?
|
|
18
|
+
color: ${(props) => props.$isSelected ? props.$app === AppModules.SURFER ? ApplicationThemeColor.SURFER : props.$app === AppModules.ORCHESTRATOR ? ApplicationThemeColor.ORCHESTRATOR : ApplicationThemeColor.DESIGNER : '#fff'};
|
|
19
|
+
background-color: ${props => props.$isSelected ? 'white' : 'transparent'} ;
|
|
20
|
+
border-radius: 3px;
|
|
13
21
|
width: 32px;
|
|
14
22
|
height: 32px;
|
|
15
23
|
|
|
@@ -18,10 +26,12 @@ const StyledTMSidebarItemContainer = styled.div `
|
|
|
18
26
|
}
|
|
19
27
|
|
|
20
28
|
&:hover {
|
|
21
|
-
color: ${
|
|
29
|
+
background-color: ${props => !props.$isApp && 'white'};
|
|
30
|
+
color: ${props => !props.$isApp && props.$app === AppModules.SURFER ? ApplicationThemeColor.SURFER : props.$app === AppModules.ORCHESTRATOR ? ApplicationThemeColor.ORCHESTRATOR : ApplicationThemeColor.DESIGNER};
|
|
22
31
|
}
|
|
23
32
|
`;
|
|
24
33
|
const TMSidebarItem = (props) => {
|
|
25
|
-
|
|
34
|
+
let app = SDK_Globals.appModule;
|
|
35
|
+
return (_jsx(TMTooltip, { hideAfterDelay: true, content: props.name, children: _jsxs(StyledTMSidebarItemContainer, { "$app": app, "$isApp": props.isAppIcon, onClick: () => props.onClick?.(props), style: { position: 'relative' }, "$isSelected": props.isSelected, children: [_jsxs("div", { children: [_jsx("i", { children: props.icon }), _jsx("p", { children: props.name })] }), props.badgeNumber > 0 && _jsx("div", { style: { width: '22px', height: '22px', backgroundColor: '#f09c0a', position: 'absolute', borderRadius: '22px', top: -6, right: -6, color: 'white', display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: '1rem', fontWeight: 'bold' }, children: props.badgeNumber })] }) }));
|
|
26
36
|
};
|
|
27
37
|
export default TMSidebarItem;
|