Skip to content

Commit

Permalink
Merge pull request #143 from lightsheet-team/rename-lightsheet
Browse files Browse the repository at this point in the history
Change all occurrences of "LightSheet" to "Lightsheet"
  • Loading branch information
Fluglow authored May 3, 2024
2 parents ca71cda + 33f8dc6 commit ac4916f
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 46 deletions.
6 changes: 3 additions & 3 deletions src/core/evaluation/expressionHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
} from "./expressionHandler.types.ts";

import { CellState } from "../structure/cell/cellState.ts";
import LightSheetHelper from "../../utils/helpers.ts";
import LightsheetHelper from "../../utils/helpers.ts";
import { Coordinate } from "../../utils/common.types.ts";
import { CellReference } from "../structure/cell/types.cell.ts";
import SheetHolder from "../structure/sheetHolder.ts";
Expand Down Expand Up @@ -93,9 +93,9 @@ export default class ExpressionHandler {
const parseResult = math.parse(expression);

const fromSymbol =
LightSheetHelper.generateColumnLabel(from.column + 1) + (from.row + 1);
LightsheetHelper.generateColumnLabel(from.column + 1) + (from.row + 1);
const toSymbol =
LightSheetHelper.generateColumnLabel(to.column + 1) + (to.row + 1);
LightsheetHelper.generateColumnLabel(to.column + 1) + (to.row + 1);

// Update each symbol in the expression.
const transform = parseResult.transform((node) =>
Expand Down
8 changes: 4 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import UI from "./ui/render.ts";
import { LightSheetOptions } from "./main.types.ts";
import { LightsheetOptions } from "./main.types.ts";
import Sheet from "./core/structure/sheet.ts";
import { CellInfo } from "./core/structure/sheet.types.ts";
import Events from "./core/event/events.ts";
Expand All @@ -14,17 +14,17 @@ import { RowKey, ColumnKey } from "./core/structure/key/keyTypes.ts";
import CellStyle from "./core/structure/cellStyle.ts";
import { Coordinate } from "./utils/common.types.ts";

export default class LightSheet {
export default class Lightsheet {
private ui: UI | undefined;
options: LightSheetOptions;
options: LightsheetOptions;
private sheet: Sheet;
sheetHolder: SheetHolder;
private events: Events;
onCellChange?;
isReady: boolean = false;

constructor(
options: LightSheetOptions,
options: LightsheetOptions,
targetElement: Element | null = null,
) {
this.options = {
Expand Down
2 changes: 1 addition & 1 deletion src/main.types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// TODO We should reconsider the role/scope of this type
export type LightSheetOptions = {
export type LightsheetOptions = {
sheetName: string;
data?: any[];
onCellChange?: (colIndex: number, rowIndex: number, value: any) => void;
Expand Down
8 changes: 4 additions & 4 deletions src/ui/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
UISetCellPayload,
} from "../core/event/events.types.ts";
import EventType from "../core/event/eventType.ts";
import { LightSheetOptions, ToolbarOptions } from "../main.types";
import LightSheetHelper from "../utils/helpers.ts";
import { LightsheetOptions, ToolbarOptions } from "../main.types";
import LightsheetHelper from "../utils/helpers.ts";
import { ToolbarItems } from "../utils/constants.ts";
import { Coordinate } from "../utils/common.types.ts";
import Events from "../core/event/events.ts";
Expand All @@ -31,7 +31,7 @@ export default class UI {

constructor(
lightSheetContainerDom: Element,
lightSheetOptions: LightSheetOptions,
lightSheetOptions: LightsheetOptions,
events: Events | null = null,
) {
this.selectedCell = [];
Expand Down Expand Up @@ -207,7 +207,7 @@ export default class UI {

const newColumnNumber = this.getColumnCount() + 1;
const newHeaderValue =
LightSheetHelper.generateColumnLabel(newColumnNumber);
LightsheetHelper.generateColumnLabel(newColumnNumber);

headerCellDom.textContent = newHeaderValue;
headerCellDom.onclick = (e: MouseEvent) =>
Expand Down
2 changes: 1 addition & 1 deletion src/utils/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default class LightSheetHelper {
export default class LightsheetHelper {
static generateColumnLabel = (rowIndex: number) => {
let label = "";
const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
Expand Down
6 changes: 3 additions & 3 deletions tests/core/structure/customFunction.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Sheet from "../../../src/core/structure/sheet.ts";
import LightSheet from "../../../src/main.ts";
import Lightsheet from "../../../src/main.ts";
import SheetHolder from "../../../src/core/structure/sheetHolder.ts";
import { CellReference } from "../../../src/core/structure/cell/types.cell.ts";

Expand All @@ -16,11 +16,11 @@ describe("Custom formula function test", () => {
sheet.setCellAt(0, 2, "5"); // A3
sheet.setCellAt(1, 2, "6"); // B3

LightSheet.registerFunction("concat", (_, values: string[]) =>
Lightsheet.registerFunction("concat", (_, values: string[]) =>
values.join(""),
);

LightSheet.registerFunction(
Lightsheet.registerFunction(
"spread",
(cellPos: CellReference, value: string) => {
const sheet = SheetHolder.getInstance().getSheet(cellPos.sheetKey)!;
Expand Down
4 changes: 2 additions & 2 deletions tests/core/structure/sheetHolder.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import LightSheet from "../../../src/main.ts";
import Lightsheet from "../../../src/main.ts";

describe("Multiple sheets test", () => {
beforeEach(() => {
window.sheetHolder?.clear();
for (let i = 0; i < 2; i++) {
new LightSheet({ data: [], sheetName: `Sheet${i + 1}` });
new Lightsheet({ data: [], sheetName: `Sheet${i + 1}` });
}
});

Expand Down
8 changes: 4 additions & 4 deletions tests/ui/editability.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import LightSheet from "../../src/main";
import Lightsheet from "../../src/main";

describe("LightSheet", () => {
describe("Lightsheet", () => {
let targetElementMock: HTMLElement;

beforeEach(() => {
Expand All @@ -14,7 +14,7 @@ describe("LightSheet", () => {
});

test("All input elements within the table have readonly property set to true when isReadOnly is true", () => {
new LightSheet(
new Lightsheet(
{
data: [],
sheetName: "Sheet",
Expand All @@ -37,7 +37,7 @@ describe("LightSheet", () => {
});

test("All input elements within the table have readonly property set to true when isReadOnly is false", () => {
new LightSheet(
new Lightsheet(
{
data: [],
sheetName: "Sheet",
Expand Down
14 changes: 7 additions & 7 deletions tests/ui/formulaBar.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Import other necessary dependencies and utilities for testing
import LightSheet from "../../src/main";
import Lightsheet from "../../src/main";

describe("Formula", () => {
let targetElementMock: HTMLElement;
Expand All @@ -15,7 +15,7 @@ describe("Formula", () => {
});

test("Exist formula bar in dom", () => {
new LightSheet(
new Lightsheet(
{
sheetName: "Sheet 1",
data: [],
Expand All @@ -31,7 +31,7 @@ describe("Formula", () => {
});

test("Change cell content from formula bar", () => {
new LightSheet(
new Lightsheet(
{
sheetName: "Sheet 2",
data: [],
Expand Down Expand Up @@ -80,7 +80,7 @@ describe("Formula", () => {
});

test("Change formula bar content from cell", async () => {
new LightSheet(
new Lightsheet(
{
sheetName: "Sheet 3",
data: [],
Expand Down Expand Up @@ -117,7 +117,7 @@ describe("Formula", () => {
});

test("Hide formula bar when read only mode is on", () => {
new LightSheet(
new Lightsheet(
{
sheetName: "Sheet 4",
data: [],
Expand All @@ -133,7 +133,7 @@ describe("Formula", () => {
});

test("Show formula bar when read only mode is off", () => {
new LightSheet(
new Lightsheet(
{
sheetName: "Sheet 5",
data: [],
Expand All @@ -149,7 +149,7 @@ describe("Formula", () => {
});

test("Display the raw value of the cell", () => {
new LightSheet(
new Lightsheet(
{
sheetName: "Sheet 6",
data: [
Expand Down
10 changes: 5 additions & 5 deletions tests/ui/initialtable.test.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import LightSheet from "../../src/main";
import Lightsheet from "../../src/main";

describe("LightSheet", () => {
let lightSheet: LightSheet;
describe("Lightsheet", () => {
let lightSheet: Lightsheet;
let targetElementMock: HTMLElement;
const onReady = jest.fn();

beforeEach(() => {
// Mocking UI and target element
targetElementMock = document.createElement("div");

// Creating instance of LightSheet with mocked dependencies
// Creating instance of Lightsheet with mocked dependencies
window.sheetHolder?.clear();
lightSheet = new LightSheet(
lightSheet = new Lightsheet(
{
sheetName: "Sheet",
onReady: onReady,
Expand Down
10 changes: 5 additions & 5 deletions tests/ui/setCellAt.test.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import LightSheet from "../../src/main";
import Lightsheet from "../../src/main";

describe("LightSheet setCellAt", () => {
let lightSheet: LightSheet;
describe("Lightsheet setCellAt", () => {
let lightSheet: Lightsheet;
let targetElementMock: HTMLElement;

beforeEach(() => {
// Mocking UI and target element
targetElementMock = document.createElement("div");

// Creating instance of LightSheet with mocked dependencies
// Creating instance of Lightsheet with mocked dependencies
window.sheetHolder?.clear();
lightSheet = new LightSheet(
lightSheet = new Lightsheet(
{
sheetName: "Sheet",
},
Expand Down
14 changes: 7 additions & 7 deletions tests/ui/toolBar.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import LightSheet from "../../src/main";
import Lightsheet from "../../src/main";
import { ToolbarItems } from "../../src/utils/constants.ts";

describe("Tool bar", () => {
Expand All @@ -11,7 +11,7 @@ describe("Tool bar", () => {
document.body.appendChild(targetElementMock);

// Get the toolbar element
new LightSheet(
new Lightsheet(
{
sheetName: "Sheet",
toolbarOptions: { showToolbar: true },
Expand All @@ -31,7 +31,7 @@ describe("Tool bar", () => {
test("should create items in toolbar from the constant file in the table container if no items provided", () => {
const targetElementMock: HTMLElement = document.createElement("div");

new LightSheet(
new Lightsheet(
{
sheetName: "Sheet",
toolbarOptions: { showToolbar: true },
Expand All @@ -51,7 +51,7 @@ describe("Tool bar", () => {
const toolbarItems = ["undo", "redo", "save"];
const targetElementMock: HTMLElement = document.createElement("div");

new LightSheet(
new Lightsheet(
{
sheetName: "Sheet",
toolbarOptions: {
Expand All @@ -72,7 +72,7 @@ describe("Tool bar", () => {
test("should show toolbar when showToolbar option is true", () => {
const targetElementMock: HTMLElement = document.createElement("div");

new LightSheet(
new Lightsheet(
{
sheetName: "Sheet",
toolbarOptions: {
Expand All @@ -93,7 +93,7 @@ describe("Tool bar", () => {
test("should hide toolbar when showToolbar option is false", () => {
const targetElementMock: HTMLElement = document.createElement("div");

new LightSheet(
new Lightsheet(
{
sheetName: "Sheet",
toolbarOptions: {
Expand All @@ -113,7 +113,7 @@ describe("Tool bar", () => {
test("should hide toolbar when there is no show toolbar option", () => {
const targetElementMock: HTMLElement = document.createElement("div");

new LightSheet({ sheetName: "Sheet" }, targetElementMock);
new Lightsheet({ sheetName: "Sheet" }, targetElementMock);
// Get the toolbar element
const toolBarElement = targetElementMock.querySelector(
".lightsheet_table_toolbar",
Expand Down

0 comments on commit ac4916f

Please sign in to comment.