From 5c000e5c532275330335a9a8989a08407aa2da05 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Mon, 24 Feb 2025 14:51:46 +0800 Subject: [PATCH 01/22] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=20UniverSheet?= =?UTF-8?q?=20=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Extensions/MenusLocalizerExtensions.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/BootstrapBlazor.Server/Extensions/MenusLocalizerExtensions.cs b/src/BootstrapBlazor.Server/Extensions/MenusLocalizerExtensions.cs index 00297b76b1a..6d7b7c13b0c 100644 --- a/src/BootstrapBlazor.Server/Extensions/MenusLocalizerExtensions.cs +++ b/src/BootstrapBlazor.Server/Extensions/MenusLocalizerExtensions.cs @@ -766,6 +766,12 @@ void AddData(DemoMenuItem item) Url = "typed" }, new() + { + IsNew = true, + Text = Localizer["UniverSheet"], + Url = "univer-sheet" + }, + new() { Text = Localizer["VideoPlayer"], Url = "video-player" From 4f14546c8b23887dc2bb7c8325e5831e93a0e50e Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Mon, 24 Feb 2025 14:52:13 +0800 Subject: [PATCH 02/22] =?UTF-8?q?doc:=20=E5=A2=9E=E5=8A=A0=E7=A4=BA?= =?UTF-8?q?=E4=BE=8B=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Samples/UniverSheets.razor | 18 +++++++++++ .../Components/Samples/UniverSheets.razor.cs | 17 ++++++++++ .../Components/Samples/UniverSheets.razor.css | 5 +++ .../Components/Samples/UniverSheets.razor.js | 32 +++++++++++++++++++ 4 files changed, 72 insertions(+) create mode 100644 src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor create mode 100644 src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.cs create mode 100644 src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.css create mode 100644 src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.js diff --git a/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor new file mode 100644 index 00000000000..346a4307aa1 --- /dev/null +++ b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor @@ -0,0 +1,18 @@ +@page "/univer-sheet" +@inherits WebSiteModuleComponentBase +@inject IStringLocalizer Localizer +@attribute [JSModuleAutoLoader("Samples/UniverSheets.razor.js")] + +

@Localizer["UniverSheetTitle"]

+ +

@Localizer["UniverSheetIntro"]

+ + + + +
+ +
+
diff --git a/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.cs b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.cs new file mode 100644 index 00000000000..0ed5f3ee5c0 --- /dev/null +++ b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the Apache 2.0 License +// See the LICENSE file in the project root for more information. +// Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone + +namespace BootstrapBlazor.Server.Components.Samples; + +/// +/// UniverSheet 组件示例代码 +/// +public partial class UniverSheets +{ + private readonly Dictionary Plugins = new() + { + { "ReportPlugin", "report/plugin.js" } + }; +} diff --git a/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.css b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.css new file mode 100644 index 00000000000..c757a796377 --- /dev/null +++ b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.css @@ -0,0 +1,5 @@ +.bb-sheet-demo { + height: calc(100vh - 160px); + width: 100%; + border: 1px solid var(--bs-border-color); +} diff --git a/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.js b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.js new file mode 100644 index 00000000000..af7b9fa6b37 --- /dev/null +++ b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.js @@ -0,0 +1,32 @@ +const beforeCreateUniver = (sheetName, options) => { + console.log(sheetName, options); +} + +const beforeCreateUniverSheet = (sheetName, workbookData) => { + console.log(sheetName, workbookData); +} + +if (window.BootstrapBlazor === void 0) { + window.BootstrapBlazor = {}; +} + +if (window.BootstrapBlazor.Univer === void 0) { + window.BootstrapBlazor.Univer = {}; +} + +if (window.BootstrapBlazor.Univer.Sheet === void 0) { + window.BootstrapBlazor.Univer.Sheet = { + callbacks: { + beforeCreateUniver: beforeCreateUniver, + beforeCreateUniverSheet: beforeCreateUniverSheet + } + } +} + +export function init(id) { + console.log(id); +} + +export function dispose(id) { + +} From aea902e59e898e3342df611e5101b6e5857ad281 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Mon, 24 Feb 2025 14:52:26 +0800 Subject: [PATCH 03/22] =?UTF-8?q?doc:=20=E5=A2=9E=E5=8A=A0=E5=A4=9A?= =?UTF-8?q?=E8=AF=AD=E8=A8=80=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor.Server/Locales/en-US.json | 3 ++- src/BootstrapBlazor.Server/Locales/zh-CN.json | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/BootstrapBlazor.Server/Locales/en-US.json b/src/BootstrapBlazor.Server/Locales/en-US.json index b8172bbe0cb..6a0e04ce6d1 100644 --- a/src/BootstrapBlazor.Server/Locales/en-US.json +++ b/src/BootstrapBlazor.Server/Locales/en-US.json @@ -4852,7 +4852,8 @@ "Affix": "Affix", "Watermark": "Watermark", "OctIcon": "Oct Icons", - "Typed": "Typed" + "Typed": "Typed", + "UniverSheet": "UniverSheet" }, "BootstrapBlazor.Server.Components.Samples.Table.TablesHeader": { "TablesHeaderTitle": "Header grouping function", diff --git a/src/BootstrapBlazor.Server/Locales/zh-CN.json b/src/BootstrapBlazor.Server/Locales/zh-CN.json index faa7b275927..a38bd1658c7 100644 --- a/src/BootstrapBlazor.Server/Locales/zh-CN.json +++ b/src/BootstrapBlazor.Server/Locales/zh-CN.json @@ -4852,7 +4852,8 @@ "Affix": "固钉组件 Affix", "Watermark": "水印组件 Watermark", "OctIcon": "Oct Icons", - "Typed": "打字机效果 Typed" + "Typed": "打字机效果 Typed", + "UniverSheet": "表格组件 UniverSheet" }, "BootstrapBlazor.Server.Components.Samples.Table.TablesHeader": { "TablesHeaderTitle": "表头分组功能", From 21ed47699bb8245c6c6e92c6b44378572ea2fd40 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Mon, 24 Feb 2025 14:52:37 +0800 Subject: [PATCH 04/22] =?UTF-8?q?doc:=20=E5=A2=9E=E5=8A=A0=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wwwroot/report/api/getData.js | 174 +++++++++++++++++ .../wwwroot/report/api/reportApis.js | 82 ++++++++ .../wwwroot/report/api/sheetApis.js | 24 +++ .../report/canvasExtension/main-extension.js | 99 ++++++++++ .../wwwroot/report/commands/openEditDialog.js | 26 +++ .../report/commands/openFormulaDialog.js | 28 +++ .../commands/operations/add-plot.operation.js | 16 ++ .../operations/add-table.operation.js | 11 ++ .../operations/exit-preview.operation.js | 11 ++ .../operations/insert-variable.operation.js | 18 ++ .../commands/operations/preview.operation.js | 11 ++ .../operations/save-excel.operation.js | 11 ++ .../operations/save-range.operation.js | 19 ++ .../formula-selection/CategoryList.js | 0 .../formula-selection/FormulaSelection.js | 128 +++++++++++++ .../formula-selection/VariableList.js | 0 .../components/menus-icon/AddPlotIcon.js | 10 + .../components/menus-icon/AddTableIcon.js | 10 + .../components/menus-icon/ExitPreviewIcon.js | 10 + .../menus-icon/InsertVariableIcon.js | 15 ++ .../components/menus-icon/PreviewIcon.js | 10 + .../menus-icon/SaveAsCommonTemplateIcon.js | 18 ++ .../menus-icon/SaveAsTableTemplateIcon.js | 18 ++ .../components/menus-icon/SaveExcelIcon.js | 10 + .../components/menus-icon/SaveRangeIcon.js | 10 + .../variable-table-edit/EditLayout.js | 33 ++++ .../variable-table-edit/TableColumnEdit.js | 157 +++++++++++++++ .../variable-table-edit/TableFilterPeaks.js | 82 ++++++++ .../TableHeaderRowsEdit.js | 29 +++ .../TablePropertiesEdit.js | 33 ++++ .../components/variable-table-edit/Tabs.js | 24 +++ .../variable-table-edit/VariableEdit.js | 65 +++++++ .../wwwroot/report/constant.js | 2 + .../controllers/menu/save-range.menu.js | 30 +++ .../controllers/menu/single-butten.menu.js | 76 ++++++++ .../report/controllers/report.controller.js | 180 ++++++++++++++++++ .../wwwroot/report/eventsListener.js | 44 +++++ .../wwwroot/report/locale/en-US.js | 14 ++ .../wwwroot/report/locale/zh-CN.js | 14 ++ .../wwwroot/report/plugin.js | 54 ++++++ .../wwwroot/report/report.css | 104 ++++++++++ 41 files changed, 1710 insertions(+) create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/api/getData.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/api/reportApis.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/api/sheetApis.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/canvasExtension/main-extension.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/commands/openEditDialog.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/commands/openFormulaDialog.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/commands/operations/add-plot.operation.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/commands/operations/add-table.operation.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/commands/operations/exit-preview.operation.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/commands/operations/insert-variable.operation.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/commands/operations/preview.operation.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/commands/operations/save-excel.operation.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/commands/operations/save-range.operation.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/formula-selection/CategoryList.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/formula-selection/FormulaSelection.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/formula-selection/VariableList.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/AddPlotIcon.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/AddTableIcon.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/ExitPreviewIcon.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/InsertVariableIcon.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/PreviewIcon.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/SaveAsCommonTemplateIcon.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/SaveAsTableTemplateIcon.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/SaveExcelIcon.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/SaveRangeIcon.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/EditLayout.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/TableColumnEdit.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/TableFilterPeaks.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/TableHeaderRowsEdit.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/TablePropertiesEdit.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/Tabs.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/VariableEdit.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/constant.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/controllers/menu/save-range.menu.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/controllers/menu/single-butten.menu.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/controllers/report.controller.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/eventsListener.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/locale/en-US.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/locale/zh-CN.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/plugin.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/report.css diff --git a/src/BootstrapBlazor.Server/wwwroot/report/api/getData.js b/src/BootstrapBlazor.Server/wwwroot/report/api/getData.js new file mode 100644 index 00000000000..82d576ca7e6 --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/api/getData.js @@ -0,0 +1,174 @@ +const categoryList = [ + { + "TVOCReportObject": { + "desc": "TVOC信息", + "hasChannel": true + } + }, + { + "CustomReportObject": { + "desc": "Mock Report Object", + "hasChannel": true + } + }, + { + "Calibration": { + "desc": "Calibration Item", + "hasChannel": true + } + }, + { + "IntegralEvent": { + "desc": "Integral Event", + "hasChannel": true + } + }, + { + "PeakInfo": { + "desc": "Peak Results", + "hasChannel": true + } + }, + { + "ReportInfo": { + "desc": "Report Info", + "hasChannel": false + } + }, + { + "StatisticalResult": { + "desc": "Statistical Results", + "hasChannel": true + } + } +] + +export const getCategoryList = () => { + return categoryList.map(category => { + const key = Object.keys(category)[0]; + return { + value: key, + ...category[key] + } + }); +} + +export const getVariableList = (category) => { + const variableList = [ + { + "Client": { + "dataType": "string", + "desc": "委托单位", + "defaultFormat": null, + "unit": null, + "header": null + } + }, + { + "Testerj": { + "dataType": "string", + "desc": "检测单位", + "defaultFormat": null, + "unit": null, + "header": null + } + }, + { + "Tests": { + "dataType": "string", + "desc": "检测项目", + "defaultFormat": null, + "unit": null, + "header": null + } + }, + { + "Operator": { + "dataType": "string", + "desc": "分析人员", + "defaultFormat": null, + "unit": null, + "header": null + } + }, + { + "TestCondition": { + "dataType": "string", + "desc": "分析条件", + "defaultFormat": null, + "unit": null, + "header": null + } + }, + { + "Project": { + "dataType": "string", + "desc": "工程名称", + "defaultFormat": null, + "unit": null, + "header": null + } + }, + { + "Location": { + "dataType": "string", + "desc": "采样地点", + "defaultFormat": null, + "unit": null, + "header": null + } + }, + { + "SampleID": { + "dataType": "string", + "desc": "样品编号", + "defaultFormat": null, + "unit": null, + "header": null + } + }, + { + "DeviceID": { + "dataType": "string", + "desc": "设备编号", + "defaultFormat": null, + "unit": null, + "header": null + } + }, + { + "CalibCurve": { + "dataType": "string", + "desc": "标准曲线", + "defaultFormat": null, + "unit": null, + "header": null + } + }, + { + "Amount": { + "dataType": "string", + "desc": "TVOC含量", + "defaultFormat": null, + "unit": null, + "header": null + } + }, + { + "Summary": { + "dataType": "string", + "desc": "总结", + "defaultFormat": null, + "unit": null, + "header": null + } + } + ] + return variableList.map(variable => { + const key = Object.keys(variable)[0]; + return { + value: category.value + '_' + key, + ...variable[key] + } + }); +} \ No newline at end of file diff --git a/src/BootstrapBlazor.Server/wwwroot/report/api/reportApis.js b/src/BootstrapBlazor.Server/wwwroot/report/api/reportApis.js new file mode 100644 index 00000000000..40741740238 --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/api/reportApis.js @@ -0,0 +1,82 @@ +import { getCategoryList, getVariableList } from './getData.js'; + +const { IDialogService } = UniverUi; +const { useState } = React; + +export function insertVariable({cellData} = {}) { + const categoryList = getCategoryList(); + console.log('insertVariable', cellData); + if(!cellData){ + const sheet = univerAPI.getActiveWorkbook().getActiveSheet(); + cellData = sheet.getSelection().getActiveRange().getCellData() || {}; + } + univerAPI.executeCommand('report.open-formula-dialog', {categoryList, cellData}) +} +export function editVariableAndTable({cellData}) { + const variable = cellData.custom?.variable; + const params = { + tabs: [ + {key: 0, title: 'Variable'}, + {key: 1, title: 'Table Column'}, + {key: 2, title: 'Filter Peaks'}, + {key: 3, title: 'Header Rows'}, + {key: 4, title: 'Table Properties'} + ], + contentList: [ + {key: 0, component: 'VariableEdit'}, + {key: 1, component: 'TableColumnEdit'}, + {key: 2, component: 'TableFilterPeaks'}, + {key: 3, component: 'TableHeaderRowsEdit'}, + {key: 4, component: 'TablePropertiesEdit'} + ] + } + + univerAPI.executeCommand('report.open-edit-dialog', {...params, cellData}) +} +export function preview() { + const activeWorkbook = univerAPI.getActiveWorkbook(); + const activeSheet = activeWorkbook.getActiveSheet(); + const snapshot = activeWorkbook.save() + const sheet1 = Object.values(snapshot.sheets).find((sheet) => { + return sheet.name === 'sheet1' + }) + const data = sheet1.cellData + Object.keys(data).forEach(rowIndex => { + Object.keys(data[rowIndex]).forEach(columnIndex => { + if(data[rowIndex][columnIndex].custom?.variable){ + const range = activeSheet.getRange(rowIndex * 1, columnIndex * 1, 1, 1) + range.setValue({ + v: data[rowIndex][columnIndex].custom.variable.desc || '预览数据', + custom: data[rowIndex][columnIndex].custom, + }); + } + }) + }) +} +// 保存数据 +export function saveExcel() { + const activeWorkbook = univerAPI.getActiveWorkbook(); + const activeSheet = activeWorkbook.getActiveSheet(); + const snapshot = activeWorkbook.save() + return snapshot +} + +// 保存选取数据 +export function saveSelectionData(saveType = 'table') { + const activeSheet = univerAPI.getActiveWorkbook().getActiveSheet(); + const selection = activeSheet.getSelection(); + const range = selection.getActiveRange(); + const data = range.getCellDataGrid(); + + console.log('saveSelectedData', data); + localStorage.setItem('table01', JSON.stringify(data)); +} + +// 添加表格 +export function addTable() { + const activeSheet = univerAPI.getActiveWorkbook().getActiveSheet(); + // const selection = activeSheet.getSelection(); + // const range = selection.getActiveRange(); + console.log('addTable', univerAPI.getActiveWorkbook().getSnapshot()); + +} diff --git a/src/BootstrapBlazor.Server/wwwroot/report/api/sheetApis.js b/src/BootstrapBlazor.Server/wwwroot/report/api/sheetApis.js new file mode 100644 index 00000000000..a4ea70c4206 --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/api/sheetApis.js @@ -0,0 +1,24 @@ + + +export const setRange = ({value}, setRangeAfter = () => {}) => { + const sheet = univerAPI.getActiveWorkbook().getActiveSheet(); + const selectRange = sheet.getSelection().getActiveRange(); + console.log(value, 'value'); + selectRange.setValue(value); + setRangeAfter(); +} + +export function setRichTextValue() { + const range = univerAPI.getActiveWorkbook() + .getActiveSheet() + .getActiveRange(); + + // 创建富文本并插入文本 + const richText = univerAPI.newRichText() + .insertText('Hello\rWorld'); + + // 设置富文本值 + range.setRichTextValueForCell(richText); +} + +// setTimeout(setRichTextValue, 5000) \ No newline at end of file diff --git a/src/BootstrapBlazor.Server/wwwroot/report/canvasExtension/main-extension.js b/src/BootstrapBlazor.Server/wwwroot/report/canvasExtension/main-extension.js new file mode 100644 index 00000000000..7df724c25a5 --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/canvasExtension/main-extension.js @@ -0,0 +1,99 @@ +const { DEFAULT_FONTFACE_PLANE, FIX_ONE_PIXEL_BLUR_OFFSET, getColor, MIDDLE_CELL_POS_MAGIC_NUMBER, SheetExtension } = UniverEngineRender + +const UNIQUE_KEY = 'MainCustomExtension' +// const customEmojiList = ['🥳'] +export class MainCustomExtension extends SheetExtension { + uKey = UNIQUE_KEY + + // Must be greater than 50 + get zIndex() { + return 50 + } + + draw(ctx, _parentScale, spreadsheetSkeleton) { + const { rowColumnSegment } = spreadsheetSkeleton + const { startRow, endRow, startColumn, endColumn } = rowColumnSegment + if (!spreadsheetSkeleton) { + return + } + + // Only displayed on the specified sheet + if (spreadsheetSkeleton.worksheet.getSheetId() !== 'sheet1') { + // return + } + + const { rowHeightAccumulation, columnTotalWidth, columnWidthAccumulation, rowTotalHeight, _cellData } = spreadsheetSkeleton + const sheetData = _cellData.getData() + if ( + !rowHeightAccumulation + || !columnWidthAccumulation + || columnTotalWidth === undefined + || rowTotalHeight === undefined + ) { + return + } + + ctx.fillStyle = getColor([248, 249, 250]) + ctx.textAlign = 'center' + ctx.textBaseline = 'middle' + ctx.fillStyle = getColor([0, 0, 0]) + ctx.beginPath() + ctx.lineWidth = 1 + + ctx.translateWithPrecisionRatio(FIX_ONE_PIXEL_BLUR_OFFSET, FIX_ONE_PIXEL_BLUR_OFFSET) + + ctx.strokeStyle = getColor([217, 217, 217]) + ctx.font = `13px ${DEFAULT_FONTFACE_PLANE}` + let preRowPosition = 0 + const rowHeightAccumulationLength = rowHeightAccumulation.length + for (let r = startRow - 1; r <= endRow; r++) { + if (r < 0 || r > rowHeightAccumulationLength - 1) { + continue + } + const rowEndPosition = rowHeightAccumulation[r] + if (preRowPosition === rowEndPosition) { + // Skip hidden rows + continue + } + + let preColumnPosition = 0 + const columnWidthAccumulationLength = columnWidthAccumulation.length + for (let c = startColumn - 1; c <= endColumn; c++) { + if (c < 0 || c > columnWidthAccumulationLength - 1) { + continue + } + + const columnEndPosition = columnWidthAccumulation[c] + if (preColumnPosition === columnEndPosition) { + // Skip hidden columns + continue + } + + // painting cell background + if (sheetData[r]?.[c]?.custom?.variable) { + ctx.fillStyle = '#e4393c' + strokeTriangle(ctx, preColumnPosition, preRowPosition, columnEndPosition, rowEndPosition) + } + + // painting cell text + // const middleCellPosX = preColumnPosition + (columnEndPosition - preColumnPosition) / 2 + // const middleCellPosY = preRowPosition + (rowEndPosition - preRowPosition) / 2 + // customEmojiList[c] && ctx.fillText(customEmojiList[c], middleCellPosX + 20, middleCellPosY + MIDDLE_CELL_POS_MAGIC_NUMBER) // Magic number 1, because the vertical alignment appears to be off by 1 pixel + + preColumnPosition = columnEndPosition + } + + preRowPosition = rowEndPosition + } + ctx.fill() + } +} + +// 画三角形 +function strokeTriangle(ctx, str, stc, endr, endc) { + ctx.moveTo(endr, stc) + ctx.lineTo(endr - 6, stc) + ctx.lineTo(endr, stc + 6) + ctx.lineTo(endr, stc) +} + \ No newline at end of file diff --git a/src/BootstrapBlazor.Server/wwwroot/report/commands/openEditDialog.js b/src/BootstrapBlazor.Server/wwwroot/report/commands/openEditDialog.js new file mode 100644 index 00000000000..046376d15eb --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/commands/openEditDialog.js @@ -0,0 +1,26 @@ +import { EDIT_DIALOG, INSERT_VARIABLE_DIALOG } from '../constant.js' + +const { CommandType, ICommandService, IUniverInstanceService, IContextService} = UniverCore; +const { IDialogService } = UniverUi; + +export const OpenEditDialogCommand = { + id: 'report.open-edit-dialog', + type: CommandType.OPERATION, + handler: async (accessor, params = {}) => { + const dialogService = accessor.get(IDialogService); + const closeDialog = () => dialogService.close(EDIT_DIALOG); + closeDialog(); + const dialog = dialogService.open({ + id: EDIT_DIALOG, + title: { title: 'Edit Variable and Table' }, + children: { label: 'EditLayout', ...params, closeDialog }, + // footer: { title: 'Insert' }, + width: 650, + draggable: true, + resizable: true, + destroyOnClose: true, + preservePositionOnDestroy: true, + onClose: closeDialog, + }); + }, +}; \ No newline at end of file diff --git a/src/BootstrapBlazor.Server/wwwroot/report/commands/openFormulaDialog.js b/src/BootstrapBlazor.Server/wwwroot/report/commands/openFormulaDialog.js new file mode 100644 index 00000000000..87b2804c334 --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/commands/openFormulaDialog.js @@ -0,0 +1,28 @@ +import { insertVariable } from '../api/reportApis.js' +import { INSERT_VARIABLE_DIALOG } from '../constant.js' +const { CommandType, ICommandService, IUniverInstanceService, IContextService} = UniverCore; +const { IDialogService } = UniverUi; + +export const OpenFormulaDialogCommand = { + id: 'report.open-formula-dialog', + type: CommandType.OPERATION, + handler: async (accessor, params = {}) => { + const dialogService = accessor.get(IDialogService); + const closeDialog = () => dialogService.close(INSERT_VARIABLE_DIALOG); + closeDialog() + console.log('OpenFormulaDialogCommand', params); + const title = params.cellData?.custom?.variable ? 'Edit Variable' : 'Insert Variable'; + const dialog = dialogService.open({ + id: INSERT_VARIABLE_DIALOG, + title: { title }, + children: { label: 'FormulaSelection', ...params, closeDialog }, + // footer: { title: 'Insert' }, + width: 650, + draggable: true, + resizable: true, + destroyOnClose: true, + preservePositionOnDestroy: true, + onClose: closeDialog, + }); + }, +}; diff --git a/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/add-plot.operation.js b/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/add-plot.operation.js new file mode 100644 index 00000000000..3e669a99f28 --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/add-plot.operation.js @@ -0,0 +1,16 @@ +import { insertVariable } from '../../api/reportApis.js' + +const { CommandType, IConfigService } = UniverCore; +const { IMenuManagerService } = UniverUi; + +export const AddPlotOperation = { + id: 'report.operation.add-plot', + type: CommandType.OPERATION, + handler: async (accessor) => { + const menuManagerService = accessor.get(IMenuManagerService); + const configService = accessor.get(IConfigService) + console.log(menuManagerService, 'menuManagerService'); + console.log(configService, 'configService'); + alert('AddPlotOperation'); + }, +}; diff --git a/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/add-table.operation.js b/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/add-table.operation.js new file mode 100644 index 00000000000..56074d94093 --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/add-table.operation.js @@ -0,0 +1,11 @@ +import { addTable } from '../../api/reportApis.js' + +const { CommandType } = UniverCore; + +export const AddTableOperation = { + id: 'report.operation.add-table', + type: CommandType.OPERATION, + handler: async (accessor) => { + addTable() + }, +}; diff --git a/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/exit-preview.operation.js b/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/exit-preview.operation.js new file mode 100644 index 00000000000..3fab5308841 --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/exit-preview.operation.js @@ -0,0 +1,11 @@ +import { preview } from '../../api/reportApis.js' + +const { CommandType } = UniverCore; +export const ExitPreviewOperation = { + id: 'report.operation.exit-preview', + type: CommandType.OPERATION, + handler: async (accessor) => { + alert('Exit Preview') + return true; + }, +}; diff --git a/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/insert-variable.operation.js b/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/insert-variable.operation.js new file mode 100644 index 00000000000..62d80da2057 --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/insert-variable.operation.js @@ -0,0 +1,18 @@ +import { insertVariable } from '../../api/reportApis.js' + +const { CommandType, ICommandService, IUniverInstanceService, IContextService} = UniverCore; +const { IDialogService } = UniverUi; + +export const InsertVariableOperation = { + id: 'report.operation.insert-variable', + type: CommandType.OPERATION, + handler: async (accessor) => { + const commandService = accessor.get(ICommandService); + const univerInstanceService = accessor.get(IUniverInstanceService); + const wb = univerInstanceService.getFocusedUnit().getActiveSheet().getRange(0,0,1,1) + const dialogService = accessor.get(IDialogService); + console.log(dialogService.getDialogs$()); + console.log(dialogService.valueOf(), 'dialogService'); + insertVariable() + }, +}; diff --git a/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/preview.operation.js b/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/preview.operation.js new file mode 100644 index 00000000000..032711ae3a3 --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/preview.operation.js @@ -0,0 +1,11 @@ +import { preview } from '../../api/reportApis.js' + +const { CommandType } = UniverCore; +export const PreviewOperation = { + id: 'report.operation.preview', + type: CommandType.OPERATION, + handler: async (accessor) => { + preview() + return true; + }, +}; diff --git a/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/save-excel.operation.js b/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/save-excel.operation.js new file mode 100644 index 00000000000..81e572281ff --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/save-excel.operation.js @@ -0,0 +1,11 @@ +import { saveExcel } from '../../api/reportApis.js' + +const { CommandType } = UniverCore; +export const SaveExcelOperation = { + id: 'report.operation.save-excel', + type: CommandType.OPERATION, + handler: async (accessor) => { + console.log(saveExcel()); + return true; + }, +}; diff --git a/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/save-range.operation.js b/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/save-range.operation.js new file mode 100644 index 00000000000..9b79ff0aee6 --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/save-range.operation.js @@ -0,0 +1,19 @@ +import { saveSelectionData } from '../../api/reportApis.js'; + +const { CommandType } = UniverCore; +export const SaveAsTableTemplateOperation = { + id: 'report.operation.save-as-table-template', + type: CommandType.OPERATION, + handler: async (accessor) => { + saveSelectionData() + return true; + }, +}; +export const SaveAsCommonTemplateOperation = { + id: 'report.operation.save-as-common-template', + type: CommandType.OPERATION, + handler: async (accessor) => { + saveSelectionData() + return true; + }, +}; diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/formula-selection/CategoryList.js b/src/BootstrapBlazor.Server/wwwroot/report/components/formula-selection/CategoryList.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/formula-selection/FormulaSelection.js b/src/BootstrapBlazor.Server/wwwroot/report/components/formula-selection/FormulaSelection.js new file mode 100644 index 00000000000..f1b36d36fc2 --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/components/formula-selection/FormulaSelection.js @@ -0,0 +1,128 @@ +import { getCategoryList, getVariableList } from '../../api/getData.js'; +import { setRange } from '../../api/sheetApis.js'; +import { editVariableAndTable } from '../../api/reportApis.js' + +const { useState, useEffect, createElement: c } = React; +export function FormulaSelection(props) { + const { categoryList, closeDialog, cellData } = props; + const { category, value: variable } = cellData.custom?.variable || {}; + const [ formula, setFormula ] = useState(''); + const [currentCategoryIndex, setCurrentCategoryIndex] = useState(findIndex(categoryList, item => item.value == category)); + const [variableList, setVariableList] = useState(getVariableList(categoryList[currentCategoryIndex])); + const [ currentVariableIndex, setCurrentVariableIndex ] = useState(findIndex(variableList, item => item.value == variable)); + + const handleCategoryClick = (category, index) => { + return e => { + if (currentCategoryIndex == index) return; + setVariableList(getVariableList(category)); + setCurrentCategoryIndex(index); + setCurrentVariableIndex(0); + } + } + const handleVariableClick = (variable, index) => { + return e => { + setCurrentVariableIndex(index); + } + } + const handleInsertFormula = () => { + const cc = categoryList[currentCategoryIndex] + const cellData = { + v: formula, + custom: { + variable: { + formula, + category: cc.value, + categoryDesc: cc.desc, + hasChannel: cc.hasChannel, + ...variableList[currentVariableIndex] + }, + } + } + setRange({ + value: cellData, + range: null, + sheet: null, + }, () => { + closeDialog() + const editEle = document.querySelector('.bb-edit-container') + if (editEle) { + editVariableAndTable({cellData}) + } + }) + } + + useEffect(() => { + const categoryIndex = findIndex(categoryList, item => item.value == category); + setCurrentCategoryIndex(categoryIndex); + + const varList = getVariableList(categoryList[categoryIndex]); + const varIndex = findIndex(varList, item => item.value == variable); + setVariableList(varList); + setCurrentVariableIndex(varIndex); + }, [cellData.custom?.variable]) + + useEffect(() => { + setFormula(categoryList[currentCategoryIndex].value + '.' + variableList[currentVariableIndex]?.value) + }, [currentCategoryIndex, currentVariableIndex]) + + return c( + 'div', + { className: 'bb-formula-selection' }, + c( + 'div', + { }, + c( + 'ul', + { className: 'bb-category-list' }, + ...categoryList.map((category, index) => { + return c( + 'li', + { + key: index, + className: currentCategoryIndex == index ? 'active' : '', + title: category.value, + onClick: handleCategoryClick(category, index), + }, + category.value, + c('span', {}, category.desc) + ) + }) + ), + c( + 'ul', + { className: 'bb-variable-list' }, + ...variableList.map((variable, index) => { + return React.createElement( + 'li', + { + key: index, + className: currentVariableIndex == index ? 'active' : '', + title: variable.value, + onClick: handleVariableClick(variable, index), + onDoubleClick: e => { + handleInsertFormula() + } + }, + variable.value, + c('span', {}, variable.desc) + ) + }) + ), + ), + c( + 'input', + { type: 'text', disabled: true, value: formula }, + ), + c( + 'button', + { onClick: handleInsertFormula }, + `${(cellData.custom?.variable || cellData.custom?.table) ? 'OK' : 'Insert'}` + ) + ) + +} + +function findIndex(arr, p) { + const index = arr.findIndex(p); + return index === -1 ? 0 : index; +} diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/formula-selection/VariableList.js b/src/BootstrapBlazor.Server/wwwroot/report/components/formula-selection/VariableList.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/AddPlotIcon.js b/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/AddPlotIcon.js new file mode 100644 index 00000000000..b6b469d85f8 --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/AddPlotIcon.js @@ -0,0 +1,10 @@ +export function AddPlotIcon() { + return React.createElement( + 'svg', + { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24" }, + React.createElement( + 'path', + { fill: "currentColor", d: "M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12S6.477 2 12 2m.16 14a6.981 6.981 0 0 0-5.147 2.256A7.966 7.966 0 0 0 12 20a7.97 7.97 0 0 0 5.167-1.892A6.979 6.979 0 0 0 12.16 16M12 4a8 8 0 0 0-6.384 12.821A8.975 8.975 0 0 1 12.16 14a8.972 8.972 0 0 1 6.362 2.634A8 8 0 0 0 12 4m0 1a4 4 0 1 1 0 8a4 4 0 0 1 0-8m0 2a2 2 0 1 0 0 4a2 2 0 0 0 0-4" } + ) + ); +} diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/AddTableIcon.js b/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/AddTableIcon.js new file mode 100644 index 00000000000..b7244103c83 --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/AddTableIcon.js @@ -0,0 +1,10 @@ +export function AddTableIcon() { + return React.createElement( + 'svg', + { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24" }, + React.createElement( + 'path', + { fill: "currentColor", d: "M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12S6.477 2 12 2m.16 14a6.981 6.981 0 0 0-5.147 2.256A7.966 7.966 0 0 0 12 20a7.97 7.97 0 0 0 5.167-1.892A6.979 6.979 0 0 0 12.16 16M12 4a8 8 0 0 0-6.384 12.821A8.975 8.975 0 0 1 12.16 14a8.972 8.972 0 0 1 6.362 2.634A8 8 0 0 0 12 4m0 1a4 4 0 1 1 0 8a4 4 0 0 1 0-8m0 2a2 2 0 1 0 0 4a2 2 0 0 0 0-4" } + ) + ); +} diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/ExitPreviewIcon.js b/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/ExitPreviewIcon.js new file mode 100644 index 00000000000..42882b26397 --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/ExitPreviewIcon.js @@ -0,0 +1,10 @@ +export function ExitPreviewIcon() { + return React.createElement( + 'svg', + { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24" }, + React.createElement( + 'path', + { fill: "currentColor", d: "M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12S6.477 2 12 2m.16 14a6.981 6.981 0 0 0-5.147 2.256A7.966 7.966 0 0 0 12 20a7.97 7.97 0 0 0 5.167-1.892A6.979 6.979 0 0 0 12.16 16M12 4a8 8 0 0 0-6.384 12.821A8.975 8.975 0 0 1 12.16 14a8.972 8.972 0 0 1 6.362 2.634A8 8 0 0 0 12 4m0 1a4 4 0 1 1 0 8a4 4 0 0 1 0-8m0 2a2 2 0 1 0 0 4a2 2 0 0 0 0-4" } + ) + ); +} diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/InsertVariableIcon.js b/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/InsertVariableIcon.js new file mode 100644 index 00000000000..a4908bbc4da --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/InsertVariableIcon.js @@ -0,0 +1,15 @@ +export function InsertVariableIcon() { + return React.createElement( + 'svg', + { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24" }, + React.createElement( + 'path', + { fill: "currentColor", d: "M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12S6.477 2 12 2m.16 14a6.981 6.981 0 0 0-5.147 2.256A7.966 7.966 0 0 0 12 20a7.97 7.97 0 0 0 5.167-1.892A6.979 6.979 0 0 0 12.16 16M12 4a8 8 0 0 0-6.384 12.821A8.975 8.975 0 0 1 12.16 14a8.972 8.972 0 0 1 6.362 2.634A8 8 0 0 0 12 4m0 1a4 4 0 1 1 0 8a4 4 0 0 1 0-8m0 2a2 2 0 1 0 0 4a2 2 0 0 0 0-4" } + ) + ); + // return ( + // + // + // + // ); +} diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/PreviewIcon.js b/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/PreviewIcon.js new file mode 100644 index 00000000000..d1b43982086 --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/PreviewIcon.js @@ -0,0 +1,10 @@ +export function PreviewIcon() { + return React.createElement( + 'svg', + { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24" }, + React.createElement( + 'path', + { fill: "currentColor", d: "M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12S6.477 2 12 2m.16 14a6.981 6.981 0 0 0-5.147 2.256A7.966 7.966 0 0 0 12 20a7.97 7.97 0 0 0 5.167-1.892A6.979 6.979 0 0 0 12.16 16M12 4a8 8 0 0 0-6.384 12.821A8.975 8.975 0 0 1 12.16 14a8.972 8.972 0 0 1 6.362 2.634A8 8 0 0 0 12 4m0 1a4 4 0 1 1 0 8a4 4 0 0 1 0-8m0 2a2 2 0 1 0 0 4a2 2 0 0 0 0-4" } + ) + ); +} diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/SaveAsCommonTemplateIcon.js b/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/SaveAsCommonTemplateIcon.js new file mode 100644 index 00000000000..44122a1678a --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/SaveAsCommonTemplateIcon.js @@ -0,0 +1,18 @@ +export function SaveAsCommonTemplateIcon() { + return React.createElement( + 'svg', + { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 14 14" }, + React.createElement( + 'g', + { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }, + React.createElement( + 'path', + { d: "M11.27 13.5H2.73a2 2 0 0 1-2-2.22l.67-5.89a1 1 0 0 1 1-.89h9.2a1 1 0 0 1 1 .89l.65 5.89a2 2 0 0 1-1.98 2.22Z" } + ), + React.createElement( + 'path', + { d: "M3 4.5a4 4 0 0 1 8 0m-6.5 3h5" } + ) + ) + ); +}; diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/SaveAsTableTemplateIcon.js b/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/SaveAsTableTemplateIcon.js new file mode 100644 index 00000000000..c828158e90e --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/SaveAsTableTemplateIcon.js @@ -0,0 +1,18 @@ +export function SaveAsTableTemplateIcon() { + return React.createElement( + 'svg', + { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 14 14" }, + React.createElement( + 'g', + { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }, + React.createElement( + 'path', + { d: "M11.27 13.5H2.73a2 2 0 0 1-2-2.22l.67-5.89a1 1 0 0 1 1-.89h9.2a1 1 0 0 1 1 .89l.65 5.89a2 2 0 0 1-1.98 2.22Z" } + ), + React.createElement( + 'path', + { d: "M3 4.5a4 4 0 0 1 8 0m-6.5 3h5" } + ) + ) + ); +}; diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/SaveExcelIcon.js b/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/SaveExcelIcon.js new file mode 100644 index 00000000000..a9b8d5a2c88 --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/SaveExcelIcon.js @@ -0,0 +1,10 @@ +export function SaveExcelIcon() { + return React.createElement( + 'svg', + { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24" }, + React.createElement( + 'path', + { fill: "currentColor", d: "M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12S6.477 2 12 2m.16 14a6.981 6.981 0 0 0-5.147 2.256A7.966 7.966 0 0 0 12 20a7.97 7.97 0 0 0 5.167-1.892A6.979 6.979 0 0 0 12.16 16M12 4a8 8 0 0 0-6.384 12.821A8.975 8.975 0 0 1 12.16 14a8.972 8.972 0 0 1 6.362 2.634A8 8 0 0 0 12 4m0 1a4 4 0 1 1 0 8a4 4 0 0 1 0-8m0 2a2 2 0 1 0 0 4a2 2 0 0 0 0-4" } + ) + ); +} diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/SaveRangeIcon.js b/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/SaveRangeIcon.js new file mode 100644 index 00000000000..7f7ab6809f3 --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/SaveRangeIcon.js @@ -0,0 +1,10 @@ +export function SaveRangeIcon() { + return React.createElement( + 'svg', + { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24" }, + React.createElement( + 'path', + { fill: "currentColor", d: "m12 11.6l2.5 2.5q.275.275.275.7t-.275.7t-.7.275t-.7-.275l-2.8-2.8q-.15-.15-.225-.337T10 11.975V8q0-.425.288-.712T11 7t.713.288T12 8zM18 6h-2q-.425 0-.712-.287T15 5t.288-.712T16 4h2V2q0-.425.288-.712T19 1t.713.288T20 2v2h2q.425 0 .713.288T23 5t-.288.713T22 6h-2v2q0 .425-.288.713T19 9t-.712-.288T18 8zm-7 15q-1.875 0-3.512-.7t-2.863-1.925T2.7 15.512T2 12t.7-3.512t1.925-2.863T7.488 3.7T11 3q.275 0 .513.013t.512.062q.425 0 .713.288t.287.712t-.288.713t-.712.287q-.275 0-.513-.038T11 5Q8.05 5 6.025 7.025T4 12t2.025 4.977T11 19t4.975-2.025T18 12q0-.425.288-.712T19 11t.713.288T20 12q0 1.875-.7 3.513t-1.925 2.862t-2.863 1.925T11 21" } + ) + ); +}; diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/EditLayout.js b/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/EditLayout.js new file mode 100644 index 00000000000..4b2786fd09b --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/EditLayout.js @@ -0,0 +1,33 @@ +import { Tabs } from './Tabs.js' +import { VariableEdit } from './VariableEdit.js' +import { TableColumnEdit } from './TableColumnEdit.js' +import { TableFilterPeaks } from './TableFilterPeaks.js' +import { TableHeaderRowsEdit } from './TableHeaderRowsEdit.js' +import { TablePropertiesEdit } from './TablePropertiesEdit.js' + +const { useState, useEffect, createElement: c } = React; +const componentMap = { + VariableEdit, + TableColumnEdit, + TableFilterPeaks, + TableHeaderRowsEdit, + TablePropertiesEdit, +} + +export function EditLayout(props) { + const { cellData, tabs, contentList } = props + const [activeTabIndex, setActiveTabIndex] = useState(0); + const getContentComponent = (content) => componentMap[content.component]; + + return c( + 'div', + { className: 'bb-edit-container' }, + c(Tabs, { tabs, activeTabIndex, setActiveTabIndex }), + c( + getContentComponent(contentList[activeTabIndex]), + { + cellData + } + ), + ); +} diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/TableColumnEdit.js b/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/TableColumnEdit.js new file mode 100644 index 00000000000..7f442468e9f --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/TableColumnEdit.js @@ -0,0 +1,157 @@ + +const { useState } = React; +export function TableColumnEdit(props) { + const { content } = props; + console.log(content); + return React.createElement( + 'div', + { className: 'bb-edit-content', style: { display: 'block' } }, + React.createElement( + 'h2', + { className: 'bb-edit-title' }, + 'Report Column' + ), + React.createElement( + 'div', + { className: 'management' }, + React.createElement( + 'h3', + null, + 'Column Management' + ), + React.createElement( + 'div', + null, + React.createElement( + 'button', + { id: 'addColumn', title: 'Insert a new column' }, + React.createElement( + 'svg', + { t: '1713868541570', className: 'icon', viewBox: '0 0 1024 1024', version: '1.1', xmlns: 'http://www.w3.org/2000/svg', pId: '3010', width: '19', height: '19' }, + React.createElement( + 'path', + { d: 'M906.6124654 484.96676768H747.99379616V114.87697753h158.61866923v370.08979015M959.52623131 537.79469433V62H695.12908112v475.79469433zM589.38738942 960.85956464h52.86471417V220.61866924H377.89174265V960.85956464h211.49564677zM325.0270276 220.61866924H60.66666667V960.85956464h52.87697754V273.48338427h158.60640674V960.85956464h52.87697665zM854.27504928 960.85956464l115.78488398-115.79714735L932.54818112 807.48935175l-78.77590489 78.77590489v-242.67981973h-52.90150253v242.67981973l-78.77590576-78.77590489-37.54853965 37.53627716L800.34347477 960.85956464l0.52729893-0.52729891v0.52729891h52.87697666v-0.52729891z', fill: '#333333', pId: '3011' }, + null + ) + ) + ), + React.createElement( + 'button', + { id: 'deleteColumn', title: 'Remove the selected column' }, + React.createElement( + 'svg', + { t: '1713868654744', className: 'icon', viewBox: '0 0 1024 1024', version: '1.1', xmlns: 'http://www.w3.org/2000/svg', pId: '3728', width: '20', height: '20' }, + React.createElement( + 'path', + { d: 'M371.4048 544.88576h286.12096V29.88032H371.4048v515.00544z m228.8896-457.79456v400.56832h-171.6736V87.0912h171.6736zM514.46272 900.2496l102.43072 102.43072h37.77024l2.86208-2.86208V962.048l-102.43072-102.43072 102.43072-102.43584v-37.76512l-2.86208-2.86208h-37.77024l-102.43072 102.43072-102.43072-102.43072h-37.77024l-2.86208 2.86208v37.76512l102.43072 102.43584L371.4048 962.048v37.77024l2.86208 2.86208h37.77024l102.4256-102.43072z m0 0', fill: '#09958D', pId: '3729' }, + null + ), + React.createElement( + 'path', + { d: 'M85.28384 258.7648h171.6736v743.91552h57.22112V201.53856H28.0576v801.14176h57.22624zM714.752 1002.68032h57.216V258.7648h171.6736v743.91552h57.216V201.53856H714.752z', fill: '#4A4B4B', pId: '3730' }, + null + ), + React.createElement( + 'path', + { d: 'M657.52064 719.42144v-2.86208h-2.85696zM657.52064 1002.68032v-2.86208l-2.85696 2.86208zM371.4048 1002.68032h2.86208l-2.86208-2.86208zM371.4048 719.42144l2.86208-2.86208h-2.86208z', fill: '#444A5C', pId: '3731' }, + null + ) + ) + ) + ) + ), + React.createElement( + 'div', + null, + React.createElement( + 'h3', + null, + 'Column Properties' + ), + React.createElement( + 'div', + null, + React.createElement( + 'label', + { htmlFor: 'variableFormula' }, + 'Formula' + ), + React.createElement( + 'input', + { type: 'text', autoComplete: 'off', name: 'variableFormula', id: 'variableFormula' }, + null + ) + ), + React.createElement( + 'div', + null, + React.createElement( + 'label', + { htmlFor: 'columnHeader' }, + 'Header' + ), + React.createElement( + 'input', + { type: 'text', name: 'Header', id: 'columnHeader' }, + null + ) + ), + React.createElement( + 'div', + null, + React.createElement( + 'label', + { htmlFor: 'columnUnit' }, + 'Unit' + ), + React.createElement( + 'input', + { type: 'text', name: 'Unit', id: 'columnUnit' }, + null + ) + ), + React.createElement( + 'div', + { style: { display: 'none' } }, + React.createElement( + 'label', + { htmlFor: 'columnFormat' }, + 'Format' + ), + React.createElement( + 'input', + { type: 'text', name: 'Format', id: 'columnFormat' }, + null + ) + ), + React.createElement( + 'div', + { style: { display: 'block' } }, + React.createElement( + 'label', + { htmlFor: 'variableChannel' }, + 'Channel' + ), + React.createElement( + 'select', + { name: 'channel', id: 'variableChannel' }, + React.createElement( + 'option', + { value: '' }, + '' + ), + React.createElement( + 'option', + { value: '' }, + '' + ), + React.createElement( + 'option', + { value: 'TCD1' }, + 'TCD1' + ) + ) + ) + ) + ); +} diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/TableFilterPeaks.js b/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/TableFilterPeaks.js new file mode 100644 index 00000000000..42478f03853 --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/TableFilterPeaks.js @@ -0,0 +1,82 @@ + +const { useState } = React; + +export function TableFilterPeaks(props) { + const { content } = props; + console.log(content); + return React.createElement( + 'div', + { class: 'bb-edit-content filter-peaks', style: { display: 'block' } }, + React.createElement('h2', { className: 'bb-edit-title' }, 'Filter Peaks'), + React.createElement( + 'div', + { class: 'include-peaks' }, + React.createElement('h3', {}, 'Include Peaks'), + React.createElement( + 'div', + {}, + React.createElement('input', { type: 'checkbox', name: 'IdentifiedPeaks', id: 'IdentifiedPeaks' }), + React.createElement('label', { htmlFor: 'IdentifiedPeaks' }, 'Identified Peaks') + ), + React.createElement( + 'div', + {}, + React.createElement('input', { type: 'checkbox', name: 'UnidentifiedPeaks', id: 'UnidentifiedPeaks' }), + React.createElement('label', { htmlFor: 'UnidentifiedPeaks' }, 'Unidentified Peaks') + ), + React.createElement( + 'div', + {}, + React.createElement('input', { type: 'checkbox', name: 'UndetectedComponent', id: 'UndetectedComponent' }), + React.createElement('label', { htmlFor: 'UndetectedComponent' }, 'Undetected Component') + ) + ), + React.createElement( + 'div', + { class: 'custom-conditions mask' }, + React.createElement('h3', {}, 'Custom Conditions'), + React.createElement( + 'div', + {}, + React.createElement('input', { type: 'checkbox', name: 'CustomConditionsCheck', id: 'CustomConditionsCheck' }), + React.createElement('label', { htmlFor: 'CustomConditionsCheck' }, 'Only include peaks that match the following conditions') + ), + React.createElement( + 'div', + {}, + 'Match ', + React.createElement( + 'select', + { className: 'match-type', name: 'anyOrAll', id: 'anyOrAll' }, + React.createElement('option', { value: 'ALL' }, 'ALL'), + React.createElement('option', { value: 'ANY' }, 'ANY') + ), + ' of the following rules:' + ), + React.createElement( + 'div', + { id: 'validWrapper', class: 'bb-valid-wrapper' }, + React.createElement( + 'ul', + {}, + React.createElement( + 'li', + {}, + React.createElement('input', { type: 'text', class: 'variable', onfocus: () => fpFocusHandle(this) }), + React.createElement('select', { class: 'action', onchange: () => fpChangeHandle(this) }), + React.createElement('input', { type: 'text', class: 'valid-value', onblur: () => fpBlurHandle(this) }), + React.createElement('button', { class: 'addValid' }, '+'), + React.createElement('button', { class: 'deleteValid' }, '-') + ) + ) + ), + React.createElement( + 'div', + {}, + React.createElement('button', { id: 'addGroupBtn' }, 'and'), + React.createElement('button', { style: { float: 'right', display: 'none' }, id: 'filterBtn' }, ' Submit filtering rules ') + ) + ) + ); +} + diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/TableHeaderRowsEdit.js b/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/TableHeaderRowsEdit.js new file mode 100644 index 00000000000..92c6f1e5785 --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/TableHeaderRowsEdit.js @@ -0,0 +1,29 @@ + +const { useState } = React; +export function TableHeaderRowsEdit(props) { + const { content } = props; + console.log(content); + return React.createElement( + 'div', + { className: 'bb-edit-content', style: { display: 'block' } }, + React.createElement('h2', { className: 'bb-edit-title' }, 'Header Rows'), + React.createElement( + 'div', + { className: 'show-row-wrapper' }, + React.createElement('h3', null, 'Show Rows'), + React.createElement( + 'div', + null, + React.createElement('input', { type: 'checkbox', name: 'showChannel', id: 'showChannel' }), + React.createElement('label', { htmlFor: 'showChannel' }, 'Channel') + ), + React.createElement( + 'div', + null, + React.createElement('input', { type: 'checkbox', name: 'showUnit', id: 'showUnit' }), + React.createElement('label', { htmlFor: 'showUnit' }, 'Unit') + ) + ) + ); +} + diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/TablePropertiesEdit.js b/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/TablePropertiesEdit.js new file mode 100644 index 00000000000..c31911a40f8 --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/TablePropertiesEdit.js @@ -0,0 +1,33 @@ + +const { useState } = React; + +export function TablePropertiesEdit(props) { + const { content } = props; + console.log(content); + return React.createElement( + 'div', + { className: 'bb-edit-content', style: { display: 'block' } }, + React.createElement( + 'h2', + { className: 'bb-edit-title' }, + 'Table Properties' + ), + React.createElement( + 'div', + { className: 'show-row-wrapper' }, + React.createElement( + 'h3', + null, + 'Channel' + ), + React.createElement( + 'select', + { name: 'channel', id: 'tableChannel' }, + React.createElement('option', { hidden: '', value: '' }), + React.createElement('option', { value: '' }, ''), + React.createElement('option', { value: '' }, ''), + React.createElement('option', { value: 'TCD1' }, 'TCD1') + ) + ) + ) +} diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/Tabs.js b/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/Tabs.js new file mode 100644 index 00000000000..e7d5c5f3c2c --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/Tabs.js @@ -0,0 +1,24 @@ + +const { useState } = React; +export function Tabs(props) { + // const [activeTabIndex, setActiveTabIndex] = useState(0); + const { activeTabIndex, setActiveTabIndex } = props; + const tabs = props.tabs || []; + + return React.createElement( + 'ul', + { className: 'bb-edit-tabs' }, + ...tabs.map((tab, index) => React.createElement( + 'li', + { + className: activeTabIndex === index? 'active' : '', + key: index, + onClick: () => { + setActiveTabIndex(index); + }, + }, + tab.title + )) + + ); +} diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/VariableEdit.js b/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/VariableEdit.js new file mode 100644 index 00000000000..17690575cb8 --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/VariableEdit.js @@ -0,0 +1,65 @@ +import { insertVariable } from '../../api/reportApis.js' + +const { useState, useEffect, createElement: c } = React; +export function VariableEdit(props) { + const { cellData } = props; + const hasChannel = cellData.custom?.variable?.hasChannel; + + console.log(cellData, 'cellData666'); + // const [formula, setFormula] = useState(cellData.v); + // useEffect(() => { + // setFormula(cellData.v || ''); + // }, [cellData.v]); + return c( + 'div', + { className: 'bb-edit-content' }, + c('h2', { className: 'bb-edit-title' }, 'Formula'), + c( + 'div', + null, + c( + 'div', + null, + c('label', { htmlFor: 'variableFormula' }, 'Formula'), + c('input', { + type: 'text', + autoComplete: 'off', + name: 'variableFormula', + id: 'variableFormula', + value: cellData.v || '', + onFocus: () => insertVariable({cellData}), + }) + ), + c( + 'div', + { style: { display: 'none' } }, + c('label', { htmlFor: 'variableFormat' }, 'Format'), + c('input', { type: 'text', name: 'variableFormat', id: 'variableFormat' }) + ), + c( + 'div', + { style: { display: hasChannel ? 'block' : 'none' } }, + c('label', { htmlFor: 'variableChannel' }, 'Channel'), + c( + 'select', + { name: 'variableChannel', id: 'variableChannel' }, + c('option', { value: '' }, ''), + c('option', { value: 'FID(C6+)' }, 'FID(C6+)'), + c('option', { value: 'FID(C2-C6)' }, 'FID(C2-C6)') + ) + ), + c( + 'div', + { style: { display: hasChannel ? 'block' : 'none' } }, + c('label', { htmlFor: 'variableCompoment' }, 'Compoment'), + c( + 'select', + { name: 'variableCompoment', id: 'variableCompoment' }, + c('option', { value: 'X' }, 'X'), + c('option', { value: 'Y' }, 'Y'), + c('option', { value: 'Z' }, 'Z') + ) + ) + ) + ); +} diff --git a/src/BootstrapBlazor.Server/wwwroot/report/constant.js b/src/BootstrapBlazor.Server/wwwroot/report/constant.js new file mode 100644 index 00000000000..613d6d5e5c2 --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/constant.js @@ -0,0 +1,2 @@ +export const EDIT_DIALOG = 'variable-and-table-edit-dialog'; +export const INSERT_VARIABLE_DIALOG = 'insert-variable-dialog'; \ No newline at end of file diff --git a/src/BootstrapBlazor.Server/wwwroot/report/controllers/menu/save-range.menu.js b/src/BootstrapBlazor.Server/wwwroot/report/controllers/menu/save-range.menu.js new file mode 100644 index 00000000000..b0c17dc56b6 --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/controllers/menu/save-range.menu.js @@ -0,0 +1,30 @@ +import { SaveAsTableTemplateOperation, SaveAsCommonTemplateOperation } from '../../commands/operations/save-range.operation.js'; +export const REPORT_OPERATION_SAVE_RANGE_ID = 'report.operation.save-range'; +const { MenuItemType } = UniverUi; +export function ReportSaveRangeFactory() { + return { + id: REPORT_OPERATION_SAVE_RANGE_ID, + type: MenuItemType.SUBITEMS, + icon: 'SaveRangeIcon', + tooltip: 'report.saveRange', + title: 'report.saveRange', + }; +} +export function ReportSaveAsTableTemplateFactory() { + return { + id: SaveAsTableTemplateOperation.id, + type: MenuItemType.BUTTON, + title: 'report.saveAsTableTemplate', + icon: 'SaveAsTableTemplateIcon', + positions: [REPORT_OPERATION_SAVE_RANGE_ID], + }; +} +export function ReportSaveAsCommonTemplateFactory() { + return { + id: SaveAsCommonTemplateOperation.id, + type: MenuItemType.BUTTON, + title: 'report.saveAsCommonTemplate', + icon: 'SaveAsCommonTemplateIcon', + positions: [REPORT_OPERATION_SAVE_RANGE_ID], + }; +} diff --git a/src/BootstrapBlazor.Server/wwwroot/report/controllers/menu/single-butten.menu.js b/src/BootstrapBlazor.Server/wwwroot/report/controllers/menu/single-butten.menu.js new file mode 100644 index 00000000000..3375faf375e --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/controllers/menu/single-butten.menu.js @@ -0,0 +1,76 @@ +import { InsertVariableOperation } from '../../commands/operations/insert-variable.operation.js'; +import { AddTableOperation } from '../../commands/operations/add-table.operation.js'; +import { AddPlotOperation } from '../../commands/operations/add-plot.operation.js'; +import { PreviewOperation } from '../../commands/operations/preview.operation.js'; +import { ExitPreviewOperation } from '../../commands/operations/exit-preview.operation.js'; +import { SaveExcelOperation } from '../../commands/operations/save-excel.operation.js'; + +const { UniverInstanceType } = UniverCore; +const { MenuItemType, getMenuHiddenObservable } = UniverUi; + +export function ReportInsertVariableFactory(accessor) { + return { + id: InsertVariableOperation.id, + type: MenuItemType.BUTTON, + icon: 'InsertVariableIcon', + tooltip: 'report.insertVariable', + title: 'report.insertVariable', + hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET) + }; +} + +export function ReportAddTableFactory(accessor) { + return { + id: AddTableOperation.id, + type: MenuItemType.BUTTON, + icon: 'AddTableIcon', + tooltip: 'report.addTable', + title: 'report.addTable', + hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET) + }; +} + +export function ReportAddPlotFactory(accessor) { + return { + id: AddPlotOperation.id, + type: MenuItemType.BUTTON, + icon: 'AddPlotIcon', + tooltip: 'report.addPlot', + title: 'report.addPlot', + hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET) + }; +} + +export function ReportPreviewFactory(accessor) { + return { + id: PreviewOperation.id, + type: MenuItemType.BUTTON, + icon: 'PreviewIcon', + tooltip: 'report.preview', + title: 'report.preview', + hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET) + }; +} + +export function ReportExitPreviewFactory(accessor) { + return { + id: ExitPreviewOperation.id, + type: MenuItemType.BUTTON, + icon: 'ExitPreviewIcon', + tooltip: 'report.exitPreview', + title: 'report.exitPreview', + hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET) + }; +} + +export function ReportSaveExcelFactory(accessor) { + return { + id: SaveExcelOperation.id, + type: MenuItemType.BUTTON, + icon: 'SaveExcelIcon', + tooltip: 'report.saveExcel', + title: 'report.saveExcel', + hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET) + }; +} + diff --git a/src/BootstrapBlazor.Server/wwwroot/report/controllers/report.controller.js b/src/BootstrapBlazor.Server/wwwroot/report/controllers/report.controller.js new file mode 100644 index 00000000000..618a8c6f67a --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/controllers/report.controller.js @@ -0,0 +1,180 @@ + +import { SaveRangeIcon } from '../components/menus-icon/SaveRangeIcon.js'; +import { SaveAsTableTemplateIcon } from '../components/menus-icon/SaveAsTableTemplateIcon.js'; +import { SaveAsCommonTemplateIcon } from '../components/menus-icon/SaveAsCommonTemplateIcon.js'; +import { + REPORT_OPERATION_SAVE_RANGE_ID, + ReportSaveRangeFactory, + ReportSaveAsTableTemplateFactory, + ReportSaveAsCommonTemplateFactory +} from './menu/save-range.menu.js'; +import { SaveAsTableTemplateOperation, SaveAsCommonTemplateOperation } from '../commands/operations/save-range.operation.js'; + +import { ReportInsertVariableFactory, ReportAddTableFactory, ReportAddPlotFactory, ReportPreviewFactory, ReportExitPreviewFactory, ReportSaveExcelFactory } from './menu/single-butten.menu.js'; + +import { InsertVariableOperation } from '../commands/operations/insert-variable.operation.js'; +import { InsertVariableIcon } from '../components/menus-icon/InsertVariableIcon.js'; + +import { AddTableOperation } from '../commands/operations/add-table.operation.js'; +import { AddTableIcon } from '../components/menus-icon/AddTableIcon.js'; + +import { AddPlotOperation } from '../commands/operations/add-plot.operation.js'; +import { AddPlotIcon } from '../components/menus-icon/AddPlotIcon.js'; + +import { PreviewOperation } from '../commands/operations/preview.operation.js'; +import { PreviewIcon } from '../components/menus-icon/PreviewIcon.js'; + +import { ExitPreviewOperation } from '../commands/operations/exit-preview.operation.js'; +import { ExitPreviewIcon } from '../components/menus-icon/ExitPreviewIcon.js'; + +import { SaveExcelOperation } from '../commands/operations/save-excel.operation.js'; +import { SaveExcelIcon } from '../components/menus-icon/SaveExcelIcon.js'; + +import { FormulaSelection } from '../components/formula-selection/FormulaSelection.js'; +import { EditLayout } from '../components/variable-table-edit/EditLayout.js' + +import { OpenFormulaDialogCommand } from '../commands/openFormulaDialog.js' +import { OpenEditDialogCommand } from '../commands/openEditDialog.js' + + + +const { Disposable, setDependencies, Injector, ICommandService } = UniverCore; +const { ContextMenuGroup, ContextMenuPosition, RibbonStartGroup, ComponentManager, IMenuManagerService } = UniverUi; +const { RibbonDataGroup, RibbonFormulasGroup, RibbonInsertGroup, RibbonOthersGroup, RibbonPosition, RibbonViewGroup } = UniverUi + +export class ReportController extends Disposable { + constructor(_injector, _commandService, _menuManagerService, _componentManager) { + super(); + this._injector = _injector; + this._commandService = _commandService; + this._menuManagerService = _menuManagerService ; + this._componentManager = _componentManager; + + this._initCommands(); + this._registerComponents(); + this._initMenus(); + } + _initCommands() { + [ + InsertVariableOperation, + AddTableOperation, + AddPlotOperation, + PreviewOperation, + ExitPreviewOperation, + SaveExcelOperation, + + SaveAsTableTemplateOperation, + SaveAsCommonTemplateOperation, + + OpenFormulaDialogCommand, + OpenEditDialogCommand, + + ].forEach((c) => { + this.disposeWithMe(this._commandService.registerCommand(c)); + }); + } + _registerComponents() { + const componentMap = { + InsertVariableIcon, + AddTableIcon, + AddPlotIcon, + PreviewIcon, + ExitPreviewIcon, + SaveExcelIcon, + + SaveRangeIcon, + SaveAsTableTemplateIcon, + SaveAsCommonTemplateIcon, + + FormulaSelection, + EditLayout, + } + Object.entries(componentMap).forEach((item) => { + this.disposeWithMe(this._componentManager.register(...item)); + }); + + } + _initMenus() { + console.log(this._menuManagerService, 'this._menuManagerService'); + this._menuManagerService.mergeMenu({ + // { + // "HISTORY": "ribbon.start.history", + // "FORMAT": "ribbon.start.format", + // "LAYOUT": "ribbon.start.layout", + // "FORMULAS_INSERT": "ribbon.start.insert", + // "FORMULAS_VIEW": "ribbon.start.view", + // "FILE": "ribbon.start.file", + // "OTHERS": "ribbon.start.others" + // } + [RibbonStartGroup.FILE]: { + [InsertVariableOperation.id]: { + order: 2, + menuItemFactory: ReportInsertVariableFactory + }, + [AddTableOperation.id]: { + order: 2, + menuItemFactory: ReportAddTableFactory + }, + [AddPlotOperation.id]: { + order: 2, + menuItemFactory: ReportAddPlotFactory + }, + [PreviewOperation.id]: { + order: 2, + menuItemFactory: ReportPreviewFactory + }, + [ExitPreviewOperation.id]: { + order: 2, + menuItemFactory: ReportExitPreviewFactory + }, + [SaveExcelOperation.id]: { + order: 2, + menuItemFactory: ReportSaveExcelFactory + }, + }, + [RibbonStartGroup.OTHERS]: { + // [REPORT_OPERATION_SAVE_RANGE_ID]: { + // order: -1, + // menuItemFactory: ReportSaveRangeFactory, + // [SaveAsTableTemplateOperation.id]: { + // order: 0, + // menuItemFactory: ReportSaveAsTableTemplateFactory + // }, + // [SaveAsCommonTemplateOperation.id]: { + // order: 1, + // menuItemFactory: ReportSaveAsCommonTemplateFactory + // } + // } + }, + [ContextMenuPosition.MAIN_AREA]: { + [ContextMenuGroup.DATA]: { + [InsertVariableOperation.id]: { + order: 0, + menuItemFactory: ReportInsertVariableFactory + }, + [AddTableOperation.id]: { + order: 0, + menuItemFactory: ReportAddTableFactory + }, + [AddPlotOperation.id]: { + order: 0, + menuItemFactory: ReportAddPlotFactory + }, + [REPORT_OPERATION_SAVE_RANGE_ID]: { + order: 0, + menuItemFactory: ReportSaveRangeFactory, + [SaveAsTableTemplateOperation.id]: { + order: 0, + menuItemFactory: ReportSaveAsTableTemplateFactory + }, + [SaveAsCommonTemplateOperation.id]: { + order: 1, + menuItemFactory: ReportSaveAsCommonTemplateFactory + } + } + } + } + }); + } +} +setDependencies(ReportController, [Injector, ICommandService, IMenuManagerService, ComponentManager]); diff --git a/src/BootstrapBlazor.Server/wwwroot/report/eventsListener.js b/src/BootstrapBlazor.Server/wwwroot/report/eventsListener.js new file mode 100644 index 00000000000..f0c3b3d6a54 --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/eventsListener.js @@ -0,0 +1,44 @@ +import { editVariableAndTable, insertVariable, preview } from './api/reportApis.js' +import { getCategoryList, getVariableList } from './api/getData.js'; + + +const {UniverSheetsUIPlugin} = UniverSheetsUi + export const eventsListen = ({univer, univerAPI}) => [ + // 监听选区变化事件 + univerAPI.addEvent(univerAPI.Event.SelectionChanged, (params) => { + const editEle = document.querySelector('.bb-edit-container'); + const formulaEle = document.querySelector('.bb-formula-selection'); + if(editEle){ + const { worksheet, workbook, selections: [{startRow, startColumn}]} = params; + const cellData = worksheet.getRange(startRow, startColumn, 1, 1).getCellData(); + // if( cellData.custom?.variable || cellData.custom?.table ) { + editVariableAndTable({cellData}) + // } + } + if (formulaEle) { + insertVariable() + } + }), + // 监听单元格编辑开始事件 + univerAPI.addEvent(univerAPI.Event.BeforeSheetEditStart, (params) => { + const { worksheet, workbook, row, column, eventType, keycode, isZenEditor } = params; + const cellData = worksheet.getRange(row, column, 1, 1).getCellData(); + if( cellData.custom?.variable || cellData.custom?.table ) { + params.cancel = true; + editVariableAndTable({cellData}) + } + }), + + // univerAPI.addEvent(univerAPI.Event.CellClicked, (params) => { + // const { worksheet, workbook, row, column } = params; + // console.log('点击的单元格:', row, column); + // }), + + + univerAPI.onBeforeCommandExecute((command) => { + const { id, type, params } = command; + if(id === 'zen-editor.command.open-zen-editor'){ + console.log(id); + } + }) + ] diff --git a/src/BootstrapBlazor.Server/wwwroot/report/locale/en-US.js b/src/BootstrapBlazor.Server/wwwroot/report/locale/en-US.js new file mode 100644 index 00000000000..20568d9083e --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/locale/en-US.js @@ -0,0 +1,14 @@ + +export default { + report: { + insertVariable: 'Add variable', + addTable: 'Add table', + addPlot: 'Add plot', + preview: 'Preview', + exitPreview: 'Exit Preview', + saveExcel: 'SaveExcel', + saveRange: 'Save Range Data', + saveAsTableTemplate: 'SaveAsTableTemplate', + saveAsCommonTemplate: 'SaveAsCommonTemplate', + } +}; diff --git a/src/BootstrapBlazor.Server/wwwroot/report/locale/zh-CN.js b/src/BootstrapBlazor.Server/wwwroot/report/locale/zh-CN.js new file mode 100644 index 00000000000..e075f289d16 --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/locale/zh-CN.js @@ -0,0 +1,14 @@ + +export default { + report: { + insertVariable: '添加变量', + addTable: '添加表格', + addPlot: '添加谱图', + preview: '预览数据', + exitPreview: '退出预览', + saveExcel: '保存', + saveRange: '保存选区数据', + saveAsTableTemplate: '保存为表格模板', + saveAsCommonTemplate: '保存为普通模板', + }, +}; diff --git a/src/BootstrapBlazor.Server/wwwroot/report/plugin.js b/src/BootstrapBlazor.Server/wwwroot/report/plugin.js new file mode 100644 index 00000000000..ea4d0cdbd0f --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/plugin.js @@ -0,0 +1,54 @@ +import zhCN from './locale/zh-CN.js'; +import enUS from './locale/en-US.js'; +import { ReportController } from './controllers/report.controller.js'; +import { eventsListen } from "./eventsListener.js" +import { MainCustomExtension } from './canvasExtension/main-extension.js' + +const { Plugin, UniverInstanceType, LocaleService, Inject, touchDependencies, Injector, setDependencies } = UniverCore +const REPORT_PLUGIN = 'ReportPlugin'; + +// 定义插件类 +export class ReportPlugin extends Plugin { + static type = UniverInstanceType.UNIVER_SHEET; + static pluginName = REPORT_PLUGIN; + + constructor( + _injector, + _localeService, + ) { + super(); + this._injector = _injector; + this._localeService = _localeService; + this._localeService.load({ + zhCN, + enUS + }); + } + + onStarting() { + this._injector.add([ReportController]) + } + + onReady() { + this._injector.get(ReportController) + } + onRendered() { + // touchDependencies(this._injector, [[ReportController]]) + + // 注册自定义表格单元格渲染 + const unitId = univerAPI.getActiveWorkbook().id + univerAPI.registerSheetMainExtension(unitId, new MainCustomExtension()) + + // 绑定report插件的事件监听 + const eventDisposableList = eventsListen({ univer, univerAPI }); + // excel销毁时,解绑事件监听 + univer.onDispose(() => eventDisposableList.forEach(disposable => { disposable.dispose(); console.log("解绑report插件的事件监听"); })); + } + + onInit(univer, univerAPI) { + + } +} + +// 设置依赖 +setDependencies(ReportPlugin, [Injector, LocaleService]); diff --git a/src/BootstrapBlazor.Server/wwwroot/report/report.css b/src/BootstrapBlazor.Server/wwwroot/report/report.css new file mode 100644 index 00000000000..722c0743f3c --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/report.css @@ -0,0 +1,104 @@ + + + + +ul, li { + list-style: none; + margin: 0; + padding: 0; +} +.bb-formula-selection, .bb-edit-container { + font-size: 12px; +} + +.bb-formula-selection > div { + display: flex; +} + .bb-formula-selection .bb-category-list{ + width: 50%; + margin-right: 10px; + } + .bb-formula-selection .bb-variable-list{ + width: 50%; + } + .bb-formula-selection li, .bb-edit-container .bb-edit-tabs li { + height: 30px; + line-height: 30px; + padding-left: 8px; + font-size: 14px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + cursor: pointer; + user-select: none; + } + .bb-formula-selection li:hover, .bb-edit-container .bb-edit-tabs li:hover { + background-color: #efefef; + } + .bb-formula-selection li.active, .bb-edit-container .bb-edit-tabs li.active { + background-color: #e3e3e3; + } + .bb-formula-selection li span { + font-size: 10px; + margin-left: 5px; + color: rgba(0, 0, 0, 0.6) + } + .bb-formula-selection input { + margin-top: 10px; + width: 80%; + height: 20px; + padding-left: 5px; + } + .bb-formula-selection button { + width: 60px; + height: 25px; + padding-left: 5px; + margin-left: 10px; + cursor: pointer; + } + +.bb-edit-container { + display: flex; +} + .bb-edit-container .bb-edit-tabs { + width: 30%; + } + .bb-edit-container .bb-edit-content { + width: 70%; + padding-left: 5px; + } + .bb-edit-container .bb-edit-content h2 { + margin: 0; + font-size: 20px; + font-weight: normal; + } + .bb-edit-container .bb-edit-content h3 { + margin: 0; + font-size: 16px; + font-weight: normal; + } + .bb-edit-container .bb-edit-content label:has(+input[type="text"]) { + display: block; + font-size: 12px; + } + .bb-edit-container .bb-edit-content input[type="text"]:not(.variable):not(.valid-value), + .bb-edit-container .bb-edit-content select:not(.match-type):not(.action) { + width: 100%; + height: 25px; + box-sizing: border-box; + } + + .bb-edit-container .bb-edit-content > div { + padding-left: 10px; + } + + .bb-edit-container .bb-edit-content > div > div { + margin-bottom: 10px; + } + .bb-edit-container .bb-edit-content .bb-valid-wrapper li { + display: flex; + } + .bb-edit-container .bb-edit-content .bb-valid-wrapper li input[type="text"], .bb-edit-container .bb-edit-content .bb-valid-wrapper li select { + flex: 1; + margin-right: 3px; + } From f458c50fceb46838e3d571acd5fb8a502b72f8f0 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Mon, 24 Feb 2025 14:52:49 +0800 Subject: [PATCH 05/22] =?UTF-8?q?chore:=20=E5=A2=9E=E5=8A=A0=E6=BA=90?= =?UTF-8?q?=E7=A0=81=E6=98=A0=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor.Server/docs.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/BootstrapBlazor.Server/docs.json b/src/BootstrapBlazor.Server/docs.json index 6cbcfd80e9f..2eb67ad658b 100644 --- a/src/BootstrapBlazor.Server/docs.json +++ b/src/BootstrapBlazor.Server/docs.json @@ -226,7 +226,8 @@ "smiles-drawer": "SmilesDrawers", "affix": "Affixs", "watermark": "Watermarks", - "typed": "Typeds" + "typed": "Typeds", + "univer-sheet": "UniverSheets" }, "video": { "table": "BV1ap4y1x7Qn?p=1", From cc0e7d7b56db628e3a7b2ae1bac66da71e891554 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Mon, 24 Feb 2025 14:53:05 +0800 Subject: [PATCH 06/22] =?UTF-8?q?chore:=20=E5=A2=9E=E5=8A=A0=20UniverSheet?= =?UTF-8?q?=20=E5=B7=A5=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BootstrapBlazor.sln | 7 +++++++ src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj | 1 + 2 files changed, 8 insertions(+) diff --git a/BootstrapBlazor.sln b/BootstrapBlazor.sln index c0db3d47fbb..9bb06bfaa99 100644 --- a/BootstrapBlazor.sln +++ b/BootstrapBlazor.sln @@ -78,6 +78,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{9BAF50BE EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTest.Benchmarks", "tools\Benchmarks\UnitTest.Benchmarks.csproj", "{3E6D8D0E-5A36-4CFD-8612-7D64E3FFE7B1}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BootstrapBlazor.UniverSheet", "..\BootstrapBlazor.Extensions\src\components\BootstrapBlazor.UniverSheet\BootstrapBlazor.UniverSheet.csproj", "{1A0FDDCB-63A3-B260-4F9E-C820C70CD0BC}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -112,6 +114,10 @@ Global {3E6D8D0E-5A36-4CFD-8612-7D64E3FFE7B1}.Debug|Any CPU.Build.0 = Debug|Any CPU {3E6D8D0E-5A36-4CFD-8612-7D64E3FFE7B1}.Release|Any CPU.ActiveCfg = Release|Any CPU {3E6D8D0E-5A36-4CFD-8612-7D64E3FFE7B1}.Release|Any CPU.Build.0 = Release|Any CPU + {1A0FDDCB-63A3-B260-4F9E-C820C70CD0BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1A0FDDCB-63A3-B260-4F9E-C820C70CD0BC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1A0FDDCB-63A3-B260-4F9E-C820C70CD0BC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1A0FDDCB-63A3-B260-4F9E-C820C70CD0BC}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -128,6 +134,7 @@ Global {D8AEAFE7-10AF-4A5B-BC67-FE740A2CA1DF} = {7C1D79F1-87BC-42C1-BD5A-CDE4044AC1BD} {C075C6C8-B9CB-4AC0-9BDF-B2002B4AB99C} = {EA765165-0542-41C8-93F2-85787FEDEDFF} {3E6D8D0E-5A36-4CFD-8612-7D64E3FFE7B1} = {9BAF50BE-141D-4429-93A9-942F373D1F68} + {1A0FDDCB-63A3-B260-4F9E-C820C70CD0BC} = {A2182155-43ED-44C1-BF6F-1B70EBD2DFFE} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {0DCB0756-34FA-4FD0-AE1D-D3F08B5B3A6B} diff --git a/src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj b/src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj index 4badaa064fb..1a3ea20a1c6 100644 --- a/src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj +++ b/src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj @@ -75,6 +75,7 @@ + From 082aad2533dc34a84b4c8adc9b28f0a16c391fc3 Mon Sep 17 00:00:00 2001 From: zhaijunlei <276318515@qq.com> Date: Thu, 27 Feb 2025 11:05:25 +0800 Subject: [PATCH 07/22] =?UTF-8?q?feat:=20=E4=BA=A4=E4=BA=92=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wwwroot/report/CustomerService.js | 62 +++++++++++++++ .../wwwroot/report/api/reportApis.js | 9 +++ .../wwwroot/report/eventsListener.js | 79 ++++++++++--------- .../wwwroot/report/plugin.js | 45 ++++++++--- .../wwwroot/report/report.css | 4 +- 5 files changed, 150 insertions(+), 49 deletions(-) create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/CustomerService.js diff --git a/src/BootstrapBlazor.Server/wwwroot/report/CustomerService.js b/src/BootstrapBlazor.Server/wwwroot/report/CustomerService.js new file mode 100644 index 00000000000..44ec5ed46aa --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/CustomerService.js @@ -0,0 +1,62 @@ + +const {IResourceManagerService, setDependencies, IResourceLoaderService, IUniverInstanceService, Injector, FUniver } = UniverCore +const { UniverType } = UniverProtocol + +export class CustomerService{ + _model = { + testResource: { + name: 'testResource', + value: 'testValue' + } + } + constructor( + _injector, + _resourceManagerService, + _univerInstanceService, + _resourceLoaderService, + ) {console.log('CustomerService constructor'); + + this._injector = _injector; + + this._resourceManagerService = _resourceManagerService; + this._univerInstanceService = _univerInstanceService; + this._resourceLoaderService = _resourceLoaderService; + + this._resourceManagerService.registerPluginResource({ + toJson: (_unitId) => this._toJson(_unitId), + parseJson: (json) => this._parseJson(json), + pluginName: 'CustomerService', + businesses: [UniverType.UNIVER_SHEET, UniverType.UNIVER_DOC, UniverType.UNIVER_SLIDE], + onLoad: (_unitId, resource) => { + this._model = resource; + }, + onUnLoad: (_unitId) => { + console.log(_unitId, 'onUnLoad'); + this._model = { }; + }, + }); + } + + _toJson(_unitId) { + const model = this._model; + console.log('_toJson'); + return JSON.stringify(model); + } + + _parseJson(json) { + return JSON.parse(json); + } + _getResource() { + const workbook = this._univerInstanceService.getCurrentUnitForType(UniverType.UNIVER_SHEET) + const snapshot = this._resourceLoaderService.saveUnit(workbook.getUnitId()); + return snapshot.resources + } + + _setRangeValue(data = 'testValue001') { + const univerAPI = FUniver.newAPI(this._injector) + const range = univerAPI.getActiveWorkbook().getActiveSheet().getRange(5,3,2,1) + range.setValue(data) + } +} + +setDependencies(CustomerService, [Injector, IResourceManagerService, IUniverInstanceService, IResourceLoaderService]); \ No newline at end of file diff --git a/src/BootstrapBlazor.Server/wwwroot/report/api/reportApis.js b/src/BootstrapBlazor.Server/wwwroot/report/api/reportApis.js index 40741740238..d226813da8c 100644 --- a/src/BootstrapBlazor.Server/wwwroot/report/api/reportApis.js +++ b/src/BootstrapBlazor.Server/wwwroot/report/api/reportApis.js @@ -2,10 +2,19 @@ import { getCategoryList, getVariableList } from './getData.js'; const { IDialogService } = UniverUi; const { useState } = React; +const { IUniverInstanceService, Injector, FUniver, UniverInstanceService } = UniverCore export function insertVariable({cellData} = {}) { const categoryList = getCategoryList(); console.log('insertVariable', cellData); + console.log(IUniverInstanceService) + + const injector = new Injector([ + [UniverInstanceService], + ]); + + // const instance = injector.get(UniverInstanceService) + // console.log(instance, 'instance') if(!cellData){ const sheet = univerAPI.getActiveWorkbook().getActiveSheet(); cellData = sheet.getSelection().getActiveRange().getCellData() || {}; diff --git a/src/BootstrapBlazor.Server/wwwroot/report/eventsListener.js b/src/BootstrapBlazor.Server/wwwroot/report/eventsListener.js index f0c3b3d6a54..b9421ae1081 100644 --- a/src/BootstrapBlazor.Server/wwwroot/report/eventsListener.js +++ b/src/BootstrapBlazor.Server/wwwroot/report/eventsListener.js @@ -2,43 +2,46 @@ import { editVariableAndTable, insertVariable, preview } from './api/reportApis. import { getCategoryList, getVariableList } from './api/getData.js'; -const {UniverSheetsUIPlugin} = UniverSheetsUi - export const eventsListen = ({univer, univerAPI}) => [ - // 监听选区变化事件 - univerAPI.addEvent(univerAPI.Event.SelectionChanged, (params) => { - const editEle = document.querySelector('.bb-edit-container'); - const formulaEle = document.querySelector('.bb-formula-selection'); - if(editEle){ - const { worksheet, workbook, selections: [{startRow, startColumn}]} = params; - const cellData = worksheet.getRange(startRow, startColumn, 1, 1).getCellData(); - // if( cellData.custom?.variable || cellData.custom?.table ) { - editVariableAndTable({cellData}) - // } - } - if (formulaEle) { - insertVariable() - } - }), - // 监听单元格编辑开始事件 - univerAPI.addEvent(univerAPI.Event.BeforeSheetEditStart, (params) => { - const { worksheet, workbook, row, column, eventType, keycode, isZenEditor } = params; - const cellData = worksheet.getRange(row, column, 1, 1).getCellData(); - if( cellData.custom?.variable || cellData.custom?.table ) { - params.cancel = true; - editVariableAndTable({cellData}) - } - }), - - // univerAPI.addEvent(univerAPI.Event.CellClicked, (params) => { - // const { worksheet, workbook, row, column } = params; - // console.log('点击的单元格:', row, column); - // }), +const { UniverSheetsUIPlugin } = UniverSheetsUi +export const eventsListen = ({}) => [ + // 监听选区变化事件 + univerAPI.addEvent(univerAPI.Event.SelectionChanged, (params) => { + const editEle = document.querySelector('.bb-edit-container'); + const formulaEle = document.querySelector('.bb-formula-selection'); + if (editEle) { + const { worksheet, workbook, selections: [{ startRow, startColumn }] } = params; + const cellData = worksheet.getRange(startRow, startColumn, 1, 1).getCellData(); + // if( cellData.custom?.variable || cellData.custom?.table ) { + editVariableAndTable({ cellData }) + // } + } + if (formulaEle) { + insertVariable() + } + }), + // 监听单元格编辑开始事件 + univerAPI.addEvent(univerAPI.Event.BeforeSheetEditStart, (params) => { + const { worksheet, workbook, row, column, eventType, keycode, isZenEditor } = params; + const cellData = worksheet.getRange(row, column, 1, 1).getCellData(); + if (cellData.custom?.variable || cellData.custom?.table) { + params.cancel = true; + editVariableAndTable({ cellData }) + } + }), + // univerAPI.addEvent(univerAPI.Event.CellClicked, (params) => { + // const { worksheet, workbook, row, column } = params; + // console.log('点击的单元格:', row, column); + // }), - univerAPI.onBeforeCommandExecute((command) => { - const { id, type, params } = command; - if(id === 'zen-editor.command.open-zen-editor'){ - console.log(id); - } - }) - ] + + univerAPI.onBeforeCommandExecute((command) => { + const { id, type, params } = command; + if (id === 'zen-editor.command.open-zen-editor') { + console.log(id); + } + if (id === 'drawing.operation.set-drawing-selected') { + console.log(id); + } + }) +] diff --git a/src/BootstrapBlazor.Server/wwwroot/report/plugin.js b/src/BootstrapBlazor.Server/wwwroot/report/plugin.js index ea4d0cdbd0f..45ba3f11c0b 100644 --- a/src/BootstrapBlazor.Server/wwwroot/report/plugin.js +++ b/src/BootstrapBlazor.Server/wwwroot/report/plugin.js @@ -3,8 +3,9 @@ import enUS from './locale/en-US.js'; import { ReportController } from './controllers/report.controller.js'; import { eventsListen } from "./eventsListener.js" import { MainCustomExtension } from './canvasExtension/main-extension.js' +import { CustomerService } from './CustomerService.js' -const { Plugin, UniverInstanceType, LocaleService, Inject, touchDependencies, Injector, setDependencies } = UniverCore +const { Plugin, UniverInstanceType, LocaleService, Inject, touchDependencies, Injector, setDependencies, FUniver, IUniverInstanceService, createIdentifier } = UniverCore const REPORT_PLUGIN = 'ReportPlugin'; // 定义插件类 @@ -17,6 +18,7 @@ export class ReportPlugin extends Plugin { _localeService, ) { super(); + console.log('ReportPlugin constructor'); this._injector = _injector; this._localeService = _localeService; this._localeService.load({ @@ -24,31 +26,54 @@ export class ReportPlugin extends Plugin { enUS }); } - - onStarting() { + + onStarting() {console.log('onStarting'); this._injector.add([ReportController]) + this._injector.add(['zhangsan', {useClass: CustomerService}]) } - onReady() { + onReady() {console.log('onReady'); this._injector.get(ReportController) + + // const customerService = this._injector.get('zhangsan') + // console.log(customerService, 'customerService'); + // const resource = customerService._getResource().resources.find(item => item.name === 'CustomerService').data || {} + // const univerAPI = FUniver.newAPI(this._injector) + // const unitId = univerAPI.getActiveWorkbook().getId() + // univerAPI.createUniverSheet(JSON.parse(resource)) + // univerAPI.disposeUnit(unitId) + + const customerService = this._injector.get('zhangsan') + const resource = customerService._getResource().find(item => item.name === 'CustomerService').data || {} + const univerAPI = FUniver.newAPI(this._injector) + const sheet = univerAPI.getActiveWorkbook().getActiveSheet().getRange(2,2,2,1) + sheet.setValue(resource) } onRendered() { // touchDependencies(this._injector, [[ReportController]]) + // 动态添加link标签 + const link = document.createElement('link'); + link.type = 'text/css'; + link.rel ='stylesheet'; + link.href = './report/report.css'; + document.head.appendChild(link); + + const univerAPI = FUniver.newAPI(this._injector) + // 注册自定义表格单元格渲染 const unitId = univerAPI.getActiveWorkbook().id univerAPI.registerSheetMainExtension(unitId, new MainCustomExtension()) // 绑定report插件的事件监听 - const eventDisposableList = eventsListen({ univer, univerAPI }); + const eventDisposableList = eventsListen({ univerAPI }); // excel销毁时,解绑事件监听 - univer.onDispose(() => eventDisposableList.forEach(disposable => { disposable.dispose(); console.log("解绑report插件的事件监听"); })); + this._injector.onDispose(() => eventDisposableList.forEach(disposable => { disposable.dispose(); console.log("解绑report插件的事件监听"); })); } - onInit(univer, univerAPI) { - - } + // onSteady() { + // } } // 设置依赖 -setDependencies(ReportPlugin, [Injector, LocaleService]); +setDependencies(ReportPlugin, [Injector, LocaleService]); \ No newline at end of file diff --git a/src/BootstrapBlazor.Server/wwwroot/report/report.css b/src/BootstrapBlazor.Server/wwwroot/report/report.css index 722c0743f3c..a2131787114 100644 --- a/src/BootstrapBlazor.Server/wwwroot/report/report.css +++ b/src/BootstrapBlazor.Server/wwwroot/report/report.css @@ -1,6 +1,8 @@ - +.univer-fixed { + position: absolute; +} ul, li { list-style: none; From d8978fe238c00468cb34af78b96cd245e8d7fb52 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Thu, 27 Feb 2025 11:34:16 +0800 Subject: [PATCH 08/22] =?UTF-8?q?refactor:=20=E5=A2=9E=E5=8A=A0=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Samples/UniverSheets.razor | 4 ++- .../Components/Samples/UniverSheets.razor.cs | 16 ++++++++++ .../wwwroot/report/CustomerService.js | 29 ++++++++++++++----- 3 files changed, 41 insertions(+), 8 deletions(-) diff --git a/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor index 346a4307aa1..5a2628d1d7b 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor +++ b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor @@ -9,10 +9,12 @@ + +
- +
diff --git a/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.cs b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.cs index 0ed5f3ee5c0..5d4ba52723a 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.cs +++ b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.cs @@ -14,4 +14,20 @@ public partial class UniverSheets { { "ReportPlugin", "report/plugin.js" } }; + + private UniverSheet _sheet = default!; + + private async Task OnPush() + { + await _sheet.PushData(new UniverSheetData() + { + MessageName = "MessageName", + CommandName = "CommandName", + Data = new + { + Id = 01, + Name = "Test-Name" + } + }); + } } diff --git a/src/BootstrapBlazor.Server/wwwroot/report/CustomerService.js b/src/BootstrapBlazor.Server/wwwroot/report/CustomerService.js index 44ec5ed46aa..62d7df1811d 100644 --- a/src/BootstrapBlazor.Server/wwwroot/report/CustomerService.js +++ b/src/BootstrapBlazor.Server/wwwroot/report/CustomerService.js @@ -1,8 +1,8 @@ - -const {IResourceManagerService, setDependencies, IResourceLoaderService, IUniverInstanceService, Injector, FUniver } = UniverCore + +const { IResourceManagerService, setDependencies, IResourceLoaderService, IUniverInstanceService, Injector, FUniver } = UniverCore const { UniverType } = UniverProtocol -export class CustomerService{ +export class CustomerService { _model = { testResource: { name: 'testResource', @@ -14,7 +14,8 @@ export class CustomerService{ _resourceManagerService, _univerInstanceService, _resourceLoaderService, - ) {console.log('CustomerService constructor'); + ) { + console.log('CustomerService constructor'); this._injector = _injector; @@ -32,7 +33,7 @@ export class CustomerService{ }, onUnLoad: (_unitId) => { console.log(_unitId, 'onUnLoad'); - this._model = { }; + this._model = {}; }, }); } @@ -54,9 +55,23 @@ export class CustomerService{ _setRangeValue(data = 'testValue001') { const univerAPI = FUniver.newAPI(this._injector) - const range = univerAPI.getActiveWorkbook().getActiveSheet().getRange(5,3,2,1) + const range = univerAPI.getActiveWorkbook().getActiveSheet().getRange(5, 3, 2, 1) range.setValue(data) } + + receiveData(data) { + console.log(data); + + if (typeof (this.pushData) === 'function') { + this.pushData({ + messageName: 'CustomerService', + commandName: 'setRangeValue', + data: { + value: 1 + } + }); + } + } } -setDependencies(CustomerService, [Injector, IResourceManagerService, IUniverInstanceService, IResourceLoaderService]); \ No newline at end of file +setDependencies(CustomerService, [Injector, IResourceManagerService, IUniverInstanceService, IResourceLoaderService]); From fa8e1c5c69f9ea8f300c66b7ab8ca3ea6c7db9e8 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Thu, 27 Feb 2025 12:20:58 +0800 Subject: [PATCH 09/22] =?UTF-8?q?refactor:=20=E6=9B=B4=E6=94=B9=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Samples/UniverSheets.razor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.cs b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.cs index 5d4ba52723a..a20ba4fea3d 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.cs +++ b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.cs @@ -19,7 +19,7 @@ public partial class UniverSheets private async Task OnPush() { - await _sheet.PushData(new UniverSheetData() + await _sheet.PushDataAsync(new UniverSheetData() { MessageName = "MessageName", CommandName = "CommandName", From e0eb53b52588662543e2d47bfe870f723648271c Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Thu, 27 Feb 2025 12:21:14 +0800 Subject: [PATCH 10/22] =?UTF-8?q?refactor:=20=E6=95=B0=E6=8D=AE=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=90=8D=E7=A7=B0=E5=8F=82=E6=95=B0=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wwwroot/report/plugin.js | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/BootstrapBlazor.Server/wwwroot/report/plugin.js b/src/BootstrapBlazor.Server/wwwroot/report/plugin.js index 45ba3f11c0b..8858390c7df 100644 --- a/src/BootstrapBlazor.Server/wwwroot/report/plugin.js +++ b/src/BootstrapBlazor.Server/wwwroot/report/plugin.js @@ -12,7 +12,7 @@ const REPORT_PLUGIN = 'ReportPlugin'; export class ReportPlugin extends Plugin { static type = UniverInstanceType.UNIVER_SHEET; static pluginName = REPORT_PLUGIN; - + static DataServiceName = 'CustomerService'; constructor( _injector, _localeService, @@ -26,13 +26,15 @@ export class ReportPlugin extends Plugin { enUS }); } - - onStarting() {console.log('onStarting'); + + onStarting() { + console.log('onStarting'); this._injector.add([ReportController]) - this._injector.add(['zhangsan', {useClass: CustomerService}]) + this._injector.add([ReportPlugin.DataServiceName, { useClass: CustomerService }]) } - onReady() {console.log('onReady'); + onReady() { + console.log('onReady'); this._injector.get(ReportController) // const customerService = this._injector.get('zhangsan') @@ -43,10 +45,10 @@ export class ReportPlugin extends Plugin { // univerAPI.createUniverSheet(JSON.parse(resource)) // univerAPI.disposeUnit(unitId) - const customerService = this._injector.get('zhangsan') + const customerService = this._injector.get(ReportPlugin.DataServiceName) const resource = customerService._getResource().find(item => item.name === 'CustomerService').data || {} const univerAPI = FUniver.newAPI(this._injector) - const sheet = univerAPI.getActiveWorkbook().getActiveSheet().getRange(2,2,2,1) + const sheet = univerAPI.getActiveWorkbook().getActiveSheet().getRange(2, 2, 2, 1) sheet.setValue(resource) } onRendered() { @@ -55,7 +57,7 @@ export class ReportPlugin extends Plugin { // 动态添加link标签 const link = document.createElement('link'); link.type = 'text/css'; - link.rel ='stylesheet'; + link.rel = 'stylesheet'; link.href = './report/report.css'; document.head.appendChild(link); @@ -76,4 +78,4 @@ export class ReportPlugin extends Plugin { } // 设置依赖 -setDependencies(ReportPlugin, [Injector, LocaleService]); \ No newline at end of file +setDependencies(ReportPlugin, [Injector, LocaleService]); From 6d1e3c77bc1e65fe0839f4765ce6c9a4b8a989f6 Mon Sep 17 00:00:00 2001 From: zhaijunlei <276318515@qq.com> Date: Thu, 27 Feb 2025 14:01:06 +0800 Subject: [PATCH 11/22] =?UTF-8?q?refactor:=20=E4=BF=AE=E6=94=B9=E6=A1=88?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wwwroot/report/CustomerService.js | 77 ------- .../wwwroot/report/DataService.js | 25 +++ .../wwwroot/report/api/getData.js | 174 --------------- .../wwwroot/report/api/reportApis.js | 91 -------- .../wwwroot/report/api/sheetApis.js | 24 --- .../report/canvasExtension/main-extension.js | 99 --------- .../wwwroot/report/commands/openEditDialog.js | 26 --- .../report/commands/openFormulaDialog.js | 28 --- .../commands/operations/add-plot.operation.js | 16 -- .../operations/add-table.operation.js | 11 - .../operations/exit-preview.operation.js | 11 - .../operations/insert-variable.operation.js | 18 -- .../commands/operations/preview.operation.js | 11 - .../operations/save-excel.operation.js | 11 - .../operations/save-range.operation.js | 19 -- .../formula-selection/CategoryList.js | 0 .../formula-selection/FormulaSelection.js | 128 ----------- .../formula-selection/VariableList.js | 0 .../components/menus-icon/AddPlotIcon.js | 10 - .../components/menus-icon/AddTableIcon.js | 10 - .../components/menus-icon/ExitPreviewIcon.js | 10 - .../menus-icon/InsertVariableIcon.js | 15 -- .../components/menus-icon/PreviewIcon.js | 10 - .../menus-icon/SaveAsCommonTemplateIcon.js | 18 -- .../menus-icon/SaveAsTableTemplateIcon.js | 18 -- .../components/menus-icon/SaveExcelIcon.js | 10 - .../components/menus-icon/SaveRangeIcon.js | 10 - .../variable-table-edit/EditLayout.js | 33 --- .../variable-table-edit/TableColumnEdit.js | 157 -------------- .../variable-table-edit/TableFilterPeaks.js | 82 ------- .../TableHeaderRowsEdit.js | 29 --- .../TablePropertiesEdit.js | 33 --- .../components/variable-table-edit/Tabs.js | 24 --- .../variable-table-edit/VariableEdit.js | 65 ------ .../wwwroot/report/constant.js | 2 - .../controllers/menu/save-range.menu.js | 30 --- .../controllers/menu/single-butten.menu.js | 76 ------- .../report/controllers/report.controller.js | 202 ++++++------------ .../wwwroot/report/eventsListener.js | 47 ---- .../wwwroot/report/locale/en-US.js | 14 -- .../wwwroot/report/locale/zh-CN.js | 14 -- .../wwwroot/report/plugin.js | 54 +---- 42 files changed, 94 insertions(+), 1648 deletions(-) delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/CustomerService.js create mode 100644 src/BootstrapBlazor.Server/wwwroot/report/DataService.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/api/getData.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/api/reportApis.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/api/sheetApis.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/canvasExtension/main-extension.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/commands/openEditDialog.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/commands/openFormulaDialog.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/commands/operations/add-plot.operation.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/commands/operations/add-table.operation.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/commands/operations/exit-preview.operation.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/commands/operations/insert-variable.operation.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/commands/operations/preview.operation.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/commands/operations/save-excel.operation.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/commands/operations/save-range.operation.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/formula-selection/CategoryList.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/formula-selection/FormulaSelection.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/formula-selection/VariableList.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/AddPlotIcon.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/AddTableIcon.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/ExitPreviewIcon.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/InsertVariableIcon.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/PreviewIcon.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/SaveAsCommonTemplateIcon.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/SaveAsTableTemplateIcon.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/SaveExcelIcon.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/SaveRangeIcon.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/EditLayout.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/TableColumnEdit.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/TableFilterPeaks.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/TableHeaderRowsEdit.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/TablePropertiesEdit.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/Tabs.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/VariableEdit.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/constant.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/controllers/menu/save-range.menu.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/controllers/menu/single-butten.menu.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/eventsListener.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/locale/en-US.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/locale/zh-CN.js diff --git a/src/BootstrapBlazor.Server/wwwroot/report/CustomerService.js b/src/BootstrapBlazor.Server/wwwroot/report/CustomerService.js deleted file mode 100644 index 62d7df1811d..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/CustomerService.js +++ /dev/null @@ -1,77 +0,0 @@ - -const { IResourceManagerService, setDependencies, IResourceLoaderService, IUniverInstanceService, Injector, FUniver } = UniverCore -const { UniverType } = UniverProtocol - -export class CustomerService { - _model = { - testResource: { - name: 'testResource', - value: 'testValue' - } - } - constructor( - _injector, - _resourceManagerService, - _univerInstanceService, - _resourceLoaderService, - ) { - console.log('CustomerService constructor'); - - this._injector = _injector; - - this._resourceManagerService = _resourceManagerService; - this._univerInstanceService = _univerInstanceService; - this._resourceLoaderService = _resourceLoaderService; - - this._resourceManagerService.registerPluginResource({ - toJson: (_unitId) => this._toJson(_unitId), - parseJson: (json) => this._parseJson(json), - pluginName: 'CustomerService', - businesses: [UniverType.UNIVER_SHEET, UniverType.UNIVER_DOC, UniverType.UNIVER_SLIDE], - onLoad: (_unitId, resource) => { - this._model = resource; - }, - onUnLoad: (_unitId) => { - console.log(_unitId, 'onUnLoad'); - this._model = {}; - }, - }); - } - - _toJson(_unitId) { - const model = this._model; - console.log('_toJson'); - return JSON.stringify(model); - } - - _parseJson(json) { - return JSON.parse(json); - } - _getResource() { - const workbook = this._univerInstanceService.getCurrentUnitForType(UniverType.UNIVER_SHEET) - const snapshot = this._resourceLoaderService.saveUnit(workbook.getUnitId()); - return snapshot.resources - } - - _setRangeValue(data = 'testValue001') { - const univerAPI = FUniver.newAPI(this._injector) - const range = univerAPI.getActiveWorkbook().getActiveSheet().getRange(5, 3, 2, 1) - range.setValue(data) - } - - receiveData(data) { - console.log(data); - - if (typeof (this.pushData) === 'function') { - this.pushData({ - messageName: 'CustomerService', - commandName: 'setRangeValue', - data: { - value: 1 - } - }); - } - } -} - -setDependencies(CustomerService, [Injector, IResourceManagerService, IUniverInstanceService, IResourceLoaderService]); diff --git a/src/BootstrapBlazor.Server/wwwroot/report/DataService.js b/src/BootstrapBlazor.Server/wwwroot/report/DataService.js new file mode 100644 index 00000000000..6ad38b86a90 --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/report/DataService.js @@ -0,0 +1,25 @@ + +const { IResourceManagerService, setDependencies, IResourceLoaderService, IUniverInstanceService, Injector, FUniver } = UniverCore +const { UniverType } = UniverProtocol + +export class DataService { + constructor( + _injector + ) { + this._injector = _injector; + } + receiveData(data) { + console.log(data); + if (typeof (this.pushData) === 'function') { + this.pushData({ + messageName: 'DataService', + commandName: 'setRangeValue', + data: { + value: 1 + } + }); + } + } +} + +setDependencies(DataService, [Injector]); diff --git a/src/BootstrapBlazor.Server/wwwroot/report/api/getData.js b/src/BootstrapBlazor.Server/wwwroot/report/api/getData.js deleted file mode 100644 index 82d576ca7e6..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/api/getData.js +++ /dev/null @@ -1,174 +0,0 @@ -const categoryList = [ - { - "TVOCReportObject": { - "desc": "TVOC信息", - "hasChannel": true - } - }, - { - "CustomReportObject": { - "desc": "Mock Report Object", - "hasChannel": true - } - }, - { - "Calibration": { - "desc": "Calibration Item", - "hasChannel": true - } - }, - { - "IntegralEvent": { - "desc": "Integral Event", - "hasChannel": true - } - }, - { - "PeakInfo": { - "desc": "Peak Results", - "hasChannel": true - } - }, - { - "ReportInfo": { - "desc": "Report Info", - "hasChannel": false - } - }, - { - "StatisticalResult": { - "desc": "Statistical Results", - "hasChannel": true - } - } -] - -export const getCategoryList = () => { - return categoryList.map(category => { - const key = Object.keys(category)[0]; - return { - value: key, - ...category[key] - } - }); -} - -export const getVariableList = (category) => { - const variableList = [ - { - "Client": { - "dataType": "string", - "desc": "委托单位", - "defaultFormat": null, - "unit": null, - "header": null - } - }, - { - "Testerj": { - "dataType": "string", - "desc": "检测单位", - "defaultFormat": null, - "unit": null, - "header": null - } - }, - { - "Tests": { - "dataType": "string", - "desc": "检测项目", - "defaultFormat": null, - "unit": null, - "header": null - } - }, - { - "Operator": { - "dataType": "string", - "desc": "分析人员", - "defaultFormat": null, - "unit": null, - "header": null - } - }, - { - "TestCondition": { - "dataType": "string", - "desc": "分析条件", - "defaultFormat": null, - "unit": null, - "header": null - } - }, - { - "Project": { - "dataType": "string", - "desc": "工程名称", - "defaultFormat": null, - "unit": null, - "header": null - } - }, - { - "Location": { - "dataType": "string", - "desc": "采样地点", - "defaultFormat": null, - "unit": null, - "header": null - } - }, - { - "SampleID": { - "dataType": "string", - "desc": "样品编号", - "defaultFormat": null, - "unit": null, - "header": null - } - }, - { - "DeviceID": { - "dataType": "string", - "desc": "设备编号", - "defaultFormat": null, - "unit": null, - "header": null - } - }, - { - "CalibCurve": { - "dataType": "string", - "desc": "标准曲线", - "defaultFormat": null, - "unit": null, - "header": null - } - }, - { - "Amount": { - "dataType": "string", - "desc": "TVOC含量", - "defaultFormat": null, - "unit": null, - "header": null - } - }, - { - "Summary": { - "dataType": "string", - "desc": "总结", - "defaultFormat": null, - "unit": null, - "header": null - } - } - ] - return variableList.map(variable => { - const key = Object.keys(variable)[0]; - return { - value: category.value + '_' + key, - ...variable[key] - } - }); -} \ No newline at end of file diff --git a/src/BootstrapBlazor.Server/wwwroot/report/api/reportApis.js b/src/BootstrapBlazor.Server/wwwroot/report/api/reportApis.js deleted file mode 100644 index d226813da8c..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/api/reportApis.js +++ /dev/null @@ -1,91 +0,0 @@ -import { getCategoryList, getVariableList } from './getData.js'; - -const { IDialogService } = UniverUi; -const { useState } = React; -const { IUniverInstanceService, Injector, FUniver, UniverInstanceService } = UniverCore - -export function insertVariable({cellData} = {}) { - const categoryList = getCategoryList(); - console.log('insertVariable', cellData); - console.log(IUniverInstanceService) - - const injector = new Injector([ - [UniverInstanceService], - ]); - - // const instance = injector.get(UniverInstanceService) - // console.log(instance, 'instance') - if(!cellData){ - const sheet = univerAPI.getActiveWorkbook().getActiveSheet(); - cellData = sheet.getSelection().getActiveRange().getCellData() || {}; - } - univerAPI.executeCommand('report.open-formula-dialog', {categoryList, cellData}) -} -export function editVariableAndTable({cellData}) { - const variable = cellData.custom?.variable; - const params = { - tabs: [ - {key: 0, title: 'Variable'}, - {key: 1, title: 'Table Column'}, - {key: 2, title: 'Filter Peaks'}, - {key: 3, title: 'Header Rows'}, - {key: 4, title: 'Table Properties'} - ], - contentList: [ - {key: 0, component: 'VariableEdit'}, - {key: 1, component: 'TableColumnEdit'}, - {key: 2, component: 'TableFilterPeaks'}, - {key: 3, component: 'TableHeaderRowsEdit'}, - {key: 4, component: 'TablePropertiesEdit'} - ] - } - - univerAPI.executeCommand('report.open-edit-dialog', {...params, cellData}) -} -export function preview() { - const activeWorkbook = univerAPI.getActiveWorkbook(); - const activeSheet = activeWorkbook.getActiveSheet(); - const snapshot = activeWorkbook.save() - const sheet1 = Object.values(snapshot.sheets).find((sheet) => { - return sheet.name === 'sheet1' - }) - const data = sheet1.cellData - Object.keys(data).forEach(rowIndex => { - Object.keys(data[rowIndex]).forEach(columnIndex => { - if(data[rowIndex][columnIndex].custom?.variable){ - const range = activeSheet.getRange(rowIndex * 1, columnIndex * 1, 1, 1) - range.setValue({ - v: data[rowIndex][columnIndex].custom.variable.desc || '预览数据', - custom: data[rowIndex][columnIndex].custom, - }); - } - }) - }) -} -// 保存数据 -export function saveExcel() { - const activeWorkbook = univerAPI.getActiveWorkbook(); - const activeSheet = activeWorkbook.getActiveSheet(); - const snapshot = activeWorkbook.save() - return snapshot -} - -// 保存选取数据 -export function saveSelectionData(saveType = 'table') { - const activeSheet = univerAPI.getActiveWorkbook().getActiveSheet(); - const selection = activeSheet.getSelection(); - const range = selection.getActiveRange(); - const data = range.getCellDataGrid(); - - console.log('saveSelectedData', data); - localStorage.setItem('table01', JSON.stringify(data)); -} - -// 添加表格 -export function addTable() { - const activeSheet = univerAPI.getActiveWorkbook().getActiveSheet(); - // const selection = activeSheet.getSelection(); - // const range = selection.getActiveRange(); - console.log('addTable', univerAPI.getActiveWorkbook().getSnapshot()); - -} diff --git a/src/BootstrapBlazor.Server/wwwroot/report/api/sheetApis.js b/src/BootstrapBlazor.Server/wwwroot/report/api/sheetApis.js deleted file mode 100644 index a4ea70c4206..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/api/sheetApis.js +++ /dev/null @@ -1,24 +0,0 @@ - - -export const setRange = ({value}, setRangeAfter = () => {}) => { - const sheet = univerAPI.getActiveWorkbook().getActiveSheet(); - const selectRange = sheet.getSelection().getActiveRange(); - console.log(value, 'value'); - selectRange.setValue(value); - setRangeAfter(); -} - -export function setRichTextValue() { - const range = univerAPI.getActiveWorkbook() - .getActiveSheet() - .getActiveRange(); - - // 创建富文本并插入文本 - const richText = univerAPI.newRichText() - .insertText('Hello\rWorld'); - - // 设置富文本值 - range.setRichTextValueForCell(richText); -} - -// setTimeout(setRichTextValue, 5000) \ No newline at end of file diff --git a/src/BootstrapBlazor.Server/wwwroot/report/canvasExtension/main-extension.js b/src/BootstrapBlazor.Server/wwwroot/report/canvasExtension/main-extension.js deleted file mode 100644 index 7df724c25a5..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/canvasExtension/main-extension.js +++ /dev/null @@ -1,99 +0,0 @@ -const { DEFAULT_FONTFACE_PLANE, FIX_ONE_PIXEL_BLUR_OFFSET, getColor, MIDDLE_CELL_POS_MAGIC_NUMBER, SheetExtension } = UniverEngineRender - -const UNIQUE_KEY = 'MainCustomExtension' -// const customEmojiList = ['🥳'] -export class MainCustomExtension extends SheetExtension { - uKey = UNIQUE_KEY - - // Must be greater than 50 - get zIndex() { - return 50 - } - - draw(ctx, _parentScale, spreadsheetSkeleton) { - const { rowColumnSegment } = spreadsheetSkeleton - const { startRow, endRow, startColumn, endColumn } = rowColumnSegment - if (!spreadsheetSkeleton) { - return - } - - // Only displayed on the specified sheet - if (spreadsheetSkeleton.worksheet.getSheetId() !== 'sheet1') { - // return - } - - const { rowHeightAccumulation, columnTotalWidth, columnWidthAccumulation, rowTotalHeight, _cellData } = spreadsheetSkeleton - const sheetData = _cellData.getData() - if ( - !rowHeightAccumulation - || !columnWidthAccumulation - || columnTotalWidth === undefined - || rowTotalHeight === undefined - ) { - return - } - - ctx.fillStyle = getColor([248, 249, 250]) - ctx.textAlign = 'center' - ctx.textBaseline = 'middle' - ctx.fillStyle = getColor([0, 0, 0]) - ctx.beginPath() - ctx.lineWidth = 1 - - ctx.translateWithPrecisionRatio(FIX_ONE_PIXEL_BLUR_OFFSET, FIX_ONE_PIXEL_BLUR_OFFSET) - - ctx.strokeStyle = getColor([217, 217, 217]) - ctx.font = `13px ${DEFAULT_FONTFACE_PLANE}` - let preRowPosition = 0 - const rowHeightAccumulationLength = rowHeightAccumulation.length - for (let r = startRow - 1; r <= endRow; r++) { - if (r < 0 || r > rowHeightAccumulationLength - 1) { - continue - } - const rowEndPosition = rowHeightAccumulation[r] - if (preRowPosition === rowEndPosition) { - // Skip hidden rows - continue - } - - let preColumnPosition = 0 - const columnWidthAccumulationLength = columnWidthAccumulation.length - for (let c = startColumn - 1; c <= endColumn; c++) { - if (c < 0 || c > columnWidthAccumulationLength - 1) { - continue - } - - const columnEndPosition = columnWidthAccumulation[c] - if (preColumnPosition === columnEndPosition) { - // Skip hidden columns - continue - } - - // painting cell background - if (sheetData[r]?.[c]?.custom?.variable) { - ctx.fillStyle = '#e4393c' - strokeTriangle(ctx, preColumnPosition, preRowPosition, columnEndPosition, rowEndPosition) - } - - // painting cell text - // const middleCellPosX = preColumnPosition + (columnEndPosition - preColumnPosition) / 2 - // const middleCellPosY = preRowPosition + (rowEndPosition - preRowPosition) / 2 - // customEmojiList[c] && ctx.fillText(customEmojiList[c], middleCellPosX + 20, middleCellPosY + MIDDLE_CELL_POS_MAGIC_NUMBER) // Magic number 1, because the vertical alignment appears to be off by 1 pixel - - preColumnPosition = columnEndPosition - } - - preRowPosition = rowEndPosition - } - ctx.fill() - } -} - -// 画三角形 -function strokeTriangle(ctx, str, stc, endr, endc) { - ctx.moveTo(endr, stc) - ctx.lineTo(endr - 6, stc) - ctx.lineTo(endr, stc + 6) - ctx.lineTo(endr, stc) -} - \ No newline at end of file diff --git a/src/BootstrapBlazor.Server/wwwroot/report/commands/openEditDialog.js b/src/BootstrapBlazor.Server/wwwroot/report/commands/openEditDialog.js deleted file mode 100644 index 046376d15eb..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/commands/openEditDialog.js +++ /dev/null @@ -1,26 +0,0 @@ -import { EDIT_DIALOG, INSERT_VARIABLE_DIALOG } from '../constant.js' - -const { CommandType, ICommandService, IUniverInstanceService, IContextService} = UniverCore; -const { IDialogService } = UniverUi; - -export const OpenEditDialogCommand = { - id: 'report.open-edit-dialog', - type: CommandType.OPERATION, - handler: async (accessor, params = {}) => { - const dialogService = accessor.get(IDialogService); - const closeDialog = () => dialogService.close(EDIT_DIALOG); - closeDialog(); - const dialog = dialogService.open({ - id: EDIT_DIALOG, - title: { title: 'Edit Variable and Table' }, - children: { label: 'EditLayout', ...params, closeDialog }, - // footer: { title: 'Insert' }, - width: 650, - draggable: true, - resizable: true, - destroyOnClose: true, - preservePositionOnDestroy: true, - onClose: closeDialog, - }); - }, -}; \ No newline at end of file diff --git a/src/BootstrapBlazor.Server/wwwroot/report/commands/openFormulaDialog.js b/src/BootstrapBlazor.Server/wwwroot/report/commands/openFormulaDialog.js deleted file mode 100644 index 87b2804c334..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/commands/openFormulaDialog.js +++ /dev/null @@ -1,28 +0,0 @@ -import { insertVariable } from '../api/reportApis.js' -import { INSERT_VARIABLE_DIALOG } from '../constant.js' -const { CommandType, ICommandService, IUniverInstanceService, IContextService} = UniverCore; -const { IDialogService } = UniverUi; - -export const OpenFormulaDialogCommand = { - id: 'report.open-formula-dialog', - type: CommandType.OPERATION, - handler: async (accessor, params = {}) => { - const dialogService = accessor.get(IDialogService); - const closeDialog = () => dialogService.close(INSERT_VARIABLE_DIALOG); - closeDialog() - console.log('OpenFormulaDialogCommand', params); - const title = params.cellData?.custom?.variable ? 'Edit Variable' : 'Insert Variable'; - const dialog = dialogService.open({ - id: INSERT_VARIABLE_DIALOG, - title: { title }, - children: { label: 'FormulaSelection', ...params, closeDialog }, - // footer: { title: 'Insert' }, - width: 650, - draggable: true, - resizable: true, - destroyOnClose: true, - preservePositionOnDestroy: true, - onClose: closeDialog, - }); - }, -}; diff --git a/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/add-plot.operation.js b/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/add-plot.operation.js deleted file mode 100644 index 3e669a99f28..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/add-plot.operation.js +++ /dev/null @@ -1,16 +0,0 @@ -import { insertVariable } from '../../api/reportApis.js' - -const { CommandType, IConfigService } = UniverCore; -const { IMenuManagerService } = UniverUi; - -export const AddPlotOperation = { - id: 'report.operation.add-plot', - type: CommandType.OPERATION, - handler: async (accessor) => { - const menuManagerService = accessor.get(IMenuManagerService); - const configService = accessor.get(IConfigService) - console.log(menuManagerService, 'menuManagerService'); - console.log(configService, 'configService'); - alert('AddPlotOperation'); - }, -}; diff --git a/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/add-table.operation.js b/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/add-table.operation.js deleted file mode 100644 index 56074d94093..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/add-table.operation.js +++ /dev/null @@ -1,11 +0,0 @@ -import { addTable } from '../../api/reportApis.js' - -const { CommandType } = UniverCore; - -export const AddTableOperation = { - id: 'report.operation.add-table', - type: CommandType.OPERATION, - handler: async (accessor) => { - addTable() - }, -}; diff --git a/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/exit-preview.operation.js b/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/exit-preview.operation.js deleted file mode 100644 index 3fab5308841..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/exit-preview.operation.js +++ /dev/null @@ -1,11 +0,0 @@ -import { preview } from '../../api/reportApis.js' - -const { CommandType } = UniverCore; -export const ExitPreviewOperation = { - id: 'report.operation.exit-preview', - type: CommandType.OPERATION, - handler: async (accessor) => { - alert('Exit Preview') - return true; - }, -}; diff --git a/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/insert-variable.operation.js b/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/insert-variable.operation.js deleted file mode 100644 index 62d80da2057..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/insert-variable.operation.js +++ /dev/null @@ -1,18 +0,0 @@ -import { insertVariable } from '../../api/reportApis.js' - -const { CommandType, ICommandService, IUniverInstanceService, IContextService} = UniverCore; -const { IDialogService } = UniverUi; - -export const InsertVariableOperation = { - id: 'report.operation.insert-variable', - type: CommandType.OPERATION, - handler: async (accessor) => { - const commandService = accessor.get(ICommandService); - const univerInstanceService = accessor.get(IUniverInstanceService); - const wb = univerInstanceService.getFocusedUnit().getActiveSheet().getRange(0,0,1,1) - const dialogService = accessor.get(IDialogService); - console.log(dialogService.getDialogs$()); - console.log(dialogService.valueOf(), 'dialogService'); - insertVariable() - }, -}; diff --git a/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/preview.operation.js b/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/preview.operation.js deleted file mode 100644 index 032711ae3a3..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/preview.operation.js +++ /dev/null @@ -1,11 +0,0 @@ -import { preview } from '../../api/reportApis.js' - -const { CommandType } = UniverCore; -export const PreviewOperation = { - id: 'report.operation.preview', - type: CommandType.OPERATION, - handler: async (accessor) => { - preview() - return true; - }, -}; diff --git a/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/save-excel.operation.js b/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/save-excel.operation.js deleted file mode 100644 index 81e572281ff..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/save-excel.operation.js +++ /dev/null @@ -1,11 +0,0 @@ -import { saveExcel } from '../../api/reportApis.js' - -const { CommandType } = UniverCore; -export const SaveExcelOperation = { - id: 'report.operation.save-excel', - type: CommandType.OPERATION, - handler: async (accessor) => { - console.log(saveExcel()); - return true; - }, -}; diff --git a/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/save-range.operation.js b/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/save-range.operation.js deleted file mode 100644 index 9b79ff0aee6..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/commands/operations/save-range.operation.js +++ /dev/null @@ -1,19 +0,0 @@ -import { saveSelectionData } from '../../api/reportApis.js'; - -const { CommandType } = UniverCore; -export const SaveAsTableTemplateOperation = { - id: 'report.operation.save-as-table-template', - type: CommandType.OPERATION, - handler: async (accessor) => { - saveSelectionData() - return true; - }, -}; -export const SaveAsCommonTemplateOperation = { - id: 'report.operation.save-as-common-template', - type: CommandType.OPERATION, - handler: async (accessor) => { - saveSelectionData() - return true; - }, -}; diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/formula-selection/CategoryList.js b/src/BootstrapBlazor.Server/wwwroot/report/components/formula-selection/CategoryList.js deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/formula-selection/FormulaSelection.js b/src/BootstrapBlazor.Server/wwwroot/report/components/formula-selection/FormulaSelection.js deleted file mode 100644 index f1b36d36fc2..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/components/formula-selection/FormulaSelection.js +++ /dev/null @@ -1,128 +0,0 @@ -import { getCategoryList, getVariableList } from '../../api/getData.js'; -import { setRange } from '../../api/sheetApis.js'; -import { editVariableAndTable } from '../../api/reportApis.js' - -const { useState, useEffect, createElement: c } = React; -export function FormulaSelection(props) { - const { categoryList, closeDialog, cellData } = props; - const { category, value: variable } = cellData.custom?.variable || {}; - const [ formula, setFormula ] = useState(''); - const [currentCategoryIndex, setCurrentCategoryIndex] = useState(findIndex(categoryList, item => item.value == category)); - const [variableList, setVariableList] = useState(getVariableList(categoryList[currentCategoryIndex])); - const [ currentVariableIndex, setCurrentVariableIndex ] = useState(findIndex(variableList, item => item.value == variable)); - - const handleCategoryClick = (category, index) => { - return e => { - if (currentCategoryIndex == index) return; - setVariableList(getVariableList(category)); - setCurrentCategoryIndex(index); - setCurrentVariableIndex(0); - } - } - const handleVariableClick = (variable, index) => { - return e => { - setCurrentVariableIndex(index); - } - } - const handleInsertFormula = () => { - const cc = categoryList[currentCategoryIndex] - const cellData = { - v: formula, - custom: { - variable: { - formula, - category: cc.value, - categoryDesc: cc.desc, - hasChannel: cc.hasChannel, - ...variableList[currentVariableIndex] - }, - } - } - setRange({ - value: cellData, - range: null, - sheet: null, - }, () => { - closeDialog() - const editEle = document.querySelector('.bb-edit-container') - if (editEle) { - editVariableAndTable({cellData}) - } - }) - } - - useEffect(() => { - const categoryIndex = findIndex(categoryList, item => item.value == category); - setCurrentCategoryIndex(categoryIndex); - - const varList = getVariableList(categoryList[categoryIndex]); - const varIndex = findIndex(varList, item => item.value == variable); - setVariableList(varList); - setCurrentVariableIndex(varIndex); - }, [cellData.custom?.variable]) - - useEffect(() => { - setFormula(categoryList[currentCategoryIndex].value + '.' + variableList[currentVariableIndex]?.value) - }, [currentCategoryIndex, currentVariableIndex]) - - return c( - 'div', - { className: 'bb-formula-selection' }, - c( - 'div', - { }, - c( - 'ul', - { className: 'bb-category-list' }, - ...categoryList.map((category, index) => { - return c( - 'li', - { - key: index, - className: currentCategoryIndex == index ? 'active' : '', - title: category.value, - onClick: handleCategoryClick(category, index), - }, - category.value, - c('span', {}, category.desc) - ) - }) - ), - c( - 'ul', - { className: 'bb-variable-list' }, - ...variableList.map((variable, index) => { - return React.createElement( - 'li', - { - key: index, - className: currentVariableIndex == index ? 'active' : '', - title: variable.value, - onClick: handleVariableClick(variable, index), - onDoubleClick: e => { - handleInsertFormula() - } - }, - variable.value, - c('span', {}, variable.desc) - ) - }) - ), - ), - c( - 'input', - { type: 'text', disabled: true, value: formula }, - ), - c( - 'button', - { onClick: handleInsertFormula }, - `${(cellData.custom?.variable || cellData.custom?.table) ? 'OK' : 'Insert'}` - ) - ) - -} - -function findIndex(arr, p) { - const index = arr.findIndex(p); - return index === -1 ? 0 : index; -} diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/formula-selection/VariableList.js b/src/BootstrapBlazor.Server/wwwroot/report/components/formula-selection/VariableList.js deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/AddPlotIcon.js b/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/AddPlotIcon.js deleted file mode 100644 index b6b469d85f8..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/AddPlotIcon.js +++ /dev/null @@ -1,10 +0,0 @@ -export function AddPlotIcon() { - return React.createElement( - 'svg', - { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24" }, - React.createElement( - 'path', - { fill: "currentColor", d: "M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12S6.477 2 12 2m.16 14a6.981 6.981 0 0 0-5.147 2.256A7.966 7.966 0 0 0 12 20a7.97 7.97 0 0 0 5.167-1.892A6.979 6.979 0 0 0 12.16 16M12 4a8 8 0 0 0-6.384 12.821A8.975 8.975 0 0 1 12.16 14a8.972 8.972 0 0 1 6.362 2.634A8 8 0 0 0 12 4m0 1a4 4 0 1 1 0 8a4 4 0 0 1 0-8m0 2a2 2 0 1 0 0 4a2 2 0 0 0 0-4" } - ) - ); -} diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/AddTableIcon.js b/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/AddTableIcon.js deleted file mode 100644 index b7244103c83..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/AddTableIcon.js +++ /dev/null @@ -1,10 +0,0 @@ -export function AddTableIcon() { - return React.createElement( - 'svg', - { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24" }, - React.createElement( - 'path', - { fill: "currentColor", d: "M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12S6.477 2 12 2m.16 14a6.981 6.981 0 0 0-5.147 2.256A7.966 7.966 0 0 0 12 20a7.97 7.97 0 0 0 5.167-1.892A6.979 6.979 0 0 0 12.16 16M12 4a8 8 0 0 0-6.384 12.821A8.975 8.975 0 0 1 12.16 14a8.972 8.972 0 0 1 6.362 2.634A8 8 0 0 0 12 4m0 1a4 4 0 1 1 0 8a4 4 0 0 1 0-8m0 2a2 2 0 1 0 0 4a2 2 0 0 0 0-4" } - ) - ); -} diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/ExitPreviewIcon.js b/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/ExitPreviewIcon.js deleted file mode 100644 index 42882b26397..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/ExitPreviewIcon.js +++ /dev/null @@ -1,10 +0,0 @@ -export function ExitPreviewIcon() { - return React.createElement( - 'svg', - { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24" }, - React.createElement( - 'path', - { fill: "currentColor", d: "M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12S6.477 2 12 2m.16 14a6.981 6.981 0 0 0-5.147 2.256A7.966 7.966 0 0 0 12 20a7.97 7.97 0 0 0 5.167-1.892A6.979 6.979 0 0 0 12.16 16M12 4a8 8 0 0 0-6.384 12.821A8.975 8.975 0 0 1 12.16 14a8.972 8.972 0 0 1 6.362 2.634A8 8 0 0 0 12 4m0 1a4 4 0 1 1 0 8a4 4 0 0 1 0-8m0 2a2 2 0 1 0 0 4a2 2 0 0 0 0-4" } - ) - ); -} diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/InsertVariableIcon.js b/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/InsertVariableIcon.js deleted file mode 100644 index a4908bbc4da..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/InsertVariableIcon.js +++ /dev/null @@ -1,15 +0,0 @@ -export function InsertVariableIcon() { - return React.createElement( - 'svg', - { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24" }, - React.createElement( - 'path', - { fill: "currentColor", d: "M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12S6.477 2 12 2m.16 14a6.981 6.981 0 0 0-5.147 2.256A7.966 7.966 0 0 0 12 20a7.97 7.97 0 0 0 5.167-1.892A6.979 6.979 0 0 0 12.16 16M12 4a8 8 0 0 0-6.384 12.821A8.975 8.975 0 0 1 12.16 14a8.972 8.972 0 0 1 6.362 2.634A8 8 0 0 0 12 4m0 1a4 4 0 1 1 0 8a4 4 0 0 1 0-8m0 2a2 2 0 1 0 0 4a2 2 0 0 0 0-4" } - ) - ); - // return ( - // - // - // - // ); -} diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/PreviewIcon.js b/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/PreviewIcon.js deleted file mode 100644 index d1b43982086..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/PreviewIcon.js +++ /dev/null @@ -1,10 +0,0 @@ -export function PreviewIcon() { - return React.createElement( - 'svg', - { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24" }, - React.createElement( - 'path', - { fill: "currentColor", d: "M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12S6.477 2 12 2m.16 14a6.981 6.981 0 0 0-5.147 2.256A7.966 7.966 0 0 0 12 20a7.97 7.97 0 0 0 5.167-1.892A6.979 6.979 0 0 0 12.16 16M12 4a8 8 0 0 0-6.384 12.821A8.975 8.975 0 0 1 12.16 14a8.972 8.972 0 0 1 6.362 2.634A8 8 0 0 0 12 4m0 1a4 4 0 1 1 0 8a4 4 0 0 1 0-8m0 2a2 2 0 1 0 0 4a2 2 0 0 0 0-4" } - ) - ); -} diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/SaveAsCommonTemplateIcon.js b/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/SaveAsCommonTemplateIcon.js deleted file mode 100644 index 44122a1678a..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/SaveAsCommonTemplateIcon.js +++ /dev/null @@ -1,18 +0,0 @@ -export function SaveAsCommonTemplateIcon() { - return React.createElement( - 'svg', - { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 14 14" }, - React.createElement( - 'g', - { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }, - React.createElement( - 'path', - { d: "M11.27 13.5H2.73a2 2 0 0 1-2-2.22l.67-5.89a1 1 0 0 1 1-.89h9.2a1 1 0 0 1 1 .89l.65 5.89a2 2 0 0 1-1.98 2.22Z" } - ), - React.createElement( - 'path', - { d: "M3 4.5a4 4 0 0 1 8 0m-6.5 3h5" } - ) - ) - ); -}; diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/SaveAsTableTemplateIcon.js b/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/SaveAsTableTemplateIcon.js deleted file mode 100644 index c828158e90e..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/SaveAsTableTemplateIcon.js +++ /dev/null @@ -1,18 +0,0 @@ -export function SaveAsTableTemplateIcon() { - return React.createElement( - 'svg', - { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 14 14" }, - React.createElement( - 'g', - { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }, - React.createElement( - 'path', - { d: "M11.27 13.5H2.73a2 2 0 0 1-2-2.22l.67-5.89a1 1 0 0 1 1-.89h9.2a1 1 0 0 1 1 .89l.65 5.89a2 2 0 0 1-1.98 2.22Z" } - ), - React.createElement( - 'path', - { d: "M3 4.5a4 4 0 0 1 8 0m-6.5 3h5" } - ) - ) - ); -}; diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/SaveExcelIcon.js b/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/SaveExcelIcon.js deleted file mode 100644 index a9b8d5a2c88..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/SaveExcelIcon.js +++ /dev/null @@ -1,10 +0,0 @@ -export function SaveExcelIcon() { - return React.createElement( - 'svg', - { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24" }, - React.createElement( - 'path', - { fill: "currentColor", d: "M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12S6.477 2 12 2m.16 14a6.981 6.981 0 0 0-5.147 2.256A7.966 7.966 0 0 0 12 20a7.97 7.97 0 0 0 5.167-1.892A6.979 6.979 0 0 0 12.16 16M12 4a8 8 0 0 0-6.384 12.821A8.975 8.975 0 0 1 12.16 14a8.972 8.972 0 0 1 6.362 2.634A8 8 0 0 0 12 4m0 1a4 4 0 1 1 0 8a4 4 0 0 1 0-8m0 2a2 2 0 1 0 0 4a2 2 0 0 0 0-4" } - ) - ); -} diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/SaveRangeIcon.js b/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/SaveRangeIcon.js deleted file mode 100644 index 7f7ab6809f3..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/components/menus-icon/SaveRangeIcon.js +++ /dev/null @@ -1,10 +0,0 @@ -export function SaveRangeIcon() { - return React.createElement( - 'svg', - { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24" }, - React.createElement( - 'path', - { fill: "currentColor", d: "m12 11.6l2.5 2.5q.275.275.275.7t-.275.7t-.7.275t-.7-.275l-2.8-2.8q-.15-.15-.225-.337T10 11.975V8q0-.425.288-.712T11 7t.713.288T12 8zM18 6h-2q-.425 0-.712-.287T15 5t.288-.712T16 4h2V2q0-.425.288-.712T19 1t.713.288T20 2v2h2q.425 0 .713.288T23 5t-.288.713T22 6h-2v2q0 .425-.288.713T19 9t-.712-.288T18 8zm-7 15q-1.875 0-3.512-.7t-2.863-1.925T2.7 15.512T2 12t.7-3.512t1.925-2.863T7.488 3.7T11 3q.275 0 .513.013t.512.062q.425 0 .713.288t.287.712t-.288.713t-.712.287q-.275 0-.513-.038T11 5Q8.05 5 6.025 7.025T4 12t2.025 4.977T11 19t4.975-2.025T18 12q0-.425.288-.712T19 11t.713.288T20 12q0 1.875-.7 3.513t-1.925 2.862t-2.863 1.925T11 21" } - ) - ); -}; diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/EditLayout.js b/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/EditLayout.js deleted file mode 100644 index 4b2786fd09b..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/EditLayout.js +++ /dev/null @@ -1,33 +0,0 @@ -import { Tabs } from './Tabs.js' -import { VariableEdit } from './VariableEdit.js' -import { TableColumnEdit } from './TableColumnEdit.js' -import { TableFilterPeaks } from './TableFilterPeaks.js' -import { TableHeaderRowsEdit } from './TableHeaderRowsEdit.js' -import { TablePropertiesEdit } from './TablePropertiesEdit.js' - -const { useState, useEffect, createElement: c } = React; -const componentMap = { - VariableEdit, - TableColumnEdit, - TableFilterPeaks, - TableHeaderRowsEdit, - TablePropertiesEdit, -} - -export function EditLayout(props) { - const { cellData, tabs, contentList } = props - const [activeTabIndex, setActiveTabIndex] = useState(0); - const getContentComponent = (content) => componentMap[content.component]; - - return c( - 'div', - { className: 'bb-edit-container' }, - c(Tabs, { tabs, activeTabIndex, setActiveTabIndex }), - c( - getContentComponent(contentList[activeTabIndex]), - { - cellData - } - ), - ); -} diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/TableColumnEdit.js b/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/TableColumnEdit.js deleted file mode 100644 index 7f442468e9f..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/TableColumnEdit.js +++ /dev/null @@ -1,157 +0,0 @@ - -const { useState } = React; -export function TableColumnEdit(props) { - const { content } = props; - console.log(content); - return React.createElement( - 'div', - { className: 'bb-edit-content', style: { display: 'block' } }, - React.createElement( - 'h2', - { className: 'bb-edit-title' }, - 'Report Column' - ), - React.createElement( - 'div', - { className: 'management' }, - React.createElement( - 'h3', - null, - 'Column Management' - ), - React.createElement( - 'div', - null, - React.createElement( - 'button', - { id: 'addColumn', title: 'Insert a new column' }, - React.createElement( - 'svg', - { t: '1713868541570', className: 'icon', viewBox: '0 0 1024 1024', version: '1.1', xmlns: 'http://www.w3.org/2000/svg', pId: '3010', width: '19', height: '19' }, - React.createElement( - 'path', - { d: 'M906.6124654 484.96676768H747.99379616V114.87697753h158.61866923v370.08979015M959.52623131 537.79469433V62H695.12908112v475.79469433zM589.38738942 960.85956464h52.86471417V220.61866924H377.89174265V960.85956464h211.49564677zM325.0270276 220.61866924H60.66666667V960.85956464h52.87697754V273.48338427h158.60640674V960.85956464h52.87697665zM854.27504928 960.85956464l115.78488398-115.79714735L932.54818112 807.48935175l-78.77590489 78.77590489v-242.67981973h-52.90150253v242.67981973l-78.77590576-78.77590489-37.54853965 37.53627716L800.34347477 960.85956464l0.52729893-0.52729891v0.52729891h52.87697666v-0.52729891z', fill: '#333333', pId: '3011' }, - null - ) - ) - ), - React.createElement( - 'button', - { id: 'deleteColumn', title: 'Remove the selected column' }, - React.createElement( - 'svg', - { t: '1713868654744', className: 'icon', viewBox: '0 0 1024 1024', version: '1.1', xmlns: 'http://www.w3.org/2000/svg', pId: '3728', width: '20', height: '20' }, - React.createElement( - 'path', - { d: 'M371.4048 544.88576h286.12096V29.88032H371.4048v515.00544z m228.8896-457.79456v400.56832h-171.6736V87.0912h171.6736zM514.46272 900.2496l102.43072 102.43072h37.77024l2.86208-2.86208V962.048l-102.43072-102.43072 102.43072-102.43584v-37.76512l-2.86208-2.86208h-37.77024l-102.43072 102.43072-102.43072-102.43072h-37.77024l-2.86208 2.86208v37.76512l102.43072 102.43584L371.4048 962.048v37.77024l2.86208 2.86208h37.77024l102.4256-102.43072z m0 0', fill: '#09958D', pId: '3729' }, - null - ), - React.createElement( - 'path', - { d: 'M85.28384 258.7648h171.6736v743.91552h57.22112V201.53856H28.0576v801.14176h57.22624zM714.752 1002.68032h57.216V258.7648h171.6736v743.91552h57.216V201.53856H714.752z', fill: '#4A4B4B', pId: '3730' }, - null - ), - React.createElement( - 'path', - { d: 'M657.52064 719.42144v-2.86208h-2.85696zM657.52064 1002.68032v-2.86208l-2.85696 2.86208zM371.4048 1002.68032h2.86208l-2.86208-2.86208zM371.4048 719.42144l2.86208-2.86208h-2.86208z', fill: '#444A5C', pId: '3731' }, - null - ) - ) - ) - ) - ), - React.createElement( - 'div', - null, - React.createElement( - 'h3', - null, - 'Column Properties' - ), - React.createElement( - 'div', - null, - React.createElement( - 'label', - { htmlFor: 'variableFormula' }, - 'Formula' - ), - React.createElement( - 'input', - { type: 'text', autoComplete: 'off', name: 'variableFormula', id: 'variableFormula' }, - null - ) - ), - React.createElement( - 'div', - null, - React.createElement( - 'label', - { htmlFor: 'columnHeader' }, - 'Header' - ), - React.createElement( - 'input', - { type: 'text', name: 'Header', id: 'columnHeader' }, - null - ) - ), - React.createElement( - 'div', - null, - React.createElement( - 'label', - { htmlFor: 'columnUnit' }, - 'Unit' - ), - React.createElement( - 'input', - { type: 'text', name: 'Unit', id: 'columnUnit' }, - null - ) - ), - React.createElement( - 'div', - { style: { display: 'none' } }, - React.createElement( - 'label', - { htmlFor: 'columnFormat' }, - 'Format' - ), - React.createElement( - 'input', - { type: 'text', name: 'Format', id: 'columnFormat' }, - null - ) - ), - React.createElement( - 'div', - { style: { display: 'block' } }, - React.createElement( - 'label', - { htmlFor: 'variableChannel' }, - 'Channel' - ), - React.createElement( - 'select', - { name: 'channel', id: 'variableChannel' }, - React.createElement( - 'option', - { value: '' }, - '' - ), - React.createElement( - 'option', - { value: '' }, - '' - ), - React.createElement( - 'option', - { value: 'TCD1' }, - 'TCD1' - ) - ) - ) - ) - ); -} diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/TableFilterPeaks.js b/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/TableFilterPeaks.js deleted file mode 100644 index 42478f03853..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/TableFilterPeaks.js +++ /dev/null @@ -1,82 +0,0 @@ - -const { useState } = React; - -export function TableFilterPeaks(props) { - const { content } = props; - console.log(content); - return React.createElement( - 'div', - { class: 'bb-edit-content filter-peaks', style: { display: 'block' } }, - React.createElement('h2', { className: 'bb-edit-title' }, 'Filter Peaks'), - React.createElement( - 'div', - { class: 'include-peaks' }, - React.createElement('h3', {}, 'Include Peaks'), - React.createElement( - 'div', - {}, - React.createElement('input', { type: 'checkbox', name: 'IdentifiedPeaks', id: 'IdentifiedPeaks' }), - React.createElement('label', { htmlFor: 'IdentifiedPeaks' }, 'Identified Peaks') - ), - React.createElement( - 'div', - {}, - React.createElement('input', { type: 'checkbox', name: 'UnidentifiedPeaks', id: 'UnidentifiedPeaks' }), - React.createElement('label', { htmlFor: 'UnidentifiedPeaks' }, 'Unidentified Peaks') - ), - React.createElement( - 'div', - {}, - React.createElement('input', { type: 'checkbox', name: 'UndetectedComponent', id: 'UndetectedComponent' }), - React.createElement('label', { htmlFor: 'UndetectedComponent' }, 'Undetected Component') - ) - ), - React.createElement( - 'div', - { class: 'custom-conditions mask' }, - React.createElement('h3', {}, 'Custom Conditions'), - React.createElement( - 'div', - {}, - React.createElement('input', { type: 'checkbox', name: 'CustomConditionsCheck', id: 'CustomConditionsCheck' }), - React.createElement('label', { htmlFor: 'CustomConditionsCheck' }, 'Only include peaks that match the following conditions') - ), - React.createElement( - 'div', - {}, - 'Match ', - React.createElement( - 'select', - { className: 'match-type', name: 'anyOrAll', id: 'anyOrAll' }, - React.createElement('option', { value: 'ALL' }, 'ALL'), - React.createElement('option', { value: 'ANY' }, 'ANY') - ), - ' of the following rules:' - ), - React.createElement( - 'div', - { id: 'validWrapper', class: 'bb-valid-wrapper' }, - React.createElement( - 'ul', - {}, - React.createElement( - 'li', - {}, - React.createElement('input', { type: 'text', class: 'variable', onfocus: () => fpFocusHandle(this) }), - React.createElement('select', { class: 'action', onchange: () => fpChangeHandle(this) }), - React.createElement('input', { type: 'text', class: 'valid-value', onblur: () => fpBlurHandle(this) }), - React.createElement('button', { class: 'addValid' }, '+'), - React.createElement('button', { class: 'deleteValid' }, '-') - ) - ) - ), - React.createElement( - 'div', - {}, - React.createElement('button', { id: 'addGroupBtn' }, 'and'), - React.createElement('button', { style: { float: 'right', display: 'none' }, id: 'filterBtn' }, ' Submit filtering rules ') - ) - ) - ); -} - diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/TableHeaderRowsEdit.js b/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/TableHeaderRowsEdit.js deleted file mode 100644 index 92c6f1e5785..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/TableHeaderRowsEdit.js +++ /dev/null @@ -1,29 +0,0 @@ - -const { useState } = React; -export function TableHeaderRowsEdit(props) { - const { content } = props; - console.log(content); - return React.createElement( - 'div', - { className: 'bb-edit-content', style: { display: 'block' } }, - React.createElement('h2', { className: 'bb-edit-title' }, 'Header Rows'), - React.createElement( - 'div', - { className: 'show-row-wrapper' }, - React.createElement('h3', null, 'Show Rows'), - React.createElement( - 'div', - null, - React.createElement('input', { type: 'checkbox', name: 'showChannel', id: 'showChannel' }), - React.createElement('label', { htmlFor: 'showChannel' }, 'Channel') - ), - React.createElement( - 'div', - null, - React.createElement('input', { type: 'checkbox', name: 'showUnit', id: 'showUnit' }), - React.createElement('label', { htmlFor: 'showUnit' }, 'Unit') - ) - ) - ); -} - diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/TablePropertiesEdit.js b/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/TablePropertiesEdit.js deleted file mode 100644 index c31911a40f8..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/TablePropertiesEdit.js +++ /dev/null @@ -1,33 +0,0 @@ - -const { useState } = React; - -export function TablePropertiesEdit(props) { - const { content } = props; - console.log(content); - return React.createElement( - 'div', - { className: 'bb-edit-content', style: { display: 'block' } }, - React.createElement( - 'h2', - { className: 'bb-edit-title' }, - 'Table Properties' - ), - React.createElement( - 'div', - { className: 'show-row-wrapper' }, - React.createElement( - 'h3', - null, - 'Channel' - ), - React.createElement( - 'select', - { name: 'channel', id: 'tableChannel' }, - React.createElement('option', { hidden: '', value: '' }), - React.createElement('option', { value: '' }, ''), - React.createElement('option', { value: '' }, ''), - React.createElement('option', { value: 'TCD1' }, 'TCD1') - ) - ) - ) -} diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/Tabs.js b/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/Tabs.js deleted file mode 100644 index e7d5c5f3c2c..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/Tabs.js +++ /dev/null @@ -1,24 +0,0 @@ - -const { useState } = React; -export function Tabs(props) { - // const [activeTabIndex, setActiveTabIndex] = useState(0); - const { activeTabIndex, setActiveTabIndex } = props; - const tabs = props.tabs || []; - - return React.createElement( - 'ul', - { className: 'bb-edit-tabs' }, - ...tabs.map((tab, index) => React.createElement( - 'li', - { - className: activeTabIndex === index? 'active' : '', - key: index, - onClick: () => { - setActiveTabIndex(index); - }, - }, - tab.title - )) - - ); -} diff --git a/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/VariableEdit.js b/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/VariableEdit.js deleted file mode 100644 index 17690575cb8..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/components/variable-table-edit/VariableEdit.js +++ /dev/null @@ -1,65 +0,0 @@ -import { insertVariable } from '../../api/reportApis.js' - -const { useState, useEffect, createElement: c } = React; -export function VariableEdit(props) { - const { cellData } = props; - const hasChannel = cellData.custom?.variable?.hasChannel; - - console.log(cellData, 'cellData666'); - // const [formula, setFormula] = useState(cellData.v); - // useEffect(() => { - // setFormula(cellData.v || ''); - // }, [cellData.v]); - return c( - 'div', - { className: 'bb-edit-content' }, - c('h2', { className: 'bb-edit-title' }, 'Formula'), - c( - 'div', - null, - c( - 'div', - null, - c('label', { htmlFor: 'variableFormula' }, 'Formula'), - c('input', { - type: 'text', - autoComplete: 'off', - name: 'variableFormula', - id: 'variableFormula', - value: cellData.v || '', - onFocus: () => insertVariable({cellData}), - }) - ), - c( - 'div', - { style: { display: 'none' } }, - c('label', { htmlFor: 'variableFormat' }, 'Format'), - c('input', { type: 'text', name: 'variableFormat', id: 'variableFormat' }) - ), - c( - 'div', - { style: { display: hasChannel ? 'block' : 'none' } }, - c('label', { htmlFor: 'variableChannel' }, 'Channel'), - c( - 'select', - { name: 'variableChannel', id: 'variableChannel' }, - c('option', { value: '' }, ''), - c('option', { value: 'FID(C6+)' }, 'FID(C6+)'), - c('option', { value: 'FID(C2-C6)' }, 'FID(C2-C6)') - ) - ), - c( - 'div', - { style: { display: hasChannel ? 'block' : 'none' } }, - c('label', { htmlFor: 'variableCompoment' }, 'Compoment'), - c( - 'select', - { name: 'variableCompoment', id: 'variableCompoment' }, - c('option', { value: 'X' }, 'X'), - c('option', { value: 'Y' }, 'Y'), - c('option', { value: 'Z' }, 'Z') - ) - ) - ) - ); -} diff --git a/src/BootstrapBlazor.Server/wwwroot/report/constant.js b/src/BootstrapBlazor.Server/wwwroot/report/constant.js deleted file mode 100644 index 613d6d5e5c2..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/constant.js +++ /dev/null @@ -1,2 +0,0 @@ -export const EDIT_DIALOG = 'variable-and-table-edit-dialog'; -export const INSERT_VARIABLE_DIALOG = 'insert-variable-dialog'; \ No newline at end of file diff --git a/src/BootstrapBlazor.Server/wwwroot/report/controllers/menu/save-range.menu.js b/src/BootstrapBlazor.Server/wwwroot/report/controllers/menu/save-range.menu.js deleted file mode 100644 index b0c17dc56b6..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/controllers/menu/save-range.menu.js +++ /dev/null @@ -1,30 +0,0 @@ -import { SaveAsTableTemplateOperation, SaveAsCommonTemplateOperation } from '../../commands/operations/save-range.operation.js'; -export const REPORT_OPERATION_SAVE_RANGE_ID = 'report.operation.save-range'; -const { MenuItemType } = UniverUi; -export function ReportSaveRangeFactory() { - return { - id: REPORT_OPERATION_SAVE_RANGE_ID, - type: MenuItemType.SUBITEMS, - icon: 'SaveRangeIcon', - tooltip: 'report.saveRange', - title: 'report.saveRange', - }; -} -export function ReportSaveAsTableTemplateFactory() { - return { - id: SaveAsTableTemplateOperation.id, - type: MenuItemType.BUTTON, - title: 'report.saveAsTableTemplate', - icon: 'SaveAsTableTemplateIcon', - positions: [REPORT_OPERATION_SAVE_RANGE_ID], - }; -} -export function ReportSaveAsCommonTemplateFactory() { - return { - id: SaveAsCommonTemplateOperation.id, - type: MenuItemType.BUTTON, - title: 'report.saveAsCommonTemplate', - icon: 'SaveAsCommonTemplateIcon', - positions: [REPORT_OPERATION_SAVE_RANGE_ID], - }; -} diff --git a/src/BootstrapBlazor.Server/wwwroot/report/controllers/menu/single-butten.menu.js b/src/BootstrapBlazor.Server/wwwroot/report/controllers/menu/single-butten.menu.js deleted file mode 100644 index 3375faf375e..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/controllers/menu/single-butten.menu.js +++ /dev/null @@ -1,76 +0,0 @@ -import { InsertVariableOperation } from '../../commands/operations/insert-variable.operation.js'; -import { AddTableOperation } from '../../commands/operations/add-table.operation.js'; -import { AddPlotOperation } from '../../commands/operations/add-plot.operation.js'; -import { PreviewOperation } from '../../commands/operations/preview.operation.js'; -import { ExitPreviewOperation } from '../../commands/operations/exit-preview.operation.js'; -import { SaveExcelOperation } from '../../commands/operations/save-excel.operation.js'; - -const { UniverInstanceType } = UniverCore; -const { MenuItemType, getMenuHiddenObservable } = UniverUi; - -export function ReportInsertVariableFactory(accessor) { - return { - id: InsertVariableOperation.id, - type: MenuItemType.BUTTON, - icon: 'InsertVariableIcon', - tooltip: 'report.insertVariable', - title: 'report.insertVariable', - hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET) - }; -} - -export function ReportAddTableFactory(accessor) { - return { - id: AddTableOperation.id, - type: MenuItemType.BUTTON, - icon: 'AddTableIcon', - tooltip: 'report.addTable', - title: 'report.addTable', - hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET) - }; -} - -export function ReportAddPlotFactory(accessor) { - return { - id: AddPlotOperation.id, - type: MenuItemType.BUTTON, - icon: 'AddPlotIcon', - tooltip: 'report.addPlot', - title: 'report.addPlot', - hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET) - }; -} - -export function ReportPreviewFactory(accessor) { - return { - id: PreviewOperation.id, - type: MenuItemType.BUTTON, - icon: 'PreviewIcon', - tooltip: 'report.preview', - title: 'report.preview', - hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET) - }; -} - -export function ReportExitPreviewFactory(accessor) { - return { - id: ExitPreviewOperation.id, - type: MenuItemType.BUTTON, - icon: 'ExitPreviewIcon', - tooltip: 'report.exitPreview', - title: 'report.exitPreview', - hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET) - }; -} - -export function ReportSaveExcelFactory(accessor) { - return { - id: SaveExcelOperation.id, - type: MenuItemType.BUTTON, - icon: 'SaveExcelIcon', - tooltip: 'report.saveExcel', - title: 'report.saveExcel', - hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET) - }; -} - diff --git a/src/BootstrapBlazor.Server/wwwroot/report/controllers/report.controller.js b/src/BootstrapBlazor.Server/wwwroot/report/controllers/report.controller.js index 618a8c6f67a..fd8b5040b4b 100644 --- a/src/BootstrapBlazor.Server/wwwroot/report/controllers/report.controller.js +++ b/src/BootstrapBlazor.Server/wwwroot/report/controllers/report.controller.js @@ -1,47 +1,58 @@ +import { ReportPlugin } from '../plugin.js'; +const { Disposable, setDependencies, Injector, ICommandService, CommandType, UniverInstanceType, FUniver } = UniverCore; +const { ContextMenuGroup, ContextMenuPosition, RibbonStartGroup, ComponentManager, IMenuManagerService, MenuItemType, getMenuHiddenObservable } = UniverUi; + +function GetDataIcon() { + return React.createElement( + 'svg', + { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24" }, + React.createElement( + 'path', + { fill: "currentColor", d: "M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12S6.477 2 12 2m.16 14a6.981 6.981 0 0 0-5.147 2.256A7.966 7.966 0 0 0 12 20a7.97 7.97 0 0 0 5.167-1.892A6.979 6.979 0 0 0 12.16 16M12 4a8 8 0 0 0-6.384 12.821A8.975 8.975 0 0 1 12.16 14a8.972 8.972 0 0 1 6.362 2.634A8 8 0 0 0 12 4m0 1a4 4 0 1 1 0 8a4 4 0 0 1 0-8m0 2a2 2 0 1 0 0 4a2 2 0 0 0 0-4" } + ) + ); +} -import { SaveRangeIcon } from '../components/menus-icon/SaveRangeIcon.js'; -import { SaveAsTableTemplateIcon } from '../components/menus-icon/SaveAsTableTemplateIcon.js'; -import { SaveAsCommonTemplateIcon } from '../components/menus-icon/SaveAsCommonTemplateIcon.js'; -import { - REPORT_OPERATION_SAVE_RANGE_ID, - ReportSaveRangeFactory, - ReportSaveAsTableTemplateFactory, - ReportSaveAsCommonTemplateFactory -} from './menu/save-range.menu.js'; -import { SaveAsTableTemplateOperation, SaveAsCommonTemplateOperation } from '../commands/operations/save-range.operation.js'; - -import { ReportInsertVariableFactory, ReportAddTableFactory, ReportAddPlotFactory, ReportPreviewFactory, ReportExitPreviewFactory, ReportSaveExcelFactory } from './menu/single-butten.menu.js'; - -import { InsertVariableOperation } from '../commands/operations/insert-variable.operation.js'; -import { InsertVariableIcon } from '../components/menus-icon/InsertVariableIcon.js'; - -import { AddTableOperation } from '../commands/operations/add-table.operation.js'; -import { AddTableIcon } from '../components/menus-icon/AddTableIcon.js'; - -import { AddPlotOperation } from '../commands/operations/add-plot.operation.js'; -import { AddPlotIcon } from '../components/menus-icon/AddPlotIcon.js'; - -import { PreviewOperation } from '../commands/operations/preview.operation.js'; -import { PreviewIcon } from '../components/menus-icon/PreviewIcon.js'; - -import { ExitPreviewOperation } from '../commands/operations/exit-preview.operation.js'; -import { ExitPreviewIcon } from '../components/menus-icon/ExitPreviewIcon.js'; - -import { SaveExcelOperation } from '../commands/operations/save-excel.operation.js'; -import { SaveExcelIcon } from '../components/menus-icon/SaveExcelIcon.js'; - -import { FormulaSelection } from '../components/formula-selection/FormulaSelection.js'; -import { EditLayout } from '../components/variable-table-edit/EditLayout.js' - -import { OpenFormulaDialogCommand } from '../commands/openFormulaDialog.js' -import { OpenEditDialogCommand } from '../commands/openEditDialog.js' - - - -const { Disposable, setDependencies, Injector, ICommandService } = UniverCore; -const { ContextMenuGroup, ContextMenuPosition, RibbonStartGroup, ComponentManager, IMenuManagerService } = UniverUi; -const { RibbonDataGroup, RibbonFormulasGroup, RibbonInsertGroup, RibbonOthersGroup, RibbonPosition, RibbonViewGroup } = UniverUi - +const GetDataOperation = { + id: 'report.operation.add-table', + type: CommandType.OPERATION, + handler: async (accessor) => { + const dataService = accessor.get(ReportPlugin.DataServiceName); + const data = await dataService.pushData({id: '123'}) + console.log(data, 'GetDataOperation'); + + const univerAPI = FUniver.newAPI(dataService._injector) + const range = univerAPI.getActiveWorkbook().getActiveSheet().getRange(0, 0, 2, 2) + const defaultData1 = [ + [{ v: 'A1' }, { v: 'B1' }], + [{ v: 'A2' }, { v: 'B2' }], + ] + const defaultData2 = { + 0: { + 0: 'A1', + 1: 'B1', + }, + 1: { + 0: 'A2', + 1: 'B2', + }, + } + + range.setValues(data || defaultData1) + + }, +}; + +function ReportGetDataFactory(accessor) { + return { + id: GetDataOperation.id, + type: MenuItemType.BUTTON, + icon: 'GetDataIcon', + tooltip: '获取数据', + title: '获取数据', + hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET) + }; +} export class ReportController extends Disposable { constructor(_injector, _commandService, _menuManagerService, _componentManager) { super(); @@ -56,38 +67,14 @@ export class ReportController extends Disposable { } _initCommands() { [ - InsertVariableOperation, - AddTableOperation, - AddPlotOperation, - PreviewOperation, - ExitPreviewOperation, - SaveExcelOperation, - - SaveAsTableTemplateOperation, - SaveAsCommonTemplateOperation, - - OpenFormulaDialogCommand, - OpenEditDialogCommand, - + GetDataOperation, ].forEach((c) => { this.disposeWithMe(this._commandService.registerCommand(c)); }); } _registerComponents() { const componentMap = { - InsertVariableIcon, - AddTableIcon, - AddPlotIcon, - PreviewIcon, - ExitPreviewIcon, - SaveExcelIcon, - - SaveRangeIcon, - SaveAsTableTemplateIcon, - SaveAsCommonTemplateIcon, - - FormulaSelection, - EditLayout, + GetDataIcon, } Object.entries(componentMap).forEach((item) => { this.disposeWithMe(this._componentManager.register(...item)); @@ -95,82 +82,19 @@ export class ReportController extends Disposable { } _initMenus() { - console.log(this._menuManagerService, 'this._menuManagerService'); this._menuManagerService.mergeMenu({ - // { - // "HISTORY": "ribbon.start.history", - // "FORMAT": "ribbon.start.format", - // "LAYOUT": "ribbon.start.layout", - // "FORMULAS_INSERT": "ribbon.start.insert", - // "FORMULAS_VIEW": "ribbon.start.view", - // "FILE": "ribbon.start.file", - // "OTHERS": "ribbon.start.others" - // } - [RibbonStartGroup.FILE]: { - [InsertVariableOperation.id]: { - order: 2, - menuItemFactory: ReportInsertVariableFactory - }, - [AddTableOperation.id]: { - order: 2, - menuItemFactory: ReportAddTableFactory - }, - [AddPlotOperation.id]: { - order: 2, - menuItemFactory: ReportAddPlotFactory - }, - [PreviewOperation.id]: { - order: 2, - menuItemFactory: ReportPreviewFactory - }, - [ExitPreviewOperation.id]: { - order: 2, - menuItemFactory: ReportExitPreviewFactory - }, - [SaveExcelOperation.id]: { - order: 2, - menuItemFactory: ReportSaveExcelFactory + + [RibbonStartGroup.HISTORY]: { + [GetDataOperation.id]: { + order: -1, + menuItemFactory: ReportGetDataFactory }, }, - [RibbonStartGroup.OTHERS]: { - // [REPORT_OPERATION_SAVE_RANGE_ID]: { - // order: -1, - // menuItemFactory: ReportSaveRangeFactory, - // [SaveAsTableTemplateOperation.id]: { - // order: 0, - // menuItemFactory: ReportSaveAsTableTemplateFactory - // }, - // [SaveAsCommonTemplateOperation.id]: { - // order: 1, - // menuItemFactory: ReportSaveAsCommonTemplateFactory - // } - // } - }, [ContextMenuPosition.MAIN_AREA]: { [ContextMenuGroup.DATA]: { - [InsertVariableOperation.id]: { - order: 0, - menuItemFactory: ReportInsertVariableFactory - }, - [AddTableOperation.id]: { - order: 0, - menuItemFactory: ReportAddTableFactory - }, - [AddPlotOperation.id]: { - order: 0, - menuItemFactory: ReportAddPlotFactory - }, - [REPORT_OPERATION_SAVE_RANGE_ID]: { + [GetDataOperation.id]: { order: 0, - menuItemFactory: ReportSaveRangeFactory, - [SaveAsTableTemplateOperation.id]: { - order: 0, - menuItemFactory: ReportSaveAsTableTemplateFactory - }, - [SaveAsCommonTemplateOperation.id]: { - order: 1, - menuItemFactory: ReportSaveAsCommonTemplateFactory - } + menuItemFactory: ReportGetDataFactory } } } diff --git a/src/BootstrapBlazor.Server/wwwroot/report/eventsListener.js b/src/BootstrapBlazor.Server/wwwroot/report/eventsListener.js deleted file mode 100644 index b9421ae1081..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/eventsListener.js +++ /dev/null @@ -1,47 +0,0 @@ -import { editVariableAndTable, insertVariable, preview } from './api/reportApis.js' -import { getCategoryList, getVariableList } from './api/getData.js'; - - -const { UniverSheetsUIPlugin } = UniverSheetsUi -export const eventsListen = ({}) => [ - // 监听选区变化事件 - univerAPI.addEvent(univerAPI.Event.SelectionChanged, (params) => { - const editEle = document.querySelector('.bb-edit-container'); - const formulaEle = document.querySelector('.bb-formula-selection'); - if (editEle) { - const { worksheet, workbook, selections: [{ startRow, startColumn }] } = params; - const cellData = worksheet.getRange(startRow, startColumn, 1, 1).getCellData(); - // if( cellData.custom?.variable || cellData.custom?.table ) { - editVariableAndTable({ cellData }) - // } - } - if (formulaEle) { - insertVariable() - } - }), - // 监听单元格编辑开始事件 - univerAPI.addEvent(univerAPI.Event.BeforeSheetEditStart, (params) => { - const { worksheet, workbook, row, column, eventType, keycode, isZenEditor } = params; - const cellData = worksheet.getRange(row, column, 1, 1).getCellData(); - if (cellData.custom?.variable || cellData.custom?.table) { - params.cancel = true; - editVariableAndTable({ cellData }) - } - }), - - // univerAPI.addEvent(univerAPI.Event.CellClicked, (params) => { - // const { worksheet, workbook, row, column } = params; - // console.log('点击的单元格:', row, column); - // }), - - - univerAPI.onBeforeCommandExecute((command) => { - const { id, type, params } = command; - if (id === 'zen-editor.command.open-zen-editor') { - console.log(id); - } - if (id === 'drawing.operation.set-drawing-selected') { - console.log(id); - } - }) -] diff --git a/src/BootstrapBlazor.Server/wwwroot/report/locale/en-US.js b/src/BootstrapBlazor.Server/wwwroot/report/locale/en-US.js deleted file mode 100644 index 20568d9083e..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/locale/en-US.js +++ /dev/null @@ -1,14 +0,0 @@ - -export default { - report: { - insertVariable: 'Add variable', - addTable: 'Add table', - addPlot: 'Add plot', - preview: 'Preview', - exitPreview: 'Exit Preview', - saveExcel: 'SaveExcel', - saveRange: 'Save Range Data', - saveAsTableTemplate: 'SaveAsTableTemplate', - saveAsCommonTemplate: 'SaveAsCommonTemplate', - } -}; diff --git a/src/BootstrapBlazor.Server/wwwroot/report/locale/zh-CN.js b/src/BootstrapBlazor.Server/wwwroot/report/locale/zh-CN.js deleted file mode 100644 index e075f289d16..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/locale/zh-CN.js +++ /dev/null @@ -1,14 +0,0 @@ - -export default { - report: { - insertVariable: '添加变量', - addTable: '添加表格', - addPlot: '添加谱图', - preview: '预览数据', - exitPreview: '退出预览', - saveExcel: '保存', - saveRange: '保存选区数据', - saveAsTableTemplate: '保存为表格模板', - saveAsCommonTemplate: '保存为普通模板', - }, -}; diff --git a/src/BootstrapBlazor.Server/wwwroot/report/plugin.js b/src/BootstrapBlazor.Server/wwwroot/report/plugin.js index 8858390c7df..cc78a516a09 100644 --- a/src/BootstrapBlazor.Server/wwwroot/report/plugin.js +++ b/src/BootstrapBlazor.Server/wwwroot/report/plugin.js @@ -1,81 +1,39 @@ -import zhCN from './locale/zh-CN.js'; -import enUS from './locale/en-US.js'; -import { ReportController } from './controllers/report.controller.js'; -import { eventsListen } from "./eventsListener.js" -import { MainCustomExtension } from './canvasExtension/main-extension.js' -import { CustomerService } from './CustomerService.js' +import { ReportController } from './controllers/report.controller.js'; +import { DataService } from './DataService.js' -const { Plugin, UniverInstanceType, LocaleService, Inject, touchDependencies, Injector, setDependencies, FUniver, IUniverInstanceService, createIdentifier } = UniverCore +const { Plugin, UniverInstanceType, Injector, setDependencies } = UniverCore const REPORT_PLUGIN = 'ReportPlugin'; // 定义插件类 export class ReportPlugin extends Plugin { static type = UniverInstanceType.UNIVER_SHEET; static pluginName = REPORT_PLUGIN; - static DataServiceName = 'CustomerService'; + static DataServiceName = 'DataService'; constructor( _injector, - _localeService, ) { super(); - console.log('ReportPlugin constructor'); this._injector = _injector; - this._localeService = _localeService; - this._localeService.load({ - zhCN, - enUS - }); } onStarting() { console.log('onStarting'); this._injector.add([ReportController]) - this._injector.add([ReportPlugin.DataServiceName, { useClass: CustomerService }]) + this._injector.add([ReportPlugin.DataServiceName, { useClass: DataService }]) } onReady() { - console.log('onReady'); this._injector.get(ReportController) - - // const customerService = this._injector.get('zhangsan') - // console.log(customerService, 'customerService'); - // const resource = customerService._getResource().resources.find(item => item.name === 'CustomerService').data || {} - // const univerAPI = FUniver.newAPI(this._injector) - // const unitId = univerAPI.getActiveWorkbook().getId() - // univerAPI.createUniverSheet(JSON.parse(resource)) - // univerAPI.disposeUnit(unitId) - - const customerService = this._injector.get(ReportPlugin.DataServiceName) - const resource = customerService._getResource().find(item => item.name === 'CustomerService').data || {} - const univerAPI = FUniver.newAPI(this._injector) - const sheet = univerAPI.getActiveWorkbook().getActiveSheet().getRange(2, 2, 2, 1) - sheet.setValue(resource) } onRendered() { - // touchDependencies(this._injector, [[ReportController]]) - // 动态添加link标签 const link = document.createElement('link'); link.type = 'text/css'; link.rel = 'stylesheet'; link.href = './report/report.css'; document.head.appendChild(link); - - const univerAPI = FUniver.newAPI(this._injector) - - // 注册自定义表格单元格渲染 - const unitId = univerAPI.getActiveWorkbook().id - univerAPI.registerSheetMainExtension(unitId, new MainCustomExtension()) - - // 绑定report插件的事件监听 - const eventDisposableList = eventsListen({ univerAPI }); - // excel销毁时,解绑事件监听 - this._injector.onDispose(() => eventDisposableList.forEach(disposable => { disposable.dispose(); console.log("解绑report插件的事件监听"); })); } - - // onSteady() { - // } } // 设置依赖 -setDependencies(ReportPlugin, [Injector, LocaleService]); +setDependencies(ReportPlugin, [Injector]); From 9d0b0d4e87c3fce4c91890e1891d81e47d311fd0 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Fri, 28 Feb 2025 09:52:11 +0800 Subject: [PATCH 12/22] =?UTF-8?q?refactor:=20=E6=9B=B4=E6=94=B9=20report?= =?UTF-8?q?=20=E7=9B=AE=E5=BD=95=E4=B8=BA=20univer-sheet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wwwroot/report/DataService.js | 25 ----- .../wwwroot/report/plugin.js | 39 ------- .../wwwroot/report/report.css | 106 ------------------ .../controller.js} | 70 +++++++----- .../wwwroot/univer-sheet/plugin.js | 32 ++++++ 5 files changed, 71 insertions(+), 201 deletions(-) delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/DataService.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/plugin.js delete mode 100644 src/BootstrapBlazor.Server/wwwroot/report/report.css rename src/BootstrapBlazor.Server/wwwroot/{report/controllers/report.controller.js => univer-sheet/controller.js} (81%) create mode 100644 src/BootstrapBlazor.Server/wwwroot/univer-sheet/plugin.js diff --git a/src/BootstrapBlazor.Server/wwwroot/report/DataService.js b/src/BootstrapBlazor.Server/wwwroot/report/DataService.js deleted file mode 100644 index 6ad38b86a90..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/DataService.js +++ /dev/null @@ -1,25 +0,0 @@ - -const { IResourceManagerService, setDependencies, IResourceLoaderService, IUniverInstanceService, Injector, FUniver } = UniverCore -const { UniverType } = UniverProtocol - -export class DataService { - constructor( - _injector - ) { - this._injector = _injector; - } - receiveData(data) { - console.log(data); - if (typeof (this.pushData) === 'function') { - this.pushData({ - messageName: 'DataService', - commandName: 'setRangeValue', - data: { - value: 1 - } - }); - } - } -} - -setDependencies(DataService, [Injector]); diff --git a/src/BootstrapBlazor.Server/wwwroot/report/plugin.js b/src/BootstrapBlazor.Server/wwwroot/report/plugin.js deleted file mode 100644 index cc78a516a09..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/plugin.js +++ /dev/null @@ -1,39 +0,0 @@ -import { ReportController } from './controllers/report.controller.js'; -import { DataService } from './DataService.js' - -const { Plugin, UniverInstanceType, Injector, setDependencies } = UniverCore -const REPORT_PLUGIN = 'ReportPlugin'; - -// 定义插件类 -export class ReportPlugin extends Plugin { - static type = UniverInstanceType.UNIVER_SHEET; - static pluginName = REPORT_PLUGIN; - static DataServiceName = 'DataService'; - constructor( - _injector, - ) { - super(); - this._injector = _injector; - } - - onStarting() { - console.log('onStarting'); - this._injector.add([ReportController]) - this._injector.add([ReportPlugin.DataServiceName, { useClass: DataService }]) - } - - onReady() { - this._injector.get(ReportController) - } - onRendered() { - // 动态添加link标签 - const link = document.createElement('link'); - link.type = 'text/css'; - link.rel = 'stylesheet'; - link.href = './report/report.css'; - document.head.appendChild(link); - } -} - -// 设置依赖 -setDependencies(ReportPlugin, [Injector]); diff --git a/src/BootstrapBlazor.Server/wwwroot/report/report.css b/src/BootstrapBlazor.Server/wwwroot/report/report.css deleted file mode 100644 index a2131787114..00000000000 --- a/src/BootstrapBlazor.Server/wwwroot/report/report.css +++ /dev/null @@ -1,106 +0,0 @@ - - -.univer-fixed { - position: absolute; -} - -ul, li { - list-style: none; - margin: 0; - padding: 0; -} -.bb-formula-selection, .bb-edit-container { - font-size: 12px; -} - -.bb-formula-selection > div { - display: flex; -} - .bb-formula-selection .bb-category-list{ - width: 50%; - margin-right: 10px; - } - .bb-formula-selection .bb-variable-list{ - width: 50%; - } - .bb-formula-selection li, .bb-edit-container .bb-edit-tabs li { - height: 30px; - line-height: 30px; - padding-left: 8px; - font-size: 14px; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - cursor: pointer; - user-select: none; - } - .bb-formula-selection li:hover, .bb-edit-container .bb-edit-tabs li:hover { - background-color: #efefef; - } - .bb-formula-selection li.active, .bb-edit-container .bb-edit-tabs li.active { - background-color: #e3e3e3; - } - .bb-formula-selection li span { - font-size: 10px; - margin-left: 5px; - color: rgba(0, 0, 0, 0.6) - } - .bb-formula-selection input { - margin-top: 10px; - width: 80%; - height: 20px; - padding-left: 5px; - } - .bb-formula-selection button { - width: 60px; - height: 25px; - padding-left: 5px; - margin-left: 10px; - cursor: pointer; - } - -.bb-edit-container { - display: flex; -} - .bb-edit-container .bb-edit-tabs { - width: 30%; - } - .bb-edit-container .bb-edit-content { - width: 70%; - padding-left: 5px; - } - .bb-edit-container .bb-edit-content h2 { - margin: 0; - font-size: 20px; - font-weight: normal; - } - .bb-edit-container .bb-edit-content h3 { - margin: 0; - font-size: 16px; - font-weight: normal; - } - .bb-edit-container .bb-edit-content label:has(+input[type="text"]) { - display: block; - font-size: 12px; - } - .bb-edit-container .bb-edit-content input[type="text"]:not(.variable):not(.valid-value), - .bb-edit-container .bb-edit-content select:not(.match-type):not(.action) { - width: 100%; - height: 25px; - box-sizing: border-box; - } - - .bb-edit-container .bb-edit-content > div { - padding-left: 10px; - } - - .bb-edit-container .bb-edit-content > div > div { - margin-bottom: 10px; - } - .bb-edit-container .bb-edit-content .bb-valid-wrapper li { - display: flex; - } - .bb-edit-container .bb-edit-content .bb-valid-wrapper li input[type="text"], .bb-edit-container .bb-edit-content .bb-valid-wrapper li select { - flex: 1; - margin-right: 3px; - } diff --git a/src/BootstrapBlazor.Server/wwwroot/report/controllers/report.controller.js b/src/BootstrapBlazor.Server/wwwroot/univer-sheet/controller.js similarity index 81% rename from src/BootstrapBlazor.Server/wwwroot/report/controllers/report.controller.js rename to src/BootstrapBlazor.Server/wwwroot/univer-sheet/controller.js index fd8b5040b4b..ee91e43ba4d 100644 --- a/src/BootstrapBlazor.Server/wwwroot/report/controllers/report.controller.js +++ b/src/BootstrapBlazor.Server/wwwroot/univer-sheet/controller.js @@ -1,27 +1,15 @@ -import { ReportPlugin } from '../plugin.js'; +import { DataService } from '../_content/BootstrapBlazor.UniverSheet/univer.js' + const { Disposable, setDependencies, Injector, ICommandService, CommandType, UniverInstanceType, FUniver } = UniverCore; const { ContextMenuGroup, ContextMenuPosition, RibbonStartGroup, ComponentManager, IMenuManagerService, MenuItemType, getMenuHiddenObservable } = UniverUi; -function GetDataIcon() { - return React.createElement( - 'svg', - { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24" }, - React.createElement( - 'path', - { fill: "currentColor", d: "M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12S6.477 2 12 2m.16 14a6.981 6.981 0 0 0-5.147 2.256A7.966 7.966 0 0 0 12 20a7.97 7.97 0 0 0 5.167-1.892A6.979 6.979 0 0 0 12.16 16M12 4a8 8 0 0 0-6.384 12.821A8.975 8.975 0 0 1 12.16 14a8.972 8.972 0 0 1 6.362 2.634A8 8 0 0 0 12 4m0 1a4 4 0 1 1 0 8a4 4 0 0 1 0-8m0 2a2 2 0 1 0 0 4a2 2 0 0 0 0-4" } - ) - ); -} - const GetDataOperation = { id: 'report.operation.add-table', type: CommandType.OPERATION, handler: async (accessor) => { - const dataService = accessor.get(ReportPlugin.DataServiceName); - const data = await dataService.pushData({id: '123'}) - console.log(data, 'GetDataOperation'); - - const univerAPI = FUniver.newAPI(dataService._injector) + const dataService = accessor.get(DataService.name); + const data = await dataService.getData({ id: '123' }); + const univerAPI = dataService.getSheet().univerAPI; const range = univerAPI.getActiveWorkbook().getActiveSheet().getRange(0, 0, 2, 2) const defaultData1 = [ [{ v: 'A1' }, { v: 'B1' }], @@ -29,20 +17,29 @@ const GetDataOperation = { ] const defaultData2 = { 0: { - 0: 'A1', - 1: 'B1', + 0: 'A1', + 1: 'B1', }, 1: { - 0: 'A2', - 1: 'B2', - }, - } - + 0: 'A2', + 1: 'B2', + } + } range.setValues(data || defaultData1) - - }, + } }; +function GetDataIcon() { + return React.createElement( + 'svg', + { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24" }, + React.createElement( + 'path', + { fill: "currentColor", d: "M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12S6.477 2 12 2m.16 14a6.981 6.981 0 0 0-5.147 2.256A7.966 7.966 0 0 0 12 20a7.97 7.97 0 0 0 5.167-1.892A6.979 6.979 0 0 0 12.16 16M12 4a8 8 0 0 0-6.384 12.821A8.975 8.975 0 0 1 12.16 14a8.972 8.972 0 0 1 6.362 2.634A8 8 0 0 0 12 4m0 1a4 4 0 1 1 0 8a4 4 0 0 1 0-8m0 2a2 2 0 1 0 0 4a2 2 0 0 0 0-4" } + ) + ); +} + function ReportGetDataFactory(accessor) { return { id: GetDataOperation.id, @@ -53,25 +50,35 @@ function ReportGetDataFactory(accessor) { hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET) }; } + export class ReportController extends Disposable { constructor(_injector, _commandService, _menuManagerService, _componentManager) { super(); + this._injector = _injector; this._commandService = _commandService; - this._menuManagerService = _menuManagerService ; + this._menuManagerService = _menuManagerService; this._componentManager = _componentManager; this._initCommands(); this._registerComponents(); this._initMenus(); + this._initDataService(); + } + + _initDataService() { + const dataService = this._injector.get(DataService.name); + dataService.registerCallback(data => { + console.log(data); + }); } + _initCommands() { - [ - GetDataOperation, - ].forEach((c) => { + [GetDataOperation].forEach((c) => { this.disposeWithMe(this._commandService.registerCommand(c)); }); } + _registerComponents() { const componentMap = { GetDataIcon, @@ -81,9 +88,9 @@ export class ReportController extends Disposable { }); } + _initMenus() { this._menuManagerService.mergeMenu({ - [RibbonStartGroup.HISTORY]: { [GetDataOperation.id]: { order: -1, @@ -101,4 +108,5 @@ export class ReportController extends Disposable { }); } } + setDependencies(ReportController, [Injector, ICommandService, IMenuManagerService, ComponentManager]); diff --git a/src/BootstrapBlazor.Server/wwwroot/univer-sheet/plugin.js b/src/BootstrapBlazor.Server/wwwroot/univer-sheet/plugin.js new file mode 100644 index 00000000000..a1b6b0ac498 --- /dev/null +++ b/src/BootstrapBlazor.Server/wwwroot/univer-sheet/plugin.js @@ -0,0 +1,32 @@ +import { ReportController } from './controller.js' +import { DataService } from '../_content/BootstrapBlazor.UniverSheet/univer.js' + +const { Plugin, Injector, setDependencies } = UniverCore; +const REPORT_PLUGIN = 'ReportPlugin'; + +// 定义插件类 +export class ReportPlugin extends Plugin { + static pluginName = REPORT_PLUGIN; + + constructor(_injector) { + super(); + + this._injector = _injector; + } + + onStarting() { + this._injector.add([ReportController]); + this._injector.add([DataService.name, { useClass: DataService }]) + } + + onReady() { + this._injector.get(ReportController) + } + + onRendered() { + + } +} + +// 设置依赖 +setDependencies(ReportPlugin, [Injector]); From 09edb1dea54fe40c2edbec9d3865ba788ec25969 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Fri, 28 Feb 2025 09:52:27 +0800 Subject: [PATCH 13/22] =?UTF-8?q?refactor:=20=E7=B2=BE=E7=AE=80=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Samples/UniverSheets.razor.cs | 2 +- .../Components/Samples/UniverSheets.razor.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.cs b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.cs index a20ba4fea3d..70f2861a39a 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.cs +++ b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.cs @@ -12,7 +12,7 @@ public partial class UniverSheets { private readonly Dictionary Plugins = new() { - { "ReportPlugin", "report/plugin.js" } + { "ReportPlugin", "univer-sheet/plugin.js" } }; private UniverSheet _sheet = default!; diff --git a/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.js b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.js index af7b9fa6b37..b25d5531710 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.js +++ b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.js @@ -24,7 +24,7 @@ if (window.BootstrapBlazor.Univer.Sheet === void 0) { } export function init(id) { - console.log(id); + } export function dispose(id) { From d651cdb3a87cfa0ec54caf1b5449ef892b5a4996 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Fri, 28 Feb 2025 10:16:01 +0800 Subject: [PATCH 14/22] =?UTF-8?q?refactor:=20=E5=A2=9E=E5=8A=A0=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=9C=8D=E5=8A=A1=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wwwroot/univer-sheet/controller.js | 18 +++++++++++------- .../wwwroot/univer-sheet/plugin.js | 7 +++---- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/BootstrapBlazor.Server/wwwroot/univer-sheet/controller.js b/src/BootstrapBlazor.Server/wwwroot/univer-sheet/controller.js index ee91e43ba4d..3e4dc76ced6 100644 --- a/src/BootstrapBlazor.Server/wwwroot/univer-sheet/controller.js +++ b/src/BootstrapBlazor.Server/wwwroot/univer-sheet/controller.js @@ -1,6 +1,6 @@ -import { DataService } from '../_content/BootstrapBlazor.UniverSheet/univer.js' +import DataService from '../_content/BootstrapBlazor.UniverSheet/data-service.js' -const { Disposable, setDependencies, Injector, ICommandService, CommandType, UniverInstanceType, FUniver } = UniverCore; +const { Disposable, setDependencies, Injector, ICommandService, CommandType, UniverInstanceType } = UniverCore; const { ContextMenuGroup, ContextMenuPosition, RibbonStartGroup, ComponentManager, IMenuManagerService, MenuItemType, getMenuHiddenObservable } = UniverUi; const GetDataOperation = { @@ -8,7 +8,7 @@ const GetDataOperation = { type: CommandType.OPERATION, handler: async (accessor) => { const dataService = accessor.get(DataService.name); - const data = await dataService.getData({ id: '123' }); + const data = await dataService.getDataAsync({ id: '123' }); const univerAPI = dataService.getSheet().univerAPI; const range = univerAPI.getActiveWorkbook().getActiveSheet().getRange(0, 0, 2, 2) const defaultData1 = [ @@ -63,13 +63,13 @@ export class ReportController extends Disposable { this._initCommands(); this._registerComponents(); this._initMenus(); - this._initDataService(); + this._registerReceiveDataCallback(); } - _initDataService() { + _registerReceiveDataCallback() { const dataService = this._injector.get(DataService.name); - dataService.registerCallback(data => { - console.log(data); + dataService.registerReceiveDataCallback(data => { + this.receiveData(data); }); } @@ -107,6 +107,10 @@ export class ReportController extends Disposable { } }); } + + receiveData(data) { + console.log(data); + } } setDependencies(ReportController, [Injector, ICommandService, IMenuManagerService, ComponentManager]); diff --git a/src/BootstrapBlazor.Server/wwwroot/univer-sheet/plugin.js b/src/BootstrapBlazor.Server/wwwroot/univer-sheet/plugin.js index a1b6b0ac498..81e97a14e3b 100644 --- a/src/BootstrapBlazor.Server/wwwroot/univer-sheet/plugin.js +++ b/src/BootstrapBlazor.Server/wwwroot/univer-sheet/plugin.js @@ -1,12 +1,11 @@ -import { ReportController } from './controller.js' -import { DataService } from '../_content/BootstrapBlazor.UniverSheet/univer.js' +import DataService from '../_content/BootstrapBlazor.UniverSheet/data-service.js' +import { ReportController } from './controller.js' const { Plugin, Injector, setDependencies } = UniverCore; -const REPORT_PLUGIN = 'ReportPlugin'; // 定义插件类 export class ReportPlugin extends Plugin { - static pluginName = REPORT_PLUGIN; + static pluginName = 'ReportPlugin'; constructor(_injector) { super(); From 620ca51e13239b69ba7d4d7ddcbdec84a669d46d Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Fri, 28 Feb 2025 10:35:39 +0800 Subject: [PATCH 15/22] =?UTF-8?q?refactor:=20=E6=9B=B4=E6=94=B9=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor.Server/wwwroot/univer-sheet/controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BootstrapBlazor.Server/wwwroot/univer-sheet/controller.js b/src/BootstrapBlazor.Server/wwwroot/univer-sheet/controller.js index 3e4dc76ced6..bc61f8a012c 100644 --- a/src/BootstrapBlazor.Server/wwwroot/univer-sheet/controller.js +++ b/src/BootstrapBlazor.Server/wwwroot/univer-sheet/controller.js @@ -9,7 +9,7 @@ const GetDataOperation = { handler: async (accessor) => { const dataService = accessor.get(DataService.name); const data = await dataService.getDataAsync({ id: '123' }); - const univerAPI = dataService.getSheet().univerAPI; + const univerAPI = dataService.getUniverSheet().univerAPI; const range = univerAPI.getActiveWorkbook().getActiveSheet().getRange(0, 0, 2, 2) const defaultData1 = [ [{ v: 'A1' }, { v: 'B1' }], From 55d448ba4346d77db81c9ece2d2d00179447b684 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Fri, 28 Feb 2025 11:29:52 +0800 Subject: [PATCH 16/22] =?UTF-8?q?chore:=20=E6=9B=B4=E6=96=B0=E7=A4=BA?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Samples/UniverSheets.razor | 9 ++++-- .../Components/Samples/UniverSheets.razor.cs | 28 ++++++++++++++++++- .../Components/Samples/UniverSheets.razor.css | 2 +- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor index 5a2628d1d7b..1b09f009821 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor +++ b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor @@ -1,6 +1,5 @@ @page "/univer-sheet" @inherits WebSiteModuleComponentBase -@inject IStringLocalizer Localizer @attribute [JSModuleAutoLoader("Samples/UniverSheets.razor.js")]

@Localizer["UniverSheetTitle"]

@@ -9,12 +8,16 @@ - +
+

@((MarkupString)Localizer["NormalDesc"].Value)

+ +
- +
diff --git a/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.cs b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.cs index 70f2861a39a..daceae5bcc9 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.cs +++ b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.cs @@ -10,6 +10,12 @@ namespace BootstrapBlazor.Server.Components.Samples; /// public partial class UniverSheets { + [Inject, NotNull] + private ToastService? ToastService { get; set; } + + [Inject, NotNull] + private IStringLocalizer? Localizer { get; set; } + private readonly Dictionary Plugins = new() { { "ReportPlugin", "univer-sheet/plugin.js" } @@ -17,6 +23,25 @@ public partial class UniverSheets private UniverSheet _sheet = default!; + private async Task OnReadyAsync() => await ToastService.Information(Localizer["ToastOnReadyTitle"], Localizer["ToastOnReadyContent"]); + + private static Task OnPostDataAsync(UniverSheetData data) + { + // 这里可以根据 data 的内容进行处理然后返回处理后的数据 + // 本例返回与时间相关的数据 + var result = new UniverSheetData() + { + MessageName = data.MessageName, + CommandName = data.CommandName, + Data = new + { + key = "datetime", + Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + } + }; + return Task.FromResult(result); + } + private async Task OnPush() { await _sheet.PushDataAsync(new UniverSheetData() @@ -26,7 +51,8 @@ await _sheet.PushDataAsync(new UniverSheetData() Data = new { Id = 01, - Name = "Test-Name" + Name = "Test-Name", + Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") } }); } diff --git a/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.css b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.css index c757a796377..958241368f1 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.css +++ b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.css @@ -1,5 +1,5 @@ .bb-sheet-demo { - height: calc(100vh - 160px); + height: calc(100vh - 198px); width: 100%; border: 1px solid var(--bs-border-color); } From 461c43299faa757b265ab20c9318e848eb82fccc Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Fri, 28 Feb 2025 11:30:07 +0800 Subject: [PATCH 17/22] =?UTF-8?q?refactor:=20=E5=A2=9E=E5=8A=A0=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wwwroot/univer-sheet/controller.js | 42 ++++++++++--------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/src/BootstrapBlazor.Server/wwwroot/univer-sheet/controller.js b/src/BootstrapBlazor.Server/wwwroot/univer-sheet/controller.js index bc61f8a012c..715d30a9c43 100644 --- a/src/BootstrapBlazor.Server/wwwroot/univer-sheet/controller.js +++ b/src/BootstrapBlazor.Server/wwwroot/univer-sheet/controller.js @@ -8,24 +8,19 @@ const GetDataOperation = { type: CommandType.OPERATION, handler: async (accessor) => { const dataService = accessor.get(DataService.name); - const data = await dataService.getDataAsync({ id: '123' }); - const univerAPI = dataService.getUniverSheet().univerAPI; - const range = univerAPI.getActiveWorkbook().getActiveSheet().getRange(0, 0, 2, 2) - const defaultData1 = [ - [{ v: 'A1' }, { v: 'B1' }], - [{ v: 'A2' }, { v: 'B2' }], - ] - const defaultData2 = { - 0: { - 0: 'A1', - 1: 'B1', - }, - 1: { - 0: 'A2', - 1: 'B2', - } + const data = await dataService.getDataAsync({ + messageName: "getDataMessage", + commandName: "getDataCommand" + }); + if (data) { + const univerAPI = dataService.getUniverSheet().univerAPI; + const range = univerAPI.getActiveWorkbook().getActiveSheet().getRange(0, 0, 2, 1) + const defaultData = [ + [{ v: data.data.key }], + [{ v: data.data.value }] + ] + range.setValues(defaultData); } - range.setValues(data || defaultData1) } }; @@ -69,7 +64,7 @@ export class ReportController extends Disposable { _registerReceiveDataCallback() { const dataService = this._injector.get(DataService.name); dataService.registerReceiveDataCallback(data => { - this.receiveData(data); + this.receiveData(data, dataService.getUniverSheet()); }); } @@ -108,8 +103,15 @@ export class ReportController extends Disposable { }); } - receiveData(data) { - console.log(data); + receiveData(data, sheet) { + const { univerAPI } = sheet; + const range = univerAPI.getActiveWorkbook().getActiveSheet().getRange(0, 0, 2, 3) + const defaultData = [ + [{ v: 'Id' }, { v: 'Name' }, { v: 'Value' }], + [{ v: data.data.id }, { v: data.data.name }, { v: data.data.value }] + ] + range.setValues(defaultData); + } } From d9c60398a1e6cc8bd9ea1198ae1cc7c1ecb6ef6d Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Fri, 28 Feb 2025 12:03:03 +0800 Subject: [PATCH 18/22] =?UTF-8?q?doc:=20=E5=A2=9E=E5=8A=A0=E5=A4=9A?= =?UTF-8?q?=E8=AF=AD=E8=A8=80=E8=B5=84=E6=BA=90=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor.Server/Locales/en-US.json | 10 ++++++++++ src/BootstrapBlazor.Server/Locales/zh-CN.json | 12 +++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/BootstrapBlazor.Server/Locales/en-US.json b/src/BootstrapBlazor.Server/Locales/en-US.json index 6a0e04ce6d1..997a3d22417 100644 --- a/src/BootstrapBlazor.Server/Locales/en-US.json +++ b/src/BootstrapBlazor.Server/Locales/en-US.json @@ -7000,5 +7000,15 @@ "Html2ImageElementIntro": "Get the base64-encoded image by calling the GetDataAsync method", "Html2ImageButtonText": "Image", "Html2ImageDesc": "Since the underlying library is html-to-image, if you encounter any problems during actual use, please refer to the project Issue" + }, + "BootstrapBlazor.Server.Components.Samples.UniverSheets": { + "UniverSheetTitle": "UniverSheet", + "UniverSheetIntro": "Encapsulates the core spreadsheet component of the open source office suite ​Univer​, providing a high-performance, scalable online spreadsheet solution", + "NormalTitle": "Basic usage", + "NormalIntro": "Set your own plugins by setting the Plugins parameter", + "NormalDesc": "Click the Push Data button to push data to the table, and click the first small button on the Toolbar to get data from the server.", + "PushButtonText": "Push", + "ToastOnReadyTitle": "Notification", + "ToastOnReadyContent": "The sheet is ready for push data." } } diff --git a/src/BootstrapBlazor.Server/Locales/zh-CN.json b/src/BootstrapBlazor.Server/Locales/zh-CN.json index a38bd1658c7..7e918b42d7f 100644 --- a/src/BootstrapBlazor.Server/Locales/zh-CN.json +++ b/src/BootstrapBlazor.Server/Locales/zh-CN.json @@ -6988,7 +6988,7 @@ "BootstrapBlazor.Server.Components.Samples.Typeds": { "TypedTitle": "Typed 打字机效果", "TypedIntro": "输入任意字符串,它会按照你设置的速度输入,输入的内容会退格,然后根据你设置的字符串数量开始一个新句子。", - "NormalTitle": "Text", + "NormalTitle": "基础用法", "NormalIntro": "通过设置 Text 参数设置要显示的文本", "TypedOptionsTitle": "TypedOptions", "TypedOptionsIntro": "通过设置 TypedOptions 参数的属性自定义打字速度、延时等设定" @@ -7000,5 +7000,15 @@ "Html2ImageElementIntro": "通过调用 GetDataAsync 方法获得 base64-encoded 图片", "Html2ImageButtonText": "Image", "Html2ImageDesc": "由于底层使用的是 html-to-image 实际使用过程中遇到问题请参考项目 Issue" + }, + "BootstrapBlazor.Server.Components.Samples.UniverSheets": { + "UniverSheetTitle": "UniverSheet 电子表格组件", + "UniverSheetIntro": "封装开源办公套件 ​Univer​ 的核心电子表格组件,提供高性能、可扩展的在线表格解决方案", + "NormalTitle": "基础用法", + "NormalIntro": "通过设置 Plugins 参数设置自己的插件", + "NormalDesc": "点击 推送数据 按钮主动将数据推送给表格,点击 工具栏 第一个小按钮主动从服务器端获取数据", + "PushButtonText": "推送数据", + "ToastOnReadyTitle": "组件通知", + "ToastOnReadyContent": "表格组件已就绪,可进行后续数据推送等操作" } } From 120199390269974ced14bfc6b4f104e8ab00031f Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Fri, 28 Feb 2025 13:01:04 +0800 Subject: [PATCH 19/22] =?UTF-8?q?doc:=20=E6=9B=B4=E6=96=B0=E6=8E=A8?= =?UTF-8?q?=E9=80=81=E6=95=B0=E6=8D=AE=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Samples/UniverSheets.razor | 5 ++--- .../Components/Samples/UniverSheets.razor.cs | 9 ++++----- .../Components/Samples/UniverSheets.razor.css | 2 +- src/BootstrapBlazor.Server/Locales/zh-CN.json | 3 ++- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor index 1b09f009821..04ec496f081 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor +++ b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor @@ -14,10 +14,9 @@ Name="Normal">

@((MarkupString)Localizer["NormalDesc"].Value)

- +
- +
diff --git a/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.cs b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.cs index daceae5bcc9..5b108214db2 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.cs +++ b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.cs @@ -42,17 +42,16 @@ public partial class UniverSheets return Task.FromResult(result); } - private async Task OnPush() + private async Task OnPushExcelData() { await _sheet.PushDataAsync(new UniverSheetData() { MessageName = "MessageName", CommandName = "CommandName", - Data = new + Data = new object[] { - Id = 01, - Name = "Test-Name", - Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + new object[] { "1", "2", "3", "4", "5" }, + new object[] { "1", "2", "3", "4", "5" }, } }); } diff --git a/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.css b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.css index 958241368f1..abfb32681bb 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.css +++ b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.css @@ -1,5 +1,5 @@ .bb-sheet-demo { - height: calc(100vh - 198px); + height: 290px; width: 100%; border: 1px solid var(--bs-border-color); } diff --git a/src/BootstrapBlazor.Server/Locales/zh-CN.json b/src/BootstrapBlazor.Server/Locales/zh-CN.json index 7e918b42d7f..432fca6a6ff 100644 --- a/src/BootstrapBlazor.Server/Locales/zh-CN.json +++ b/src/BootstrapBlazor.Server/Locales/zh-CN.json @@ -7006,7 +7006,8 @@ "UniverSheetIntro": "封装开源办公套件 ​Univer​ 的核心电子表格组件,提供高性能、可扩展的在线表格解决方案", "NormalTitle": "基础用法", "NormalIntro": "通过设置 Plugins 参数设置自己的插件", - "NormalDesc": "点击 推送数据 按钮主动将数据推送给表格,点击 工具栏 第一个小按钮主动从服务器端获取数据", + "NormalDesc": "点击 推送数据 按钮主动将数据推送给表格", + "NormalDesc1": "点击 推送数据 按钮主动将数据推送给表格,点击 工具栏 第一个小按钮主动从服务器端获取数据", "PushButtonText": "推送数据", "ToastOnReadyTitle": "组件通知", "ToastOnReadyContent": "表格组件已就绪,可进行后续数据推送等操作" From b77e1a60dae09e11d0fd0adb7f60d6d73e307013 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Fri, 28 Feb 2025 14:25:23 +0800 Subject: [PATCH 20/22] =?UTF-8?q?doc:=20=E6=9B=B4=E6=96=B0=E7=A4=BA?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Samples/UniverSheets.razor | 15 +++++++++-- .../Components/Samples/UniverSheets.razor.cs | 21 +++++++++++++-- .../Components/Samples/UniverSheets.razor.js | 27 +------------------ 3 files changed, 33 insertions(+), 30 deletions(-) diff --git a/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor index 04ec496f081..822078d028e 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor +++ b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor @@ -8,7 +8,6 @@ - @@ -17,6 +16,18 @@
- + +
+
+ + +
+

@((MarkupString)Localizer["NormalDesc"].Value)

+ +
+
+
diff --git a/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.cs b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.cs index 5b108214db2..2c39bceac4b 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.cs +++ b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.cs @@ -21,7 +21,9 @@ public partial class UniverSheets { "ReportPlugin", "univer-sheet/plugin.js" } }; - private UniverSheet _sheet = default!; + private UniverSheet _sheetExcel = default!; + + private UniverSheet _sheetPlugin = default!; private async Task OnReadyAsync() => await ToastService.Information(Localizer["ToastOnReadyTitle"], Localizer["ToastOnReadyContent"]); @@ -44,7 +46,7 @@ public partial class UniverSheets private async Task OnPushExcelData() { - await _sheet.PushDataAsync(new UniverSheetData() + await _sheetExcel.PushDataAsync(new UniverSheetData() { MessageName = "MessageName", CommandName = "CommandName", @@ -55,4 +57,19 @@ await _sheet.PushDataAsync(new UniverSheetData() } }); } + + private async Task OnPushPluginData() + { + await _sheetPlugin.PushDataAsync(new UniverSheetData() + { + MessageName = "MessageName", + CommandName = "CommandName", + Data = new + { + Id = "1", + Name = "Test", + Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + } + }); + } } diff --git a/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.js b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.js index b25d5531710..76d916f6661 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.js +++ b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor.js @@ -1,29 +1,4 @@ -const beforeCreateUniver = (sheetName, options) => { - console.log(sheetName, options); -} - -const beforeCreateUniverSheet = (sheetName, workbookData) => { - console.log(sheetName, workbookData); -} - -if (window.BootstrapBlazor === void 0) { - window.BootstrapBlazor = {}; -} - -if (window.BootstrapBlazor.Univer === void 0) { - window.BootstrapBlazor.Univer = {}; -} - -if (window.BootstrapBlazor.Univer.Sheet === void 0) { - window.BootstrapBlazor.Univer.Sheet = { - callbacks: { - beforeCreateUniver: beforeCreateUniver, - beforeCreateUniverSheet: beforeCreateUniverSheet - } - } -} - -export function init(id) { +export function init(id) { } From 08132dc3e4e1e07167e3800b8898e4a4555e6702 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Fri, 28 Feb 2025 14:30:25 +0800 Subject: [PATCH 21/22] =?UTF-8?q?doc:=20=E5=A2=9E=E5=8A=A0=E5=A4=9A?= =?UTF-8?q?=E8=AF=AD=E8=A8=80=E8=B5=84=E6=BA=90=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Samples/UniverSheets.razor | 4 ++-- src/BootstrapBlazor.Server/Locales/en-US.json | 7 +++++-- src/BootstrapBlazor.Server/Locales/zh-CN.json | 10 ++++++---- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor index 822078d028e..0ce64a216f8 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor +++ b/src/BootstrapBlazor.Server/Components/Samples/UniverSheets.razor @@ -12,7 +12,7 @@ Introduction="@Localizer["NormalIntro"]" Name="Normal">
-

@((MarkupString)Localizer["NormalDesc"].Value)

+

@((MarkupString)Localizer["NormalDesc1"].Value)

@@ -24,7 +24,7 @@ Introduction="@Localizer["PluginIntro"]" Name="Plugin">
-

@((MarkupString)Localizer["NormalDesc"].Value)

+

@((MarkupString)Localizer["NormalDesc2"].Value)

diff --git a/src/BootstrapBlazor.Server/Locales/en-US.json b/src/BootstrapBlazor.Server/Locales/en-US.json index 997a3d22417..231d6c0d98a 100644 --- a/src/BootstrapBlazor.Server/Locales/en-US.json +++ b/src/BootstrapBlazor.Server/Locales/en-US.json @@ -7006,9 +7006,12 @@ "UniverSheetIntro": "Encapsulates the core spreadsheet component of the open source office suite ​Univer​, providing a high-performance, scalable online spreadsheet solution", "NormalTitle": "Basic usage", "NormalIntro": "Set your own plugins by setting the Plugins parameter", - "NormalDesc": "Click the Push Data button to push data to the table, and click the first small button on the Toolbar to get data from the server.", + "NormalDesc1": "Push data to the spreadsheet by calling the instance method PushDataAsync", + "NormalDesc2": "Click the Push Data button to push data to the table, and click the first icon on the Toolbar to get data from the server.", "PushButtonText": "Push", "ToastOnReadyTitle": "Notification", - "ToastOnReadyContent": "The sheet is ready for push data." + "ToastOnReadyContent": "The sheet is ready for push data.", + "PluginTitle": "Plugins", + "PluginIntro": "Set custom plugins by setting the Plugins parameter" } } diff --git a/src/BootstrapBlazor.Server/Locales/zh-CN.json b/src/BootstrapBlazor.Server/Locales/zh-CN.json index 432fca6a6ff..d1ce766180b 100644 --- a/src/BootstrapBlazor.Server/Locales/zh-CN.json +++ b/src/BootstrapBlazor.Server/Locales/zh-CN.json @@ -7005,11 +7005,13 @@ "UniverSheetTitle": "UniverSheet 电子表格组件", "UniverSheetIntro": "封装开源办公套件 ​Univer​ 的核心电子表格组件,提供高性能、可扩展的在线表格解决方案", "NormalTitle": "基础用法", - "NormalIntro": "通过设置 Plugins 参数设置自己的插件", - "NormalDesc": "点击 推送数据 按钮主动将数据推送给表格", - "NormalDesc1": "点击 推送数据 按钮主动将数据推送给表格,点击 工具栏 第一个小按钮主动从服务器端获取数据", + "NormalIntro": "通过调用实例方法 PushDataAsync 推送数据到电子表格", + "NormalDesc1": "点击 推送数据 按钮主动将数据推送给表格", + "NormalDesc2": "点击 推送数据 按钮主动将数据推送给表格,点击 工具栏 第一个小按钮主动从服务器端获取数据", "PushButtonText": "推送数据", "ToastOnReadyTitle": "组件通知", - "ToastOnReadyContent": "表格组件已就绪,可进行后续数据推送等操作" + "ToastOnReadyContent": "表格组件已就绪,可进行后续数据推送等操作", + "PluginTitle": "自定义插件", + "PluginIntro": "通过设置 Plugins 参数设置自己的插件" } } From 8aafccc8af2d771ca3f050709a05672d73b2ad2f Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Fri, 28 Feb 2025 14:54:08 +0800 Subject: [PATCH 22/22] =?UTF-8?q?chore:=20=E6=9B=B4=E6=96=B0=E4=BE=9D?= =?UTF-8?q?=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BootstrapBlazor.sln | 7 ------- src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj | 6 +++--- .../wwwroot/univer-sheet/controller.js | 1 - 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/BootstrapBlazor.sln b/BootstrapBlazor.sln index 9bb06bfaa99..c0db3d47fbb 100644 --- a/BootstrapBlazor.sln +++ b/BootstrapBlazor.sln @@ -78,8 +78,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{9BAF50BE EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTest.Benchmarks", "tools\Benchmarks\UnitTest.Benchmarks.csproj", "{3E6D8D0E-5A36-4CFD-8612-7D64E3FFE7B1}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BootstrapBlazor.UniverSheet", "..\BootstrapBlazor.Extensions\src\components\BootstrapBlazor.UniverSheet\BootstrapBlazor.UniverSheet.csproj", "{1A0FDDCB-63A3-B260-4F9E-C820C70CD0BC}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -114,10 +112,6 @@ Global {3E6D8D0E-5A36-4CFD-8612-7D64E3FFE7B1}.Debug|Any CPU.Build.0 = Debug|Any CPU {3E6D8D0E-5A36-4CFD-8612-7D64E3FFE7B1}.Release|Any CPU.ActiveCfg = Release|Any CPU {3E6D8D0E-5A36-4CFD-8612-7D64E3FFE7B1}.Release|Any CPU.Build.0 = Release|Any CPU - {1A0FDDCB-63A3-B260-4F9E-C820C70CD0BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1A0FDDCB-63A3-B260-4F9E-C820C70CD0BC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1A0FDDCB-63A3-B260-4F9E-C820C70CD0BC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1A0FDDCB-63A3-B260-4F9E-C820C70CD0BC}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -134,7 +128,6 @@ Global {D8AEAFE7-10AF-4A5B-BC67-FE740A2CA1DF} = {7C1D79F1-87BC-42C1-BD5A-CDE4044AC1BD} {C075C6C8-B9CB-4AC0-9BDF-B2002B4AB99C} = {EA765165-0542-41C8-93F2-85787FEDEDFF} {3E6D8D0E-5A36-4CFD-8612-7D64E3FFE7B1} = {9BAF50BE-141D-4429-93A9-942F373D1F68} - {1A0FDDCB-63A3-B260-4F9E-C820C70CD0BC} = {A2182155-43ED-44C1-BF6F-1B70EBD2DFFE} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {0DCB0756-34FA-4FD0-AE1D-D3F08B5B3A6B} diff --git a/src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj b/src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj index 1a3ea20a1c6..cd163e942ae 100644 --- a/src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj +++ b/src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj @@ -38,12 +38,12 @@ - + - + @@ -64,6 +64,7 @@ + @@ -75,7 +76,6 @@ - diff --git a/src/BootstrapBlazor.Server/wwwroot/univer-sheet/controller.js b/src/BootstrapBlazor.Server/wwwroot/univer-sheet/controller.js index 715d30a9c43..a41c049fd0b 100644 --- a/src/BootstrapBlazor.Server/wwwroot/univer-sheet/controller.js +++ b/src/BootstrapBlazor.Server/wwwroot/univer-sheet/controller.js @@ -111,7 +111,6 @@ export class ReportController extends Disposable { [{ v: data.data.id }, { v: data.data.name }, { v: data.data.value }] ] range.setValues(defaultData); - } }