UPDATE: Autofill by rows (#73)

This commit is contained in:
Nicolás Hatcher Andrés
2024-06-02 10:01:46 +02:00
committed by GitHub
parent c3a9b006d2
commit 72c7c94f3d
5 changed files with 521 additions and 2 deletions

View File

@@ -354,4 +354,13 @@ impl Model {
pub fn get_show_grid_lines(&mut self, sheet: u32) -> Result<bool, JsError> {
self.model.get_show_grid_lines(sheet).map_err(to_js_error)
}
#[wasm_bindgen(js_name = "autoFillRows")]
pub fn auto_fill_rows(&mut self, source_area: JsValue, to_row: i32) -> Result<(), JsError> {
let area: Area =
serde_wasm_bindgen::from_value(source_area).map_err(|e| to_js_error(e.to_string()))?;
self.model
.auto_fill_rows(&area, to_row)
.map_err(to_js_error)
}
}

View File

@@ -119,5 +119,14 @@ test("floating column numbers get truncated", () => {
assert.strictEqual(model.getRowHeight(0, 5), 100.5);
});
test("autofill", () => {
const model = new Model('en', 'UTC');
model.setUserInput(0, 1, 1, "23");
model.autoFillRows({sheet: 0, row: 1, column: 1, width: 1, height: 1}, 2);
const result = model.getFormattedCellValue(0, 2, 1);
assert.strictEqual(result, "23");
});