@topconsultnpm/sdkui-react-beta 6.16.15 → 6.16.16
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/assets/icomoon.svg +96 -96
- package/lib/assets/italy.svg +16 -16
- package/lib/assets/topmedia-six.svg +65 -65
- package/lib/assets/topmeida-six-bianco.svg +65 -65
- package/lib/components/editors/TMDropDown.js +42 -18
- package/lib/components/forms/TMChooserForm.js +2 -2
- package/package.json +1 -1
|
@@ -5,34 +5,58 @@ import { FontSize, TMColors } from '../../utils/theme';
|
|
|
5
5
|
import { StyledEditorContainer, StyledEditorIcon, StyledEditorLabel, TMEditorsDefaultBorderRadius, editorColorManager } from "./TMEditorStyled";
|
|
6
6
|
import TMLayoutContainer, { TMLayoutItem } from "../base/TMLayout";
|
|
7
7
|
import TMVilViewer from "../base/TMVilViewer";
|
|
8
|
+
import TMTooltip from "../base/TMTooltip";
|
|
9
|
+
const StyledDropDownWrapper = styled.div `
|
|
10
|
+
position: relative;
|
|
11
|
+
width: ${props => props.$width};
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
`;
|
|
8
15
|
const StyledDropDown = styled.select `
|
|
9
|
-
width:
|
|
10
|
-
padding: 5px
|
|
16
|
+
width: 100%;
|
|
17
|
+
padding: 5px 35px 3px 9px; /* padding-right leaves space for buttons + custom arrow */
|
|
11
18
|
border: 1px solid;
|
|
12
19
|
border-color: ${props => props.$isModified ? TMColors.isModified : TMColors.border_normal};
|
|
13
|
-
border-bottom: ${props => (props.$vil.length > 0) ? '3px' : '1px'} solid
|
|
20
|
+
border-bottom: ${props => (props.$vil.length > 0) ? '3px' : '1px'} solid;
|
|
14
21
|
border-bottom-color: ${props => (props.$vil.length === 0) ? !props.$isModified ? TMColors.border_normal : TMColors.isModified : editorColorManager(props.$vil)};
|
|
15
|
-
color: ${props => !props
|
|
22
|
+
color: ${props => !props.$disabled ? (props.$vil.length === 0 ? (!props.$isModified ? TMColors.text_normal : TMColors.isModified) : editorColorManager(props.$vil)) : TMColors.disabled};
|
|
16
23
|
border-radius: ${props => props.$borderRadius ?? TMEditorsDefaultBorderRadius};
|
|
17
|
-
|
|
18
|
-
|
|
24
|
+
font-size: ${props => props.$fontSize};
|
|
25
|
+
appearance: none; /* remove native arrow */
|
|
26
|
+
background-color: white;
|
|
27
|
+
|
|
28
|
+
&:focus {
|
|
19
29
|
outline: none;
|
|
20
30
|
background-image: linear-gradient(white, #E4E9F7);
|
|
21
31
|
border: ${props => props.$isModified ? `1px solid ${TMColors.isModified}` : '1px solid rgb(180,180,180)'};
|
|
22
|
-
border-bottom: 2px solid
|
|
32
|
+
border-bottom: 2px solid;
|
|
23
33
|
border-bottom-color: ${props => (props.$vil.length === 0) ? !props.$isModified ? TMColors.primary : TMColors.isModified : editorColorManager(props.$vil)};
|
|
24
34
|
}
|
|
25
|
-
font-size: ${props => props.$fontSize};
|
|
26
|
-
&::placeholder {
|
|
27
|
-
/* color: ${props => (props.$vil.length === 0) ? 'gray' : editorColorManager(props.$vil)}; */
|
|
28
|
-
font-size: ${props => props.$fontSize};
|
|
29
|
-
}
|
|
30
35
|
`;
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
const ButtonsContainer = styled.div `
|
|
37
|
+
position: absolute;
|
|
38
|
+
right: 20px; /* adjust depending on arrow size */
|
|
39
|
+
display: flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
gap: 5px; /* spacing between buttons */
|
|
42
|
+
`;
|
|
43
|
+
const CustomArrow = styled.div `
|
|
44
|
+
position: absolute;
|
|
45
|
+
right: 5px;
|
|
46
|
+
pointer-events: none;
|
|
47
|
+
border-left: 5px solid transparent;
|
|
48
|
+
border-right: 5px solid transparent;
|
|
49
|
+
border-top: 5px solid ${TMColors.text_normal};
|
|
50
|
+
`;
|
|
51
|
+
const StyledDropDownEditorButton = styled.div `
|
|
52
|
+
color: ${TMColors.button_icon};
|
|
53
|
+
display: flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
cursor: pointer;
|
|
56
|
+
`;
|
|
57
|
+
const TMDropDown = ({ validationItems = [], disabled = false, elementStyle, isModifiedWhen, labelPosition = 'left', label, icon, width = '100%', fontSize = FontSize.defaultFontSize, dataSource, value, onValueChanged, buttons = [], }) => {
|
|
58
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
59
|
+
const renderedLeftLabelTextBox = () => (_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, children: label }), _jsxs(StyledDropDownWrapper, { "$width": width, children: [_jsx(StyledDropDown, { value: value, onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), "$disabled": disabled, disabled: disabled, "$fontSize": fontSize, "$isModified": isModifiedWhen, "$vil": validationItems, onChange: onValueChanged, children: dataSource?.map((data, index) => (_jsx("option", { value: data.value, children: data.display }, index))) }), buttons.length > 0 && (_jsx(ButtonsContainer, { children: buttons.map((buttonItem) => (_jsx(StyledDropDownEditorButton, { onClick: buttonItem.onClick, children: _jsx(TMTooltip, { content: buttonItem.text, children: buttonItem.icon }) }, buttonItem.text))) })), _jsx(CustomArrow, {})] }), _jsx(TMVilViewer, { vil: validationItems })] }) })] }));
|
|
60
|
+
return _jsx("div", { style: elementStyle, children: renderedLeftLabelTextBox() });
|
|
37
61
|
};
|
|
38
62
|
export default TMDropDown;
|
|
@@ -86,8 +86,8 @@ const TMChooserForm = ({ children, title, allowMultipleSelection = false, allowA
|
|
|
86
86
|
...summaryItems ?? {}
|
|
87
87
|
});
|
|
88
88
|
}, [manageUseLocalizedName, summaryItems]);
|
|
89
|
-
return (_jsx(TMModal, { title: renderTitle(), width: width ?? '550px', height: height ?? '600px', toolbar: _jsx(ToolbarButtons, {}), onClose: onClose, children: children ??
|
|
90
|
-
filteredItems.length > 0
|
|
89
|
+
return (_jsx(TMModal, { title: renderTitle(), width: width ?? '550px', height: height ?? '600px', toolbar: _jsx(ToolbarButtons, {}), onClose: onClose, children: (children ??
|
|
90
|
+
filteredItems.length > 0)
|
|
91
91
|
? _jsx(TMDataGrid, { dataSource: filteredItems, keyExpr: keyName, dataColumns: dataColumns, focusedRowKey: focusedRowKey, selectedRowKeys: selectedRowKeys, searchPanelFocusStarting: true, headerFilter: { visible: true }, selection: { mode: allowMultipleSelection ? 'multiple' : 'single', showCheckBoxesMode: 'always', selectAllMode: 'allPages' }, grouping: allowGrouping ? { autoExpandAll: false, expandMode: 'rowClick' } : undefined, summary: customSummary, onFocusedRowChanged: handleFocusedRowChange, onSelectionChanged: handleSelectionChanged, onRowDblClick: handleRowDoubleClick })
|
|
92
92
|
: _jsx(TMLayoutContainer, { gap: 30, alignItems: 'center', justifyContent: 'center', children: _jsx(TMLayoutItem, { children: _jsx("p", { style: { height: "100%", color: TMColors.primaryColor, fontSize: "1.5rem", display: 'flex', alignItems: 'center', justifyContent: 'center' }, children: SDKUI_Localizator.NoDataToDisplay }) }) }) }));
|
|
93
93
|
};
|