FIX: users :)

This commit is contained in:
Nicolás Hatcher
2025-06-02 18:32:43 +02:00
parent 7635cbe1d1
commit abaeb3284a
13 changed files with 122 additions and 16 deletions

View File

@@ -405,6 +405,7 @@ impl Model {
},
tables: HashMap::new(),
views,
users: Vec::new(),
};
let parsed_formulas = Vec::new();
let worksheets = &workbook.worksheets;

View File

@@ -39,6 +39,14 @@ pub struct WorkbookView {
pub window_height: i64,
}
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub struct WebUser {
pub id: String,
pub sheet: u32,
pub row: i32,
pub column: i32,
}
/// An internal representation of an IronCalc Workbook
#[derive(Encode, Decode, Debug, PartialEq, Clone)]
pub struct Workbook {
@@ -51,6 +59,7 @@ pub struct Workbook {
pub metadata: Metadata,
pub tables: HashMap<String, Table>,
pub views: HashMap<u32, WorkbookView>,
pub users: Vec<WebUser>
}
/// A defined name. The `sheet_id` is the sheet index in case the name is local

View File

@@ -14,7 +14,7 @@ use crate::{
model::Model,
types::{
Alignment, BorderItem, CellType, Col, HorizontalAlignment, SheetProperties, SheetState,
Style, VerticalAlignment,
Style, VerticalAlignment, WebUser,
},
utils::is_valid_hex_color,
};
@@ -293,6 +293,11 @@ impl UserModel {
self.model.workbook.name = name.to_string();
}
/// Set users
pub fn set_users(&mut self, users: &[WebUser]) {
self.model.workbook.users = users.to_vec();
}
/// Undoes last change if any, places the change in the redo list and evaluates the model if needed
///
/// See also: