@osdk/react-components 0.18.0 → 0.18.1-main-56c2c9fdaf97899b89e2dfd18c578bbc6d2de4de
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 +15 -0
- package/build/browser/util/UserAgent.js +1 -1
- package/build/browser/util/UserAgent.js.map +1 -1
- package/build/cjs/chunk-4Q55HVCU.cjs +11 -0
- package/build/cjs/{chunk-URQCTCDJ.cjs.map → chunk-4Q55HVCU.cjs.map} +1 -1
- package/build/cjs/chunk-4UGBG47C.cjs +11 -0
- package/build/cjs/{chunk-RR3VWKZH.cjs.map → chunk-4UGBG47C.cjs.map} +1 -1
- package/build/cjs/{chunk-DDXYP26C.cjs → chunk-5NJPTMXK.cjs} +4 -4
- package/build/cjs/{chunk-DDXYP26C.cjs.map → chunk-5NJPTMXK.cjs.map} +1 -1
- package/build/cjs/{chunk-5YC6ASJW.cjs → chunk-A6SBI5RI.cjs} +4 -4
- package/build/cjs/{chunk-5YC6ASJW.cjs.map → chunk-A6SBI5RI.cjs.map} +1 -1
- package/build/cjs/{chunk-3ZTI3X34.cjs → chunk-AO46RUVF.cjs} +4 -4
- package/build/cjs/{chunk-3ZTI3X34.cjs.map → chunk-AO46RUVF.cjs.map} +1 -1
- package/build/cjs/{chunk-4VBZDFNF.cjs → chunk-CDP6APHZ.cjs} +4 -4
- package/build/cjs/{chunk-4VBZDFNF.cjs.map → chunk-CDP6APHZ.cjs.map} +1 -1
- package/build/cjs/{chunk-GU5FOAQH.cjs → chunk-DCPBYZ6S.cjs} +3 -3
- package/build/cjs/chunk-DCPBYZ6S.cjs.map +1 -0
- package/build/cjs/chunk-G3VNNI4O.cjs +11 -0
- package/build/cjs/{chunk-4WN66RSZ.cjs.map → chunk-G3VNNI4O.cjs.map} +1 -1
- package/build/cjs/chunk-JJOFAOLY.cjs +11 -0
- package/build/cjs/{chunk-5BNDEXWF.cjs.map → chunk-JJOFAOLY.cjs.map} +1 -1
- package/build/cjs/chunk-OLIM3OTO.cjs +11 -0
- package/build/cjs/{chunk-WVP6Y6QL.cjs.map → chunk-OLIM3OTO.cjs.map} +1 -1
- package/build/cjs/{chunk-JYNEP3MG.cjs → chunk-ROXUCLLY.cjs} +4 -4
- package/build/cjs/{chunk-JYNEP3MG.cjs.map → chunk-ROXUCLLY.cjs.map} +1 -1
- package/build/cjs/{chunk-LPGTPRYE.cjs → chunk-U3XCLZJ2.cjs} +4 -4
- package/build/cjs/{chunk-LPGTPRYE.cjs.map → chunk-U3XCLZJ2.cjs.map} +1 -1
- package/build/cjs/{chunk-G7ASG6Y4.cjs → chunk-VMRQD27O.cjs} +4 -4
- package/build/cjs/{chunk-G7ASG6Y4.cjs.map → chunk-VMRQD27O.cjs.map} +1 -1
- package/build/cjs/public/experimental/action-form.cjs +4 -4
- package/build/cjs/public/experimental/document-viewer.cjs +4 -4
- package/build/cjs/public/experimental/email-viewer.cjs +3 -3
- package/build/cjs/public/experimental/excel-viewer.cjs +3 -3
- package/build/cjs/public/experimental/filter-list.cjs +13 -13
- package/build/cjs/public/experimental/image-viewer.cjs +3 -3
- package/build/cjs/public/experimental/markdown-renderer.cjs +3 -3
- package/build/cjs/public/experimental/object-table.cjs +8 -8
- package/build/cjs/public/experimental/pdf-viewer.cjs +7 -7
- package/build/cjs/public/experimental/tiff-renderer.cjs +3 -3
- package/build/cjs/public/experimental/video-viewer.cjs +3 -3
- package/build/cjs/public/experimental/xml-viewer.cjs +3 -3
- package/build/cjs/public/experimental.cjs +46 -46
- package/build/esm/util/UserAgent.js +1 -1
- package/build/esm/util/UserAgent.js.map +1 -1
- package/docs/ActionForm.md +8 -3
- package/docs/FilterList.md +28 -21
- package/docs/ObjectTable.md +23 -19
- package/docs/Prerequisites.md +19 -1
- package/package.json +4 -4
- package/build/cjs/chunk-4WN66RSZ.cjs +0 -11
- package/build/cjs/chunk-5BNDEXWF.cjs +0 -11
- package/build/cjs/chunk-GU5FOAQH.cjs.map +0 -1
- package/build/cjs/chunk-RR3VWKZH.cjs +0 -11
- package/build/cjs/chunk-URQCTCDJ.cjs +0 -11
- package/build/cjs/chunk-WVP6Y6QL.cjs +0 -11
package/docs/FilterList.md
CHANGED
|
@@ -28,17 +28,21 @@ import { FilterList } from "@osdk/react-components/experimental/filter-list";
|
|
|
28
28
|
|
|
29
29
|
## Basic Usage
|
|
30
30
|
|
|
31
|
+
:::note About `@my/osdk` and `./client`
|
|
32
|
+
`@my/osdk` is a placeholder for **your generated SDK package** (e.g. `@your-app/sdk`). `./client` is the file in your app where you exported the OSDK client returned by `createClient(...)`. Replace both with the actual paths in your project.
|
|
33
|
+
:::
|
|
34
|
+
|
|
31
35
|
The simplest way to use FilterList is with an objectSet and a few filter definitions:
|
|
32
36
|
|
|
33
37
|
```typescript
|
|
38
|
+
import { Employee } from "@my/osdk";
|
|
34
39
|
import { FilterList } from "@osdk/react-components/experimental/filter-list";
|
|
35
|
-
import
|
|
36
|
-
import { $ } from "@YourApp/sdk";
|
|
40
|
+
import client from "./client";
|
|
37
41
|
|
|
38
42
|
function EmployeeFilters() {
|
|
39
43
|
return (
|
|
40
44
|
<FilterList
|
|
41
|
-
objectSet={
|
|
45
|
+
objectSet={client(Employee)}
|
|
42
46
|
filterDefinitions={[
|
|
43
47
|
{
|
|
44
48
|
type: "PROPERTY",
|
|
@@ -156,18 +160,18 @@ When using `type: "PROPERTY"` or `type: "LINKED_PROPERTY"`, specify a `filterCom
|
|
|
156
160
|
Use controlled `filterClause` to connect FilterList and ObjectTable:
|
|
157
161
|
|
|
158
162
|
```typescript
|
|
163
|
+
import { Employee } from "@my/osdk";
|
|
159
164
|
import type { WhereClause } from "@osdk/api";
|
|
160
165
|
import { FilterList } from "@osdk/react-components/experimental/filter-list";
|
|
161
166
|
import { ObjectTable } from "@osdk/react-components/experimental/object-table";
|
|
162
|
-
import { Employee } from "@YourApp/sdk";
|
|
163
|
-
import { $ } from "@YourApp/sdk";
|
|
164
167
|
import { useMemo, useState } from "react";
|
|
168
|
+
import client from "./client";
|
|
165
169
|
|
|
166
170
|
function EmployeeDashboard() {
|
|
167
171
|
const [filterClause, setFilterClause] = useState<
|
|
168
172
|
WhereClause<typeof Employee>
|
|
169
173
|
>({});
|
|
170
|
-
const objectSet = useMemo(() =>
|
|
174
|
+
const objectSet = useMemo(() => client(Employee), []);
|
|
171
175
|
|
|
172
176
|
return (
|
|
173
177
|
<div style={{ display: "flex", gap: 16, height: 600 }}>
|
|
@@ -242,7 +246,7 @@ const filterDefinitions = [
|
|
|
242
246
|
];
|
|
243
247
|
|
|
244
248
|
<FilterList
|
|
245
|
-
objectSet={
|
|
249
|
+
objectSet={client(Employee)}
|
|
246
250
|
filterDefinitions={filterDefinitions}
|
|
247
251
|
addFilterMode="uncontrolled"
|
|
248
252
|
showResetButton={true}
|
|
@@ -263,7 +267,7 @@ const handleFilterRemoved = (filterKey) => {
|
|
|
263
267
|
};
|
|
264
268
|
|
|
265
269
|
<FilterList
|
|
266
|
-
objectSet={
|
|
270
|
+
objectSet={client(Employee)}
|
|
267
271
|
filterDefinitions={definitions}
|
|
268
272
|
addFilterMode="controlled"
|
|
269
273
|
onFilterRemoved={handleFilterRemoved}
|
|
@@ -276,14 +280,14 @@ const handleFilterRemoved = (filterKey) => {
|
|
|
276
280
|
Pass a `.where()` objectSet to scope filter dropdown values. For example, to only show Engineering employees:
|
|
277
281
|
|
|
278
282
|
```typescript
|
|
283
|
+
import { Employee } from "@my/osdk";
|
|
279
284
|
import { FilterList } from "@osdk/react-components/experimental/filter-list";
|
|
280
|
-
import { Employee } from "@YourApp/sdk";
|
|
281
|
-
import { $ } from "@YourApp/sdk";
|
|
282
285
|
import { useMemo } from "react";
|
|
286
|
+
import client from "./client";
|
|
283
287
|
|
|
284
288
|
function EngineeringFilters() {
|
|
285
289
|
const engineeringSet = useMemo(
|
|
286
|
-
() =>
|
|
290
|
+
() => client(Employee).where({ department: "Engineering" }),
|
|
287
291
|
[],
|
|
288
292
|
);
|
|
289
293
|
|
|
@@ -316,7 +320,10 @@ const filterDefinitions = [
|
|
|
316
320
|
{ type: "PROPERTY", key: "locationCity", filterComponent: "LISTOGRAM" },
|
|
317
321
|
];
|
|
318
322
|
|
|
319
|
-
<FilterList
|
|
323
|
+
<FilterList
|
|
324
|
+
objectSet={client(Employee)}
|
|
325
|
+
filterDefinitions={filterDefinitions}
|
|
326
|
+
/>;
|
|
320
327
|
```
|
|
321
328
|
|
|
322
329
|
### Custom Listogram Colors
|
|
@@ -325,7 +332,7 @@ Assign colors to specific values in a listogram:
|
|
|
325
332
|
|
|
326
333
|
```typescript
|
|
327
334
|
<FilterList
|
|
328
|
-
objectSet={
|
|
335
|
+
objectSet={client(Employee)}
|
|
329
336
|
filterDefinitions={[
|
|
330
337
|
{
|
|
331
338
|
type: "PROPERTY",
|
|
@@ -353,7 +360,7 @@ const USER_NAMES: Record<string, string> = {
|
|
|
353
360
|
};
|
|
354
361
|
|
|
355
362
|
<FilterList
|
|
356
|
-
objectSet={
|
|
363
|
+
objectSet={client(Task)}
|
|
357
364
|
filterDefinitions={[
|
|
358
365
|
{
|
|
359
366
|
type: "PROPERTY",
|
|
@@ -379,7 +386,7 @@ Control how much detail each listogram row shows:
|
|
|
379
386
|
// "minimal": checkbox + label only
|
|
380
387
|
|
|
381
388
|
<FilterList
|
|
382
|
-
objectSet={
|
|
389
|
+
objectSet={client(Employee)}
|
|
383
390
|
filterDefinitions={[
|
|
384
391
|
{
|
|
385
392
|
type: "PROPERTY",
|
|
@@ -397,7 +404,7 @@ By default, LISTOGRAM filters show at most 5 items with a "View all" link. Overr
|
|
|
397
404
|
|
|
398
405
|
```typescript
|
|
399
406
|
<FilterList
|
|
400
|
-
objectSet={
|
|
407
|
+
objectSet={client(Employee)}
|
|
401
408
|
filterDefinitions={[
|
|
402
409
|
{
|
|
403
410
|
type: "PROPERTY",
|
|
@@ -421,7 +428,7 @@ function CollapsibleFilters() {
|
|
|
421
428
|
|
|
422
429
|
return (
|
|
423
430
|
<FilterList
|
|
424
|
-
objectSet={
|
|
431
|
+
objectSet={client(Employee)}
|
|
425
432
|
title="Filters"
|
|
426
433
|
collapsed={collapsed}
|
|
427
434
|
onCollapsedChange={setCollapsed}
|
|
@@ -440,7 +447,7 @@ Enable reordering of filters via drag and drop:
|
|
|
440
447
|
|
|
441
448
|
```typescript
|
|
442
449
|
<FilterList
|
|
443
|
-
objectSet={
|
|
450
|
+
objectSet={client(Employee)}
|
|
444
451
|
filterDefinitions={filterDefinitions}
|
|
445
452
|
enableSorting={true}
|
|
446
453
|
/>;
|
|
@@ -454,7 +461,7 @@ LISTOGRAM and TEXT_TAGS filters support an exclude/include toggle. Hover a filte
|
|
|
454
461
|
// Exclude mode is built into LISTOGRAM filters automatically.
|
|
455
462
|
// Users access it via the overflow menu (three dots) on each filter item.
|
|
456
463
|
<FilterList
|
|
457
|
-
objectSet={
|
|
464
|
+
objectSet={client(Employee)}
|
|
458
465
|
filterDefinitions={[
|
|
459
466
|
{
|
|
460
467
|
type: "PROPERTY",
|
|
@@ -487,7 +494,7 @@ Use the `className` prop for scoped styling:
|
|
|
487
494
|
|
|
488
495
|
```typescript
|
|
489
496
|
<FilterList
|
|
490
|
-
objectSet={
|
|
497
|
+
objectSet={client(Employee)}
|
|
491
498
|
className="my-custom-filters"
|
|
492
499
|
filterDefinitions={[...]}
|
|
493
500
|
/>
|
|
@@ -499,6 +506,6 @@ For a full reference of CSS tokens, see the [CSS Variables documentation](./CSSV
|
|
|
499
506
|
|
|
500
507
|
- **Memoize filterDefinitions** -- define the array outside the component or wrap in `useMemo` to avoid unnecessary re-renders
|
|
501
508
|
- **Use controlled mode for persistence** -- provide `filterClause` and `onFilterClauseChanged` to persist filter state across navigation
|
|
502
|
-
- **Use objectSet constraints to scope filter values** -- pass a prefiltered objectSet (e.g.
|
|
509
|
+
- **Use objectSet constraints to scope filter values** -- pass a prefiltered objectSet (e.g. `client(Employee).where(...)`) so filter dropdowns only show relevant values
|
|
503
510
|
- **Keep filter lists focused** -- show 3-8 filters; too many filters overwhelm users
|
|
504
511
|
- **Use `addFilterMode="uncontrolled"` for progressive disclosure** -- start with a few visible filters and let users add more as needed
|
package/docs/ObjectTable.md
CHANGED
|
@@ -34,13 +34,17 @@ import type {
|
|
|
34
34
|
|
|
35
35
|
## Basic Usage
|
|
36
36
|
|
|
37
|
+
:::note About `@my/osdk`
|
|
38
|
+
`@my/osdk` is a placeholder for **your generated SDK package** (e.g. `@your-app/sdk`). Replace it with the actual package name in your project.
|
|
39
|
+
:::
|
|
40
|
+
|
|
37
41
|
### Minimal Example
|
|
38
42
|
|
|
39
43
|
The simplest way to use ObjectTable is with just an object type:
|
|
40
44
|
|
|
41
45
|
```typescript
|
|
46
|
+
import { Office } from "@my/osdk";
|
|
42
47
|
import { ObjectTable } from "@osdk/react-components/experimental/object-table";
|
|
43
|
-
import { Office } from "@YourApp/sdk";
|
|
44
48
|
|
|
45
49
|
function OfficesPage() {
|
|
46
50
|
return (
|
|
@@ -311,11 +315,11 @@ Displays header and cell with the provided custom renderers.
|
|
|
311
315
|
### Example 1: Basic Table with Custom Column Definitions
|
|
312
316
|
|
|
313
317
|
```typescript
|
|
318
|
+
import { Employee } from "@my/osdk";
|
|
314
319
|
import {
|
|
315
320
|
type ColumnDefinition,
|
|
316
321
|
ObjectTable,
|
|
317
322
|
} from "@osdk/react-components/experimental/object-table";
|
|
318
|
-
import { Employee } from "@YourApp/sdk";
|
|
319
323
|
|
|
320
324
|
const columnDefinitions: Array<ColumnDefinition<typeof Employee>> = [
|
|
321
325
|
{
|
|
@@ -348,8 +352,8 @@ function EmployeesTable() {
|
|
|
348
352
|
### Example 2: Table with Multiple Selection
|
|
349
353
|
|
|
350
354
|
```typescript
|
|
355
|
+
import { Employee } from "@my/osdk";
|
|
351
356
|
import { ObjectTable } from "@osdk/react-components/experimental/object-table";
|
|
352
|
-
import { Employee } from "@YourApp/sdk";
|
|
353
357
|
|
|
354
358
|
function EmployeesTable() {
|
|
355
359
|
return (
|
|
@@ -364,8 +368,8 @@ function EmployeesTable() {
|
|
|
364
368
|
### Example 3: Table with Default Sorting
|
|
365
369
|
|
|
366
370
|
```typescript
|
|
371
|
+
import { Employee } from "@my/osdk";
|
|
367
372
|
import { ObjectTable } from "@osdk/react-components/experimental/object-table";
|
|
368
|
-
import { Employee } from "@YourApp/sdk";
|
|
369
373
|
|
|
370
374
|
function EmployeesTable() {
|
|
371
375
|
return (
|
|
@@ -383,11 +387,11 @@ function EmployeesTable() {
|
|
|
383
387
|
### Example 4: Custom Cell Rendering
|
|
384
388
|
|
|
385
389
|
```typescript
|
|
390
|
+
import { Employee } from "@my/osdk";
|
|
386
391
|
import {
|
|
387
392
|
type ColumnDefinition,
|
|
388
393
|
ObjectTable,
|
|
389
394
|
} from "@osdk/react-components/experimental/object-table";
|
|
390
|
-
import { Employee } from "@YourApp/sdk";
|
|
391
395
|
|
|
392
396
|
const columnDefinitions: Array<ColumnDefinition<typeof Employee>> = [
|
|
393
397
|
{
|
|
@@ -420,11 +424,11 @@ function EmployeesTable() {
|
|
|
420
424
|
### Example 5: Custom Header Rendering
|
|
421
425
|
|
|
422
426
|
```typescript
|
|
427
|
+
import { Employee } from "@my/osdk";
|
|
423
428
|
import {
|
|
424
429
|
type ColumnDefinition,
|
|
425
430
|
ObjectTable,
|
|
426
431
|
} from "@osdk/react-components/experimental/object-table";
|
|
427
|
-
import { Employee } from "@YourApp/sdk";
|
|
428
432
|
|
|
429
433
|
const columnDefinitions: Array<ColumnDefinition<typeof Employee>> = [
|
|
430
434
|
{
|
|
@@ -470,8 +474,8 @@ const columnDefinitions: Array<ColumnDefinition<typeof Employee>> = [
|
|
|
470
474
|
### Example 7: Context Menu on Cell Right-Click
|
|
471
475
|
|
|
472
476
|
```typescript
|
|
477
|
+
import { Employee } from "@my/osdk";
|
|
473
478
|
import { ObjectTable } from "@osdk/react-components/experimental/object-table";
|
|
474
|
-
import { Employee } from "@YourApp/sdk";
|
|
475
479
|
|
|
476
480
|
function EmployeesTable() {
|
|
477
481
|
const renderCellContextMenu = (employee: Employee, cellValue: unknown) => (
|
|
@@ -507,8 +511,8 @@ function EmployeesTable() {
|
|
|
507
511
|
### Example 8: Row Click Handler
|
|
508
512
|
|
|
509
513
|
```typescript
|
|
514
|
+
import { Employee } from "@my/osdk";
|
|
510
515
|
import { ObjectTable } from "@osdk/react-components/experimental/object-table";
|
|
511
|
-
import { Employee } from "@YourApp/sdk";
|
|
512
516
|
import { useRouter } from "next/router";
|
|
513
517
|
|
|
514
518
|
function EmployeesTable() {
|
|
@@ -532,12 +536,12 @@ function EmployeesTable() {
|
|
|
532
536
|
You can filter by object properties and derived properties by including them in the `WhereClause`:
|
|
533
537
|
|
|
534
538
|
```typescript
|
|
539
|
+
import { Employee } from "@my/osdk";
|
|
535
540
|
import { DerivedProperty } from "@osdk/client";
|
|
536
541
|
import {
|
|
537
542
|
type ColumnDefinition,
|
|
538
543
|
ObjectTable,
|
|
539
544
|
} from "@osdk/react-components/experimental/object-table";
|
|
540
|
-
import { Employee } from "@YourApp/sdk";
|
|
541
545
|
|
|
542
546
|
type RDPs = {
|
|
543
547
|
managerName: string | undefined;
|
|
@@ -580,8 +584,8 @@ function EmployeesWithManagerTable() {
|
|
|
580
584
|
### Example 10: Controlled Sorting
|
|
581
585
|
|
|
582
586
|
```typescript
|
|
587
|
+
import { Employee } from "@my/osdk";
|
|
583
588
|
import { ObjectTable } from "@osdk/react-components/experimental/object-table";
|
|
584
|
-
import { Employee } from "@YourApp/sdk";
|
|
585
589
|
import { useState } from "react";
|
|
586
590
|
|
|
587
591
|
function EmployeesTable() {
|
|
@@ -607,8 +611,8 @@ function EmployeesTable() {
|
|
|
607
611
|
### Example 11: Controlled Row Selection
|
|
608
612
|
|
|
609
613
|
```typescript
|
|
614
|
+
import { Employee } from "@my/osdk";
|
|
610
615
|
import { ObjectTable } from "@osdk/react-components/experimental/object-table";
|
|
611
|
-
import { Employee } from "@YourApp/sdk";
|
|
612
616
|
import { useState } from "react";
|
|
613
617
|
|
|
614
618
|
function EmployeesTable() {
|
|
@@ -704,11 +708,11 @@ The legacy `onRowSelection(selectedRowIds, isSelectAll?)` callback is deprecated
|
|
|
704
708
|
In a custom column type, you can render anything in the column by passing in renderHeader and renderCell props.
|
|
705
709
|
|
|
706
710
|
```typescript
|
|
711
|
+
import { Employee } from "@my/osdk";
|
|
707
712
|
import {
|
|
708
713
|
type ColumnDefinition,
|
|
709
714
|
ObjectTable,
|
|
710
715
|
} from "@osdk/react-components/experimental/object-table";
|
|
711
|
-
import { Employee } from "@YourApp/sdk";
|
|
712
716
|
|
|
713
717
|
const columnDefinitions: Array<ColumnDefinition<typeof Employee>> = [
|
|
714
718
|
{
|
|
@@ -743,13 +747,13 @@ function EmployeesTable() {
|
|
|
743
747
|
Enable inline editing with validation, dropdown selectors, and bulk submission:
|
|
744
748
|
|
|
745
749
|
```typescript
|
|
750
|
+
import { Employee, updateMultipleEmployees } from "@my/osdk";
|
|
746
751
|
import { useOsdkAction } from "@osdk/react";
|
|
747
752
|
import {
|
|
748
753
|
type CellEditInfo,
|
|
749
754
|
type ColumnDefinition,
|
|
750
755
|
ObjectTable,
|
|
751
756
|
} from "@osdk/react-components/experimental/object-table";
|
|
752
|
-
import { Employee, updateMultipleEmployees } from "@YourApp/sdk";
|
|
753
757
|
|
|
754
758
|
const columnDefinitions: Array<ColumnDefinition<typeof Employee>> = [
|
|
755
759
|
{
|
|
@@ -885,11 +889,11 @@ function EditableEmployeesTable() {
|
|
|
885
889
|
Pass a function to `editable` to gate editing per row, and a `getFieldComponentProps` function to compute editor props from the row's data:
|
|
886
890
|
|
|
887
891
|
```typescript
|
|
892
|
+
import { Employee } from "@my/osdk";
|
|
888
893
|
import {
|
|
889
894
|
type ColumnDefinition,
|
|
890
895
|
ObjectTable,
|
|
891
896
|
} from "@osdk/react-components/experimental/object-table";
|
|
892
|
-
import { Employee } from "@YourApp/sdk";
|
|
893
897
|
|
|
894
898
|
const columnDefinitions: Array<ColumnDefinition<typeof Employee>> = [
|
|
895
899
|
{
|
|
@@ -916,12 +920,12 @@ const columnDefinitions: Array<ColumnDefinition<typeof Employee>> = [
|
|
|
916
920
|
Use the `ColumnConfigDialog` component to create a custom column configuration experience:
|
|
917
921
|
|
|
918
922
|
```typescript
|
|
923
|
+
import { Employee } from "@my/osdk";
|
|
919
924
|
import {
|
|
920
925
|
ColumnConfigDialog,
|
|
921
926
|
type ColumnDefinition,
|
|
922
927
|
ObjectTable,
|
|
923
928
|
} from "@osdk/react-components/experimental/object-table";
|
|
924
|
-
import { Employee } from "@YourApp/sdk";
|
|
925
929
|
import { useCallback, useMemo, useState } from "react";
|
|
926
930
|
|
|
927
931
|
const initialColumnDefinitions: Array<ColumnDefinition<typeof Employee>> = [
|
|
@@ -1045,11 +1049,11 @@ This example demonstrates:
|
|
|
1045
1049
|
Display values computed by OSDK functions (queries) alongside regular property columns. Function columns automatically handle loading states, caching, and deduplication.
|
|
1046
1050
|
|
|
1047
1051
|
```typescript
|
|
1052
|
+
import { Employee, getEmployeeMetrics } from "@my/osdk";
|
|
1048
1053
|
import {
|
|
1049
1054
|
type ColumnDefinition,
|
|
1050
1055
|
ObjectTable,
|
|
1051
1056
|
} from "@osdk/react-components/experimental/object-table";
|
|
1052
|
-
import { Employee, getEmployeeMetrics } from "@YourApp/sdk";
|
|
1053
1057
|
|
|
1054
1058
|
// Define a type map for your function columns
|
|
1055
1059
|
type EmployeeFunctionColumns = {
|
|
@@ -1220,9 +1224,9 @@ Adjust row height for better readability:
|
|
|
1220
1224
|
Use `getRowAttributes` to apply custom HTML attributes (typically `data-*` attributes) to each `<tr>` element. This is the recommended pattern for conditional row styling — for example, changing a row's background color based on the underlying object's state.
|
|
1221
1225
|
|
|
1222
1226
|
```tsx
|
|
1227
|
+
import { Employee } from "@my/osdk";
|
|
1223
1228
|
import type { Osdk } from "@osdk/api";
|
|
1224
1229
|
import { ObjectTable } from "@osdk/react-components/experimental/object-table";
|
|
1225
|
-
import { Employee } from "@YourApp/sdk";
|
|
1226
1230
|
import { useCallback } from "react";
|
|
1227
1231
|
|
|
1228
1232
|
function EmployeesTable() {
|
|
@@ -1292,11 +1296,11 @@ The ObjectTable automatically implements infinite scroll pagination, with page s
|
|
|
1292
1296
|
Use TypeScript generics to ensure type safety:
|
|
1293
1297
|
|
|
1294
1298
|
```typescript
|
|
1299
|
+
import { Employee } from "@my/osdk";
|
|
1295
1300
|
import {
|
|
1296
1301
|
type ColumnDefinition,
|
|
1297
1302
|
ObjectTable,
|
|
1298
1303
|
} from "@osdk/react-components/experimental/object-table";
|
|
1299
|
-
import { Employee } from "@YourApp/sdk";
|
|
1300
1304
|
|
|
1301
1305
|
type RDPs = {
|
|
1302
1306
|
managerName: string | undefined;
|
|
@@ -1319,8 +1323,8 @@ const columnDefinitions: Array<ColumnDefinition<typeof Employee, RDPs>> = [
|
|
|
1319
1323
|
Let TypeScript infer types from your OSDK object type:
|
|
1320
1324
|
|
|
1321
1325
|
```typescript
|
|
1326
|
+
import { Employee } from "@my/osdk";
|
|
1322
1327
|
import type { PropertyKeys } from "@osdk/client";
|
|
1323
|
-
import { Employee } from "@YourApp/sdk";
|
|
1324
1328
|
|
|
1325
1329
|
// PropertyKeys gives you all valid property names
|
|
1326
1330
|
type EmployeeProps = PropertyKeys<typeof Employee>;
|
package/docs/Prerequisites.md
CHANGED
|
@@ -8,11 +8,29 @@ Setup required before using `@osdk/react-components` or `@osdk/cbac-components`.
|
|
|
8
8
|
|
|
9
9
|
## Install dependencies
|
|
10
10
|
|
|
11
|
+
:::tip If your tooling already installs dependencies, skip this step.
|
|
12
|
+
:::
|
|
13
|
+
|
|
14
|
+
Use whichever package manager your project uses (`# if using CBAC components` lines are optional):
|
|
15
|
+
|
|
11
16
|
```bash
|
|
17
|
+
# npm
|
|
12
18
|
npm install @osdk/api@beta @osdk/client@beta @osdk/react@beta
|
|
13
19
|
npm install @osdk/react-components
|
|
14
20
|
npm install @osdk/cbac-components # if using CBAC components
|
|
15
21
|
npm install react react-dom classnames
|
|
22
|
+
|
|
23
|
+
# pnpm
|
|
24
|
+
pnpm add @osdk/api@beta @osdk/client@beta @osdk/react@beta
|
|
25
|
+
pnpm add @osdk/react-components
|
|
26
|
+
pnpm add @osdk/cbac-components # if using CBAC components
|
|
27
|
+
pnpm add react react-dom classnames
|
|
28
|
+
|
|
29
|
+
# yarn
|
|
30
|
+
yarn add @osdk/api@beta @osdk/client@beta @osdk/react@beta
|
|
31
|
+
yarn add @osdk/react-components
|
|
32
|
+
yarn add @osdk/cbac-components # if using CBAC components
|
|
33
|
+
yarn add react react-dom classnames
|
|
16
34
|
```
|
|
17
35
|
|
|
18
36
|
## Configure the OSDK client
|
|
@@ -25,7 +43,7 @@ import { OsdkProvider } from "@osdk/react";
|
|
|
25
43
|
|
|
26
44
|
const client = createClient(
|
|
27
45
|
"https://your-stack.palantirfoundry.com",
|
|
28
|
-
"ri.ontology.main.ontology.
|
|
46
|
+
"ri.ontology.main.ontology.{UUID}",
|
|
29
47
|
async () => {
|
|
30
48
|
// return your auth token
|
|
31
49
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osdk/react-components",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.1-main-56c2c9fdaf97899b89e2dfd18c578bbc6d2de4de",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -211,11 +211,11 @@
|
|
|
211
211
|
"react-dom": "^18.3.1",
|
|
212
212
|
"typescript": "~5.5.4",
|
|
213
213
|
"@osdk/aip-core": "0.4.0",
|
|
214
|
-
"@osdk/client": "2.22.0",
|
|
215
214
|
"@osdk/api": "2.22.0",
|
|
215
|
+
"@osdk/client": "2.22.0",
|
|
216
216
|
"@osdk/monorepo.api-extractor": "~0.7.0",
|
|
217
|
-
"@osdk/
|
|
218
|
-
"@osdk/
|
|
217
|
+
"@osdk/monorepo.tsconfig": "~0.7.0",
|
|
218
|
+
"@osdk/react": "2.22.0"
|
|
219
219
|
},
|
|
220
220
|
"publishConfig": {
|
|
221
221
|
"access": "public"
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkPKJFOG2Z_cjs = require('./chunk-PKJFOG2Z.cjs');
|
|
4
|
-
var chunkGU5FOAQH_cjs = require('./chunk-GU5FOAQH.cjs');
|
|
5
|
-
|
|
6
|
-
// src/public/experimental/email-viewer.ts
|
|
7
|
-
var EmailViewer2 = chunkGU5FOAQH_cjs.withOsdkMetrics(chunkPKJFOG2Z_cjs.EmailViewer, "EmailViewer");
|
|
8
|
-
|
|
9
|
-
exports.EmailViewer = EmailViewer2;
|
|
10
|
-
//# sourceMappingURL=chunk-4WN66RSZ.cjs.map
|
|
11
|
-
//# sourceMappingURL=chunk-4WN66RSZ.cjs.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunk4VJIPB7R_cjs = require('./chunk-4VJIPB7R.cjs');
|
|
4
|
-
var chunkGU5FOAQH_cjs = require('./chunk-GU5FOAQH.cjs');
|
|
5
|
-
|
|
6
|
-
// src/public/experimental/excel-viewer.ts
|
|
7
|
-
var ExcelViewer2 = chunkGU5FOAQH_cjs.withOsdkMetrics(chunk4VJIPB7R_cjs.ExcelViewer, "ExcelViewer");
|
|
8
|
-
|
|
9
|
-
exports.ExcelViewer = ExcelViewer2;
|
|
10
|
-
//# sourceMappingURL=chunk-5BNDEXWF.cjs.map
|
|
11
|
-
//# sourceMappingURL=chunk-5BNDEXWF.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/util/UserAgent.ts","../../src/util/withOsdkMetrics.ts"],"names":["useRegisterUserAgent","React"],"mappings":";;;;;;;;;;;;AAgBA,IAAM,kBAAA,GAAqB,yBAAyB,QAA2B,CAAA,CAAA;AACxE,SAAS,mBAAmB,aAAA,EAAe;AAChD,EAAA,OAAO,CAAA,EAAG,kBAAkB,CAAA,CAAA,EAAI,aAAa,CAAA,CAAA;AAC/C;;;ACKO,SAAS,eAAA,CAAgB,WAAW,IAAA,EAAM;AAC/C,EAAA,MAAM,UAAU,CAAA,KAAA,KAAS;AACvB,IAAAA,0BAAA,CAAqB,kBAAA,CAAmB,IAAI,CAAC,CAAA;AAC7C,IAAA,uBAAoBC,sBAAA,CAAM,aAAA,CAAc,SAAA,EAAW,KAAK,CAAA;AAAA,EAC1D,CAAA;AACA,EAAA,OAAA,CAAQ,WAAA,GAAc,mBAAmB,IAAI,CAAA,CAAA,CAAA;AAC7C,EAAA,OAAO,OAAA;AACT","file":"chunk-GU5FOAQH.cjs","sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst PACKAGE_USER_AGENT = `osdk-react-components/${process.env.PACKAGE_VERSION}`;\nexport function componentUserAgent(componentName) {\n return `${PACKAGE_USER_AGENT}/${componentName}`;\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useRegisterUserAgent } from \"@osdk/react\";\nimport React from \"react\";\nimport { componentUserAgent } from \"./UserAgent.js\";\n\n// `any` is required: FunctionComponent defaults to FunctionComponent<{}> which\n// rejects components with required props. A generic P parameter doesn't help\n// because TS can't infer both P and C simultaneously from a single argument.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function withOsdkMetrics(Component, name) {\n const Wrapped = props => {\n useRegisterUserAgent(componentUserAgent(name));\n return /*#__PURE__*/React.createElement(Component, props);\n };\n Wrapped.displayName = `withOsdkMetrics(${name})`;\n return Wrapped;\n}"]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkKHMOMROL_cjs = require('./chunk-KHMOMROL.cjs');
|
|
4
|
-
var chunkGU5FOAQH_cjs = require('./chunk-GU5FOAQH.cjs');
|
|
5
|
-
|
|
6
|
-
// src/public/experimental/video-viewer.ts
|
|
7
|
-
var VideoViewer2 = chunkGU5FOAQH_cjs.withOsdkMetrics(chunkKHMOMROL_cjs.VideoViewer, "VideoViewer");
|
|
8
|
-
|
|
9
|
-
exports.VideoViewer = VideoViewer2;
|
|
10
|
-
//# sourceMappingURL=chunk-RR3VWKZH.cjs.map
|
|
11
|
-
//# sourceMappingURL=chunk-RR3VWKZH.cjs.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkVOROB7KJ_cjs = require('./chunk-VOROB7KJ.cjs');
|
|
4
|
-
var chunkGU5FOAQH_cjs = require('./chunk-GU5FOAQH.cjs');
|
|
5
|
-
|
|
6
|
-
// src/public/experimental/image-viewer.ts
|
|
7
|
-
var ImageViewer2 = chunkGU5FOAQH_cjs.withOsdkMetrics(chunkVOROB7KJ_cjs.ImageViewer, "ImageViewer");
|
|
8
|
-
|
|
9
|
-
exports.ImageViewer = ImageViewer2;
|
|
10
|
-
//# sourceMappingURL=chunk-URQCTCDJ.cjs.map
|
|
11
|
-
//# sourceMappingURL=chunk-URQCTCDJ.cjs.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkOUJQJQ7N_cjs = require('./chunk-OUJQJQ7N.cjs');
|
|
4
|
-
var chunkGU5FOAQH_cjs = require('./chunk-GU5FOAQH.cjs');
|
|
5
|
-
|
|
6
|
-
// src/public/experimental/xml-viewer.ts
|
|
7
|
-
var XmlViewer2 = chunkGU5FOAQH_cjs.withOsdkMetrics(chunkOUJQJQ7N_cjs.XmlViewer, "XmlViewer");
|
|
8
|
-
|
|
9
|
-
exports.XmlViewer = XmlViewer2;
|
|
10
|
-
//# sourceMappingURL=chunk-WVP6Y6QL.cjs.map
|
|
11
|
-
//# sourceMappingURL=chunk-WVP6Y6QL.cjs.map
|