From a8b7cf1dac8644ad6e7855ccb107a87a9ba652dc Mon Sep 17 00:00:00 2001 From: Garrett Date: Mon, 30 Oct 2023 12:56:36 -0700 Subject: [PATCH 1/2] Allow editing sessions on new rows --- src/renderer/src/stories/Table.js | 8 ++++---- src/renderer/src/stories/hot.js | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/renderer/src/stories/Table.js b/src/renderer/src/stories/Table.js index eaa0f4948..b5df7aa31 100644 --- a/src/renderer/src/stories/Table.js +++ b/src/renderer/src/stories/Table.js @@ -109,9 +109,9 @@ export class Table extends LitElement { } else value = (hasRow ? this.data[row][col] : undefined) ?? - this.template[col] ?? - // this.schema.properties[col].default ?? - ""; + this.template[col] + + return value; }); } @@ -417,7 +417,7 @@ export class Table extends LitElement { table.addHook("afterCreateRow", (index, amount) => { nRows += amount; - const physicalRows = Array.from({ length: amount }, (e, i) => index + i); + const physicalRows = Array.from({ length: amount }, (e, i) => index + i) physicalRows.forEach((row) => this.#setRow(row, this.#getRowData(row))); }); diff --git a/src/renderer/src/stories/hot.js b/src/renderer/src/stories/hot.js index 795dc949c..93b233d63 100644 --- a/src/renderer/src/stories/hot.js +++ b/src/renderer/src/stories/hot.js @@ -100,12 +100,13 @@ class ArrayEditor extends Handsontable.editors.TextEditor { .split(",") .map((str) => str.trim()) .filter((str) => str); + return this.cellProperties.uniqueItems ? Array.from(new Set(split)) : split; // Only unique values } } setValue(newValue) { - if (Array.isArray(newValue)) return newValue.join(","); + if (Array.isArray(newValue)) newValue = newValue.join(","); super.setValue(newValue); } } From d019b2424ac3e025b6bf30edf6ae976e7675dad3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 30 Oct 2023 20:01:25 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/renderer/src/stories/Table.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/renderer/src/stories/Table.js b/src/renderer/src/stories/Table.js index b5df7aa31..3350a8eeb 100644 --- a/src/renderer/src/stories/Table.js +++ b/src/renderer/src/stories/Table.js @@ -106,11 +106,7 @@ export class Table extends LitElement { if (col === this.keyColumn) { if (hasRow) value = row; else return ""; - } else - value = - (hasRow ? this.data[row][col] : undefined) ?? - this.template[col] - + } else value = (hasRow ? this.data[row][col] : undefined) ?? this.template[col]; return value; }); @@ -417,7 +413,7 @@ export class Table extends LitElement { table.addHook("afterCreateRow", (index, amount) => { nRows += amount; - const physicalRows = Array.from({ length: amount }, (e, i) => index + i) + const physicalRows = Array.from({ length: amount }, (e, i) => index + i); physicalRows.forEach((row) => this.#setRow(row, this.#getRowData(row))); });