@casoon/opengrid 0.14.0 → 0.16.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.
Files changed (33) hide show
  1. package/CHANGELOG.md +621 -19
  2. package/README.md +19 -2
  3. package/engine/opengrid_wasm_bg.wasm +0 -0
  4. package/loader.d.ts +451 -24
  5. package/loader.js +584 -132
  6. package/package.json +13 -6
  7. package/pkg/opengrid_web_components.d.ts +94 -23
  8. package/pkg/opengrid_web_components.js +451 -59
  9. package/pkg/opengrid_web_components_bg.wasm +0 -0
  10. package/pkg/opengrid_web_components_bg.wasm.d.ts +15 -6
  11. package/pkg/snippets/opengrid-web-components-35ed06b453a9b215/inline0.js +8 -0
  12. package/pkg/snippets/opengrid-web-components-35ed06b453a9b215/inline1.js +58 -0
  13. package/pkg/snippets/opengrid-web-core-b41714d4e7311909/inline2.js +89 -0
  14. package/react/index.d.ts +20 -2
  15. package/react/index.js +32 -6
  16. package/svelte/Opengrid.svelte +46 -11
  17. package/svelte/OpengridGrid.svelte +20 -1
  18. package/svelte/OpengridPivot.svelte +3 -3
  19. package/svelte/OpengridTable.svelte +1 -1
  20. package/svelte/index.d.ts +57 -18
  21. package/svelte/index.js +1 -1
  22. package/texts/de.d.ts +5 -0
  23. package/texts/de.js +245 -0
  24. package/vue/index.d.ts +49 -7
  25. package/vue/index.js +41 -11
  26. package/worker.js +6 -3
  27. package/xlsx/opengrid_xlsx.d.ts +69 -0
  28. package/xlsx/opengrid_xlsx.js +375 -0
  29. package/xlsx/opengrid_xlsx_bg.wasm +0 -0
  30. package/xlsx/opengrid_xlsx_bg.wasm.d.ts +16 -0
  31. package/pkg/snippets/opengrid-web-components-56667a20e9158a6a/inline0.js +0 -17
  32. /package/pkg/snippets/{opengrid-web-core-a3505e32fee0c1ed → opengrid-web-core-b41714d4e7311909}/inline0.js +0 -0
  33. /package/pkg/snippets/{opengrid-web-core-a3505e32fee0c1ed → opengrid-web-core-b41714d4e7311909}/inline1.js +0 -0
package/svelte/index.d.ts CHANGED
@@ -1,10 +1,12 @@
1
1
  /**
2
- * Types for `@casoon/opengrid/svelte` (plan point 79).
2
+ * Types for `@casoon/opengrid/svelte`.
3
3
  *
4
4
  * The props are the element's attributes in camelCase plus the options of
5
5
  * `connect` from `@casoon/opengrid`, with the callbacks in Svelte's own
6
- * spelling — `onviewchange`, `onselectionchange`, `oncellchange` — `view`
7
- * bindable (`bind:view`), and the element itself through `bind:element`.
6
+ * spelling — `onviewchange`, `onselectionchange`, `oncellchange`, `onrowadd`,
7
+ * `onpaste`, `onbulkchange`, `onrowaction`, `onsourcereplaced` — `view`
8
+ * bindable (`bind:view`), the element itself through `bind:element`, and the
9
+ * grid's `setCellState` and `setValues` through `bind:this`.
8
10
  * Everything else (`id`, `class`, `style`, `aria-*`) goes to the element.
9
11
  *
10
12
  * `view` is controlled through `bind:view`: a binding whose setter refuses the
@@ -16,27 +18,58 @@
16
18
  import type { Component } from "svelte";
17
19
  import type { HTMLAttributes } from "svelte/elements";
18
20
  import type {
21
+ BulkChangeDetail,
19
22
  CellChangeDetail,
23
+ CellWrites,
20
24
  ConnectOptions,
21
25
  Density,
22
26
  Theme,
23
27
  Mode,
24
28
  PivotConnectOptions,
29
+ PasteDetail,
25
30
  PivotView,
31
+ DrillDownDetail,
32
+ RowActionDetail,
26
33
  SelectionChangeDetail,
34
+ SourceReplacedDetail,
27
35
  View,
28
36
  } from "../loader.js";
29
37
 
30
- /** `connect`'s options, the callbacks in Svelte's spelling. */
31
- type Options = Omit<ConnectOptions, "onViewChange" | "onSelectionChange" | "onCellChange"> & {
38
+ /** The callbacks of `connect`, which take Svelte's spelling here. */
39
+ type Callbacks =
40
+ | "onViewChange"
41
+ | "onSelectionChange"
42
+ | "onCellChange"
43
+ | "onRowAdd"
44
+ | "onPaste"
45
+ | "onBulkChange"
46
+ | "onRowAction"
47
+ | "onDrillDown"
48
+ | "onSourceReplaced";
49
+
50
+ /** The callbacks every component has, in Svelte's spelling. */
51
+ type SvelteCallbacks = {
32
52
  /** The element, for `bind:element`. */
33
53
  element?: HTMLElement;
34
- /** The reader changed the view; `bind:view` has it already. */
35
- onviewchange?: (view: View) => void;
36
54
  onselectionchange?: (detail: SelectionChangeDetail) => void;
37
55
  oncellchange?: (detail: CellChangeDetail) => void;
56
+ /** Answers with the new row's state, as `onRowAdd` does in `connect`. */
57
+ onrowadd?: ConnectOptions["onRowAdd"];
58
+ onpaste?: (detail: PasteDetail) => void;
59
+ onbulkchange?: (detail: BulkChangeDetail) => void;
60
+ onrowaction?: (detail: RowActionDetail) => void;
61
+ /** The pivot only: a value was pressed, with `drillDown`. */
62
+ ondrilldown?: (detail: DrillDownDetail) => void;
63
+ onsourcereplaced?: (detail: SourceReplacedDetail) => void;
38
64
  };
39
65
 
66
+ /** `connect`'s options, the callbacks in Svelte's spelling. */
67
+ type Options = Omit<ConnectOptions, Callbacks> &
68
+ SvelteCallbacks & {
69
+ /** The reader changed the view; `bind:view` has it already. */
70
+ onviewchange?: (view: View) => void;
71
+ };
72
+
40
73
  /** What the element itself takes, minus what the component owns. */
41
74
  type ElementProps = Omit<HTMLAttributes<HTMLElement>, "children" | keyof Options>;
42
75
 
@@ -52,16 +85,24 @@ export interface OpengridGridProps extends Options, ElementProps {
52
85
  /** Switches from scrolling to paging. */
53
86
  pageSize?: number;
54
87
  mode?: Mode;
55
- /** Up to two columns, outermost first: `"country,customer"`. */
88
+ /** Up to three columns, outermost first: `"country,customer"`. */
56
89
  groupBy?: string;
57
90
  /** The field holding a row's parent key: the rows show as a tree. */
58
91
  tree?: string;
59
92
  /** The field the parent key refers to; `id` when absent. */
60
93
  treeKey?: string;
94
+ /** The field that names a record: `key` in the editing events. */
95
+ rowKey?: string;
96
+ /** The page's filter, as the wire's JSON; and-ed onto every query, not in the view. */
97
+ filter?: string;
98
+ /** An empty row after the last one to type a new record into (`onrowadd`). */
99
+ addRow?: boolean;
61
100
  search?: boolean;
62
101
  facets?: boolean;
63
102
  toolbar?: boolean;
64
103
  columnMenu?: boolean;
104
+ /** *Advanced filter* in the toolbar: the builder of the nested filter. */
105
+ filterBuilder?: boolean;
65
106
  selection?: boolean;
66
107
  density?: Density;
67
108
  /** One of the built-in looks; Base when absent. */
@@ -76,15 +117,10 @@ export interface OpengridTableProps extends Options, ElementProps {
76
117
  }
77
118
 
78
119
  /** The pivot's options: its view is a `PivotView`. */
79
- type PivotOptions = Omit<
80
- PivotConnectOptions,
81
- "onViewChange" | "onSelectionChange" | "onCellChange"
82
- > & {
83
- element?: HTMLElement;
84
- onviewchange?: (view: PivotView) => void;
85
- onselectionchange?: (detail: SelectionChangeDetail) => void;
86
- oncellchange?: (detail: CellChangeDetail) => void;
87
- };
120
+ type PivotOptions = Omit<PivotConnectOptions, Callbacks> &
121
+ SvelteCallbacks & {
122
+ onviewchange?: (view: PivotView) => void;
123
+ };
88
124
 
89
125
  export interface OpengridPivotProps extends PivotOptions, ElementProps {
90
126
  label?: string;
@@ -107,9 +143,12 @@ export interface OpengridPivotProps extends PivotOptions, ElementProps {
107
143
  measures?: string;
108
144
  /** The filter on the raw rows, as the wire's JSON; part of the view. */
109
145
  filter?: string;
146
+ /** Makes every value a button that calls `ondrilldown`. */
147
+ drillDown?: boolean;
110
148
  theme?: Theme;
111
149
  }
112
150
 
113
- export const OpengridGrid: Component<OpengridGridProps, {}, "view" | "element">;
151
+ /** What `bind:this` on `OpengridGrid` gives: the connection's cell writes. */
152
+ export const OpengridGrid: Component<OpengridGridProps, CellWrites, "view" | "element">;
114
153
  export const OpengridTable: Component<OpengridTableProps, {}, "view" | "element">;
115
154
  export const OpengridPivot: Component<OpengridPivotProps, {}, "view" | "element">;
package/svelte/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Svelte 5 components for `@casoon/opengrid` (plan point 79, E32).
2
+ * Svelte 5 components for `@casoon/opengrid`.
3
3
  *
4
4
  * Shipped as `.svelte` sources, the Svelte convention: the page's bundler
5
5
  * compiles them with the page's Svelte. The three components are thin: each
package/texts/de.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import type { Texts } from "../loader.js";
2
+
3
+ /** German for every text of the three elements, with `lang: "de"`. */
4
+ declare const texts: Texts;
5
+ export default texts;
package/texts/de.js ADDED
@@ -0,0 +1,245 @@
1
+ // German for everything `<opengrid-grid>`, `<opengrid-table>` and
2
+ // `<opengrid-pivot>` write themselves — hand it to `set_texts`, or to the
3
+ // `texts` of `connect` and the framework components. `lang` goes with it, so
4
+ // the words are announced in a German voice whatever the page's language is.
5
+ //
6
+ // The object is written as JSON — quoted keys, no trailing comma — because a
7
+ // test reads it that way: `every_shipped_language_has_every_key`
8
+ // (crates/opengrid-web-components/src/texts.rs) fails when a key the elements
9
+ // know is missing here, when one is here that they do not know, or when a text
10
+ // lost a placeholder its English default has.
11
+ export default {
12
+ "lang": "de",
13
+ "loading": "Wird geladen …",
14
+ "matchesOne": "{count} Treffer",
15
+ "matchesOther": "{count} Treffer",
16
+ "empty": "Keine Treffer",
17
+ "error": "Die Daten konnten nicht geladen werden: {cause}",
18
+ "errorUnknown": "Die Daten konnten nicht geladen werden.",
19
+ "filterGroup": "Filter",
20
+ "operatorLabel": "{column} Bedingung",
21
+ "valueLabel": "{column} Wert",
22
+ "clear": "Leeren",
23
+ "selectAll": "Alle Treffer auswählen",
24
+ "selectedAll": "{count} Zeilen ausgewählt",
25
+ "groupRow": "{column}: {value} ({rows})",
26
+ "rowsOne": "1 Zeile",
27
+ "rowsOther": "{count} Zeilen",
28
+ "groupExpanded": "{group} aufgeklappt, {rows}",
29
+ "groupCollapsed": "{group} zugeklappt",
30
+ "groupInvalid": "Gruppieren nach {column} ist nicht möglich",
31
+ "totalRow": "Gesamt ({rows})",
32
+ "aggregateCell": "{aggregate}: {value}",
33
+ "aggregateSum": "Summe",
34
+ "aggregateAvg": "Durchschnitt",
35
+ "aggregateCount": "Anzahl",
36
+ "aggregateMin": "Minimum",
37
+ "aggregateMax": "Maximum",
38
+ "aggregateRange": "Spanne",
39
+ "columnMenu": "Spaltenmenü {column}",
40
+ "sortAscending": "Aufsteigend sortieren",
41
+ "sortDescending": "Absteigend sortieren",
42
+ "sortKey": "Sortierschlüssel {position}",
43
+ "filterColumn": "Filtern …",
44
+ "aggregateGroup": "Aggregat in Gruppen",
45
+ "aggregateNone": "Kein Aggregat",
46
+ "groupByColumn": "Nach dieser Spalte gruppieren",
47
+ "groupSecondLevel": "Als 2. Ebene gruppieren",
48
+ "ungroupColumn": "Gruppierung aufheben",
49
+ "hideColumn": "Spalte ausblenden",
50
+ "hideBand": "Band ausblenden",
51
+ "bandKeep": "{band} ist alles, was angezeigt wird, und bleibt",
52
+ "pinGroup": "Fixieren",
53
+ "pinNone": "Nicht fixiert",
54
+ "pinStart": "Am Anfang",
55
+ "pinEnd": "Am Ende",
56
+ "toolbarGroup": "Werkzeuge",
57
+ "filterRowToggle": "Filterzeile",
58
+ "densityGroup": "Dichte",
59
+ "densityCompact": "Kompakt",
60
+ "densityNormal": "Normal",
61
+ "densityComfortable": "Luftig",
62
+ "chipsGroup": "Aktive Filter",
63
+ "chipRemove": "{filter} entfernen",
64
+ "chipsClear": "Alle entfernen",
65
+ "filterRemoved": "{filter} entfernt",
66
+ "filtersCleared": "Alle Filter entfernt",
67
+ "groupChip": "Gruppiert nach {columns}",
68
+ "facetsGroup": "Facetten",
69
+ "facetsToggle": "Facetten",
70
+ "facetsReset": "Zurücksetzen",
71
+ "facetFrom": "Von",
72
+ "facetTo": "Bis",
73
+ "facetQueries": "Gezählt mit {count} Abfragen",
74
+ "facetChipValues": "{column} ist eines von {values}",
75
+ "addFilter": "+ Filter",
76
+ "addFilterTitle": "Filter hinzufügen",
77
+ "filterColumnLabel": "Spalte",
78
+ "filterConditionLabel": "Bedingung",
79
+ "filterValueLabel": "Wert",
80
+ "cancel": "Abbrechen",
81
+ "apply": "Anwenden",
82
+ "addGrouping": "+ Gruppieren",
83
+ "groupingFull": "Schon nach drei Spalten gruppiert",
84
+ "pivotToolbar": "Pivot-Felder",
85
+ "pivotRows": "Zeilen",
86
+ "pivotColumns": "Spalten",
87
+ "pivotMeasures": "Kennzahlen",
88
+ "addRow": "+ Zeile",
89
+ "addColumn": "+ Spalte",
90
+ "addMeasure": "+ Kennzahl",
91
+ "columnFull": "Schon zwei Spaltenfelder",
92
+ "nothingToAdd": "Nichts mehr hinzuzufügen",
93
+ "fieldRemove": "{field} entfernen",
94
+ "fieldEarlier": "{field} nach vorn verschieben",
95
+ "fieldLater": "{field} nach hinten verschieben",
96
+ "pivotFilters": "Filter",
97
+ "pivotFilterLabel": "Filter hinzufügen",
98
+ "pivotFilterHint": "Feld = Wert · Enter",
99
+ "pivotDrillDown": "{value}, Zeilen anzeigen",
100
+ "pivotShowAs": "{field} anzeigen als: {calc}",
101
+ "calcValue": "Wert",
102
+ "shareOfRow": "Anteil an der Zeile",
103
+ "shareOfColumn": "Anteil an der Spalte",
104
+ "shareOfTotal": "Anteil am Gesamtergebnis",
105
+ "runningTotal": "laufende Summe",
106
+ "treeContext": "Kontext",
107
+ "subtreeCell": "{shown}, {aggregate} im Teilbaum",
108
+ "subtreeOnly": "{shown}, {aggregate} im Teilbaum",
109
+ "treeOrphans": "Ohne Elternzeile, oben angezeigt: {count}",
110
+ "treeLevelTooLarge": "{count} Zeilen auf einer Ebene; eine Ebene fasst höchstens {max} – bitte filtern",
111
+ "treeRefused": "Kein Baum mit page-size: Ein Baum scrollt",
112
+ "treeGroupIgnored": "group-by wird in einem Baum nicht verwendet",
113
+ "filterAny": "beliebig",
114
+ "booleanTrue": "ja",
115
+ "booleanFalse": "nein",
116
+ "sourceLocal": "lokal · wasm",
117
+ "sourceWorker": "Worker · wasm",
118
+ "sourceRemote": "Server",
119
+ "sourceHybrid": "hybrid",
120
+ "queriesOne": "{count} Abfrage",
121
+ "queriesOther": "{count} Abfragen",
122
+ "searchLabel": "Suchen oder filtern",
123
+ "searchPlaceholder": "Suchen oder filtern: Land = DE und Betrag ≥ 10",
124
+ "queryAnd": "und",
125
+ "searchHint": "Abfrage · Enter",
126
+ "searchSuggestions": "Spalten",
127
+ "typeText": "Text",
128
+ "typeBool": "ja/nein",
129
+ "typeInteger": "Ganzzahl",
130
+ "typeNumber": "Zahl",
131
+ "typeDate": "Datum",
132
+ "typeTime": "Zeitpunkt",
133
+ "searchChip": "Text enthält „{text}“",
134
+ "queryUnknownColumn": "{column} ist keine Spalte dieses Grids",
135
+ "queryMissingValue": "{column}: der Wert fehlt",
136
+ "queryWrongOperator": "{column} kennt {operator} nicht",
137
+ "queryOr": "oder",
138
+ "queryUnclosed": "Eine Klammer ist nicht geschlossen",
139
+ "queryUnopened": "Eine schließende Klammer hat keine öffnende",
140
+ "queryMissingCondition": "Eine Bedingung fehlt",
141
+ "queryMissingJoin": "Vor „{text}“ fehlt „{and}“ oder „{or}“",
142
+ "filterBuilder": "Erweiterter Filter",
143
+ "filterBuilderJoin": "Zeilen erfüllen",
144
+ "filterBuilderAll": "alle Bedingungen",
145
+ "filterBuilderAny": "mindestens eine Bedingung",
146
+ "filterBuilderCondition": "Bedingung {number}",
147
+ "filterBuilderGroup": "Gruppe {number}",
148
+ "filterBuilderAddCondition": "+ Bedingung",
149
+ "filterBuilderAddGroup": "+ Gruppe",
150
+ "filterBuilderEdit": "{filter} bearbeiten",
151
+ "filterApplied": "Filter gesetzt: {filter}",
152
+ "emptyFiltered": "Für diese Filter gibt es keine Zeilen.",
153
+ "emptySource": "Es gibt keine Zeilen.",
154
+ "emptyReset": "Filter zurücksetzen",
155
+ "filterInvalid": "{column}: {value} ist kein Wert dieser Spalte",
156
+ "cellRequired": "{column} braucht einen Wert",
157
+ "newRow": "Neue Zeile",
158
+ "choicesOne": "1 Auswahlmöglichkeit",
159
+ "choicesOther": "{count} Auswahlmöglichkeiten",
160
+ "choiceRefused": "„{value}“ ist keine der Auswahlmöglichkeiten",
161
+ "listItemAdded": "{value} hinzugefügt",
162
+ "listItemRemoved": "{value} entfernt",
163
+ "listItemRemove": "{value} entfernen",
164
+ "typeList": "Liste",
165
+ "undoCell": "Rückgängig gemacht: {column} in Zeile {row}",
166
+ "redoCell": "Wiederholt: {column} in Zeile {row}",
167
+ "undoAdded": "Rückgängig gemacht: Zeile hinzugefügt",
168
+ "redoAdded": "Wiederholt: Zeile hinzugefügt",
169
+ "undoPaste": "Rückgängig gemacht: Einfügen, {count} Werte",
170
+ "redoPaste": "Wiederholt: Einfügen, {count} Werte",
171
+ "undoRecord": "Rückgängig gemacht: Datensatz {row}, {count} Felder",
172
+ "redoRecord": "Wiederholt: Datensatz {row}, {count} Felder",
173
+ "recordTitle": "Datensatz {row} bearbeiten",
174
+ "recordSave": "Speichern",
175
+ "recordDone": "Datensatz {row} gespeichert, {count} Felder geändert",
176
+ "recordNothing": "Datensatz {row}: kein Feld geändert",
177
+ "rangeSize": "{rows} mal {cols} Zellen",
178
+ "rangeCopied": "{rows} mal {cols} Zellen kopiert",
179
+ "rangeUnloaded": "Nicht kopiert: der Bereich reicht über Zeilen, die nicht geladen sind",
180
+ "sourceChanged": "Die Daten haben sich geändert. Aktualisieren, um sie zu sehen.",
181
+ "sourceRefresh": "Aktualisieren",
182
+ "detailShow": "Details anzeigen",
183
+ "detailHide": "Details ausblenden",
184
+ "detailPanel": "Details",
185
+ "detailShown": "Details angezeigt",
186
+ "detailHidden": "Details ausgeblendet",
187
+ "undoNothing": "Nichts rückgängig zu machen",
188
+ "redoNothing": "Nichts zu wiederholen",
189
+ "validationWarning": "Warnung: {message}",
190
+ "validationError": "Fehler: {message}",
191
+ "bulkCaption": "{column} für die Auswahl setzen ({rows})",
192
+ "bulkApply": "Setzen",
193
+ "bulkMenu": "Für ausgewählte Zeilen setzen",
194
+ "bulkReadonly": "{column} ist schreibgeschützt",
195
+ "bulkDone": "{column} für {rows} gesetzt",
196
+ "pastePreview": "Einfügevorschau",
197
+ "pasteApply": "Einfügen",
198
+ "pasteDiscard": "Verwerfen",
199
+ "pasteUnreadable": "„{value}“ ist nicht als {type} lesbar",
200
+ "pasteBadOne": "1 Wert nicht lesbar",
201
+ "pasteBadOther": "{count} Werte nicht lesbar",
202
+ "pasteCutOff": "{count} Werte hinter dem Ende werden nicht eingefügt",
203
+ "pasteApplied": "{count} Werte eingefügt",
204
+ "pasteDiscarded": "Einfügen verworfen",
205
+ "pasteBlocked": "Nicht eingefügt: {problems}. Verwerfen und erneut einfügen.",
206
+ "rowAdded": "Zeile hinzugefügt, {count} noch nicht gespeichert",
207
+ "columnWidth": "{column} ist {width} Pixel breit",
208
+ "columnMoved": "{column} an Position {position} von {count} verschoben",
209
+ "columnAtEdge": "{column} ist schon am Rand",
210
+ "columnPinnedStart": "{column} am Anfang fixiert",
211
+ "columnPinnedEnd": "{column} am Ende fixiert",
212
+ "columnUnpinned": "{column} nicht mehr fixiert",
213
+ "pinsReleased": "Zu schmal für die fixierten Spalten: Sie scrollen mit den anderen",
214
+ "columnHidden": "{column} ausgeblendet, {visible} von {count} Spalten sichtbar",
215
+ "columnShown": "{column} eingeblendet, {visible} von {count} Spalten sichtbar",
216
+ "columnsGroup": "Spalten",
217
+ "pageFirst": "Erste Seite",
218
+ "pagePrevious": "Vorige Seite",
219
+ "pageNext": "Nächste Seite",
220
+ "pageLast": "Letzte Seite",
221
+ "pageOf": "Seite {page} von {pages}",
222
+ "selectionCleared": "Auswahl aufgehoben",
223
+ "selectionMissing": "{count} ausgewählte Zeilen gibt es nicht mehr",
224
+ "noValue": "(kein Wert)",
225
+ "emptyValue": "(leer)",
226
+ "total": "Gesamt",
227
+ "subtotal": "Gesamt {value}",
228
+ "operators": {
229
+ "contains": "enthält",
230
+ "starts_with": "beginnt mit",
231
+ "icontains": "enthält (Groß-/Kleinschreibung egal)",
232
+ "istarts_with": "beginnt mit (Groß-/Kleinschreibung egal)",
233
+ "eq": "ist",
234
+ "ne": "ist nicht",
235
+ "gt": "größer als",
236
+ "gte": "größer oder gleich",
237
+ "lt": "kleiner als",
238
+ "lte": "kleiner oder gleich",
239
+ "is_null": "hat keinen Wert",
240
+ "is_not_null": "hat einen Wert",
241
+ "has": "enthält",
242
+ "has_all": "enthält alle",
243
+ "is_empty": "ist leer"
244
+ }
245
+ };
package/vue/index.d.ts CHANGED
@@ -1,27 +1,47 @@
1
1
  /**
2
- * Types for `@casoon/opengrid/vue` (plan point 78).
2
+ * Types for `@casoon/opengrid/vue`.
3
3
  *
4
4
  * The props are the element's attributes in camelCase plus the options of
5
5
  * `connect` from `@casoon/opengrid`; the callbacks are Vue events instead:
6
- * `update:view` (so `v-model:view` works), `selectionChange` and `cellChange`
7
- * — `@selection-change` and `@cell-change` in a template.
6
+ * `update:view` (so `v-model:view` works), `selectionChange`, `cellChange`,
7
+ * `paste`, `bulkChange`, `rowAction` and `sourceReplaced` — `@selection-change`
8
+ * and so on in a template. `onRowAdd` stays a prop, because its answer is the
9
+ * new row's state; a template writes it as `@row-add` all the same.
8
10
  */
9
11
 
10
12
  import type { DefineSetupFnComponent } from "vue";
11
13
  import type {
14
+ BulkChangeDetail,
12
15
  CellChangeDetail,
16
+ CellWrites,
13
17
  ConnectOptions,
14
18
  Density,
15
19
  Theme,
16
20
  Mode,
17
21
  PivotConnectOptions,
22
+ OpengridGridElement,
23
+ PasteDetail,
18
24
  PivotView,
25
+ DrillDownDetail,
26
+ RowActionDetail,
19
27
  SelectionChangeDetail,
28
+ SourceReplacedDetail,
20
29
  View,
21
30
  } from "../loader.js";
22
31
 
23
- /** `connect`'s options, less the callbacks — those are events here. */
24
- type Options = Omit<ConnectOptions, "onViewChange" | "onSelectionChange" | "onCellChange">;
32
+ /** The callbacks of `connect` that are events here. */
33
+ type Callbacks =
34
+ | "onViewChange"
35
+ | "onSelectionChange"
36
+ | "onCellChange"
37
+ | "onPaste"
38
+ | "onBulkChange"
39
+ | "onRowAction"
40
+ | "onDrillDown"
41
+ | "onSourceReplaced";
42
+
43
+ /** `connect`'s options, less the callbacks that are events. */
44
+ type Options = Omit<ConnectOptions, Callbacks>;
25
45
 
26
46
  /** A type, not an interface: Vue's `EmitsOptions` wants an index signature. */
27
47
  export type OpengridEmits = {
@@ -29,8 +49,20 @@ export type OpengridEmits = {
29
49
  "update:view": (view: View) => void;
30
50
  selectionChange: (detail: SelectionChangeDetail) => void;
31
51
  cellChange: (detail: CellChangeDetail) => void;
52
+ paste: (detail: PasteDetail) => void;
53
+ bulkChange: (detail: BulkChangeDetail) => void;
54
+ rowAction: (detail: RowActionDetail) => void;
55
+ /** The pivot only: a value was pressed, with `drill-down`. */
56
+ drillDown: (detail: DrillDownDetail) => void;
57
+ sourceReplaced: (detail: SourceReplacedDetail) => void;
32
58
  };
33
59
 
60
+ /**
61
+ * What a template ref on `OpengridGrid` holds: the connection's `setCellState`
62
+ * and `setValues`, and the element as `$el` — `ref<OpengridGridExposed | null>(null)`.
63
+ */
64
+ export type OpengridGridExposed = CellWrites & { $el: OpengridGridElement };
65
+
34
66
  export interface OpengridGridProps extends Options {
35
67
  /** The accessible name of the table. */
36
68
  label?: string;
@@ -43,16 +75,24 @@ export interface OpengridGridProps extends Options {
43
75
  /** Switches from scrolling to paging. */
44
76
  pageSize?: number;
45
77
  mode?: Mode;
46
- /** Up to two columns, outermost first: `"country,customer"`. */
78
+ /** Up to three columns, outermost first: `"country,customer"`. */
47
79
  groupBy?: string;
48
80
  /** The field holding a row's parent key: the rows show as a tree. */
49
81
  tree?: string;
50
82
  /** The field the parent key refers to; `id` when absent. */
51
83
  treeKey?: string;
84
+ /** The field that names a record: `key` in the editing events. */
85
+ rowKey?: string;
86
+ /** The page's filter, as the wire's JSON; and-ed onto every query, not in the view. */
87
+ filter?: string;
88
+ /** An empty row after the last one to type a new record into (`@row-add`). */
89
+ addRow?: boolean;
52
90
  search?: boolean;
53
91
  facets?: boolean;
54
92
  toolbar?: boolean;
55
93
  columnMenu?: boolean;
94
+ /** *Advanced filter* in the toolbar: the builder of the nested filter. */
95
+ filterBuilder?: boolean;
56
96
  selection?: boolean;
57
97
  density?: Density;
58
98
  /** One of the built-in looks; Base when absent. */
@@ -72,7 +112,7 @@ export type OpengridPivotEmits = Omit<OpengridEmits, "update:view"> & {
72
112
  };
73
113
 
74
114
  export interface OpengridPivotProps
75
- extends Omit<PivotConnectOptions, "onViewChange" | "onSelectionChange" | "onCellChange"> {
115
+ extends Omit<PivotConnectOptions, Callbacks> {
76
116
  label?: string;
77
117
  datasource?: string;
78
118
  /** Comma-separated row dimensions, outermost first. */
@@ -93,6 +133,8 @@ export interface OpengridPivotProps
93
133
  measures?: string;
94
134
  /** The filter on the raw rows, as the wire's JSON; part of the view. */
95
135
  filter?: string;
136
+ /** Makes every value a button that emits `drillDown`. */
137
+ drillDown?: boolean;
96
138
  theme?: Theme;
97
139
  }
98
140
 
package/vue/index.js CHANGED
@@ -1,9 +1,10 @@
1
1
  /**
2
- * Vue components for `@casoon/opengrid` (plan point 78, E32).
2
+ * Vue components for `@casoon/opengrid`.
3
3
  *
4
4
  * The same thin shell as the React adapter: the component renders the custom
5
5
  * element with its attributes, and hands everything else — provider, texts,
6
- * formats, presentation, choices, the view and the events — to one `connect`.
6
+ * formats, presentation, choices, actions, validators, the view and the
7
+ * events — to one `connect`.
7
8
  *
8
9
  * What only a Vue shell has to know:
9
10
  *
@@ -15,12 +16,17 @@
15
16
  * - **Events in camelCase** (`selectionChange`, `cellChange`), which a
16
17
  * template writes as `@selection-change` — Vue normalizes the two, and only
17
18
  * the camelCase form gives typed `onSelectionChange` props.
19
+ * - **`onRowAdd` is a prop, not an event:** its answer is the new row's
20
+ * state, and an emitted event has none. A template still writes it as
21
+ * `@row-add`, which Vue passes as the prop `onRowAdd`.
22
+ * - **The template ref** exposes `setCellState` and `setValues`; `$el` is
23
+ * the element, as before.
18
24
  * - **`v-model:view`:** the view comes in as a prop and goes out as
19
25
  * `update:view`, which is the reader's change `connect` reports. Writing it
20
26
  * back is no change, so the loop ends there.
21
27
  * - **`<KeepAlive>` detaches, it does not unmount:** the connection stays, and
22
28
  * the element brings back its own view and selection when it returns
23
- * (docs/api.md §Connecting, plan point 74). Only an unmount disconnects. A
29
+ * (docs/api.md §Connecting). Only an unmount disconnects. A
24
30
  * view that changed while the grid was away waited in `connect` (there is no
25
31
  * view to set on a detached element); reactivation hands it over.
26
32
  * - **Watchers run after the render** (`flush: "post"`), so the element has
@@ -35,8 +41,19 @@ import { defineComponent, h, nextTick, onActivated, onBeforeUnmount, onMounted,
35
41
  import { connect } from "../loader.js";
36
42
 
37
43
  /** The options of `connect` that are props; deep ones compare by value. */
38
- const SHALLOW = ["provider"];
39
- const DEEP = ["texts", "formats", "presentation", "choices", "view"];
44
+ const SHALLOW = ["provider", "detailRenderer"];
45
+ const DEEP = ["texts", "formats", "presentation", "choices", "actions", "validators", "cellTemplates", "view"];
46
+
47
+ /** The events, by `connect`'s callback. */
48
+ const EVENTS = {
49
+ onSelectionChange: "selectionChange",
50
+ onCellChange: "cellChange",
51
+ onPaste: "paste",
52
+ onBulkChange: "bulkChange",
53
+ onRowAction: "rowAction",
54
+ onDrillDown: "drillDown",
55
+ onSourceReplaced: "sourceReplaced",
56
+ };
40
57
 
41
58
  /**
42
59
  * Builds one component.
@@ -54,12 +71,13 @@ function component(tag, name, attributes, booleans) {
54
71
  for (const option of [...SHALLOW, ...DEEP, "defaultView"]) {
55
72
  props[option] = { type: null, default: undefined };
56
73
  }
74
+ props.onRowAdd = { type: Function, default: undefined };
57
75
 
58
76
  return defineComponent({
59
77
  name,
60
78
  props,
61
- emits: ["update:view", "selectionChange", "cellChange"],
62
- setup(props, { emit }) {
79
+ emits: ["update:view", ...Object.values(EVENTS)],
80
+ setup(props, { emit, expose }) {
63
81
  const element = ref(null);
64
82
  let connection = null;
65
83
 
@@ -74,9 +92,11 @@ function component(tag, name, attributes, booleans) {
74
92
  if (props.view != null) connection?.update({ view: props.view });
75
93
  });
76
94
  },
77
- onSelectionChange: (detail) => emit("selectionChange", detail),
78
- onCellChange: (detail) => emit("cellChange", detail),
95
+ onRowAdd: (detail) => props.onRowAdd?.(detail),
79
96
  };
97
+ for (const [callback, event] of Object.entries(EVENTS)) {
98
+ options[callback] = (detail) => emit(event, detail);
99
+ }
80
100
  for (const option of [...SHALLOW, ...DEEP, "defaultView"]) {
81
101
  if (props[option] !== undefined) {
82
102
  options[option] = props[option];
@@ -103,6 +123,11 @@ function component(tag, name, attributes, booleans) {
103
123
  }
104
124
  onActivated(() => connection?.update({}));
105
125
 
126
+ expose({
127
+ setCellState: (...args) => connection?.setCellState(...args),
128
+ setValues: (values) => connection?.setValues(values),
129
+ });
130
+
106
131
  onBeforeUnmount(() => {
107
132
  connection?.disconnect();
108
133
  connection = null;
@@ -137,15 +162,19 @@ export const OpengridGrid = component(
137
162
  groupBy: "group-by",
138
163
  tree: "tree",
139
164
  treeKey: "tree-key",
165
+ rowKey: "row-key",
166
+ filter: "filter",
167
+ addRow: "add-row",
140
168
  search: "search",
141
169
  facets: "facets",
142
170
  toolbar: "toolbar",
143
171
  columnMenu: "column-menu",
172
+ filterBuilder: "filter-builder",
144
173
  selection: "selection",
145
174
  density: "density",
146
175
  theme: "theme",
147
176
  },
148
- ["search", "facets", "toolbar", "columnMenu", "selection"],
177
+ ["search", "facets", "toolbar", "columnMenu", "filterBuilder", "selection", "addRow"],
149
178
  );
150
179
 
151
180
  export const OpengridTable = component(
@@ -170,7 +199,8 @@ export const OpengridPivot = component(
170
199
  fields: "fields",
171
200
  measures: "measures",
172
201
  filter: "filter",
202
+ drillDown: "drill-down",
173
203
  theme: "theme",
174
204
  },
175
- ["toolbar"],
205
+ ["toolbar", "drillDown"],
176
206
  );
package/worker.js CHANGED
@@ -1,6 +1,5 @@
1
1
  /**
2
- * opengrid engine worker (plan point 19,
3
- * plan/spezifikation/04-local-engine.md §Worker).
2
+ * opengrid engine worker: the local engine in a module worker.
4
3
  *
5
4
  * A **module worker** that owns exactly one WASM `Engine`. The main thread
6
5
  * keeps the DOM, events and rendering; this worker runs ingest, filter, sort,
@@ -23,6 +22,10 @@
23
22
  * transferred, not copied. Nothing engine-specific is serialised here.
24
23
  */
25
24
 
25
+ // The packaged engine glue, imported statically so that a bundler follows it and
26
+ // the `.wasm` beside it; `init` names another one with `moduleUrl`.
27
+ import * as packaged from "./engine/opengrid_wasm.js";
28
+
26
29
  /** The single engine instance, created on `init` and reused for every query. */
27
30
  let engine;
28
31
 
@@ -32,7 +35,7 @@ self.onmessage = async ({ data }) => {
32
35
  case "init": {
33
36
  // wasm-bindgen `--target web`: the default export initialises the
34
37
  // module; the named `Engine` class is created afterwards.
35
- const module = await import(data.moduleUrl);
38
+ const module = data.moduleUrl ? await import(/* @vite-ignore */ data.moduleUrl) : packaged;
36
39
  await module.default(data.wasmUrl);
37
40
  engine = new module.Engine();
38
41
  self.postMessage({ type: "ready", id: data.id });