derive-dashboards 0.7.1 → 0.9.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 +513 -0
- package/README.md +8 -2
- package/dist/adapter/statement.mjs +9 -7
- package/dist/authorize.mjs +27 -6
- package/dist/body.mjs +28 -25
- package/dist/cache.d.mts +2 -2
- package/dist/charts/data/buckets.d.mts +25 -7
- package/dist/charts/data/buckets.mjs +92 -15
- package/dist/charts/data/clean.mjs +254 -12
- package/dist/charts/data/format.d.mts +7 -2
- package/dist/charts/data/format.mjs +68 -70
- package/dist/charts/data/input-error.d.mts +2 -0
- package/dist/charts/data/input-error.mjs +2 -0
- package/dist/charts/data/rows.d.mts +3 -1
- package/dist/charts/data/rows.mjs +4 -2
- package/dist/charts/data/types.d.mts +50 -7
- package/dist/charts/data/words.d.mts +13 -0
- package/dist/charts/data/words.mjs +8 -1
- package/dist/charts/describe.mjs +6 -6
- package/dist/charts/index.d.mts +14 -14
- package/dist/charts/index.mjs +4 -1
- package/dist/charts/kinds/area-marks.mjs +86 -44
- package/dist/charts/kinds/area.d.mts +3 -3
- package/dist/charts/kinds/area.mjs +32 -11
- package/dist/charts/kinds/bars-data.d.mts +3 -3
- package/dist/charts/kinds/bars-data.mjs +12 -6
- package/dist/charts/kinds/bars-layout.mjs +60 -6
- package/dist/charts/kinds/bars-marks.mjs +6 -6
- package/dist/charts/kinds/bars.d.mts +5 -3
- package/dist/charts/kinds/bars.mjs +39 -6
- package/dist/charts/kinds/columns-data.mjs +14 -5
- package/dist/charts/kinds/columns-marks.mjs +52 -23
- package/dist/charts/kinds/columns.d.mts +2 -2
- package/dist/charts/kinds/columns.mjs +36 -10
- package/dist/charts/kinds/course-data.mjs +44 -0
- package/dist/charts/kinds/course-layout.mjs +77 -0
- package/dist/charts/kinds/course-marks.mjs +52 -0
- package/dist/charts/kinds/course-words.mjs +64 -0
- package/dist/charts/kinds/course.d.mts +10 -0
- package/dist/charts/kinds/course.mjs +55 -0
- package/dist/charts/kinds/dumbbell-data.d.mts +4 -4
- package/dist/charts/kinds/dumbbell-data.mjs +3 -3
- package/dist/charts/kinds/dumbbell-layout.mjs +17 -8
- package/dist/charts/kinds/dumbbell.d.mts +5 -3
- package/dist/charts/kinds/dumbbell.mjs +35 -4
- package/dist/charts/kinds/funnel-data.d.mts +3 -3
- package/dist/charts/kinds/funnel-data.mjs +11 -16
- package/dist/charts/kinds/funnel-layout.mjs +7 -6
- package/dist/charts/kinds/funnel.d.mts +5 -4
- package/dist/charts/kinds/funnel.mjs +33 -6
- package/dist/charts/kinds/grid-data.d.mts +3 -3
- package/dist/charts/kinds/grid-data.mjs +55 -13
- package/dist/charts/kinds/grid-layout.mjs +88 -13
- package/dist/charts/kinds/grid-legend.mjs +60 -0
- package/dist/charts/kinds/grid-marks.mjs +81 -32
- package/dist/charts/kinds/grid-time.mjs +19 -5
- package/dist/charts/kinds/grid-words.mjs +57 -35
- package/dist/charts/kinds/grid.d.mts +7 -4
- package/dist/charts/kinds/grid.mjs +51 -9
- package/dist/charts/kinds/histogram-data.mjs +68 -26
- package/dist/charts/kinds/histogram-layout.mjs +4 -3
- package/dist/charts/kinds/histogram-words.mjs +2 -3
- package/dist/charts/kinds/histogram.d.mts +2 -2
- package/dist/charts/kinds/histogram.mjs +17 -1
- package/dist/charts/kinds/line-marks.mjs +19 -11
- package/dist/charts/kinds/line.d.mts +2 -2
- package/dist/charts/kinds/line.mjs +21 -3
- package/dist/charts/kinds/multiples-grid.mjs +57 -27
- package/dist/charts/kinds/multiples-head.mjs +52 -22
- package/dist/charts/kinds/multiples-layout.mjs +106 -52
- package/dist/charts/kinds/multiples-marks.mjs +6 -5
- package/dist/charts/kinds/multiples-words.mjs +53 -38
- package/dist/charts/kinds/multiples.d.mts +2 -2
- package/dist/charts/kinds/multiples.mjs +35 -7
- package/dist/charts/kinds/row-chart.d.mts +7 -0
- package/dist/charts/kinds/row-chart.mjs +47 -10
- package/dist/charts/kinds/row-marks.mjs +5 -5
- package/dist/charts/kinds/scatter-data.d.mts +5 -5
- package/dist/charts/kinds/scatter-data.mjs +6 -6
- package/dist/charts/kinds/scatter-marks.mjs +46 -19
- package/dist/charts/kinds/scatter-words.mjs +8 -8
- package/dist/charts/kinds/scatter.d.mts +5 -3
- package/dist/charts/kinds/scatter.mjs +18 -0
- package/dist/charts/kinds/stat-data.mjs +7 -7
- package/dist/charts/kinds/stat-marks.mjs +2 -2
- package/dist/charts/kinds/stat.d.mts +4 -4
- package/dist/charts/kinds/stat.mjs +19 -0
- package/dist/charts/kinds/time-chart.mjs +13 -4
- package/dist/charts/kinds/time-frame.mjs +50 -19
- package/dist/charts/kinds/time-plan.mjs +29 -2
- package/dist/charts/kinds/time-plot.mjs +1 -1
- package/dist/charts/kinds/time-stops.mjs +58 -29
- package/dist/charts/kinds/waterfall-data.d.mts +3 -3
- package/dist/charts/kinds/waterfall-data.mjs +2 -2
- package/dist/charts/kinds/waterfall.d.mts +5 -4
- package/dist/charts/kinds/waterfall.mjs +29 -2
- package/dist/charts/layout/frame.mjs +5 -3
- package/dist/charts/layout/stack.mjs +43 -22
- package/dist/charts/marks/axes.mjs +12 -6
- package/dist/charts/marks/budget.mjs +14 -0
- package/dist/charts/marks/end-labels.mjs +24 -10
- package/dist/charts/marks/legend.mjs +19 -8
- package/dist/charts/marks/lines.mjs +3 -3
- package/dist/charts/marks/more.mjs +79 -13
- package/dist/charts/marks/notes.mjs +12 -6
- package/dist/charts/marks/series-line.mjs +14 -10
- package/dist/charts/marks/thin.mjs +16 -33
- package/dist/charts/marks/x-axis.mjs +3 -2
- package/dist/charts/scale/calendar.mjs +41 -26
- package/dist/charts/scale/linear.mjs +58 -0
- package/dist/charts/scale/value.d.mts +21 -0
- package/dist/charts/scale/value.mjs +67 -9
- package/dist/charts/scene/lazy.mjs +27 -0
- package/dist/charts/scene/markup.mjs +2 -1
- package/dist/charts/scene/svg.mjs +20 -8
- package/dist/charts/scene/types.d.mts +34 -0
- package/dist/charts/text/measure.mjs +33 -3
- package/dist/charts/theme.d.mts +25 -25
- package/dist/charts/theme.mjs +47 -30
- package/dist/charts-react/Chart.d.mts +20 -0
- package/dist/charts-react/Chart.mjs +9 -67
- package/dist/charts-react/Reader.mjs +50 -96
- package/dist/charts-react/box.mjs +106 -0
- package/dist/charts-react/bucket-names.mjs +9 -24
- package/dist/charts-react/columns-picture.mjs +12 -0
- package/dist/charts-react/exact-sum.mjs +4 -7
- package/dist/charts-react/from-answer.mjs +9 -4
- package/dist/charts-react/index.d.mts +9 -2
- package/dist/charts-react/index.mjs +9 -2
- package/dist/charts-react/kinds/area.d.mts +4 -0
- package/dist/charts-react/kinds/area.mjs +38 -0
- package/dist/charts-react/kinds/bar.d.mts +4 -0
- package/dist/charts-react/kinds/bar.mjs +15 -0
- package/dist/charts-react/kinds/funnel.d.mts +4 -0
- package/dist/charts-react/kinds/funnel.mjs +13 -0
- package/dist/charts-react/kinds/heatmap.d.mts +4 -0
- package/dist/charts-react/kinds/heatmap.mjs +13 -0
- package/dist/charts-react/kinds/line.d.mts +4 -0
- package/dist/charts-react/kinds/line.mjs +20 -0
- package/dist/charts-react/kinds/multiples.d.mts +4 -0
- package/dist/charts-react/kinds/multiples.mjs +33 -0
- package/dist/charts-react/kinds/number.d.mts +5 -0
- package/dist/charts-react/kinds/number.mjs +86 -0
- package/dist/charts-react/plan-bars.mjs +15 -8
- package/dist/charts-react/plan-funnel.mjs +3 -1
- package/dist/charts-react/plan-grid.mjs +14 -5
- package/dist/charts-react/plan-of.mjs +17 -0
- package/dist/charts-react/plan-parts.mjs +16 -5
- package/dist/charts-react/plan-time.mjs +4 -53
- package/dist/charts-react/reader-page.d.mts +1 -1
- package/dist/charts-react/reader-page.mjs +19 -9
- package/dist/charts-react/renderers.d.mts +14 -0
- package/dist/charts-react/renderers.mjs +22 -0
- package/dist/charts-react/table.d.mts +1 -0
- package/dist/charts-react/table.mjs +108 -0
- package/dist/charts-react/tiles.mjs +21 -49
- package/dist/charts-react/useScene.mjs +45 -17
- package/dist/charts-react/words.mjs +19 -0
- package/dist/checks.mjs +97 -19
- package/dist/cli/add.mjs +4 -3
- package/dist/cli/doctor.mjs +2 -2
- package/dist/core/conformance/index.d.mts +5 -2
- package/dist/core/conformance/index.mjs +5 -2
- package/dist/core/conformance/memory/aggregate.mjs +11 -6
- package/dist/core/conformance/memory/rows.d.mts +7 -3
- package/dist/core/conformance/memory/rows.mjs +19 -13
- package/dist/core/conformance/memory/source.mjs +4 -4
- package/dist/core/document/control-fields.d.mts +20 -0
- package/dist/core/document/control-fields.mjs +117 -0
- package/dist/core/document/display-comparisons.d.mts +17 -0
- package/dist/core/document/display-comparisons.mjs +15 -4
- package/dist/core/document/display-entries.d.mts +14 -0
- package/dist/core/document/display-entries.mjs +25 -9
- package/dist/core/document/display-validation.d.mts +5 -1
- package/dist/core/document/display-validation.mjs +14 -7
- package/dist/core/document/display.d.mts +11 -8
- package/dist/core/document/display.mjs +26 -3
- package/dist/core/document/layout.d.mts +8 -9
- package/dist/core/document/layout.mjs +23 -6
- package/dist/core/document/stacked.d.mts +0 -7
- package/dist/core/document/types.mjs +8 -6
- package/dist/core/document/upgrade.d.mts +1 -0
- package/dist/core/document/upgrade.mjs +4 -2
- package/dist/core/engine/access.mjs +3 -3
- package/dist/core/engine/assert.mjs +4 -2
- package/dist/core/engine/bucket.mjs +2 -2
- package/dist/core/engine/checks.mjs +6 -7
- package/dist/core/engine/custom/ask.mjs +22 -2
- package/dist/core/engine/custom/cells.mjs +22 -22
- package/dist/core/engine/custom/level.mjs +12 -13
- package/dist/core/engine/custom/measures.mjs +12 -9
- package/dist/core/engine/custom/reader.mjs +3 -1
- package/dist/core/engine/custom/records.mjs +8 -7
- package/dist/core/engine/custom/unread.mjs +78 -0
- package/dist/core/engine/custom/where.mjs +15 -10
- package/dist/core/engine/index.d.mts +2 -13
- package/dist/core/engine/index.mjs +2 -12
- package/dist/core/engine/measure.mjs +1 -0
- package/dist/core/engine/members.mjs +7 -3
- package/dist/core/engine/nan.mjs +10 -1
- package/dist/core/engine/native.mjs +2 -20
- package/dist/core/engine/numbers.mjs +26 -14
- package/dist/core/engine/postgres.mjs +9 -5
- package/dist/core/engine/prepare.mjs +4 -4
- package/dist/core/engine/rank-sets.mjs +1 -1
- package/dist/core/engine/read.mjs +5 -4
- package/dist/core/engine/reader.d.mts +6 -0
- package/dist/core/engine/record-layout.mjs +3 -3
- package/dist/core/engine/run.mjs +77 -20
- package/dist/core/engine/segmented.d.mts +2 -1
- package/dist/core/engine/segmented.mjs +19 -12
- package/dist/core/engine/series.mjs +1 -1
- package/dist/core/engine/shape.mjs +8 -8
- package/dist/core/engine/sql-partition.mjs +2 -2
- package/dist/core/engine/sql-pass.mjs +3 -2
- package/dist/core/engine/sql-reader.mjs +13 -5
- package/dist/core/engine/sql-reads.mjs +2 -1
- package/dist/core/engine/sql-records.mjs +2 -2
- package/dist/core/engine/sql-split.mjs +1 -1
- package/dist/core/engine/sql-unread.mjs +70 -0
- package/dist/core/engine/time.mjs +2 -1
- package/dist/core/engine/types.d.mts +17 -0
- package/dist/core/engine/version.d.mts +1 -1
- package/dist/core/engine/version.mjs +1 -1
- package/dist/core/error/codes.d.mts +24 -1
- package/dist/core/error/codes.mjs +23 -3
- package/dist/core/error/refusal.d.mts +8 -3
- package/dist/core/error/refusal.mjs +6 -1
- package/dist/core/exact/decimal.d.mts +1 -14
- package/dist/core/exact/decimal.mjs +9 -19
- package/dist/core/exact/stored.d.mts +9 -0
- package/dist/core/exact/stored.mjs +38 -0
- package/dist/core/exact/text.d.mts +16 -1
- package/dist/core/exact/text.mjs +50 -1
- package/dist/core/format/digits.mjs +55 -0
- package/dist/core/format/index.d.mts +16 -0
- package/dist/core/format/index.mjs +27 -0
- package/dist/core/format/number.d.mts +27 -0
- package/dist/core/format/number.mjs +158 -0
- package/dist/core/format/write.d.mts +6 -0
- package/dist/core/format/write.mjs +57 -0
- package/dist/core/index.d.mts +43 -33
- package/dist/core/index.mjs +31 -28
- package/dist/core/model/defaults.d.mts +18 -1
- package/dist/core/model/defaults.mjs +19 -1
- package/dist/core/model/define.d.mts +17 -8
- package/dist/core/model/define.mjs +2 -0
- package/dist/core/model/member.d.mts +5 -3
- package/dist/core/model/member.mjs +33 -6
- package/dist/core/model/storage.mjs +40 -12
- package/dist/core/model/types.d.mts +17 -1
- package/dist/core/model/types.mjs +5 -0
- package/dist/core/model/validate/expr.d.mts +1 -7
- package/dist/core/model/validate/fields.d.mts +2 -0
- package/dist/core/model/validate/fields.mjs +14 -7
- package/dist/core/model/validate/issues.mjs +5 -1
- package/dist/core/model/validate/known-members.mjs +6 -5
- package/dist/core/model/validate/shape.mjs +36 -3
- package/dist/core/model/validate/source.mjs +2 -2
- package/dist/core/oracle/data.d.mts +4 -2
- package/dist/core/oracle/evaluate.d.mts +19 -1
- package/dist/core/oracle/evaluate.mjs +56 -10
- package/dist/core/oracle/expr.mjs +1 -1
- package/dist/core/oracle/facts.mjs +12 -5
- package/dist/core/oracle/measure.mjs +1 -1
- package/dist/core/oracle/request.mjs +39 -4
- package/dist/core/oracle/segmented.d.mts +3 -1
- package/dist/core/oracle/segmented.mjs +19 -13
- package/dist/core/oracle/unread.mjs +32 -0
- package/dist/core/oracle/visibility.mjs +4 -3
- package/dist/core/policy/bind.d.mts +2 -11
- package/dist/core/policy/bind.mjs +1 -1
- package/dist/core/policy/match.mjs +1 -1
- package/dist/core/query/closure.d.mts +7 -2
- package/dist/core/query/closure.mjs +29 -12
- package/dist/core/query/compose-tile.d.mts +3 -2
- package/dist/core/query/compose-tile.mjs +32 -13
- package/dist/core/query/compose.d.mts +0 -5
- package/dist/core/query/drill/internal.d.mts +5 -5
- package/dist/core/query/drill/internal.mjs +11 -0
- package/dist/core/query/drill/links.d.mts +2 -3
- package/dist/core/query/drill/links.mjs +18 -4
- package/dist/core/query/drill/selection.d.mts +8 -2
- package/dist/core/query/drill/selection.mjs +14 -3
- package/dist/core/query/drill/synthetic.mjs +1 -1
- package/dist/core/query/drill/time.mjs +11 -10
- package/dist/core/query/filter.d.mts +1 -6
- package/dist/core/query/filter.mjs +1 -4
- package/dist/core/query/fold.mjs +23 -0
- package/dist/core/query/segments.mjs +42 -3
- package/dist/core/query/to-wire.d.mts +7 -0
- package/dist/core/query/to-wire.mjs +14 -2
- package/dist/core/query/types.d.mts +30 -13
- package/dist/core/result/columns.mjs +23 -13
- package/dist/core/result/number.mjs +3 -3
- package/dist/core/result/status.d.mts +13 -0
- package/dist/core/result/status.mjs +18 -0
- package/dist/core/result/time-axis.d.mts +14 -13
- package/dist/core/result/time-axis.mjs +20 -2
- package/dist/core/result/types.d.mts +33 -3
- package/dist/core/result/whole.d.mts +23 -0
- package/dist/core/result/whole.mjs +27 -0
- package/dist/core/schema/agent-query.d.mts +89 -0
- package/dist/core/schema/agent-query.mjs +115 -0
- package/dist/core/schema/aliases.mjs +1 -52
- package/dist/core/schema/answer-parts.mjs +17 -13
- package/dist/core/schema/answers.d.mts +787 -319
- package/dist/core/schema/commands.d.mts +33 -23
- package/dist/core/schema/commands.mjs +26 -18
- package/dist/core/schema/custom.mjs +46 -45
- package/dist/core/schema/document.d.mts +32 -27
- package/dist/core/schema/document.mjs +61 -81
- package/dist/core/schema/drill-answers.mjs +4 -1
- package/dist/core/schema/drill.d.mts +14 -9
- package/dist/core/schema/drill.mjs +23 -22
- package/dist/core/schema/index.d.mts +5 -3
- package/dist/core/schema/index.mjs +5 -3
- package/dist/core/schema/options.d.mts +92 -0
- package/dist/core/schema/options.mjs +104 -0
- package/dist/core/schema/picks.d.mts +2 -2
- package/dist/core/schema/picks.mjs +7 -6
- package/dist/core/schema/query.d.mts +9 -83
- package/dist/core/schema/query.mjs +49 -73
- package/dist/core/schema/strict.d.mts +3 -0
- package/dist/core/schema/strict.mjs +91 -0
- package/dist/core/schema/union-error.mjs +30 -7
- package/dist/core/schema/view.d.mts +4 -3
- package/dist/core/schema/view.mjs +16 -11
- package/dist/core/store/ddl.d.mts +0 -2
- package/dist/core/store/ddl.mjs +1 -5
- package/dist/core/time/bucket.d.mts +1 -18
- package/dist/core/time/bucket.mjs +12 -8
- package/dist/core/time/compare.mjs +3 -2
- package/dist/core/time/index.d.mts +7 -8
- package/dist/core/time/instant.d.mts +15 -9
- package/dist/core/time/instant.mjs +23 -9
- package/dist/core/time/range.d.mts +3 -15
- package/dist/core/time/range.mjs +17 -7
- package/dist/core/time/stored.d.mts +8 -5
- package/dist/core/time/stored.mjs +51 -15
- package/dist/core/time/temporal.d.mts +1 -5
- package/dist/core/time/temporal.mjs +9 -4
- package/dist/core/time/text-time.d.mts +31 -2
- package/dist/core/time/text-time.mjs +139 -22
- package/dist/core/time/zone.d.mts +6 -1
- package/dist/core/time/zone.mjs +13 -4
- package/dist/core/types/api.d.mts +1 -1
- package/dist/core/types/api.mjs +1 -1
- package/dist/core/types/dashboard.d.mts +185 -0
- package/dist/core/types/dashboard.mjs +26 -0
- package/dist/core/types/drill-api.d.mts +14 -2
- package/dist/core/types/infer.d.mts +0 -4
- package/dist/core/types/options-check.d.mts +42 -0
- package/dist/core/types/options-check.mjs +90 -0
- package/dist/core/types/options.d.mts +14 -8
- package/dist/core/value/casefold.d.mts +1 -3
- package/dist/core/value/stored.d.mts +26 -0
- package/dist/core/value/stored.mjs +28 -0
- package/dist/cursor-seal.mjs +37 -9
- package/dist/dashboard-documents.d.mts +14 -6
- package/dist/dashboard-documents.mjs +32 -12
- package/dist/dashboards.mjs +10 -9
- package/dist/drill-access.mjs +6 -6
- package/dist/drill-change.mjs +18 -20
- package/dist/drill-comparison.mjs +2 -1
- package/dist/drill-crumbs.mjs +63 -28
- package/dist/drill-distinct.mjs +2 -1
- package/dist/drill-explain.mjs +1 -1
- package/dist/drill-items.mjs +1 -1
- package/dist/drill-open.mjs +39 -23
- package/dist/drill-seal.mjs +41 -13
- package/dist/drill-share.mjs +1 -1
- package/dist/drill-summary.mjs +2 -1
- package/dist/drill-targets.mjs +4 -4
- package/dist/drill-views.mjs +4 -3
- package/dist/drill.mjs +1 -1
- package/dist/editing.mjs +5 -3
- package/dist/endpoints/index.d.mts +29 -8
- package/dist/endpoints/index.mjs +4 -1
- package/dist/endpoints/meta.mjs +4 -3
- package/dist/endpoints/query.mjs +5 -2
- package/dist/endpoints/read.mjs +7 -6
- package/dist/endpoints/versions.mjs +2 -1
- package/dist/execute.d.mts +3 -0
- package/dist/execute.mjs +23 -12
- package/dist/grant.d.mts +9 -0
- package/dist/grant.mjs +43 -0
- package/dist/handler.mjs +8 -13
- package/dist/http.d.mts +6 -2
- package/dist/http.mjs +6 -2
- package/dist/index.d.mts +25 -4
- package/dist/index.mjs +91 -40
- package/dist/llms.txt +3 -3
- package/dist/mcp/api.mjs +2 -1
- package/dist/mcp/query.mjs +3 -8
- package/dist/mcp/resolve.mjs +9 -2
- package/dist/node/index.d.mts +36 -0
- package/dist/node/index.mjs +89 -0
- package/dist/node/request.d.mts +12 -0
- package/dist/node/request.mjs +119 -0
- package/dist/node/response.mjs +58 -0
- package/dist/principal.mjs +15 -7
- package/dist/react/Canvas.mjs +90 -69
- package/dist/react/Cell.mjs +2 -1
- package/dist/react/Dashboard.d.mts +15 -1
- package/dist/react/Dashboard.mjs +43 -42
- package/dist/react/DashboardList.mjs +9 -4
- package/dist/react/Editing.d.mts +9 -0
- package/dist/react/Editing.mjs +8 -3
- package/dist/react/Grid.mjs +1 -1
- package/dist/react/Header.mjs +25 -52
- package/dist/react/History.mjs +3 -2
- package/dist/react/LoadFailed.mjs +59 -0
- package/dist/react/Panel.d.mts +1 -1
- package/dist/react/Panel.mjs +1 -1
- package/dist/react/Parts.d.mts +34 -0
- package/dist/react/Parts.mjs +9 -6
- package/dist/react/ReviewPanel.mjs +1 -1
- package/dist/react/RowBody.d.mts +2 -0
- package/dist/react/RowBody.mjs +5 -1
- package/dist/react/Share.mjs +153 -0
- package/dist/react/TabStrip.mjs +37 -0
- package/dist/react/Tile.d.mts +3 -1
- package/dist/react/Tile.mjs +89 -92
- package/dist/react/TileState.mjs +117 -0
- package/dist/react/ago.mjs +45 -0
- package/dist/react/arrange.mjs +1 -1
- package/dist/react/board.mjs +2 -2
- package/dist/react/bucket-name.d.mts +8 -0
- package/dist/react/bucket-name.mjs +13 -0
- package/dist/react/builder/DisplayOptions.mjs +219 -0
- package/dist/react/builder/Preview.mjs +13 -13
- package/dist/react/builder/RangeEditor.mjs +4 -3
- package/dist/react/builder/WidgetBuilder.d.mts +1 -7
- package/dist/react/builder/WidgetBuilder.mjs +12 -3
- package/dist/react/builder/base.d.mts +13 -2
- package/dist/react/builder/base.mjs +70 -12
- package/dist/react/builder/display.d.mts +3 -0
- package/dist/react/builder/display.mjs +256 -0
- package/dist/react/builder/labels.mjs +19 -5
- package/dist/react/builder/options.mjs +11 -6
- package/dist/react/builder/state.mjs +25 -3
- package/dist/react/builder/useBuilder.d.mts +7 -1
- package/dist/react/builder/useBuilder.mjs +6 -9
- package/dist/react/builder/usePreview.mjs +3 -2
- package/dist/react/builder/words.d.mts +16 -1
- package/dist/react/builder/words.mjs +41 -1
- package/dist/react/change-text.mjs +149 -0
- package/dist/react/client.d.mts +9 -0
- package/dist/react/client.mjs +105 -14
- package/dist/react/columns.mjs +9 -1
- package/dist/react/context.d.mts +24 -3
- package/dist/react/context.mjs +23 -7
- package/dist/react/dates-shown.mjs +76 -0
- package/dist/react/draft.mjs +3 -2
- package/dist/react/drill/Bars.mjs +12 -16
- package/dist/react/drill/Comparison.mjs +1 -1
- package/dist/react/drill/DrillPanel.d.mts +1 -1
- package/dist/react/drill/DrillPanel.mjs +2 -1
- package/dist/react/drill/Header.mjs +65 -12
- package/dist/react/drill/Items.d.mts +1 -1
- package/dist/react/drill/Notes.mjs +10 -7
- package/dist/react/drill/PanelStates.mjs +8 -1
- package/dist/react/drill/Trend.mjs +10 -5
- package/dist/react/drill/board.d.mts +1 -1
- package/dist/react/drill/board.mjs +1 -0
- package/dist/react/drill/host.mjs +4 -1
- package/dist/react/drill/lazy.mjs +2 -27
- package/dist/react/drill/props.d.mts +19 -8
- package/dist/react/drill/props.mjs +62 -18
- package/dist/react/drill/state.d.mts +15 -5
- package/dist/react/drill/state.mjs +12 -3
- package/dist/react/drill/words.d.mts +46 -3
- package/dist/react/drill/words.mjs +30 -5
- package/dist/react/english.mjs +33 -8
- package/dist/react/export/ExportButton.mjs +4 -1
- package/dist/react/export/csv.d.mts +7 -2
- package/dist/react/export/csv.mjs +24 -7
- package/dist/react/failure-words.mjs +60 -0
- package/dist/react/filters/bar.d.mts +1 -1
- package/dist/react/filters/bar.mjs +4 -1
- package/dist/react/filters/calendar.mjs +23 -8
- package/dist/react/filters/chip.mjs +7 -3
- package/dist/react/filters/context.d.mts +13 -1
- package/dist/react/filters/context.mjs +1 -1
- package/dist/react/filters/dates-said.mjs +57 -0
- package/dist/react/filters/days.d.mts +3 -4
- package/dist/react/filters/days.mjs +10 -17
- package/dist/react/filters/hooks.d.mts +11 -0
- package/dist/react/filters/hooks.mjs +10 -6
- package/dist/react/filters/menu-search.mjs +17 -9
- package/dist/react/filters/menu.mjs +10 -8
- package/dist/react/filters/phone.mjs +41 -16
- package/dist/react/filters/place.mjs +40 -0
- package/dist/react/filters/popover.mjs +18 -13
- package/dist/react/filters/rules.d.mts +4 -3
- package/dist/react/filters/rules.mjs +3 -3
- package/dist/react/filters/sheet.mjs +7 -3
- package/dist/react/filters/state.mjs +6 -1
- package/dist/react/filters/values.mjs +24 -7
- package/dist/react/filters/words.d.mts +13 -0
- package/dist/react/filters/words.mjs +5 -0
- package/dist/react/format-time.d.mts +17 -6
- package/dist/react/format-time.mjs +152 -33
- package/dist/react/format.d.mts +3 -3
- package/dist/react/format.mjs +35 -122
- package/dist/react/headline.d.mts +12 -0
- package/dist/react/headline.mjs +107 -0
- package/dist/react/index.d.mts +20 -17
- package/dist/react/index.mjs +13 -10
- package/dist/react/lazy.mjs +38 -0
- package/dist/react/messages.d.mts +78 -2
- package/dist/react/now.mjs +38 -0
- package/dist/react/place.mjs +4 -2
- package/dist/react/read.d.mts +1 -0
- package/dist/react/read.mjs +140 -9
- package/dist/react/renderers/exact.mjs +31 -59
- package/dist/react/renderers/index.d.mts +27 -6
- package/dist/react/renderers/index.mjs +154 -92
- package/dist/react/renderers/list-parts.mjs +24 -0
- package/dist/react/renderers/list.d.mts +1 -0
- package/dist/react/renderers/list.mjs +99 -43
- package/dist/react/renderers/more-rows.mjs +75 -0
- package/dist/react/renderers/number-before.mjs +320 -0
- package/dist/react/renderers/number-period.mjs +54 -0
- package/dist/react/renderers/number-whole.mjs +29 -0
- package/dist/react/renderers/props.d.mts +24 -1
- package/dist/react/renderers/props.mjs +8 -0
- package/dist/react/renderers/table-cells.mjs +137 -31
- package/dist/react/renderers/table-fit.mjs +55 -10
- package/dist/react/renderers/table-measure.mjs +29 -9
- package/dist/react/renderers/table-row.mjs +14 -9
- package/dist/react/renderers/table-scale.mjs +2 -3
- package/dist/react/renderers/table-sort.mjs +3 -2
- package/dist/react/renderers/table-whole.mjs +37 -0
- package/dist/react/renderers/table.mjs +73 -53
- package/dist/react/review.d.mts +7 -0
- package/dist/react/review.mjs +35 -8
- package/dist/react/roving.d.mts +6 -0
- package/dist/react/roving.mjs +123 -0
- package/dist/react/says-dates.d.mts +7 -0
- package/dist/react/says-dates.mjs +51 -0
- package/dist/react/series.mjs +5 -6
- package/dist/react/stable.mjs +1 -1
- package/dist/react/tabs/EditTabs.mjs +125 -0
- package/dist/react/tabs/NameField.mjs +72 -0
- package/dist/react/tabs/TabMenu.mjs +175 -0
- package/dist/react/tabs/actions.mjs +37 -0
- package/dist/react/tabs/commands.mjs +76 -0
- package/dist/react/tabs/focus.mjs +22 -0
- package/dist/react/tabs/keys.mjs +28 -0
- package/dist/react/theme-unlayered.css +1 -1
- package/dist/react/theme.css +1 -1
- package/dist/react/tile-store.d.mts +4 -0
- package/dist/react/tile-store.mjs +93 -13
- package/dist/react/touch.d.mts +16 -0
- package/dist/react/touch.mjs +39 -0
- package/dist/react/useBoard.d.mts +6 -0
- package/dist/react/useBoard.mjs +1 -0
- package/dist/react/useDashboard.d.mts +2 -0
- package/dist/react/useDashboard.mjs +5 -2
- package/dist/react/useTiles.d.mts +3 -0
- package/dist/react/useTiles.mjs +73 -17
- package/dist/react/view-grid.mjs +2 -2
- package/dist/react/view.mjs +1 -1
- package/dist/recharts/axes.mjs +1 -1
- package/dist/recharts/axis.mjs +23 -73
- package/dist/recharts/bar.d.mts +2 -1
- package/dist/recharts/bar.mjs +140 -64
- package/dist/recharts/fit.mjs +33 -0
- package/dist/recharts/line.mjs +23 -17
- package/dist/recharts/marks.mjs +2 -1
- package/dist/recharts/parts.mjs +19 -14
- package/dist/recharts/table.mjs +8 -3
- package/dist/refusal.mjs +46 -0
- package/dist/registry/filter-bar.json +1 -1
- package/dist/skills/derive-dashboards/SKILL.md +25 -9
- package/dist/tile-doc.mjs +1 -1
- package/package.json +21 -6
- package/dist/charts-react/plan.d.mts +0 -3
- package/dist/charts-react/plan.mjs +0 -37
- package/dist/charts-react/tiles.d.mts +0 -24
- package/dist/core/policy/match.d.mts +0 -16
- package/dist/core/schema/aliases.d.mts +0 -7
- package/dist/core/time/compare.d.mts +0 -30
- package/dist/react/EditBar.d.mts +0 -16
- package/dist/react/History.d.mts +0 -30
- package/dist/react/ReviewPanel.d.mts +0 -15
- package/dist/react/digits.mjs +0 -46
- package/dist/react/drill/trend-touch.mjs +0 -33
- package/dist/react/renderers/exact.d.mts +0 -6
|
@@ -2,11 +2,49 @@ import { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react
|
|
|
2
2
|
// src/renderers/table-fit.ts
|
|
3
3
|
/** A server has no layout to measure: there the effect waits for the browser. */
|
|
4
4
|
const useLayout = typeof document === "undefined" ? useEffect : useLayoutEffect;
|
|
5
|
-
/**
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
5
|
+
/** The width under which a table whose columns do not fit is drawn as cards. */
|
|
6
|
+
const CARDS_UNDER = 480;
|
|
7
|
+
const nothingOf = (of) => ({
|
|
8
|
+
of,
|
|
9
|
+
columns: {},
|
|
10
|
+
tight: {}
|
|
11
|
+
});
|
|
12
|
+
/** What a draw in a box teaches: the columns' exact width when they ran over it, else that they fit it. */
|
|
13
|
+
function learned(known, box) {
|
|
14
|
+
if (box.needs > box.inside) return { exact: box.needs };
|
|
15
|
+
return {
|
|
16
|
+
...known,
|
|
17
|
+
fitsAt: Math.min(known.fitsAt ?? box.inside, box.inside)
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/** What is known of the widths after a draw of `of` in a layout, in a box. */
|
|
21
|
+
function needAfter(known, drawn) {
|
|
22
|
+
const kept = known.of === drawn.of ? known : nothingOf(drawn.of);
|
|
23
|
+
if (drawn.layout === "cards") return kept;
|
|
24
|
+
const way = drawn.layout === "tight" ? "tight" : "columns";
|
|
25
|
+
return {
|
|
26
|
+
...kept,
|
|
27
|
+
[way]: learned(kept[way], drawn)
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/** Whether columns fit a box, by what is known of them; undefined until they are drawn in one that tells. */
|
|
31
|
+
function fitsIn(known, width) {
|
|
32
|
+
if (known.exact !== void 0) return known.exact <= width;
|
|
33
|
+
return known.fitsAt !== void 0 && known.fitsAt <= width ? true : void 0;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* How a table is drawn in a box, from what is known of its columns. A layout not yet known to
|
|
37
|
+
* fit or not is drawn to find out: plain columns first, then tighter, and only when neither
|
|
38
|
+
* fits are the columns given up. Tighter is tried however much too wide the columns are: it
|
|
39
|
+
* breaks long words, so no share of their width says what it saves, and only a draw can. The
|
|
40
|
+
* try is paid once an answer, since what is known is true of the columns in any box; and so the
|
|
41
|
+
* layout a box ends in is its width's alone, whatever widths it had before.
|
|
42
|
+
*/
|
|
43
|
+
function fitOf(need, width) {
|
|
44
|
+
if (fitsIn(need.columns, width) !== false) return "columns";
|
|
45
|
+
if (fitsIn(need.tight, width) !== false) return "tight";
|
|
46
|
+
return width < CARDS_UNDER ? "cards" : "scroll";
|
|
47
|
+
}
|
|
10
48
|
/**
|
|
11
49
|
* How a table fits the box around it, measured after every draw and whenever the box changes
|
|
12
50
|
* size: the table's ref, and how it is drawn. A new `of` (another answer) is measured afresh,
|
|
@@ -14,7 +52,7 @@ const fitOf = (over, width) => {
|
|
|
14
52
|
*/
|
|
15
53
|
function useFit(of) {
|
|
16
54
|
const table = useRef(null);
|
|
17
|
-
const need = useRef(
|
|
55
|
+
const need = useRef(nothingOf(of));
|
|
18
56
|
const [fit, setFit] = useState("columns");
|
|
19
57
|
const [seen, setSeen] = useState(of);
|
|
20
58
|
if (seen !== of) {
|
|
@@ -24,9 +62,16 @@ function useFit(of) {
|
|
|
24
62
|
const measure = useCallback(() => {
|
|
25
63
|
const box = table.current?.parentElement;
|
|
26
64
|
if (table.current === null || box === null || box === void 0) return;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
65
|
+
const layout = table.current.dataset["layout"];
|
|
66
|
+
const inside = box.clientWidth;
|
|
67
|
+
need.current = needAfter(need.current, {
|
|
68
|
+
of,
|
|
69
|
+
layout,
|
|
70
|
+
needs: box.scrollWidth,
|
|
71
|
+
inside
|
|
72
|
+
});
|
|
73
|
+
setFit(fitOf(need.current, inside));
|
|
74
|
+
}, [of]);
|
|
30
75
|
useLayout(measure);
|
|
31
76
|
useLayout(() => {
|
|
32
77
|
const box = table.current?.parentElement;
|
|
@@ -49,4 +94,4 @@ function nameCut(event) {
|
|
|
49
94
|
if (target.scrollWidth > target.clientWidth) target.title = target.textContent;
|
|
50
95
|
else target.removeAttribute("title");
|
|
51
96
|
}
|
|
52
|
-
export {
|
|
97
|
+
export { nameCut, useFit };
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { isValue } from "../columns.mjs";
|
|
2
|
-
import { formatCell } from "../format.mjs";
|
|
3
2
|
import { answerIds } from "./entries.mjs";
|
|
4
3
|
import { isSummary, measurable, rangeOf, scaleOf } from "./table-scale.mjs";
|
|
5
|
-
import {
|
|
4
|
+
import { valueText } from "./table-whole.mjs";
|
|
5
|
+
import { displayOf, isMark, roleOf } from "derive-dashboards/core";
|
|
6
6
|
// src/renderers/table-measure.ts
|
|
7
7
|
/** One column's measure: its scale over every row, and the values of the rows drawn as written, with the room the longest takes. */
|
|
8
8
|
function measure(asked, at, column, draws) {
|
|
9
9
|
const { rows } = asked.answer;
|
|
10
10
|
const places = asked.drawn ?? rows.map((_, place) => place);
|
|
11
|
-
const
|
|
11
|
+
const how = {
|
|
12
|
+
whole: asked.whole,
|
|
13
|
+
format: asked
|
|
14
|
+
};
|
|
15
|
+
const texts = new Map(places.map((place) => [place, valueText(rows[place]?.[at] ?? null, column, how)]));
|
|
12
16
|
const scale = scaleOf(rows, at, column);
|
|
13
17
|
return {
|
|
14
18
|
scale,
|
|
@@ -39,13 +43,29 @@ function measuredOf(asked) {
|
|
|
39
43
|
}));
|
|
40
44
|
}
|
|
41
45
|
/**
|
|
46
|
+
* Whether a row that folds dimensions (Other, a total) is of the rows drawn: the groups it
|
|
47
|
+
* does not fold (its month, its outer group) are those of some row drawn. One that folds every
|
|
48
|
+
* dimension, the grand total, is of them all. Only a group names a row: what a measure or a
|
|
49
|
+
* calculation comes to in a fold is a value of its own, never a row's.
|
|
50
|
+
*/
|
|
51
|
+
function foldsDrawn(fold, drawn, columns) {
|
|
52
|
+
const kept = columns.flatMap((column, at) => roleOf(column) === "dimension" && !isMark(fold[at] ?? null) ? [at] : []);
|
|
53
|
+
return drawn.some((row) => kept.every((at) => same(row[at], fold[at])));
|
|
54
|
+
}
|
|
55
|
+
/** Whether two cells hold one value: exact values are told by their text. */
|
|
56
|
+
const same = (a, b) => a === b || JSON.stringify(a) === JSON.stringify(b);
|
|
57
|
+
/**
|
|
42
58
|
* The rows drawn, of the rows in a viewer's order: all of a table of `limit` rows or fewer,
|
|
43
|
-
* else
|
|
44
|
-
* under them.
|
|
59
|
+
* Other and totals not counted, else its first `limit` rows with the rows that fold their
|
|
60
|
+
* dimensions (Other, a total) where they were, under them or between them. A table by month and
|
|
61
|
+
* plan has an Other and a total a month: only those of the months drawn are kept, so no total
|
|
62
|
+
* stands under rows that are not there.
|
|
45
63
|
*/
|
|
46
|
-
function drawnOf(order, rows, limit) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
64
|
+
function drawnOf(order, rows, limit, columns) {
|
|
65
|
+
const plain = order.filter((place) => !isSummary(rows[place] ?? []));
|
|
66
|
+
if (plain.length <= limit) return order;
|
|
67
|
+
const first = new Set(plain.slice(0, limit));
|
|
68
|
+
const drawn = [...first].map((place) => rows[place] ?? []);
|
|
69
|
+
return order.filter((place) => isSummary(rows[place] ?? []) ? foldsDrawn(rows[place] ?? [], drawn, columns) : first.has(place));
|
|
50
70
|
}
|
|
51
71
|
export { drawnOf, measuredOf };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { isValue } from "../columns.mjs";
|
|
2
2
|
import { groupText, rawCellText } from "../format.mjs";
|
|
3
|
-
import { Cell as Cell$1 } from "./table-cells.mjs";
|
|
3
|
+
import { Cell as Cell$1, rowMark } from "./table-cells.mjs";
|
|
4
4
|
import { isSummary, isTotal } from "./table-scale.mjs";
|
|
5
|
-
import { memo, useMemo } from "react";
|
|
6
5
|
import { isMark, roleOf } from "derive-dashboards/core";
|
|
6
|
+
import { memo, useMemo } from "react";
|
|
7
7
|
import { jsx } from "react/jsx-runtime";
|
|
8
8
|
// src/renderers/table-row.tsx
|
|
9
9
|
/** Cells as table cells: a run of equal marks is one cell spanning its columns. */
|
|
@@ -29,8 +29,8 @@ const markOf = (cells) => {
|
|
|
29
29
|
function useComparisons(columns, groups, drill, format) {
|
|
30
30
|
const { locale, messages, timeZone } = format;
|
|
31
31
|
return useMemo(() => {
|
|
32
|
-
if (!groups || !drill?.
|
|
33
|
-
const openGroup = drill.
|
|
32
|
+
if (!groups || !drill?.compareGroups) return;
|
|
33
|
+
const openGroup = drill.compareGroups.bind(drill);
|
|
34
34
|
const place = columns.findIndex((c) => roleOf(c) === "dimension");
|
|
35
35
|
if (place < 0) return;
|
|
36
36
|
const labels = columns.flatMap((column, i) => isValue(column) ? [] : [{
|
|
@@ -79,9 +79,14 @@ function RowOf(props) {
|
|
|
79
79
|
const { cells, columns, ruled, drill, ...at } = props;
|
|
80
80
|
const compare = props.comparison?.(cells);
|
|
81
81
|
const mark = markOf(cells);
|
|
82
|
-
const whole = compare ? void 0 : drill?.props(cells);
|
|
83
|
-
const
|
|
82
|
+
const whole = rowMark(compare ? void 0 : drill?.props(cells));
|
|
83
|
+
const placed = spans(cells);
|
|
84
84
|
const heading = columns.findIndex((column) => roleOf(column) === "dimension");
|
|
85
|
+
const holder = placed.some((s) => s.at === heading) ? heading : placed[0]?.at ?? 0;
|
|
86
|
+
const markAt = (place, column) => {
|
|
87
|
+
if (whole.button !== void 0) return place === holder ? whole.button : void 0;
|
|
88
|
+
return column !== void 0 && isValue(column) ? drill?.props(cells, column.id) : void 0;
|
|
89
|
+
};
|
|
85
90
|
const cellAt = {
|
|
86
91
|
...at,
|
|
87
92
|
total: mark === "all",
|
|
@@ -92,8 +97,8 @@ function RowOf(props) {
|
|
|
92
97
|
"data-mark": mark,
|
|
93
98
|
"data-rule": ruled ? "full" : void 0,
|
|
94
99
|
role: at.cards ? "row" : void 0,
|
|
95
|
-
...whole,
|
|
96
|
-
children:
|
|
100
|
+
...whole.row,
|
|
101
|
+
children: placed.map(({ cell, at: place, span }) => {
|
|
97
102
|
const column = columns[place];
|
|
98
103
|
return /* @__PURE__ */ jsx(Cell$1, {
|
|
99
104
|
cell,
|
|
@@ -103,7 +108,7 @@ function RowOf(props) {
|
|
|
103
108
|
...cellAt,
|
|
104
109
|
heading: place === heading
|
|
105
110
|
},
|
|
106
|
-
|
|
111
|
+
mark: markAt(place, column),
|
|
107
112
|
compare: compare?.place === place ? compare : void 0
|
|
108
113
|
}, column?.id ?? place);
|
|
109
114
|
})
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { plotValue } from "../format.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { isMark } from "derive-dashboards/core";
|
|
2
|
+
import { cellDigits, isMark } from "derive-dashboards/core";
|
|
4
3
|
// src/renderers/table-scale.ts
|
|
5
4
|
/** Whether a row folds dimensions: a total, or the rest as Other. */
|
|
6
5
|
const isSummary = (cells) => cells.some((cell) => isMark(cell));
|
|
@@ -10,7 +9,7 @@ const isTotal = (cells) => cells.some((cell) => isMark(cell) && cell.mark === "a
|
|
|
10
9
|
const wholeOf = (column) => column.fraction === true ? 1 : 100;
|
|
11
10
|
/** A cell's size as a float: nothing for a cell with no number, infinite for an exact amount past what a float holds. */
|
|
12
11
|
const sizeOf = (cell) => {
|
|
13
|
-
const digits =
|
|
12
|
+
const digits = cellDigits(cell);
|
|
14
13
|
return Math.abs(digits === void 0 ? numberOf(cell) ?? 0 : Number(digits));
|
|
15
14
|
};
|
|
16
15
|
/** A cell's number, when it has one: a cell that is not a number has none, as an empty cell has none. */
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { isNumeric, isValue } from "../columns.mjs";
|
|
2
2
|
import { rawCellText } from "../format.mjs";
|
|
3
|
-
import { compareExact
|
|
3
|
+
import { compareExact } from "./exact.mjs";
|
|
4
4
|
import { isSummary } from "./table-scale.mjs";
|
|
5
|
+
import { cellDigits } from "derive-dashboards/core";
|
|
5
6
|
// src/renderers/table-sort.ts
|
|
6
7
|
/**
|
|
7
8
|
* Whether a table's rows can be sorted: every row that folds dimensions comes after every row
|
|
@@ -48,7 +49,7 @@ function byNumber(cells, floats) {
|
|
|
48
49
|
const [p, q] = [floats[a] ?? 0, floats[b] ?? 0];
|
|
49
50
|
if (p !== q) return p < q ? -1 : 1;
|
|
50
51
|
if (typeof cells[a] === "number" && typeof cells[b] === "number") return 0;
|
|
51
|
-
const [x, y] = [
|
|
52
|
+
const [x, y] = [cellDigits(cells[a]), cellDigits(cells[b])];
|
|
52
53
|
return x !== void 0 && y !== void 0 ? compareExact(x, y) : 0;
|
|
53
54
|
};
|
|
54
55
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { isValue } from "../columns.mjs";
|
|
2
|
+
import { formatCell } from "../format.mjs";
|
|
3
|
+
import { digitsOf, takesWhole, wholeDigits, wholeText } from "../headline.mjs";
|
|
4
|
+
import { compareExact } from "./exact.mjs";
|
|
5
|
+
import { displayOf, isMark } from "derive-dashboards/core";
|
|
6
|
+
// src/renderers/table-whole.ts
|
|
7
|
+
const NONE = /* @__PURE__ */ new Set();
|
|
8
|
+
/**
|
|
9
|
+
* Whether digits are nothing at all (0). A float says so first, then the digits themselves: an
|
|
10
|
+
* amount too small for a float to hold is still an amount, and a smaller one than a thousand.
|
|
11
|
+
*/
|
|
12
|
+
const isNothing = (digits) => digits !== void 0 && Number(digits) === 0 && compareExact(digits, "0") === 0;
|
|
13
|
+
/** Whether a cell holds no amount to weigh: no value, a fold's mark, or nothing at all (0). */
|
|
14
|
+
const weighsNothing = (cell, column) => cell === null || isMark(cell) || isNothing(digitsOf(cell, column));
|
|
15
|
+
/** Whether every amount in a column is large, and there is one: read as digits, no number is formatted. */
|
|
16
|
+
function allLarge(rows, at, column) {
|
|
17
|
+
let some = false;
|
|
18
|
+
for (const row of rows) {
|
|
19
|
+
const cell = row[at] ?? null;
|
|
20
|
+
if (weighsNothing(cell, column)) continue;
|
|
21
|
+
if (wholeDigits(cell, column) === void 0) return false;
|
|
22
|
+
some = true;
|
|
23
|
+
}
|
|
24
|
+
return some;
|
|
25
|
+
}
|
|
26
|
+
/** The ids of the value columns a table writes in whole units. */
|
|
27
|
+
function wholeColumns(asked) {
|
|
28
|
+
if (displayOf("table", asked.widget.display).full === true) return NONE;
|
|
29
|
+
const { columns, rows } = asked.answer;
|
|
30
|
+
const whole = columns.flatMap((column, at) => isValue(column) && takesWhole(column, asked.locale) && allLarge(rows, at, column) ? [column.id] : []);
|
|
31
|
+
return whole.length === 0 ? NONE : new Set(whole);
|
|
32
|
+
}
|
|
33
|
+
/** A value cell as its table writes it: in whole units in a column that is, else as any cell. */
|
|
34
|
+
function valueText(cell, column, at) {
|
|
35
|
+
return (at.whole.has(column.id) ? wholeText(cell, column, at.format) : null) ?? formatCell(cell, column, at.format);
|
|
36
|
+
}
|
|
37
|
+
export { valueText, wholeColumns };
|
|
@@ -1,40 +1,25 @@
|
|
|
1
|
+
import { MoreRows, holdsRows, useRowLimit } from "./more-rows.mjs";
|
|
2
|
+
import { fitted } from "./props.mjs";
|
|
1
3
|
import { nameCut, useFit } from "./table-fit.mjs";
|
|
2
4
|
import { Head } from "./table-head.mjs";
|
|
3
5
|
import { drawnOf, measuredOf } from "./table-measure.mjs";
|
|
4
6
|
import { Row, useComparisons } from "./table-row.mjs";
|
|
5
7
|
import { isSummary, isTotal } from "./table-scale.mjs";
|
|
6
8
|
import { orderOf, sortable } from "./table-sort.mjs";
|
|
7
|
-
import {
|
|
9
|
+
import { wholeColumns } from "./table-whole.mjs";
|
|
8
10
|
import { displayOf } from "derive-dashboards/core";
|
|
11
|
+
import { useMemo, useState } from "react";
|
|
9
12
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
13
|
// src/renderers/table.tsx
|
|
11
|
-
/** Under a long table that draws its first rows only: the button that draws more. Nothing under a table drawn whole. */
|
|
12
|
-
function More({ hidden, of, onMore, table, tile }) {
|
|
13
|
-
if (hidden <= 0) return null;
|
|
14
|
-
const written = (count) => count.toLocaleString(tile.locale);
|
|
15
|
-
return /* @__PURE__ */ jsx("button", {
|
|
16
|
-
type: "button",
|
|
17
|
-
className: "dd-table-more",
|
|
18
|
-
onClick: () => {
|
|
19
|
-
if (hidden <= 500) table.current?.focus();
|
|
20
|
-
onMore();
|
|
21
|
-
},
|
|
22
|
-
children: tile.messages.showMoreRows(written(Math.min(hidden, 500)), written(of))
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
14
|
/**
|
|
26
15
|
* The rows a table draws, in a viewer's order, and what its value columns are measured against:
|
|
27
16
|
* each worked out once for an answer, a sort and the rows drawn, not on every draw. A long
|
|
28
17
|
* table draws its first rows, and more with each press of its button.
|
|
29
18
|
*/
|
|
30
|
-
function useRows(
|
|
19
|
+
function useRows(tile, sort) {
|
|
20
|
+
const { answer, widget, locale, messages } = tile;
|
|
31
21
|
const { columns, rows } = answer;
|
|
32
|
-
const
|
|
33
|
-
const [seen, setSeen] = useState(answer);
|
|
34
|
-
if (seen !== answer) {
|
|
35
|
-
setSeen(answer);
|
|
36
|
-
setLimit(500);
|
|
37
|
-
}
|
|
22
|
+
const { limit, first, drawMore, drawFirst } = useRowLimit(answer, tile.fit);
|
|
38
23
|
const order = useMemo(() => orderOf(rows, columns, {
|
|
39
24
|
sort,
|
|
40
25
|
locale
|
|
@@ -44,50 +29,83 @@ function useRows({ answer, widget, locale, messages }, sort) {
|
|
|
44
29
|
sort,
|
|
45
30
|
locale
|
|
46
31
|
]);
|
|
47
|
-
const drawn = useMemo(() => drawnOf(order, rows, limit), [
|
|
32
|
+
const drawn = useMemo(() => drawnOf(order, rows, limit, columns), [
|
|
48
33
|
order,
|
|
49
34
|
rows,
|
|
50
|
-
limit
|
|
35
|
+
limit,
|
|
36
|
+
columns
|
|
51
37
|
]);
|
|
52
38
|
const written = drawn.length < rows.length ? drawn : void 0;
|
|
39
|
+
const whole = useMemo(() => wholeColumns({
|
|
40
|
+
answer,
|
|
41
|
+
widget,
|
|
42
|
+
locale
|
|
43
|
+
}), [
|
|
44
|
+
answer,
|
|
45
|
+
widget,
|
|
46
|
+
locale
|
|
47
|
+
]);
|
|
53
48
|
const measured = useMemo(() => measuredOf({
|
|
54
49
|
answer,
|
|
55
50
|
widget,
|
|
56
51
|
locale,
|
|
57
52
|
messages,
|
|
58
|
-
drawn: written
|
|
53
|
+
drawn: written,
|
|
54
|
+
whole
|
|
59
55
|
}), [
|
|
60
56
|
answer,
|
|
61
57
|
widget,
|
|
62
58
|
locale,
|
|
63
59
|
messages,
|
|
64
|
-
written
|
|
60
|
+
written,
|
|
61
|
+
whole
|
|
65
62
|
]);
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
};
|
|
63
|
+
const plain = useMemo(() => rows.filter((cells) => !isSummary(cells)).length, [rows]);
|
|
64
|
+
const shown = useMemo(() => drawn.filter((place) => !isSummary(rows[place] ?? [])).length, [drawn, rows]);
|
|
69
65
|
return {
|
|
70
66
|
measured,
|
|
67
|
+
whole,
|
|
71
68
|
drawn,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
until: useMemo(() => drawn.findLastIndex((place) => !isSummary(rows[place] ?? [])) + 1, [drawn, rows]),
|
|
70
|
+
more: {
|
|
71
|
+
hidden: plain - shown,
|
|
72
|
+
of: plain,
|
|
73
|
+
first,
|
|
74
|
+
onMore: drawMore,
|
|
75
|
+
onFirst: drawFirst
|
|
76
|
+
}
|
|
75
77
|
};
|
|
76
78
|
}
|
|
79
|
+
/** A table's rows that are not folds (Other, a total) nor its button's own: the rows a reader counts. */
|
|
80
|
+
const PLAIN_ROWS = "tbody > tr:not(.dd-table-summary):not(.dd-table-more-row)";
|
|
77
81
|
/** Every row and column: the groups, then Other and the total under them. */
|
|
78
82
|
function TableTile(props) {
|
|
79
83
|
const { columns, rows } = props.answer;
|
|
80
84
|
const [sort, setSort] = useState();
|
|
81
85
|
const [table, fit] = useFit(props.answer);
|
|
82
86
|
const cards = fit === "cards";
|
|
83
|
-
const { measured,
|
|
87
|
+
const { measured, whole, drawn, until, more } = useRows(props, sort);
|
|
84
88
|
const { compact, comparisons } = displayOf("table", props.widget.display);
|
|
85
89
|
const comparison = useComparisons(columns, comparisons, props.drill, props);
|
|
86
|
-
|
|
90
|
+
const row = (place, i) => /* @__PURE__ */ jsx(Row, {
|
|
91
|
+
cells: rows[place] ?? [],
|
|
92
|
+
columns,
|
|
93
|
+
format: props,
|
|
94
|
+
time: props.answer.time,
|
|
95
|
+
measured,
|
|
96
|
+
whole,
|
|
97
|
+
place,
|
|
98
|
+
cards,
|
|
99
|
+
ruled: isTotal(rows[drawn[i + 1] ?? -1] ?? []),
|
|
100
|
+
drill: props.drill,
|
|
101
|
+
comparison
|
|
102
|
+
}, place);
|
|
103
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsxs("table", {
|
|
87
104
|
ref: table,
|
|
88
105
|
className: "dd-table",
|
|
89
106
|
"data-density": compact === true ? "compact" : void 0,
|
|
90
107
|
"data-layout": fit === "columns" ? void 0 : fit,
|
|
108
|
+
...fitted(props.fit),
|
|
91
109
|
role: cards ? "table" : void 0,
|
|
92
110
|
tabIndex: -1,
|
|
93
111
|
onPointerOver: nameCut,
|
|
@@ -97,26 +115,28 @@ function TableTile(props) {
|
|
|
97
115
|
onSort: sortable(rows) ? setSort : void 0,
|
|
98
116
|
cards,
|
|
99
117
|
messages: props.messages
|
|
100
|
-
}), /* @__PURE__ */
|
|
118
|
+
}), /* @__PURE__ */ jsxs("tbody", {
|
|
101
119
|
role: cards ? "rowgroup" : void 0,
|
|
102
|
-
children:
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
120
|
+
children: [
|
|
121
|
+
drawn.slice(0, until).map((place, i) => row(place, i)),
|
|
122
|
+
holdsRows(more) ? /* @__PURE__ */ jsx("tr", {
|
|
123
|
+
className: "dd-table-more-row",
|
|
124
|
+
role: cards ? "row" : void 0,
|
|
125
|
+
children: /* @__PURE__ */ jsx("td", {
|
|
126
|
+
colSpan: columns.length,
|
|
127
|
+
role: cards ? "cell" : void 0,
|
|
128
|
+
children: /* @__PURE__ */ jsx(MoreRows, {
|
|
129
|
+
...more,
|
|
130
|
+
rows: table,
|
|
131
|
+
row: PLAIN_ROWS,
|
|
132
|
+
tile: props,
|
|
133
|
+
className: "dd-table-more"
|
|
134
|
+
})
|
|
135
|
+
})
|
|
136
|
+
}) : null,
|
|
137
|
+
drawn.slice(until).map((place, i) => row(place, until + i))
|
|
138
|
+
]
|
|
113
139
|
})]
|
|
114
|
-
})
|
|
115
|
-
hidden,
|
|
116
|
-
of: plain,
|
|
117
|
-
onMore: drawMore,
|
|
118
|
-
table,
|
|
119
|
-
tile: props
|
|
120
|
-
})] });
|
|
140
|
+
}) });
|
|
121
141
|
}
|
|
122
142
|
export { TableTile };
|
package/dist/react/review.d.mts
CHANGED
|
@@ -15,9 +15,16 @@ export type Moved = {
|
|
|
15
15
|
export declare function useReview(dashboardId: string, edit: DraftEditor): {
|
|
16
16
|
preview: Preview | undefined;
|
|
17
17
|
moved: Moved | undefined;
|
|
18
|
+
/** True while a decision is on its way and the review has not yet read what it left. */
|
|
19
|
+
deciding: boolean;
|
|
18
20
|
loading: boolean;
|
|
19
21
|
error: string | undefined;
|
|
20
22
|
open: () => Promise<Preview | null>;
|
|
23
|
+
/**
|
|
24
|
+
* Reads the review again for the draft as it is now (after Undo, say), unless it has
|
|
25
|
+
* already read that revision: once a decision has read the draft it left, not again.
|
|
26
|
+
*/
|
|
27
|
+
follow: () => Promise<void>;
|
|
21
28
|
close: () => void;
|
|
22
29
|
drop: (...commandIds: string[]) => Promise<void>;
|
|
23
30
|
putBack: (widgetId: string) => Promise<void>;
|
package/dist/react/review.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { DashboardsError } from "./errors.mjs";
|
|
2
2
|
import { useDashboards } from "./context.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { failureWords } from "./failure-words.mjs";
|
|
4
|
+
import { useRef, useState } from "react";
|
|
4
5
|
// src/review.ts
|
|
5
6
|
/** The preview of what publishing would do, loaded on request, with its failure kept to show. */
|
|
6
7
|
function usePreview(dashboardId) {
|
|
@@ -16,7 +17,7 @@ function usePreview(dashboardId) {
|
|
|
16
17
|
setPreview(next);
|
|
17
18
|
return next;
|
|
18
19
|
} catch (failure) {
|
|
19
|
-
setFailed(failure instanceof TypeError ? messages.unreachable : failure
|
|
20
|
+
setFailed(failure instanceof TypeError ? messages.unreachable : failureWords(failure, messages));
|
|
20
21
|
return null;
|
|
21
22
|
} finally {
|
|
22
23
|
setLoading(false);
|
|
@@ -63,15 +64,19 @@ function useReview(dashboardId, edit) {
|
|
|
63
64
|
dropped: []
|
|
64
65
|
});
|
|
65
66
|
const preview = overThen(loaded, over);
|
|
66
|
-
const
|
|
67
|
-
|
|
67
|
+
const readFor = useRef(void 0);
|
|
68
|
+
const read = () => {
|
|
69
|
+
readFor.current = edit.current()?.revision;
|
|
70
|
+
return load();
|
|
71
|
+
};
|
|
72
|
+
const decided = async (decision, shown) => {
|
|
68
73
|
if (!await edit.run(async () => {
|
|
69
74
|
const draft = edit.current();
|
|
70
75
|
if (draft === void 0) return;
|
|
71
76
|
const rebased = await client.rebaseDraft({
|
|
72
77
|
dashboardId,
|
|
73
78
|
expectedRevision: draft.revision,
|
|
74
|
-
head:
|
|
79
|
+
head: shown.head,
|
|
75
80
|
...decision
|
|
76
81
|
});
|
|
77
82
|
edit.replace(rebased);
|
|
@@ -80,13 +85,26 @@ function useReview(dashboardId, edit) {
|
|
|
80
85
|
...over,
|
|
81
86
|
dropped: [...over.dropped, ...decision.drop ?? []]
|
|
82
87
|
});
|
|
83
|
-
await
|
|
88
|
+
await read();
|
|
89
|
+
};
|
|
90
|
+
const inFlight = useRef(false);
|
|
91
|
+
const [deciding, setDeciding] = useState(false);
|
|
92
|
+
const decide = async (decision) => {
|
|
93
|
+
if (preview === void 0 || inFlight.current) return;
|
|
94
|
+
inFlight.current = true;
|
|
95
|
+
setDeciding(true);
|
|
96
|
+
try {
|
|
97
|
+
await decided(decision, preview);
|
|
98
|
+
} finally {
|
|
99
|
+
inFlight.current = false;
|
|
100
|
+
setDeciding(false);
|
|
101
|
+
}
|
|
84
102
|
};
|
|
85
103
|
const publish = async () => {
|
|
86
104
|
if (preview === void 0) return;
|
|
87
105
|
const done = await edit.publish(preview);
|
|
88
106
|
if ((!done.ok && done.failure instanceof DashboardsError ? done.failure : null)?.code !== "HEAD_MOVED") return;
|
|
89
|
-
const fresh = await
|
|
107
|
+
const fresh = await read();
|
|
90
108
|
if (fresh !== null) setMoved({
|
|
91
109
|
from: preview.head,
|
|
92
110
|
to: fresh.head
|
|
@@ -95,9 +113,18 @@ function useReview(dashboardId, edit) {
|
|
|
95
113
|
return {
|
|
96
114
|
preview,
|
|
97
115
|
moved,
|
|
116
|
+
/** True while a decision is on its way and the review has not yet read what it left. */
|
|
117
|
+
deciding,
|
|
98
118
|
loading,
|
|
99
119
|
error: failed ?? edit.error,
|
|
100
|
-
open:
|
|
120
|
+
open: read,
|
|
121
|
+
/**
|
|
122
|
+
* Reads the review again for the draft as it is now (after Undo, say), unless it has
|
|
123
|
+
* already read that revision: once a decision has read the draft it left, not again.
|
|
124
|
+
*/
|
|
125
|
+
follow: async () => {
|
|
126
|
+
if (readFor.current !== edit.current()?.revision) await read();
|
|
127
|
+
},
|
|
101
128
|
close: () => {
|
|
102
129
|
setPreview(void 0);
|
|
103
130
|
setMoved(void 0);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { KeyboardEvent, ReactNode } from "react";
|
|
2
|
+
/** Marks as one tab stop (`useRoving`) in a `div` of their own, for a page of the host's. */
|
|
3
|
+
export declare function Roving({ children, className }: {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
}): import("react").JSX.Element;
|