reactive-md 0.9.3 → 0.10.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-ch.md +34 -0
- package/CHANGELOG.md +34 -0
- package/README-ch.md +7 -7
- package/README-en.md +7 -7
- package/README.md +7 -7
- package/THIRD_PARTY_NOTICES.md +0 -57
- package/cli/help.mjs +6 -4
- package/cli/init.mjs +1 -1
- package/cli/migrate.mjs +1 -1
- package/dist-library/{LocalDocumentView-D6zQkTkt.js → LocalDocumentView-CP2QG86k.js} +46 -44
- package/dist-library/{LocalDocumentViewCore-CmJhemcA.js → LocalDocumentViewCore-Cd6yMEkg.js} +284 -265
- package/dist-library/{LocalReactiveDocumentCore-lAKOGAZ7.js → LocalReactiveDocumentCore-VuYpZqdn.js} +7 -7
- package/dist-library/LocalStaticDocumentView-DfX6bemE.js +147 -0
- package/dist-library/authoring-Bwu_zCWs.js +768 -0
- package/dist-library/choice-values-BItGjPD2.js +58 -0
- package/dist-library/compile-B35rfzKr.js +1742 -0
- package/dist-library/{compile-cache-key-6GgpETz_.js → compile-cache-key-D21X2Obx.js} +5 -5
- package/dist-library/{compiler-DLkKUK4t.js → compiler-DBwLawMZ.js} +4 -4
- package/dist-library/{compiler-core-Niqhp9wV.js → compiler-core-kkDiQ1RK.js} +3146 -2055
- package/dist-library/{component-kernel-IG4wOO0i.js → component-kernel-CsJSabHX.js} +42 -26
- package/dist-library/{component-state-Ht-hOK0W.js → component-state-Da0G8Ajc.js} +1 -1
- package/dist-library/{component-utils-eSj5IdG4.js → component-utils-ZM3jUJNy.js} +80 -79
- package/dist-library/conditional-branches-CIhJXasR.js +17 -0
- package/dist-library/{config-validation-Cpol91_M.js → config-validation-DbmsWAEV.js} +165 -152
- package/dist-library/{controls-B-CLSK8Q.js → controls-DRy5rzzN.js} +271 -228
- package/dist-library/{coordinate-PyLPMIQK.js → coordinate-c54pHfgf.js} +29 -29
- package/dist-library/data-table-CSAkm1eU.js +290 -0
- package/dist-library/data-table-model-DruztQFt.js +391 -0
- package/dist-library/{data-visuals-_Z7QqYTk.js → data-visuals-rZQUeQM0.js} +14 -14
- package/dist-library/{default-components-jugH7Ubr.js → default-components-B-39etG9.js} +233 -71
- package/dist-library/{default-config-DIrRpuQz.js → default-config-CCa8rm2k.js} +236 -216
- package/dist-library/default-options-By16CVw1.js +131 -0
- package/dist-library/{default-registry-BlloaZi7.js → default-registry-DXJy66xj.js} +3 -3
- package/dist-library/{default-schema-Ch-Vznpm.js → default-schema-CeYiEW1K.js} +3 -3
- package/dist-library/display-Bb6hAG5T.js +2065 -0
- package/dist-library/{document-theme-DBAfnk7y.js → document-theme-CJvN-nC1.js} +190 -3
- package/dist-library/{export-heVBqgxA.js → export-BSV4E0jv.js} +105 -106
- package/dist-library/font-aliases-CKYjwn4o.js +4 -0
- package/dist-library/{gallery-Q6VPS2ep.js → gallery-DM2yTVZJ.js} +1 -1
- package/dist-library/{html-CCnvzan1.js → html-CY9mC3Sr.js} +5 -5
- package/dist-library/{incremental-Bzvh8_lB.js → incremental-B-wW4H3F.js} +251 -245
- package/dist-library/{display-y4v9v0Qd.js → katex-4ukd4ZxT.js} +1555 -3618
- package/dist-library/layout-CPQggKxk.js +592 -0
- package/dist-library/{layout-BnfDeUNy.js → layout-CaDWsDof.js} +1 -1
- package/dist-library/{math-view-B0jthpRw.js → math-view-CyGTS6kv.js} +1 -1
- package/dist-library/{mount-preset-C_i37FvY.js → mount-preset-DtrCX4G8.js} +4 -4
- package/dist-library/{numeric-sliders-CkWS0-ja.js → numeric-sliders-BmJ1LCLx.js} +190 -190
- package/dist-library/{observability-CYLuvFfL.js → observability-BVQ16ByQ.js} +5 -4
- package/dist-library/{package-core-9UK5ZdqB.js → package-core-Cu_r_qs7.js} +7 -6
- package/dist-library/{parser-9yNJxGip.js → parser-BHl9Lxbw.js} +2 -2
- package/dist-library/{parser-standard-BPIy4HOu.js → parser-standard-DDAKv_DZ.js} +247 -247
- package/dist-library/{plugin-packs-CZb46nuv.js → plugin-packs-CkI0floL.js} +3 -3
- package/dist-library/{preset-core-BW3NWZJ9.js → preset-core-BKPbH_Nv.js} +377 -306
- package/dist-library/{props-pJRrfDc6.js → props-0iDqxlTk.js} +56 -61
- package/dist-library/{react-BSo0o998.js → react-74jdGBmu.js} +2 -2
- package/dist-library/reactive-md-authoring.js +277 -269
- package/dist-library/reactive-md-build.js +327 -33
- package/dist-library/reactive-md-compiler-session.js +3 -3
- package/dist-library/reactive-md-compiler-standard.js +10 -10
- package/dist-library/reactive-md-compiler.js +3 -3
- package/dist-library/reactive-md-contracts.js +4 -4
- package/dist-library/reactive-md-default-packs.js +4 -3
- package/dist-library/reactive-md-default-preset.js +3 -3
- package/dist-library/reactive-md-export.js +6 -6
- package/dist-library/reactive-md-minimal-preset.js +3 -2
- package/dist-library/reactive-md-minimal-react-preset.js +18 -17
- package/dist-library/reactive-md-minimal.css +1 -1
- package/dist-library/reactive-md-observability.js +2 -2
- package/dist-library/reactive-md-pack-style-manifest.js +8 -0
- package/dist-library/reactive-md-plugin-chart.js +13 -9
- package/dist-library/reactive-md-plugin-data.js +4 -4
- package/dist-library/reactive-md-plugin-diagram.js +3 -3
- package/dist-library/reactive-md-plugin-forms.js +5 -5
- package/dist-library/reactive-md-plugin-gallery.js +3 -3
- package/dist-library/reactive-md-plugin-navigation.js +10 -10
- package/dist-library/reactive-md-plugin-network.js +5 -5
- package/dist-library/reactive-md-plugin-plot.js +4 -4
- package/dist-library/reactive-md-react-component-accordion.js +3 -3
- package/dist-library/reactive-md-react-component-alert.js +3 -3
- package/dist-library/reactive-md-react-component-anchor.js +3 -3
- package/dist-library/reactive-md-react-component-badge.js +3 -3
- package/dist-library/reactive-md-react-component-card.js +3 -3
- package/dist-library/reactive-md-react-component-chart.js +2 -2
- package/dist-library/reactive-md-react-component-checkbox.js +2 -2
- package/dist-library/reactive-md-react-component-checklist.js +2 -2
- package/dist-library/reactive-md-react-component-choices.js +2 -2
- package/dist-library/reactive-md-react-component-column.js +1 -1
- package/dist-library/reactive-md-react-component-coordinate.js +2 -2
- package/dist-library/reactive-md-react-component-counter.js +2 -2
- package/dist-library/reactive-md-react-component-data-table.js +2 -2
- package/dist-library/reactive-md-react-component-date.js +2 -2
- package/dist-library/reactive-md-react-component-diagram.js +2 -2
- package/dist-library/reactive-md-react-component-disclosure.js +3 -3
- package/dist-library/reactive-md-react-component-edge.js +1 -1
- package/dist-library/reactive-md-react-component-else.js +10 -0
- package/dist-library/reactive-md-react-component-gallery-item.js +2 -2
- package/dist-library/reactive-md-react-component-gallery.js +2 -2
- package/dist-library/reactive-md-react-component-grid.js +3 -3
- package/dist-library/reactive-md-react-component-if.js +3 -3
- package/dist-library/reactive-md-react-component-input.js +2 -2
- package/dist-library/reactive-md-react-component-jump.js +3 -3
- package/dist-library/reactive-md-react-component-multi-select.js +2 -2
- package/dist-library/reactive-md-react-component-node.js +2 -2
- package/dist-library/reactive-md-react-component-number.js +2 -2
- package/dist-library/reactive-md-react-component-option.js +1 -1
- package/dist-library/reactive-md-react-component-panel.js +3 -3
- package/dist-library/reactive-md-react-component-plot.js +2 -2
- package/dist-library/reactive-md-react-component-progress.js +2 -2
- package/dist-library/reactive-md-react-component-quiz.js +2 -2
- package/dist-library/reactive-md-react-component-radio-group.js +2 -2
- package/dist-library/reactive-md-react-component-range-slider.js +2 -2
- package/dist-library/reactive-md-react-component-section.js +3 -3
- package/dist-library/reactive-md-react-component-select.js +2 -2
- package/dist-library/reactive-md-react-component-slider.js +2 -2
- package/dist-library/reactive-md-react-component-step.js +3 -3
- package/dist-library/reactive-md-react-component-steps.js +3 -3
- package/dist-library/reactive-md-react-component-tab.js +3 -3
- package/dist-library/reactive-md-react-component-table.js +2 -2
- package/dist-library/reactive-md-react-component-tabs.js +3 -3
- package/dist-library/reactive-md-react-component-text.js +3 -3
- package/dist-library/reactive-md-react-component-textarea.js +2 -2
- package/dist-library/reactive-md-react-component-timeline.js +2 -2
- package/dist-library/reactive-md-react-component-timer.js +2 -2
- package/dist-library/reactive-md-react-component-toggle.js +2 -2
- package/dist-library/reactive-md-react-component-tooltip.js +3 -3
- package/dist-library/reactive-md-react-component-validation.js +3 -3
- package/dist-library/reactive-md-react-minimal.js +4 -4
- package/dist-library/reactive-md-react-pack-controls.js +4 -4
- package/dist-library/reactive-md-react-pack-data.js +3 -3
- package/dist-library/reactive-md-react-pack-layout.js +25 -24
- package/dist-library/reactive-md-react-pack-visuals.js +2 -2
- package/dist-library/reactive-md-react-packed.js +6 -6
- package/dist-library/reactive-md-react-server.js +37 -36
- package/dist-library/reactive-md-react-static-server.js +2 -2
- package/dist-library/reactive-md-react-static.js +1 -1
- package/dist-library/reactive-md-react-unstyled.js +12 -12
- package/dist-library/reactive-md-react.js +12 -12
- package/dist-library/reactive-md-scan.js +1 -1
- package/dist-library/reactive-md-sdk.js +23 -9
- package/dist-library/reactive-md-standalone-configured.js +2 -2
- package/dist-library/reactive-md-standalone-host.js +2 -2
- package/dist-library/reactive-md-testing-browser.js +2 -2
- package/dist-library/reactive-md-testing-react.js +6 -6
- package/dist-library/reactive-md-testing.js +6 -6
- package/dist-library/reactive-md-vite.js +25 -9
- package/dist-library/reactive-md-worker-pool.js +3 -3
- package/dist-library/reactive-md.css +1 -1
- package/dist-library/reactive-md.js +52 -43
- package/dist-library/{registry-core-CziAIP5P.js → registry-core-DxEaxhJ6.js} +3 -2
- package/dist-library/{render-nodes-DKjg_TR1.js → render-nodes-B6j6Ip5I.js} +766 -731
- package/dist-library/{requirements-DhIkxAbl.js → requirements-C56sFIEs.js} +2 -2
- package/dist-library/{resources-B_nbROgj.js → resources-6VaNgk-h.js} +2 -2
- package/dist-library/rmd-pack-layout.css +9 -0
- package/dist-library/rmd-pack-resource-layout.css +9 -0
- package/dist-library/runtime-BHeuLOv_.js +1369 -0
- package/dist-library/{runtime-requirement-C4-vNcf5.js → runtime-requirement-DzPO8raU.js} +166 -163
- package/dist-library/{schema-core-4sd1Vu7V.js → schema-core-CDXfxdID.js} +24 -1
- package/dist-library/{sdk-core-BLsW9cCy.js → sdk-core-CnE-n0Z7.js} +469 -314
- package/dist-library/{session-core-DLBRPV7f.js → session-core-C071yQwV.js} +140 -127
- package/dist-library/{validation-XXlb-spV.js → sha256-utf16-Bmandi_H.js} +392 -315
- package/dist-library/shareable-CHCDnl6j.js +844 -0
- package/dist-library/types/authoring/catalog.d.ts +3 -1
- package/dist-library/types/authoring/index.d.ts +1 -1
- package/dist-library/types/components/chart/default-chart-types.d.ts +3 -0
- package/dist-library/types/components/chart/default-chart.d.ts +7 -0
- package/dist-library/types/components/entries/else.d.ts +3 -0
- package/dist-library/types/components/layout/layout.d.ts +5 -0
- package/dist-library/types/components/shared/visuals.d.ts +1 -1
- package/dist-library/types/components/table/data-table-model.d.ts +95 -2
- package/dist-library/types/components/table/data-table.d.ts +2 -2
- package/dist-library/types/contracts/component-kernel.d.ts +5 -0
- package/dist-library/types/contracts/font-aliases.d.ts +18 -0
- package/dist-library/types/contracts/number-literal.d.ts +2 -0
- package/dist-library/types/contracts/sha256-utf16.d.ts +2 -0
- package/dist-library/types/export/index.d.ts +4 -1
- package/dist-library/types/local/compilation/compiler-choices.d.ts +4 -0
- package/dist-library/types/local/compilation/compiler-declarations.d.ts +2 -1
- package/dist-library/types/local/compilation/compiler-expressions.d.ts +12 -1
- package/dist-library/types/local/compilation/compiler-macros.d.ts +18 -0
- package/dist-library/types/local/compilation/compiler-structure.d.ts +8 -2
- package/dist-library/types/local/compilation/compiler-tables.d.ts +1 -0
- package/dist-library/types/local/compilation/compiler-validation.d.ts +11 -0
- package/dist-library/types/local/compilation/compiler-values.d.ts +1 -2
- package/dist-library/types/local/configuration/diagnostic-messages.d.ts +173 -2
- package/dist-library/types/local/configuration/diagnostic-runtime-messages.d.ts +40 -0
- package/dist-library/types/local/evaluation/choice-values.d.ts +22 -0
- package/dist-library/types/local/evaluation/computations.d.ts +13 -5
- package/dist-library/types/local/evaluation/dataset.d.ts +4 -0
- package/dist-library/types/local/evaluation/expression/collection-functions.d.ts +13 -0
- package/dist-library/types/local/evaluation/expression/compile.d.ts +11 -4
- package/dist-library/types/local/evaluation/expression/data-functions.d.ts +23 -0
- package/dist-library/types/local/evaluation/expression/evaluation.d.ts +3 -1
- package/dist-library/types/local/evaluation/expression/internal-names.d.ts +8 -0
- package/dist-library/types/local/evaluation/expression/syntax.d.ts +19 -2
- package/dist-library/types/local/evaluation/expression/transform-budget.d.ts +13 -0
- package/dist-library/types/local/evaluation/expression/values.d.ts +9 -1
- package/dist-library/types/local/evaluation/validation.d.ts +8 -6
- package/dist-library/types/local/index.d.ts +4 -3
- package/dist-library/types/local/parsing/conditional-branches.d.ts +4 -0
- package/dist-library/types/local/parsing/source-revision.d.ts +3 -0
- package/dist-library/types/local/runtime/runtime-choices.d.ts +11 -0
- package/dist-library/types/local/runtime/runtime.d.ts +3 -1
- package/dist-library/types/local/runtime/state.d.ts +30 -15
- package/dist-library/types/local/source/authoring-requirements.d.ts +3 -0
- package/dist-library/types/local/source/authoring-syntax.d.ts +3 -2
- package/dist-library/types/local/source/authoring.d.ts +10 -0
- package/dist-library/types/local/source/source-migration.d.ts +1 -0
- package/dist-library/types/local/types.d.ts +33 -2
- package/dist-library/types/react/component-api.d.ts +21 -2
- package/dist-library/types/react/component-utils.d.ts +11 -0
- package/dist-library/types/react/font-aliases.d.ts +2 -0
- package/dist-library/types/react/package-core.d.ts +3 -0
- package/dist-library/types/react/rendering/document/validation-state.d.ts +1 -1
- package/dist-library/types/react/rendering/document/view-revision.d.ts +3 -12
- package/dist-library/types/react/rendering/table/data-table.d.ts +1 -1
- package/dist-library/types/react/sdk-core.d.ts +3 -1
- package/dist-library/types/sdk/assembly.d.ts +3 -0
- package/dist-library/types/sdk/font.d.ts +13 -0
- package/dist-library/types/sdk/index.d.ts +1 -0
- package/dist-library/types/sdk/theme.d.ts +5 -0
- package/dist-library/types/sdk/types.d.ts +6 -0
- package/dist-library/types/sdk/version.d.ts +1 -1
- package/dist-library/types/shareable.d.ts +15 -3
- package/dist-library/types/standalone/prepare.d.ts +4 -2
- package/dist-library/types/standalone/session-core.d.ts +4 -1
- package/dist-library/types/vite/index.d.ts +3 -0
- package/dist-library/types/vite/registration.d.ts +1 -0
- package/dist-library/{types-Bza88SGK.js → types-B4qG8J4S.js} +1 -1
- package/dist-library/types-FYhRWRn9.js +3 -0
- package/dist-library/use-hydrated-D1gFY2Dq.js +2655 -0
- package/dist-library/validation-DRuW0Wl9.js +433 -0
- package/dist-library/{version-B0G1699c.js → version-4wzhbvDG.js} +1 -1
- package/dist-library/{visual-helpers-CRmaqCHX.js → visual-helpers-UU6xiL8g.js} +3 -3
- package/dist-library/visuals-7xzoL9ql.js +49340 -0
- package/dist-library/{worker-D6WMV8xJ.js → worker-3ldRjOEG.js} +9 -9
- package/dist-standalone/reactive-md-standalone.css +1 -1
- package/dist-standalone/reactive-md-standalone.js +128 -368
- package/docs/README-ch.md +3 -1
- package/docs/README.md +3 -1
- package/docs/compatibility/api-stability-ch.md +1 -1
- package/docs/compatibility/api-stability-en.md +1 -1
- package/docs/compatibility/compatibility-ch.md +15 -15
- package/docs/compatibility/compatibility-en.md +15 -15
- package/docs/compatibility/compatibility-manifest.schema.json +3 -2
- package/docs/compatibility/deprecation-ch.md +2 -2
- package/docs/compatibility/deprecation-en.md +2 -2
- package/docs/compatibility/source-versioning-ch.md +22 -14
- package/docs/compatibility/source-versioning-en.md +22 -13
- package/docs/compatibility/support-matrix-ch.md +4 -3
- package/docs/compatibility/support-matrix-en.md +4 -3
- package/docs/development/component-development-ch.md +2 -2
- package/docs/development/component-development-en.md +2 -2
- package/docs/development/component-protocol-ch.md +18 -18
- package/docs/development/component-protocol-en.md +14 -14
- package/docs/guides/local-guide-ch.md +109 -20
- package/docs/guides/local-guide-en.md +109 -20
- package/docs/integration/author-tools-ch.md +1 -1
- package/docs/integration/author-tools-en.md +1 -1
- package/docs/integration/editor-ch.md +3 -3
- package/docs/integration/editor-en.md +3 -3
- package/docs/integration/extension-sdk-ch.md +29 -3
- package/docs/integration/extension-sdk-en.md +29 -3
- package/docs/integration/local-integration-ch.md +3 -3
- package/docs/integration/local-integration-en.md +3 -3
- package/docs/integration/pdf-export-ch.md +42 -0
- package/docs/integration/pdf-export-en.md +42 -0
- package/docs/integration/shareable-export-ch.md +11 -19
- package/docs/integration/shareable-export-en.md +11 -19
- package/docs/reference/diagnostics-counting-ch.md +24 -1
- package/docs/reference/diagnostics-counting-en.md +24 -1
- package/docs/reference/local-interaction-syntax-ch.md +222 -33
- package/docs/reference/local-interaction-syntax-en.md +220 -31
- package/docs/reference/public-api-ch.md +24 -18
- package/docs/reference/public-api-en.md +24 -18
- package/docs/reference/theme-protocol-ch.md +1 -1
- package/docs/reference/theme-protocol-en.md +1 -1
- package/docs/releases/release-0.10.0-ch.md +45 -0
- package/docs/releases/release-0.10.0-en.md +45 -0
- package/examples/conformance/README-ch.md +3 -3
- package/examples/conformance/README.md +3 -3
- package/examples/conformance/local-draft-4.json +441 -0
- package/examples/integration/README-ch.md +3 -3
- package/examples/integration/README.md +3 -3
- package/examples/integration/chat-session/package.json +1 -1
- package/examples/local/README-ch.md +1 -1
- package/examples/local/README.md +1 -1
- package/package.json +6 -1
- package/dist-library/LocalStaticDocumentView-2J7w0sKm.js +0 -143
- package/dist-library/authoring-B14SsOXZ.js +0 -893
- package/dist-library/compile-D50B5_Ww.js +0 -1249
- package/dist-library/computations-CffoW7Ff.js +0 -340
- package/dist-library/data-table-Kv_ZA2Z2.js +0 -297
- package/dist-library/default-options-DU5dxuU6.js +0 -125
- package/dist-library/layout-BfUzzO2b.js +0 -553
- package/dist-library/runtime-CuJndKqK.js +0 -1289
- package/dist-library/shareable-C6mUerpQ.js +0 -817
- package/dist-library/types-daDo2c_w.js +0 -3
- package/dist-library/use-hydrated-W-laKPhY.js +0 -22975
- package/dist-library/visuals-CoVSjVD8.js +0 -49159
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
import { u as e } from "./limits-CFERRrlC.js";
|
|
2
|
+
import { a as t, d as n, f as r, p as i, t as a, u as o } from "./compile-B35rfzKr.js";
|
|
3
|
+
import { t as s } from "./choice-values-BItGjPD2.js";
|
|
4
|
+
// src/components/table/data-table-model.ts
|
|
5
|
+
var c = class extends Error {
|
|
6
|
+
failure;
|
|
7
|
+
constructor(e) {
|
|
8
|
+
super(e), this.name = "DataTableFailureError", this.failure = e;
|
|
9
|
+
}
|
|
10
|
+
}, l = [
|
|
11
|
+
"plain",
|
|
12
|
+
"number",
|
|
13
|
+
"percent",
|
|
14
|
+
"scientific",
|
|
15
|
+
"currency"
|
|
16
|
+
], u = [
|
|
17
|
+
"left",
|
|
18
|
+
"center",
|
|
19
|
+
"right"
|
|
20
|
+
];
|
|
21
|
+
function d(e, t) {
|
|
22
|
+
let n = t.format && t.format !== "plain" ? t.format : null;
|
|
23
|
+
if (n === null) return null;
|
|
24
|
+
try {
|
|
25
|
+
return m(n, e, t);
|
|
26
|
+
} catch {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
var f = {
|
|
31
|
+
number: 2,
|
|
32
|
+
percent: 0,
|
|
33
|
+
scientific: 2,
|
|
34
|
+
currency: 2
|
|
35
|
+
};
|
|
36
|
+
function p(e) {
|
|
37
|
+
return typeof e == "string" && l.includes(e);
|
|
38
|
+
}
|
|
39
|
+
function m(e, t, a) {
|
|
40
|
+
let s = a.digits ?? f[e], c = a.locale ?? "en-US";
|
|
41
|
+
switch (e) {
|
|
42
|
+
case "number": return n(t, s, c);
|
|
43
|
+
case "percent": return r(t, s, c);
|
|
44
|
+
case "scientific": return i(t, s, c);
|
|
45
|
+
case "currency": return o(t, a.currency ?? "USD", s, c);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function h(e) {
|
|
49
|
+
return e === null ? "" : typeof e == "string" ? e : typeof e == "number" ? Number.isFinite(e) ? String(e) : null : typeof e == "boolean" ? e ? "true" : "false" : null;
|
|
50
|
+
}
|
|
51
|
+
function g(e) {
|
|
52
|
+
if (typeof e == "string") return e === "" ? null : {
|
|
53
|
+
key: `s:${e}`,
|
|
54
|
+
keyValue: e
|
|
55
|
+
};
|
|
56
|
+
if (typeof e == "number") {
|
|
57
|
+
if (!Number.isFinite(e)) return null;
|
|
58
|
+
let t = e === 0 ? 0 : e;
|
|
59
|
+
return {
|
|
60
|
+
key: `n:${t}`,
|
|
61
|
+
keyValue: t
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
function _(e) {
|
|
67
|
+
return s(e.keyValue) ?? "";
|
|
68
|
+
}
|
|
69
|
+
function v(e, t) {
|
|
70
|
+
let n = _(e);
|
|
71
|
+
return t(n), n;
|
|
72
|
+
}
|
|
73
|
+
function y(e, t) {
|
|
74
|
+
return t === "" ? null : e.rows.find((e) => _(e) === t) ?? null;
|
|
75
|
+
}
|
|
76
|
+
function b(e, t, n) {
|
|
77
|
+
let r = { ...n };
|
|
78
|
+
for (let i of t) Object.hasOwn(n, i) || Object.defineProperty(r, i, {
|
|
79
|
+
enumerable: !0,
|
|
80
|
+
configurable: !0,
|
|
81
|
+
get() {
|
|
82
|
+
return e.evaluate(i);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
return r;
|
|
86
|
+
}
|
|
87
|
+
function x(e) {
|
|
88
|
+
if (e.length === 0) return null;
|
|
89
|
+
let t = typeof e[0];
|
|
90
|
+
if (t !== "string" && t !== "number") return "rows";
|
|
91
|
+
for (let n of e) if (typeof n !== t || typeof n == "number" && !Number.isFinite(n)) return "rows";
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
function S(e, n, r) {
|
|
95
|
+
let i;
|
|
96
|
+
try {
|
|
97
|
+
i = a(n);
|
|
98
|
+
} catch {
|
|
99
|
+
throw new c("rows");
|
|
100
|
+
}
|
|
101
|
+
let o;
|
|
102
|
+
try {
|
|
103
|
+
o = i.evaluate(b(e, i.dependencies, {}), r ?? t());
|
|
104
|
+
} catch {
|
|
105
|
+
throw new c("rows");
|
|
106
|
+
}
|
|
107
|
+
if (!Array.isArray(o)) throw new c("rows");
|
|
108
|
+
let s = x(o);
|
|
109
|
+
if (s) throw new c(s);
|
|
110
|
+
return o;
|
|
111
|
+
}
|
|
112
|
+
function C(e) {
|
|
113
|
+
let { rows: n, columns: r, keyExpression: i, runtime: o } = e, s = e.maxRows ?? 100, l = e.budget ?? 1e5, d = e.stage ?? t();
|
|
114
|
+
if (!Number.isSafeInteger(s) || s <= 0 || s > 1e3) return {
|
|
115
|
+
ok: !1,
|
|
116
|
+
failure: "max-rows"
|
|
117
|
+
};
|
|
118
|
+
if (r.length < 1 || r.length > 20) return {
|
|
119
|
+
ok: !1,
|
|
120
|
+
failure: "columns"
|
|
121
|
+
};
|
|
122
|
+
let f = x(n);
|
|
123
|
+
if (f) return {
|
|
124
|
+
ok: !1,
|
|
125
|
+
failure: f
|
|
126
|
+
};
|
|
127
|
+
if (n.length > s) return {
|
|
128
|
+
ok: !1,
|
|
129
|
+
failure: "rows-budget"
|
|
130
|
+
};
|
|
131
|
+
let _ = null;
|
|
132
|
+
if (i !== void 0) {
|
|
133
|
+
try {
|
|
134
|
+
_ = a(i);
|
|
135
|
+
} catch {
|
|
136
|
+
return {
|
|
137
|
+
ok: !1,
|
|
138
|
+
failure: "key"
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
let e = _.dependencies;
|
|
142
|
+
if (e.length !== 1 || e[0] !== "item") return {
|
|
143
|
+
ok: !1,
|
|
144
|
+
failure: "key"
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
let v = r.map((e) => {
|
|
148
|
+
try {
|
|
149
|
+
return {
|
|
150
|
+
spec: e,
|
|
151
|
+
expression: a(e.value)
|
|
152
|
+
};
|
|
153
|
+
} catch {
|
|
154
|
+
return {
|
|
155
|
+
spec: e,
|
|
156
|
+
expression: null
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
}), y = null;
|
|
160
|
+
if (e.rowAlign !== void 0) try {
|
|
161
|
+
y = a(e.rowAlign);
|
|
162
|
+
} catch {
|
|
163
|
+
y = null;
|
|
164
|
+
}
|
|
165
|
+
let S = (e) => {
|
|
166
|
+
if (!y) return null;
|
|
167
|
+
try {
|
|
168
|
+
let t = y.evaluate(b(o, y.dependencies, e), d);
|
|
169
|
+
return typeof t == "string" && u.includes(t) ? t : null;
|
|
170
|
+
} catch {
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
}, C = 0;
|
|
174
|
+
for (let e of r) C += e.label.length;
|
|
175
|
+
if (n.length === 0) {
|
|
176
|
+
let t = e.emptyText;
|
|
177
|
+
C += t !== void 0 && t !== "" ? t.length : 7;
|
|
178
|
+
}
|
|
179
|
+
if (C > l) return {
|
|
180
|
+
ok: !1,
|
|
181
|
+
failure: "text-budget"
|
|
182
|
+
};
|
|
183
|
+
let w = (e) => {
|
|
184
|
+
if (C += e, C > l) throw new c("text-budget");
|
|
185
|
+
}, T = () => ({
|
|
186
|
+
ok: !1,
|
|
187
|
+
text: "",
|
|
188
|
+
value: null,
|
|
189
|
+
numeric: null
|
|
190
|
+
}), E = /* @__PURE__ */ new Set(), D = [];
|
|
191
|
+
try {
|
|
192
|
+
for (let e = 0; e < n.length; e += 1) {
|
|
193
|
+
let t = {
|
|
194
|
+
item: n[e],
|
|
195
|
+
index: e
|
|
196
|
+
}, r = _ === null ? {
|
|
197
|
+
key: `i:${e}`,
|
|
198
|
+
keyValue: e
|
|
199
|
+
} : (() => {
|
|
200
|
+
try {
|
|
201
|
+
return g(_.evaluate(t, d));
|
|
202
|
+
} catch {
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
})();
|
|
206
|
+
if (r === null) return {
|
|
207
|
+
ok: !1,
|
|
208
|
+
failure: "key"
|
|
209
|
+
};
|
|
210
|
+
if (_ !== null) {
|
|
211
|
+
if (E.has(r.key)) return {
|
|
212
|
+
ok: !1,
|
|
213
|
+
failure: "key"
|
|
214
|
+
};
|
|
215
|
+
w(r.key.length), E.add(r.key);
|
|
216
|
+
}
|
|
217
|
+
let i = [];
|
|
218
|
+
for (let e of v) {
|
|
219
|
+
if (!e.expression) {
|
|
220
|
+
w(14), i.push(T());
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
223
|
+
let n;
|
|
224
|
+
try {
|
|
225
|
+
n = e.expression.evaluate(b(o, e.expression.dependencies, t), d);
|
|
226
|
+
} catch {
|
|
227
|
+
w(14), i.push(T());
|
|
228
|
+
continue;
|
|
229
|
+
}
|
|
230
|
+
let r = h(n);
|
|
231
|
+
if (r === null) {
|
|
232
|
+
w(14), i.push(T());
|
|
233
|
+
continue;
|
|
234
|
+
}
|
|
235
|
+
let a = typeof n == "number" && Number.isFinite(n) ? n : null, s = p(e.spec.format) ? e.spec.format : "plain", c = r;
|
|
236
|
+
if (s !== "plain") {
|
|
237
|
+
if (n === null || n === "") {
|
|
238
|
+
i.push({
|
|
239
|
+
ok: !0,
|
|
240
|
+
text: "",
|
|
241
|
+
value: n,
|
|
242
|
+
numeric: null
|
|
243
|
+
});
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
if (a === null) {
|
|
247
|
+
w(14), i.push({
|
|
248
|
+
ok: !1,
|
|
249
|
+
text: "",
|
|
250
|
+
value: n,
|
|
251
|
+
numeric: null
|
|
252
|
+
});
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
255
|
+
try {
|
|
256
|
+
c = m(s, a, e.spec);
|
|
257
|
+
} catch {
|
|
258
|
+
w(14), i.push({
|
|
259
|
+
ok: !1,
|
|
260
|
+
text: "",
|
|
261
|
+
value: n,
|
|
262
|
+
numeric: a
|
|
263
|
+
});
|
|
264
|
+
continue;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
w(c.length), i.push({
|
|
268
|
+
ok: !0,
|
|
269
|
+
text: c,
|
|
270
|
+
value: n,
|
|
271
|
+
numeric: a
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
let a = S(t);
|
|
275
|
+
D.push({
|
|
276
|
+
key: r.key,
|
|
277
|
+
keyValue: r.keyValue,
|
|
278
|
+
cells: i,
|
|
279
|
+
...a ? { align: a } : {}
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
} catch (e) {
|
|
283
|
+
return e instanceof c ? {
|
|
284
|
+
ok: !1,
|
|
285
|
+
failure: e.failure
|
|
286
|
+
} : {
|
|
287
|
+
ok: !1,
|
|
288
|
+
failure: "rows"
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
return {
|
|
292
|
+
ok: !0,
|
|
293
|
+
model: {
|
|
294
|
+
columns: r.map((e) => e.label),
|
|
295
|
+
rows: D,
|
|
296
|
+
empty: n.length === 0
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
function w(e, t) {
|
|
301
|
+
let n = Array.from(e), r = Array.from(t), i = Math.min(n.length, r.length);
|
|
302
|
+
for (let e = 0; e < i; e += 1) {
|
|
303
|
+
let t = (n[e].codePointAt(0) ?? 0) - (r[e].codePointAt(0) ?? 0);
|
|
304
|
+
if (t !== 0) return t;
|
|
305
|
+
}
|
|
306
|
+
return n.length - r.length;
|
|
307
|
+
}
|
|
308
|
+
function T(e) {
|
|
309
|
+
return e?.ok ? e.text : "";
|
|
310
|
+
}
|
|
311
|
+
function E(e) {
|
|
312
|
+
return e?.ok && e.numeric !== null ? e.numeric : -Infinity;
|
|
313
|
+
}
|
|
314
|
+
function D(e) {
|
|
315
|
+
return e.columns.map((t, n) => {
|
|
316
|
+
let r = !1;
|
|
317
|
+
for (let t of e.rows) {
|
|
318
|
+
let e = t.cells[n];
|
|
319
|
+
if (e && e.ok && e.text !== "") {
|
|
320
|
+
if (e.numeric === null) return !1;
|
|
321
|
+
r = !0;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
return r;
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
function O(e, t) {
|
|
328
|
+
return !e || e.column !== t ? {
|
|
329
|
+
column: t,
|
|
330
|
+
direction: "asc"
|
|
331
|
+
} : e.direction === "asc" ? {
|
|
332
|
+
column: t,
|
|
333
|
+
direction: "desc"
|
|
334
|
+
} : null;
|
|
335
|
+
}
|
|
336
|
+
function k(e, t = {}) {
|
|
337
|
+
let n = D(e), r = (t.search ?? "").trim().toLowerCase(), i = r !== "", a = i ? e.rows.filter((e) => e.cells.some((e) => e.ok && e.text.toLowerCase().includes(r))) : e.rows, o = t.sort, s = o && Number.isInteger(o.column) && o.column >= 0 && o.column < e.columns.length ? o : null, c = a;
|
|
338
|
+
if (s) {
|
|
339
|
+
let e = s.column, t = n[e] === !0, r = s.direction === "desc" ? -1 : 1;
|
|
340
|
+
c = a.map((e, t) => ({
|
|
341
|
+
row: e,
|
|
342
|
+
position: t
|
|
343
|
+
})).sort((n, i) => {
|
|
344
|
+
let a = E(n.row.cells[e]), o = E(i.row.cells[e]), s = t ? a === o ? 0 : a < o ? -1 : 1 : w(T(n.row.cells[e]), T(i.row.cells[e]));
|
|
345
|
+
return s === 0 ? n.position - i.position : s * r;
|
|
346
|
+
}).map((e) => e.row);
|
|
347
|
+
}
|
|
348
|
+
let l = t.pageSize, u = typeof l == "number" && Number.isInteger(l) && l > 0 ? l : null, d = c.length, f = u === null ? 1 : Math.max(1, Math.ceil(d / u)), p = typeof t.page == "number" && Number.isFinite(t.page) ? Math.floor(t.page) : 1, m = Math.min(f, Math.max(1, p));
|
|
349
|
+
return {
|
|
350
|
+
rows: u === null ? c : c.slice((m - 1) * u, m * u),
|
|
351
|
+
filteredRows: a,
|
|
352
|
+
numericColumns: n,
|
|
353
|
+
total: d,
|
|
354
|
+
page: m,
|
|
355
|
+
pageCount: f,
|
|
356
|
+
pageSize: u,
|
|
357
|
+
sort: s,
|
|
358
|
+
searching: i
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
function A(e, t) {
|
|
362
|
+
return t.map((t, n) => {
|
|
363
|
+
if (!t.summary) return null;
|
|
364
|
+
let r = 0, i = 0;
|
|
365
|
+
for (let a of e) {
|
|
366
|
+
let e = a.cells[n];
|
|
367
|
+
e?.ok && e.text !== "" && (t.summary === "count" ? r += 1 : e.numeric !== null && (r += e.numeric, i += 1));
|
|
368
|
+
}
|
|
369
|
+
if (t.summary === "average") {
|
|
370
|
+
if (i === 0) return null;
|
|
371
|
+
let e = r / i;
|
|
372
|
+
return Number.isFinite(e) ? d(e, t) ?? String(e) : "";
|
|
373
|
+
}
|
|
374
|
+
return Number.isFinite(r) ? t.summary === "count" ? String(r) : d(r, t) ?? String(r) : "";
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
function j(e, t, n) {
|
|
378
|
+
return e.empty ? t !== void 0 && t !== "" ? t : n("No rows", "没有数据") : n("No matching results", "没有匹配结果");
|
|
379
|
+
}
|
|
380
|
+
function M(t, n) {
|
|
381
|
+
switch (n) {
|
|
382
|
+
case "label": return t("Data table requires a label.", "数据表需要标签。");
|
|
383
|
+
case "columns": return t("Data table requires between 1 and 20 column definitions.", "数据表需要 1 到 20 个列定义。");
|
|
384
|
+
case "max-rows": return t(`max-rows must be a positive integer no greater than ${e}.`, `max-rows 必须是 1 到 ${e} 之间的整数。`);
|
|
385
|
+
case "rows": return t("Rows must evaluate to a list.", "行数据必须计算为列表。");
|
|
386
|
+
case "rows-budget": return t("Too many rows for this table.", "此数据表的行数超过上限。");
|
|
387
|
+
case "key": return t("Every row needs a unique, non-empty key.", "每一行都需要唯一且非空的键。");
|
|
388
|
+
case "text-budget": return t("The table content exceeds the text budget.", "数据表内容超过文本上限。");
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
export { O as a, _ as c, d, p as f, k as i, A as l, v as m, c as n, j as o, y as p, C as r, M as s, u as t, S as u };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as e } from "./table-surface-CfZn_tk-.js";
|
|
2
|
-
import {
|
|
2
|
+
import { C as t, M as n, P as r, R as i, k as a, p as o, y as s } from "./component-utils-ZM3jUJNy.js";
|
|
3
3
|
import { t as c } from "./visual-frame-y5RFhJ0_.js";
|
|
4
|
-
import { a as l, c as u, i as d, l as f, n as p, o as m, r as h, s as g, t as _, u as v } from "./visual-helpers-
|
|
4
|
+
import { a as l, c as u, i as d, l as f, n as p, o as m, r as h, s as g, t as _, u as v } from "./visual-helpers-UU6xiL8g.js";
|
|
5
5
|
import { useState as y } from "react";
|
|
6
6
|
import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
7
7
|
// src/components/shared/data-visuals.tsx
|
|
@@ -13,14 +13,14 @@ function C(e, t) {
|
|
|
13
13
|
}
|
|
14
14
|
return n.length - r.length;
|
|
15
15
|
}
|
|
16
|
-
function w(
|
|
17
|
-
let { content: u, mode: p, t: g } = o
|
|
18
|
-
|
|
16
|
+
function w(o) {
|
|
17
|
+
let { content: u, mode: p, t: g } = n(o), [_, b] = y(""), [w, T] = y(null), [E, D] = y(1), [O, k] = y(null), { write: A, error: j } = i(o);
|
|
18
|
+
r(o, () => {
|
|
19
19
|
b(""), T(null), D(1), k(null);
|
|
20
20
|
});
|
|
21
|
-
let M =
|
|
21
|
+
let M = a(o, "label", g("Table", "表格")), N = o.content.attrs.searchable === void 0 || o.props.searchable === !0, P = o.content.attrs.sortable === void 0 || o.props.sortable === !0, F = Math.max(1, Math.floor(s(o, "page-size", 10))), I = o.children.table();
|
|
22
22
|
if (!I || I.header.length === 0) return /* @__PURE__ */ x(d, {
|
|
23
|
-
context:
|
|
23
|
+
context: o,
|
|
24
24
|
children: /* @__PURE__ */ x(c, {
|
|
25
25
|
className: "local-visual-table-block",
|
|
26
26
|
label: M,
|
|
@@ -31,10 +31,10 @@ function w(a) {
|
|
|
31
31
|
})
|
|
32
32
|
})
|
|
33
33
|
});
|
|
34
|
-
let L = I.header.map((e) => l(e, g).trim()), R = v(
|
|
34
|
+
let L = I.header.map((e) => l(e, g).trim()), R = v(t(u, "key"), L), z = R >= 0, B = (() => {
|
|
35
35
|
if (!z) return "";
|
|
36
36
|
try {
|
|
37
|
-
let e =
|
|
37
|
+
let e = o.runtime.get(u);
|
|
38
38
|
return typeof e == "string" ? e : "";
|
|
39
39
|
} catch {
|
|
40
40
|
return "";
|
|
@@ -161,7 +161,7 @@ function w(a) {
|
|
|
161
161
|
}) })
|
|
162
162
|
] });
|
|
163
163
|
return /* @__PURE__ */ x(d, {
|
|
164
|
-
context:
|
|
164
|
+
context: o,
|
|
165
165
|
children: p === "static" ? /* @__PURE__ */ S(c, {
|
|
166
166
|
className: "local-visual-table-block local-static-table-block",
|
|
167
167
|
label: M,
|
|
@@ -231,9 +231,9 @@ function D(e) {
|
|
|
231
231
|
return t(T) ? T : t(E) ? E : null;
|
|
232
232
|
}
|
|
233
233
|
function O(e) {
|
|
234
|
-
let { mode: t, t: i } =
|
|
235
|
-
|
|
236
|
-
let v =
|
|
234
|
+
let { mode: t, t: i } = n(e), s = t !== "static", [f, m] = y(null);
|
|
235
|
+
r(e, () => m(null));
|
|
236
|
+
let v = a(e, "title", "") || i("Timeline", "时间轴"), C = e.content.attrs.unit === void 0 ? i("minutes", "分钟") : a(e, "unit", ""), w = e.children.table();
|
|
237
237
|
if (!w) return /* @__PURE__ */ x(d, {
|
|
238
238
|
context: e,
|
|
239
239
|
children: /* @__PURE__ */ x(c, {
|
|
@@ -283,7 +283,7 @@ function O(e) {
|
|
|
283
283
|
});
|
|
284
284
|
let F = [...P].sort((e, t) => e.start - t.start || e.sourceIndex - t.sourceIndex), I = F.reduce((e, t) => Math.max(e, t.start + t.duration), 0), L = Math.max(1, I), R = u(0, L, 5);
|
|
285
285
|
(R.length === 0 || R[0] !== 0) && R.unshift(0), R[R.length - 1] < L && R.push(L);
|
|
286
|
-
let z = C ? ` ${C}` : "", B = (e) => `${
|
|
286
|
+
let z = C ? ` ${C}` : "", B = (e) => `${o(e)}${z}`, V = F.find((e) => e.key === f) ?? null;
|
|
287
287
|
return /* @__PURE__ */ x(d, {
|
|
288
288
|
context: e,
|
|
289
289
|
children: /* @__PURE__ */ S(c, {
|