@casoon/opengrid 0.20.1 → 0.21.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 +185 -1
- package/README.md +10 -6
- package/collation/opengrid_collation_bg.wasm +0 -0
- package/engine/opengrid_wasm.d.ts +7 -0
- package/engine/opengrid_wasm.js +29 -2
- package/engine/opengrid_wasm_bg.wasm +0 -0
- package/engine/opengrid_wasm_bg.wasm.d.ts +1 -0
- package/loader.d.ts +228 -4
- package/loader.js +105 -2
- package/package.json +19 -3
- package/pkg/opengrid_web_components.d.ts +47 -10
- package/pkg/opengrid_web_components.js +185 -59
- package/pkg/opengrid_web_components_bg.wasm +0 -0
- package/pkg/opengrid_web_components_bg.wasm.d.ts +13 -10
- package/react/index.d.ts +6 -0
- package/react/index.js +10 -1
- package/solid/index.d.ts +149 -0
- package/solid/index.js +252 -0
- package/svelte/Opengrid.svelte +12 -0
- package/svelte/OpengridGrid.svelte +6 -0
- package/svelte/index.d.ts +13 -1
- package/texts/de.js +29 -0
- package/vue/index.d.ts +13 -1
- package/vue/index.js +20 -2
- package/worker.js +5 -0
- package/xlsx/opengrid_xlsx_bg.wasm +0 -0
- /package/pkg/snippets/{opengrid-web-components-75269052febb3de2 → opengrid-web-components-7b74e96872f41f92}/inline0.js +0 -0
- /package/pkg/snippets/{opengrid-web-components-75269052febb3de2 → opengrid-web-components-7b74e96872f41f92}/inline1.js +0 -0
- /package/pkg/snippets/{opengrid-web-core-d95b346530aeec64 → opengrid-web-core-2138c846fafc77c3}/inline0.js +0 -0
- /package/pkg/snippets/{opengrid-web-core-d95b346530aeec64 → opengrid-web-core-2138c846fafc77c3}/inline1.js +0 -0
- /package/pkg/snippets/{opengrid-web-core-d95b346530aeec64 → opengrid-web-core-2138c846fafc77c3}/inline2.js +0 -0
package/react/index.js
CHANGED
|
@@ -54,6 +54,10 @@ const OPTIONS = [
|
|
|
54
54
|
"onSelectionChange",
|
|
55
55
|
"onCellChange",
|
|
56
56
|
"actions",
|
|
57
|
+
"cellActions",
|
|
58
|
+
"toolbarItems",
|
|
59
|
+
"presets",
|
|
60
|
+
"presetOptions",
|
|
57
61
|
"validators",
|
|
58
62
|
"cellTemplates",
|
|
59
63
|
"detailRenderer",
|
|
@@ -61,6 +65,8 @@ const OPTIONS = [
|
|
|
61
65
|
"onPaste",
|
|
62
66
|
"onBulkChange",
|
|
63
67
|
"onRowAction",
|
|
68
|
+
"onCellAction",
|
|
69
|
+
"onToolbarAction",
|
|
64
70
|
"onDrillDown",
|
|
65
71
|
"onSourceReplaced",
|
|
66
72
|
];
|
|
@@ -167,10 +173,13 @@ export const OpengridGrid = component(
|
|
|
167
173
|
tree: "tree",
|
|
168
174
|
treeKey: "tree-key",
|
|
169
175
|
rowKey: "row-key",
|
|
176
|
+
rowMuted: "row-muted",
|
|
170
177
|
filter: "filter",
|
|
171
178
|
collation: "collation",
|
|
172
179
|
addRow: "add-row",
|
|
173
180
|
editLocked: "edit-locked",
|
|
181
|
+
editToggle: "edit-toggle",
|
|
182
|
+
enterMoves: "enter-moves",
|
|
174
183
|
search: "search",
|
|
175
184
|
facets: "facets",
|
|
176
185
|
toolbar: "toolbar",
|
|
@@ -180,7 +189,7 @@ export const OpengridGrid = component(
|
|
|
180
189
|
density: "density",
|
|
181
190
|
theme: "theme",
|
|
182
191
|
},
|
|
183
|
-
["search", "facets", "toolbar", "columnMenu", "filterBuilder", "selection", "addRow", "editLocked"],
|
|
192
|
+
["search", "facets", "toolbar", "columnMenu", "filterBuilder", "selection", "addRow", "editLocked", "editToggle"],
|
|
184
193
|
);
|
|
185
194
|
|
|
186
195
|
export const OpengridTable = component(
|
package/solid/index.d.ts
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for `@casoon/opengrid/solid` — Solid 2.
|
|
3
|
+
*
|
|
4
|
+
* The props are the element's attributes in camelCase plus the options of
|
|
5
|
+
* `connect` from `@casoon/opengrid` — no names of their own. Everything else
|
|
6
|
+
* (`id`, `class`, `style`, `aria-*`, `data-*`, `hidden`) goes to the element,
|
|
7
|
+
* written the Solid way: `class`, not `className`; lowercase attribute names.
|
|
8
|
+
*
|
|
9
|
+
* Four things to know, from `connect` and from Solid:
|
|
10
|
+
*
|
|
11
|
+
* - `provider` and format functions compare by **identity**. Solid makes
|
|
12
|
+
* `provider={createRestProvider(…)}` a getter, and every read is a new
|
|
13
|
+
* provider that asks the source again — create it once, in the component
|
|
14
|
+
* or outside it.
|
|
15
|
+
* - `view` is controlled: the reader's change goes to `onViewChange`, and a
|
|
16
|
+
* view the page does not take into the signal it holds is written again
|
|
17
|
+
* once the page's updates have flushed.
|
|
18
|
+
* - `density` and `groupBy` are attributes the reader can change too (they are
|
|
19
|
+
* part of the view). As props they set the start; with a controlled `view`,
|
|
20
|
+
* leave them out and let the view carry them.
|
|
21
|
+
* - The component is plain JavaScript. The page's own JSX is compiled by
|
|
22
|
+
* Solid's compiler (`@solidjs/vite-plugin`) with `"jsxImportSource":
|
|
23
|
+
* "@solidjs/web"` in `tsconfig.json`; the adapter needs neither.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import type { Component } from "solid-js";
|
|
27
|
+
import type { JSX } from "@solidjs/web";
|
|
28
|
+
import type {
|
|
29
|
+
CellWrites,
|
|
30
|
+
ConnectOptions,
|
|
31
|
+
Density,
|
|
32
|
+
Theme,
|
|
33
|
+
Mode,
|
|
34
|
+
OpengridGridElement,
|
|
35
|
+
OpengridPivotElement,
|
|
36
|
+
OpengridTableElement,
|
|
37
|
+
PivotConnectOptions,
|
|
38
|
+
} from "../loader.js";
|
|
39
|
+
|
|
40
|
+
/** What the element itself takes from Solid, minus what the component owns. */
|
|
41
|
+
type ElementProps = Omit<
|
|
42
|
+
JSX.HTMLAttributes<HTMLElement>,
|
|
43
|
+
"children" | "ref" | keyof ConnectOptions
|
|
44
|
+
>;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Solid's `ref`: the element — a variable declared `let grid!: …` that
|
|
48
|
+
* `ref={grid}` fills — or a function that gets it, or a list of those.
|
|
49
|
+
*/
|
|
50
|
+
type ElementRef<Element, Given = Element> =
|
|
51
|
+
| Element
|
|
52
|
+
| ((element: Given) => void)
|
|
53
|
+
| undefined
|
|
54
|
+
| ElementRef<Element, Given>[];
|
|
55
|
+
|
|
56
|
+
export interface OpengridGridProps extends ConnectOptions, ElementProps {
|
|
57
|
+
/** The element — `let grid!: OpengridGridRef`, `ref={grid}` — or a function that gets it. */
|
|
58
|
+
ref?: ElementRef<OpengridGridElement, OpengridGridRef>;
|
|
59
|
+
/** The accessible name of the table. */
|
|
60
|
+
label?: string;
|
|
61
|
+
/** The source; becomes the query's `source`. */
|
|
62
|
+
datasource?: string;
|
|
63
|
+
/** Comma-separated output fields, in order. */
|
|
64
|
+
columns?: string;
|
|
65
|
+
/** Rows rendered and fetched at once while scrolling. Default 40. */
|
|
66
|
+
windowSize?: number;
|
|
67
|
+
/** Switches from scrolling to paging. */
|
|
68
|
+
pageSize?: number;
|
|
69
|
+
mode?: Mode;
|
|
70
|
+
/** Up to three columns, outermost first: `"country,customer"`. */
|
|
71
|
+
groupBy?: string;
|
|
72
|
+
/** The field holding a row's parent key: the rows show as a tree. */
|
|
73
|
+
tree?: string;
|
|
74
|
+
/** The field the parent key refers to; `id` when absent. */
|
|
75
|
+
treeKey?: string;
|
|
76
|
+
/** The field that names a record: `key` in the editing events. */
|
|
77
|
+
rowKey?: string;
|
|
78
|
+
/** The boolean field that mutes a row: drawn in the muted ink, described with the text `rowMuted`. */
|
|
79
|
+
rowMuted?: string;
|
|
80
|
+
/** The page's filter, as the wire's JSON; and-ed onto every query, not in the view. */
|
|
81
|
+
filter?: string;
|
|
82
|
+
/** The locale text columns sort by (`de`, `sr-Latn`); by code point without it. */
|
|
83
|
+
collation?: string;
|
|
84
|
+
/** An empty row after the last one to type a new record into (`onRowAdd`). */
|
|
85
|
+
addRow?: boolean;
|
|
86
|
+
/** Locks editing for the whole grid; the page unlocks it at run time. */
|
|
87
|
+
editLocked?: boolean;
|
|
88
|
+
/** An *Edit* switch in the toolbar that locks and unlocks editing (needs `toolbar`). */
|
|
89
|
+
editToggle?: boolean;
|
|
90
|
+
/** `"down"`: `Enter` that commits an editor moves the focus to the next data row (`Shift`+`Enter`: the previous one). */
|
|
91
|
+
enterMoves?: "down";
|
|
92
|
+
search?: boolean;
|
|
93
|
+
facets?: boolean;
|
|
94
|
+
toolbar?: boolean;
|
|
95
|
+
columnMenu?: boolean;
|
|
96
|
+
/** *Advanced filter* in the toolbar: the builder of the nested filter. */
|
|
97
|
+
filterBuilder?: boolean;
|
|
98
|
+
selection?: boolean;
|
|
99
|
+
density?: Density;
|
|
100
|
+
/** One of the built-in looks; Base when absent. */
|
|
101
|
+
theme?: Theme;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface OpengridTableProps extends ConnectOptions, ElementProps {
|
|
105
|
+
ref?: ElementRef<OpengridTableElement>;
|
|
106
|
+
label?: string;
|
|
107
|
+
datasource?: string;
|
|
108
|
+
columns?: string;
|
|
109
|
+
theme?: Theme;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** A pivot's view is a `PivotView`: its `rows`, `columns` and `values`. */
|
|
113
|
+
export interface OpengridPivotProps extends PivotConnectOptions, ElementProps {
|
|
114
|
+
ref?: ElementRef<OpengridPivotElement>;
|
|
115
|
+
label?: string;
|
|
116
|
+
datasource?: string;
|
|
117
|
+
/** Comma-separated row dimensions, outermost first. */
|
|
118
|
+
rows?: string;
|
|
119
|
+
/** Comma-separated column dimensions, outermost first; V1 allows two. */
|
|
120
|
+
columns?: string;
|
|
121
|
+
/** The measures as the contract's JSON. */
|
|
122
|
+
values?: string;
|
|
123
|
+
/** How each level is ordered, as the wire's JSON; part of the view. */
|
|
124
|
+
sort?: string;
|
|
125
|
+
/** The folded groups, as a JSON list of group paths; part of the view. */
|
|
126
|
+
collapsed?: string;
|
|
127
|
+
/** Shows the field toolbar. */
|
|
128
|
+
toolbar?: boolean;
|
|
129
|
+
/** The fields a reader may pivot by, comma-separated. */
|
|
130
|
+
fields?: string;
|
|
131
|
+
/** The measures a reader may add, as the contract's JSON. */
|
|
132
|
+
measures?: string;
|
|
133
|
+
/** The filter on the raw rows, as the wire's JSON; part of the view. */
|
|
134
|
+
filter?: string;
|
|
135
|
+
/** Makes every value a button that calls `onDrillDown`. */
|
|
136
|
+
drillDown?: boolean;
|
|
137
|
+
theme?: Theme;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* What the ref holds: the element, carrying the connection's `setCellState`
|
|
142
|
+
* and `setValues` — `let grid!: OpengridGridRef`. The prop takes a variable of
|
|
143
|
+
* the plain element type too.
|
|
144
|
+
*/
|
|
145
|
+
export type OpengridGridRef = OpengridGridElement & CellWrites;
|
|
146
|
+
|
|
147
|
+
export const OpengridGrid: Component<OpengridGridProps>;
|
|
148
|
+
export const OpengridTable: Component<OpengridTableProps>;
|
|
149
|
+
export const OpengridPivot: Component<OpengridPivotProps>;
|
package/solid/index.js
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Solid components for `@casoon/opengrid` — Solid 2 only.
|
|
3
|
+
*
|
|
4
|
+
* The same thin shell as the other adapters: the component renders the custom
|
|
5
|
+
* element with its attributes, and hands everything else — provider, texts,
|
|
6
|
+
* formats, presentation, choices, actions, validators, the view and the event
|
|
7
|
+
* callbacks — to one `connect`. The rules of the module functions live in
|
|
8
|
+
* `connect`, not here.
|
|
9
|
+
*
|
|
10
|
+
* What only a Solid shell has to know:
|
|
11
|
+
*
|
|
12
|
+
* - **No JSX in the adapter, so nothing to compile.** The element is rendered
|
|
13
|
+
* with `Dynamic` from `@solidjs/web`, which writes it the same way on the
|
|
14
|
+
* server (`renderToString`) and on the client, and claims the server's
|
|
15
|
+
* element when the page hydrates. The package ships plain JavaScript; the
|
|
16
|
+
* page's own JSX needs Solid's compiler, the adapter does not.
|
|
17
|
+
* - **Attributes are rendered, not set later,** so they are in the server HTML
|
|
18
|
+
* too. A boolean attribute (`selection`, `toolbar`, …) is present or absent:
|
|
19
|
+
* `selection={false}` leaves it out. Solid writes `true` as an empty
|
|
20
|
+
* attribute and `false` not at all, on the server and in the browser alike.
|
|
21
|
+
* - **Props are read where Solid tracks them,** never in the component body:
|
|
22
|
+
* one effect reads every option, and runs again when one of them changes.
|
|
23
|
+
* There is no render to run again, so nothing is passed that did not
|
|
24
|
+
* change — a view the page holds is not written back over the reader's
|
|
25
|
+
* because a text changed.
|
|
26
|
+
* - **An option is passed when it changed**, and one that goes away is passed
|
|
27
|
+
* as `undefined`, which `connect` resets; one that was never there is left
|
|
28
|
+
* alone.
|
|
29
|
+
* - **The view is controlled** like in the other adapters: the reader's change
|
|
30
|
+
* goes to `onViewChange`; the page takes it into its signal, and Solid
|
|
31
|
+
* passes it back, which `connect` knows is no change. A view the page does
|
|
32
|
+
* not take back is written again once the page's updates have flushed.
|
|
33
|
+
* - **The ref is the element,** and the element behind it carries the
|
|
34
|
+
* connection's `setCellState` and `setValues` — `ref={grid}` with
|
|
35
|
+
* `let grid` is the usual Solid ref, a function the component calls.
|
|
36
|
+
* - **Effects, and `connect`, run in the browser only.** On the server the
|
|
37
|
+
* element is rendered with its attributes and nothing is connected.
|
|
38
|
+
* - **A provider created inline in JSX is created on every read.** Solid
|
|
39
|
+
* makes `provider={createRestProvider(…)}` a getter, and each read is a new
|
|
40
|
+
* provider that asks the source again. Create it once, in the component or
|
|
41
|
+
* outside it.
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
import { createComponent, createEffect, merge, omit, onFlush, onSettled } from "solid-js";
|
|
45
|
+
import { Dynamic } from "@solidjs/web";
|
|
46
|
+
import { connect } from "../loader.js";
|
|
47
|
+
|
|
48
|
+
/** The options of `connect` that are values; the page's props of that name. */
|
|
49
|
+
const VALUES = [
|
|
50
|
+
"provider",
|
|
51
|
+
"texts",
|
|
52
|
+
"formats",
|
|
53
|
+
"presentation",
|
|
54
|
+
"choices",
|
|
55
|
+
"view",
|
|
56
|
+
"defaultView",
|
|
57
|
+
"actions",
|
|
58
|
+
"cellActions",
|
|
59
|
+
"toolbarItems",
|
|
60
|
+
"presets",
|
|
61
|
+
"presetOptions",
|
|
62
|
+
"validators",
|
|
63
|
+
"cellTemplates",
|
|
64
|
+
"detailRenderer",
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
/** The options of `connect` that are callbacks. */
|
|
68
|
+
const CALLBACKS = [
|
|
69
|
+
"onViewChange",
|
|
70
|
+
"onSelectionChange",
|
|
71
|
+
"onCellChange",
|
|
72
|
+
"onRowAdd",
|
|
73
|
+
"onPaste",
|
|
74
|
+
"onBulkChange",
|
|
75
|
+
"onRowAction",
|
|
76
|
+
"onCellAction",
|
|
77
|
+
"onToolbarAction",
|
|
78
|
+
"onDrillDown",
|
|
79
|
+
"onSourceReplaced",
|
|
80
|
+
];
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Builds one component.
|
|
84
|
+
*
|
|
85
|
+
* @param {string} tag the custom element.
|
|
86
|
+
* @param {string} displayName the component's name in the Solid tools.
|
|
87
|
+
* @param {Record<string, string>} attributes prop name → attribute name.
|
|
88
|
+
* @param {string[]} booleans the props that are boolean attributes.
|
|
89
|
+
*/
|
|
90
|
+
function component(tag, displayName, attributes, booleans) {
|
|
91
|
+
const owned = [...VALUES, ...CALLBACKS, ...Object.keys(attributes), "ref"];
|
|
92
|
+
|
|
93
|
+
const Component = (props) => {
|
|
94
|
+
let element = null;
|
|
95
|
+
let connection = null;
|
|
96
|
+
/** The options of the last run, to tell a removed prop from an absent one. */
|
|
97
|
+
let previous = {};
|
|
98
|
+
|
|
99
|
+
// The callbacks read the prop when the event comes, so a changed handler
|
|
100
|
+
// needs no update, and a reader's event is not a read of the component.
|
|
101
|
+
const callbacks = {};
|
|
102
|
+
for (const name of CALLBACKS) {
|
|
103
|
+
callbacks[name] = (detail) => props[name]?.(detail);
|
|
104
|
+
}
|
|
105
|
+
callbacks.onViewChange = (view) => {
|
|
106
|
+
props.onViewChange?.(view);
|
|
107
|
+
// Controlled: once the page's own updates have flushed, the view it
|
|
108
|
+
// holds is written again — a view it took back is no change, one it
|
|
109
|
+
// refused puts the grid back.
|
|
110
|
+
onFlush(() => {
|
|
111
|
+
const held = props.view;
|
|
112
|
+
if (held != null) {
|
|
113
|
+
connection?.update({ view: held });
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
createEffect(
|
|
119
|
+
() => {
|
|
120
|
+
const options = {};
|
|
121
|
+
for (const name of VALUES) {
|
|
122
|
+
options[name] = props[name];
|
|
123
|
+
}
|
|
124
|
+
return options;
|
|
125
|
+
},
|
|
126
|
+
(options) => {
|
|
127
|
+
if (!connection) {
|
|
128
|
+
if (options.view != null && options.defaultView != null) {
|
|
129
|
+
console.warn(
|
|
130
|
+
`[opengrid] <${displayName}> has both view and defaultView; the view is controlled and leads`,
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
// Only what is set: `texts={undefined}` is no texts, not a reset.
|
|
134
|
+
const set = Object.entries(options).filter(([, value]) => value !== undefined);
|
|
135
|
+
connection = connect(element, { ...Object.fromEntries(set), ...callbacks });
|
|
136
|
+
} else {
|
|
137
|
+
const changed = {};
|
|
138
|
+
for (const name of VALUES) {
|
|
139
|
+
if (options[name] !== previous[name]) {
|
|
140
|
+
changed[name] = options[name];
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
connection.update(changed);
|
|
144
|
+
}
|
|
145
|
+
previous = options;
|
|
146
|
+
},
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
// Unmount: the listeners go; the element keeps its state for as long as it
|
|
150
|
+
// lives (docs/api.md §Connecting).
|
|
151
|
+
onSettled(() => () => {
|
|
152
|
+
connection?.disconnect();
|
|
153
|
+
connection = null;
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
const rendered = {};
|
|
157
|
+
for (const [prop, attribute] of Object.entries(attributes)) {
|
|
158
|
+
Object.defineProperty(rendered, attribute, {
|
|
159
|
+
enumerable: true,
|
|
160
|
+
get: booleans.includes(prop)
|
|
161
|
+
? () => (props[prop] ? true : undefined)
|
|
162
|
+
: () => {
|
|
163
|
+
const value = props[prop];
|
|
164
|
+
return value == null ? undefined : String(value);
|
|
165
|
+
},
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return createComponent(
|
|
170
|
+
Dynamic,
|
|
171
|
+
merge(rendered, omit(props, ...owned), {
|
|
172
|
+
component: tag,
|
|
173
|
+
ref: (host) => {
|
|
174
|
+
element = host;
|
|
175
|
+
Object.assign(host, {
|
|
176
|
+
setCellState: (...args) => connection?.setCellState(...args),
|
|
177
|
+
setValues: (values) => connection?.setValues(values),
|
|
178
|
+
});
|
|
179
|
+
const user = props.ref;
|
|
180
|
+
if (Array.isArray(user)) {
|
|
181
|
+
user.flat(Infinity).forEach((ref) => ref?.(host));
|
|
182
|
+
} else if (typeof user === "function") {
|
|
183
|
+
user(host);
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
}),
|
|
187
|
+
);
|
|
188
|
+
};
|
|
189
|
+
Object.defineProperty(Component, "name", { value: displayName });
|
|
190
|
+
return Component;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export const OpengridGrid = component(
|
|
194
|
+
"opengrid-grid",
|
|
195
|
+
"OpengridGrid",
|
|
196
|
+
{
|
|
197
|
+
label: "label",
|
|
198
|
+
datasource: "datasource",
|
|
199
|
+
columns: "columns",
|
|
200
|
+
windowSize: "window-size",
|
|
201
|
+
pageSize: "page-size",
|
|
202
|
+
mode: "mode",
|
|
203
|
+
groupBy: "group-by",
|
|
204
|
+
tree: "tree",
|
|
205
|
+
treeKey: "tree-key",
|
|
206
|
+
rowKey: "row-key",
|
|
207
|
+
rowMuted: "row-muted",
|
|
208
|
+
filter: "filter",
|
|
209
|
+
collation: "collation",
|
|
210
|
+
addRow: "add-row",
|
|
211
|
+
editLocked: "edit-locked",
|
|
212
|
+
editToggle: "edit-toggle",
|
|
213
|
+
enterMoves: "enter-moves",
|
|
214
|
+
search: "search",
|
|
215
|
+
facets: "facets",
|
|
216
|
+
toolbar: "toolbar",
|
|
217
|
+
columnMenu: "column-menu",
|
|
218
|
+
filterBuilder: "filter-builder",
|
|
219
|
+
selection: "selection",
|
|
220
|
+
density: "density",
|
|
221
|
+
theme: "theme",
|
|
222
|
+
},
|
|
223
|
+
["search", "facets", "toolbar", "columnMenu", "filterBuilder", "selection", "addRow", "editLocked", "editToggle"],
|
|
224
|
+
);
|
|
225
|
+
|
|
226
|
+
export const OpengridTable = component(
|
|
227
|
+
"opengrid-table",
|
|
228
|
+
"OpengridTable",
|
|
229
|
+
{ label: "label", datasource: "datasource", columns: "columns", theme: "theme" },
|
|
230
|
+
[],
|
|
231
|
+
);
|
|
232
|
+
|
|
233
|
+
export const OpengridPivot = component(
|
|
234
|
+
"opengrid-pivot",
|
|
235
|
+
"OpengridPivot",
|
|
236
|
+
{
|
|
237
|
+
label: "label",
|
|
238
|
+
datasource: "datasource",
|
|
239
|
+
rows: "rows",
|
|
240
|
+
columns: "columns",
|
|
241
|
+
values: "values",
|
|
242
|
+
sort: "sort",
|
|
243
|
+
collapsed: "collapsed",
|
|
244
|
+
toolbar: "toolbar",
|
|
245
|
+
fields: "fields",
|
|
246
|
+
measures: "measures",
|
|
247
|
+
filter: "filter",
|
|
248
|
+
drillDown: "drill-down",
|
|
249
|
+
theme: "theme",
|
|
250
|
+
},
|
|
251
|
+
["toolbar", "drillDown"],
|
|
252
|
+
);
|
package/svelte/Opengrid.svelte
CHANGED
|
@@ -42,6 +42,10 @@
|
|
|
42
42
|
presentation,
|
|
43
43
|
choices,
|
|
44
44
|
actions,
|
|
45
|
+
cellActions,
|
|
46
|
+
toolbarItems,
|
|
47
|
+
presets,
|
|
48
|
+
presetOptions,
|
|
45
49
|
validators,
|
|
46
50
|
cellTemplates,
|
|
47
51
|
detailRenderer,
|
|
@@ -52,6 +56,8 @@
|
|
|
52
56
|
onpaste,
|
|
53
57
|
onbulkchange,
|
|
54
58
|
onrowaction,
|
|
59
|
+
oncellaction,
|
|
60
|
+
ontoolbaraction,
|
|
55
61
|
ondrilldown,
|
|
56
62
|
onsourcereplaced,
|
|
57
63
|
...rest
|
|
@@ -68,6 +74,10 @@
|
|
|
68
74
|
presentation: $state.snapshot(presentation),
|
|
69
75
|
choices: $state.snapshot(choices),
|
|
70
76
|
actions: $state.snapshot(actions),
|
|
77
|
+
cellActions: $state.snapshot(cellActions),
|
|
78
|
+
toolbarItems: $state.snapshot(toolbarItems),
|
|
79
|
+
presets: $state.snapshot(presets),
|
|
80
|
+
presetOptions: $state.snapshot(presetOptions),
|
|
71
81
|
validators: validators && snapshotKeepingFunctions(validators),
|
|
72
82
|
cellTemplates: cellTemplates && snapshotKeepingFunctions(cellTemplates),
|
|
73
83
|
detailRenderer,
|
|
@@ -89,6 +99,8 @@
|
|
|
89
99
|
onPaste: (detail) => onpaste?.(detail),
|
|
90
100
|
onBulkChange: (detail) => onbulkchange?.(detail),
|
|
91
101
|
onRowAction: (detail) => onrowaction?.(detail),
|
|
102
|
+
onCellAction: (detail) => oncellaction?.(detail),
|
|
103
|
+
onToolbarAction: (detail) => ontoolbaraction?.(detail),
|
|
92
104
|
onDrillDown: (detail) => ondrilldown?.(detail),
|
|
93
105
|
onSourceReplaced: (detail) => onsourcereplaced?.(detail),
|
|
94
106
|
};
|
|
@@ -13,10 +13,13 @@
|
|
|
13
13
|
tree,
|
|
14
14
|
treeKey,
|
|
15
15
|
rowKey,
|
|
16
|
+
rowMuted,
|
|
16
17
|
filter,
|
|
17
18
|
collation,
|
|
18
19
|
addRow = false,
|
|
19
20
|
editLocked = false,
|
|
21
|
+
editToggle = false,
|
|
22
|
+
enterMoves,
|
|
20
23
|
search = false,
|
|
21
24
|
facets = false,
|
|
22
25
|
toolbar = false,
|
|
@@ -59,10 +62,13 @@
|
|
|
59
62
|
tree,
|
|
60
63
|
"tree-key": treeKey,
|
|
61
64
|
"row-key": rowKey,
|
|
65
|
+
"row-muted": rowMuted,
|
|
62
66
|
filter,
|
|
63
67
|
collation,
|
|
64
68
|
"add-row": flag(addRow),
|
|
65
69
|
"edit-locked": flag(editLocked),
|
|
70
|
+
"edit-toggle": flag(editToggle),
|
|
71
|
+
"enter-moves": enterMoves,
|
|
66
72
|
search: flag(search),
|
|
67
73
|
facets: flag(facets),
|
|
68
74
|
toolbar: flag(toolbar),
|
package/svelte/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
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
6
|
* spelling — `onviewchange`, `onselectionchange`, `oncellchange`, `onrowadd`,
|
|
7
|
-
* `onpaste`, `onbulkchange`, `onrowaction`, `onsourcereplaced` — `view`
|
|
7
|
+
* `onpaste`, `onbulkchange`, `onrowaction`, `oncellaction`, `ontoolbaraction`, `onsourcereplaced` — `view`
|
|
8
8
|
* bindable (`bind:view`), the element itself through `bind:element`, and the
|
|
9
9
|
* grid's `setCellState` and `setValues` through `bind:this`.
|
|
10
10
|
* Everything else (`id`, `class`, `style`, `aria-*`) goes to the element.
|
|
@@ -30,6 +30,8 @@ import type {
|
|
|
30
30
|
PivotView,
|
|
31
31
|
DrillDownDetail,
|
|
32
32
|
RowActionDetail,
|
|
33
|
+
CellActionDetail,
|
|
34
|
+
ToolbarActionDetail,
|
|
33
35
|
SelectionChangeDetail,
|
|
34
36
|
SourceReplacedDetail,
|
|
35
37
|
View,
|
|
@@ -44,6 +46,8 @@ type Callbacks =
|
|
|
44
46
|
| "onPaste"
|
|
45
47
|
| "onBulkChange"
|
|
46
48
|
| "onRowAction"
|
|
49
|
+
| "onCellAction"
|
|
50
|
+
| "onToolbarAction"
|
|
47
51
|
| "onDrillDown"
|
|
48
52
|
| "onSourceReplaced";
|
|
49
53
|
|
|
@@ -58,6 +62,8 @@ type SvelteCallbacks = {
|
|
|
58
62
|
onpaste?: (detail: PasteDetail) => void;
|
|
59
63
|
onbulkchange?: (detail: BulkChangeDetail) => void;
|
|
60
64
|
onrowaction?: (detail: RowActionDetail) => void;
|
|
65
|
+
oncellaction?: (detail: CellActionDetail) => void;
|
|
66
|
+
ontoolbaraction?: (detail: ToolbarActionDetail) => void;
|
|
61
67
|
/** The pivot only: a value was pressed, with `drillDown`. */
|
|
62
68
|
ondrilldown?: (detail: DrillDownDetail) => void;
|
|
63
69
|
onsourcereplaced?: (detail: SourceReplacedDetail) => void;
|
|
@@ -93,6 +99,8 @@ export interface OpengridGridProps extends Options, ElementProps {
|
|
|
93
99
|
treeKey?: string;
|
|
94
100
|
/** The field that names a record: `key` in the editing events. */
|
|
95
101
|
rowKey?: string;
|
|
102
|
+
/** The boolean field that mutes a row: drawn in the muted ink, described with the text `rowMuted`. */
|
|
103
|
+
rowMuted?: string;
|
|
96
104
|
/** The page's filter, as the wire's JSON; and-ed onto every query, not in the view. */
|
|
97
105
|
filter?: string;
|
|
98
106
|
/** The locale text columns sort by (`de`, `sr-Latn`); by code point without it. */
|
|
@@ -101,6 +109,10 @@ export interface OpengridGridProps extends Options, ElementProps {
|
|
|
101
109
|
addRow?: boolean;
|
|
102
110
|
/** Locks editing for the whole grid; the page unlocks it at run time. */
|
|
103
111
|
editLocked?: boolean;
|
|
112
|
+
/** An *Edit* switch in the toolbar that locks and unlocks editing (needs `toolbar`). */
|
|
113
|
+
editToggle?: boolean;
|
|
114
|
+
/** `"down"`: `Enter` that commits an editor moves the focus to the next data row (`Shift`+`Enter`: the previous one). */
|
|
115
|
+
enterMoves?: "down";
|
|
104
116
|
search?: boolean;
|
|
105
117
|
facets?: boolean;
|
|
106
118
|
toolbar?: boolean;
|
package/texts/de.js
CHANGED
|
@@ -37,6 +37,14 @@ export default {
|
|
|
37
37
|
"aggregateMax": "Maximum",
|
|
38
38
|
"aggregateRange": "Spanne",
|
|
39
39
|
"columnMenu": "Spaltenmenü {column}",
|
|
40
|
+
"cellMenu": "Zellenmenü {column}",
|
|
41
|
+
"cellEdit": "Bearbeiten",
|
|
42
|
+
"cellCopy": "Kopieren",
|
|
43
|
+
"cellCopied": "Kopiert",
|
|
44
|
+
"cellSelectRow": "Zeile auswählen",
|
|
45
|
+
"cellDeselectRow": "Zeilenauswahl aufheben",
|
|
46
|
+
"cellOpenRecord": "Datensatz öffnen",
|
|
47
|
+
"cellColumnMenu": "Spaltenmenü",
|
|
40
48
|
"sortAscending": "Aufsteigend sortieren",
|
|
41
49
|
"sortDescending": "Absteigend sortieren",
|
|
42
50
|
"sortKey": "Sortierschlüssel {position}",
|
|
@@ -53,7 +61,9 @@ export default {
|
|
|
53
61
|
"pinNone": "Nicht fixiert",
|
|
54
62
|
"pinStart": "Am Anfang",
|
|
55
63
|
"pinEnd": "Am Ende",
|
|
64
|
+
"pinNarrow": "Nur auf schmalen Bildschirmen",
|
|
56
65
|
"toolbarGroup": "Werkzeuge",
|
|
66
|
+
"toolbarRefused": "Werkzeugleisten-Einträge nicht übernommen. {problems}",
|
|
57
67
|
"filterRowToggle": "Filterzeile",
|
|
58
68
|
"densityGroup": "Dichte",
|
|
59
69
|
"densityCompact": "Kompakt",
|
|
@@ -104,6 +114,7 @@ export default {
|
|
|
104
114
|
"shareOfTotal": "Anteil am Gesamtergebnis",
|
|
105
115
|
"runningTotal": "laufende Summe",
|
|
106
116
|
"treeContext": "Kontext",
|
|
117
|
+
"rowMuted": "inaktiv",
|
|
107
118
|
"subtreeCell": "{shown}, {aggregate} im Teilbaum",
|
|
108
119
|
"subtreeOnly": "{shown}, {aggregate} im Teilbaum",
|
|
109
120
|
"treeOrphans": "Ohne Elternzeile, oben angezeigt: {count}",
|
|
@@ -149,11 +160,19 @@ export default {
|
|
|
149
160
|
"filterBuilderAddGroup": "+ Gruppe",
|
|
150
161
|
"filterBuilderEdit": "{filter} bearbeiten",
|
|
151
162
|
"filterApplied": "Filter gesetzt: {filter}",
|
|
163
|
+
"presetsGroup": "Ansichten",
|
|
164
|
+
"presetChosen": "{preset}",
|
|
165
|
+
"presetCount": "{label} ({count})",
|
|
152
166
|
"emptyFiltered": "Für diese Filter gibt es keine Zeilen.",
|
|
167
|
+
"emptyPreset": "Für diese Filter gibt es in „{preset}“ keine Zeilen.",
|
|
153
168
|
"emptySource": "Es gibt keine Zeilen.",
|
|
154
169
|
"emptyReset": "Filter zurücksetzen",
|
|
155
170
|
"filterInvalid": "{column}: {value} ist kein Wert dieser Spalte",
|
|
156
171
|
"cellRequired": "{column} braucht einen Wert",
|
|
172
|
+
"numberInvalid": "„{value}“ ist keine Zahl",
|
|
173
|
+
"integerInvalid": "„{value}“ ist keine ganze Zahl",
|
|
174
|
+
"numberDecimals": "„{value}“ hat mehr als {scale} Nachkommastellen",
|
|
175
|
+
"numberTooLarge": "„{value}“ ist zu groß für diese Spalte",
|
|
157
176
|
"newRow": "Neue Zeile",
|
|
158
177
|
"choicesOne": "1 Auswahlmöglichkeit",
|
|
159
178
|
"choicesOther": "{count} Auswahlmöglichkeiten",
|
|
@@ -175,6 +194,7 @@ export default {
|
|
|
175
194
|
"recordDone": "Datensatz {row} gespeichert, {count} Felder geändert",
|
|
176
195
|
"recordNothing": "Datensatz {row}: kein Feld geändert",
|
|
177
196
|
"rangeSize": "{rows} mal {cols} Zellen",
|
|
197
|
+
"positionCell": "Zeile {row} von {rows} · {column}",
|
|
178
198
|
"rangeCopied": "{rows} mal {cols} Zellen kopiert",
|
|
179
199
|
"rangeUnloaded": "Nicht kopiert: der Bereich reicht über Zeilen, die nicht geladen sind",
|
|
180
200
|
"sourceChanged": "Die Daten haben sich geändert. Aktualisieren, um sie zu sehen.",
|
|
@@ -193,6 +213,14 @@ export default {
|
|
|
193
213
|
"bulkMenu": "Für ausgewählte Zeilen setzen",
|
|
194
214
|
"bulkReadonly": "{column} ist schreibgeschützt",
|
|
195
215
|
"editLocked": "Bearbeiten ist gesperrt",
|
|
216
|
+
"editUnlocked": "Bearbeiten ist freigegeben",
|
|
217
|
+
"editToggle": "Bearbeiten",
|
|
218
|
+
"lockColumn": "Spalte sperren",
|
|
219
|
+
"unlockColumn": "Spalte entsperren",
|
|
220
|
+
"columnLocked": "{column} gegen Bearbeiten gesperrt",
|
|
221
|
+
"columnUnlocked": "{column} zum Bearbeiten entsperrt",
|
|
222
|
+
"editHint": "Enter zum Bearbeiten",
|
|
223
|
+
"editLockedHint": "Bearbeiten gesperrt",
|
|
196
224
|
"bulkDone": "{column} für {rows} gesetzt",
|
|
197
225
|
"pastePreview": "Einfügevorschau",
|
|
198
226
|
"pasteApply": "Einfügen",
|
|
@@ -211,6 +239,7 @@ export default {
|
|
|
211
239
|
"columnPinnedStart": "{column} am Anfang fixiert",
|
|
212
240
|
"columnPinnedEnd": "{column} am Ende fixiert",
|
|
213
241
|
"columnUnpinned": "{column} nicht mehr fixiert",
|
|
242
|
+
"columnPinnedNarrow": "{column} auf schmalen Bildschirmen am Anfang fixiert",
|
|
214
243
|
"pinsReleased": "Zu schmal für die fixierten Spalten: Sie scrollen mit den anderen",
|
|
215
244
|
"columnHidden": "{column} ausgeblendet, {visible} von {count} Spalten sichtbar",
|
|
216
245
|
"columnShown": "{column} eingeblendet, {visible} von {count} Spalten sichtbar",
|