FIX: It it possible to have DF scoped to the first sheet
This commit is contained in:
committed by
Nicolás Hatcher Andrés
parent
a10d1f4615
commit
5aa7617e97
@@ -396,3 +396,30 @@ fn undo_redo() {
|
|||||||
Ok("Hola!".to_string())
|
Ok("Hola!".to_string())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn change_scope_to_first_sheet() {
|
||||||
|
let mut model = UserModel::new_empty("model", "en", "UTC").unwrap();
|
||||||
|
model.new_sheet().unwrap();
|
||||||
|
model.set_user_input(0, 1, 1, "Hello").unwrap();
|
||||||
|
model
|
||||||
|
.set_user_input(1, 2, 1, r#"=CONCATENATE(MyName, " world!")"#)
|
||||||
|
.unwrap();
|
||||||
|
model
|
||||||
|
.new_defined_name("myName", None, "Sheet1!$A$1")
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
model.get_formatted_cell_value(1, 2, 1),
|
||||||
|
Ok("Hello world!".to_string())
|
||||||
|
);
|
||||||
|
|
||||||
|
model
|
||||||
|
.update_defined_name("myName", None, "myName", Some(0), "Sheet1!$A$1")
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
model.get_formatted_cell_value(1, 2, 1),
|
||||||
|
Ok("#NAME?".to_string())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@@ -98,9 +98,10 @@ function NameManagerDialog(properties: NameManagerDialogProperties) {
|
|||||||
) : (
|
) : (
|
||||||
<NameListWrapper>
|
<NameListWrapper>
|
||||||
{definedNameList.map((definedName, index) => {
|
{definedNameList.map((definedName, index) => {
|
||||||
const scopeName = definedName.scope
|
const scopeName =
|
||||||
? worksheets[definedName.scope].name
|
definedName.scope !== undefined
|
||||||
: "[global]";
|
? worksheets[definedName.scope].name
|
||||||
|
: "[global]";
|
||||||
if (index === editingNameIndex) {
|
if (index === editingNameIndex) {
|
||||||
return (
|
return (
|
||||||
<NamedRangeActive
|
<NamedRangeActive
|
||||||
@@ -117,7 +118,7 @@ function NameManagerDialog(properties: NameManagerDialogProperties) {
|
|||||||
const scope_index = worksheets.findIndex(
|
const scope_index = worksheets.findIndex(
|
||||||
(s) => s.name === newScope,
|
(s) => s.name === newScope,
|
||||||
);
|
);
|
||||||
const scope = scope_index > 0 ? scope_index : undefined;
|
const scope = scope_index >= 0 ? scope_index : undefined;
|
||||||
try {
|
try {
|
||||||
updateDefinedName(
|
updateDefinedName(
|
||||||
definedName.name,
|
definedName.name,
|
||||||
|
|||||||
Reference in New Issue
Block a user