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
|
@@ -0,0 +1,520 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const OpenGrid = require("./OpenGrid-B7m7ei7f.cjs");
|
|
4
|
+
function isStyleRef(e) {
|
|
5
|
+
return !!e && typeof e.ref == "string";
|
|
6
|
+
}
|
|
7
|
+
const CF_SCHEMA_VERSION = 1;
|
|
8
|
+
function cfRuleEquals(e, t) {
|
|
9
|
+
return JSON.stringify(e) === JSON.stringify(t);
|
|
10
|
+
}
|
|
11
|
+
function staticAppearanceView(e) {
|
|
12
|
+
const t = (e == null ? void 0 : e.primary) ?? "#1976d2", n = (e == null ? void 0 : e.graphite) ?? "#3a3f45";
|
|
13
|
+
return { rampFrom: (r) => r === "primary" ? t : n };
|
|
14
|
+
}
|
|
15
|
+
function numeric(e) {
|
|
16
|
+
const t = [];
|
|
17
|
+
for (const n of e) {
|
|
18
|
+
const r = typeof n == "number" ? n : typeof n == "string" && n.trim() !== "" ? Number(n) : NaN;
|
|
19
|
+
Number.isFinite(r) && t.push(r);
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
}
|
|
23
|
+
function computeColumnStats(e) {
|
|
24
|
+
const t = numeric(e), n = t.length;
|
|
25
|
+
if (n === 0) return { count: 0, distinct: 0 };
|
|
26
|
+
const r = [...t].sort((m, g) => m - g), i = r[0], o = r[n - 1], a = t.reduce((m, g) => m + g, 0) / n, c = t.reduce((m, g) => m + (g - a) ** 2, 0) / n, l = Math.sqrt(c), f = /* @__PURE__ */ new Map();
|
|
27
|
+
for (const m of t) f.set(m, (f.get(m) ?? 0) + 1);
|
|
28
|
+
const d = f.size;
|
|
29
|
+
return { min: i, max: o, avg: a, stddev: l, count: n, distinct: d, rankOf: (m) => {
|
|
30
|
+
let g = 0;
|
|
31
|
+
for (const v of t) v > m && g++;
|
|
32
|
+
return g + 1;
|
|
33
|
+
}, rankAscOf: (m) => {
|
|
34
|
+
let g = 0;
|
|
35
|
+
for (const v of t) v < m && g++;
|
|
36
|
+
return g + 1;
|
|
37
|
+
}, percentileOf: (m) => {
|
|
38
|
+
let g = 0;
|
|
39
|
+
for (const v of t) v <= m && g++;
|
|
40
|
+
return g / n;
|
|
41
|
+
}, countOf: (m) => f.get(m) ?? 0 };
|
|
42
|
+
}
|
|
43
|
+
function snapshotStats(e) {
|
|
44
|
+
const t = {};
|
|
45
|
+
return e.min !== void 0 && (t.min = e.min), e.max !== void 0 && (t.max = e.max), e.avg !== void 0 && (t.avg = e.avg), e.stddev !== void 0 && (t.stddev = e.stddev), e.count !== void 0 && (t.count = e.count), e.distinct !== void 0 && (t.distinct = e.distinct), t;
|
|
46
|
+
}
|
|
47
|
+
const RESERVED_PREFIXES = ["og:", "og-"];
|
|
48
|
+
function isReserved(e) {
|
|
49
|
+
return RESERVED_PREFIXES.some((t) => e.startsWith(t));
|
|
50
|
+
}
|
|
51
|
+
function spiMajor(e) {
|
|
52
|
+
const t = e.lastIndexOf("@"), n = t >= 0 ? e.slice(t + 1) : e;
|
|
53
|
+
return n.split(".")[0] ?? n;
|
|
54
|
+
}
|
|
55
|
+
function spiCompatible(e, t) {
|
|
56
|
+
return spiMajor(e) === spiMajor(t);
|
|
57
|
+
}
|
|
58
|
+
function buildEntry(e, t, n, r, i) {
|
|
59
|
+
const o = { key: e, value: t, origin: n, priority: r.priority ?? 0, seq: i };
|
|
60
|
+
return r.pluginId !== void 0 && (o.pluginId = r.pluginId), r.spiVersion !== void 0 && (o.spiVersion = r.spiVersion), r.deprecated !== void 0 && (o.deprecated = r.deprecated), o;
|
|
61
|
+
}
|
|
62
|
+
class TypedRegistry {
|
|
63
|
+
constructor(t = {}) {
|
|
64
|
+
this._map = /* @__PURE__ */ new Map(), this._seq = 0, this._disposed = false, this._warned = /* @__PURE__ */ new Set(), this._cfg = t;
|
|
65
|
+
}
|
|
66
|
+
_warn(t, n) {
|
|
67
|
+
const r = `[OpenGrid] ${n}`, i = `${t}::${n}`;
|
|
68
|
+
return this._warned.has(i) || (this._warned.add(i), (this._cfg.onWarn ?? ((s) => {
|
|
69
|
+
typeof console < "u" && console.warn(s);
|
|
70
|
+
}))(r)), r;
|
|
71
|
+
}
|
|
72
|
+
register(t, n, r = {}) {
|
|
73
|
+
if (this._disposed) return { ok: false, action: "rejected", reason: "disposed" };
|
|
74
|
+
if (typeof t != "string" || t.length === 0) return { ok: false, action: "rejected", reason: "invalid-key" };
|
|
75
|
+
const i = r.origin ?? "user";
|
|
76
|
+
if (isReserved(t) && i !== "builtin") return { ok: false, action: "rejected", reason: "reserved-namespace", warning: this._warn(t, `reserved namespace: '${t}' 는 og:* 코어 예약 대역입니다(origin:'builtin' 만 점유).`) };
|
|
77
|
+
if (this._cfg.spi && r.spiVersion !== void 0 && !spiCompatible(this._cfg.spi.version, r.spiVersion)) return { ok: false, action: "rejected", reason: "spi-mismatch", warning: this._warn(t, `SPI major 불일치: '${t}' 선언 ${r.spiVersion}, 코어 ${this._cfg.spi.name}@${this._cfg.spi.version}.`) };
|
|
78
|
+
const o = this._map.get(t);
|
|
79
|
+
return o && !this._resolveConflict(o, r) ? { ok: false, action: "kept", reason: "protected-builtin", warning: this._warn(t, `'${t}' 는 ${o.origin === "builtin" ? "내장(built-in) 보호" : "override 미지정"} — 덮으려면 { override:true }.`) } : (this._map.set(t, buildEntry(t, n, i, r, this._seq++)), { ok: true, action: o ? "replaced" : "added" });
|
|
80
|
+
}
|
|
81
|
+
_resolveConflict(t, n) {
|
|
82
|
+
return t.origin === "builtin" && n.override !== true ? false : this._cfg.duplicatePolicy === "explicit-override" ? n.override === true : true;
|
|
83
|
+
}
|
|
84
|
+
get(t) {
|
|
85
|
+
var _a;
|
|
86
|
+
return (_a = this._map.get(t)) == null ? void 0 : _a.value;
|
|
87
|
+
}
|
|
88
|
+
require(t, n) {
|
|
89
|
+
const r = this.get(t);
|
|
90
|
+
if (r !== void 0) return r;
|
|
91
|
+
if (n !== void 0) return n;
|
|
92
|
+
if (this._cfg.placeholder) return this._cfg.placeholder(t);
|
|
93
|
+
}
|
|
94
|
+
has(t) {
|
|
95
|
+
return this._map.has(t);
|
|
96
|
+
}
|
|
97
|
+
list() {
|
|
98
|
+
return [...this._map.keys()];
|
|
99
|
+
}
|
|
100
|
+
entries() {
|
|
101
|
+
return [...this._map.values()];
|
|
102
|
+
}
|
|
103
|
+
unregister(t) {
|
|
104
|
+
return this._map.delete(t);
|
|
105
|
+
}
|
|
106
|
+
disposePlugin(t) {
|
|
107
|
+
let n = 0;
|
|
108
|
+
for (const [r, i] of this._map) i.pluginId === t && (this._map.delete(r), n++);
|
|
109
|
+
return n;
|
|
110
|
+
}
|
|
111
|
+
dispose() {
|
|
112
|
+
this._map.clear(), this._warned.clear(), this._disposed = true;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
function num$1(e) {
|
|
116
|
+
return typeof e == "number" ? e : typeof e == "string" && e.trim() !== "" ? Number(e) : NaN;
|
|
117
|
+
}
|
|
118
|
+
const DAY = 864e5;
|
|
119
|
+
function startOfDay(e) {
|
|
120
|
+
const t = new Date(e);
|
|
121
|
+
return new Date(t.getFullYear(), t.getMonth(), t.getDate()).getTime();
|
|
122
|
+
}
|
|
123
|
+
function startOfWeek(e) {
|
|
124
|
+
const t = startOfDay(e), n = new Date(t).getDay();
|
|
125
|
+
return t - n * DAY;
|
|
126
|
+
}
|
|
127
|
+
const comparePredicate = { needs: [], test(e, t) {
|
|
128
|
+
const n = num$1(t.value);
|
|
129
|
+
if (!Number.isFinite(n)) return false;
|
|
130
|
+
switch (e.op) {
|
|
131
|
+
case ">":
|
|
132
|
+
return n > e.a;
|
|
133
|
+
case ">=":
|
|
134
|
+
return n >= e.a;
|
|
135
|
+
case "<":
|
|
136
|
+
return n < e.a;
|
|
137
|
+
case "<=":
|
|
138
|
+
return n <= e.a;
|
|
139
|
+
case "=":
|
|
140
|
+
return n === e.a;
|
|
141
|
+
case "!=":
|
|
142
|
+
return n !== e.a;
|
|
143
|
+
case "between":
|
|
144
|
+
return e.b !== void 0 && n >= Math.min(e.a, e.b) && n <= Math.max(e.a, e.b);
|
|
145
|
+
default:
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
} }, textContainsPredicate = { needs: [], test(e, t) {
|
|
149
|
+
const n = t.value == null ? "" : String(t.value);
|
|
150
|
+
return e.ci === false ? n.includes(e.text) : n.toLowerCase().includes(e.text.toLowerCase());
|
|
151
|
+
} }, dateOccurringPredicate = { needs: [], test(e, t, n, r) {
|
|
152
|
+
const i = t.value, o = i instanceof Date ? i.getTime() : typeof i == "number" ? i : Date.parse(String(i));
|
|
153
|
+
if (!Number.isFinite(o)) return false;
|
|
154
|
+
const s = r.now, a = startOfDay(s);
|
|
155
|
+
switch (e.rel) {
|
|
156
|
+
case "today":
|
|
157
|
+
return startOfDay(o) === a;
|
|
158
|
+
case "yesterday":
|
|
159
|
+
return startOfDay(o) === a - DAY;
|
|
160
|
+
case "tomorrow":
|
|
161
|
+
return startOfDay(o) === a + DAY;
|
|
162
|
+
case "thisWeek": {
|
|
163
|
+
const c = startOfWeek(s);
|
|
164
|
+
return o >= c && o < c + 7 * DAY;
|
|
165
|
+
}
|
|
166
|
+
case "lastWeek": {
|
|
167
|
+
const c = startOfWeek(s) - 7 * DAY;
|
|
168
|
+
return o >= c && o < c + 7 * DAY;
|
|
169
|
+
}
|
|
170
|
+
case "thisMonth": {
|
|
171
|
+
const c = new Date(s);
|
|
172
|
+
return new Date(o).getFullYear() === c.getFullYear() && new Date(o).getMonth() === c.getMonth();
|
|
173
|
+
}
|
|
174
|
+
case "lastMonth": {
|
|
175
|
+
const c = new Date(s.valueOf()), l = new Date(c.getFullYear(), c.getMonth() - 1, 1);
|
|
176
|
+
return new Date(o).getFullYear() === l.getFullYear() && new Date(o).getMonth() === l.getMonth();
|
|
177
|
+
}
|
|
178
|
+
case "next7d":
|
|
179
|
+
return o >= a && o < a + 7 * DAY;
|
|
180
|
+
case "last7d":
|
|
181
|
+
return o < a + DAY && o >= a - 6 * DAY;
|
|
182
|
+
default:
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
185
|
+
} }, topNPredicate = { needs: ["rank"], test(e, t, n) {
|
|
186
|
+
const r = num$1(t.value);
|
|
187
|
+
return Number.isFinite(r) ? e.bottom ? n.rankAscOf ? n.rankAscOf(r) <= e.n : false : n.rankOf ? n.rankOf(r) <= e.n : false : false;
|
|
188
|
+
} }, topNpctPredicate = { needs: ["percentile"], test(e, t, n) {
|
|
189
|
+
const r = num$1(t.value);
|
|
190
|
+
if (!Number.isFinite(r) || !n.percentileOf) return false;
|
|
191
|
+
const i = n.percentileOf(r);
|
|
192
|
+
return e.bottom ? i <= e.pct / 100 : i >= 1 - e.pct / 100;
|
|
193
|
+
} }, aboveAvgPredicate = { needs: ["avg"], test(e, t, n) {
|
|
194
|
+
const r = num$1(t.value);
|
|
195
|
+
return !Number.isFinite(r) || n.avg === void 0 ? false : e.below ? r < n.avg : r > n.avg;
|
|
196
|
+
} }, stdBandPredicate = { needs: ["avg", "stddev"], test(e, t, n) {
|
|
197
|
+
const r = num$1(t.value);
|
|
198
|
+
if (!Number.isFinite(r) || n.avg === void 0 || n.stddev === void 0) return false;
|
|
199
|
+
const i = Math.abs(r - n.avg), o = e.k * n.stddev;
|
|
200
|
+
return e.outside === false ? i <= o : i >= o;
|
|
201
|
+
} }, duplicatePredicate = { needs: ["cardinality"], test(e, t, n) {
|
|
202
|
+
const r = num$1(t.value);
|
|
203
|
+
if (!Number.isFinite(r) || !n.countOf) return false;
|
|
204
|
+
const i = n.countOf(r);
|
|
205
|
+
return e.unique ? i === 1 : i > 1;
|
|
206
|
+
} }, customFallbackPredicate = { needs: [], test() {
|
|
207
|
+
return false;
|
|
208
|
+
} }, BUILTIN_PREDICATES = Object.freeze({ compare: comparePredicate, textContains: textContainsPredicate, dateOccurring: dateOccurringPredicate, topN: topNPredicate, topNpct: topNpctPredicate, aboveAvg: aboveAvgPredicate, stdBand: stdBandPredicate, duplicate: duplicatePredicate, custom: customFallbackPredicate });
|
|
209
|
+
function createRuleTypeRegistry() {
|
|
210
|
+
const e = new TypedRegistry({ spi: { name: "CFPredicate", version: "1" } });
|
|
211
|
+
for (const [t, n] of Object.entries(BUILTIN_PREDICATES)) e.register(t, n, { origin: "builtin" });
|
|
212
|
+
return e;
|
|
213
|
+
}
|
|
214
|
+
function scopeMatches(e, t) {
|
|
215
|
+
const n = e.scope;
|
|
216
|
+
return !(n.columnId !== t.columnId || n.range && (t.rowIndex < n.range.startRow || t.rowIndex >= n.range.endRow) || n.rowState && n.rowState !== t.rowState);
|
|
217
|
+
}
|
|
218
|
+
function sortRules(e) {
|
|
219
|
+
return [...e].sort((t, n) => t.priority - n.priority || (t.id < n.id ? -1 : t.id > n.id ? 1 : 0));
|
|
220
|
+
}
|
|
221
|
+
function num(e) {
|
|
222
|
+
return typeof e == "number" ? e : typeof e == "string" && e.trim() !== "" ? Number(e) : NaN;
|
|
223
|
+
}
|
|
224
|
+
function clamp01(e) {
|
|
225
|
+
return e < 0 ? 0 : e > 1 ? 1 : e;
|
|
226
|
+
}
|
|
227
|
+
function computeDatum(e, t, n) {
|
|
228
|
+
const r = num(t), i = Number.isFinite(r), o = !i || r === 0 ? 0 : r > 0 ? 1 : -1, s = n.min ?? 0, a = n.max ?? 0;
|
|
229
|
+
if (e.kind === "bar") {
|
|
230
|
+
if (!i) return { sign: 0 };
|
|
231
|
+
const c = e.axis ?? "zero";
|
|
232
|
+
let l, f = false;
|
|
233
|
+
if (c === "zero") {
|
|
234
|
+
const d = Math.max(Math.abs(s), Math.abs(a)) || 1, u = Math.abs(r) / d;
|
|
235
|
+
l = clamp01(u), e.clamp && u > 1 && (f = true);
|
|
236
|
+
} else {
|
|
237
|
+
const d = a - s || 1, u = (r - s) / d;
|
|
238
|
+
l = clamp01(u), e.clamp && (u < 0 || u > 1) && (f = true);
|
|
239
|
+
}
|
|
240
|
+
return { ratio: l, sign: o, value: r, clamped: f };
|
|
241
|
+
}
|
|
242
|
+
if (e.kind === "scale") {
|
|
243
|
+
if (!i) return { sign: 0 };
|
|
244
|
+
const c = e.mode ?? "discrete";
|
|
245
|
+
let l;
|
|
246
|
+
if (e.diverging) {
|
|
247
|
+
const u = e.midpoint === "zero" ? 0 : e.midpoint === "mean" ? n.avg ?? (s + a) / 2 : typeof e.midpoint == "number" ? e.midpoint : 0;
|
|
248
|
+
if (r <= u) {
|
|
249
|
+
const p = u - s || 1;
|
|
250
|
+
l = 0.5 * clamp01((r - s) / p);
|
|
251
|
+
} else {
|
|
252
|
+
const p = a - u || 1;
|
|
253
|
+
l = 0.5 + 0.5 * clamp01((r - u) / p);
|
|
254
|
+
}
|
|
255
|
+
} else {
|
|
256
|
+
const u = a - s || 1;
|
|
257
|
+
l = clamp01((r - s) / u);
|
|
258
|
+
}
|
|
259
|
+
if (c === "continuous") return { ratio: l, sign: o, value: r };
|
|
260
|
+
const f = e.diverging ? Math.max(3, Math.min(5, e.bands ?? 3)) : Math.max(2, Math.min(5, e.bands ?? 3)), d = Math.min(f - 1, Math.floor(l * f));
|
|
261
|
+
return { ratio: l, bandIndex: d, bandCount: f, sign: o, value: r };
|
|
262
|
+
}
|
|
263
|
+
if (e.kind === "icon") {
|
|
264
|
+
if (!i) return { sign: 0 };
|
|
265
|
+
const c = e.steps ?? 3, l = a - s || 1, f = clamp01((r - s) / l);
|
|
266
|
+
let d = Math.min(c - 1, Math.floor(f * c));
|
|
267
|
+
return e.reverse && (d = c - 1 - d), { bandIndex: d, bandCount: c, ratio: f, sign: o, value: r };
|
|
268
|
+
}
|
|
269
|
+
return i ? { sign: o, value: r } : { sign: o };
|
|
270
|
+
}
|
|
271
|
+
function predicateFor(e, t) {
|
|
272
|
+
return e.get(t);
|
|
273
|
+
}
|
|
274
|
+
class DefaultCFEvaluator {
|
|
275
|
+
constructor(t) {
|
|
276
|
+
this.ruleTypes = t;
|
|
277
|
+
}
|
|
278
|
+
evaluate(t, n, r, i) {
|
|
279
|
+
const o = sortRules(t.filter((u) => scopeMatches(u, n)));
|
|
280
|
+
let s;
|
|
281
|
+
const a = [], c = [];
|
|
282
|
+
let l;
|
|
283
|
+
for (const u of o) {
|
|
284
|
+
const p = predicateFor(this.ruleTypes, u.when.type);
|
|
285
|
+
if (!p) continue;
|
|
286
|
+
let h = false;
|
|
287
|
+
try {
|
|
288
|
+
h = p.test(u.when, n, r, i);
|
|
289
|
+
} catch {
|
|
290
|
+
h = false;
|
|
291
|
+
}
|
|
292
|
+
if (!h) continue;
|
|
293
|
+
const b = computeDatum(u.encode, n.value, r), m = { ruleId: u.id, conditionType: u.when.type, threshold: thresholdOf(u), inputValue: n.value, statsUsed: snapshotStats(r), priority: u.priority, wonOver: [] }, g = { ruleId: u.id, fired: true, encode: u.encode, datum: b, ...u.style !== void 0 ? { styleRef: u.style } : {}, lineage: m };
|
|
294
|
+
if (u.encode.kind === "bar" || u.encode.kind === "scale" ? (s && c.push(s.ruleId), s = g) : a.push(g), u.stopIfTrue) {
|
|
295
|
+
l = u.id;
|
|
296
|
+
break;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
s && c.length && (s = { ...s, lineage: { ...s.lineage, wonOver: [...c] } });
|
|
300
|
+
const f = s ?? a[0], d = { decorators: a };
|
|
301
|
+
return s && (d.background = s), f && (d.winner = f), l !== void 0 && (d.stoppedAt = l), d;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
function thresholdOf(e) {
|
|
305
|
+
const { type: t, ...n } = e.when;
|
|
306
|
+
return n;
|
|
307
|
+
}
|
|
308
|
+
const NEUTRAL_MIDPOINT = "#f4f5f6";
|
|
309
|
+
function toHex(e) {
|
|
310
|
+
const t = (n) => Math.max(0, Math.min(255, Math.round(n))).toString(16).padStart(2, "0");
|
|
311
|
+
return `#${t(e.r)}${t(e.g)}${t(e.b)}`;
|
|
312
|
+
}
|
|
313
|
+
function mix(e, t, n) {
|
|
314
|
+
const r = n < 0 ? 0 : n > 1 ? 1 : n;
|
|
315
|
+
return { r: e.r + (t.r - e.r) * r, g: e.g + (t.g - e.g) * r, b: e.b + (t.b - e.b) * r };
|
|
316
|
+
}
|
|
317
|
+
function rgb(e) {
|
|
318
|
+
return OpenGrid.parseColor(e) ?? { r: 58, g: 63, b: 69 };
|
|
319
|
+
}
|
|
320
|
+
function lightAnchorOf(e) {
|
|
321
|
+
return mix({ r: 255, g: 255, b: 255 }, e, 0.08);
|
|
322
|
+
}
|
|
323
|
+
function sequentialColor(e, t) {
|
|
324
|
+
const n = rgb(e);
|
|
325
|
+
return toHex(mix(lightAnchorOf(n), n, t));
|
|
326
|
+
}
|
|
327
|
+
function sequentialBands(e, t) {
|
|
328
|
+
const n = Math.max(2, Math.min(5, Math.floor(t))), r = [];
|
|
329
|
+
for (let i = 0; i < n; i++) r.push(sequentialColor(e, n === 1 ? 0 : i / (n - 1)));
|
|
330
|
+
return r;
|
|
331
|
+
}
|
|
332
|
+
function divergingColor(e, t, n, r = NEUTRAL_MIDPOINT) {
|
|
333
|
+
const i = rgb(r);
|
|
334
|
+
return n <= 0.5 ? toHex(mix(rgb(e), i, n / 0.5)) : toHex(mix(i, rgb(t), (n - 0.5) / 0.5));
|
|
335
|
+
}
|
|
336
|
+
function divergingBands(e, t, n, r = NEUTRAL_MIDPOINT) {
|
|
337
|
+
const i = Math.max(3, Math.min(5, Math.floor(n))), o = [];
|
|
338
|
+
for (let s = 0; s < i; s++) o.push(divergingColor(e, t, i === 1 ? 0.5 : s / (i - 1), r));
|
|
339
|
+
return o;
|
|
340
|
+
}
|
|
341
|
+
const AA_BODY = 4.5, BLACK = "#111111", WHITE = "#ffffff";
|
|
342
|
+
class DefaultInkResolver {
|
|
343
|
+
pickInk(t) {
|
|
344
|
+
const n = OpenGrid.contrastRatio(BLACK, t), r = OpenGrid.contrastRatio(WHITE, t), i = r >= n, o = i ? WHITE : BLACK, s = i ? r : n;
|
|
345
|
+
return s >= AA_BODY ? { color: o, ratio: s } : { color: o, outline: true, outlineColor: i ? BLACK : WHITE, ratio: s };
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
function passesInkGate(e) {
|
|
349
|
+
return Math.max(OpenGrid.contrastRatio(BLACK, e), OpenGrid.contrastRatio(WHITE, e)) >= AA_BODY;
|
|
350
|
+
}
|
|
351
|
+
const ink = new DefaultInkResolver(), MISSING_INK = "#111111";
|
|
352
|
+
function fmt(e) {
|
|
353
|
+
return e === void 0 || !Number.isFinite(e) ? "—" : Number.isInteger(e) ? String(e) : String(Math.round(e * 1e3) / 1e3);
|
|
354
|
+
}
|
|
355
|
+
function pct(e) {
|
|
356
|
+
return e === void 0 ? "—" : `${Math.round(e * 100)}%`;
|
|
357
|
+
}
|
|
358
|
+
class BarEncoder {
|
|
359
|
+
constructor() {
|
|
360
|
+
this.kind = "bar";
|
|
361
|
+
}
|
|
362
|
+
encode(t, n, r) {
|
|
363
|
+
const i = t.encode, o = t.datum;
|
|
364
|
+
if (o.value === void 0) return { layer: "background", inkColor: MISSING_INK, ariaSummary: "값 없음" };
|
|
365
|
+
const s = i.seed ?? (o.sign === -1 ? "graphite" : "primary"), a = n.rampFrom(s), l = (i.axis ?? "zero") === "zero" && o.sign === -1 ? "right" : "left", f = ink.pickInk(a), d = o.ratio ?? 0, u = o.clamped ? " (범위 초과·클램프)" : "", p = i.log ? " (log)" : "", h = `값 ${fmt(o.value)}, 막대 ${pct(d)}${o.sign === -1 ? " 음수" : ""}${u}${p}`;
|
|
366
|
+
return { layer: "background", fill: { color: a, from: l, ratio: d }, inkColor: f.color, ...f.outline ? { inkOutline: true } : {}, ...o.clamped ? { clamped: true } : {}, ariaSummary: h };
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
class ScaleEncoder {
|
|
370
|
+
constructor() {
|
|
371
|
+
this.kind = "scale";
|
|
372
|
+
}
|
|
373
|
+
encode(t, n, r) {
|
|
374
|
+
const i = t.encode, o = t.datum;
|
|
375
|
+
if (o.value === void 0) return { layer: "background", inkColor: MISSING_INK, ariaSummary: "값 없음" };
|
|
376
|
+
const s = i.mode ?? "discrete";
|
|
377
|
+
let a, c = "";
|
|
378
|
+
if (i.diverging) {
|
|
379
|
+
const d = n.rampFrom("graphite"), u = n.rampFrom("primary");
|
|
380
|
+
if (s === "continuous") a = divergingColor(d, u, o.ratio ?? 0.5);
|
|
381
|
+
else {
|
|
382
|
+
const p = divergingBands(d, u, o.bandCount ?? 3);
|
|
383
|
+
a = p[o.bandIndex ?? 0] ?? p[0], c = ` (구간 ${(o.bandIndex ?? 0) + 1}/${o.bandCount ?? p.length})`;
|
|
384
|
+
}
|
|
385
|
+
} else {
|
|
386
|
+
const d = i.seed ?? "graphite", u = n.rampFrom(d);
|
|
387
|
+
if (s === "continuous") a = sequentialColor(u, o.ratio ?? 0);
|
|
388
|
+
else {
|
|
389
|
+
const p = sequentialBands(u, o.bandCount ?? 3);
|
|
390
|
+
a = p[o.bandIndex ?? 0] ?? p[0], c = ` (구간 ${(o.bandIndex ?? 0) + 1}/${o.bandCount ?? p.length})`;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
const l = ink.pickInk(a), f = `값 ${fmt(o.value)}, 히트맵 ${pct(o.ratio)}${c}`;
|
|
394
|
+
return { layer: "background", fill: { color: a, ratio: o.ratio ?? 0 }, inkColor: l.color, ...l.outline ? { inkOutline: true } : {}, ariaSummary: f };
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
function shapeFor(e, t) {
|
|
398
|
+
return t <= 1 ? "circle" : e <= 0 ? "triangleDown" : e >= t - 1 ? "triangleUp" : "circle";
|
|
399
|
+
}
|
|
400
|
+
class IconEncoder {
|
|
401
|
+
constructor() {
|
|
402
|
+
this.kind = "icon";
|
|
403
|
+
}
|
|
404
|
+
encode(t, n, r) {
|
|
405
|
+
const i = t.encode, o = t.datum;
|
|
406
|
+
if (o.value === void 0) return { layer: "decorator", inkColor: MISSING_INK, ariaSummary: "값 없음" };
|
|
407
|
+
const s = o.bandCount ?? i.steps ?? 3, a = o.bandIndex ?? 0, c = shapeFor(a, s), l = sequentialBands(n.rampFrom("graphite"), Math.max(2, s)), f = l[Math.min(l.length - 1, a)] ?? l[0], d = `cf-icon-${a}-of-${s}`, u = a <= 0 ? "하위" : a >= s - 1 ? "상위" : "중간", p = `값 ${fmt(o.value)}, ${u} 구간 ${a + 1}/${s} (${c})`;
|
|
408
|
+
return { layer: "decorator", glyph: { role: d, tint: f, shape: c }, inkColor: f, ariaSummary: p };
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
class SparklineEncoder {
|
|
412
|
+
constructor() {
|
|
413
|
+
this.kind = "sparkline";
|
|
414
|
+
}
|
|
415
|
+
encode(t, n, r) {
|
|
416
|
+
const i = t.encode, o = t.datum;
|
|
417
|
+
return { layer: "decorator", inkColor: "#111111", ariaSummary: `인셀 ${i.chart ?? "line"} 스파크, 값 ${fmt(o.value)}` };
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
function createEncoderRegistry() {
|
|
421
|
+
const e = new TypedRegistry({ spi: { name: "CFEncoder", version: "1" } });
|
|
422
|
+
return e.register("bar", new BarEncoder(), { origin: "builtin" }), e.register("scale", new ScaleEncoder(), { origin: "builtin" }), e.register("icon", new IconEncoder(), { origin: "builtin" }), e.register("sparkline", new SparklineEncoder(), { origin: "builtin" }), e;
|
|
423
|
+
}
|
|
424
|
+
function createNamedStyleRegistry() {
|
|
425
|
+
return new TypedRegistry({ spi: { name: "CFNamedStyle", version: "1" } });
|
|
426
|
+
}
|
|
427
|
+
function isObj(e) {
|
|
428
|
+
return typeof e == "object" && e !== null;
|
|
429
|
+
}
|
|
430
|
+
class DefaultCFRuleLoader {
|
|
431
|
+
load(t, n) {
|
|
432
|
+
const r = [], i = [], o = Array.isArray(t) ? t : isObj(t) && Array.isArray(t.rules) ? t.rules : [];
|
|
433
|
+
for (const s of o) {
|
|
434
|
+
if (!isObj(s)) {
|
|
435
|
+
i.push({ ruleId: "?", reason: "malformed", detail: "not an object" });
|
|
436
|
+
continue;
|
|
437
|
+
}
|
|
438
|
+
const a = typeof s.id == "string" ? s.id : "?", c = s.when, l = s.encode, f = s.scope;
|
|
439
|
+
if (typeof s.v == "number" && s.v > CF_SCHEMA_VERSION) {
|
|
440
|
+
i.push({ ruleId: a, reason: "future-version", detail: `v${s.v} > ${CF_SCHEMA_VERSION}` });
|
|
441
|
+
continue;
|
|
442
|
+
}
|
|
443
|
+
if (!isObj(c) || typeof c.type != "string" || !isObj(l) || typeof l.kind != "string" || !isObj(f) || typeof f.columnId != "string") {
|
|
444
|
+
i.push({ ruleId: a, reason: "malformed", detail: "missing when/encode/scope" });
|
|
445
|
+
continue;
|
|
446
|
+
}
|
|
447
|
+
if (!n.types.has(c.type)) {
|
|
448
|
+
i.push({ ruleId: a, reason: "unknown-condition", detail: String(c.type) });
|
|
449
|
+
continue;
|
|
450
|
+
}
|
|
451
|
+
if (!n.encoders.has(l.kind)) {
|
|
452
|
+
i.push({ ruleId: a, reason: "unknown-encoder", detail: String(l.kind) });
|
|
453
|
+
continue;
|
|
454
|
+
}
|
|
455
|
+
const d = s.style;
|
|
456
|
+
if (isStyleRef(d) && !n.styles.has(d.ref)) {
|
|
457
|
+
i.push({ ruleId: a, reason: "unknown-style", detail: d.ref });
|
|
458
|
+
continue;
|
|
459
|
+
}
|
|
460
|
+
r.push(s);
|
|
461
|
+
}
|
|
462
|
+
return { rules: r, skipped: i };
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
function serializeRules(e) {
|
|
466
|
+
return JSON.stringify({ v: CF_SCHEMA_VERSION, rules: e });
|
|
467
|
+
}
|
|
468
|
+
class CFRuleStore {
|
|
469
|
+
constructor(t = []) {
|
|
470
|
+
this.byColumn = /* @__PURE__ */ new Map(), this.all = [];
|
|
471
|
+
for (const n of t) this.add(n);
|
|
472
|
+
}
|
|
473
|
+
add(t) {
|
|
474
|
+
this.all.push(t);
|
|
475
|
+
const n = this.byColumn.get(t.scope.columnId) ?? [];
|
|
476
|
+
n.push(t), this.byColumn.set(t.scope.columnId, n);
|
|
477
|
+
}
|
|
478
|
+
rulesFor(t) {
|
|
479
|
+
return this.byColumn.get(t) ?? [];
|
|
480
|
+
}
|
|
481
|
+
list() {
|
|
482
|
+
return this.all;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
class CFEngine {
|
|
486
|
+
constructor(t, n = createEncoderRegistry(), r = createRuleTypeRegistry(), i) {
|
|
487
|
+
this.rules = t, this.encoders = n, this.ruleTypes = r, this.evaluator = i ?? new DefaultCFEvaluator(r);
|
|
488
|
+
}
|
|
489
|
+
get lineage() {
|
|
490
|
+
return this;
|
|
491
|
+
}
|
|
492
|
+
paintFor(t, n, r, i, o) {
|
|
493
|
+
const s = this.evaluator.evaluate(this.rules.rulesFor(t.columnId), t, n, o), a = [];
|
|
494
|
+
if (s.background) {
|
|
495
|
+
const c = this.encoders.get(s.background.encode.kind);
|
|
496
|
+
c && a.push(c.encode(s.background, r, i));
|
|
497
|
+
}
|
|
498
|
+
for (const c of s.decorators) {
|
|
499
|
+
const l = this.encoders.get(c.encode.kind);
|
|
500
|
+
l && a.push(l.encode(c, r, i));
|
|
501
|
+
}
|
|
502
|
+
return a;
|
|
503
|
+
}
|
|
504
|
+
statsNeedsFor(t) {
|
|
505
|
+
const n = /* @__PURE__ */ new Set();
|
|
506
|
+
for (const r of this.rules.rulesFor(t)) {
|
|
507
|
+
const i = this.ruleTypes.get(r.when.type);
|
|
508
|
+
if (i) for (const o of i.needs) n.add(o);
|
|
509
|
+
}
|
|
510
|
+
return [...n].sort();
|
|
511
|
+
}
|
|
512
|
+
explain(t, n, r, i) {
|
|
513
|
+
const o = this.evaluator.evaluate(n, t, r, i), s = [];
|
|
514
|
+
o.background && s.push(o.background.lineage);
|
|
515
|
+
for (const a of o.decorators) s.push(a.lineage);
|
|
516
|
+
return s.sort((a, c) => a.priority - c.priority);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
exports.AA_BODY = AA_BODY, exports.BUILTIN_PREDICATES = BUILTIN_PREDICATES, exports.BarEncoder = BarEncoder, exports.CFEngine = CFEngine, exports.CFRuleStore = CFRuleStore, exports.CF_SCHEMA_VERSION = CF_SCHEMA_VERSION, exports.DefaultCFEvaluator = DefaultCFEvaluator, exports.DefaultCFRuleLoader = DefaultCFRuleLoader, exports.DefaultInkResolver = DefaultInkResolver, exports.IconEncoder = IconEncoder, exports.NEUTRAL_MIDPOINT = NEUTRAL_MIDPOINT, exports.ScaleEncoder = ScaleEncoder, exports.SparklineEncoder = SparklineEncoder, exports.cfRuleEquals = cfRuleEquals, exports.computeColumnStats = computeColumnStats, exports.computeDatum = computeDatum, exports.createEncoderRegistry = createEncoderRegistry, exports.createNamedStyleRegistry = createNamedStyleRegistry, exports.createRuleTypeRegistry = createRuleTypeRegistry, exports.divergingBands = divergingBands, exports.divergingColor = divergingColor, exports.isStyleRef = isStyleRef, exports.passesInkGate = passesInkGate, exports.scopeMatches = scopeMatches, exports.sequentialBands = sequentialBands, exports.sequentialColor = sequentialColor, exports.serializeRules = serializeRules, exports.snapshotStats = snapshotStats, exports.staticAppearanceView = staticAppearanceView;
|
|
520
|
+
//# sourceMappingURL=index-JjfWY3Bt.cjs.map
|
package/dist/open-grid-base.css
CHANGED
|
@@ -123,6 +123,17 @@
|
|
|
123
123
|
차단한다. 모든 후손(행·셀·헤더 <th> 포함)으로 normal이 cascade되어,
|
|
124
124
|
고정 행/헤더 높이가 호스트 본문 line-height에 desync되는 것을 막는다. */
|
|
125
125
|
line-height: normal;
|
|
126
|
+
/* host isolation(확장): 호스트 테마가 body/후손에 건 텍스트-흐름 상속 속성을 차단한다.
|
|
127
|
+
letter-spacing·word-spacing 이 상속되면 셀 텍스트가 "김 민 준"처럼 벌어지고(부모 div 오염),
|
|
128
|
+
text-transform/text-indent/font-style/font-variant 도 데이터 표시를 왜곡한다. 컨테이너에서
|
|
129
|
+
normal/기본으로 못박아 전 후손에 cascade — 특정 요소(헤더 letter-spacing·uppercase 등)는
|
|
130
|
+
자기 규칙으로 명시 재지정하므로 영향받지 않는다. */
|
|
131
|
+
letter-spacing: normal;
|
|
132
|
+
word-spacing: normal;
|
|
133
|
+
text-transform: none;
|
|
134
|
+
text-indent: 0;
|
|
135
|
+
font-style: normal;
|
|
136
|
+
font-variant: normal;
|
|
126
137
|
display: flex;
|
|
127
138
|
flex-direction: column;
|
|
128
139
|
overflow: hidden;
|
|
@@ -1704,7 +1715,7 @@
|
|
|
1704
1715
|
font-size: 12px;
|
|
1705
1716
|
}
|
|
1706
1717
|
|
|
1707
|
-
.og-vue-wrapper[data-v-
|
|
1718
|
+
.og-vue-wrapper[data-v-a9841021] {
|
|
1708
1719
|
display: block;
|
|
1709
1720
|
box-sizing: border-box;
|
|
1710
1721
|
}
|
package/dist/open-grid-react.cjs
CHANGED
|
@@ -1,2 +1,28 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime"), React = require("react"), OpenGrid = require("./OpenGrid-B7m7ei7f.cjs");
|
|
4
|
+
function OpenGridReact({ data: e, columns: r, height: t = 400, width: u = "100%", editable: i = false, sortable: p = true, filterable: o = true, rowNumber: l = false, checkColumn: d = false, stateColumn: y = false, draggable: R = false, frozenColumns: x = 0, theme: s = "default", options: E, style: T, className: $, onReady: g, onDataChange: O, onCellClick: G, onRowClick: j, onEditEnd: a, onSortChange: b, onFilterChange: q, onRowDrop: S }) {
|
|
5
|
+
const c = React.useRef(null), n = React.useRef(null), M = { height: typeof t == "number" ? `${t}px` : t, width: typeof u == "number" ? `${u}px` : u, display: "block", boxSizing: "border-box", ...T };
|
|
6
|
+
return React.useEffect(() => {
|
|
7
|
+
if (!c.current) return;
|
|
8
|
+
const P = { columns: r, height: "100%", width: "100%", editable: i, sortable: p, filterable: o, rowNumber: l, checkColumn: d, stateColumn: y, draggable: R, frozenColumns: x, theme: s, ...E, onReady: (f) => {
|
|
9
|
+
n.current = f, (e == null ? void 0 : e.length) && f.setData(e), g == null ? void 0 : g(f);
|
|
10
|
+
}, ...O && { onDataChange: O }, ...G && { onCellClick: G }, ...j && { onRowClick: j }, ...a && { onEditEnd: a }, ...b && { onSortChange: b }, ...q && { onFilterChange: q }, ...S && { onRowDrop: S } }, v = new OpenGrid.OpenGrid(c.current, P);
|
|
11
|
+
return n.current = v, () => {
|
|
12
|
+
v.destroy(), n.current = null;
|
|
13
|
+
};
|
|
14
|
+
}, [r, i, p, o, l, d, y, R, x]), React.useEffect(() => {
|
|
15
|
+
n.current && e && n.current.setData(e);
|
|
16
|
+
}, [e]), React.useEffect(() => {
|
|
17
|
+
n.current && n.current.setTheme(s);
|
|
18
|
+
}, [s]), jsxRuntime.jsx("div", { ref: c, style: M, className: $ });
|
|
19
|
+
}
|
|
20
|
+
const OpenGridWithRef = React.forwardRef((e, r) => {
|
|
21
|
+
React.useRef(null);
|
|
22
|
+
const t = React.useRef(null);
|
|
23
|
+
return React.useEffect(() => {
|
|
24
|
+
t.current && r && (typeof r == "function" ? r(t.current) : r.current = t.current);
|
|
25
|
+
}), jsxRuntime.jsx(OpenGridReact, { ...e });
|
|
26
|
+
});
|
|
27
|
+
OpenGridWithRef.displayName = "OpenGrid", exports.OpenGrid = OpenGridReact;
|
|
2
28
|
//# sourceMappingURL=open-grid-react.cjs.map
|