@osdk/react-components 0.0.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 +5 -0
- package/README.md +17 -0
- package/build/browser/filter-list/FilterListApi.js +2 -0
- package/build/browser/filter-list/FilterListApi.js.map +1 -0
- package/build/browser/filter-list/FilterListItemApi.js +2 -0
- package/build/browser/filter-list/FilterListItemApi.js.map +1 -0
- package/build/browser/index.js +19 -0
- package/build/browser/index.js.map +1 -0
- package/build/browser/junk.test.js +23 -0
- package/build/browser/junk.test.js.map +1 -0
- package/build/browser/object-table/ObjectTableApi.js +2 -0
- package/build/browser/object-table/ObjectTableApi.js.map +1 -0
- package/build/browser/public/experimental.js +2 -0
- package/build/browser/public/experimental.js.map +1 -0
- package/build/cjs/index.cjs +4 -0
- package/build/cjs/index.cjs.map +1 -0
- package/build/cjs/index.d.cts +2 -0
- package/build/cjs/public/experimental.cjs +4 -0
- package/build/cjs/public/experimental.cjs.map +1 -0
- package/build/cjs/public/experimental.d.cts +320 -0
- package/build/esm/filter-list/FilterListApi.js +2 -0
- package/build/esm/filter-list/FilterListApi.js.map +1 -0
- package/build/esm/filter-list/FilterListItemApi.js +2 -0
- package/build/esm/filter-list/FilterListItemApi.js.map +1 -0
- package/build/esm/index.js +19 -0
- package/build/esm/index.js.map +1 -0
- package/build/esm/junk.test.js +23 -0
- package/build/esm/junk.test.js.map +1 -0
- package/build/esm/object-table/ObjectTableApi.js +2 -0
- package/build/esm/object-table/ObjectTableApi.js.map +1 -0
- package/build/esm/public/experimental.js +2 -0
- package/build/esm/public/experimental.js.map +1 -0
- package/build/types/filter-list/FilterListApi.d.ts +65 -0
- package/build/types/filter-list/FilterListApi.d.ts.map +1 -0
- package/build/types/filter-list/FilterListItemApi.d.ts +126 -0
- package/build/types/filter-list/FilterListItemApi.d.ts.map +1 -0
- package/build/types/index.d.ts +0 -0
- package/build/types/index.d.ts.map +1 -0
- package/build/types/junk.test.d.ts +1 -0
- package/build/types/junk.test.d.ts.map +1 -0
- package/build/types/object-table/ObjectTableApi.d.ts +158 -0
- package/build/types/object-table/ObjectTableApi.d.ts.map +1 -0
- package/build/types/public/experimental.d.ts +3 -0
- package/build/types/public/experimental.d.ts.map +1 -0
- package/experimental.d.ts +17 -0
- package/package.json +86 -0
package/CHANGELOG.md
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# @osdk/react-components
|
|
2
|
+
|
|
3
|
+
React components library for building applications with the Ontology SDK.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install @osdk/react-components
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
This package provides reusable React components built on top of `@osdk/react` for common Ontology SDK use cases.
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import {/* your components */} from "@osdk/components";
|
|
17
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterListApi.js","names":[],"sources":["FilterListApi.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\nimport type { ObjectSet, ObjectTypeDefinition, WhereClause } from \"@osdk/api\";\nimport type { FilterDefinition } from \"./FilterListItemApi.js\";\n\nexport interface FilterListProps<Q extends ObjectTypeDefinition> {\n /**\n * The set of objects to be filtered\n */\n objectSet: ObjectSet<Q>;\n\n /**\n * The definition for all supported filter items in the list\n * If not supplied, all filterable properties will be available\n */\n filterDefinitions?: Array<FilterDefinition<Q>>;\n\n /**\n * The current where clause to filter the objectSet.\n * If provided, the filter clause is controlled.\n */\n filterClause?: WhereClause<Q>;\n\n /**\n * Called when the filter clause changes.\n * The filters are joined by the selected filterOperator.\n * Required in controlled mode.\n *\n * @param newClause The updated filter clause\n */\n onFilterClauseChanged?: (newClause: WhereClause<Q>) => void;\n\n /**\n * The logical operator to join multiple filters\n *\n * @default \"and\"\n */\n filterOperator?: \"and\" | \"or\";\n\n /**\n * Called when filter state change\n *\n * @param filterKey The key of the updated filter\n * @param newState The updated filter state\n */\n onFilterStateChanged?: (\n filterKey: FilterKey<Q>,\n newState: FilterState<Q>,\n ) => void;\n\n /**\n * Called when a filter is added\n * If provided, user will be allowed to add filters\n *\n * @param filterKey The key of the added filter\n * @param newDefinitions The filter list with the new filter added\n */\n onFilterAdded?: (\n filterKey: FilterKey<Q>,\n newDefinitions: Array<FilterDefinition<Q>>,\n ) => void;\n\n /**\n * Called when a filter is removed\n * If provided, user will be allowed to remove filters\n *\n * @param filterKey The key of the removed filter\n * @param newDefinitions The updated filter list with the filter removed\n */\n onFilterRemoved?: (\n filterKey: FilterKey<Q>,\n newDefinitions: Array<FilterDefinition<Q>>,\n ) => void;\n\n /**\n * Called when filters are reordered\n * If provided, the filter list becomes sortable\n *\n * @param newOrder The updated filter definitions in new order\n */\n onFiltersReordered?: (newOrder: ReadonlyArray<FilterDefinition<Q>>) => void;\n}\n\ntype FilterKey<Q extends ObjectTypeDefinition> = FilterDefinition<Q>[\"key\"];\n\ntype FilterState<Q extends ObjectTypeDefinition> = FilterDefinition<\n Q\n>[\"filterState\"];\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterListItemApi.js","names":[],"sources":["FilterListItemApi.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\nimport type {\n CompileTimeMetadata,\n ObjectSet,\n ObjectTypeDefinition,\n PropertyKeys,\n WirePropertyTypes,\n} from \"@osdk/api\";\n\n/**\n * Props for a single filter list item component\n */\nexport interface FilterListItemProps<\n Q extends ObjectTypeDefinition,\n K extends PropertyKeys<Q> = PropertyKeys<Q>,\n C extends ValidComponentsForPropertyType<\n PropertyTypeFromKey<Q, K>\n > = ValidComponentsForPropertyType<PropertyTypeFromKey<Q, K>>,\n> extends FilterDefinition<Q, K, C> {\n objectSet: ObjectSet<Q>;\n\n /**\n * Called when the state of the filter changes.\n * Required in controlled mode.\n */\n onFilterStateChanged: (state: FilterStateByComponentType[C]) => void;\n\n onFilterRemoved?: (key: PropertyKeys<Q>) => void;\n}\n\n/**\n * A filter definition specifies configuration for a single filter\n *\n * The component type C must be compatible with the property type derived from the key.\n * For example, boolean properties can only use LISTOGRAM,\n * while string properties can use LISTOGRAM, TEXT_TAGS, or CONTAINS_TEXT.\n */\nexport interface FilterDefinition<\n Q extends ObjectTypeDefinition,\n K extends PropertyKeys<Q> = PropertyKeys<Q>,\n C extends ValidComponentsForPropertyType<\n PropertyTypeFromKey<Q, K>\n > = ValidComponentsForPropertyType<PropertyTypeFromKey<Q, K>>,\n> {\n /**\n * The property key to filter on\n */\n key: K;\n\n /**\n * Display label for the filter\n */\n label?: string;\n\n /**\n * The filter component type to render\n * Must be compatible with the property type derived from the key, see ValidComponentsForPropertyType\n */\n filterComponent: C;\n\n /**\n * The current state of the filter.\n * If provided, the filter is controlled.\n */\n filterState: FilterStateByComponentType[C];\n}\n\n/**\n * Helper type to extract the property type from an ObjectTypeDefinition given a property key\n */\ntype PropertyTypeFromKey<\n Q extends ObjectTypeDefinition,\n K extends PropertyKeys<Q>,\n> = CompileTimeMetadata<Q>[\"properties\"][K][\"type\"];\n\nexport type FilterComponentType =\n | \"LISTOGRAM\"\n | \"DATE_RANGE\"\n | \"NUMBER_RANGE\"\n | \"TEXT_TAGS\"\n | \"CONTAINS_TEXT\";\n\n/**\n * Gets valid component types for a given property type\n */\nexport type ValidComponentsForPropertyType<P extends WirePropertyTypes> =\n P extends \"boolean\" ? \"LISTOGRAM\"\n : P extends \"string\" ? \"LISTOGRAM\" | \"TEXT_TAGS\" | \"CONTAINS_TEXT\"\n : P extends \"datetime\" | \"timestamp\" ? \"DATE_RANGE\"\n : P extends\n | \"double\"\n | \"integer\"\n | \"long\"\n | \"float\"\n | \"short\"\n | \"byte\"\n | \"decimal\" ? \"NUMBER_RANGE\"\n : never;\n\n/**\n * Union of all possible filter states\n */\nexport type FilterState =\n | ExactMatchFilterState<string | boolean>\n | DateRangeFilterState\n | ContainsTextFilterState\n | NumberRangeFilterState;\n\n/**\n * Maps component types to their corresponding state types\n */\nexport interface FilterStateByComponentType {\n LISTOGRAM: ExactMatchFilterState<string | boolean>;\n DATE_RANGE: DateRangeFilterState;\n TEXT_TAGS: ExactMatchFilterState<string>;\n CONTAINS_TEXT: ContainsTextFilterState;\n NUMBER_RANGE: NumberRangeFilterState;\n}\n\ntype FilterStateType =\n | \"EXACT_MATCH\"\n | \"DATE_RANGE\"\n | \"NUMBER_RANGE\"\n | \"CONTAINS_TEXT\";\n\n/**\n * Base interface for all filter states\n * Contains common properties shared across all filter types\n */\nexport interface BaseFilterState {\n /**\n * The type of filter component\n */\n type: FilterStateType;\n\n /**\n * If true, the objects satisfying the filter are excluded\n * @default false\n */\n isExcluding?: boolean;\n\n /**\n * If true, include objects that have no value\n * @default false\n */\n includeNull?: boolean;\n}\n\nexport interface ExactMatchFilterState<T = string | boolean>\n extends BaseFilterState\n{\n type: \"EXACT_MATCH\";\n values: T[];\n}\n\nexport interface DateRangeFilterState extends BaseFilterState {\n type: \"DATE_RANGE\";\n /**\n * The earliest date the user can select\n */\n minValue?: Date;\n /**\n * The latest date the user can select\n */\n maxValue?: Date;\n}\n\nexport interface ContainsTextFilterState extends BaseFilterState {\n type: \"CONTAINS_TEXT\";\n value?: string;\n}\n\nexport interface NumberRangeFilterState extends BaseFilterState {\n type: \"NUMBER_RANGE\";\n /**\n * Minimum numeric value (inclusive)\n */\n minValue?: number;\n /**\n * Maximum numeric value (inclusive)\n */\n maxValue?: number;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
// Export your components here
|
|
18
|
+
// Example: export { MyComponent } from "./MyComponent";
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["index.ts"],"sourcesContent":["/*\n * Copyright 2024 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\n// Export your components here\n// Example: export { MyComponent } from \"./MyComponent\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA","ignoreList":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { describe, expect, it } from "vitest";
|
|
18
|
+
describe("anything", () => {
|
|
19
|
+
it("does", async () => {
|
|
20
|
+
expect(1).toBe(1);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=junk.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"junk.test.js","names":["describe","expect","it","toBe"],"sources":["junk.test.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { describe, expect, it } from \"vitest\";\n\ndescribe(\"anything\", () => {\n it(\"does\", async () => {\n expect(1).toBe(1);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAE7CF,QAAQ,CAAC,UAAU,EAAE,MAAM;EACzBE,EAAE,CAAC,MAAM,EAAE,YAAY;IACrBD,MAAM,CAAC,CAAC,CAAC,CAACE,IAAI,CAAC,CAAC,CAAC;EACnB,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObjectTableApi.js","names":[],"sources":["ObjectTableApi.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\nimport type {\n DerivedProperty,\n ObjectSet,\n ObjectTypeDefinition,\n Osdk,\n PrimaryKeyType,\n PropertyKeys,\n QueryDefinition,\n SimplePropertyDef,\n WhereClause,\n} from \"@osdk/api\";\nimport type * as React from \"react\";\n\nexport type ColumnDefinition<\n Q extends ObjectTypeDefinition,\n RDPs extends Record<string, SimplePropertyDef>,\n FunctionColumns extends Record<string, QueryDefinition<{}>>,\n> = {\n locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>;\n isVisible?: boolean;\n pinned?: \"left\" | \"right\" | \"none\";\n width?: number;\n minWidth?: number;\n maxWidth?: number;\n resizable?: boolean;\n orderable?: boolean;\n filterable?: boolean;\n renderCell?: (\n object: Osdk.Instance<Q>,\n locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>,\n ) => React.ReactNode;\n renderHeader?: () => React.ReactNode;\n};\n\ntype ColumnDefinitionLocator<\n Q extends ObjectTypeDefinition,\n RDPs extends Record<string, SimplePropertyDef>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = {},\n> =\n | {\n type: \"property\";\n propertyKey: PropertyKeys<Q>;\n }\n | {\n type: \"function\";\n id: keyof FunctionColumns;\n }\n | {\n type: \"rdp\";\n id: keyof RDPs;\n creator: DerivedProperty.Creator<Q, RDPs[keyof RDPs]>;\n };\n\nexport interface ObjectTableProps<\n Q extends ObjectTypeDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> {\n /**\n * The set of objects to show in the table\n */\n objectSet: ObjectSet<Q>;\n\n /**\n * Ordered list of column definitions to show in the table\n *\n * If not provided, all of the properties of the object type will be shown in default order.\n */\n columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>;\n\n /**\n * Whether the table is filterable by the user.\n *\n * @default true\n */\n filterable?: boolean;\n\n /**\n * The current where clause to filter the objects in the table.\n * If provided, the filter is controlled.\n */\n filter?: WhereClause<Q, RDPs>;\n\n /**\n * Called when the where clause is changed.\n * Required when filter is controlled.\n *\n * @param newWhere The new where clause\n */\n onFilterChanged?: (newWhere: WhereClause<Q, RDPs>) => void;\n\n /**\n * Whether the table is sortable by the user.\n *\n * @default true\n */\n orderable?: boolean;\n\n /**\n * The current order by clause to sort the objects in the table.\n * If provided, the sorting is controlled.\n */\n orderBy?: Array<{\n property: PropertyKeys<Q>;\n direction: \"asc\" | \"desc\";\n }>;\n\n /**\n * Called when the order by clause is changed.\n * Required when sorting is controlled.\n *\n * @param newOrderBy The new order by clause\n */\n onOrderByChanged?: (\n newOrderBy: Array<{\n property: PropertyKeys<Q>;\n direction: \"asc\" | \"desc\";\n }>,\n ) => void;\n\n /**\n * Called when the visible columns change.\n *\n * If provided, the table will allow the user to show/hide columns.\n *\n * @param newStates The new list of column visibility states\n */\n onColumnVisibilityChanged?: (\n newStates: Array<{\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;\n isVisible: boolean;\n }>,\n ) => void;\n\n /**\n * Called when the pinned columns change.\n *\n * If provided, the table will allow the user to pin/unpin columns.\n *\n * @param newStates The new list of column pin states\n */\n onColumnsPinnedChanged?: (\n newStates: Array<{\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;\n pinned: \"left\" | \"right\" | \"none\";\n }>,\n ) => void;\n\n /**\n * Called when a column is resized.\n *\n * @param columnId The ID of the resized column\n * @param newWidth The new width of the column\n */\n onColumnResize?: (\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns,\n newWidth: number,\n ) => void;\n\n /**\n * Called when a cell is clicked.\n *\n * @param object The object representing the row\n * @param columnDefinition The column definition for the clicked cell\n */\n onCellClick?: (\n object: Osdk.Instance<Q>,\n locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>,\n ) => void;\n\n /**\n * Called when a row is clicked.\n *\n * @param object The object representing the clicked row\n */\n onRowClick?: (object: Osdk.Instance<Q>) => void;\n\n /**\n * Selection mode for the table rows.\n *\n * If multiple, a checkbox will be shown for each row to allow selecting multiple rows\n * as well as a top-level checkbox in the header to select all rows.\n */\n selectionMode?: \"single\" | \"multiple\" | \"none\";\n\n /**\n * The currently selected rows in the table.\n * If provided, the row selection is controlled.\n */\n selectedRows?: PrimaryKeyType<Q>[];\n\n /**\n * Called when the row selection changes.\n * Required when row selection is controlled.\n *\n * @param objects The currently selected objects\n */\n onRowSelection?: (objects: PrimaryKeyType<Q>[]) => void;\n\n /**\n * If provided, will render this context menu when right clicking on a cell\n */\n renderCellContextMenu?: (\n object: Osdk.Instance<Q>,\n locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>,\n ) => React.ReactNode;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"experimental.js","names":[],"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\nexport type { ObjectTableProps } from \"../object-table/ObjectTableApi.js\";\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"experimental.cjs"}
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import { ObjectTypeDefinition, PropertyKeys, WirePropertyTypes, CompileTimeMetadata, ObjectSet, WhereClause, SimplePropertyDef, QueryDefinition, DerivedProperty, Osdk, PrimaryKeyType } from '@osdk/api';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Props for a single filter list item component
|
|
6
|
+
*/
|
|
7
|
+
interface FilterListItemProps<Q extends ObjectTypeDefinition, K extends PropertyKeys<Q> = PropertyKeys<Q>, C extends ValidComponentsForPropertyType<PropertyTypeFromKey<Q, K>> = ValidComponentsForPropertyType<PropertyTypeFromKey<Q, K>>> extends FilterDefinition<Q, K, C> {
|
|
8
|
+
objectSet: ObjectSet<Q>;
|
|
9
|
+
/**
|
|
10
|
+
* Called when the state of the filter changes.
|
|
11
|
+
* Required in controlled mode.
|
|
12
|
+
*/
|
|
13
|
+
onFilterStateChanged: (state: FilterStateByComponentType[C]) => void;
|
|
14
|
+
onFilterRemoved?: (key: PropertyKeys<Q>) => void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A filter definition specifies configuration for a single filter
|
|
18
|
+
*
|
|
19
|
+
* The component type C must be compatible with the property type derived from the key.
|
|
20
|
+
* For example, boolean properties can only use LISTOGRAM,
|
|
21
|
+
* while string properties can use LISTOGRAM, TEXT_TAGS, or CONTAINS_TEXT.
|
|
22
|
+
*/
|
|
23
|
+
interface FilterDefinition<Q extends ObjectTypeDefinition, K extends PropertyKeys<Q> = PropertyKeys<Q>, C extends ValidComponentsForPropertyType<PropertyTypeFromKey<Q, K>> = ValidComponentsForPropertyType<PropertyTypeFromKey<Q, K>>> {
|
|
24
|
+
/**
|
|
25
|
+
* The property key to filter on
|
|
26
|
+
*/
|
|
27
|
+
key: K;
|
|
28
|
+
/**
|
|
29
|
+
* Display label for the filter
|
|
30
|
+
*/
|
|
31
|
+
label?: string;
|
|
32
|
+
/**
|
|
33
|
+
* The filter component type to render
|
|
34
|
+
* Must be compatible with the property type derived from the key, see ValidComponentsForPropertyType
|
|
35
|
+
*/
|
|
36
|
+
filterComponent: C;
|
|
37
|
+
/**
|
|
38
|
+
* The current state of the filter.
|
|
39
|
+
* If provided, the filter is controlled.
|
|
40
|
+
*/
|
|
41
|
+
filterState: FilterStateByComponentType[C];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Helper type to extract the property type from an ObjectTypeDefinition given a property key
|
|
45
|
+
*/
|
|
46
|
+
type PropertyTypeFromKey<Q extends ObjectTypeDefinition, K extends PropertyKeys<Q>> = CompileTimeMetadata<Q>["properties"][K]["type"];
|
|
47
|
+
/**
|
|
48
|
+
* Gets valid component types for a given property type
|
|
49
|
+
*/
|
|
50
|
+
type ValidComponentsForPropertyType<P extends WirePropertyTypes> = P extends "boolean" ? "LISTOGRAM" : P extends "string" ? "LISTOGRAM" | "TEXT_TAGS" | "CONTAINS_TEXT" : P extends "datetime" | "timestamp" ? "DATE_RANGE" : P extends "double" | "integer" | "long" | "float" | "short" | "byte" | "decimal" ? "NUMBER_RANGE" : never;
|
|
51
|
+
/**
|
|
52
|
+
* Maps component types to their corresponding state types
|
|
53
|
+
*/
|
|
54
|
+
interface FilterStateByComponentType {
|
|
55
|
+
LISTOGRAM: ExactMatchFilterState<string | boolean>;
|
|
56
|
+
DATE_RANGE: DateRangeFilterState;
|
|
57
|
+
TEXT_TAGS: ExactMatchFilterState<string>;
|
|
58
|
+
CONTAINS_TEXT: ContainsTextFilterState;
|
|
59
|
+
NUMBER_RANGE: NumberRangeFilterState;
|
|
60
|
+
}
|
|
61
|
+
type FilterStateType = "EXACT_MATCH" | "DATE_RANGE" | "NUMBER_RANGE" | "CONTAINS_TEXT";
|
|
62
|
+
/**
|
|
63
|
+
* Base interface for all filter states
|
|
64
|
+
* Contains common properties shared across all filter types
|
|
65
|
+
*/
|
|
66
|
+
interface BaseFilterState {
|
|
67
|
+
/**
|
|
68
|
+
* The type of filter component
|
|
69
|
+
*/
|
|
70
|
+
type: FilterStateType;
|
|
71
|
+
/**
|
|
72
|
+
* If true, the objects satisfying the filter are excluded
|
|
73
|
+
* @default false
|
|
74
|
+
*/
|
|
75
|
+
isExcluding?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* If true, include objects that have no value
|
|
78
|
+
* @default false
|
|
79
|
+
*/
|
|
80
|
+
includeNull?: boolean;
|
|
81
|
+
}
|
|
82
|
+
interface ExactMatchFilterState<T = string | boolean> extends BaseFilterState {
|
|
83
|
+
type: "EXACT_MATCH";
|
|
84
|
+
values: T[];
|
|
85
|
+
}
|
|
86
|
+
interface DateRangeFilterState extends BaseFilterState {
|
|
87
|
+
type: "DATE_RANGE";
|
|
88
|
+
/**
|
|
89
|
+
* The earliest date the user can select
|
|
90
|
+
*/
|
|
91
|
+
minValue?: Date;
|
|
92
|
+
/**
|
|
93
|
+
* The latest date the user can select
|
|
94
|
+
*/
|
|
95
|
+
maxValue?: Date;
|
|
96
|
+
}
|
|
97
|
+
interface ContainsTextFilterState extends BaseFilterState {
|
|
98
|
+
type: "CONTAINS_TEXT";
|
|
99
|
+
value?: string;
|
|
100
|
+
}
|
|
101
|
+
interface NumberRangeFilterState extends BaseFilterState {
|
|
102
|
+
type: "NUMBER_RANGE";
|
|
103
|
+
/**
|
|
104
|
+
* Minimum numeric value (inclusive)
|
|
105
|
+
*/
|
|
106
|
+
minValue?: number;
|
|
107
|
+
/**
|
|
108
|
+
* Maximum numeric value (inclusive)
|
|
109
|
+
*/
|
|
110
|
+
maxValue?: number;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
interface FilterListProps<Q extends ObjectTypeDefinition> {
|
|
114
|
+
/**
|
|
115
|
+
* The set of objects to be filtered
|
|
116
|
+
*/
|
|
117
|
+
objectSet: ObjectSet<Q>;
|
|
118
|
+
/**
|
|
119
|
+
* The definition for all supported filter items in the list
|
|
120
|
+
* If not supplied, all filterable properties will be available
|
|
121
|
+
*/
|
|
122
|
+
filterDefinitions?: Array<FilterDefinition<Q>>;
|
|
123
|
+
/**
|
|
124
|
+
* The current where clause to filter the objectSet.
|
|
125
|
+
* If provided, the filter clause is controlled.
|
|
126
|
+
*/
|
|
127
|
+
filterClause?: WhereClause<Q>;
|
|
128
|
+
/**
|
|
129
|
+
* Called when the filter clause changes.
|
|
130
|
+
* The filters are joined by the selected filterOperator.
|
|
131
|
+
* Required in controlled mode.
|
|
132
|
+
*
|
|
133
|
+
* @param newClause The updated filter clause
|
|
134
|
+
*/
|
|
135
|
+
onFilterClauseChanged?: (newClause: WhereClause<Q>) => void;
|
|
136
|
+
/**
|
|
137
|
+
* The logical operator to join multiple filters
|
|
138
|
+
*
|
|
139
|
+
* @default "and"
|
|
140
|
+
*/
|
|
141
|
+
filterOperator?: "and" | "or";
|
|
142
|
+
/**
|
|
143
|
+
* Called when filter state change
|
|
144
|
+
*
|
|
145
|
+
* @param filterKey The key of the updated filter
|
|
146
|
+
* @param newState The updated filter state
|
|
147
|
+
*/
|
|
148
|
+
onFilterStateChanged?: (filterKey: FilterKey<Q>, newState: FilterState<Q>) => void;
|
|
149
|
+
/**
|
|
150
|
+
* Called when a filter is added
|
|
151
|
+
* If provided, user will be allowed to add filters
|
|
152
|
+
*
|
|
153
|
+
* @param filterKey The key of the added filter
|
|
154
|
+
* @param newDefinitions The filter list with the new filter added
|
|
155
|
+
*/
|
|
156
|
+
onFilterAdded?: (filterKey: FilterKey<Q>, newDefinitions: Array<FilterDefinition<Q>>) => void;
|
|
157
|
+
/**
|
|
158
|
+
* Called when a filter is removed
|
|
159
|
+
* If provided, user will be allowed to remove filters
|
|
160
|
+
*
|
|
161
|
+
* @param filterKey The key of the removed filter
|
|
162
|
+
* @param newDefinitions The updated filter list with the filter removed
|
|
163
|
+
*/
|
|
164
|
+
onFilterRemoved?: (filterKey: FilterKey<Q>, newDefinitions: Array<FilterDefinition<Q>>) => void;
|
|
165
|
+
/**
|
|
166
|
+
* Called when filters are reordered
|
|
167
|
+
* If provided, the filter list becomes sortable
|
|
168
|
+
*
|
|
169
|
+
* @param newOrder The updated filter definitions in new order
|
|
170
|
+
*/
|
|
171
|
+
onFiltersReordered?: (newOrder: ReadonlyArray<FilterDefinition<Q>>) => void;
|
|
172
|
+
}
|
|
173
|
+
type FilterKey<Q extends ObjectTypeDefinition> = FilterDefinition<Q>["key"];
|
|
174
|
+
type FilterState<Q extends ObjectTypeDefinition> = FilterDefinition<Q>["filterState"];
|
|
175
|
+
|
|
176
|
+
type ColumnDefinition<Q extends ObjectTypeDefinition, RDPs extends Record<string, SimplePropertyDef>, FunctionColumns extends Record<string, QueryDefinition<{}>>> = {
|
|
177
|
+
locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>;
|
|
178
|
+
isVisible?: boolean;
|
|
179
|
+
pinned?: "left" | "right" | "none";
|
|
180
|
+
width?: number;
|
|
181
|
+
minWidth?: number;
|
|
182
|
+
maxWidth?: number;
|
|
183
|
+
resizable?: boolean;
|
|
184
|
+
orderable?: boolean;
|
|
185
|
+
filterable?: boolean;
|
|
186
|
+
renderCell?: (object: Osdk.Instance<Q>, locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>) => React.ReactNode;
|
|
187
|
+
renderHeader?: () => React.ReactNode;
|
|
188
|
+
};
|
|
189
|
+
type ColumnDefinitionLocator<Q extends ObjectTypeDefinition, RDPs extends Record<string, SimplePropertyDef>, FunctionColumns extends Record<string, QueryDefinition<{}>> = {}> = {
|
|
190
|
+
type: "property";
|
|
191
|
+
propertyKey: PropertyKeys<Q>;
|
|
192
|
+
} | {
|
|
193
|
+
type: "function";
|
|
194
|
+
id: keyof FunctionColumns;
|
|
195
|
+
} | {
|
|
196
|
+
type: "rdp";
|
|
197
|
+
id: keyof RDPs;
|
|
198
|
+
creator: DerivedProperty.Creator<Q, RDPs[keyof RDPs]>;
|
|
199
|
+
};
|
|
200
|
+
interface ObjectTableProps<Q extends ObjectTypeDefinition, RDPs extends Record<string, SimplePropertyDef> = {}, FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<string, never>> {
|
|
201
|
+
/**
|
|
202
|
+
* The set of objects to show in the table
|
|
203
|
+
*/
|
|
204
|
+
objectSet: ObjectSet<Q>;
|
|
205
|
+
/**
|
|
206
|
+
* Ordered list of column definitions to show in the table
|
|
207
|
+
*
|
|
208
|
+
* If not provided, all of the properties of the object type will be shown in default order.
|
|
209
|
+
*/
|
|
210
|
+
columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>;
|
|
211
|
+
/**
|
|
212
|
+
* Whether the table is filterable by the user.
|
|
213
|
+
*
|
|
214
|
+
* @default true
|
|
215
|
+
*/
|
|
216
|
+
filterable?: boolean;
|
|
217
|
+
/**
|
|
218
|
+
* The current where clause to filter the objects in the table.
|
|
219
|
+
* If provided, the filter is controlled.
|
|
220
|
+
*/
|
|
221
|
+
filter?: WhereClause<Q, RDPs>;
|
|
222
|
+
/**
|
|
223
|
+
* Called when the where clause is changed.
|
|
224
|
+
* Required when filter is controlled.
|
|
225
|
+
*
|
|
226
|
+
* @param newWhere The new where clause
|
|
227
|
+
*/
|
|
228
|
+
onFilterChanged?: (newWhere: WhereClause<Q, RDPs>) => void;
|
|
229
|
+
/**
|
|
230
|
+
* Whether the table is sortable by the user.
|
|
231
|
+
*
|
|
232
|
+
* @default true
|
|
233
|
+
*/
|
|
234
|
+
orderable?: boolean;
|
|
235
|
+
/**
|
|
236
|
+
* The current order by clause to sort the objects in the table.
|
|
237
|
+
* If provided, the sorting is controlled.
|
|
238
|
+
*/
|
|
239
|
+
orderBy?: Array<{
|
|
240
|
+
property: PropertyKeys<Q>;
|
|
241
|
+
direction: "asc" | "desc";
|
|
242
|
+
}>;
|
|
243
|
+
/**
|
|
244
|
+
* Called when the order by clause is changed.
|
|
245
|
+
* Required when sorting is controlled.
|
|
246
|
+
*
|
|
247
|
+
* @param newOrderBy The new order by clause
|
|
248
|
+
*/
|
|
249
|
+
onOrderByChanged?: (newOrderBy: Array<{
|
|
250
|
+
property: PropertyKeys<Q>;
|
|
251
|
+
direction: "asc" | "desc";
|
|
252
|
+
}>) => void;
|
|
253
|
+
/**
|
|
254
|
+
* Called when the visible columns change.
|
|
255
|
+
*
|
|
256
|
+
* If provided, the table will allow the user to show/hide columns.
|
|
257
|
+
*
|
|
258
|
+
* @param newStates The new list of column visibility states
|
|
259
|
+
*/
|
|
260
|
+
onColumnVisibilityChanged?: (newStates: Array<{
|
|
261
|
+
columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;
|
|
262
|
+
isVisible: boolean;
|
|
263
|
+
}>) => void;
|
|
264
|
+
/**
|
|
265
|
+
* Called when the pinned columns change.
|
|
266
|
+
*
|
|
267
|
+
* If provided, the table will allow the user to pin/unpin columns.
|
|
268
|
+
*
|
|
269
|
+
* @param newStates The new list of column pin states
|
|
270
|
+
*/
|
|
271
|
+
onColumnsPinnedChanged?: (newStates: Array<{
|
|
272
|
+
columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;
|
|
273
|
+
pinned: "left" | "right" | "none";
|
|
274
|
+
}>) => void;
|
|
275
|
+
/**
|
|
276
|
+
* Called when a column is resized.
|
|
277
|
+
*
|
|
278
|
+
* @param columnId The ID of the resized column
|
|
279
|
+
* @param newWidth The new width of the column
|
|
280
|
+
*/
|
|
281
|
+
onColumnResize?: (columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns, newWidth: number) => void;
|
|
282
|
+
/**
|
|
283
|
+
* Called when a cell is clicked.
|
|
284
|
+
*
|
|
285
|
+
* @param object The object representing the row
|
|
286
|
+
* @param columnDefinition The column definition for the clicked cell
|
|
287
|
+
*/
|
|
288
|
+
onCellClick?: (object: Osdk.Instance<Q>, locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>) => void;
|
|
289
|
+
/**
|
|
290
|
+
* Called when a row is clicked.
|
|
291
|
+
*
|
|
292
|
+
* @param object The object representing the clicked row
|
|
293
|
+
*/
|
|
294
|
+
onRowClick?: (object: Osdk.Instance<Q>) => void;
|
|
295
|
+
/**
|
|
296
|
+
* Selection mode for the table rows.
|
|
297
|
+
*
|
|
298
|
+
* If multiple, a checkbox will be shown for each row to allow selecting multiple rows
|
|
299
|
+
* as well as a top-level checkbox in the header to select all rows.
|
|
300
|
+
*/
|
|
301
|
+
selectionMode?: "single" | "multiple" | "none";
|
|
302
|
+
/**
|
|
303
|
+
* The currently selected rows in the table.
|
|
304
|
+
* If provided, the row selection is controlled.
|
|
305
|
+
*/
|
|
306
|
+
selectedRows?: PrimaryKeyType<Q>[];
|
|
307
|
+
/**
|
|
308
|
+
* Called when the row selection changes.
|
|
309
|
+
* Required when row selection is controlled.
|
|
310
|
+
*
|
|
311
|
+
* @param objects The currently selected objects
|
|
312
|
+
*/
|
|
313
|
+
onRowSelection?: (objects: PrimaryKeyType<Q>[]) => void;
|
|
314
|
+
/**
|
|
315
|
+
* If provided, will render this context menu when right clicking on a cell
|
|
316
|
+
*/
|
|
317
|
+
renderCellContextMenu?: (object: Osdk.Instance<Q>, locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>) => React.ReactNode;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
export type { FilterListItemProps, FilterListProps, ObjectTableProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterListApi.js","names":[],"sources":["FilterListApi.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\nimport type { ObjectSet, ObjectTypeDefinition, WhereClause } from \"@osdk/api\";\nimport type { FilterDefinition } from \"./FilterListItemApi.js\";\n\nexport interface FilterListProps<Q extends ObjectTypeDefinition> {\n /**\n * The set of objects to be filtered\n */\n objectSet: ObjectSet<Q>;\n\n /**\n * The definition for all supported filter items in the list\n * If not supplied, all filterable properties will be available\n */\n filterDefinitions?: Array<FilterDefinition<Q>>;\n\n /**\n * The current where clause to filter the objectSet.\n * If provided, the filter clause is controlled.\n */\n filterClause?: WhereClause<Q>;\n\n /**\n * Called when the filter clause changes.\n * The filters are joined by the selected filterOperator.\n * Required in controlled mode.\n *\n * @param newClause The updated filter clause\n */\n onFilterClauseChanged?: (newClause: WhereClause<Q>) => void;\n\n /**\n * The logical operator to join multiple filters\n *\n * @default \"and\"\n */\n filterOperator?: \"and\" | \"or\";\n\n /**\n * Called when filter state change\n *\n * @param filterKey The key of the updated filter\n * @param newState The updated filter state\n */\n onFilterStateChanged?: (\n filterKey: FilterKey<Q>,\n newState: FilterState<Q>,\n ) => void;\n\n /**\n * Called when a filter is added\n * If provided, user will be allowed to add filters\n *\n * @param filterKey The key of the added filter\n * @param newDefinitions The filter list with the new filter added\n */\n onFilterAdded?: (\n filterKey: FilterKey<Q>,\n newDefinitions: Array<FilterDefinition<Q>>,\n ) => void;\n\n /**\n * Called when a filter is removed\n * If provided, user will be allowed to remove filters\n *\n * @param filterKey The key of the removed filter\n * @param newDefinitions The updated filter list with the filter removed\n */\n onFilterRemoved?: (\n filterKey: FilterKey<Q>,\n newDefinitions: Array<FilterDefinition<Q>>,\n ) => void;\n\n /**\n * Called when filters are reordered\n * If provided, the filter list becomes sortable\n *\n * @param newOrder The updated filter definitions in new order\n */\n onFiltersReordered?: (newOrder: ReadonlyArray<FilterDefinition<Q>>) => void;\n}\n\ntype FilterKey<Q extends ObjectTypeDefinition> = FilterDefinition<Q>[\"key\"];\n\ntype FilterState<Q extends ObjectTypeDefinition> = FilterDefinition<\n Q\n>[\"filterState\"];\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterListItemApi.js","names":[],"sources":["FilterListItemApi.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\nimport type {\n CompileTimeMetadata,\n ObjectSet,\n ObjectTypeDefinition,\n PropertyKeys,\n WirePropertyTypes,\n} from \"@osdk/api\";\n\n/**\n * Props for a single filter list item component\n */\nexport interface FilterListItemProps<\n Q extends ObjectTypeDefinition,\n K extends PropertyKeys<Q> = PropertyKeys<Q>,\n C extends ValidComponentsForPropertyType<\n PropertyTypeFromKey<Q, K>\n > = ValidComponentsForPropertyType<PropertyTypeFromKey<Q, K>>,\n> extends FilterDefinition<Q, K, C> {\n objectSet: ObjectSet<Q>;\n\n /**\n * Called when the state of the filter changes.\n * Required in controlled mode.\n */\n onFilterStateChanged: (state: FilterStateByComponentType[C]) => void;\n\n onFilterRemoved?: (key: PropertyKeys<Q>) => void;\n}\n\n/**\n * A filter definition specifies configuration for a single filter\n *\n * The component type C must be compatible with the property type derived from the key.\n * For example, boolean properties can only use LISTOGRAM,\n * while string properties can use LISTOGRAM, TEXT_TAGS, or CONTAINS_TEXT.\n */\nexport interface FilterDefinition<\n Q extends ObjectTypeDefinition,\n K extends PropertyKeys<Q> = PropertyKeys<Q>,\n C extends ValidComponentsForPropertyType<\n PropertyTypeFromKey<Q, K>\n > = ValidComponentsForPropertyType<PropertyTypeFromKey<Q, K>>,\n> {\n /**\n * The property key to filter on\n */\n key: K;\n\n /**\n * Display label for the filter\n */\n label?: string;\n\n /**\n * The filter component type to render\n * Must be compatible with the property type derived from the key, see ValidComponentsForPropertyType\n */\n filterComponent: C;\n\n /**\n * The current state of the filter.\n * If provided, the filter is controlled.\n */\n filterState: FilterStateByComponentType[C];\n}\n\n/**\n * Helper type to extract the property type from an ObjectTypeDefinition given a property key\n */\ntype PropertyTypeFromKey<\n Q extends ObjectTypeDefinition,\n K extends PropertyKeys<Q>,\n> = CompileTimeMetadata<Q>[\"properties\"][K][\"type\"];\n\nexport type FilterComponentType =\n | \"LISTOGRAM\"\n | \"DATE_RANGE\"\n | \"NUMBER_RANGE\"\n | \"TEXT_TAGS\"\n | \"CONTAINS_TEXT\";\n\n/**\n * Gets valid component types for a given property type\n */\nexport type ValidComponentsForPropertyType<P extends WirePropertyTypes> =\n P extends \"boolean\" ? \"LISTOGRAM\"\n : P extends \"string\" ? \"LISTOGRAM\" | \"TEXT_TAGS\" | \"CONTAINS_TEXT\"\n : P extends \"datetime\" | \"timestamp\" ? \"DATE_RANGE\"\n : P extends\n | \"double\"\n | \"integer\"\n | \"long\"\n | \"float\"\n | \"short\"\n | \"byte\"\n | \"decimal\" ? \"NUMBER_RANGE\"\n : never;\n\n/**\n * Union of all possible filter states\n */\nexport type FilterState =\n | ExactMatchFilterState<string | boolean>\n | DateRangeFilterState\n | ContainsTextFilterState\n | NumberRangeFilterState;\n\n/**\n * Maps component types to their corresponding state types\n */\nexport interface FilterStateByComponentType {\n LISTOGRAM: ExactMatchFilterState<string | boolean>;\n DATE_RANGE: DateRangeFilterState;\n TEXT_TAGS: ExactMatchFilterState<string>;\n CONTAINS_TEXT: ContainsTextFilterState;\n NUMBER_RANGE: NumberRangeFilterState;\n}\n\ntype FilterStateType =\n | \"EXACT_MATCH\"\n | \"DATE_RANGE\"\n | \"NUMBER_RANGE\"\n | \"CONTAINS_TEXT\";\n\n/**\n * Base interface for all filter states\n * Contains common properties shared across all filter types\n */\nexport interface BaseFilterState {\n /**\n * The type of filter component\n */\n type: FilterStateType;\n\n /**\n * If true, the objects satisfying the filter are excluded\n * @default false\n */\n isExcluding?: boolean;\n\n /**\n * If true, include objects that have no value\n * @default false\n */\n includeNull?: boolean;\n}\n\nexport interface ExactMatchFilterState<T = string | boolean>\n extends BaseFilterState\n{\n type: \"EXACT_MATCH\";\n values: T[];\n}\n\nexport interface DateRangeFilterState extends BaseFilterState {\n type: \"DATE_RANGE\";\n /**\n * The earliest date the user can select\n */\n minValue?: Date;\n /**\n * The latest date the user can select\n */\n maxValue?: Date;\n}\n\nexport interface ContainsTextFilterState extends BaseFilterState {\n type: \"CONTAINS_TEXT\";\n value?: string;\n}\n\nexport interface NumberRangeFilterState extends BaseFilterState {\n type: \"NUMBER_RANGE\";\n /**\n * Minimum numeric value (inclusive)\n */\n minValue?: number;\n /**\n * Maximum numeric value (inclusive)\n */\n maxValue?: number;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
// Export your components here
|
|
18
|
+
// Example: export { MyComponent } from "./MyComponent";
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["index.ts"],"sourcesContent":["/*\n * Copyright 2024 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\n// Export your components here\n// Example: export { MyComponent } from \"./MyComponent\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA","ignoreList":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { describe, expect, it } from "vitest";
|
|
18
|
+
describe("anything", () => {
|
|
19
|
+
it("does", async () => {
|
|
20
|
+
expect(1).toBe(1);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=junk.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"junk.test.js","names":["describe","expect","it","toBe"],"sources":["junk.test.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { describe, expect, it } from \"vitest\";\n\ndescribe(\"anything\", () => {\n it(\"does\", async () => {\n expect(1).toBe(1);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAE7CF,QAAQ,CAAC,UAAU,EAAE,MAAM;EACzBE,EAAE,CAAC,MAAM,EAAE,YAAY;IACrBD,MAAM,CAAC,CAAC,CAAC,CAACE,IAAI,CAAC,CAAC,CAAC;EACnB,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObjectTableApi.js","names":[],"sources":["ObjectTableApi.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\nimport type {\n DerivedProperty,\n ObjectSet,\n ObjectTypeDefinition,\n Osdk,\n PrimaryKeyType,\n PropertyKeys,\n QueryDefinition,\n SimplePropertyDef,\n WhereClause,\n} from \"@osdk/api\";\nimport type * as React from \"react\";\n\nexport type ColumnDefinition<\n Q extends ObjectTypeDefinition,\n RDPs extends Record<string, SimplePropertyDef>,\n FunctionColumns extends Record<string, QueryDefinition<{}>>,\n> = {\n locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>;\n isVisible?: boolean;\n pinned?: \"left\" | \"right\" | \"none\";\n width?: number;\n minWidth?: number;\n maxWidth?: number;\n resizable?: boolean;\n orderable?: boolean;\n filterable?: boolean;\n renderCell?: (\n object: Osdk.Instance<Q>,\n locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>,\n ) => React.ReactNode;\n renderHeader?: () => React.ReactNode;\n};\n\ntype ColumnDefinitionLocator<\n Q extends ObjectTypeDefinition,\n RDPs extends Record<string, SimplePropertyDef>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = {},\n> =\n | {\n type: \"property\";\n propertyKey: PropertyKeys<Q>;\n }\n | {\n type: \"function\";\n id: keyof FunctionColumns;\n }\n | {\n type: \"rdp\";\n id: keyof RDPs;\n creator: DerivedProperty.Creator<Q, RDPs[keyof RDPs]>;\n };\n\nexport interface ObjectTableProps<\n Q extends ObjectTypeDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> {\n /**\n * The set of objects to show in the table\n */\n objectSet: ObjectSet<Q>;\n\n /**\n * Ordered list of column definitions to show in the table\n *\n * If not provided, all of the properties of the object type will be shown in default order.\n */\n columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>;\n\n /**\n * Whether the table is filterable by the user.\n *\n * @default true\n */\n filterable?: boolean;\n\n /**\n * The current where clause to filter the objects in the table.\n * If provided, the filter is controlled.\n */\n filter?: WhereClause<Q, RDPs>;\n\n /**\n * Called when the where clause is changed.\n * Required when filter is controlled.\n *\n * @param newWhere The new where clause\n */\n onFilterChanged?: (newWhere: WhereClause<Q, RDPs>) => void;\n\n /**\n * Whether the table is sortable by the user.\n *\n * @default true\n */\n orderable?: boolean;\n\n /**\n * The current order by clause to sort the objects in the table.\n * If provided, the sorting is controlled.\n */\n orderBy?: Array<{\n property: PropertyKeys<Q>;\n direction: \"asc\" | \"desc\";\n }>;\n\n /**\n * Called when the order by clause is changed.\n * Required when sorting is controlled.\n *\n * @param newOrderBy The new order by clause\n */\n onOrderByChanged?: (\n newOrderBy: Array<{\n property: PropertyKeys<Q>;\n direction: \"asc\" | \"desc\";\n }>,\n ) => void;\n\n /**\n * Called when the visible columns change.\n *\n * If provided, the table will allow the user to show/hide columns.\n *\n * @param newStates The new list of column visibility states\n */\n onColumnVisibilityChanged?: (\n newStates: Array<{\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;\n isVisible: boolean;\n }>,\n ) => void;\n\n /**\n * Called when the pinned columns change.\n *\n * If provided, the table will allow the user to pin/unpin columns.\n *\n * @param newStates The new list of column pin states\n */\n onColumnsPinnedChanged?: (\n newStates: Array<{\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;\n pinned: \"left\" | \"right\" | \"none\";\n }>,\n ) => void;\n\n /**\n * Called when a column is resized.\n *\n * @param columnId The ID of the resized column\n * @param newWidth The new width of the column\n */\n onColumnResize?: (\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns,\n newWidth: number,\n ) => void;\n\n /**\n * Called when a cell is clicked.\n *\n * @param object The object representing the row\n * @param columnDefinition The column definition for the clicked cell\n */\n onCellClick?: (\n object: Osdk.Instance<Q>,\n locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>,\n ) => void;\n\n /**\n * Called when a row is clicked.\n *\n * @param object The object representing the clicked row\n */\n onRowClick?: (object: Osdk.Instance<Q>) => void;\n\n /**\n * Selection mode for the table rows.\n *\n * If multiple, a checkbox will be shown for each row to allow selecting multiple rows\n * as well as a top-level checkbox in the header to select all rows.\n */\n selectionMode?: \"single\" | \"multiple\" | \"none\";\n\n /**\n * The currently selected rows in the table.\n * If provided, the row selection is controlled.\n */\n selectedRows?: PrimaryKeyType<Q>[];\n\n /**\n * Called when the row selection changes.\n * Required when row selection is controlled.\n *\n * @param objects The currently selected objects\n */\n onRowSelection?: (objects: PrimaryKeyType<Q>[]) => void;\n\n /**\n * If provided, will render this context menu when right clicking on a cell\n */\n renderCellContextMenu?: (\n object: Osdk.Instance<Q>,\n locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>,\n ) => React.ReactNode;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"experimental.js","names":[],"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\nexport type { ObjectTableProps } from \"../object-table/ObjectTableApi.js\";\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { ObjectSet, ObjectTypeDefinition, WhereClause } from "@osdk/api";
|
|
2
|
+
import type { FilterDefinition } from "./FilterListItemApi.js";
|
|
3
|
+
export interface FilterListProps<Q extends ObjectTypeDefinition> {
|
|
4
|
+
/**
|
|
5
|
+
* The set of objects to be filtered
|
|
6
|
+
*/
|
|
7
|
+
objectSet: ObjectSet<Q>;
|
|
8
|
+
/**
|
|
9
|
+
* The definition for all supported filter items in the list
|
|
10
|
+
* If not supplied, all filterable properties will be available
|
|
11
|
+
*/
|
|
12
|
+
filterDefinitions?: Array<FilterDefinition<Q>>;
|
|
13
|
+
/**
|
|
14
|
+
* The current where clause to filter the objectSet.
|
|
15
|
+
* If provided, the filter clause is controlled.
|
|
16
|
+
*/
|
|
17
|
+
filterClause?: WhereClause<Q>;
|
|
18
|
+
/**
|
|
19
|
+
* Called when the filter clause changes.
|
|
20
|
+
* The filters are joined by the selected filterOperator.
|
|
21
|
+
* Required in controlled mode.
|
|
22
|
+
*
|
|
23
|
+
* @param newClause The updated filter clause
|
|
24
|
+
*/
|
|
25
|
+
onFilterClauseChanged?: (newClause: WhereClause<Q>) => void;
|
|
26
|
+
/**
|
|
27
|
+
* The logical operator to join multiple filters
|
|
28
|
+
*
|
|
29
|
+
* @default "and"
|
|
30
|
+
*/
|
|
31
|
+
filterOperator?: "and" | "or";
|
|
32
|
+
/**
|
|
33
|
+
* Called when filter state change
|
|
34
|
+
*
|
|
35
|
+
* @param filterKey The key of the updated filter
|
|
36
|
+
* @param newState The updated filter state
|
|
37
|
+
*/
|
|
38
|
+
onFilterStateChanged?: (filterKey: FilterKey<Q>, newState: FilterState<Q>) => void;
|
|
39
|
+
/**
|
|
40
|
+
* Called when a filter is added
|
|
41
|
+
* If provided, user will be allowed to add filters
|
|
42
|
+
*
|
|
43
|
+
* @param filterKey The key of the added filter
|
|
44
|
+
* @param newDefinitions The filter list with the new filter added
|
|
45
|
+
*/
|
|
46
|
+
onFilterAdded?: (filterKey: FilterKey<Q>, newDefinitions: Array<FilterDefinition<Q>>) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Called when a filter is removed
|
|
49
|
+
* If provided, user will be allowed to remove filters
|
|
50
|
+
*
|
|
51
|
+
* @param filterKey The key of the removed filter
|
|
52
|
+
* @param newDefinitions The updated filter list with the filter removed
|
|
53
|
+
*/
|
|
54
|
+
onFilterRemoved?: (filterKey: FilterKey<Q>, newDefinitions: Array<FilterDefinition<Q>>) => void;
|
|
55
|
+
/**
|
|
56
|
+
* Called when filters are reordered
|
|
57
|
+
* If provided, the filter list becomes sortable
|
|
58
|
+
*
|
|
59
|
+
* @param newOrder The updated filter definitions in new order
|
|
60
|
+
*/
|
|
61
|
+
onFiltersReordered?: (newOrder: ReadonlyArray<FilterDefinition<Q>>) => void;
|
|
62
|
+
}
|
|
63
|
+
type FilterKey<Q extends ObjectTypeDefinition> = FilterDefinition<Q>["key"];
|
|
64
|
+
type FilterState<Q extends ObjectTypeDefinition> = FilterDefinition<Q>["filterState"];
|
|
65
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cAAc,WAAW,sBAAsB,mBAAmB,WAAY;AAC9E,cAAc,wBAAwB,wBAAyB;AAE/D,iBAAiB,gBAAgB,UAAU,sBAAsB;;;;CAI/D,WAAW,UAAU;;;;;CAMrB,oBAAoB,MAAM,iBAAiB;;;;;CAM3C,eAAe,YAAY;;;;;;;;CAS3B,yBAAyBA,WAAW,YAAY;;;;;;CAOhD,iBAAiB,QAAQ;;;;;;;CAQzB,wBACEC,WAAW,UAAU,IACrBC,UAAU,YAAY;;;;;;;;CAUxB,iBACED,WAAW,UAAU,IACrBE,gBAAgB,MAAM,iBAAiB;;;;;;;;CAUzC,mBACEF,WAAW,UAAU,IACrBE,gBAAgB,MAAM,iBAAiB;;;;;;;CASzC,sBAAsBC,UAAU,cAAc,iBAAiB;AAChE;KAEI,UAAU,UAAU,wBAAwB,iBAAiB,GAAG;KAEhE,YAAY,UAAU,wBAAwB,iBACjD,GACA","names":["newClause: WhereClause<Q>","filterKey: FilterKey<Q>","newState: FilterState<Q>","newDefinitions: Array<FilterDefinition<Q>>","newOrder: ReadonlyArray<FilterDefinition<Q>>"],"sources":["../../../src/filter-list/FilterListApi.ts"],"version":3,"file":"FilterListApi.d.ts"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import type { CompileTimeMetadata, ObjectSet, ObjectTypeDefinition, PropertyKeys, WirePropertyTypes } from "@osdk/api";
|
|
2
|
+
/**
|
|
3
|
+
* Props for a single filter list item component
|
|
4
|
+
*/
|
|
5
|
+
export interface FilterListItemProps<
|
|
6
|
+
Q extends ObjectTypeDefinition,
|
|
7
|
+
K extends PropertyKeys<Q> = PropertyKeys<Q>,
|
|
8
|
+
C extends ValidComponentsForPropertyType<PropertyTypeFromKey<Q, K>> = ValidComponentsForPropertyType<PropertyTypeFromKey<Q, K>>
|
|
9
|
+
> extends FilterDefinition<Q, K, C> {
|
|
10
|
+
objectSet: ObjectSet<Q>;
|
|
11
|
+
/**
|
|
12
|
+
* Called when the state of the filter changes.
|
|
13
|
+
* Required in controlled mode.
|
|
14
|
+
*/
|
|
15
|
+
onFilterStateChanged: (state: FilterStateByComponentType[C]) => void;
|
|
16
|
+
onFilterRemoved?: (key: PropertyKeys<Q>) => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A filter definition specifies configuration for a single filter
|
|
20
|
+
*
|
|
21
|
+
* The component type C must be compatible with the property type derived from the key.
|
|
22
|
+
* For example, boolean properties can only use LISTOGRAM,
|
|
23
|
+
* while string properties can use LISTOGRAM, TEXT_TAGS, or CONTAINS_TEXT.
|
|
24
|
+
*/
|
|
25
|
+
export interface FilterDefinition<
|
|
26
|
+
Q extends ObjectTypeDefinition,
|
|
27
|
+
K extends PropertyKeys<Q> = PropertyKeys<Q>,
|
|
28
|
+
C extends ValidComponentsForPropertyType<PropertyTypeFromKey<Q, K>> = ValidComponentsForPropertyType<PropertyTypeFromKey<Q, K>>
|
|
29
|
+
> {
|
|
30
|
+
/**
|
|
31
|
+
* The property key to filter on
|
|
32
|
+
*/
|
|
33
|
+
key: K;
|
|
34
|
+
/**
|
|
35
|
+
* Display label for the filter
|
|
36
|
+
*/
|
|
37
|
+
label?: string;
|
|
38
|
+
/**
|
|
39
|
+
* The filter component type to render
|
|
40
|
+
* Must be compatible with the property type derived from the key, see ValidComponentsForPropertyType
|
|
41
|
+
*/
|
|
42
|
+
filterComponent: C;
|
|
43
|
+
/**
|
|
44
|
+
* The current state of the filter.
|
|
45
|
+
* If provided, the filter is controlled.
|
|
46
|
+
*/
|
|
47
|
+
filterState: FilterStateByComponentType[C];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Helper type to extract the property type from an ObjectTypeDefinition given a property key
|
|
51
|
+
*/
|
|
52
|
+
type PropertyTypeFromKey<
|
|
53
|
+
Q extends ObjectTypeDefinition,
|
|
54
|
+
K extends PropertyKeys<Q>
|
|
55
|
+
> = CompileTimeMetadata<Q>["properties"][K]["type"];
|
|
56
|
+
export type FilterComponentType = "LISTOGRAM" | "DATE_RANGE" | "NUMBER_RANGE" | "TEXT_TAGS" | "CONTAINS_TEXT";
|
|
57
|
+
/**
|
|
58
|
+
* Gets valid component types for a given property type
|
|
59
|
+
*/
|
|
60
|
+
export type ValidComponentsForPropertyType<P extends WirePropertyTypes> = P extends "boolean" ? "LISTOGRAM" : P extends "string" ? "LISTOGRAM" | "TEXT_TAGS" | "CONTAINS_TEXT" : P extends "datetime" | "timestamp" ? "DATE_RANGE" : P extends "double" | "integer" | "long" | "float" | "short" | "byte" | "decimal" ? "NUMBER_RANGE" : never;
|
|
61
|
+
/**
|
|
62
|
+
* Union of all possible filter states
|
|
63
|
+
*/
|
|
64
|
+
export type FilterState = ExactMatchFilterState<string | boolean> | DateRangeFilterState | ContainsTextFilterState | NumberRangeFilterState;
|
|
65
|
+
/**
|
|
66
|
+
* Maps component types to their corresponding state types
|
|
67
|
+
*/
|
|
68
|
+
export interface FilterStateByComponentType {
|
|
69
|
+
LISTOGRAM: ExactMatchFilterState<string | boolean>;
|
|
70
|
+
DATE_RANGE: DateRangeFilterState;
|
|
71
|
+
TEXT_TAGS: ExactMatchFilterState<string>;
|
|
72
|
+
CONTAINS_TEXT: ContainsTextFilterState;
|
|
73
|
+
NUMBER_RANGE: NumberRangeFilterState;
|
|
74
|
+
}
|
|
75
|
+
type FilterStateType = "EXACT_MATCH" | "DATE_RANGE" | "NUMBER_RANGE" | "CONTAINS_TEXT";
|
|
76
|
+
/**
|
|
77
|
+
* Base interface for all filter states
|
|
78
|
+
* Contains common properties shared across all filter types
|
|
79
|
+
*/
|
|
80
|
+
export interface BaseFilterState {
|
|
81
|
+
/**
|
|
82
|
+
* The type of filter component
|
|
83
|
+
*/
|
|
84
|
+
type: FilterStateType;
|
|
85
|
+
/**
|
|
86
|
+
* If true, the objects satisfying the filter are excluded
|
|
87
|
+
* @default false
|
|
88
|
+
*/
|
|
89
|
+
isExcluding?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* If true, include objects that have no value
|
|
92
|
+
* @default false
|
|
93
|
+
*/
|
|
94
|
+
includeNull?: boolean;
|
|
95
|
+
}
|
|
96
|
+
export interface ExactMatchFilterState<T = string | boolean> extends BaseFilterState {
|
|
97
|
+
type: "EXACT_MATCH";
|
|
98
|
+
values: T[];
|
|
99
|
+
}
|
|
100
|
+
export interface DateRangeFilterState extends BaseFilterState {
|
|
101
|
+
type: "DATE_RANGE";
|
|
102
|
+
/**
|
|
103
|
+
* The earliest date the user can select
|
|
104
|
+
*/
|
|
105
|
+
minValue?: Date;
|
|
106
|
+
/**
|
|
107
|
+
* The latest date the user can select
|
|
108
|
+
*/
|
|
109
|
+
maxValue?: Date;
|
|
110
|
+
}
|
|
111
|
+
export interface ContainsTextFilterState extends BaseFilterState {
|
|
112
|
+
type: "CONTAINS_TEXT";
|
|
113
|
+
value?: string;
|
|
114
|
+
}
|
|
115
|
+
export interface NumberRangeFilterState extends BaseFilterState {
|
|
116
|
+
type: "NUMBER_RANGE";
|
|
117
|
+
/**
|
|
118
|
+
* Minimum numeric value (inclusive)
|
|
119
|
+
*/
|
|
120
|
+
minValue?: number;
|
|
121
|
+
/**
|
|
122
|
+
* Maximum numeric value (inclusive)
|
|
123
|
+
*/
|
|
124
|
+
maxValue?: number;
|
|
125
|
+
}
|
|
126
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cACE,qBACA,WACA,sBACA,cACA,yBACK,WAAY;;;;AAKnB,iBAAiB;CACf,UAAU;CACV,UAAU,aAAa,KAAK,aAAa;CACzC,UAAU,+BACR,oBAAoB,GAAG,MACrB,+BAA+B,oBAAoB,GAAG;UAClD,iBAAiB,GAAG,GAAG,GAAG;CAClC,WAAW,UAAU;;;;;CAMrB,uBAAuBA,OAAO,2BAA2B;CAEzD,mBAAmBC,KAAK,aAAa;AACtC;;;;;;;;AASD,iBAAiB;CACf,UAAU;CACV,UAAU,aAAa,KAAK,aAAa;CACzC,UAAU,+BACR,oBAAoB,GAAG,MACrB,+BAA+B,oBAAoB,GAAG;EAC1D;;;;CAIA,KAAK;;;;CAKL;;;;;CAMA,iBAAiB;;;;;CAMjB,aAAa,2BAA2B;AACzC;;;;KAKI;CACH,UAAU;CACV,UAAU,aAAa;IACrB,oBAAoB,GAAG,cAAc,GAAG;AAE5C,YAAY,sBACR,cACA,eACA,iBACA,cACA;;;;AAKJ,YAAY,+BAA+B,UAAU,qBACnD,UAAU,YAAY,cAClB,UAAU,WAAW,cAAc,cAAc,kBACjD,UAAU,aAAa,cAAc,eACrC,UACE,WACA,YACA,SACA,UACA,UACA,SACA,YAAY;;;;AAMpB,YAAY,cACR,0CACA,uBACA,0BACA;;;;AAKJ,iBAAiB,2BAA2B;CAC1C,WAAW;CACX,YAAY;CACZ,WAAW;CACX,eAAe;CACf,cAAc;AACf;KAEI,kBACD,gBACA,eACA,iBACA;;;;;AAMJ,iBAAiB,gBAAgB;;;;CAI/B,MAAM;;;;;CAMN;;;;;CAMA;AACD;AAED,iBAAiB,sBAAsB,8BAC7B,gBACV;CACE,MAAM;CACN,QAAQ;AACT;AAED,iBAAiB,6BAA6B,gBAAgB;CAC5D,MAAM;;;;CAIN,WAAW;;;;CAIX,WAAW;AACZ;AAED,iBAAiB,gCAAgC,gBAAgB;CAC/D,MAAM;CACN;AACD;AAED,iBAAiB,+BAA+B,gBAAgB;CAC9D,MAAM;;;;CAIN;;;;CAIA;AACD","names":["state: FilterStateByComponentType[C]","key: PropertyKeys<Q>"],"sources":["../../../src/filter-list/FilterListItemApi.ts"],"version":3,"file":"FilterListItemApi.d.ts"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"","names":[],"sources":["../../src/index.ts"],"version":3,"file":"index.d.ts"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"","names":[],"sources":["../../src/junk.test.ts"],"version":3,"file":"junk.test.d.ts"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import type { DerivedProperty, ObjectSet, ObjectTypeDefinition, Osdk, PrimaryKeyType, PropertyKeys, QueryDefinition, SimplePropertyDef, WhereClause } from "@osdk/api";
|
|
2
|
+
import type * as React from "react";
|
|
3
|
+
export type ColumnDefinition<
|
|
4
|
+
Q extends ObjectTypeDefinition,
|
|
5
|
+
RDPs extends Record<string, SimplePropertyDef>,
|
|
6
|
+
FunctionColumns extends Record<string, QueryDefinition<{}>>
|
|
7
|
+
> = {
|
|
8
|
+
locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>
|
|
9
|
+
isVisible?: boolean
|
|
10
|
+
pinned?: "left" | "right" | "none"
|
|
11
|
+
width?: number
|
|
12
|
+
minWidth?: number
|
|
13
|
+
maxWidth?: number
|
|
14
|
+
resizable?: boolean
|
|
15
|
+
orderable?: boolean
|
|
16
|
+
filterable?: boolean
|
|
17
|
+
renderCell?: (object: Osdk.Instance<Q>, locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>) => React.ReactNode
|
|
18
|
+
renderHeader?: () => React.ReactNode
|
|
19
|
+
};
|
|
20
|
+
type ColumnDefinitionLocator<
|
|
21
|
+
Q extends ObjectTypeDefinition,
|
|
22
|
+
RDPs extends Record<string, SimplePropertyDef>,
|
|
23
|
+
FunctionColumns extends Record<string, QueryDefinition<{}>> = {}
|
|
24
|
+
> = {
|
|
25
|
+
type: "property"
|
|
26
|
+
propertyKey: PropertyKeys<Q>
|
|
27
|
+
} | {
|
|
28
|
+
type: "function"
|
|
29
|
+
id: keyof FunctionColumns
|
|
30
|
+
} | {
|
|
31
|
+
type: "rdp"
|
|
32
|
+
id: keyof RDPs
|
|
33
|
+
creator: DerivedProperty.Creator<Q, RDPs[keyof RDPs]>
|
|
34
|
+
};
|
|
35
|
+
export interface ObjectTableProps<
|
|
36
|
+
Q extends ObjectTypeDefinition,
|
|
37
|
+
RDPs extends Record<string, SimplePropertyDef> = {},
|
|
38
|
+
FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<string, never>
|
|
39
|
+
> {
|
|
40
|
+
/**
|
|
41
|
+
* The set of objects to show in the table
|
|
42
|
+
*/
|
|
43
|
+
objectSet: ObjectSet<Q>;
|
|
44
|
+
/**
|
|
45
|
+
* Ordered list of column definitions to show in the table
|
|
46
|
+
*
|
|
47
|
+
* If not provided, all of the properties of the object type will be shown in default order.
|
|
48
|
+
*/
|
|
49
|
+
columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>;
|
|
50
|
+
/**
|
|
51
|
+
* Whether the table is filterable by the user.
|
|
52
|
+
*
|
|
53
|
+
* @default true
|
|
54
|
+
*/
|
|
55
|
+
filterable?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* The current where clause to filter the objects in the table.
|
|
58
|
+
* If provided, the filter is controlled.
|
|
59
|
+
*/
|
|
60
|
+
filter?: WhereClause<Q, RDPs>;
|
|
61
|
+
/**
|
|
62
|
+
* Called when the where clause is changed.
|
|
63
|
+
* Required when filter is controlled.
|
|
64
|
+
*
|
|
65
|
+
* @param newWhere The new where clause
|
|
66
|
+
*/
|
|
67
|
+
onFilterChanged?: (newWhere: WhereClause<Q, RDPs>) => void;
|
|
68
|
+
/**
|
|
69
|
+
* Whether the table is sortable by the user.
|
|
70
|
+
*
|
|
71
|
+
* @default true
|
|
72
|
+
*/
|
|
73
|
+
orderable?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* The current order by clause to sort the objects in the table.
|
|
76
|
+
* If provided, the sorting is controlled.
|
|
77
|
+
*/
|
|
78
|
+
orderBy?: Array<{
|
|
79
|
+
property: PropertyKeys<Q>
|
|
80
|
+
direction: "asc" | "desc"
|
|
81
|
+
}>;
|
|
82
|
+
/**
|
|
83
|
+
* Called when the order by clause is changed.
|
|
84
|
+
* Required when sorting is controlled.
|
|
85
|
+
*
|
|
86
|
+
* @param newOrderBy The new order by clause
|
|
87
|
+
*/
|
|
88
|
+
onOrderByChanged?: (newOrderBy: Array<{
|
|
89
|
+
property: PropertyKeys<Q>
|
|
90
|
+
direction: "asc" | "desc"
|
|
91
|
+
}>) => void;
|
|
92
|
+
/**
|
|
93
|
+
* Called when the visible columns change.
|
|
94
|
+
*
|
|
95
|
+
* If provided, the table will allow the user to show/hide columns.
|
|
96
|
+
*
|
|
97
|
+
* @param newStates The new list of column visibility states
|
|
98
|
+
*/
|
|
99
|
+
onColumnVisibilityChanged?: (newStates: Array<{
|
|
100
|
+
columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns
|
|
101
|
+
isVisible: boolean
|
|
102
|
+
}>) => void;
|
|
103
|
+
/**
|
|
104
|
+
* Called when the pinned columns change.
|
|
105
|
+
*
|
|
106
|
+
* If provided, the table will allow the user to pin/unpin columns.
|
|
107
|
+
*
|
|
108
|
+
* @param newStates The new list of column pin states
|
|
109
|
+
*/
|
|
110
|
+
onColumnsPinnedChanged?: (newStates: Array<{
|
|
111
|
+
columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns
|
|
112
|
+
pinned: "left" | "right" | "none"
|
|
113
|
+
}>) => void;
|
|
114
|
+
/**
|
|
115
|
+
* Called when a column is resized.
|
|
116
|
+
*
|
|
117
|
+
* @param columnId The ID of the resized column
|
|
118
|
+
* @param newWidth The new width of the column
|
|
119
|
+
*/
|
|
120
|
+
onColumnResize?: (columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns, newWidth: number) => void;
|
|
121
|
+
/**
|
|
122
|
+
* Called when a cell is clicked.
|
|
123
|
+
*
|
|
124
|
+
* @param object The object representing the row
|
|
125
|
+
* @param columnDefinition The column definition for the clicked cell
|
|
126
|
+
*/
|
|
127
|
+
onCellClick?: (object: Osdk.Instance<Q>, locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>) => void;
|
|
128
|
+
/**
|
|
129
|
+
* Called when a row is clicked.
|
|
130
|
+
*
|
|
131
|
+
* @param object The object representing the clicked row
|
|
132
|
+
*/
|
|
133
|
+
onRowClick?: (object: Osdk.Instance<Q>) => void;
|
|
134
|
+
/**
|
|
135
|
+
* Selection mode for the table rows.
|
|
136
|
+
*
|
|
137
|
+
* If multiple, a checkbox will be shown for each row to allow selecting multiple rows
|
|
138
|
+
* as well as a top-level checkbox in the header to select all rows.
|
|
139
|
+
*/
|
|
140
|
+
selectionMode?: "single" | "multiple" | "none";
|
|
141
|
+
/**
|
|
142
|
+
* The currently selected rows in the table.
|
|
143
|
+
* If provided, the row selection is controlled.
|
|
144
|
+
*/
|
|
145
|
+
selectedRows?: PrimaryKeyType<Q>[];
|
|
146
|
+
/**
|
|
147
|
+
* Called when the row selection changes.
|
|
148
|
+
* Required when row selection is controlled.
|
|
149
|
+
*
|
|
150
|
+
* @param objects The currently selected objects
|
|
151
|
+
*/
|
|
152
|
+
onRowSelection?: (objects: PrimaryKeyType<Q>[]) => void;
|
|
153
|
+
/**
|
|
154
|
+
* If provided, will render this context menu when right clicking on a cell
|
|
155
|
+
*/
|
|
156
|
+
renderCellContextMenu?: (object: Osdk.Instance<Q>, locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>) => React.ReactNode;
|
|
157
|
+
}
|
|
158
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cACE,iBACA,WACA,sBACA,MACA,gBACA,cACA,iBACA,mBACA,mBACK,WAAY;AACnB,iBAAiB,WAAW,OAAQ;AAEpC,YAAY;CACV,UAAU;CACV,aAAa,eAAe;CAC5B,wBAAwB,eAAe,gBAAgB,CAAE;IACvD;CACF,SAAS,wBAAwB,GAAG,MAAM;CAC1C;CACA,SAAS,SAAS,UAAU;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA,cACEA,QAAQ,KAAK,SAAS,IACtBC,SAAS,wBAAwB,GAAG,MAAM,qBACvC,MAAM;CACX,qBAAqB,MAAM;AAC5B;KAEI;CACH,UAAU;CACV,aAAa,eAAe;CAC5B,wBAAwB,eAAe,gBAAgB,CAAE,MAAK,CAAE;IAE9D;CACA,MAAM;CACN,aAAa,aAAa;AAC3B,IACC;CACA,MAAM;CACN,UAAU;AACX,IACC;CACA,MAAM;CACN,UAAU;CACV,SAAS,gBAAgB,QAAQ,GAAG,WAAW;AAChD;AAEH,iBAAiB;CACf,UAAU;CACV,aAAa,eAAe,qBAAqB,CAAE;CACnD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;EAI9D;;;;CAIA,WAAW,UAAU;;;;;;CAOrB,oBAAoB,MAAM,iBAAiB,GAAG,MAAM;;;;;;CAOpD;;;;;CAMA,SAAS,YAAY,GAAG;;;;;;;CAQxB,mBAAmBC,UAAU,YAAY,GAAG;;;;;;CAO5C;;;;;CAMA,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;;;;;;;CASF,eACEP,QAAQ,KAAK,SAAS,IACtBC,SAAS,wBAAwB,GAAG,MAAM;;;;;;CAQ5C,cAAcD,QAAQ,KAAK,SAAS;;;;;;;CAQpC,gBAAgB,WAAW,aAAa;;;;;CAMxC,eAAe,eAAe;;;;;;;CAQ9B,kBAAkBQ,SAAS,eAAe;;;;CAK1C,yBACER,QAAQ,KAAK,SAAS,IACtBC,SAAS,wBAAwB,GAAG,MAAM,qBACvC,MAAM;AACZ","names":["object: Osdk.Instance<Q>","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","objects: PrimaryKeyType<Q>[]"],"sources":["../../../src/object-table/ObjectTableApi.ts"],"version":3,"file":"ObjectTableApi.d.ts"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cAAc,uBAAuB;AACrC,cAAc,2BAA2B;AAEzC,cAAc,wBAAwB","names":[],"sources":["../../../src/public/experimental.ts"],"version":3,"file":"experimental.d.ts"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export * from "./build/types/public/experimental.js";
|
package/package.json
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@osdk/react-components",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/palantir/osdk-ts.git"
|
|
8
|
+
},
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"browser": "./build/browser/index.js",
|
|
12
|
+
"import": {
|
|
13
|
+
"types": "./build/types/index.d.ts",
|
|
14
|
+
"default": "./build/esm/index.js"
|
|
15
|
+
},
|
|
16
|
+
"require": "./build/cjs/index.cjs",
|
|
17
|
+
"default": "./build/browser/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./experimental": {
|
|
20
|
+
"browser": "./build/browser/public/experimental.js",
|
|
21
|
+
"import": {
|
|
22
|
+
"types": "./build/types/public/experimental.d.ts",
|
|
23
|
+
"default": "./build/esm/public/experimental.js"
|
|
24
|
+
},
|
|
25
|
+
"require": "./build/cjs/public/experimental.cjs",
|
|
26
|
+
"default": "./build/browser/public/experimental.js"
|
|
27
|
+
},
|
|
28
|
+
"./*": {
|
|
29
|
+
"browser": "./build/browser/public/*.js",
|
|
30
|
+
"import": {
|
|
31
|
+
"types": "./build/types/public/*.d.ts",
|
|
32
|
+
"default": "./build/esm/public/*.js"
|
|
33
|
+
},
|
|
34
|
+
"require": "./build/cjs/public/*.cjs",
|
|
35
|
+
"default": "./build/browser/public/*.js"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"@osdk/api": "*",
|
|
40
|
+
"@osdk/client": "*",
|
|
41
|
+
"@osdk/react": "*",
|
|
42
|
+
"@types/react": "^17 || ^18 || ^19",
|
|
43
|
+
"react": "^17 || ^18 || ^19",
|
|
44
|
+
"react-dom": "^17 || ^18 || ^19"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@types/react": "^18.3.24",
|
|
48
|
+
"react": "^18.3.1",
|
|
49
|
+
"typescript": "~5.5.4",
|
|
50
|
+
"@osdk/api": "2.7.0-beta.4",
|
|
51
|
+
"@osdk/client": "2.7.0-beta.4",
|
|
52
|
+
"@osdk/monorepo.api-extractor": "~0.6.0-beta.1",
|
|
53
|
+
"@osdk/monorepo.tsconfig": "~0.6.0-beta.1",
|
|
54
|
+
"@osdk/react": "0.9.0-beta.3"
|
|
55
|
+
},
|
|
56
|
+
"publishConfig": {
|
|
57
|
+
"access": "public"
|
|
58
|
+
},
|
|
59
|
+
"files": [
|
|
60
|
+
"build/cjs",
|
|
61
|
+
"build/esm",
|
|
62
|
+
"build/browser",
|
|
63
|
+
"build/types",
|
|
64
|
+
"CHANGELOG.md",
|
|
65
|
+
"package.json",
|
|
66
|
+
"templates",
|
|
67
|
+
"*.d.ts"
|
|
68
|
+
],
|
|
69
|
+
"main": "./build/cjs/index.cjs",
|
|
70
|
+
"module": "./build/esm/index.js",
|
|
71
|
+
"types": "./build/cjs/index.d.cts",
|
|
72
|
+
"type": "module",
|
|
73
|
+
"scripts": {
|
|
74
|
+
"check-attw": "attw --pack .",
|
|
75
|
+
"check-spelling": "cspell --quiet .",
|
|
76
|
+
"clean": "rm -rf lib dist types build tsconfig.tsbuildinfo",
|
|
77
|
+
"fix-lint": "eslint . --fix && dprint fmt --config $(find-up dprint.json)",
|
|
78
|
+
"lint": "eslint . && dprint check --config $(find-up dprint.json)",
|
|
79
|
+
"test": "vitest run",
|
|
80
|
+
"transpileBrowser": "monorepo.tool.transpile -f esm -m normal -t browser",
|
|
81
|
+
"transpileCjs": "monorepo.tool.transpile -f cjs -m bundle -t node",
|
|
82
|
+
"transpileEsm": "monorepo.tool.transpile -f esm -m normal -t node",
|
|
83
|
+
"transpileTypes": "monorepo.tool.transpile -f esm -m types -t node",
|
|
84
|
+
"typecheck": "tsc --noEmit --emitDeclarationOnly false"
|
|
85
|
+
}
|
|
86
|
+
}
|