open-grid 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +376 -353
- package/README.md +1 -1
- package/dist/OpenGrid-B7m7ei7f.cjs +7385 -0
- package/dist/OpenGrid-CeUdO_fM.js +7398 -0
- package/dist/index-CeJ-0-80.cjs +260 -0
- package/dist/index-DnarQ4eR.js +266 -0
- package/dist/index-DrCPRuYi.js +548 -0
- package/dist/index-JjfWY3Bt.cjs +520 -0
- package/dist/open-grid-base.css +12 -1
- package/dist/open-grid-react.cjs +27 -1
- package/dist/open-grid-react.js +22 -82
- package/dist/open-grid-vue.cjs +31 -1
- package/dist/open-grid-vue.js +29 -79
- package/dist/open-grid.cjs +272 -6
- package/dist/open-grid.js +177 -266
- package/dist/types/bench/perf.d.ts +14 -8
- package/dist/types/core/AppearanceResolver.d.ts +98 -11
- package/dist/types/core/CFRenderBridge.d.ts +13 -0
- package/dist/types/core/CellEditManager.d.ts +73 -0
- package/dist/types/core/CellEventHandler.d.ts +99 -2
- package/dist/types/core/CellTypeRegistry.d.ts +24 -0
- package/dist/types/core/ChartManager.d.ts +51 -3
- package/dist/types/core/ColumnLayout.d.ts +100 -2
- package/dist/types/core/ContextMenu.d.ts +43 -2
- package/dist/types/core/CrossGridController.d.ts +86 -15
- package/dist/types/core/CrossGridMapper.d.ts +43 -5
- package/dist/types/core/CrossGridRegistry.d.ts +36 -2
- package/dist/types/core/DataLayer.d.ts +210 -15
- package/dist/types/core/DetailManager.d.ts +106 -15
- package/dist/types/core/DragVisuals.d.ts +33 -4
- package/dist/types/core/EventEmitter.d.ts +54 -0
- package/dist/types/core/ExportManager.d.ts +66 -1
- package/dist/types/core/ExtensionPointRegistry.d.ts +160 -14
- package/dist/types/core/FilterPanel.d.ts +17 -2
- package/dist/types/core/FilterSelect.d.ts +37 -13
- package/dist/types/core/FindBarManager.d.ts +26 -0
- package/dist/types/core/FlatRowModel.d.ts +54 -11
- package/dist/types/core/FooterManager.d.ts +53 -1
- package/dist/types/core/FormulaController.d.ts +139 -10
- package/dist/types/core/FormulaEngine.d.ts +15 -4
- package/dist/types/core/GridComposer.d.ts +54 -6
- package/dist/types/core/GridRenderer.d.ts +143 -10
- package/dist/types/core/GridShuttle.d.ts +44 -4
- package/dist/types/core/GroupEngine.d.ts +68 -10
- package/dist/types/core/GroupTreeManager.d.ts +86 -2
- package/dist/types/core/IconRegistry.d.ts +56 -9
- package/dist/types/core/KeyboardManager.d.ts +88 -4
- package/dist/types/core/MaskingEngine.d.ts +10 -9
- package/dist/types/core/MathUtils.d.ts +58 -5
- package/dist/types/core/MergeEngine.d.ts +45 -10
- package/dist/types/core/MutationService.d.ts +113 -10
- package/dist/types/core/OGDecimal.d.ts +144 -13
- package/dist/types/core/OpenGrid.d.ts +99 -0
- package/dist/types/core/OrgChart.d.ts +56 -1
- package/dist/types/core/OverrideKernel.d.ts +59 -15
- package/dist/types/core/Pagination.d.ts +38 -4
- package/dist/types/core/PivotEngine.d.ts +37 -0
- package/dist/types/core/RangeSelectionManager.d.ts +121 -7
- package/dist/types/core/RenderController.d.ts +56 -0
- package/dist/types/core/RowDragDrop.d.ts +52 -6
- package/dist/types/core/RowManager.d.ts +55 -0
- package/dist/types/core/SkinRegistry.d.ts +55 -15
- package/dist/types/core/SortFilterManager.d.ts +80 -1
- package/dist/types/core/TreeEngine.d.ts +60 -6
- package/dist/types/core/TriggerManager.d.ts +46 -0
- package/dist/types/core/VirtualScroll.d.ts +64 -0
- package/dist/types/core/WorksheetManager.d.ts +61 -2
- package/dist/types/core/XmlConverter.d.ts +56 -23
- package/dist/types/core/a11y/AccessibilityAdapter.d.ts +103 -0
- package/dist/types/core/a11y/AriaIntent.d.ts +34 -0
- package/dist/types/core/a11y/KeyboardInteractionModel.d.ts +64 -0
- package/dist/types/core/a11y/LiveRegionController.d.ts +89 -0
- package/dist/types/core/a11y/OverlayStack.d.ts +36 -0
- package/dist/types/core/a11y/VisualEquivRegistry.d.ts +37 -0
- package/dist/types/core/a11y/index.d.ts +13 -0
- package/dist/types/core/a11y/ports.d.ts +24 -0
- package/dist/types/core/appearance/Appearance.d.ts +68 -0
- package/dist/types/core/appearance/AppearanceAxis.d.ts +94 -0
- package/dist/types/core/appearance/AppearanceComposer.d.ts +45 -0
- package/dist/types/core/appearance/AppearanceProvider.d.ts +50 -0
- package/dist/types/core/appearance/AppearanceView.d.ts +51 -0
- package/dist/types/core/appearance/DensityRegistry.d.ts +36 -0
- package/dist/types/core/appearance/ResolvedAppearanceSnapshot.d.ts +84 -0
- package/dist/types/core/appearance/TextureRegistry.d.ts +32 -0
- package/dist/types/core/appearance/ThemeMetaRegistry.d.ts +67 -0
- package/dist/types/core/appearance/axisAdapters.d.ts +37 -0
- package/dist/types/core/appearance/defaults.d.ts +10 -0
- package/dist/types/core/appearance/index.d.ts +20 -0
- package/dist/types/core/appearance/tokenCatalog.d.ts +30 -0
- package/dist/types/core/cf/CFEngine.d.ts +56 -0
- package/dist/types/core/cf/CFEvaluator.d.ts +24 -0
- package/dist/types/core/cf/CFRule.d.ts +127 -0
- package/dist/types/core/cf/ColorScale.d.ts +49 -0
- package/dist/types/core/cf/InkResolver.d.ts +33 -0
- package/dist/types/core/cf/appearance.d.ts +20 -0
- package/dist/types/core/cf/encoders.d.ts +61 -0
- package/dist/types/core/cf/eval-types.d.ts +93 -0
- package/dist/types/core/cf/index.d.ts +21 -0
- package/dist/types/core/cf/lineage.d.ts +32 -0
- package/dist/types/core/cf/predicates.d.ts +27 -0
- package/dist/types/core/cf/serialize.d.ts +46 -0
- package/dist/types/core/chart/CanvasAdapter.d.ts +50 -1
- package/dist/types/core/chart/DataExtractor.d.ts +53 -12
- package/dist/types/core/chart/a11y.d.ts +22 -0
- package/dist/types/core/chart/chart-type-registry.d.ts +53 -0
- package/dist/types/core/chart/downsample-report.d.ts +36 -0
- package/dist/types/core/chart/downsample.d.ts +26 -1
- package/dist/types/core/chart/engine/ChartEngineRegistry.d.ts +52 -0
- package/dist/types/core/chart/geometry.d.ts +96 -0
- package/dist/types/core/chart/hittest.d.ts +21 -3
- package/dist/types/core/chart/palette.d.ts +96 -12
- package/dist/types/core/chart/parity.d.ts +12 -0
- package/dist/types/core/chart/provenance.d.ts +47 -0
- package/dist/types/core/chart/scales.d.ts +28 -1
- package/dist/types/core/chart/scene.d.ts +102 -0
- package/dist/types/core/chart/server.d.ts +36 -0
- package/dist/types/core/chart/surfaces/CanvasSurface.d.ts +48 -0
- package/dist/types/core/chart/surfaces/ServerRasterSurface.d.ts +26 -0
- package/dist/types/core/chart/surfaces/SvgSurface.d.ts +24 -0
- package/dist/types/core/chart/surfaces/pattern-overlay.d.ts +24 -0
- package/dist/types/core/chart/types.d.ts +107 -10
- package/dist/types/core/command/CommandBus.d.ts +51 -0
- package/dist/types/core/command/CommandRegistry.d.ts +43 -0
- package/dist/types/core/command/CommandStack.d.ts +38 -0
- package/dist/types/core/command/ICommand.d.ts +110 -0
- package/dist/types/core/command/commands/CellWriteCommand.d.ts +32 -0
- package/dist/types/core/command/commands/CompositeCommand.d.ts +17 -0
- package/dist/types/core/command/commands/RowCommands.d.ts +39 -0
- package/dist/types/core/command/index.d.ts +9 -0
- package/dist/types/core/command/support.d.ts +51 -0
- package/dist/types/core/coordinate/ColumnMetrics.d.ts +30 -0
- package/dist/types/core/coordinate/CoordinateKernel.d.ts +88 -0
- package/dist/types/core/coordinate/FrozenPanes.d.ts +29 -0
- package/dist/types/core/coordinate/MergeSourceAdapter.d.ts +18 -0
- package/dist/types/core/coordinate/NodeBudget.d.ts +33 -0
- package/dist/types/core/coordinate/ResizeGovernor.d.ts +50 -0
- package/dist/types/core/coordinate/RowMetrics.d.ts +37 -0
- package/dist/types/core/coordinate/ViewPermutation.d.ts +23 -0
- package/dist/types/core/coordinate/index.d.ts +10 -0
- package/dist/types/core/coordinate/ports.d.ts +45 -0
- package/dist/types/core/coordinate/types.d.ts +76 -0
- package/dist/types/core/detail/DetailGlyph.d.ts +42 -7
- package/dist/types/core/detail/DetailSplice.d.ts +42 -11
- package/dist/types/core/detail/DetailState.d.ts +80 -11
- package/dist/types/core/detail/SubgridCache.d.ts +72 -10
- package/dist/types/core/detail/index.d.ts +8 -0
- package/dist/types/core/domain/AggregateResult.d.ts +54 -0
- package/dist/types/core/domain/CellAddress.d.ts +61 -0
- package/dist/types/core/domain/CellValueAccess.d.ts +29 -0
- package/dist/types/core/domain/Delta.d.ts +37 -0
- package/dist/types/core/domain/DomainValue.d.ts +80 -0
- package/dist/types/core/domain/Missing.d.ts +65 -0
- package/dist/types/core/domain/Money.d.ts +42 -0
- package/dist/types/core/domain/NormalizationBasis.d.ts +47 -0
- package/dist/types/core/domain/Plain.d.ts +45 -0
- package/dist/types/core/domain/Quantity.d.ts +32 -0
- package/dist/types/core/domain/Ratios.d.ts +100 -0
- package/dist/types/core/domain/ThresholdSet.d.ts +46 -0
- package/dist/types/core/domain/ValueType.d.ts +71 -0
- package/dist/types/core/domain/rounding.d.ts +25 -0
- package/dist/types/core/domain/strategies.d.ts +38 -0
- package/dist/types/core/editors/CellEditor.d.ts +29 -2
- package/dist/types/core/editors/DateEditor.d.ts +18 -0
- package/dist/types/core/editors/SelectEditor.d.ts +29 -0
- package/dist/types/core/export/ChannelRegistry.d.ts +18 -0
- package/dist/types/core/export/ExportManifest.d.ts +13 -0
- package/dist/types/core/export/GridArtifactSource.d.ts +62 -0
- package/dist/types/core/export/Provenance.d.ts +34 -0
- package/dist/types/core/export/StreamPump.d.ts +28 -0
- package/dist/types/core/export/channels/CsvChannel.d.ts +20 -0
- package/dist/types/core/export/channels/JsonChannel.d.ts +18 -0
- package/dist/types/core/export/channels/XlsxChannel.d.ts +53 -0
- package/dist/types/core/export/channels/XmlChannel.d.ts +21 -0
- package/dist/types/core/export/channels/capabilities.d.ts +13 -0
- package/dist/types/core/export/index.d.ts +24 -0
- package/dist/types/core/export/print/OutputChannelAdapter.d.ts +61 -0
- package/dist/types/core/export/print/Paginator.d.ts +48 -0
- package/dist/types/core/export/print/PrintRenderTarget.d.ts +36 -0
- package/dist/types/core/export/sinks.d.ts +40 -0
- package/dist/types/core/export/types.d.ts +211 -0
- package/dist/types/core/extension/DeprecationManager.d.ts +42 -0
- package/dist/types/core/extension/IExtension.d.ts +90 -0
- package/dist/types/core/extension/Registry.d.ts +142 -0
- package/dist/types/core/extension/SlotRegistry.d.ts +46 -0
- package/dist/types/core/extension/adapters.d.ts +44 -0
- package/dist/types/core/extension/conformance.d.ts +47 -0
- package/dist/types/core/extension/index.d.ts +16 -0
- package/dist/types/core/extension/registries.d.ts +31 -0
- package/dist/types/core/extension/reserved.d.ts +10 -0
- package/dist/types/core/format/DisplayFormatter.d.ts +47 -0
- package/dist/types/core/format/FormatCache.d.ts +20 -0
- package/dist/types/core/format/FormatterRegistry.d.ts +22 -0
- package/dist/types/core/format/grammar/AstRenderer.d.ts +10 -0
- package/dist/types/core/format/grammar/FormatCompiler.d.ts +16 -0
- package/dist/types/core/format/index.d.ts +55 -0
- package/dist/types/core/format/pipeline/DomainTypeResolver.d.ts +8 -0
- package/dist/types/core/format/pipeline/LocaleFormat.d.ts +11 -0
- package/dist/types/core/format/pipeline/ValueInterpreter.d.ts +8 -0
- package/dist/types/core/format/policy/MaskPolicy.d.ts +8 -0
- package/dist/types/core/format/policy/NegativePolicy.d.ts +12 -0
- package/dist/types/core/format/policy/NullPolicy.d.ts +10 -0
- package/dist/types/core/format/policy/TruncatePolicy.d.ts +11 -0
- package/dist/types/core/format/types.d.ts +292 -0
- package/dist/types/core/formula/CalcCacheStore.d.ts +89 -0
- package/dist/types/core/formula/CalcProvenance.d.ts +44 -0
- package/dist/types/core/formula/CalcService.d.ts +137 -0
- package/dist/types/core/formula/CyclePathReporter.d.ts +28 -0
- package/dist/types/core/formula/FormulaEvaluator.d.ts +35 -1
- package/dist/types/core/formula/FormulaGraph.d.ts +84 -7
- package/dist/types/core/formula/FormulaParser.d.ts +9 -0
- package/dist/types/core/formula/FormulaStore.d.ts +63 -1
- package/dist/types/core/formula/FunctionRegistry.d.ts +138 -0
- package/dist/types/core/formula/Generation.d.ts +86 -0
- package/dist/types/core/formula/RecalcCoordinator.d.ts +151 -9
- package/dist/types/core/formula/ReferenceRewriter.d.ts +81 -0
- package/dist/types/core/formula/functions/essential.d.ts +3 -0
- package/dist/types/core/formula/functions/extended/index.d.ts +10 -0
- package/dist/types/core/formula/normalizeRefs.d.ts +34 -3
- package/dist/types/core/formula/numericLiteral.d.ts +11 -1
- package/dist/types/core/formula/serializeFormula.d.ts +10 -1
- package/dist/types/core/formula/types.d.ts +71 -8
- package/dist/types/core/host/CapabilityRegistry.d.ts +61 -0
- package/dist/types/core/host/GridHostDriver.d.ts +27 -0
- package/dist/types/core/host/GridHostPort.d.ts +37 -0
- package/dist/types/core/host/SliceOwnershipGuard.d.ts +27 -0
- package/dist/types/core/host/archCheck.d.ts +26 -0
- package/dist/types/core/host/index.d.ts +6 -0
- package/dist/types/core/host/reconcile.d.ts +22 -0
- package/dist/types/core/i18n/LocaleContext.d.ts +40 -0
- package/dist/types/core/i18n/types.d.ts +26 -1
- package/dist/types/core/icons/bootstrap-icons.d.ts +4 -2
- package/dist/types/core/quality/ContrastAuditor.d.ts +64 -0
- package/dist/types/core/quality/DeterminismKernel.d.ts +68 -0
- package/dist/types/core/quality/PerfBaseline.d.ts +23 -0
- package/dist/types/core/quality/PerfSpec.d.ts +95 -0
- package/dist/types/core/quality/RealBrowserGate.d.ts +69 -0
- package/dist/types/core/quality/RegressionJudge.d.ts +35 -0
- package/dist/types/core/quality/ReleaseGate.d.ts +94 -0
- package/dist/types/core/quality/VisualRegression.d.ts +74 -0
- package/dist/types/core/quality/hooks.d.ts +53 -0
- package/dist/types/core/quality/index.d.ts +20 -0
- package/dist/types/core/quality/pixelMetrics.d.ts +24 -0
- package/dist/types/core/range/ClipboardCodec.d.ts +46 -4
- package/dist/types/core/range/FillEngine.d.ts +69 -9
- package/dist/types/core/range/RangeModel.d.ts +100 -13
- package/dist/types/core/range/RangeQuery.d.ts +24 -2
- package/dist/types/core/range/types.d.ts +27 -11
- package/dist/types/core/realtime/BackpressureScheduler.d.ts +0 -0
- package/dist/types/core/realtime/FreshnessClock.d.ts +34 -0
- package/dist/types/core/realtime/IRealtimeSource.d.ts +82 -0
- package/dist/types/core/realtime/LiveStateGuard.d.ts +23 -0
- package/dist/types/core/realtime/PollingSource.d.ts +42 -0
- package/dist/types/core/realtime/RealtimeController.d.ts +54 -0
- package/dist/types/core/realtime/RtAnnouncePolicy.d.ts +53 -0
- package/dist/types/core/realtime/RtApplyCommand.d.ts +29 -0
- package/dist/types/core/realtime/RtChartTargetTrigger.d.ts +26 -0
- package/dist/types/core/realtime/StreamingSource.d.ts +47 -0
- package/dist/types/core/realtime/backoff.d.ts +12 -0
- package/dist/types/core/realtime/index.d.ts +13 -0
- package/dist/types/core/realtime/ports.d.ts +80 -0
- package/dist/types/core/render/CellApplier.d.ts +18 -0
- package/dist/types/core/render/CellErrorBoundary.d.ts +65 -0
- package/dist/types/core/render/CellPipeline.d.ts +39 -0
- package/dist/types/core/render/CellRenderRequest.d.ts +209 -0
- package/dist/types/core/render/CellStageRegistry.d.ts +53 -0
- package/dist/types/core/render/OverlayCompositor.d.ts +38 -0
- package/dist/types/core/render/RenderBudget.d.ts +67 -0
- package/dist/types/core/render/contrast.d.ts +33 -0
- package/dist/types/core/render/index.d.ts +35 -0
- package/dist/types/core/render/stages/BackgroundStage.d.ts +14 -0
- package/dist/types/core/render/stages/DecoratorStage.d.ts +12 -0
- package/dist/types/core/render/stages/OverlayStage.d.ts +12 -0
- package/dist/types/core/render/stages/ValueRendererStage.d.ts +15 -0
- package/dist/types/core/render/stages/index.d.ts +14 -0
- package/dist/types/core/renderers/CellRenderer.d.ts +100 -8
- package/dist/types/core/state/AutosaveController.d.ts +63 -0
- package/dist/types/core/state/IStatePersistence.d.ts +59 -0
- package/dist/types/core/state/MultiTabGuard.d.ts +33 -0
- package/dist/types/core/state/SchemaMigrator.d.ts +33 -0
- package/dist/types/core/state/SemVerPolicy.d.ts +39 -0
- package/dist/types/core/state/StateCodec.d.ts +75 -0
- package/dist/types/core/state/index.d.ts +6 -0
- package/dist/types/core/types.d.ts +17 -0
- package/dist/types/react/OpenGrid.d.ts +54 -0
- package/dist/types/react/index.d.ts +5 -0
- package/dist/types/realtime/index.d.ts +1 -0
- package/dist/types/vue/index.d.ts +5 -0
- package/dist/types/vue/types.d.ts +35 -0
- package/dist/xlsx.min-BQ1o3sB6.cjs +11793 -0
- package/dist/{xlsx.min-Wavxcamn.js → xlsx.min-Bbz2ZypC.js} +453 -566
- package/package.json +112 -110
- package/dist/OpenGrid-B0Spm0rU.js +0 -10404
- package/dist/OpenGrid-CuXj0isp.cjs +0 -97
- package/dist/xlsx.min-Bx-LxWOf.cjs +0 -138
|
@@ -1,29 +1,76 @@
|
|
|
1
1
|
import { CellKey, CellValue, FormulaCell, FormulaErrorCode, FormulaGridAccessor, RefMode } from './types.js';
|
|
2
|
+
import { FunctionRegistry } from './FunctionRegistry.js';
|
|
2
3
|
import { indexToColLetters } from './normalizeRefs.js';
|
|
3
4
|
import { FormulaStore } from './FormulaStore.js';
|
|
4
5
|
import { FormulaGraph } from './FormulaGraph.js';
|
|
6
|
+
/**
|
|
7
|
+
* 재계산 1회의 요약 결과. / Summary of a single recalculation pass.
|
|
8
|
+
*/
|
|
5
9
|
export interface RecalcSummary {
|
|
10
|
+
/** 이번 패스에서 값이 갱신된 셀 키(위상순서 + 사이클). / Cell keys updated this pass (topological order + cycles). */
|
|
6
11
|
changed: CellKey[];
|
|
12
|
+
/** 사이클(#CYCLE)로 판정된 셀 수. / Number of cells resolved as a cycle (#CYCLE). */
|
|
7
13
|
cycles: number;
|
|
14
|
+
/** 소요 시간(ms). / Elapsed time in ms. */
|
|
8
15
|
ms: number;
|
|
9
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* RecalcCoordinator 생성 옵션. 그리드가 접근자/콜백을 주입한다.
|
|
19
|
+
* / Construction options for RecalcCoordinator. The grid injects the accessor/callbacks.
|
|
20
|
+
*/
|
|
10
21
|
export interface RecalcCoordinatorOptions {
|
|
22
|
+
/** 그리드 좌표/값 접근자(FlatRowModel·ColumnLayout·DataLayer 경유). / Grid coordinate/value accessor (via FlatRowModel/ColumnLayout/DataLayer). */
|
|
11
23
|
accessor: FormulaGridAccessor;
|
|
24
|
+
/** 계산 결과를 셀에 반영하는 콜백(§4.2 DataLayer.setComputedValue 상당). / Callback that writes a computed value back to a cell (≈ §4.2 DataLayer.setComputedValue). */
|
|
12
25
|
setComputedValue: (rowId: string, field: string, value: CellValue) => void;
|
|
26
|
+
/** (선택) 수식 에러 통지 콜백(§8.3 formulaError 이벤트 재료). / (optional) Formula-error notification callback (source for the §8.3 formulaError event). */
|
|
13
27
|
onFormulaError?: (rowId: string, field: string, error: FormulaErrorCode) => void;
|
|
28
|
+
/** 참조 정규화 모드(§8.1 formula.refMode, 기본 'stable' §3.2). / Reference normalization mode (§8.1 formula.refMode, default 'stable', §3.2). */
|
|
14
29
|
refMode?: RefMode;
|
|
30
|
+
/** 나눗셈 소수점 자리수(§8.1 formula.divisionPrecision, 기본 30). / Division decimal-place precision (§8.1 formula.divisionPrecision, default 30). */
|
|
15
31
|
divisionPrecision?: number;
|
|
32
|
+
/** (선택·additive, DD-08 §2.3) 함수 레지스트리 — 주입 시 override/확장 함수를 평가에 편입(미주입=내장 switch 만). / (optional·additive) Function registry — activates override/extended functions when injected. */
|
|
33
|
+
functions?: FunctionRegistry;
|
|
34
|
+
/** (선택·additive, DD-08 §2.4) 결정론 주입 시각(volatile 함수용). / (optional·additive) Injected deterministic clock (for volatile funcs). */
|
|
35
|
+
now?: () => number;
|
|
16
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* F3 셀 수식 오케스트레이션: 파싱→정규화→저장→그래프→배치 재계산을 조율한다.
|
|
39
|
+
* 헤드리스 계층으로 DOM/OpenGrid 를 전혀 모르며, 그리드가 accessor·setComputedValue 를
|
|
40
|
+
* 주입한다(§5.3/§8.2). 배선(OpenGrid 연결)은 후속 태스크 몫이다.
|
|
41
|
+
* / F3 cell-formula orchestration: coordinates parse → normalize → store → graph → batch
|
|
42
|
+
* recalculation. A headless layer that knows nothing of DOM/OpenGrid; the grid injects the
|
|
43
|
+
* accessor and setComputedValue (§5.3/§8.2). Wiring into OpenGrid is a follow-up task.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* const coord = new RecalcCoordinator({ accessor, setComputedValue });
|
|
47
|
+
* coord.setCellFormula('r1', 'total', '=[price] * [qty]');
|
|
48
|
+
*/
|
|
17
49
|
export declare class RecalcCoordinator {
|
|
50
|
+
/** 수식 사이드카 저장소. / Formula sidecar store. */
|
|
18
51
|
readonly store: FormulaStore;
|
|
52
|
+
/** 의존성 그래프. / Dependency graph. */
|
|
19
53
|
readonly graph: FormulaGraph;
|
|
20
54
|
private readonly _accessor;
|
|
21
55
|
private readonly _setComputedValue;
|
|
22
56
|
private readonly _onFormulaError;
|
|
23
57
|
private readonly _refMode;
|
|
24
58
|
private readonly _prec;
|
|
59
|
+
private readonly _functions;
|
|
60
|
+
private readonly _now;
|
|
25
61
|
constructor(opts: RecalcCoordinatorOptions);
|
|
26
|
-
/**
|
|
62
|
+
/** DD-08 §2.3: evaluate 옵션에 레지스트리/결정론 시각을 주입(미주입 시 undefined → 기존 동작). / Assemble evaluate options with the injected registry/clock (undefined preserves prior behavior). */
|
|
63
|
+
private _evalOpts;
|
|
64
|
+
/**
|
|
65
|
+
* src("=...")를 파싱+정규화한다. 파싱 자체가 실패하면 #ERR 을 담은 error AST로 폴백한다.
|
|
66
|
+
* setCellFormula 내부 및 단독 검증용.
|
|
67
|
+
* / Parse + normalize `src` ("=..."). On a parse failure, falls back to an error AST holding
|
|
68
|
+
* #ERR. Used inside setCellFormula and for standalone validation.
|
|
69
|
+
*
|
|
70
|
+
* @param src - 수식 원문 / Formula source text
|
|
71
|
+
* @param host - 수식이 저장될 호스트 셀(rowId·field) / Host cell (rowId, field) where the formula is stored
|
|
72
|
+
* @returns 정규화 AST 와 범위참조 포함 여부 / The normalized AST and whether it bears a range reference
|
|
73
|
+
*/
|
|
27
74
|
compile(src: string, host: {
|
|
28
75
|
rowId: string;
|
|
29
76
|
field: string;
|
|
@@ -33,6 +80,13 @@ export declare class RecalcCoordinator {
|
|
|
33
80
|
};
|
|
34
81
|
/**
|
|
35
82
|
* setCellFormula(§8.2) — 저장 후 즉시 평가하고, 기존 dependents 가 있으면 함께 dirty 처리.
|
|
83
|
+
* / setCellFormula (§8.2) — store the formula, evaluate it immediately, and also dirty any
|
|
84
|
+
* existing dependents.
|
|
85
|
+
*
|
|
86
|
+
* @param rowId - 대상 행의 stable id / Stable id of the target row
|
|
87
|
+
* @param field - 컬럼 field 명 / Column field name
|
|
88
|
+
* @param src - 수식 원문(예: "=[price] * [qty]") / Formula source (e.g. "=[price] * [qty]")
|
|
89
|
+
* @returns 이번 재계산 요약 / Summary of the resulting recalculation
|
|
36
90
|
*
|
|
37
91
|
* ⚠️ 순서가 중요하다(사이클 탐지 정합성): 새 수식을 등록하는 바로 그 순간에 사이클이
|
|
38
92
|
* "완성"될 수 있다(예: A1=B1 이미 있고 지금 B1=A1 을 등록). onValuesChanged 의
|
|
@@ -45,12 +99,53 @@ export declare class RecalcCoordinator {
|
|
|
45
99
|
* state)과는 무관하다(§13 f3.perf.closure 는 신규 등록이 아니라 leaf 값 변경 시나리오).
|
|
46
100
|
*/
|
|
47
101
|
setCellFormula(rowId: string, field: string, src: string): RecalcSummary;
|
|
102
|
+
/**
|
|
103
|
+
* (rowId, field) 셀의 수식 원문을 반환한다(없으면 null).
|
|
104
|
+
* / Return the formula source of the (rowId, field) cell (null if none).
|
|
105
|
+
*
|
|
106
|
+
* @param rowId - 대상 행의 stable id / Stable id of the target row
|
|
107
|
+
* @param field - 컬럼 field 명 / Column field name
|
|
108
|
+
* @returns 수식 원문 또는 null / Formula source or null
|
|
109
|
+
*/
|
|
48
110
|
getCellFormula(rowId: string, field: string): string | null;
|
|
111
|
+
/**
|
|
112
|
+
* (rowId, field) 셀에 수식이 있는지 여부.
|
|
113
|
+
* / Whether the (rowId, field) cell has a formula.
|
|
114
|
+
*
|
|
115
|
+
* @param rowId - 대상 행의 stable id / Stable id of the target row
|
|
116
|
+
* @param field - 컬럼 field 명 / Column field name
|
|
117
|
+
* @returns 수식 존재 여부 / Whether a formula exists
|
|
118
|
+
*/
|
|
49
119
|
hasCellFormula(rowId: string, field: string): boolean;
|
|
50
|
-
/**
|
|
120
|
+
/**
|
|
121
|
+
* clearCellFormula(§8.2) — 사이드카+그래프에서 수식을 제거한다. 값(row[field])은 그리드
|
|
122
|
+
* 쪽 책임이라 그대로 유지된다.
|
|
123
|
+
* / clearCellFormula (§8.2) — remove the formula from the sidecar and graph. The value
|
|
124
|
+
* (row[field]) is the grid's responsibility and is kept as-is.
|
|
125
|
+
*
|
|
126
|
+
* @param rowId - 대상 행의 stable id / Stable id of the target row
|
|
127
|
+
* @param field - 컬럼 field 명 / Column field name
|
|
128
|
+
* @returns 재계산이 필요한 (구) dependents 키 배열 / Keys of the former dependents that need recalculation
|
|
129
|
+
*/
|
|
51
130
|
clearCellFormula(rowId: string, field: string): CellKey[];
|
|
131
|
+
/**
|
|
132
|
+
* (rowId, field) 셀의 마지막 평가 에러 코드를 반환한다(에러 없으면 null).
|
|
133
|
+
* / Return the last evaluation error code of the (rowId, field) cell (null if none).
|
|
134
|
+
*
|
|
135
|
+
* @param rowId - 대상 행의 stable id / Stable id of the target row
|
|
136
|
+
* @param field - 컬럼 field 명 / Column field name
|
|
137
|
+
* @returns 에러 코드 또는 null / Error code or null
|
|
138
|
+
*/
|
|
52
139
|
getCellError(rowId: string, field: string): FormulaErrorCode | null;
|
|
53
|
-
/**
|
|
140
|
+
/**
|
|
141
|
+
* 디버깅용(§8.2 getDependents) — flat 좌표가 아니라 (rowId, field) 그대로 반환한다(헤드리스 계층).
|
|
142
|
+
* / For debugging (§8.2 getDependents) — returns (rowId, field) as-is rather than flat
|
|
143
|
+
* coordinates (headless layer).
|
|
144
|
+
*
|
|
145
|
+
* @param rowId - 대상 행의 stable id / Stable id of the target row
|
|
146
|
+
* @param field - 컬럼 field 명 / Column field name
|
|
147
|
+
* @returns 이 셀에 의존하는 셀들의 {rowId, field} 배열 / Array of {rowId, field} for cells depending on this one
|
|
148
|
+
*/
|
|
54
149
|
getDependents(rowId: string, field: string): Array<{
|
|
55
150
|
rowId: string;
|
|
56
151
|
field: string;
|
|
@@ -60,24 +155,71 @@ export declare class RecalcCoordinator {
|
|
|
60
155
|
* 폐포를 구해 Kahn 위상 1패스로 재계산한다. 삭제 무효화(F3-R28)는 별도 특수 로직 없이,
|
|
61
156
|
* 호출부가 "삭제된 rowId/field 를 이미 grid 에서 제거한 뒤" 그 dependents 를 keys 로
|
|
62
157
|
* 넘기면 evaluate 과정에서 accessor.hasRow/hasField 가 false → 자연스럽게 #REF.
|
|
158
|
+
* / C2 batch entry point: from `keys` (leaf cells whose value changed, or formula cells that
|
|
159
|
+
* need re-evaluation) it computes the dependents closure and recalculates in a single Kahn
|
|
160
|
+
* topological pass. Delete invalidation (F3-R28) needs no special logic: if the caller
|
|
161
|
+
* passes the dependents as `keys` after the deleted rowId/field is already removed from the
|
|
162
|
+
* grid, accessor.hasRow/hasField return false during evaluate → naturally #REF.
|
|
163
|
+
*
|
|
164
|
+
* @param keys - 변경 시작 셀 키 배열(seed) / Seed cell keys where the change starts
|
|
165
|
+
* @returns 이번 재계산 요약 / Summary of this recalculation
|
|
63
166
|
*/
|
|
64
167
|
onValuesChanged(keys: CellKey[]): RecalcSummary;
|
|
65
168
|
private _evaluateOne;
|
|
66
|
-
/**
|
|
169
|
+
/**
|
|
170
|
+
* recalculate()(§8.2) — 등록된 전체 수식 노드를 위상정렬 후 평가한다(setData/컬럼 변경 등
|
|
171
|
+
* 광범위 변경 시).
|
|
172
|
+
* / recalculate() (§8.2) — topologically sort and evaluate every registered formula node
|
|
173
|
+
* (for broad changes such as setData or column changes).
|
|
174
|
+
*
|
|
175
|
+
* @returns 이번 재계산 요약 / Summary of this recalculation
|
|
176
|
+
*/
|
|
67
177
|
recalculateAll(): RecalcSummary;
|
|
68
|
-
/**
|
|
178
|
+
/**
|
|
179
|
+
* applySort/applyFilter 후크가 호출할 편의 메서드 — range 보유 수식을 전부 dirty 처리한다(§3.5 P0).
|
|
180
|
+
* / Convenience method for applySort/applyFilter hooks — dirties every range-bearing formula
|
|
181
|
+
* (§3.5 P0).
|
|
182
|
+
*
|
|
183
|
+
* @returns 이번 재계산 요약 / Summary of this recalculation
|
|
184
|
+
*/
|
|
69
185
|
recalcRangeBearing(): RecalcSummary;
|
|
70
|
-
/**
|
|
186
|
+
/**
|
|
187
|
+
* removeRow 후크 편의 메서드 — 이 rowId 를 deps 로 가진 수식들을 재계산한다(자연 #REF, §5.1).
|
|
188
|
+
* / Convenience method for the removeRow hook — recalculates formulas that depend on this
|
|
189
|
+
* rowId (naturally #REF, §5.1).
|
|
190
|
+
*
|
|
191
|
+
* @param rowId - 삭제/무효화된 행의 stable id / Stable id of the deleted/invalidated row
|
|
192
|
+
* @returns 이번 재계산 요약 / Summary of this recalculation
|
|
193
|
+
*/
|
|
71
194
|
invalidateRow(rowId: string): RecalcSummary;
|
|
72
|
-
/**
|
|
195
|
+
/**
|
|
196
|
+
* removeColumn 후크 편의 메서드 — 이 field 를 deps 로 가진 수식들을 재계산한다(자연 #REF).
|
|
197
|
+
* / Convenience method for the removeColumn hook — recalculates formulas that depend on this
|
|
198
|
+
* field (naturally #REF).
|
|
199
|
+
*
|
|
200
|
+
* @param field - 삭제된 컬럼 field 명 / Field name of the deleted column
|
|
201
|
+
* @returns 이번 재계산 요약 / Summary of this recalculation
|
|
202
|
+
*/
|
|
73
203
|
invalidateField(field: string): RecalcSummary;
|
|
74
204
|
/**
|
|
75
205
|
* srcRowId/srcField 의 저장된 수식에서 "상대(비-$) 축만" dRow/dCol 만큼 오프셋한 새
|
|
76
|
-
* 수식 원문을
|
|
77
|
-
* "#REF!" 텍스트로 대체된다(
|
|
206
|
+
* 수식 원문을 만든다(§8.2/C3, F1 fill 전용). 절대($) 축은 불변(C3). 대상 위치가 범위를
|
|
207
|
+
* 벗어나면 해당 참조는 "#REF!" 텍스트로 대체된다(관용 표기, 이 문자열은 재파싱 시 명시적
|
|
78
208
|
* 깨짐을 사용자가 알아볼 수 있게 하기 위한 것 — 실제 파서가 #REF! 토큰 자체를 정식
|
|
79
209
|
* 문법으로 지원하진 않으므로, F1 배선 시 이 반환값을 그대로 setCellFormula 에 넘기면
|
|
80
210
|
* 파싱 실패 → #ERR 로 귀결한다는 점을 후속 배선 태스크가 인지해야 한다).
|
|
211
|
+
* / Build a new formula source from the formula stored at srcRowId/srcField, offsetting only
|
|
212
|
+
* the relative (non-$) axes by dRow/dCol (§8.2/C3, for F1 fill). Absolute ($) axes are
|
|
213
|
+
* unchanged (C3). If a target lands out of range, that reference is replaced with the
|
|
214
|
+
* literal "#REF!" text (a conventional marker so the user sees an explicit break; the parser
|
|
215
|
+
* does not accept a #REF! token as real grammar, so a follow-up wiring task must note that
|
|
216
|
+
* feeding this return value straight into setCellFormula yields a parse failure → #ERR).
|
|
217
|
+
*
|
|
218
|
+
* @param srcRowId - 원본 수식이 있는 행의 stable id / Stable id of the row holding the source formula
|
|
219
|
+
* @param srcField - 원본 수식이 있는 컬럼 field 명 / Field of the column holding the source formula
|
|
220
|
+
* @param dRow - 행 오프셋(표시 순서 기준) / Row offset (in displayed order)
|
|
221
|
+
* @param dCol - 열 오프셋(visibleFields 기준) / Column offset (in visibleFields)
|
|
222
|
+
* @returns 오프셋된 새 수식 원문("=..."), 원본이 없으면 빈 문자열 / Offset formula source ("=..."), or empty string if no source
|
|
81
223
|
*/
|
|
82
224
|
offsetFormula(srcRowId: string, srcField: string, dRow: number, dCol: number): string;
|
|
83
225
|
private _shiftAst;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { AstNode, FormulaGridAccessor } from './types.js';
|
|
2
|
+
/** 구조편집 종류(행/열 삽입·삭제·이동, §2.5). / Structural edit kinds (row/col insert/delete/move, §2.5). */
|
|
3
|
+
export type StructuralEdit = {
|
|
4
|
+
op: 'insertRows';
|
|
5
|
+
at: number;
|
|
6
|
+
count: number;
|
|
7
|
+
} | {
|
|
8
|
+
op: 'deleteRows';
|
|
9
|
+
at: number;
|
|
10
|
+
count: number;
|
|
11
|
+
} | {
|
|
12
|
+
op: 'moveRows';
|
|
13
|
+
from: number;
|
|
14
|
+
to: number;
|
|
15
|
+
count: number;
|
|
16
|
+
} | {
|
|
17
|
+
op: 'insertCols';
|
|
18
|
+
at: number;
|
|
19
|
+
count: number;
|
|
20
|
+
} | {
|
|
21
|
+
op: 'deleteCols';
|
|
22
|
+
at: number;
|
|
23
|
+
count: number;
|
|
24
|
+
} | {
|
|
25
|
+
op: 'moveCols';
|
|
26
|
+
from: number;
|
|
27
|
+
to: number;
|
|
28
|
+
count: number;
|
|
29
|
+
};
|
|
30
|
+
/** #REF 전환된 참조 1건(원문·사유, §2.5). / One reference turned into #REF (source + reason, §2.5). */
|
|
31
|
+
export interface BrokenRef {
|
|
32
|
+
/** 사유(삭제된 행/열). / Reason (deleted row/col). */
|
|
33
|
+
readonly reason: 'row-deleted' | 'col-deleted';
|
|
34
|
+
/** 사람이 읽을 참조 요약(rowId/field). / Human-readable ref summary. */
|
|
35
|
+
readonly ref: string;
|
|
36
|
+
}
|
|
37
|
+
/** 재작성 리포트(§2.5). / Rewrite report (§2.5). */
|
|
38
|
+
export interface RewriteReport {
|
|
39
|
+
/** 시프트된(dRow 변경) 참조 수. / Count of shifted (dRow-changed) references. */
|
|
40
|
+
readonly rewritten: number;
|
|
41
|
+
/** #REF 전환된 참조. / References turned into #REF. */
|
|
42
|
+
readonly broken: BrokenRef[];
|
|
43
|
+
/** 변경 없는 참조 수. / Count of unchanged references. */
|
|
44
|
+
readonly unchanged: number;
|
|
45
|
+
}
|
|
46
|
+
/** AST 순수 변환기(§2.5). / Pure AST transformer (§2.5). */
|
|
47
|
+
export interface ReferenceRewriter {
|
|
48
|
+
/** 단일 AST 재작성. 대상 소멸 참조는 { t:'error', code:'#REF' } 로 전환(REQ-T8-805). / Rewrite a single AST; dead refs → #REF. */
|
|
49
|
+
rewrite(ast: AstNode, host: {
|
|
50
|
+
rowId: string;
|
|
51
|
+
field: string;
|
|
52
|
+
}, edit: StructuralEdit): AstNode;
|
|
53
|
+
/** 직전 rewrite 의 리포트(undo·사유 표기용). / Report of the most recent rewrite (for undo/reason surfacing). */
|
|
54
|
+
lastReport(): RewriteReport;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* `ReferenceRewriter` 기본 구현. host 좌표(pre-edit)로 참조를 해소해 삭제/시프트를 판정한다.
|
|
58
|
+
* / Default `ReferenceRewriter`. Resolves refs against pre-edit host coordinates to decide
|
|
59
|
+
* deletion/shift.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* const rw = new AstReferenceRewriter(accessor);
|
|
63
|
+
* const ast2 = rw.rewrite(ast, { rowId: 'r5', field: 'total' }, { op: 'deleteRows', at: 2, count: 1 });
|
|
64
|
+
* rw.lastReport(); // { rewritten, broken: [{reason:'row-deleted',…}], unchanged }
|
|
65
|
+
*/
|
|
66
|
+
export declare class AstReferenceRewriter implements ReferenceRewriter {
|
|
67
|
+
private readonly _accessor;
|
|
68
|
+
private _rewritten;
|
|
69
|
+
private _broken;
|
|
70
|
+
private _unchanged;
|
|
71
|
+
constructor(_accessor: FormulaGridAccessor);
|
|
72
|
+
rewrite(ast: AstNode, host: {
|
|
73
|
+
rowId: string;
|
|
74
|
+
field: string;
|
|
75
|
+
}, edit: StructuralEdit): AstNode;
|
|
76
|
+
lastReport(): RewriteReport;
|
|
77
|
+
private _walk;
|
|
78
|
+
/** 단일 참조 재작성. 'deleted' 반환 시 #REF. 불변이면 원 참조 객체를 그대로 반환(구조 공유). */
|
|
79
|
+
private _rewriteRef;
|
|
80
|
+
private _refLabel;
|
|
81
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FunctionDef, FunctionRegistry } from '../../FunctionRegistry.js';
|
|
2
|
+
/** 확장 함수군(tier:'extended'). 코어 미포함 — 명시 등록 시에만 활성. / Extended set; opt-in only. */
|
|
3
|
+
export declare const EXTENDED_FUNCTIONS: readonly FunctionDef[];
|
|
4
|
+
/**
|
|
5
|
+
* 확장 함수군을 레지스트리에 일괄 등록(지연로딩 진입점). 이미 있는 이름은 override 로 교체.
|
|
6
|
+
* / Batch-register the extended function set (lazy-load entry point). Existing names are overridden.
|
|
7
|
+
*
|
|
8
|
+
* @param reg - 대상 함수 레지스트리 / Target function registry
|
|
9
|
+
*/
|
|
10
|
+
export declare function registerExtendedFunctions(reg: FunctionRegistry): void;
|
|
@@ -1,15 +1,46 @@
|
|
|
1
1
|
import { AstNode, FormulaGridAccessor, RefMode } from './types.js';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* 열문자(A,B,...,Z,AA,...)를 0-based visibleLeaves 인덱스로 변환한다.
|
|
4
|
+
* / Convert column letters (A,B,...,Z,AA,...) to a 0-based visibleLeaves index.
|
|
5
|
+
*
|
|
6
|
+
* @param letters - 열문자 문자열(대소문자 무관) / Column-letter string (case-insensitive)
|
|
7
|
+
* @returns 0-based 열 인덱스 / 0-based column index
|
|
8
|
+
*/
|
|
3
9
|
export declare function colLettersToIndex(letters: string): number;
|
|
4
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* 0-based visibleLeaves 인덱스를 열문자(A,B,...,Z,AA,...)로 변환한다.
|
|
12
|
+
* offsetFormula/serializeFormula 가 공유 재사용한다.
|
|
13
|
+
* / Convert a 0-based visibleLeaves index to column letters (A,B,...,Z,AA,...).
|
|
14
|
+
* Shared by offsetFormula/serializeFormula.
|
|
15
|
+
*
|
|
16
|
+
* @param index - 0-based 열 인덱스 / 0-based column index
|
|
17
|
+
* @returns 열문자 문자열(빈 경우 'A') / Column-letter string ('A' when empty)
|
|
18
|
+
*/
|
|
5
19
|
export declare function indexToColLetters(index: number): string;
|
|
6
20
|
/**
|
|
7
21
|
* 파서가 만든 원시 AST(rawRef/rawRange 포함)를 정규화해 ref/range/error 노드로 치환한다.
|
|
8
22
|
* host = 이 수식이 저장된 셀(현재 행 컨텍스트, FieldRef·상대참조 기준점).
|
|
23
|
+
* / Normalize a raw AST (containing rawRef/rawRange) produced by the parser, replacing them
|
|
24
|
+
* with ref/range/error nodes (§3.3 pipeline). `host` is the cell where this formula is
|
|
25
|
+
* stored (current row context; anchor for FieldRef and relative refs).
|
|
26
|
+
*
|
|
27
|
+
* @param ast - 파서가 만든 원시 AST / Raw AST produced by the parser
|
|
28
|
+
* @param host - 수식이 저장된 호스트 셀(rowId·field) / Host cell (rowId, field) where the formula is stored
|
|
29
|
+
* @param accessor - 그리드 좌표/값 접근자 / Grid coordinate/value accessor
|
|
30
|
+
* @param refMode - 참조 정규화 모드('stable' 기본 / 'relative') / Reference normalization mode ('stable' default / 'relative')
|
|
31
|
+
* @returns 정규화된 AST / The normalized AST
|
|
9
32
|
*/
|
|
10
33
|
export declare function normalizeAst(ast: AstNode, host: {
|
|
11
34
|
rowId: string;
|
|
12
35
|
field: string;
|
|
13
36
|
}, accessor: FormulaGridAccessor, refMode?: RefMode): AstNode;
|
|
14
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* 이 AST가 범위 참조를 하나라도 포함하는지 판별한다(§3.5 hasRangeRef,
|
|
39
|
+
* applySort/applyFilter 시 dirty 대상 판정에 사용).
|
|
40
|
+
* / Whether this AST contains any range reference (§3.5 hasRangeRef; used to decide the
|
|
41
|
+
* dirty set on applySort/applyFilter).
|
|
42
|
+
*
|
|
43
|
+
* @param ast - 검사할 AST / AST to inspect
|
|
44
|
+
* @returns 범위 참조 포함 여부 / Whether a range reference is present
|
|
45
|
+
*/
|
|
15
46
|
export declare function computeHasRangeRef(ast: AstNode): boolean;
|
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* 수식 리터럴/셀 텍스트가 산술 가능한 숫자 형태(정수/소수/과학표기)인지 판별하는 정규식.
|
|
3
|
+
* / Regex that tests whether a formula literal or cell text is an arithmetic-capable number
|
|
4
|
+
* form (integer / decimal / scientific notation).
|
|
5
|
+
*/
|
|
2
6
|
export declare const NUMERIC_LITERAL_RE: RegExp;
|
|
3
7
|
/**
|
|
4
8
|
* 과학표기(`1e-5`, `2.5E3`)를 정확한 10진 문자열로 변환한다(부호/자릿수 이동만 사용,
|
|
5
9
|
* 부동소수점 경유 없음). 과학표기가 아니면 trim만 하여 그대로 반환.
|
|
10
|
+
* / Convert scientific notation (`1e-5`, `2.5E3`) into an exact decimal string using only
|
|
11
|
+
* sign/digit shifting (never routed through a floating-point value, per §2.4/F3-R20). Input
|
|
12
|
+
* that is not scientific notation is returned trimmed as-is.
|
|
13
|
+
*
|
|
14
|
+
* @param raw - 변환할 원시 숫자 문자열 / Raw numeric string to convert
|
|
15
|
+
* @returns 정확한 10진 문자열(과학표기가 아니면 trim된 원문) / Exact decimal string (trimmed original if not scientific)
|
|
6
16
|
*/
|
|
7
17
|
export declare function normalizeNumericLiteral(raw: string): string;
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { AstNode, FormulaGridAccessor } from './types.js';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* 정규화 AST를 다시 "=..." 형태의 A1 원문으로 직렬화한다(offsetFormula 결과물 조립용).
|
|
4
|
+
* / Serialize a normalized AST back into "=..." A1 source text (used to assemble
|
|
5
|
+
* offsetFormula results; see §4.3 / §8.2 / C3).
|
|
6
|
+
*
|
|
7
|
+
* @param ast - 직렬화할 정규화 AST / Normalized AST to serialize
|
|
8
|
+
* @param host - 상대참조 기준점이 되는 호스트 셀(rowId·field) / Host cell (rowId, field) anchoring relative refs
|
|
9
|
+
* @param accessor - 그리드 좌표/값 접근자 / Grid coordinate/value accessor
|
|
10
|
+
* @returns "=" 로 시작하는 A1 원문 문자열 / A1 source string prefixed with "="
|
|
11
|
+
*/
|
|
3
12
|
export declare function astToSource(ast: AstNode, host: {
|
|
4
13
|
rowId: string;
|
|
5
14
|
field: string;
|
|
@@ -1,48 +1,100 @@
|
|
|
1
1
|
import { OGDecimal } from '../OGDecimal.js';
|
|
2
|
+
/** 셀 키 문자열 `${rowId}:${field}`(내부 전용 포맷). / Cell key string `${rowId}:${field}` (internal format). */
|
|
2
3
|
export type CellKey = string;
|
|
4
|
+
/**
|
|
5
|
+
* rowId·field 로 셀 키를 만든다. / Build a cell key from rowId and field.
|
|
6
|
+
*
|
|
7
|
+
* @param rowId - 행 stable id / Row stable id
|
|
8
|
+
* @param field - 컬럼 field 명 / Column field name
|
|
9
|
+
* @returns `${rowId}:${field}` 형태의 키 / A `${rowId}:${field}` key
|
|
10
|
+
*/
|
|
3
11
|
export declare function cellKey(rowId: string, field: string): CellKey;
|
|
12
|
+
/**
|
|
13
|
+
* 셀 키를 rowId·field 로 분해한다. / Split a cell key back into rowId and field.
|
|
14
|
+
*
|
|
15
|
+
* @param key - 셀 키 문자열 / Cell key string
|
|
16
|
+
* @returns { rowId, field }
|
|
17
|
+
*/
|
|
4
18
|
export declare function parseCellKey(key: CellKey): {
|
|
5
19
|
rowId: string;
|
|
6
20
|
field: string;
|
|
7
21
|
};
|
|
22
|
+
/**
|
|
23
|
+
* 수식 에러 코드. / Formula error code.
|
|
24
|
+
*
|
|
25
|
+
* `#ERR`(일반), `#REF`(참조 무효), `#CYCLE`(순환), `#DIV0`(0 나눗셈), `#NAME`(미정의 이름),
|
|
26
|
+
* `#VALUE`(비수치), `#NUM`(수치 범위).
|
|
27
|
+
* / `#ERR` (general), `#REF` (invalid ref), `#CYCLE` (cyclic), `#DIV0` (divide by zero),
|
|
28
|
+
* `#NAME` (undefined name), `#VALUE` (non-numeric), `#NUM` (numeric range).
|
|
29
|
+
*/
|
|
8
30
|
export type FormulaErrorCode = '#ERR' | '#REF' | '#CYCLE' | '#DIV0' | '#NAME' | '#VALUE' | '#NUM';
|
|
31
|
+
/** 전체 에러 코드 집합(런타임 판별용). / Set of all error codes (for runtime checks). */
|
|
9
32
|
export declare const FORMULA_ERROR_CODES: ReadonlySet<string>;
|
|
10
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* 값이 이미 다른 수식의 에러 결과(문자열)인지 판별 — 에러 전파용. / Detect whether a value is already another formula's error result (string) — for error propagation.
|
|
35
|
+
*
|
|
36
|
+
* @param v - 검사할 값 / Value to inspect
|
|
37
|
+
* @returns 에러 코드 또는 null / The error code, or null
|
|
38
|
+
*/
|
|
11
39
|
export declare function isErrorToken(v: unknown): FormulaErrorCode | null;
|
|
40
|
+
/** 수식 셀의 계산 결과 값 타입. / Computed result value type of a formula cell. */
|
|
12
41
|
export type CellValue = OGDecimal | string | boolean | null;
|
|
42
|
+
/** 참조 정규화 모드: 'stable'(rowId 앵커) | 'relative'(행 오프셋). / Reference normalization mode: 'stable' (rowId anchor) | 'relative' (row offset). */
|
|
13
43
|
export type RefMode = 'stable' | 'relative';
|
|
44
|
+
/** 정규화된 절대 참조(rowId 앵커). / Normalized absolute reference (rowId anchor). */
|
|
14
45
|
export interface CanonicalAbsRef {
|
|
15
46
|
kind: 'abs';
|
|
47
|
+
/** 앵커 행 stable id. / Anchor row stable id. */
|
|
16
48
|
rowId: string;
|
|
49
|
+
/** 컬럼 field 명. / Column field name. */
|
|
17
50
|
field: string;
|
|
51
|
+
/** 원문에 '$' 행 고정이 있었는지. / Whether the source had a '$' row lock. */
|
|
18
52
|
dollarRow: boolean;
|
|
53
|
+
/** 원문에 '$' 열 고정이 있었는지. / Whether the source had a '$' column lock. */
|
|
19
54
|
dollarCol: boolean;
|
|
20
55
|
}
|
|
56
|
+
/** 정규화된 상대 참조(행 오프셋). / Normalized relative reference (row offset). */
|
|
21
57
|
export interface CanonicalRelRef {
|
|
22
58
|
kind: 'rel';
|
|
59
|
+
/** 현재 셀 기준 행 오프셋 (refMode:'relative' 전용, §2.3). / Row offset from the current cell (refMode:'relative' only, §2.3). */
|
|
23
60
|
dRow: number;
|
|
61
|
+
/** 컬럼 field 명. / Column field name. */
|
|
24
62
|
field: string;
|
|
63
|
+
/** rel 인데 dollarRow=true 인 경우는 없음(구조상 dollarRow=true 면 abs). / Never true for rel (a '$' row lock structurally implies abs). */
|
|
25
64
|
dollarRow: boolean;
|
|
65
|
+
/** 열 고정 여부. / Whether the column is locked. */
|
|
26
66
|
dollarCol: boolean;
|
|
27
67
|
}
|
|
68
|
+
/** 정규화된 단일 참조(절대 | 상대). / Normalized single reference (absolute | relative). */
|
|
28
69
|
export type CanonicalRef = CanonicalAbsRef | CanonicalRelRef;
|
|
70
|
+
/** 정규화된 범위 참조(두 코너). / Normalized range reference (two corners). */
|
|
29
71
|
export interface CanonicalRangeRef {
|
|
72
|
+
/** 코너1 (원문 좌측/상단 그대로, 정렬은 evaluate-time §3.5). / Corner 1 (kept as source left/top; ordering happens at evaluate-time §3.5). */
|
|
30
73
|
a: CanonicalRef;
|
|
74
|
+
/** 코너2. / Corner 2. */
|
|
31
75
|
b: CanonicalRef;
|
|
32
76
|
}
|
|
77
|
+
/** 파서 원시 셀 참조 노드(정규화 전). / Raw parser cell-reference node (pre-normalization). */
|
|
33
78
|
export interface RawCellRefNode {
|
|
34
79
|
t: 'rawRef';
|
|
80
|
+
/** A1 열문자. / A1 column letters. */
|
|
35
81
|
colLetters: string;
|
|
82
|
+
/** 1-based 행 번호. / 1-based row number. */
|
|
36
83
|
row: number;
|
|
84
|
+
/** 열 '$' 고정. / Column '$' lock. */
|
|
37
85
|
dollarCol: boolean;
|
|
86
|
+
/** 행 '$' 고정. / Row '$' lock. */
|
|
38
87
|
dollarRow: boolean;
|
|
39
88
|
}
|
|
89
|
+
/** 파서 원시 범위 참조 노드(정규화 전). / Raw parser range-reference node (pre-normalization). */
|
|
40
90
|
export interface RawRangeRefNode {
|
|
41
91
|
t: 'rawRange';
|
|
42
92
|
a: RawCellRefNode;
|
|
43
93
|
b: RawCellRefNode;
|
|
44
94
|
}
|
|
95
|
+
/** 수식 이항 연산자. / Formula binary operator. */
|
|
45
96
|
export type BinOp = '+' | '-' | '*' | '/' | '%' | '^' | '&' | '=' | '<>' | '<' | '<=' | '>' | '>=';
|
|
97
|
+
/** 수식 AST 노드(원시 참조 + 정규화 후 노드 공존 유니온). / Formula AST node (union of raw refs and normalized nodes). */
|
|
46
98
|
export type AstNode = {
|
|
47
99
|
t: 'num';
|
|
48
100
|
v: string;
|
|
@@ -78,27 +130,38 @@ export type AstNode = {
|
|
|
78
130
|
left: AstNode;
|
|
79
131
|
right: AstNode;
|
|
80
132
|
};
|
|
133
|
+
/** 수식 셀 사이드카 저장 단위(§3.4/§4.1). / Formula-cell sidecar storage unit (§3.4/§4.1). */
|
|
81
134
|
export interface FormulaCell {
|
|
135
|
+
/** 원문 "=A1+B2"(편집 표시용, §4.3). / Source text "=A1+B2" (for edit display, §4.3). */
|
|
82
136
|
src: string;
|
|
137
|
+
/** 정규화된 AST. / Normalized AST. */
|
|
83
138
|
ast: AstNode;
|
|
139
|
+
/** 범위 참조 포함 여부 → applySort/applyFilter dirty 대상(§3.5 P0). / Whether a range ref is present → dirtied by applySort/applyFilter (§3.5 P0). */
|
|
84
140
|
hasRangeRef: boolean;
|
|
141
|
+
/** 캐시된 계산 결과. / Cached computed result. */
|
|
85
142
|
value: CellValue;
|
|
143
|
+
/** 에러 코드(없으면 null). / Error code (null if none). */
|
|
86
144
|
error: FormulaErrorCode | null;
|
|
145
|
+
/** 근사(SQRT 등) 포함 여부 → ≈ 표식(C11). / Whether approximation (e.g. SQRT) is involved → ≈ marker (C11). */
|
|
87
146
|
approx?: boolean;
|
|
88
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* 수식 엔진이 그리드/데이터를 보는 유일한 인터페이스(주입, 의존성 역전 C0/C0.3/C1).
|
|
150
|
+
* / The sole interface through which the formula engine views the grid/data (injected, dependency inversion C0/C0.3/C1).
|
|
151
|
+
*/
|
|
89
152
|
export interface FormulaGridAccessor {
|
|
90
|
-
/** A1 열문자 매핑 기준 — visibleLeaves(숨김 제외) 순서의 field 배열(§3.1/C1). */
|
|
153
|
+
/** A1 열문자 매핑 기준 — visibleLeaves(숨김 제외) 순서의 field 배열(§3.1/C1). / A1 column-letter basis — field array in visibleLeaves order (hidden excluded) (§3.1/C1). */
|
|
91
154
|
visibleFields(): string[];
|
|
92
|
-
/** flat index(0-based) → rowId. kind!=='data' 이거나 범위 밖이면 null(§C0.3). */
|
|
155
|
+
/** flat index(0-based) → rowId. kind!=='data' 이거나 범위 밖이면 null(§C0.3). / flat index (0-based) → rowId; null when kind!=='data' or out of range (§C0.3). */
|
|
93
156
|
rowIdAtFlat(flatIndex: number): string | null;
|
|
94
|
-
/** rowId → 현재 flat index(0-based). 없음/필터아웃/접힘이면 -1. */
|
|
157
|
+
/** rowId → 현재 flat index(0-based). 없음/필터아웃/접힘이면 -1. / rowId → current flat index (0-based); -1 when absent/filtered-out/collapsed. */
|
|
95
158
|
flatIndexOfRowId(rowId: string): number;
|
|
96
|
-
/** 현재 표시(필터 통과) 순서의 rowId 배열 — 범위 evaluate-time 멤버십 해소용(§3.5). */
|
|
159
|
+
/** 현재 표시(필터 통과) 순서의 rowId 배열 — 범위 evaluate-time 멤버십 해소용(§3.5). / rowId array in current display (filtered) order — for evaluate-time range membership (§3.5). */
|
|
97
160
|
displayedRowIds(): string[];
|
|
98
|
-
/** (rowId, field) 셀의 원시 값(비수식, 이미 계산된 값 포함) 조회. */
|
|
161
|
+
/** (rowId, field) 셀의 원시 값(비수식, 이미 계산된 값 포함) 조회. / Read the raw value at (rowId, field) (non-formula; includes already-computed values). */
|
|
99
162
|
getCellValue(rowId: string, field: string): unknown;
|
|
100
|
-
/** rowId 존재 여부(행 삭제 감지, F3-R28). */
|
|
163
|
+
/** rowId 존재 여부(행 삭제 감지, F3-R28). / Whether a rowId exists (row-deletion detection, F3-R28). */
|
|
101
164
|
hasRow(rowId: string): boolean;
|
|
102
|
-
/** field 존재 여부(열 삭제 감지, F3-R28). */
|
|
165
|
+
/** field 존재 여부(열 삭제 감지, F3-R28). / Whether a field exists (column-deletion detection, F3-R28). */
|
|
103
166
|
hasField(field: string): boolean;
|
|
104
167
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export type Priority = 'P0' | 'P1' | 'P2';
|
|
2
|
+
export type AdapterId = 'react' | 'vue' | 'jquery' | 'vanilla';
|
|
3
|
+
/** 코어 능력 선언. / Declared core capability. */
|
|
4
|
+
export interface Capability {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly priority: Priority;
|
|
7
|
+
readonly title?: string;
|
|
8
|
+
}
|
|
9
|
+
/** 어댑터별 노출/동형동작 선언. / Per-adapter conformance declaration. */
|
|
10
|
+
export interface AdapterConformance {
|
|
11
|
+
readonly adapter: AdapterId;
|
|
12
|
+
readonly exposed: ReadonlySet<string>;
|
|
13
|
+
readonly behaviorMatch: ReadonlySet<string>;
|
|
14
|
+
}
|
|
15
|
+
/** 능력×어댑터 격자의 한 셀. / One cell of the capability × adapter grid. */
|
|
16
|
+
export interface ParityCell {
|
|
17
|
+
readonly capabilityId: string;
|
|
18
|
+
readonly adapter: AdapterId;
|
|
19
|
+
readonly exposed: boolean;
|
|
20
|
+
readonly behaviorMatch: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface AdapterParity {
|
|
23
|
+
readonly adapter: AdapterId;
|
|
24
|
+
readonly exposureRate: number;
|
|
25
|
+
readonly behaviorMatchRate: number;
|
|
26
|
+
}
|
|
27
|
+
export interface ParityMatrix {
|
|
28
|
+
readonly cells: readonly ParityCell[];
|
|
29
|
+
readonly perAdapter: readonly AdapterParity[];
|
|
30
|
+
/** P0 능력이 어느 어댑터에서든 미노출/미일치인 셀 목록. 비어있어야 게이트 통과. */
|
|
31
|
+
readonly p0Gaps: readonly ParityCell[];
|
|
32
|
+
/** P0 100% 게이트 통과 여부. / Whether the P0 100% gate passes. */
|
|
33
|
+
readonly p0Pass: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* 읽기전용 능력 SSOT. register 는 코어 능력 선언 시점의 내부 조립용(확장 표면 아님).
|
|
37
|
+
* / Read-only capability SSOT. `register` is for internal declaration, not an extension surface.
|
|
38
|
+
*/
|
|
39
|
+
export declare class CapabilityRegistry {
|
|
40
|
+
private readonly _caps;
|
|
41
|
+
register(cap: Capability): this;
|
|
42
|
+
list(): readonly Capability[];
|
|
43
|
+
get(id: string): Capability | undefined;
|
|
44
|
+
snapshot(): CapabilitySnapshot;
|
|
45
|
+
}
|
|
46
|
+
/** 포트가 노출하는 읽기전용 능력 스냅샷(도메인 상태 아님). / Read-only capability probe snapshot. */
|
|
47
|
+
export interface CapabilitySnapshot {
|
|
48
|
+
readonly ids: readonly string[];
|
|
49
|
+
readonly p0Ids: readonly string[];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* 노출율·일치율 %계량 + P0 미달 항목 리포트. CI 게이트가 소비.
|
|
53
|
+
* / Computes exposure/behavior rates and the P0 gap list. Consumed by the CI gate.
|
|
54
|
+
*/
|
|
55
|
+
export declare function computeParity(caps: readonly Capability[], confs: readonly AdapterConformance[]): ParityMatrix;
|
|
56
|
+
/**
|
|
57
|
+
* 코어 능력 SSOT 싱글턴. 새 코어 능력 추가 시 여기에 등록 → 패리티 매트릭스가
|
|
58
|
+
* 자동으로 4어댑터 커버리지를 요구(고아 능력=미노출 검출).
|
|
59
|
+
* / Core capability SSOT singleton.
|
|
60
|
+
*/
|
|
61
|
+
export declare const CAPABILITY_REGISTRY: CapabilityRegistry;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { GridOptions } from '../types.js';
|
|
2
|
+
import { GridHostPort, GridPropsPatch, Unsubscribe, HostEventHandler } from './GridHostPort.js';
|
|
3
|
+
import { CapabilitySnapshot } from './CapabilityRegistry.js';
|
|
4
|
+
/**
|
|
5
|
+
* 포트를 OpenGrid 파사드로 구동하는 험블 드라이버.
|
|
6
|
+
* CRC: 책임=파사드 생명주기·이벤트·재조정 번역 / 협력자=OpenGrid(파사드)·reconcile·CapabilityRegistry.
|
|
7
|
+
*/
|
|
8
|
+
export declare class GridHostDriver<T extends Record<string, any> = any> implements GridHostPort<T> {
|
|
9
|
+
private _grid;
|
|
10
|
+
private _container;
|
|
11
|
+
private _lastOptions;
|
|
12
|
+
private readonly _subs;
|
|
13
|
+
mount(container: HTMLElement, options: GridOptions<T>): void;
|
|
14
|
+
unmount(): void;
|
|
15
|
+
updateProps(patch: GridPropsPatch<T>): void;
|
|
16
|
+
subscribe(event: string, handler: HostEventHandler): Unsubscribe;
|
|
17
|
+
get capabilities(): CapabilitySnapshot;
|
|
18
|
+
get mounted(): boolean;
|
|
19
|
+
/** 구조 변경 시 원자적 재생성(이벤트 재구독 포함). / Atomic recreate on structural change. */
|
|
20
|
+
private _recreate;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* 코어가 export 하는 유일한 팩토리 — 어댑터는 구현 클래스(GridHostDriver)를 모른다(캡슐화, Abstract Factory).
|
|
24
|
+
* 서버/헤드리스 타깃용 대체 드라이버는 팩토리 뒤에서 교체 가능(REQ-TX-846).
|
|
25
|
+
* / The single factory the core exports; adapters never see the concrete driver class.
|
|
26
|
+
*/
|
|
27
|
+
export declare function createGridHost<T extends Record<string, any> = any>(): GridHostPort<T>;
|