derive-dashboards 0.1.0 → 0.2.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/README.md +8 -5
- package/dist/adapter/sql-adapter.mjs +4 -4
- package/dist/body.mjs +11 -1
- package/dist/cache.d.mts +1 -1
- package/dist/cli/add.mjs +130 -0
- package/dist/cli/check.mjs +14 -1
- package/dist/cli/cli.mjs +14 -12
- package/dist/cli/config.mjs +12 -1
- package/dist/cli/doctor.mjs +147 -0
- package/dist/cli/import/dbt-schema.mjs +2 -2
- package/dist/cli/import/index.mjs +2 -2
- package/dist/cli/init.mjs +3 -2
- package/dist/cli/json.mjs +21 -0
- package/dist/cli/layers.mjs +33 -0
- package/dist/core/conformance/cases.d.mts +3 -0
- package/dist/core/conformance/cases.mjs +20 -4
- package/dist/core/conformance/check.mjs +6 -3
- package/dist/core/conformance/drill-cases.mjs +120 -0
- package/dist/core/document/layout.mjs +1 -1
- package/dist/core/document/view-layout.d.mts +14 -0
- package/dist/core/document/view-layout.mjs +157 -0
- package/dist/core/document/view.d.mts +26 -7
- package/dist/core/document/view.mjs +42 -11
- package/dist/core/engine/filter.mjs +2 -2
- package/dist/core/engine/index.d.mts +14 -2
- package/dist/core/engine/index.mjs +12 -1
- package/dist/core/engine/leaf.mjs +9 -4
- package/dist/core/engine/members.mjs +2 -2
- package/dist/core/engine/postgres.mjs +1 -1
- package/dist/core/engine/record-layout.d.mts +11 -0
- package/dist/core/engine/record-layout.mjs +7 -7
- package/dist/core/engine/records.d.mts +3 -2
- package/dist/core/engine/records.mjs +2 -1
- package/dist/core/engine/segmented.mjs +5 -2
- package/dist/core/engine/sql-records.mjs +2 -1
- package/dist/core/engine/statement.mjs +37 -3
- package/dist/core/engine/types.d.mts +3 -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 +33 -1
- package/dist/core/error/codes.mjs +30 -2
- package/dist/core/index.d.mts +13 -7
- package/dist/core/index.mjs +9 -5
- package/dist/core/model/catalog/check.mjs +1 -1
- package/dist/core/model/hints.d.mts +36 -0
- package/dist/core/model/member.d.mts +4 -2
- package/dist/core/model/member.mjs +19 -3
- package/dist/core/model/types.d.mts +21 -19
- package/dist/core/model/validate/drill.mjs +70 -0
- package/dist/core/model/validate/index.mjs +3 -0
- package/dist/core/model/validate/members.mjs +7 -4
- package/dist/core/model/validate/shape.mjs +150 -0
- package/dist/core/model/validate/source.mjs +5 -3
- package/dist/core/policy/bind-query.d.mts +12 -0
- package/dist/core/policy/bind-query.mjs +53 -0
- package/dist/core/query/alias.mjs +7 -1
- package/dist/core/query/drill/compose.d.mts +22 -0
- package/dist/core/query/drill/compose.mjs +85 -0
- package/dist/core/query/drill/fields.d.mts +21 -0
- package/dist/core/query/drill/fields.mjs +91 -0
- package/dist/core/query/drill/internal.d.mts +11 -0
- package/dist/core/query/drill/items.d.mts +29 -0
- package/dist/core/query/drill/items.mjs +98 -0
- package/dist/core/query/drill/line.d.mts +31 -0
- package/dist/core/query/drill/line.mjs +183 -0
- package/dist/core/query/drill/links.d.mts +33 -0
- package/dist/core/query/drill/links.mjs +31 -0
- package/dist/core/query/drill/operand.mjs +7 -0
- package/dist/core/query/drill/scopes.d.mts +22 -0
- package/dist/core/query/drill/scopes.mjs +58 -0
- package/dist/core/query/drill/selection.d.mts +37 -0
- package/dist/core/query/drill/selection.mjs +144 -0
- package/dist/core/query/drill/steps.d.mts +14 -0
- package/dist/core/query/drill/steps.mjs +35 -0
- package/dist/core/query/drill/synthetic-expr.mjs +85 -0
- package/dist/core/query/drill/synthetic.d.mts +22 -0
- package/dist/core/query/drill/synthetic.mjs +165 -0
- package/dist/core/query/drill/time.d.mts +11 -0
- package/dist/core/query/drill/time.mjs +71 -0
- package/dist/core/query/drill/types.d.mts +155 -0
- package/dist/core/query/drill/types.mjs +4 -0
- package/dist/core/query/drill/views.d.mts +62 -0
- package/dist/core/query/drill/views.mjs +257 -0
- package/dist/core/query/filter.d.mts +6 -0
- package/dist/core/query/picks.d.mts +8 -2
- package/dist/core/query/picks.mjs +11 -4
- package/dist/core/query/segments.d.mts +12 -2
- package/dist/core/query/segments.mjs +5 -2
- package/dist/core/result/columns.mjs +20 -4
- package/dist/core/result/types.d.mts +5 -1
- package/dist/core/schema/aliases.d.mts +7 -0
- package/dist/core/schema/aliases.mjs +77 -0
- package/dist/core/schema/answer-parts.mjs +117 -0
- package/dist/core/schema/answers.d.mts +2109 -128
- package/dist/core/schema/answers.mjs +11 -113
- package/dist/core/schema/commands.d.mts +2 -2
- package/dist/core/schema/document.d.mts +1 -1
- package/dist/core/schema/drill-answers.mjs +179 -0
- package/dist/core/schema/drill.d.mts +260 -0
- package/dist/core/schema/drill.mjs +107 -0
- package/dist/core/schema/index.d.mts +6 -3
- package/dist/core/schema/index.mjs +6 -3
- package/dist/core/schema/picks.d.mts +35 -0
- package/dist/core/schema/picks.mjs +23 -0
- package/dist/core/schema/query.d.mts +82 -1
- package/dist/core/schema/query.mjs +9 -5
- package/dist/core/schema/tools.mjs +1 -1
- package/dist/core/schema/view.d.mts +0 -35
- package/dist/core/schema/view.mjs +19 -24
- package/dist/core/store/schema.d.mts +5 -0
- package/dist/core/store/schema.mjs +10 -0
- package/dist/core/types/api.d.mts +21 -1
- package/dist/core/types/api.mjs +1 -1
- package/dist/core/types/drill-api.d.mts +210 -0
- package/dist/core/types/options.d.mts +21 -0
- package/dist/core/types/viewer.d.mts +5 -0
- package/dist/cursor-seal.d.mts +8 -0
- package/dist/cursor-seal.mjs +98 -0
- package/dist/dashboard-id.mjs +1 -1
- package/dist/dashboards.mjs +4 -0
- package/dist/drill-access.mjs +93 -0
- package/dist/drill-change.mjs +76 -0
- package/dist/drill-crumbs.mjs +113 -0
- package/dist/drill-distinct.mjs +130 -0
- package/dist/drill-explain.mjs +64 -0
- package/dist/drill-identity.mjs +35 -0
- package/dist/drill-item-id.mjs +35 -0
- package/dist/drill-items.mjs +132 -0
- package/dist/drill-open.mjs +169 -0
- package/dist/drill-seal.mjs +170 -0
- package/dist/drill-secret.mjs +14 -0
- package/dist/drill-share.mjs +53 -0
- package/dist/drill-summary.mjs +158 -0
- package/dist/drill-targets.mjs +53 -0
- package/dist/drill-totals.mjs +8 -0
- package/dist/drill-views.mjs +175 -0
- package/dist/drill.mjs +157 -0
- package/dist/editing.mjs +3 -3
- package/dist/endpoints/dashboards.mjs +28 -5
- package/dist/endpoints/drill.mjs +55 -0
- package/dist/endpoints/index.d.mts +245 -4
- package/dist/endpoints/index.mjs +5 -1
- package/dist/endpoints/meta.mjs +10 -1
- package/dist/endpoints/query.mjs +26 -4
- package/dist/execute.d.mts +19 -1
- package/dist/execute.mjs +34 -27
- package/dist/handler.mjs +5 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.mjs +29 -2
- package/dist/llms.txt +22 -0
- package/dist/mcp/drill.mjs +61 -0
- package/dist/mcp/format.mjs +69 -11
- package/dist/mcp/index.d.mts +15 -4
- package/dist/mcp/index.mjs +13 -7
- package/dist/mcp/query.d.mts +7 -2
- package/dist/mcp/query.mjs +40 -6
- package/dist/node-postgres.d.mts +8 -4
- package/dist/node-postgres.mjs +29 -6
- package/dist/owner.mjs +3 -3
- package/dist/postgres-connection.d.mts +8 -2
- package/dist/postgres-connection.mjs +2 -1
- package/dist/postgres-store.mjs +1 -0
- package/dist/react/Canvas.mjs +28 -5
- package/dist/react/Cell.mjs +2 -1
- package/dist/react/Dashboard.d.mts +10 -5
- package/dist/react/Dashboard.mjs +62 -22
- package/dist/react/DashboardList.mjs +52 -24
- package/dist/react/DashboardListRow.mjs +49 -0
- package/dist/react/Discard.mjs +12 -4
- package/dist/react/Editing.mjs +19 -5
- package/dist/react/FilterBar.d.mts +7 -9
- package/dist/react/Grid.mjs +19 -24
- package/dist/react/Header.mjs +10 -1
- package/dist/react/History.mjs +5 -0
- package/dist/react/Parts.mjs +6 -2
- package/dist/react/ReadFailed.mjs +23 -0
- package/dist/react/ReviewPanel.mjs +13 -2
- package/dist/react/RowBody.d.mts +19 -0
- package/dist/react/RowBody.mjs +55 -0
- package/dist/react/Spaces.mjs +15 -1
- package/dist/react/Tile.d.mts +3 -1
- package/dist/react/Tile.mjs +84 -32
- package/dist/react/_virtual/_rolldown/runtime.mjs +12 -0
- package/dist/react/arrange-steps.mjs +16 -13
- package/dist/react/arrange.mjs +10 -3
- package/dist/react/builder/Calcs.mjs +35 -11
- package/dist/react/builder/FilterEditor.mjs +196 -0
- package/dist/react/builder/Filters.mjs +172 -116
- package/dist/react/builder/Formula.mjs +82 -0
- package/dist/react/builder/Groups.mjs +1 -0
- package/dist/react/builder/Preview.mjs +1 -1
- package/dist/react/builder/RangeEditor.mjs +184 -0
- package/dist/react/builder/Sections.mjs +41 -6
- package/dist/react/builder/Time.mjs +138 -60
- package/dist/react/builder/Values.mjs +85 -0
- package/dist/react/builder/WidgetBuilder.mjs +50 -49
- package/dist/react/builder/base.d.mts +5 -0
- package/dist/react/builder/base.mjs +33 -8
- package/dist/react/builder/calc.mjs +15 -1
- package/dist/react/builder/escape.d.mts +1 -0
- package/dist/react/builder/escape.mjs +62 -0
- package/dist/react/builder/filter-tree.d.mts +9 -0
- package/dist/react/builder/filter-tree.mjs +186 -0
- package/dist/react/builder/formula-parse.d.mts +18 -0
- package/dist/react/builder/formula-parse.mjs +136 -0
- package/dist/react/builder/labels.d.mts +1 -1
- package/dist/react/builder/state.d.mts +2 -1
- package/dist/react/builder/state.mjs +23 -37
- package/dist/react/builder/useBuilder.d.mts +12 -1
- package/dist/react/builder/useBuilder.mjs +6 -3
- package/dist/react/builder/words.d.mts +59 -0
- package/dist/react/builder/words.mjs +73 -0
- package/dist/react/client.d.mts +2 -0
- package/dist/react/client.mjs +1 -0
- package/dist/react/context.d.mts +28 -1
- package/dist/react/context.mjs +25 -4
- package/dist/react/drill/Bars.mjs +179 -0
- package/dist/react/drill/Controls.mjs +173 -0
- package/dist/react/drill/DashboardTile.d.mts +18 -0
- package/dist/react/drill/DashboardTile.mjs +107 -0
- package/dist/react/drill/DrillPanel.d.mts +31 -0
- package/dist/react/drill/DrillPanel.mjs +104 -0
- package/dist/react/drill/DrillTabs.mjs +52 -0
- package/dist/react/drill/Header.mjs +131 -0
- package/dist/react/drill/Items.d.mts +22 -0
- package/dist/react/drill/Items.mjs +164 -0
- package/dist/react/drill/ItemsFoot.mjs +60 -0
- package/dist/react/drill/Notes.mjs +58 -0
- package/dist/react/drill/PanelBody.mjs +74 -0
- package/dist/react/drill/PanelStates.mjs +37 -0
- package/dist/react/drill/board.d.mts +18 -0
- package/dist/react/drill/board.mjs +91 -0
- package/dist/react/drill/counts.mjs +14 -0
- package/dist/react/drill/host.mjs +26 -0
- package/dist/react/drill/item-parts.d.mts +5 -0
- package/dist/react/drill/item-parts.mjs +76 -0
- package/dist/react/drill/item-type.d.mts +26 -0
- package/dist/react/drill/item-type.mjs +7 -0
- package/dist/react/drill/lazy.d.mts +6 -0
- package/dist/react/drill/lazy.mjs +17 -0
- package/dist/react/drill/pages.mjs +48 -0
- package/dist/react/drill/panel-focus.mjs +51 -0
- package/dist/react/drill/props.d.mts +25 -0
- package/dist/react/drill/props.mjs +72 -0
- package/dist/react/drill/state.d.mts +18 -0
- package/dist/react/drill/state.mjs +68 -0
- package/dist/react/drill/useDrill.d.mts +46 -0
- package/dist/react/drill/useDrill.mjs +194 -0
- package/dist/react/drill/words.d.mts +101 -0
- package/dist/react/drill/words.mjs +79 -0
- package/dist/react/english.mjs +29 -6
- package/dist/react/filters/bar.d.mts +12 -0
- package/dist/react/filters/bar.mjs +135 -0
- package/dist/react/filters/calendar.mjs +193 -0
- package/dist/react/filters/chip.mjs +174 -0
- package/dist/react/filters/context.d.mts +22 -0
- package/dist/react/filters/context.mjs +78 -0
- package/dist/react/filters/dates.mjs +89 -0
- package/dist/react/filters/days.d.mts +36 -0
- package/dist/react/filters/days.mjs +87 -0
- package/dist/react/filters/field-step.mjs +81 -0
- package/dist/react/filters/hooks.d.mts +34 -0
- package/dist/react/filters/hooks.mjs +94 -0
- package/dist/react/filters/listbox.mjs +131 -0
- package/dist/react/filters/logic.d.mts +59 -0
- package/dist/react/filters/logic.mjs +109 -0
- package/dist/react/filters/menu-search.mjs +211 -0
- package/dist/react/filters/menu.mjs +85 -0
- package/dist/react/filters/number.mjs +127 -0
- package/dist/react/filters/numbers.d.mts +47 -0
- package/dist/react/filters/numbers.mjs +151 -0
- package/dist/react/filters/operator.mjs +104 -0
- package/dist/react/filters/phone.mjs +104 -0
- package/dist/react/filters/popover.d.mts +19 -0
- package/dist/react/filters/popover.mjs +153 -0
- package/dist/react/filters/rules.d.mts +8 -0
- package/dist/react/filters/rules.mjs +55 -0
- package/dist/react/filters/sheet.mjs +196 -0
- package/dist/react/filters/state.mjs +132 -0
- package/dist/react/filters/suggest.d.mts +47 -0
- package/dist/react/filters/suggest.mjs +97 -0
- package/dist/react/filters/values.mjs +166 -0
- package/dist/react/filters/words.d.mts +81 -0
- package/dist/react/filters/words.mjs +73 -0
- package/dist/react/format.d.mts +3 -3
- package/dist/react/format.mjs +45 -16
- package/dist/react/index.d.mts +34 -5
- package/dist/react/index.mjs +15 -4
- package/dist/react/messages.d.mts +47 -2
- package/dist/react/place.mjs +7 -3
- package/dist/react/renderers/index.d.mts +10 -2
- package/dist/react/renderers/index.mjs +116 -14
- package/dist/react/renderers/list.d.mts +22 -0
- package/dist/react/renderers/list.mjs +118 -0
- package/dist/react/review-words.mjs +1 -1
- package/dist/react/review.mjs +2 -2
- package/dist/react/scope.mjs +2 -7
- package/dist/react/series.d.mts +54 -0
- package/dist/react/series.mjs +191 -0
- package/dist/react/theme.css +2734 -1296
- package/dist/react/theme.css.d.ts +1 -0
- package/dist/react/tile-store.mjs +15 -3
- package/dist/react/useBoard.d.mts +7 -0
- package/dist/react/useBoard.mjs +4 -1
- package/dist/react/useDashboard.d.mts +4 -0
- package/dist/react/useDashboard.mjs +8 -1
- package/dist/react/useTiles.mjs +50 -15
- package/dist/react/view-grid.mjs +16 -0
- package/dist/react/view.d.mts +9 -0
- package/dist/react/view.mjs +22 -10
- package/dist/reading.d.mts +2 -0
- package/dist/reading.mjs +9 -1
- package/dist/recharts/axes.mjs +28 -0
- package/dist/recharts/axis.mjs +84 -0
- package/dist/recharts/bar.d.mts +7 -0
- package/dist/recharts/bar.mjs +140 -0
- package/dist/recharts/charts.d.mts +4 -6
- package/dist/recharts/charts.mjs +2 -114
- package/dist/recharts/index.d.mts +5 -3
- package/dist/recharts/index.mjs +6 -3
- package/dist/recharts/line.d.mts +2 -0
- package/dist/recharts/line.mjs +111 -0
- package/dist/recharts/marks.mjs +112 -0
- package/dist/recharts/parts.mjs +88 -0
- package/dist/recharts/series.d.mts +2 -22
- package/dist/recharts/series.mjs +1 -64
- package/dist/recharts/table.mjs +71 -0
- package/dist/records-read.mjs +44 -0
- package/dist/registry/filter-bar.json +26 -0
- package/dist/skills/derive-dashboards/SKILL.md +69 -0
- package/dist/store/apply.mjs +5 -5
- package/dist/store/commands.mjs +4 -4
- package/dist/store/discard.mjs +7 -7
- package/dist/store/drafts.mjs +5 -5
- package/dist/store/editor.mjs +1 -1
- package/dist/store/publish.mjs +12 -12
- package/dist/store/reader.mjs +41 -22
- package/dist/store/review.mjs +16 -16
- package/dist/store/rows.mjs +20 -20
- package/dist/store/undo.mjs +3 -3
- package/dist/store/unpublished.mjs +4 -4
- package/dist/store/versions.mjs +14 -14
- package/dist/testing/adapter-suite.mjs +4 -4
- package/dist/tiles.mjs +37 -3
- package/package.json +12 -10
- package/dist/react/FilterBar.mjs +0 -119
- package/dist/react/Records.d.mts +0 -12
- package/dist/react/Records.mjs +0 -97
- package/src/adapter/sql-adapter.ts +0 -95
- package/src/adapter/statement.ts +0 -185
- package/src/authorize.ts +0 -73
- package/src/body.ts +0 -169
- package/src/bounded.ts +0 -43
- package/src/cache.ts +0 -192
- package/src/checks.ts +0 -170
- package/src/custom-source.ts +0 -59
- package/src/dashboard-id.ts +0 -36
- package/src/dashboards.ts +0 -132
- package/src/editing.ts +0 -148
- package/src/endpoints/access.ts +0 -41
- package/src/endpoints/dashboards.ts +0 -92
- package/src/endpoints/drafts.ts +0 -138
- package/src/endpoints/index.ts +0 -21
- package/src/endpoints/meta.ts +0 -137
- package/src/endpoints/query.ts +0 -86
- package/src/endpoints/read.ts +0 -92
- package/src/endpoints/review.ts +0 -89
- package/src/endpoints/values.ts +0 -62
- package/src/endpoints/versions.ts +0 -104
- package/src/execute.ts +0 -207
- package/src/handler.ts +0 -232
- package/src/http.ts +0 -66
- package/src/index.ts +0 -163
- package/src/introspect.ts +0 -205
- package/src/mcp/api.ts +0 -59
- package/src/mcp/format.ts +0 -67
- package/src/mcp/index.ts +0 -151
- package/src/mcp/query.ts +0 -153
- package/src/mcp/resolve.ts +0 -114
- package/src/node-postgres.ts +0 -81
- package/src/owner.ts +0 -36
- package/src/postgres-connection.ts +0 -143
- package/src/postgres-store.ts +0 -82
- package/src/principal.ts +0 -39
- package/src/reading.ts +0 -56
- package/src/request-rows.ts +0 -23
- package/src/request.ts +0 -22
- package/src/storage.ts +0 -63
- package/src/store/apply.ts +0 -129
- package/src/store/commands.ts +0 -75
- package/src/store/conflicts.ts +0 -98
- package/src/store/create-tables.ts +0 -104
- package/src/store/discard.ts +0 -42
- package/src/store/drafts.ts +0 -133
- package/src/store/editor.ts +0 -28
- package/src/store/log.ts +0 -28
- package/src/store/publish.ts +0 -199
- package/src/store/publisher.ts +0 -21
- package/src/store/reader.ts +0 -139
- package/src/store/review.ts +0 -239
- package/src/store/rows.ts +0 -250
- package/src/store/tenant.ts +0 -28
- package/src/store/undo.ts +0 -56
- package/src/store/unpublished.ts +0 -33
- package/src/store/versions.ts +0 -106
- package/src/store/writer.ts +0 -19
- package/src/testing/adapter-suite.ts +0 -239
- package/src/testing/index.ts +0 -2
- package/src/tile-doc.ts +0 -46
- package/src/tiles.ts +0 -120
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/** Every word the filter bar shows. Pass any of them as `messages.filterBar` to the provider. */
|
|
2
|
+
export type FilterWords = {
|
|
3
|
+
/** The button that opens the menu of every filter. */
|
|
4
|
+
filter: string;
|
|
5
|
+
/** The phone button that opens the sheet of every filter, with how many are set. */
|
|
6
|
+
filters: (set: number) => string;
|
|
7
|
+
/** The menu's search box. */
|
|
8
|
+
menuPlaceholder: string;
|
|
9
|
+
menuNoMatch: string;
|
|
10
|
+
suggestions: string;
|
|
11
|
+
fields: string;
|
|
12
|
+
/** How many more filters the menu holds than the bar shows. */
|
|
13
|
+
more: (count: number) => string;
|
|
14
|
+
search: (label: string) => string;
|
|
15
|
+
searching: string;
|
|
16
|
+
noMatch: (label: string, query: string) => string;
|
|
17
|
+
anyValue: string;
|
|
18
|
+
selected: (count: number) => string;
|
|
19
|
+
clear: string;
|
|
20
|
+
isWord: string;
|
|
21
|
+
isNotWord: string;
|
|
22
|
+
isAnyOf: string;
|
|
23
|
+
isNoneOf: string;
|
|
24
|
+
operator: (label: string, now: string) => string;
|
|
25
|
+
changeValues: (label: string, values: string) => string;
|
|
26
|
+
remove: (label: string) => string;
|
|
27
|
+
filterBy: (label: string) => string;
|
|
28
|
+
/** No date picked: each widget keeps the range it was built with. */
|
|
29
|
+
widgetDates: string;
|
|
30
|
+
customRange: string;
|
|
31
|
+
pickDays: string;
|
|
32
|
+
previousMonth: string;
|
|
33
|
+
nextMonth: string;
|
|
34
|
+
daysIn: (zone: string) => string;
|
|
35
|
+
dashboardZone: string;
|
|
36
|
+
apply: string;
|
|
37
|
+
min: string;
|
|
38
|
+
max: string;
|
|
39
|
+
to: string;
|
|
40
|
+
notNumbers: string;
|
|
41
|
+
minOverMax: string;
|
|
42
|
+
yourView: string;
|
|
43
|
+
fromLink: string;
|
|
44
|
+
undo: string;
|
|
45
|
+
done: string;
|
|
46
|
+
set: string;
|
|
47
|
+
keys: {
|
|
48
|
+
pick: string;
|
|
49
|
+
removeLast: string;
|
|
50
|
+
close: string;
|
|
51
|
+
};
|
|
52
|
+
/** A chip's field segment, for screen readers. */
|
|
53
|
+
field: (label: string) => string;
|
|
54
|
+
/** Default words for empty and yes-or-no values (a host's `formatValue` comes first). */
|
|
55
|
+
none: string;
|
|
56
|
+
yes: string;
|
|
57
|
+
no: string;
|
|
58
|
+
/** The Undo line after a removal, and after Reset. */
|
|
59
|
+
removed: (labels: readonly string[]) => string;
|
|
60
|
+
cleared: string;
|
|
61
|
+
/** A number field's quick picks from its buckets; `unit` is "" or " h". */
|
|
62
|
+
under: (n: number, unit: string) => string;
|
|
63
|
+
between: (lo: number, hi: number, unit: string) => string;
|
|
64
|
+
orMore: (n: number, unit: string) => string;
|
|
65
|
+
/** The control takes a minimum or a maximum, not both. */
|
|
66
|
+
oneBound: string;
|
|
67
|
+
/** The control takes a range only: both bounds. */
|
|
68
|
+
bothBounds: string;
|
|
69
|
+
/** The one box of a number filter that takes an exact value. */
|
|
70
|
+
value: string;
|
|
71
|
+
/** Typed words the Filter menu understands: "not", words to skip, words for the date. */
|
|
72
|
+
grammar: {
|
|
73
|
+
not: readonly string[];
|
|
74
|
+
skip: readonly string[];
|
|
75
|
+
dates: readonly string[];
|
|
76
|
+
};
|
|
77
|
+
/** A list of values that could not be read. */
|
|
78
|
+
valuesFailed: string;
|
|
79
|
+
retry: string;
|
|
80
|
+
};
|
|
81
|
+
export declare const ENGLISH_FILTERS: FilterWords;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// src/filters/words.ts
|
|
2
|
+
const ENGLISH_FILTERS = {
|
|
3
|
+
filter: "Filter",
|
|
4
|
+
filters: (set) => set === 0 ? "Filters" : `Filters · ${String(set)}`,
|
|
5
|
+
menuPlaceholder: "Filter by…",
|
|
6
|
+
menuNoMatch: "No field or value matches.",
|
|
7
|
+
suggestions: "Suggestions",
|
|
8
|
+
fields: "Fields",
|
|
9
|
+
more: (count) => `+${String(count)}`,
|
|
10
|
+
search: (label) => `Search ${label.toLowerCase()}…`,
|
|
11
|
+
searching: "Searching…",
|
|
12
|
+
noMatch: (label, query) => `No ${label.toLowerCase()} matches “${query}”`,
|
|
13
|
+
anyValue: "Any value",
|
|
14
|
+
selected: (count) => `${String(count)} selected`,
|
|
15
|
+
clear: "Clear",
|
|
16
|
+
isWord: "is",
|
|
17
|
+
isNotWord: "is not",
|
|
18
|
+
isAnyOf: "is any of",
|
|
19
|
+
isNoneOf: "is none of",
|
|
20
|
+
operator: (label, now) => `${label} operator: ${now}. Change`,
|
|
21
|
+
changeValues: (label, values) => `Change ${label}: ${values}`,
|
|
22
|
+
remove: (label) => `Remove ${label} filter`,
|
|
23
|
+
filterBy: (label) => `Filter by ${label}`,
|
|
24
|
+
widgetDates: "Each widget's own",
|
|
25
|
+
customRange: "Custom range",
|
|
26
|
+
pickDays: "Pick a first and a last day",
|
|
27
|
+
previousMonth: "Previous month",
|
|
28
|
+
nextMonth: "Next month",
|
|
29
|
+
daysIn: (zone) => `Days in ${zone}`,
|
|
30
|
+
dashboardZone: "the dashboard's time zone",
|
|
31
|
+
apply: "Apply",
|
|
32
|
+
min: "Min",
|
|
33
|
+
max: "Max",
|
|
34
|
+
to: "to",
|
|
35
|
+
notNumbers: "Enter numbers only.",
|
|
36
|
+
minOverMax: "The minimum must be no more than the maximum.",
|
|
37
|
+
yourView: "Your view",
|
|
38
|
+
fromLink: "From a link",
|
|
39
|
+
undo: "Undo",
|
|
40
|
+
done: "Done",
|
|
41
|
+
set: "set",
|
|
42
|
+
keys: {
|
|
43
|
+
pick: "pick",
|
|
44
|
+
removeLast: "remove last",
|
|
45
|
+
close: "close"
|
|
46
|
+
},
|
|
47
|
+
field: (label) => `${label} filter`,
|
|
48
|
+
none: "None",
|
|
49
|
+
yes: "Yes",
|
|
50
|
+
no: "No",
|
|
51
|
+
removed: (labels) => `${labels.join(", ")} filter${labels.length > 1 ? "s" : ""} removed`,
|
|
52
|
+
cleared: "Filters cleared",
|
|
53
|
+
under: (n, unit) => `Under ${String(n)}${unit}`,
|
|
54
|
+
between: (lo, hi, unit) => `${String(lo)} to ${String(hi)}${unit}`,
|
|
55
|
+
orMore: (n, unit) => `${String(n)}${unit} or more`,
|
|
56
|
+
oneBound: "Enter a minimum or a maximum, not both.",
|
|
57
|
+
bothBounds: "Enter both a minimum and a maximum.",
|
|
58
|
+
value: "Value",
|
|
59
|
+
grammar: {
|
|
60
|
+
not: ["not"],
|
|
61
|
+
skip: ["is"],
|
|
62
|
+
dates: [
|
|
63
|
+
"date",
|
|
64
|
+
"dates",
|
|
65
|
+
"when",
|
|
66
|
+
"time",
|
|
67
|
+
"range"
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
valuesFailed: "Could not load the values.",
|
|
71
|
+
retry: "Retry"
|
|
72
|
+
};
|
|
73
|
+
export { ENGLISH_FILTERS };
|
package/dist/react/format.d.mts
CHANGED
|
@@ -6,7 +6,7 @@ import { Grain, ResultCell, ResultColumn } from "derive-dashboards/core";
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function plotValue(cell: ResultCell): number | null;
|
|
8
8
|
/** What formatting reads of a column: its type, and a time bucket's grain or a money unit. */
|
|
9
|
-
type Shape = Pick<ResultColumn, "type" | "grain" | "unit" | "format" | "signed">;
|
|
9
|
+
type Shape = Pick<ResultColumn, "type" | "grain" | "unit" | "format" | "signed" | "fraction">;
|
|
10
10
|
/**
|
|
11
11
|
* A cell as text for a person, in their locale and words. A renderer can pass its own props as
|
|
12
12
|
* `format`: they carry both.
|
|
@@ -20,6 +20,6 @@ export declare function formatTick(value: number, column?: ResultColumn, locale?
|
|
|
20
20
|
* not as an instant in any zone. Hour labels stay as sent.
|
|
21
21
|
*/
|
|
22
22
|
export declare function formatBucket(label: string, grain: Grain, locale?: string): string;
|
|
23
|
-
/** An instant (text time to the microsecond) as a date and time in the viewer's own
|
|
24
|
-
export declare function formatInstant(text: string, locale?: string): string;
|
|
23
|
+
/** An instant (text time to the microsecond) as a date and time, in a zone (the dashboard's) or the viewer's own. */
|
|
24
|
+
export declare function formatInstant(text: string, locale?: string, timeZone?: string): string;
|
|
25
25
|
export {};
|
package/dist/react/format.mjs
CHANGED
|
@@ -22,13 +22,16 @@ function formatCell(cell, column, format = {}) {
|
|
|
22
22
|
const { locale, messages = ENGLISH } = format;
|
|
23
23
|
if (cell === null) return messages.noValue;
|
|
24
24
|
if (isMark(cell)) return cell.mark === "all" ? messages.total : messages.other;
|
|
25
|
-
if (typeof cell === "string") return formatText(cell, column, locale);
|
|
26
|
-
if (typeof cell === "boolean") return
|
|
25
|
+
if (typeof cell === "string") return formatText(cell, column, locale, format.timeZone);
|
|
26
|
+
if (typeof cell === "boolean") return cell ? messages.drillYes : messages.drillNo;
|
|
27
27
|
return numberText(cell, column, locale);
|
|
28
28
|
}
|
|
29
29
|
/** A number by its column's format: a percent, a duration, money or a plain number. */
|
|
30
30
|
function numberText(cell, column, locale) {
|
|
31
|
-
if (column?.format === "percent") return percentText(cell,
|
|
31
|
+
if (column?.format === "percent") return percentText(cell, {
|
|
32
|
+
signed: column.signed === true,
|
|
33
|
+
fraction: column.fraction === true
|
|
34
|
+
}, locale);
|
|
32
35
|
if (column?.format === "duration") return durationText(typeof cell === "number" ? cell : Number(cell.v), locale);
|
|
33
36
|
const currency = currencyOf(column?.unit);
|
|
34
37
|
const style = currency === void 0 ? {} : {
|
|
@@ -45,15 +48,19 @@ function numberText(cell, column, locale) {
|
|
|
45
48
|
* A value in percent points (42.5) as a percent (42.5%). Exact digits move two places as text,
|
|
46
49
|
* so Intl formats them without a float.
|
|
47
50
|
*/
|
|
48
|
-
function percentText(cell,
|
|
51
|
+
function percentText(cell, how, locale) {
|
|
52
|
+
const { signed } = how;
|
|
53
|
+
const shift = how.fraction ? "" : "E-2";
|
|
54
|
+
const share = (typeof cell === "number" ? cell : Number(cell.v)) / (how.fraction ? 1 : 100);
|
|
55
|
+
const places = Math.abs(share) >= .1 || share === 0 ? 0 : 1;
|
|
49
56
|
const style = {
|
|
50
57
|
style: "percent",
|
|
51
|
-
minimumFractionDigits:
|
|
52
|
-
maximumFractionDigits:
|
|
58
|
+
minimumFractionDigits: places,
|
|
59
|
+
maximumFractionDigits: places,
|
|
53
60
|
signDisplay: signed ? "exceptZero" : "auto"
|
|
54
61
|
};
|
|
55
|
-
if (typeof cell === "number") return new Intl.NumberFormat(locale, style).format(cell / 100);
|
|
56
|
-
return new Intl.NumberFormat(locale, style).format(`${cell.v}
|
|
62
|
+
if (typeof cell === "number") return new Intl.NumberFormat(locale, style).format(how.fraction ? cell : cell / 100);
|
|
63
|
+
return new Intl.NumberFormat(locale, style).format(`${cell.v}${shift}`);
|
|
57
64
|
}
|
|
58
65
|
const DURATION_UNITS = [
|
|
59
66
|
["day", 86400],
|
|
@@ -72,19 +79,19 @@ function durationText(seconds, locale) {
|
|
|
72
79
|
maximumFractionDigits: 1
|
|
73
80
|
}).format(seconds / per);
|
|
74
81
|
}
|
|
75
|
-
/** A text cell: a time bucket's label, an instant, or the text itself. */
|
|
76
|
-
function formatText(text, column, locale) {
|
|
82
|
+
/** A text cell: a time bucket's label, an instant (in the dashboard's zone when given), or the text itself. */
|
|
83
|
+
function formatText(text, column, locale, timeZone) {
|
|
77
84
|
if (column?.grain !== void 0) return formatBucket(text, column.grain, locale);
|
|
78
|
-
return column?.type === "time" ? formatInstant(text, locale) : text;
|
|
85
|
+
return column?.type === "time" ? formatInstant(text, locale, timeZone) : text;
|
|
79
86
|
}
|
|
80
87
|
/** Decimal text in the viewer's locale, exactly: Intl formats the digits, never a float. */
|
|
81
88
|
function exactText(text, currency, locale) {
|
|
82
|
-
const
|
|
89
|
+
const cents = text.split(".")[1] ?? "";
|
|
83
90
|
const style = currency === void 0 ? {} : {
|
|
84
91
|
style: "currency",
|
|
85
92
|
currency
|
|
86
93
|
};
|
|
87
|
-
const places = currency === void 0 ? Math.min(
|
|
94
|
+
const places = /^0*$/u.test(cents) ? 0 : currency === void 0 ? Math.min(cents.length, 2) : 2;
|
|
88
95
|
const fraction = {
|
|
89
96
|
minimumFractionDigits: places,
|
|
90
97
|
maximumFractionDigits: places
|
|
@@ -96,6 +103,11 @@ function exactText(text, currency, locale) {
|
|
|
96
103
|
}
|
|
97
104
|
/** A short axis label: 12K, $1.2M. */
|
|
98
105
|
function formatTick(value, column, locale) {
|
|
106
|
+
if (column?.format === "percent") return new Intl.NumberFormat(locale, {
|
|
107
|
+
style: "percent",
|
|
108
|
+
maximumFractionDigits: 1
|
|
109
|
+
}).format(column.fraction === true ? value : value / 100);
|
|
110
|
+
if (column?.format === "duration") return durationText(value, locale);
|
|
99
111
|
const currency = currencyOf(column?.unit);
|
|
100
112
|
const style = currency === void 0 ? {} : {
|
|
101
113
|
style: "currency",
|
|
@@ -141,13 +153,30 @@ function formatBucket(label, grain, locale) {
|
|
|
141
153
|
timeZone: "UTC"
|
|
142
154
|
}).format(date);
|
|
143
155
|
}
|
|
144
|
-
/** An instant (text time to the microsecond) as a date and time in the viewer's own
|
|
145
|
-
function formatInstant(text, locale) {
|
|
156
|
+
/** An instant (text time to the microsecond) as a date and time, in a zone (the dashboard's) or the viewer's own. */
|
|
157
|
+
function formatInstant(text, locale, timeZone) {
|
|
146
158
|
const date = new Date(text.replace(/(\.\d{3})\d+/u, "$1"));
|
|
147
159
|
if (Number.isNaN(date.getTime())) return text;
|
|
148
160
|
return new Intl.DateTimeFormat(locale, {
|
|
161
|
+
dateStyle: "medium",
|
|
162
|
+
timeStyle: "short",
|
|
163
|
+
...timeZone === void 0 ? {} : { timeZone }
|
|
164
|
+
}).format(date);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* The bucket an instant starts, named at its grain in a zone, as the chart names it: a drill's
|
|
168
|
+
* time step ("Nov 9" for a day or week, "Jul 2026" for a month), never a clock time.
|
|
169
|
+
*/
|
|
170
|
+
function formatInstantAt(text, grain, locale, timeZone) {
|
|
171
|
+
const date = new Date(text.replace(/(\.\d{3})\d+/u, "$1"));
|
|
172
|
+
if (Number.isNaN(date.getTime())) return text;
|
|
173
|
+
const options = grain === "hour" ? {
|
|
149
174
|
dateStyle: "medium",
|
|
150
175
|
timeStyle: "short"
|
|
176
|
+
} : BUCKET_FORMATS[grain];
|
|
177
|
+
return new Intl.DateTimeFormat(locale, {
|
|
178
|
+
...options,
|
|
179
|
+
...timeZone === void 0 ? {} : { timeZone }
|
|
151
180
|
}).format(date);
|
|
152
181
|
}
|
|
153
|
-
export { formatBucket, formatCell, formatInstant, formatTick, plotValue };
|
|
182
|
+
export { formatBucket, formatCell, formatInstant, formatInstantAt, formatTick, plotValue };
|
package/dist/react/index.d.mts
CHANGED
|
@@ -1,27 +1,56 @@
|
|
|
1
|
+
import { ItemFor } from "./drill/item-type.mjs";
|
|
1
2
|
import { WidgetPreview } from "./builder/Preview.mjs";
|
|
2
3
|
import { Builder, useBuilder } from "./builder/useBuilder.mjs";
|
|
3
4
|
import { WidgetBuilder, WidgetBuilderProps } from "./builder/WidgetBuilder.mjs";
|
|
4
5
|
import { DashboardsError, DashboardsErrorCode } from "./errors.mjs";
|
|
5
6
|
import { ClientOptions, DashboardsClient, DashboardsServer, TypedCall, createDashboardsClient } from "./client.mjs";
|
|
6
|
-
import { DashboardsProvider, DashboardsProviderProps, useDashboards } from "./context.mjs";
|
|
7
|
+
import { Components, DashboardsProvider, DashboardsProviderProps, LinkComponent, LinkProps, useDashboards } from "./context.mjs";
|
|
8
|
+
import { ENGLISH_FILTERS, FilterWords } from "./filters/words.mjs";
|
|
9
|
+
import { FilterBarOptions, FilterIcon } from "./filters/context.mjs";
|
|
10
|
+
import { FilterBarProps, fieldOf, useControlValues, useFilterFields } from "./filters/hooks.mjs";
|
|
11
|
+
import { FilterBar } from "./filters/bar.mjs";
|
|
12
|
+
import { Popover } from "./filters/popover.mjs";
|
|
13
|
+
import { rules_d_exports } from "./filters/rules.mjs";
|
|
7
14
|
import { Dashboard, DashboardProps } from "./Dashboard.mjs";
|
|
8
|
-
import { ENGLISH } from "./english.mjs";
|
|
9
15
|
import { DashboardList } from "./DashboardList.mjs";
|
|
10
16
|
import { Attempt, DraftClosed, DraftEditor, DraftStatus, useDraft } from "./draft.mjs";
|
|
17
|
+
import { ENGLISH } from "./english.mjs";
|
|
18
|
+
import { DashboardDrillProps, DrillEvent } from "./drill/board.mjs";
|
|
19
|
+
import { DashboardTile, DashboardTileProps } from "./drill/DashboardTile.mjs";
|
|
20
|
+
import { DrillPanelProps } from "./drill/DrillPanel.mjs";
|
|
21
|
+
import { ItemHelpers, ItemOptions } from "./drill/Items.mjs";
|
|
22
|
+
import { DrillPanel } from "./drill/lazy.mjs";
|
|
23
|
+
import { DrillMarkProps, TileDrill } from "./drill/props.mjs";
|
|
24
|
+
import { DrillChange, DrillHistory, drillFrom } from "./drill/state.mjs";
|
|
25
|
+
import { DrillController, DrillOptions, useDrill } from "./drill/useDrill.mjs";
|
|
26
|
+
import { DrillMessages, ENGLISH_DRILL } from "./drill/words.mjs";
|
|
11
27
|
import { EditBar } from "./EditBar.mjs";
|
|
12
|
-
import
|
|
28
|
+
import "./FilterBar.mjs";
|
|
13
29
|
import { formatBucket, formatCell, formatInstant, formatTick, plotValue } from "./format.mjs";
|
|
14
30
|
import { HistoryPanel, VersionBar } from "./History.mjs";
|
|
15
31
|
import { CellFormat, Messages } from "./messages.mjs";
|
|
16
32
|
import { ChangeList, Panel } from "./Panel.mjs";
|
|
17
|
-
import { RecordsPanel } from "./Records.mjs";
|
|
18
33
|
import { ReviewPanel } from "./ReviewPanel.mjs";
|
|
19
34
|
import { ClientSchemas } from "./read.mjs";
|
|
20
35
|
import { NumberTile, TableTile, TileRenderer, TileRendererProps } from "./renderers/index.mjs";
|
|
36
|
+
import { ListDisplay, ListTile } from "./renderers/list.mjs";
|
|
21
37
|
import { Moved, Review, useReview } from "./review.mjs";
|
|
22
38
|
import { ENGLISH_REVIEW, ReviewMessages } from "./review-words.mjs";
|
|
39
|
+
import { Drawn, OTHER_KEY, Point, Series, lastBucketOpen, rowAt, toSeries } from "./series.mjs";
|
|
23
40
|
import { Tile } from "./Tile.mjs";
|
|
24
41
|
import { useBoard } from "./useBoard.mjs";
|
|
25
42
|
import { useDashboard } from "./useDashboard.mjs";
|
|
26
43
|
import { useTiles } from "./useTiles.mjs";
|
|
27
|
-
|
|
44
|
+
import { ViewChange } from "./view.mjs";
|
|
45
|
+
import { DrillItem } from "derive-dashboards/core";
|
|
46
|
+
/**
|
|
47
|
+
* Register your server to type drill items by source:
|
|
48
|
+
* `declare module "derive-dashboards/react" { interface Register { server: typeof dashboards } }`.
|
|
49
|
+
* Then `item.source === "order"` narrows `item.key` to the order key's columns.
|
|
50
|
+
*/
|
|
51
|
+
export interface Register {}
|
|
52
|
+
/** A drill item, typed from the registered server's model, or a plain `DrillItem` without one. */
|
|
53
|
+
export type Item = Register extends {
|
|
54
|
+
server: infer S;
|
|
55
|
+
} ? ItemFor<S> : DrillItem;
|
|
56
|
+
export { type Attempt, type Builder, type CellFormat, ChangeList, type ClientOptions, type ClientSchemas, type Components, Dashboard, type DashboardDrillProps, DashboardList, type DashboardProps, DashboardTile, type DashboardTileProps, type DashboardsClient, DashboardsError, type DashboardsErrorCode, DashboardsProvider, type DashboardsProviderProps, type DashboardsServer, type DraftClosed, type DraftEditor, type DraftStatus, type Drawn, type DrillChange, type DrillController, type DrillEvent, type DrillHistory, type DrillMarkProps, type DrillMessages, type DrillOptions, DrillPanel, type DrillPanelProps, ENGLISH, ENGLISH_DRILL, ENGLISH_FILTERS, ENGLISH_REVIEW, EditBar, FilterBar, type FilterBarOptions, type FilterBarProps, type FilterIcon, type FilterWords, HistoryPanel, type ItemFor, type ItemHelpers, type ItemOptions, type LinkComponent, type LinkProps, type ListDisplay, ListTile, type Messages, type Moved, NumberTile, OTHER_KEY, Panel, type Point, Popover, type Review, type ReviewMessages, ReviewPanel, type Series, TableTile, Tile, type TileDrill, type TileRenderer, type TileRendererProps, type TypedCall, VersionBar, type ViewChange, WidgetBuilder, type WidgetBuilderProps, WidgetPreview, createDashboardsClient, drillFrom, fieldOf, rules_d_exports as filterRules, formatBucket, formatCell, formatInstant, formatTick, lastBucketOpen, plotValue, rowAt, toSeries, useBoard, useBuilder, useControlValues, useDashboard, useDashboards, useDraft, useDrill, useFilterFields, useReview, useTiles };
|
package/dist/react/index.mjs
CHANGED
|
@@ -1,25 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { WidgetPreview } from "./builder/Preview.mjs";
|
|
2
3
|
import { useBuilder } from "./builder/useBuilder.mjs";
|
|
3
4
|
import { WidgetBuilder } from "./builder/WidgetBuilder.mjs";
|
|
4
5
|
import { createDashboardsClient } from "./client.mjs";
|
|
5
6
|
import { DashboardsProvider, useDashboards } from "./context.mjs";
|
|
6
|
-
import { DashboardsError } from "./errors.mjs";
|
|
7
7
|
import { Dashboard } from "./Dashboard.mjs";
|
|
8
8
|
import { DashboardList } from "./DashboardList.mjs";
|
|
9
9
|
import { useDraft } from "./draft.mjs";
|
|
10
|
+
import { DashboardTile } from "./drill/DashboardTile.mjs";
|
|
11
|
+
import { DrillPanel } from "./drill/lazy.mjs";
|
|
12
|
+
import { drillFrom } from "./drill/state.mjs";
|
|
13
|
+
import { useDrill } from "./drill/useDrill.mjs";
|
|
14
|
+
import { DashboardsError } from "./errors.mjs";
|
|
15
|
+
import { ENGLISH_DRILL } from "./drill/words.mjs";
|
|
10
16
|
import { EditBar } from "./EditBar.mjs";
|
|
11
|
-
import {
|
|
17
|
+
import { ENGLISH_FILTERS } from "./filters/words.mjs";
|
|
18
|
+
import { FilterBar } from "./filters/bar.mjs";
|
|
19
|
+
import { fieldOf, useControlValues, useFilterFields } from "./filters/hooks.mjs";
|
|
20
|
+
import { rules_exports } from "./filters/rules.mjs";
|
|
21
|
+
import { Popover } from "./filters/popover.mjs";
|
|
12
22
|
import { formatBucket, formatCell, formatInstant, formatTick, plotValue } from "./format.mjs";
|
|
13
23
|
import { HistoryPanel, VersionBar } from "./History.mjs";
|
|
14
24
|
import { ENGLISH } from "./english.mjs";
|
|
15
25
|
import { ChangeList, Panel } from "./Panel.mjs";
|
|
16
|
-
import { RecordsPanel } from "./Records.mjs";
|
|
17
26
|
import { ReviewPanel } from "./ReviewPanel.mjs";
|
|
18
27
|
import { NumberTile, TableTile } from "./renderers/index.mjs";
|
|
28
|
+
import { ListTile } from "./renderers/list.mjs";
|
|
19
29
|
import { useReview } from "./review.mjs";
|
|
20
30
|
import { ENGLISH_REVIEW } from "./review-words.mjs";
|
|
31
|
+
import { OTHER_KEY, lastBucketOpen, rowAt, toSeries } from "./series.mjs";
|
|
21
32
|
import { Tile } from "./Tile.mjs";
|
|
22
33
|
import { useBoard } from "./useBoard.mjs";
|
|
23
34
|
import { useDashboard } from "./useDashboard.mjs";
|
|
24
35
|
import { useTiles } from "./useTiles.mjs";
|
|
25
|
-
export { ChangeList, Dashboard, DashboardList, DashboardsError, DashboardsProvider, ENGLISH, ENGLISH_REVIEW, EditBar, FilterBar, HistoryPanel, NumberTile, Panel,
|
|
36
|
+
export { ChangeList, Dashboard, DashboardList, DashboardTile, DashboardsError, DashboardsProvider, DrillPanel, ENGLISH, ENGLISH_DRILL, ENGLISH_FILTERS, ENGLISH_REVIEW, EditBar, FilterBar, HistoryPanel, ListTile, NumberTile, OTHER_KEY, Panel, Popover, ReviewPanel, TableTile, Tile, VersionBar, WidgetBuilder, WidgetPreview, createDashboardsClient, drillFrom, fieldOf, rules_exports as filterRules, formatBucket, formatCell, formatInstant, formatTick, lastBucketOpen, plotValue, rowAt, toSeries, useBoard, useBuilder, useControlValues, useDashboard, useDashboards, useDraft, useDrill, useFilterFields, useReview, useTiles };
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { BuilderMessages } from "./builder/words.mjs";
|
|
2
|
+
import { DrillMessages } from "./drill/words.mjs";
|
|
3
|
+
import { FilterWords } from "./filters/words.mjs";
|
|
1
4
|
import { ReviewMessages } from "./review-words.mjs";
|
|
2
5
|
import { ENGLISH } from "./english.mjs";
|
|
3
6
|
import { RelativeRange } from "derive-dashboards/core";
|
|
@@ -5,7 +8,7 @@ import { RelativeRange } from "derive-dashboards/core";
|
|
|
5
8
|
* Every word the built-in components show. English by default; pass `messages` to the
|
|
6
9
|
* provider to change any of them, for another language or another house style.
|
|
7
10
|
*/
|
|
8
|
-
export type Messages = ReviewMessages & {
|
|
11
|
+
export type Messages = ReviewMessages & DrillMessages & BuilderMessages & {
|
|
9
12
|
/** A dimension cell for the values a limit left out. */
|
|
10
13
|
other: string;
|
|
11
14
|
/** A dimension cell for every value: a total row. */
|
|
@@ -18,7 +21,11 @@ export type Messages = ReviewMessages & {
|
|
|
18
21
|
noAccess: string;
|
|
19
22
|
noData: string;
|
|
20
23
|
noRows: string;
|
|
24
|
+
/** Beside the last time bucket while it is still running: its value is not final yet. */
|
|
25
|
+
soFar: string;
|
|
21
26
|
dashboardFailed: string;
|
|
27
|
+
/** A dashboard already shown, while the server cannot be reached. */
|
|
28
|
+
dashboardUnreachable: string;
|
|
22
29
|
/** A dashboard this viewer cannot find: never published, removed, or not shared with them. */
|
|
23
30
|
dashboardMissing: string;
|
|
24
31
|
rowsFailed: string;
|
|
@@ -26,11 +33,15 @@ export type Messages = ReviewMessages & {
|
|
|
26
33
|
rows: string;
|
|
27
34
|
close: string;
|
|
28
35
|
showMore: string;
|
|
36
|
+
/** How many rows the rows panel shows, and whether there are more. */
|
|
37
|
+
rowsShowing: (n: number, more: boolean) => string;
|
|
29
38
|
reset: string;
|
|
39
|
+
/** The filter bar's words; any subset, the rest stay English. */
|
|
40
|
+
filterBar?: Partial<FilterWords>;
|
|
30
41
|
rowsBehind: (title: string) => string;
|
|
31
42
|
notFilteredBy: (controls: readonly string[]) => string;
|
|
32
43
|
firstRows: (count: number) => string;
|
|
33
|
-
/** A date-range preset: "Last 7 days", "This month", "Last 3
|
|
44
|
+
/** A date-range preset: "Today", "Last 7 days", "This month", "Last month", "Previous 3 months". */
|
|
34
45
|
range: (range: RelativeRange) => string;
|
|
35
46
|
untitledWidget: string;
|
|
36
47
|
save: string;
|
|
@@ -82,6 +93,24 @@ export type Messages = ReviewMessages & {
|
|
|
82
93
|
refOf: Record<"total" | "bucket" | "previous", string>;
|
|
83
94
|
/** Under Over time: calcs a change of time removed, since they no longer fit. */
|
|
84
95
|
removedCalcs: (names: readonly string[]) => string;
|
|
96
|
+
/** Under a chart: the values it does not draw, which the table shows. */
|
|
97
|
+
notDrawn: (labels: readonly string[]) => string;
|
|
98
|
+
/** A chart's data table caption, read by screen readers in place of the picture. */
|
|
99
|
+
chartTable: (chart: {
|
|
100
|
+
title: string;
|
|
101
|
+
kind: "line" | "bar";
|
|
102
|
+
points: number;
|
|
103
|
+
}) => string;
|
|
104
|
+
/** The name of a chart's list of points to open; arrow keys move along it. */
|
|
105
|
+
chartPoints: string;
|
|
106
|
+
/** What the builder keeps as it was, though it cannot edit it. */
|
|
107
|
+
keptAside: (kept: {
|
|
108
|
+
display: boolean;
|
|
109
|
+
queries: readonly string[];
|
|
110
|
+
fields: readonly string[];
|
|
111
|
+
}) => string;
|
|
112
|
+
/** A widget the builder cannot open: it has no main query to edit. */
|
|
113
|
+
noMainQuery: (title: string) => string;
|
|
85
114
|
/** Under the chart kinds: which dashboard filters the widget will follow. */
|
|
86
115
|
followsFilters: (labels: readonly string[]) => string;
|
|
87
116
|
/** The grip that reorders a group. */
|
|
@@ -93,6 +122,8 @@ export type Messages = ReviewMessages & {
|
|
|
93
122
|
editing: string;
|
|
94
123
|
publish: string;
|
|
95
124
|
discard: string;
|
|
125
|
+
/** Leaving edit mode with no changes: nothing to discard, so nothing is asked. */
|
|
126
|
+
doneEditing: string;
|
|
96
127
|
addWidget: string;
|
|
97
128
|
addToDashboard: string;
|
|
98
129
|
/** Screen-reader names of a tile's Edit and Remove, which say which tile. */
|
|
@@ -123,8 +154,16 @@ export type Messages = ReviewMessages & {
|
|
|
123
154
|
keepEditing: string;
|
|
124
155
|
/** An edit that never reached the server: offline, or the server is down. */
|
|
125
156
|
unreachable: string;
|
|
157
|
+
/** Said when a tile is removed while editing. */
|
|
158
|
+
removedTile: (title: string) => string;
|
|
126
159
|
/** A tile whose request failed before any answer came. */
|
|
127
160
|
tileUnreachable: string;
|
|
161
|
+
/** A list (a field's values, the history) that could not be read; with drillRetry beside it. */
|
|
162
|
+
readFailed: string;
|
|
163
|
+
/** A field with no values this viewer can see (or none matching the search). */
|
|
164
|
+
noValues: string;
|
|
165
|
+
/** Copy refused by the browser: the text is shown to copy by hand. */
|
|
166
|
+
copyByHand: string;
|
|
128
167
|
/** Said once a draft is discarded, as focus returns to Edit. */
|
|
129
168
|
changesDiscarded: string;
|
|
130
169
|
/** Draft refusals, in words that say what to do. */
|
|
@@ -136,6 +175,10 @@ export type Messages = ReviewMessages & {
|
|
|
136
175
|
untitledDashboard: string;
|
|
137
176
|
/** Beside a dashboard only its maker sees yet. */
|
|
138
177
|
unpublished: string;
|
|
178
|
+
/** Over the dashboards the app ships (`default:` ids), when the list has others too. */
|
|
179
|
+
builtIn: string;
|
|
180
|
+
/** Over the dashboards made in the app, under the built-in ones. */
|
|
181
|
+
madeHere: string;
|
|
139
182
|
dashboardTitle: string;
|
|
140
183
|
history: string;
|
|
141
184
|
noHistory: string;
|
|
@@ -152,8 +195,10 @@ export type Messages = ReviewMessages & {
|
|
|
152
195
|
previewFailed: string;
|
|
153
196
|
};
|
|
154
197
|
/** What formatting reads besides a cell and its column: the locale, and the words to show. */
|
|
198
|
+
/** What formatting a cell reads besides its column: the locale, the words, and the zone times show in. */
|
|
155
199
|
export type CellFormat = {
|
|
156
200
|
locale?: string | undefined;
|
|
157
201
|
messages?: Messages;
|
|
202
|
+
timeZone?: string | undefined;
|
|
158
203
|
};
|
|
159
204
|
export { ENGLISH };
|
package/dist/react/place.mjs
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { useEffect, useRef } from "react";
|
|
2
2
|
// src/place.ts
|
|
3
3
|
const overlaps = (a, b) => a.x < b.x + b.w && b.x < a.x + a.w && a.y < b.y + b.h && b.y < a.y + a.h;
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* Where a box is drawn on the 12-column CSS grid, as variables the theme places it by: a rule
|
|
6
|
+
* (the one-column phone layout, or a host's own) can then place it otherwise, which an inline
|
|
7
|
+
* grid position would always beat.
|
|
8
|
+
*/
|
|
5
9
|
const placeOf = (box) => ({
|
|
6
|
-
|
|
7
|
-
|
|
10
|
+
"--dd-at-column": `${String(box.x + 1)} / span ${String(box.w)}`,
|
|
11
|
+
"--dd-at-row": `${String(box.y + 1)} / span ${String(box.h)}`
|
|
8
12
|
});
|
|
9
13
|
/** Brings an element into view when asked, without motion if the viewer asked for none. */
|
|
10
14
|
function useBringIntoView(wanted) {
|
|
@@ -1,17 +1,25 @@
|
|
|
1
|
+
import { LinkComponent } from "../context.mjs";
|
|
2
|
+
import { TileDrill } from "../drill/props.mjs";
|
|
1
3
|
import { Messages } from "../messages.mjs";
|
|
2
4
|
import { ReactNode } from "react";
|
|
3
5
|
import { TileAnswer, Widget } from "derive-dashboards/core";
|
|
4
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* What a renderer draws, and how: pass the props as `formatCell`'s format to use both. `drill`
|
|
8
|
+
* is there when drilling is on: spread `drill.props(row, entry)` on a mark to make it open.
|
|
9
|
+
*/
|
|
5
10
|
export type TileRendererProps = {
|
|
6
11
|
answer: TileAnswer;
|
|
7
12
|
widget: Widget;
|
|
8
13
|
locale?: string;
|
|
9
14
|
messages: Messages;
|
|
15
|
+
drill?: TileDrill;
|
|
16
|
+
/** The provider's link component, for a renderer that links rows into the app. */
|
|
17
|
+
link?: LinkComponent;
|
|
10
18
|
};
|
|
11
19
|
/** Draws one tile's answer. Register more by widget kind on the provider. */
|
|
12
20
|
export type TileRenderer = (props: TileRendererProps) => ReactNode;
|
|
13
21
|
/**
|
|
14
|
-
* The first value column, large, from the total row when there is one, else the first row;
|
|
22
|
+
* The first calc or value column, large, from the total row when there is one, else the first row;
|
|
15
23
|
* a change calc (a signed column) sits under it.
|
|
16
24
|
*/
|
|
17
25
|
export declare function NumberTile(props: TileRendererProps): import("react").JSX.Element;
|