@nullplatform/ui-plugin-sdk 0.20.0 → 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/dist/catalog.d.ts +4 -3
- package/dist/components.d.ts +1 -1
- package/dist/components.generated.d.ts +10 -4
- package/dist/components.generated.js +1 -1
- package/dist/contractProps.d.ts +8 -1
- package/dist/contracts.generated.d.ts +8 -0
- package/dist/contracts.generated.js +5 -3
- package/dist/dataTable.d.ts +49 -2
- package/package.json +2 -2
package/dist/catalog.d.ts
CHANGED
|
@@ -23,17 +23,18 @@ export interface CatalogElementSpec {
|
|
|
23
23
|
/**
|
|
24
24
|
* Closed lists for string props. The host drops any other value, so the element draws its default. `prop[].key`
|
|
25
25
|
* names a key of each item in an array prop, which the host drops from an item whose value isn't in the list.
|
|
26
|
-
* `prop[]` names the items of an array of plain values: the host drops each item that isn't in the list.
|
|
26
|
+
* `prop[]` names the items of an array of plain values: the host drops each item that isn't in the list. `prop.key`
|
|
27
|
+
* names a key of an object prop, which the host drops from the object when its value isn't in the list.
|
|
27
28
|
*/
|
|
28
29
|
values?: Readonly<Record<string, readonly string[]>>;
|
|
29
30
|
/**
|
|
30
31
|
* Props that end up in CSS, which the host only passes as plain values. `prop[].key` names a key of each item
|
|
31
|
-
* in an array prop.
|
|
32
|
+
* in an array prop, `prop.key` a key of an object prop.
|
|
32
33
|
*/
|
|
33
34
|
cssValues?: readonly string[];
|
|
34
35
|
/**
|
|
35
36
|
* Props that load an image, which the host only passes when they point to plugin bundle storage, as np-image's
|
|
36
|
-
* `src` does. `prop[].key` names a key of each item in an array prop.
|
|
37
|
+
* `src` does. `prop[].key` names a key of each item in an array prop, `prop.key` a key of an object prop.
|
|
37
38
|
*/
|
|
38
39
|
imageValues?: readonly string[];
|
|
39
40
|
/** Whether the element draws nested elements. The host drops children otherwise. */
|
package/dist/components.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export * from "./components.generated.js";
|
|
|
10
10
|
export type { ContractProps, UiComponentsTag } from "./contractProps.js";
|
|
11
11
|
export type { CalendarEvent, CalendarEventKind, CalendarEventState, CalendarSlot, CalendarTimelineBar, CalendarTimelineRow, CalendarTimelineRowKind, } from "./calendar.js";
|
|
12
12
|
export type { FilterSingleDateChange, FilterSingleDatePreset } from "./filterSingleDate.js";
|
|
13
|
-
export type { DataTableAvatar, DataTableColor, DataTableColumn, DataTableFormatter, DataTableLabelVariant, DataTableLink, DataTablePagination, DataTableRow, DataTableRowAction, DataTableState, DataTableTypography, } from "./dataTable.js";
|
|
13
|
+
export type { DataTableAvatar, DataTableColor, DataTableColumn, DataTableEmptyState, DataTableFormatter, DataTableGrouping, DataTableLabelVariant, DataTableLink, DataTablePagination, DataTableRow, DataTableRowAction, DataTableState, DataTableTypography, } from "./dataTable.js";
|
|
14
14
|
export declare const TextField: import("react").ComponentType<{
|
|
15
15
|
label: string;
|
|
16
16
|
value: string;
|
|
@@ -362,17 +362,23 @@ export declare const DataTable: import("react").ComponentType<Omit<{
|
|
|
362
362
|
initialState?: Readonly<Record<string, unknown>> | undefined;
|
|
363
363
|
paginationProps?: Readonly<Record<string, unknown>> | undefined;
|
|
364
364
|
variant?: "default" | "embedded" | "plain" | undefined;
|
|
365
|
+
isRowClickable?: string | undefined;
|
|
366
|
+
emptyStateProps?: Readonly<Record<string, unknown>> | undefined;
|
|
367
|
+
grouping?: Readonly<Record<string, unknown>> | undefined;
|
|
365
368
|
} & {
|
|
366
369
|
readonly onChangeTableState?: ((payload: unknown) => void) | undefined;
|
|
367
370
|
readonly onRowClick?: ((payload: unknown) => void) | undefined;
|
|
368
|
-
} & {}, "data" | "onChangeTableState" | "onRowClick" | "columns" | "initialState" | "paginationProps"> & Pick<{
|
|
371
|
+
} & {}, "data" | "onChangeTableState" | "onRowClick" | "columns" | "initialState" | "paginationProps" | "isRowClickable" | "emptyStateProps" | "grouping"> & Pick<{
|
|
369
372
|
columns?: readonly import("./dataTable").DataTableColumn[];
|
|
370
373
|
data?: readonly import("./dataTable").DataTableRow[];
|
|
371
374
|
initialState?: import("./dataTable").DataTableState;
|
|
372
375
|
paginationProps?: import("./dataTable").DataTablePagination;
|
|
376
|
+
isRowClickable?: string;
|
|
377
|
+
emptyStateProps?: import("./dataTable").DataTableEmptyState;
|
|
378
|
+
grouping?: import("./dataTable").DataTableGrouping;
|
|
373
379
|
onChangeTableState?: (state: import("./dataTable").DataTableState) => void;
|
|
374
380
|
onRowClick?: (row: import("./dataTable").DataTableRow) => void;
|
|
375
|
-
}, "data" | "onChangeTableState" | "onRowClick" | "columns" | "initialState" | "paginationProps"> & {
|
|
381
|
+
}, "data" | "onChangeTableState" | "onRowClick" | "columns" | "initialState" | "paginationProps" | "isRowClickable" | "emptyStateProps" | "grouping"> & {
|
|
376
382
|
children?: import("react").ReactNode;
|
|
377
383
|
}>;
|
|
378
384
|
export declare const Gauge: import("react").ComponentType<{
|
|
@@ -502,7 +508,7 @@ export declare const CalendarTimeline: import("react").ComponentType<Omit<{
|
|
|
502
508
|
maxRows?: number | undefined;
|
|
503
509
|
} & {
|
|
504
510
|
readonly onBarPress?: ((payload: unknown) => void) | undefined;
|
|
505
|
-
} & {}, "
|
|
511
|
+
} & {}, "rows" | "onBarPress" | "emptyStateProps" | "bars"> & Pick<{
|
|
506
512
|
rows?: readonly import("./calendar").CalendarTimelineRow[];
|
|
507
513
|
bars?: readonly import("./calendar").CalendarTimelineBar[];
|
|
508
514
|
emptyStateProps?: {
|
|
@@ -510,7 +516,7 @@ export declare const CalendarTimeline: import("react").ComponentType<Omit<{
|
|
|
510
516
|
description?: string;
|
|
511
517
|
};
|
|
512
518
|
onBarPress?: (id: string) => void;
|
|
513
|
-
}, "
|
|
519
|
+
}, "rows" | "onBarPress" | "emptyStateProps" | "bars"> & {
|
|
514
520
|
children?: import("react").ReactNode;
|
|
515
521
|
}>;
|
|
516
522
|
export declare const ToggleButtonBar: import("react").ComponentType<{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated by scripts/sync-contracts.mjs from @nullplatform/react-ui-components@0.
|
|
1
|
+
// Generated by scripts/sync-contracts.mjs from @nullplatform/react-ui-components@0.17.1. Don't edit: change the contract in
|
|
2
2
|
// react-ui-components, bump `uiComponentsContracts` in package.json and run `pnpm sync:contracts`.
|
|
3
3
|
import { component } from "./component.js";
|
|
4
4
|
export const Badge = component("np-badge");
|
package/dist/contractProps.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import type { UI_COMPONENTS_CONTRACTS } from "./contracts.generated.js";
|
|
3
3
|
import type { CalendarEvent, CalendarSlot, CalendarTimelineBar, CalendarTimelineRow } from "./calendar.js";
|
|
4
|
-
import type { DataTableColumn, DataTablePagination, DataTableRow, DataTableState } from "./dataTable.js";
|
|
4
|
+
import type { DataTableColumn, DataTableEmptyState, DataTableGrouping, DataTablePagination, DataTableRow, DataTableState } from "./dataTable.js";
|
|
5
5
|
import type { FilterSingleDateChange, FilterSingleDatePreset } from "./filterSingleDate.js";
|
|
6
6
|
type Contract = (typeof UI_COMPONENTS_CONTRACTS)[number];
|
|
7
7
|
/** The elements the SDK takes from @nullplatform/react-ui-components' contracts. */
|
|
@@ -26,6 +26,13 @@ interface ContractPropTypes {
|
|
|
26
26
|
data?: readonly DataTableRow[];
|
|
27
27
|
initialState?: DataTableState;
|
|
28
28
|
paginationProps?: DataTablePagination;
|
|
29
|
+
/**
|
|
30
|
+
* The name of a boolean row field: only rows where it is `true` look and act clickable. Without it, every row is
|
|
31
|
+
* while `onRowClick` is set. A clickable row takes keyboard focus, and Enter or Space clicks it.
|
|
32
|
+
*/
|
|
33
|
+
isRowClickable?: string;
|
|
34
|
+
emptyStateProps?: DataTableEmptyState;
|
|
35
|
+
grouping?: DataTableGrouping;
|
|
29
36
|
onChangeTableState?: (state: DataTableState) => void;
|
|
30
37
|
onRowClick?: (row: DataTableRow) => void;
|
|
31
38
|
};
|
|
@@ -518,6 +518,9 @@ export declare const UI_COMPONENTS_CONTRACTS: readonly [{
|
|
|
518
518
|
readonly initialState: "object";
|
|
519
519
|
readonly paginationProps: "object";
|
|
520
520
|
readonly variant: "string";
|
|
521
|
+
readonly isRowClickable: "string";
|
|
522
|
+
readonly emptyStateProps: "object";
|
|
523
|
+
readonly grouping: "object";
|
|
521
524
|
};
|
|
522
525
|
readonly events: {
|
|
523
526
|
readonly stateChange: "onChangeTableState";
|
|
@@ -525,7 +528,12 @@ export declare const UI_COMPONENTS_CONTRACTS: readonly [{
|
|
|
525
528
|
};
|
|
526
529
|
readonly values: {
|
|
527
530
|
readonly variant: readonly ["default", "embedded", "plain"];
|
|
531
|
+
readonly "grouping.layout": readonly ["rows", "sections"];
|
|
532
|
+
readonly "emptyStateProps.action": readonly [];
|
|
533
|
+
readonly "emptyStateProps.contentComponent": readonly [];
|
|
528
534
|
};
|
|
535
|
+
readonly cssValues: readonly ["emptyStateProps.sx", "emptyStateProps.height"];
|
|
536
|
+
readonly imageValues: readonly ["emptyStateProps.img"];
|
|
529
537
|
}, {
|
|
530
538
|
readonly tag: "np-gauge";
|
|
531
539
|
readonly component: "Gauge";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated by scripts/sync-contracts.mjs from @nullplatform/react-ui-components@0.
|
|
1
|
+
// Generated by scripts/sync-contracts.mjs from @nullplatform/react-ui-components@0.17.1. Don't edit: change the contract in
|
|
2
2
|
// react-ui-components, bump `uiComponentsContracts` in package.json and run `pnpm sync:contracts`.
|
|
3
3
|
export const UI_COMPONENTS_CONTRACTS = [
|
|
4
4
|
{
|
|
@@ -283,9 +283,11 @@ export const UI_COMPONENTS_CONTRACTS = [
|
|
|
283
283
|
{
|
|
284
284
|
tag: "np-data-table",
|
|
285
285
|
component: "DataTable",
|
|
286
|
-
properties: { "columns": "array", "data": "array", "serverSide": "boolean", "isLoading": "boolean", "initialState": "object", "paginationProps": "object", "variant": "string" },
|
|
286
|
+
properties: { "columns": "array", "data": "array", "serverSide": "boolean", "isLoading": "boolean", "initialState": "object", "paginationProps": "object", "variant": "string", "isRowClickable": "string", "emptyStateProps": "object", "grouping": "object" },
|
|
287
287
|
events: { "stateChange": "onChangeTableState", "rowClick": "onRowClick" },
|
|
288
|
-
values: { "variant": ["default", "embedded", "plain"] },
|
|
288
|
+
values: { "variant": ["default", "embedded", "plain"], "grouping.layout": ["rows", "sections"], "emptyStateProps.action": [], "emptyStateProps.contentComponent": [] },
|
|
289
|
+
cssValues: ["emptyStateProps.sx", "emptyStateProps.height"],
|
|
290
|
+
imageValues: ["emptyStateProps.img"],
|
|
289
291
|
},
|
|
290
292
|
{
|
|
291
293
|
tag: "np-gauge",
|
package/dist/dataTable.d.ts
CHANGED
|
@@ -5,11 +5,19 @@ import type { TextVariant } from "./catalog.js";
|
|
|
5
5
|
*/
|
|
6
6
|
export type DataTableColor = "default" | "primary" | "secondary" | "error" | "info" | "success" | "warning";
|
|
7
7
|
export type DataTableLabelVariant = "filled" | "outlined" | "ghost" | "soft";
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* A row's menu entry, or a button with `display: 'buttons'`. `icon` is an iconify name, such as `mdi:open-in-new`.
|
|
10
|
+
* A `disabled` entry shows but can't be picked.
|
|
11
|
+
*/
|
|
9
12
|
export interface DataTableRowAction {
|
|
10
13
|
id: string;
|
|
11
14
|
label: string;
|
|
12
15
|
icon?: string;
|
|
16
|
+
/** With `display: 'buttons'`, the button's colour. An unknown one draws as `primary`. */
|
|
17
|
+
color?: "inherit" | "primary" | "secondary" | "error" | "info" | "success" | "warning";
|
|
18
|
+
/** With `display: 'buttons'`, the button's variant. An unknown one draws as `contained`. */
|
|
19
|
+
variant?: "contained" | "outlined" | "text";
|
|
20
|
+
disabled?: boolean;
|
|
13
21
|
}
|
|
14
22
|
export interface DataTableTypography {
|
|
15
23
|
variant?: TextVariant;
|
|
@@ -82,7 +90,14 @@ export type DataTableFormatter = {
|
|
|
82
90
|
} | {
|
|
83
91
|
type: "actions";
|
|
84
92
|
config: {
|
|
93
|
+
/** A kebab menu per row (`menu`, the default), or each action as a visible button at the end of the row. */
|
|
94
|
+
display?: "menu" | "buttons";
|
|
95
|
+
/**
|
|
96
|
+
* Every row's actions. A row whose value in this column is a `DataTableRowAction[]` uses that array instead,
|
|
97
|
+
* so rows can differ: an empty one draws nothing.
|
|
98
|
+
*/
|
|
85
99
|
actions: DataTableRowAction[];
|
|
100
|
+
/** The picked action's id and its row. */
|
|
86
101
|
onAction?: (actionId: string, row: DataTableRow) => void;
|
|
87
102
|
};
|
|
88
103
|
};
|
|
@@ -104,6 +119,8 @@ export interface DataTableColumn {
|
|
|
104
119
|
formatter?: DataTableFormatter;
|
|
105
120
|
/** Aligns the header and the cells together, such as `right` for numbers. Defaults to `left`. */
|
|
106
121
|
align?: "left" | "center" | "right";
|
|
122
|
+
/** Draws no column: a field `grouping` groups by without showing it anywhere else. */
|
|
123
|
+
filterOnly?: boolean;
|
|
107
124
|
}
|
|
108
125
|
/** A link cell: a route of the host, or an `href` outside it, which opens in a new tab. */
|
|
109
126
|
export type DataTableLink = {
|
|
@@ -119,7 +136,10 @@ export type DataTableAvatar = string | {
|
|
|
119
136
|
name: string;
|
|
120
137
|
color?: DataTableColor;
|
|
121
138
|
};
|
|
122
|
-
/**
|
|
139
|
+
/**
|
|
140
|
+
* A row: primitives, `DataTableLink`s in link columns, `DataTableAvatar`s in avatar columns, and a
|
|
141
|
+
* `DataTableRowAction[]` in an actions column for that row's own menu.
|
|
142
|
+
*/
|
|
123
143
|
export type DataTableRow = Record<string, unknown>;
|
|
124
144
|
export interface DataTableState {
|
|
125
145
|
sorting?: Array<{
|
|
@@ -140,3 +160,30 @@ export interface DataTablePagination {
|
|
|
140
160
|
/** Hides the pagination bar while every row fits the smallest page size, on the first page. */
|
|
141
161
|
hideWhenOnePage?: boolean;
|
|
142
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* What the table shows with no rows, in place of "No results found". The host passes `img` only from the plugin's
|
|
165
|
+
* bundle storage and `height` only as a plain number; it drops CSS (`sx`) and elements (`action`).
|
|
166
|
+
*/
|
|
167
|
+
export interface DataTableEmptyState {
|
|
168
|
+
title?: string;
|
|
169
|
+
description?: string;
|
|
170
|
+
/** An iconify name, drawn in the default empty state's circular well. */
|
|
171
|
+
icon?: string;
|
|
172
|
+
/** An image from the plugin's bundle storage, in place of the icon. */
|
|
173
|
+
img?: string;
|
|
174
|
+
height?: number;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Groups the rows under collapsible headers, client-side: inert with `serverSide`, and it hides the pager. A group
|
|
178
|
+
* is titled with its value, so group by a field that holds the title (a `filterOnly` column if it shows nowhere else).
|
|
179
|
+
*/
|
|
180
|
+
export interface DataTableGrouping {
|
|
181
|
+
/** Column ids to group by, outermost first. Empty: flat. */
|
|
182
|
+
value: readonly string[];
|
|
183
|
+
/** Groups mount collapsed. Reset whenever `value` changes. */
|
|
184
|
+
defaultCollapsed?: boolean;
|
|
185
|
+
/** Rows a group shows at first; a show-more row reveals `pageSize` more per click. Without it, all of them. */
|
|
186
|
+
pageSize?: number;
|
|
187
|
+
/** How two or more keys draw: nested header rows in one table (`rows`, the default) or a table per group. */
|
|
188
|
+
layout?: "rows" | "sections";
|
|
189
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nullplatform/ui-plugin-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "SDK for nullplatform UI plugins: catalog components, bridge client and defineUI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"test": "vitest run --passWithNoTests",
|
|
43
43
|
"sync:contracts": "node scripts/sync-contracts.mjs"
|
|
44
44
|
},
|
|
45
|
-
"uiComponentsContracts": "0.
|
|
45
|
+
"uiComponentsContracts": "0.17.1",
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@remote-dom/core": "^1.11.1",
|
|
48
48
|
"@remote-dom/react": "^1.2.2",
|