From 6908def3f29a55ed43a69ee05fcbd65146b2b0d6 Mon Sep 17 00:00:00 2001 From: Yinger Date: Mon, 21 Sep 2020 22:30:14 +0900 Subject: [PATCH] add sample --- src/App.tsx | 12 +- src/components/DiffBtn.tsx | 12 +- src/components/Import.tsx | 4 +- src/components/Left.tsx | 2 +- src/components/Right.tsx | 2 +- src/utils/ExcelHelper.ts | 332 +++++++++++++++++++++++++++++++++++++ 6 files changed, 352 insertions(+), 12 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index d961b97..9c53de6 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -99,12 +99,6 @@ function App() { } }; - const onDiffClick = (e: React.MouseEvent) => { - e.preventDefault(); - - diff(leftsheetdata, rightsheetdata, hotTableComponentDiffResult); - }; - return (
@@ -122,7 +116,11 @@ function App() { { - onDiffClick(e); + diff(leftsheetdata, rightsheetdata, hotTableComponentDiffResult); + }} + onSampleBtnClick={(e) => { + setLeftSheetData(ExcelHelper.SampleDataLeft); + setRightSheetData(ExcelHelper.SampleDataRight); }} /> diff --git a/src/components/DiffBtn.tsx b/src/components/DiffBtn.tsx index 0fff83f..6f10455 100644 --- a/src/components/DiffBtn.tsx +++ b/src/components/DiffBtn.tsx @@ -5,16 +5,26 @@ import { Button } from "antd"; interface DiffBtn { btntext: string; onDiffBtnClick(e: React.MouseEvent): any; + onSampleBtnClick(e: React.MouseEvent): any; } const DiffButtonHooks = (props: DiffBtn) => { return (
+