more style changes, changelog and locale
This commit is contained in:
committed by
Nicolás Hatcher Andrés
parent
4660f0e456
commit
ec5714e3ec
@@ -7,6 +7,7 @@
|
|||||||
- New function UNICODE ([#128](https://github.com/ironcalc/IronCalc/pull/128))
|
- New function UNICODE ([#128](https://github.com/ironcalc/IronCalc/pull/128))
|
||||||
- New document server (Thanks Dani!)
|
- New document server (Thanks Dani!)
|
||||||
- New function FORMULATEXT
|
- New function FORMULATEXT
|
||||||
|
- Name Manager ([#212](https://github.com/ironcalc/IronCalc/pull/212) [#220](https://github.com/ironcalc/IronCalc/pull/220))
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
|||||||
@@ -34,14 +34,12 @@ function NameManagerDialog(properties: NameManagerDialogProperties) {
|
|||||||
const worksheets = model.getWorksheetsProperties();
|
const worksheets = model.getWorksheetsProperties();
|
||||||
const definedNameList = model.getDefinedNameList();
|
const definedNameList = model.getDefinedNameList();
|
||||||
|
|
||||||
// reset modal state in case editing was in progress
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (open) {
|
if (open) {
|
||||||
setEditingNameIndex(-2);
|
setEditingNameIndex(-2);
|
||||||
}
|
}
|
||||||
}, [open]);
|
}, [open]);
|
||||||
|
|
||||||
// enable/disable options while editing
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (editingNameIndex !== -2) {
|
if (editingNameIndex !== -2) {
|
||||||
setShowOptions(false);
|
setShowOptions(false);
|
||||||
@@ -94,7 +92,7 @@ function NameManagerDialog(properties: NameManagerDialogProperties) {
|
|||||||
name={definedName.name}
|
name={definedName.name}
|
||||||
scope={definedName.scope}
|
scope={definedName.scope}
|
||||||
formula={definedName.formula}
|
formula={definedName.formula}
|
||||||
key={definedName.name}
|
key={definedName.name + definedName.scope}
|
||||||
onSave={handleSave}
|
onSave={handleSave}
|
||||||
onCancel={() => setEditingNameIndex(-2)}
|
onCancel={() => setEditingNameIndex(-2)}
|
||||||
/>
|
/>
|
||||||
@@ -107,7 +105,7 @@ function NameManagerDialog(properties: NameManagerDialogProperties) {
|
|||||||
name={definedName.name}
|
name={definedName.name}
|
||||||
scope={definedName.scope}
|
scope={definedName.scope}
|
||||||
formula={definedName.formula}
|
formula={definedName.formula}
|
||||||
key={definedName.name}
|
key={definedName.name + definedName.scope}
|
||||||
showOptions={showOptions}
|
showOptions={showOptions}
|
||||||
onEdit={() => setEditingNameIndex(index)}
|
onEdit={() => setEditingNameIndex(index)}
|
||||||
onDelete={handleDelete}
|
onDelete={handleDelete}
|
||||||
@@ -151,12 +149,14 @@ function NameManagerDialog(properties: NameManagerDialogProperties) {
|
|||||||
const StyledDialog = styled(Dialog)(() => ({
|
const StyledDialog = styled(Dialog)(() => ({
|
||||||
"& .MuiPaper-root": {
|
"& .MuiPaper-root": {
|
||||||
height: "380px",
|
height: "380px",
|
||||||
|
minHeight: "200px",
|
||||||
minWidth: "620px",
|
minWidth: "620px",
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const StyledDialogTitle = styled(DialogTitle)`
|
const StyledDialogTitle = styled(DialogTitle)`
|
||||||
padding: 12px 20px;
|
padding: 12px 20px;
|
||||||
|
height: 20px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -170,7 +170,7 @@ const NameListWrapper = styled(Stack)`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
const StyledBox = styled(Box)`
|
const StyledBox = styled(Box)`
|
||||||
width: 171px;
|
width: 161.67px;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const StyledDialogContent = styled(DialogContent)`
|
const StyledDialogContent = styled(DialogContent)`
|
||||||
@@ -182,6 +182,7 @@ padding: 20px 12px 20px 20px;
|
|||||||
|
|
||||||
const StyledRangesHeader = styled(Stack)(({ theme }) => ({
|
const StyledRangesHeader = styled(Stack)(({ theme }) => ({
|
||||||
flexDirection: "row",
|
flexDirection: "row",
|
||||||
|
padding: "0 8px",
|
||||||
gap: "12px",
|
gap: "12px",
|
||||||
fontFamily: theme.typography.fontFamily,
|
fontFamily: theme.typography.fontFamily,
|
||||||
fontSize: "12px",
|
fontSize: "12px",
|
||||||
|
|||||||
@@ -33,10 +33,11 @@ function NamedRangeActive(properties: NamedRangeProperties) {
|
|||||||
const [nameError, setNameError] = useState(false);
|
const [nameError, setNameError] = useState(false);
|
||||||
const [formulaError, setFormulaError] = useState(false);
|
const [formulaError, setFormulaError] = useState(false);
|
||||||
|
|
||||||
|
//todo: move logic to NameManagerDialog
|
||||||
const handleSaveUpdate = () => {
|
const handleSaveUpdate = () => {
|
||||||
const definedNamesModel = model.getDefinedNameList();
|
const definedNamesModel = model.getDefinedNameList();
|
||||||
|
|
||||||
if (definedNamesModel.find((n) => n.name === name)) {
|
if (definedNamesModel.find((n) => n.name === name && n.scope === scope)) {
|
||||||
try {
|
try {
|
||||||
model.updateDefinedName(name, scope, newName, newScope, newFormula);
|
model.updateDefinedName(name, scope, newName, newScope, newFormula);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -84,7 +85,7 @@ function NamedRangeActive(properties: NamedRangeProperties) {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<MenuItem value={"global"}>
|
<MenuItem value={"global"}>
|
||||||
{t("name_manager_dialog.workbook")}
|
{`${t("name_manager_dialog.workbook")} ${t("name_manager_dialog.global")}`}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
{worksheets.map((option, index) => (
|
{worksheets.map((option, index) => (
|
||||||
<MenuItem key={option.name} value={index}>
|
<MenuItem key={option.name} value={index}>
|
||||||
@@ -106,14 +107,14 @@ function NamedRangeActive(properties: NamedRangeProperties) {
|
|||||||
}}
|
}}
|
||||||
onClick={(event) => event.stopPropagation()}
|
onClick={(event) => event.stopPropagation()}
|
||||||
/>
|
/>
|
||||||
<>
|
<IconsWrapper>
|
||||||
<IconButton onClick={handleSaveUpdate}>
|
<IconButton onClick={handleSaveUpdate}>
|
||||||
<StyledCheck size={12} />
|
<StyledCheck size={12} />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<StyledIconButton onClick={onCancel}>
|
<StyledIconButton onClick={onCancel}>
|
||||||
<X size={12} />
|
<X size={12} />
|
||||||
</StyledIconButton>
|
</StyledIconButton>
|
||||||
</>
|
</IconsWrapper>
|
||||||
</StyledBox>
|
</StyledBox>
|
||||||
<Divider />
|
<Divider />
|
||||||
</>
|
</>
|
||||||
@@ -129,6 +130,7 @@ width: 577px;
|
|||||||
const StyledTextField = styled(TextField)(() => ({
|
const StyledTextField = styled(TextField)(() => ({
|
||||||
"& .MuiInputBase-root": {
|
"& .MuiInputBase-root": {
|
||||||
height: "28px",
|
height: "28px",
|
||||||
|
width: "161.67px",
|
||||||
margin: 0,
|
margin: 0,
|
||||||
fontFamily: "Inter",
|
fontFamily: "Inter",
|
||||||
fontSize: "12px",
|
fontSize: "12px",
|
||||||
@@ -150,4 +152,8 @@ const StyledCheck = styled(Check)(({ theme }) => ({
|
|||||||
color: theme.palette.success.main,
|
color: theme.palette.success.main,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
const IconsWrapper = styled(Box)({
|
||||||
|
display: "flex",
|
||||||
|
});
|
||||||
|
|
||||||
export default NamedRangeActive;
|
export default NamedRangeActive;
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ function NamedRangeInactive(properties: NamedRangeInactiveProperties) {
|
|||||||
showOptions,
|
showOptions,
|
||||||
} = properties;
|
} = properties;
|
||||||
|
|
||||||
|
//todo: move logic to NameManagerDialog
|
||||||
const handleDelete = () => {
|
const handleDelete = () => {
|
||||||
try {
|
try {
|
||||||
model.deleteDefinedName(name, scope);
|
model.deleteDefinedName(name, scope);
|
||||||
@@ -35,9 +36,10 @@ function NamedRangeInactive(properties: NamedRangeInactiveProperties) {
|
|||||||
onDelete();
|
onDelete();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//todo: pass the name, avoid logic
|
||||||
const scopeName =
|
const scopeName =
|
||||||
worksheets.find((sheet, index) => index === scope)?.name ||
|
worksheets.find((sheet, index) => index === scope)?.name ||
|
||||||
t("name_manager_dialog.workbook");
|
`${t("name_manager_dialog.workbook")} ${t("name_manager_dialog.global")}`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -45,14 +47,14 @@ function NamedRangeInactive(properties: NamedRangeInactiveProperties) {
|
|||||||
<StyledDiv>{name}</StyledDiv>
|
<StyledDiv>{name}</StyledDiv>
|
||||||
<StyledDiv>{scopeName}</StyledDiv>
|
<StyledDiv>{scopeName}</StyledDiv>
|
||||||
<StyledDiv>{formula}</StyledDiv>
|
<StyledDiv>{formula}</StyledDiv>
|
||||||
<WrappedIcons>
|
<IconsWrapper>
|
||||||
<StyledIconButtonBlack onClick={onEdit} disabled={!showOptions}>
|
<StyledIconButtonBlack onClick={onEdit} disabled={!showOptions}>
|
||||||
<PencilLine size={12} />
|
<PencilLine size={12} />
|
||||||
</StyledIconButtonBlack>
|
</StyledIconButtonBlack>
|
||||||
<StyledIconButtonRed onClick={handleDelete} disabled={!showOptions}>
|
<StyledIconButtonRed onClick={handleDelete} disabled={!showOptions}>
|
||||||
<Trash2 size={12} />
|
<Trash2 size={12} />
|
||||||
</StyledIconButtonRed>
|
</StyledIconButtonRed>
|
||||||
</WrappedIcons>
|
</IconsWrapper>
|
||||||
</WrappedLine>
|
</WrappedLine>
|
||||||
<Divider />
|
<Divider />
|
||||||
</>
|
</>
|
||||||
@@ -75,6 +77,7 @@ const WrappedLine = styled(Box)({
|
|||||||
display: "flex",
|
display: "flex",
|
||||||
height: "28px",
|
height: "28px",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
|
gap: "12px",
|
||||||
});
|
});
|
||||||
|
|
||||||
const StyledDiv = styled("div")(({ theme }) => ({
|
const StyledDiv = styled("div")(({ theme }) => ({
|
||||||
@@ -82,12 +85,12 @@ const StyledDiv = styled("div")(({ theme }) => ({
|
|||||||
fontSize: "12px",
|
fontSize: "12px",
|
||||||
fontWeight: "400",
|
fontWeight: "400",
|
||||||
color: theme.palette.common.black,
|
color: theme.palette.common.black,
|
||||||
width: "171px",
|
width: "153.67px",
|
||||||
|
paddingLeft: "8px",
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const WrappedIcons = styled(Box)({
|
const IconsWrapper = styled(Box)({
|
||||||
display: "flex",
|
display: "flex",
|
||||||
gap: "0px",
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default NamedRangeInactive;
|
export default NamedRangeInactive;
|
||||||
|
|||||||
@@ -84,6 +84,7 @@
|
|||||||
"scope": "Range",
|
"scope": "Range",
|
||||||
"help": "Learn more about Named Ranges",
|
"help": "Learn more about Named Ranges",
|
||||||
"new": "Add new",
|
"new": "Add new",
|
||||||
"workbook": "Workbook (Global)"
|
"workbook": "Workbook",
|
||||||
|
"global": "(Global)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user