@osdk/react-components 0.2.0-beta.3 → 0.2.0-beta.4

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 (86) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +39 -22
  3. package/build/browser/object-table/DefaultCellRenderer.js +43 -0
  4. package/build/browser/object-table/DefaultCellRenderer.js.map +1 -0
  5. package/build/browser/object-table/EditableCell.js +91 -0
  6. package/build/browser/object-table/EditableCell.js.map +1 -0
  7. package/build/browser/object-table/EditableCell.module.css +3 -0
  8. package/build/browser/object-table/EditableCell.module.css.js +6 -0
  9. package/build/browser/object-table/ObjectTable.js +29 -2
  10. package/build/browser/object-table/ObjectTable.js.map +1 -1
  11. package/build/browser/object-table/ObjectTableApi.js.map +1 -1
  12. package/build/browser/object-table/Table.js +18 -3
  13. package/build/browser/object-table/Table.js.map +1 -1
  14. package/build/browser/object-table/Table.module.css +17 -1
  15. package/build/browser/object-table/Table.module.css.js +3 -1
  16. package/build/browser/object-table/TableBody.module.css +2 -0
  17. package/build/browser/object-table/TableCell.module.css +11 -1
  18. package/build/browser/object-table/TableHeader.module.css +4 -2
  19. package/build/browser/object-table/TableRow.module.css +2 -0
  20. package/build/browser/object-table/__tests__/useEditableTable.test.js +197 -0
  21. package/build/browser/object-table/__tests__/useEditableTable.test.js.map +1 -0
  22. package/build/browser/object-table/hooks/__tests__/useColumnDefs.test.js +13 -1
  23. package/build/browser/object-table/hooks/__tests__/useColumnDefs.test.js.map +1 -1
  24. package/build/browser/object-table/hooks/useColumnDefs.js +10 -2
  25. package/build/browser/object-table/hooks/useColumnDefs.js.map +1 -1
  26. package/build/browser/object-table/hooks/useEditableTable.js +57 -0
  27. package/build/browser/object-table/hooks/useEditableTable.js.map +1 -0
  28. package/build/browser/object-table/utils/getCellId.js +27 -0
  29. package/build/browser/object-table/utils/getCellId.js.map +1 -0
  30. package/build/browser/object-table/utils/types.js.map +1 -1
  31. package/build/browser/public/experimental.js.map +1 -1
  32. package/build/browser/styles.css +42 -4
  33. package/build/cjs/public/experimental.cjs +485 -289
  34. package/build/cjs/public/experimental.cjs.map +1 -1
  35. package/build/cjs/public/experimental.css +78 -48
  36. package/build/cjs/public/experimental.css.map +1 -1
  37. package/build/cjs/public/experimental.d.cts +44 -10
  38. package/build/esm/object-table/DefaultCellRenderer.js +43 -0
  39. package/build/esm/object-table/DefaultCellRenderer.js.map +1 -0
  40. package/build/esm/object-table/EditableCell.js +91 -0
  41. package/build/esm/object-table/EditableCell.js.map +1 -0
  42. package/build/esm/object-table/EditableCell.module.css +3 -0
  43. package/build/esm/object-table/ObjectTable.js +29 -2
  44. package/build/esm/object-table/ObjectTable.js.map +1 -1
  45. package/build/esm/object-table/ObjectTableApi.js.map +1 -1
  46. package/build/esm/object-table/Table.js +18 -3
  47. package/build/esm/object-table/Table.js.map +1 -1
  48. package/build/esm/object-table/Table.module.css +17 -1
  49. package/build/esm/object-table/TableBody.module.css +2 -0
  50. package/build/esm/object-table/TableCell.module.css +11 -1
  51. package/build/esm/object-table/TableHeader.module.css +4 -2
  52. package/build/esm/object-table/TableRow.module.css +2 -0
  53. package/build/esm/object-table/__tests__/useEditableTable.test.js +197 -0
  54. package/build/esm/object-table/__tests__/useEditableTable.test.js.map +1 -0
  55. package/build/esm/object-table/hooks/__tests__/useColumnDefs.test.js +13 -1
  56. package/build/esm/object-table/hooks/__tests__/useColumnDefs.test.js.map +1 -1
  57. package/build/esm/object-table/hooks/useColumnDefs.js +10 -2
  58. package/build/esm/object-table/hooks/useColumnDefs.js.map +1 -1
  59. package/build/esm/object-table/hooks/useEditableTable.js +57 -0
  60. package/build/esm/object-table/hooks/useEditableTable.js.map +1 -0
  61. package/build/esm/object-table/utils/getCellId.js +27 -0
  62. package/build/esm/object-table/utils/getCellId.js.map +1 -0
  63. package/build/esm/object-table/utils/types.js.map +1 -1
  64. package/build/esm/public/experimental.js.map +1 -1
  65. package/build/types/object-table/DefaultCellRenderer.d.ts +3 -0
  66. package/build/types/object-table/DefaultCellRenderer.d.ts.map +1 -0
  67. package/build/types/object-table/EditableCell.d.ts +10 -0
  68. package/build/types/object-table/EditableCell.d.ts.map +1 -0
  69. package/build/types/object-table/ObjectTable.d.ts +1 -1
  70. package/build/types/object-table/ObjectTable.d.ts.map +1 -1
  71. package/build/types/object-table/ObjectTableApi.d.ts +15 -0
  72. package/build/types/object-table/ObjectTableApi.d.ts.map +1 -1
  73. package/build/types/object-table/Table.d.ts +17 -3
  74. package/build/types/object-table/Table.d.ts.map +1 -1
  75. package/build/types/object-table/__tests__/useEditableTable.test.d.ts +1 -0
  76. package/build/types/object-table/__tests__/useEditableTable.test.d.ts.map +1 -0
  77. package/build/types/object-table/hooks/useColumnDefs.d.ts.map +1 -1
  78. package/build/types/object-table/hooks/useEditableTable.d.ts +22 -0
  79. package/build/types/object-table/hooks/useEditableTable.d.ts.map +1 -0
  80. package/build/types/object-table/utils/getCellId.d.ts +3 -0
  81. package/build/types/object-table/utils/getCellId.d.ts.map +1 -0
  82. package/build/types/object-table/utils/types.d.ts +9 -0
  83. package/build/types/object-table/utils/types.d.ts.map +1 -1
  84. package/build/types/public/experimental.d.ts +1 -0
  85. package/build/types/public/experimental.d.ts.map +1 -1
  86. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"experimental.js","names":["ObjectTable","BaseTable","ColumnConfigDialog"],"sources":["experimental.ts"],"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\nexport type { FilterListProps } from \"../filter-list/FilterListApi.js\";\nexport type { FilterListItemProps } from \"../filter-list/FilterListItemApi.js\";\n\n// ObjectTable that loads and displays data for a given objectSet\nexport { ObjectTable } from \"../object-table/ObjectTable.js\";\nexport type {\n ColumnDefinition,\n ColumnDefinitionLocator,\n ObjectTableProps,\n} from \"../object-table/ObjectTableApi.js\";\n\n// BaseTable that does not handle data fetching\nexport type { BaseTableProps } from \"../object-table/Table.js\";\nexport { BaseTable } from \"../object-table/Table.js\";\n\nexport { ColumnConfigDialog } from \"../object-table/ColumnConfigDialog.js\";\nexport type {\n ColumnConfigDialogProps,\n ColumnConfigOptions,\n} from \"../object-table/ColumnConfigDialog.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA,SAASA,WAAW,QAAQ,gCAAgC;;AAO5D;;AAEA,SAASC,SAAS,QAAQ,0BAA0B;AAEpD,SAASC,kBAAkB,QAAQ,uCAAuC","ignoreList":[]}
1
+ {"version":3,"file":"experimental.js","names":["ObjectTable","BaseTable","ColumnConfigDialog"],"sources":["experimental.ts"],"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\nexport type { FilterListProps } from \"../filter-list/FilterListApi.js\";\nexport type { FilterListItemProps } from \"../filter-list/FilterListItemApi.js\";\n\n// ObjectTable that loads and displays data for a given objectSet\nexport { ObjectTable } from \"../object-table/ObjectTable.js\";\nexport type {\n ColumnDefinition,\n ColumnDefinitionLocator,\n ObjectTableProps,\n} from \"../object-table/ObjectTableApi.js\";\nexport type {\n CellIdentifier,\n CellValueState,\n} from \"../object-table/utils/types.js\";\n\n// BaseTable that does not handle data fetching\nexport type { BaseTableProps } from \"../object-table/Table.js\";\nexport { BaseTable } from \"../object-table/Table.js\";\n\nexport { ColumnConfigDialog } from \"../object-table/ColumnConfigDialog.js\";\nexport type {\n ColumnConfigDialogProps,\n ColumnConfigOptions,\n} from \"../object-table/ColumnConfigDialog.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA,SAASA,WAAW,QAAQ,gCAAgC;;AAW5D;;AAEA,SAASC,SAAS,QAAQ,0BAA0B;AAEpD,SAASC,kBAAkB,QAAQ,uCAAuC","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ import type { CellContext } from "@tanstack/react-table";
2
+ import React from "react";
3
+ export declare function renderDefaultCell<TData>(cellContext: CellContext<TData, unknown>): React.ReactNode;
@@ -0,0 +1 @@
1
+ {"mappings":"AAgBA,cAAc,mBAAmB,uBAAwB;AACzD,OAAO,WAAW,OAAQ;AAI1B,OAAO,iBAAS,kBAAkB,OAChCA,aAAa,YAAY,kBACxB,MAAM","names":["cellContext: CellContext<TData, unknown>"],"sources":["../../../src/object-table/DefaultCellRenderer.tsx"],"version":3,"file":"DefaultCellRenderer.d.ts"}
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import type { CellValueState } from "./utils/types.js";
3
+ export interface EditableCellProps {
4
+ initialValue: unknown;
5
+ currentValue: unknown;
6
+ cellId: string;
7
+ dataType?: string;
8
+ onCellEdit?: (cellId: string, state: CellValueState) => void;
9
+ }
10
+ export declare function EditableCell({ initialValue, currentValue, cellId, dataType, onCellEdit }: EditableCellProps): React.ReactElement;
@@ -0,0 +1 @@
1
+ {"mappings":"AAiBA,OAAO,WAAyD,OAAQ;AAExE,cAAc,sBAAsB,kBAAmB;AAEvD,iBAAiB,kBAAkB;CACjC;CACA;CACA;CACA;CACA,cAAcA,gBAAgBC,OAAO;AACtC;AA4CD,OAAO,iBAAS,aAAa,EAC3B,cACA,cACA,QACA,UACA,YACkB,EAAjB,oBAAoB,MAAM","names":["cellId: string","state: CellValueState"],"sources":["../../../src/object-table/EditableCell.tsx"],"version":3,"file":"EditableCell.d.ts"}
@@ -13,4 +13,4 @@ export declare function ObjectTable<
13
13
  Q extends ObjectOrInterfaceDefinition,
14
14
  RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,
15
15
  FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<string, never>
16
- >({ objectType, columnDefinitions, filter, orderBy, defaultOrderBy, onOrderByChanged, onColumnsPinnedChanged, onColumnResize, onRowSelection, renderCellContextMenu, selectionMode, selectedRows, onColumnVisibilityChanged, enableOrdering, enableColumnPinning, enableColumnResizing, enableColumnConfig,...props }: ObjectTableProps<Q, RDPs, FunctionColumns>): React.ReactElement;
16
+ >({ objectType, columnDefinitions, filter, orderBy, defaultOrderBy, onOrderByChanged, onColumnsPinnedChanged, onColumnResize, onRowSelection, renderCellContextMenu, selectionMode, selectedRows, onColumnVisibilityChanged, onCellValueChanged, onSubmitEdits, enableOrdering, enableColumnPinning, enableColumnResizing, enableColumnConfig,...props }: ObjectTableProps<Q, RDPs, FunctionColumns>): React.ReactElement;
@@ -1 +1 @@
1
- {"mappings":"AAgBA,cACE,6BAGA,iBACA,yBACK,WAAY;AAGnB,OAAO,WAAqC,OAAQ;AASpD,cAAc,wBAAwB,qBAAsB;;;;;;;;;AAc5D,OAAO,iBAAS;CACd,UAAU;CACV,aAAa,eAAe,qBAAqB;CAIjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;EAI9D,EACA,YACA,mBACA,QACA,SACA,gBACA,kBACA,wBACA,gBACA,gBACA,uBACA,eACA,cACA,2BACA,gBACA,qBACA,sBACA,mBACA,GAAG,OACwC,EAA1C,iBAAiB,GAAG,MAAM,mBAAmB,MAAM","names":[],"sources":["../../../src/object-table/ObjectTable.tsx"],"version":3,"file":"ObjectTable.d.ts"}
1
+ {"mappings":"AAgBA,cACE,6BAGA,iBACA,yBACK,WAAY;AAGnB,OAAO,WAAqC,OAAQ;AAUpD,cAAc,wBAAwB,qBAAsB;;;;;;;;;AAc5D,OAAO,iBAAS;CACd,UAAU;CACV,aAAa,eAAe,qBAAqB;CAIjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;EAI9D,EACA,YACA,mBACA,QACA,SACA,gBACA,kBACA,wBACA,gBACA,gBACA,uBACA,eACA,cACA,2BACA,oBACA,eACA,gBACA,qBACA,sBACA,mBACA,GAAG,OACwC,EAA1C,iBAAiB,GAAG,MAAM,mBAAmB,MAAM","names":[],"sources":["../../../src/object-table/ObjectTable.tsx"],"version":3,"file":"ObjectTable.d.ts"}
@@ -1,5 +1,6 @@
1
1
  import type { DerivedProperty, ObjectOrInterfaceDefinition, Osdk, PrimaryKeyType, PropertyKeys, QueryDefinition, SimplePropertyDef, WhereClause } from "@osdk/api";
2
2
  import type * as React from "react";
3
+ import type { CellIdentifier, CellValueState } from "./utils/types.js";
3
4
  export type ColumnDefinition<
4
5
  Q extends ObjectOrInterfaceDefinition,
5
6
  RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,
@@ -20,6 +21,7 @@ export type ColumnDefinition<
20
21
  resizable?: boolean
21
22
  orderable?: boolean
22
23
  filterable?: boolean
24
+ editable?: boolean
23
25
  renderCell?: (object: Osdk.Instance<Q, "$allBaseProperties", PropertyKeys<Q>, RDPs>, locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>) => React.ReactNode
24
26
  /**
25
27
  * If provided, this will be used in the column header.
@@ -141,6 +143,19 @@ export interface ObjectTableProps<
141
143
  direction: "asc" | "desc"
142
144
  }>) => void;
143
145
  /**
146
+ * Called after the value of a cell is edited and committed by the user.
147
+ *
148
+ * @param cell The cell that was edited, identified by its row and column IDs
149
+ * @param state The new and old values of the cell
150
+ */
151
+ onCellValueChanged?: (cell: CellIdentifier, state: CellValueState) => void;
152
+ /**
153
+ * If provided, the button Submit Edits will be shown in the table
154
+ *
155
+ * @param edits a map of cellId (stringified CellIdentifier) to the new and old values of the cell
156
+ */
157
+ onSubmitEdits?: (edits: Record<string, CellValueState>) => Promise<void>;
158
+ /**
144
159
  * Called when the column visibility or ordering changed.
145
160
  *
146
161
  * If provided, the table will allow the user to show/hide columns.
@@ -1 +1 @@
1
- {"mappings":"AAgBA,cACE,iBACA,6BACA,MACA,gBACA,cACA,iBACA,mBACA,mBACK,WAAY;AACnB,iBAAiB,WAAW,OAAQ;AAEpC,YAAY;CACV,UAAU;CACV,aAAa,eAAe,qBAAqB;CACjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;IAI5D;CACF,SAAS,wBAAwB,GAAG,MAAM;;;;CAK1C;;;;CAKA,SAAS,SAAS,UAAU;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA,cACEA,QAAQ,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI,OAChEC,SAAS,wBAAwB,GAAG,MAAM,qBACvC,MAAM;;;;;;;;;;CAWX;;;;;CAMA,qBAAqB,MAAM;AAC5B;AAED,YAAY;CACV,UAAU;CACV,aAAa,eAAe,qBAAqB;CACjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;IAK5D;CACA,MAAM;CACN,IAAI,aAAa;AAClB,IACC;CACA,MAAM;CACN,UAAU;AACX,IACC;CACA,MAAM;CACN,UAAU;CACV,SAAS,gBAAgB,QAAQ,GAAG,WAAW;AAChD,IACC;CACA,MAAM;CACN;AACD;AAEH,iBAAiB;CACf,UAAU;CACV,aAAa,eAAe,qBAAqB;CACjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;EAI9D;;;;CAIA,YAAY;;;;;;CAOZ,oBAAoB,MAAM,iBAAiB,GAAG,MAAM;;;;;;CAOpD;;;;;CAMA,SAAS,YAAY,GAAG;;;;;;;CAQxB,mBAAmBC,UAAU,YAAY,GAAG;;;;;;CAO5C;;;;;;CAOA;;;;;;CAOA;;;;;;CAOA;;;;;;CAOA,iBAAiB,MAAM;EACrB,UAAU,aAAa;EACvB,WAAW,QAAQ;CACpB;;;;;;CAOD,UAAU,MAAM;EACd,UAAU,aAAa;EACvB,WAAW,QAAQ;CACpB;;;;;;;CAQD,oBACEC,YAAY,MAAM;EAChB,UAAU,aAAa;EACvB,WAAW,QAAQ;CACpB;;;;;;;;CAUH,6BACEC,WAAW,MAAM;EACf,UAAU,aAAa,WAAW,aAAa;EAC/C;CACD;;;;;;;;CAUH,0BACEC,WAAW,MAAM;EACf,UAAU,aAAa,WAAW,aAAa;EAC/C,QAAQ,SAAS,UAAU;CAC5B;;;;;;;CASH,kBACEC,UAAU,aAAa,WAAW,aAAa,iBAC/CC;;;;;;CAQF,cACEP,QAAQ,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI;;;;;;;;;CAWlE,gBAAgB,WAAW,aAAa;;;;;CAMxC,eAAe,eAAe;;;;;;;CAS9B,kBAAkBQ,gBAAgB,eAAe;;;;CAKjD,yBACEC,KAAK,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI,OAC7DC,uBACG,MAAM;;;;;;CAOX;CAEA;AACD","names":["object: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>","locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>","newWhere: WhereClause<Q, RDPs>","newOrderBy: Array<{\n property: PropertyKeys<Q>;\n direction: \"asc\" | \"desc\";\n }>","newStates: Array<{\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;\n isVisible: boolean;\n }>","newStates: Array<{\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;\n pinned: \"left\" | \"right\" | \"none\";\n }>","columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns","newWidth: number | null","selectedRowIds: PrimaryKeyType<Q>[]","row: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>","cellValue: unknown"],"sources":["../../../src/object-table/ObjectTableApi.ts"],"version":3,"file":"ObjectTableApi.d.ts"}
1
+ {"mappings":"AAgBA,cACE,iBACA,6BACA,MACA,gBACA,cACA,iBACA,mBACA,mBACK,WAAY;AACnB,iBAAiB,WAAW,OAAQ;AACpC,cAAc,gBAAgB,sBAAsB,kBAAmB;AAEvE,YAAY;CACV,UAAU;CACV,aAAa,eAAe,qBAAqB;CACjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;IAI5D;CACF,SAAS,wBAAwB,GAAG,MAAM;;;;CAK1C;;;;CAKA,SAAS,SAAS,UAAU;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CAEA,cACEA,QAAQ,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI,OAChEC,SAAS,wBAAwB,GAAG,MAAM,qBACvC,MAAM;;;;;;;;;;CAWX;;;;;CAMA,qBAAqB,MAAM;AAC5B;AAED,YAAY;CACV,UAAU;CACV,aAAa,eAAe,qBAAqB;CACjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;IAK5D;CACA,MAAM;CACN,IAAI,aAAa;AAClB,IACC;CACA,MAAM;CACN,UAAU;AACX,IACC;CACA,MAAM;CACN,UAAU;CACV,SAAS,gBAAgB,QAAQ,GAAG,WAAW;AAChD,IACC;CACA,MAAM;CACN;AACD;AAEH,iBAAiB;CACf,UAAU;CACV,aAAa,eAAe,qBAAqB;CACjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;EAI9D;;;;CAIA,YAAY;;;;;;CAOZ,oBAAoB,MAAM,iBAAiB,GAAG,MAAM;;;;;;CAOpD;;;;;CAMA,SAAS,YAAY,GAAG;;;;;;;CAQxB,mBAAmBC,UAAU,YAAY,GAAG;;;;;;CAO5C;;;;;;CAOA;;;;;;CAOA;;;;;;CAOA;;;;;;CAOA,iBAAiB,MAAM;EACrB,UAAU,aAAa;EACvB,WAAW,QAAQ;CACpB;;;;;;CAOD,UAAU,MAAM;EACd,UAAU,aAAa;EACvB,WAAW,QAAQ;CACpB;;;;;;;CAQD,oBACEC,YAAY,MAAM;EAChB,UAAU,aAAa;EACvB,WAAW,QAAQ;CACpB;;;;;;;CASH,sBACEC,MAAM,gBACNC,OAAO;;;;;;CAQT,iBAAiBC,OAAO,eAAe,oBAAoB;;;;;;;;CAS3D,6BACEC,WAAW,MAAM;EACf,UAAU,aAAa,WAAW,aAAa;EAC/C;CACD;;;;;;;;CAUH,0BACEC,WAAW,MAAM;EACf,UAAU,aAAa,WAAW,aAAa;EAC/C,QAAQ,SAAS,UAAU;CAC5B;;;;;;;CASH,kBACEC,UAAU,aAAa,WAAW,aAAa,iBAC/CC;;;;;;CAQF,cACEV,QAAQ,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI;;;;;;;;;CAWlE,gBAAgB,WAAW,aAAa;;;;;CAMxC,eAAe,eAAe;;;;;;;CAS9B,kBAAkBW,gBAAgB,eAAe;;;;CAKjD,yBACEC,KAAK,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI,OAC7DC,uBACG,MAAM;;;;;;CAOX;CAEA;AACD","names":["object: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>","locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>","newWhere: WhereClause<Q, RDPs>","newOrderBy: Array<{\n property: PropertyKeys<Q>;\n direction: \"asc\" | \"desc\";\n }>","cell: CellIdentifier","state: CellValueState","edits: Record<string, CellValueState>","newStates: Array<{\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;\n isVisible: boolean;\n }>","newStates: Array<{\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;\n pinned: \"left\" | \"right\" | \"none\";\n }>","columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns","newWidth: number | null","selectedRowIds: PrimaryKeyType<Q>[]","row: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>","cellValue: unknown"],"sources":["../../../src/object-table/ObjectTableApi.ts"],"version":3,"file":"ObjectTableApi.d.ts"}
@@ -1,14 +1,26 @@
1
1
  import type { Cell, RowData, Table } from "@tanstack/react-table";
2
2
  import React, { type ReactElement } from "react";
3
3
  import type { HeaderMenuFeatureFlags } from "./TableHeaderWithPopover.js";
4
+ import type { CellValueState } from "./utils/types.js";
4
5
  declare module "@tanstack/react-table" {
5
6
  interface ColumnMeta<
6
- TData extends RowData,
7
- TValue
7
+ TData extends RowData = unknown,
8
+ TValue = unknown
8
9
  > {
9
10
  columnName?: string;
10
11
  isVisible?: boolean;
12
+ editable?: boolean;
13
+ dataType?: string;
11
14
  }
15
+ interface TableMeta<TData extends RowData = unknown> {
16
+ onCellEdit?: (cellId: string, state: CellValueState) => void;
17
+ cellEdits?: Record<string, CellValueState>;
18
+ }
19
+ }
20
+ interface EditableConfig {
21
+ onSubmitEdits?: () => Promise<void>;
22
+ clearEdits?: () => void;
23
+ cellEdits?: Record<string, CellValueState>;
12
24
  }
13
25
  export interface BaseTableProps<TData extends RowData> {
14
26
  table: Table<TData>;
@@ -20,5 +32,7 @@ export interface BaseTableProps<TData extends RowData> {
20
32
  className?: string;
21
33
  error?: Error;
22
34
  headerMenuFeatureFlags?: HeaderMenuFeatureFlags;
35
+ editableConfig?: EditableConfig;
23
36
  }
24
- export declare function BaseTable<TData extends RowData>({ table, isLoading, fetchNextPage, onRowClick, rowHeight, renderCellContextMenu, className, error, headerMenuFeatureFlags }: BaseTableProps<TData>): ReactElement;
37
+ export declare function BaseTable<TData extends RowData>({ table, isLoading, fetchNextPage, onRowClick, rowHeight, renderCellContextMenu, className, error, headerMenuFeatureFlags, editableConfig }: BaseTableProps<TData>): ReactElement;
38
+ export {};
@@ -1 +1 @@
1
- {"mappings":"AAgBA,cAAc,MAAM,SAAS,aAAa,uBAAwB;AAElE,OAAO,cACA,oBAKA,OAAQ;AAMf,cAAc,8BAA8B,6BAA8B;eAE3D,wBAAwB;WAC3B;EAAW,cAAc;EAAS;GAAQ;EAClD;EACA;CACD;AACF;AAED,iBAAiB,eACf,cAAc,SACd;CACA,OAAO,MAAM;CACb;CACA,sBAAsB;CACtB,cAAcA,KAAK;CACnB;CACA,yBACEA,KAAK,OACLC,MAAM,KAAK,oBACR,MAAM;CACX;CACA,QAAQ;CACR,yBAAyB;AAC1B;AAED,OAAO,iBAAS,UACd,cAAc,SAEd,EACE,OACA,WACA,eACA,YACA,WACA,uBACA,WACA,OACA,wBACsB,EAArB,eAAe,SACjB","names":["row: TData","cell: Cell<TData, unknown>"],"sources":["../../../src/object-table/Table.tsx"],"version":3,"file":"Table.d.ts"}
1
+ {"mappings":"AAgBA,cAAc,MAAM,SAAS,aAAa,uBAAwB;AAElE,OAAO,cACA,oBAKA,OAAQ;AAOf,cAAc,8BAA8B,6BAA8B;AAC1E,cAAc,sBAAsB,kBAAmB;eAExC,wBAAwB;WAC3B;EAAW,cAAc;EAAmB;GAAkB;EACtE;EACA;EACA;EACA;CACD;WACS,UAAU,cAAc,mBAAmB;EACnD,cACEA,gBACAC,OAAO;EAET,YAAY,eAAe;CAC5B;AACF;UAES,eAAe;CACvB,sBAAsB;CACtB;CACA,YAAY,eAAe;AAC5B;AAED,iBAAiB,eACf,cAAc,SACd;CACA,OAAO,MAAM;CACb;CACA,sBAAsB;CACtB,cAAcC,KAAK;CACnB;CACA,yBACEA,KAAK,OACLC,MAAM,KAAK,oBACR,MAAM;CACX;CACA,QAAQ;CACR,yBAAyB;CACzB,iBAAiB;AAClB;AAED,OAAO,iBAAS,UACd,cAAc,SAEd,EACE,OACA,WACA,eACA,YACA,WACA,uBACA,WACA,OACA,wBACA,gBACsB,EAArB,eAAe,SACjB","names":["cellId: string","state: CellValueState","row: TData","cell: Cell<TData, unknown>"],"sources":["../../../src/object-table/Table.tsx"],"version":3,"file":"Table.d.ts"}
@@ -0,0 +1 @@
1
+ {"mappings":"","names":[],"sources":["../../../../src/object-table/__tests__/useEditableTable.test.ts"],"version":3,"file":"useEditableTable.test.d.ts"}
@@ -1 +1 @@
1
- {"mappings":"AAgBA,cAEE,6BACA,MACA,cACA,iBACA,yBACK,WAAY;AAEnB,cAAc,yBAAyB,uBAAwB;AAE/D,cAAc,wBAAwB,sBAAuB;UAEnD;CACR,UAAU;CACV,aAAa,eAAe,qBAAqB;EACjD;CACA,SAAS,kBACP,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI;CAG1D;CAEA;AACD;;;;AAKD,OAAO,iBAAS;CACd,UAAU;CACV,aAAa,eAAe,qBAAqB;CAIjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;EAK9DA,YAAY,GACZC,oBAAoB,MAAM,iBAAiB,GAAG,MAAM,oBACnD,oBAAoB,GAAG","names":["objectType: Q","columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>"],"sources":["../../../../src/object-table/hooks/useColumnDefs.ts"],"version":3,"file":"useColumnDefs.d.ts"}
1
+ {"mappings":"AAgBA,cAEE,6BACA,MACA,cACA,iBACA,yBACK,WAAY;AAEnB,cAAc,yBAAyB,uBAAwB;AAG/D,cAAc,wBAAwB,sBAAuB;UAEnD;CACR,UAAU;CACV,aAAa,eAAe,qBAAqB;EACjD;CACA,SAAS,kBACP,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI;CAG1D;CAEA;AACD;;;;AAKD,OAAO,iBAAS;CACd,UAAU;CACV,aAAa,eAAe,qBAAqB;CAIjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;EAK9DA,YAAY,GACZC,oBAAoB,MAAM,iBAAiB,GAAG,MAAM,oBACnD,oBAAoB,GAAG","names":["objectType: Q","columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>"],"sources":["../../../../src/object-table/hooks/useColumnDefs.ts"],"version":3,"file":"useColumnDefs.d.ts"}
@@ -0,0 +1,22 @@
1
+ import type { ObjectOrInterfaceDefinition, QueryDefinition, SimplePropertyDef } from "@osdk/api";
2
+ import type { ObjectTableProps } from "../ObjectTableApi.js";
3
+ import type { CellValueState } from "../utils/types.js";
4
+ export interface UseEditableTableProps<
5
+ Q extends ObjectOrInterfaceDefinition,
6
+ RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,
7
+ FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<string, never>
8
+ > {
9
+ onCellValueChanged?: ObjectTableProps<Q, RDPs, FunctionColumns>["onCellValueChanged"];
10
+ onSubmitEdits?: ObjectTableProps<Q, RDPs, FunctionColumns>["onSubmitEdits"];
11
+ }
12
+ export interface UseEditableTableResult {
13
+ cellEdits: Record<string, CellValueState>;
14
+ handleCellEdit: (cellId: string, state: CellValueState) => void;
15
+ handleSubmitEdits: () => Promise<void>;
16
+ clearEdits: () => void;
17
+ }
18
+ export declare function useEditableTable<
19
+ Q extends ObjectOrInterfaceDefinition,
20
+ RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,
21
+ FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<string, never>
22
+ >({ onCellValueChanged, onSubmitEdits }: UseEditableTableProps<Q, RDPs, FunctionColumns>): UseEditableTableResult;
@@ -0,0 +1 @@
1
+ {"mappings":"AAgBA,cACE,6BACA,iBACA,yBACK,WAAY;AAEnB,cAAc,wBAAwB,sBAAuB;AAE7D,cAAc,sBAAsB,mBAAoB;AAExD,iBAAiB;CACf,UAAU;CACV,aAAa,eAAe,qBAAqB;CAIjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;EAI9D;CACA,qBAAqB,iBACnB,GACA,MACA,iBACA;CAEF,gBAAgB,iBACd,GACA,MACA,iBACA;AACH;AAED,iBAAiB,uBAAuB;CACtC,WAAW,eAAe;CAC1B,iBACEA,gBACAC,OAAO;CAET,yBAAyB;CACzB;AACD;AAED,OAAO,iBAAS;CACd,UAAU;CACV,aAAa,eAAe,qBAAqB;CAIjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;EAI9D,EACA,oBACA,eACgD,EAA/C,sBAAsB,GAAG,MAAM,mBAAmB","names":["cellId: string","state: CellValueState"],"sources":["../../../../src/object-table/hooks/useEditableTable.ts"],"version":3,"file":"useEditableTable.d.ts"}
@@ -0,0 +1,3 @@
1
+ import type { CellIdentifier } from "./types.js";
2
+ export declare function getCellId(cellIdentifier: CellIdentifier): string;
3
+ export declare function getCellIdentifier(cellId: string): CellIdentifier;
@@ -0,0 +1 @@
1
+ {"mappings":"AAgBA,cAAc,sBAAsB,YAAa;AAEjD,OAAO,iBAAS,UAAUA,gBAAgB;AAI1C,OAAO,iBAAS,kBAAkBC,iBAAiB","names":["cellIdentifier: CellIdentifier","cellId: string"],"sources":["../../../../src/object-table/utils/getCellId.ts"],"version":3,"file":"getCellId.d.ts"}
@@ -1,5 +1,14 @@
1
+ import type { RowData } from "@tanstack/react-table";
1
2
  export interface ColumnOption {
2
3
  id: string;
3
4
  name: string;
4
5
  canSort: boolean;
5
6
  }
7
+ export interface CellIdentifier {
8
+ rowId: string;
9
+ columnId: string;
10
+ }
11
+ export interface CellValueState<TData extends RowData = unknown> {
12
+ newValue?: TData;
13
+ oldValue?: TData;
14
+ }
@@ -1 +1 @@
1
- {"mappings":"AAgBA,iBAAiB,aAAa;CAC5B;CACA;CACA;AACD","names":[],"sources":["../../../../src/object-table/utils/types.ts"],"version":3,"file":"types.d.ts"}
1
+ {"mappings":"AAgBA,cAAc,eAAe,uBAAwB;AAErD,iBAAiB,aAAa;CAC5B;CACA;CACA;AACD;AAED,iBAAiB,eAAe;CAC9B;CACA;AACD;AAED,iBAAiB,eAAe,cAAc,mBAAmB;CAC/D,WAAW;CACX,WAAW;AACZ","names":[],"sources":["../../../../src/object-table/utils/types.ts"],"version":3,"file":"types.d.ts"}
@@ -2,6 +2,7 @@ export type { FilterListProps } from "../filter-list/FilterListApi.js";
2
2
  export type { FilterListItemProps } from "../filter-list/FilterListItemApi.js";
3
3
  export { ObjectTable } from "../object-table/ObjectTable.js";
4
4
  export type { ColumnDefinition, ColumnDefinitionLocator, ObjectTableProps } from "../object-table/ObjectTableApi.js";
5
+ export type { CellIdentifier, CellValueState } from "../object-table/utils/types.js";
5
6
  export type { BaseTableProps } from "../object-table/Table.js";
6
7
  export { BaseTable } from "../object-table/Table.js";
7
8
  export { ColumnConfigDialog } from "../object-table/ColumnConfigDialog.js";
@@ -1 +1 @@
1
- {"mappings":"AAgBA,cAAc,uBAAuB;AACrC,cAAc,2BAA2B;AAGzC,SAAS,mBAAmB;AAC5B,cACE,kBACA,yBACA,wBACK;AAGP,cAAc,sBAAsB;AACpC,SAAS,iBAAiB;AAE1B,SAAS,0BAA0B;AACnC,cACE,yBACA,2BACK","names":[],"sources":["../../../src/public/experimental.ts"],"version":3,"file":"experimental.d.ts"}
1
+ {"mappings":"AAgBA,cAAc,uBAAuB;AACrC,cAAc,2BAA2B;AAGzC,SAAS,mBAAmB;AAC5B,cACE,kBACA,yBACA,wBACK;AACP,cACE,gBACA,sBACK;AAGP,cAAc,sBAAsB;AACpC,SAAS,iBAAiB;AAE1B,SAAS,0BAA0B;AACnC,cACE,yBACA,2BACK","names":[],"sources":["../../../src/public/experimental.ts"],"version":3,"file":"experimental.d.ts"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osdk/react-components",
3
- "version": "0.2.0-beta.3",
3
+ "version": "0.2.0-beta.4",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -66,11 +66,11 @@
66
66
  "react": "^18.3.1",
67
67
  "react-dom": "^18.3.1",
68
68
  "typescript": "~5.5.4",
69
- "@osdk/api": "2.8.0-beta.6",
69
+ "@osdk/api": "2.8.0-beta.7",
70
70
  "@osdk/monorepo.api-extractor": "~0.7.0-beta.1",
71
- "@osdk/client": "2.8.0-beta.6",
72
- "@osdk/react": "0.10.0-beta.4",
73
- "@osdk/monorepo.tsconfig": "~0.7.0-beta.1"
71
+ "@osdk/monorepo.tsconfig": "~0.7.0-beta.1",
72
+ "@osdk/client": "2.8.0-beta.7",
73
+ "@osdk/react": "0.10.0-beta.4"
74
74
  },
75
75
  "publishConfig": {
76
76
  "access": "public"