@dxos/react-ui-table 0.8.2-main.5885341 → 0.8.2-main.600d381
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/chunk-UGGYKLOH.mjs +28 -0
- package/dist/lib/browser/chunk-UGGYKLOH.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +19 -18
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/types/index.mjs +1 -1
- package/dist/lib/node/{chunk-TGG6OZ54.cjs → chunk-2QLLIPZK.cjs} +13 -11
- package/dist/lib/node/chunk-2QLLIPZK.cjs.map +7 -0
- package/dist/lib/node/index.cjs +69 -68
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/types/index.cjs +3 -3
- package/dist/lib/node/types/index.cjs.map +1 -1
- package/dist/lib/node-esm/{chunk-KKLP54L3.mjs → chunk-N2RRVR7F.mjs} +11 -9
- package/dist/lib/node-esm/chunk-N2RRVR7F.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +19 -18
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/types/index.mjs +1 -1
- package/dist/types/src/components/Table/ColumnActionsMenu.d.ts.map +1 -1
- package/dist/types/src/components/Table/ColumnSettings.d.ts.map +1 -1
- package/dist/types/src/components/Table/CreateRefPanel.d.ts.map +1 -1
- package/dist/types/src/components/Table/DynamicTable.d.ts +0 -2
- package/dist/types/src/components/Table/DynamicTable.d.ts.map +1 -1
- package/dist/types/src/components/Table/RowActionsMenu.d.ts.map +1 -1
- package/dist/types/src/components/Table/Table.stories.d.ts.map +1 -1
- package/dist/types/src/components/Table/relations.stories.d.ts.map +1 -1
- package/dist/types/src/components/TableCellEditor/TableCellEditor.d.ts.map +1 -1
- package/dist/types/src/components/TableCellEditor/extension.d.ts.map +1 -1
- package/dist/types/src/components/TableToolbar/TableToolbar.d.ts +2 -2
- package/dist/types/src/components/TableToolbar/TableToolbar.d.ts.map +1 -1
- package/dist/types/src/components/testing.d.ts +39 -39
- package/dist/types/src/components/testing.d.ts.map +1 -1
- package/dist/types/src/hooks/useTableModel.d.ts.map +1 -1
- package/dist/types/src/model/modal-controller.d.ts.map +1 -1
- package/dist/types/src/model/selection-model.d.ts.map +1 -1
- package/dist/types/src/model/table-model.d.ts.map +1 -1
- package/dist/types/src/model/table-presentation.d.ts.map +1 -1
- package/dist/types/src/types/table.d.ts +42 -42
- package/dist/types/src/types/table.d.ts.map +1 -1
- package/dist/types/src/util/dynamic-table.d.ts.map +1 -1
- package/dist/types/src/util/signals.d.ts.map +1 -1
- package/dist/types/src/util/table-controls.d.ts.map +1 -1
- package/dist/types/src/util/table.d.ts +2 -2
- package/dist/types/src/util/table.d.ts.map +1 -1
- package/dist/types/src/util/tag.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +35 -33
- package/src/components/Table/CreateRefPanel.tsx +3 -3
- package/src/components/Table/DynamicTable.stories.tsx +1 -1
- package/src/components/Table/DynamicTable.tsx +0 -2
- package/src/components/Table/Table.stories.tsx +4 -5
- package/src/components/Table/relations.stories.tsx +11 -10
- package/src/components/TableCellEditor/TableCellEditor.stories.tsx +1 -1
- package/src/components/TableToolbar/TableToolbar.tsx +10 -11
- package/src/components/testing.ts +7 -6
- package/src/model/table-model.test.ts +4 -3
- package/src/model/table-presentation.test.ts +4 -3
- package/src/types/table.ts +16 -8
- package/src/util/table.ts +7 -7
- package/dist/lib/browser/chunk-YWNRUF4J.mjs +0 -26
- package/dist/lib/browser/chunk-YWNRUF4J.mjs.map +0 -7
- package/dist/lib/node/chunk-TGG6OZ54.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-KKLP54L3.mjs.map +0 -7
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// packages/ui/react-ui-table/src/types/table.ts
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
import { Type } from "@dxos/echo";
|
|
4
|
+
import { LabelAnnotationId } from "@dxos/echo-schema";
|
|
5
|
+
import { ViewType } from "@dxos/schema";
|
|
6
|
+
var TableSchema = Schema.Struct({
|
|
7
|
+
id: Type.ObjectId,
|
|
8
|
+
name: Schema.optional(Schema.String),
|
|
9
|
+
view: Schema.optional(Type.Ref(ViewType)),
|
|
10
|
+
// TODO(burdon): Document why threads is included here?
|
|
11
|
+
threads: Schema.optional(Schema.Array(Type.Ref(
|
|
12
|
+
Type.Expando
|
|
13
|
+
/* ThreadType */
|
|
14
|
+
)))
|
|
15
|
+
}).annotations({
|
|
16
|
+
// TODO(burdon): Move annotation to property.
|
|
17
|
+
[LabelAnnotationId]: "name"
|
|
18
|
+
});
|
|
19
|
+
var TableType = TableSchema.pipe(Type.def({
|
|
20
|
+
typename: "dxos.org/type/Table",
|
|
21
|
+
version: "0.1.0"
|
|
22
|
+
}));
|
|
23
|
+
|
|
24
|
+
export {
|
|
25
|
+
TableSchema,
|
|
26
|
+
TableType
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=chunk-UGGYKLOH.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/types/table.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { Type } from '@dxos/echo';\n// import { ThreadType } from '@dxos/plugin-space/types';\nimport { LabelAnnotationId } from '@dxos/echo-schema';\nimport { ViewType } from '@dxos/schema';\n\nexport const TableSchema = Schema.Struct({\n id: Type.ObjectId,\n name: Schema.optional(Schema.String),\n view: Schema.optional(Type.Ref(ViewType)),\n // TODO(burdon): Document why threads is included here?\n threads: Schema.optional(Schema.Array(Type.Ref(Type.Expando /* ThreadType */))),\n}).annotations({\n // TODO(burdon): Move annotation to property.\n [LabelAnnotationId]: 'name',\n});\n\nexport const TableType = TableSchema.pipe(\n Type.def({\n typename: 'dxos.org/type/Table',\n version: '0.1.0',\n }),\n);\nexport interface TableType extends Schema.Schema.Type<typeof TableType> {}\n"],
|
|
5
|
+
"mappings": ";AAIA,SAASA,cAAc;AAEvB,SAASC,YAAY;AAErB,SAASC,yBAAyB;AAClC,SAASC,gBAAgB;AAElB,IAAMC,cAAcC,OAAOC,OAAO;EACvCC,IAAIC,KAAKC;EACTC,MAAML,OAAOM,SAASN,OAAOO,MAAM;EACnCC,MAAMR,OAAOM,SAASH,KAAKM,IAAIC,QAAAA,CAAAA;;EAE/BC,SAASX,OAAOM,SAASN,OAAOY,MAAMT,KAAKM;IAAIN,KAAKU;;EAAsB,CAAA,CAAA;AAC5E,CAAA,EAAGC,YAAY;;EAEb,CAACC,iBAAAA,GAAoB;AACvB,CAAA;AAEO,IAAMC,YAAYjB,YAAYkB,KACnCd,KAAKe,IAAI;EACPC,UAAU;EACVC,SAAS;AACX,CAAA,CAAA;",
|
|
6
|
+
"names": ["Schema", "Type", "LabelAnnotationId", "ViewType", "TableSchema", "Schema", "Struct", "id", "Type", "ObjectId", "name", "optional", "String", "view", "Ref", "ViewType", "threads", "Array", "Expando", "annotations", "LabelAnnotationId", "TableType", "pipe", "def", "typename", "version"]
|
|
7
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TableSchema,
|
|
3
3
|
TableType
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UGGYKLOH.mjs";
|
|
5
5
|
|
|
6
6
|
// packages/ui/react-ui-table/src/translations.ts
|
|
7
7
|
var translationKey = "table";
|
|
@@ -150,8 +150,8 @@ var ColumnSettings = ({ model, modals, onNewColumn }) => {
|
|
|
150
150
|
};
|
|
151
151
|
|
|
152
152
|
// packages/ui/react-ui-table/src/components/Table/CreateRefPanel.tsx
|
|
153
|
+
import { Schema } from "effect";
|
|
153
154
|
import React3, { useCallback as useCallback2, useMemo as useMemo2 } from "react";
|
|
154
|
-
import { S } from "@dxos/echo-schema";
|
|
155
155
|
import { live } from "@dxos/react-client/echo";
|
|
156
156
|
import { Popover } from "@dxos/react-ui";
|
|
157
157
|
import { Form } from "@dxos/react-ui-form";
|
|
@@ -168,7 +168,7 @@ var CreateRefPanel = ({ model, modals, __gridScope }) => {
|
|
|
168
168
|
typename: state.typename
|
|
169
169
|
}).runSync();
|
|
170
170
|
if (schema2) {
|
|
171
|
-
const omit =
|
|
171
|
+
const omit = Schema.omit("id");
|
|
172
172
|
return omit(schema2);
|
|
173
173
|
}
|
|
174
174
|
}, [
|
|
@@ -344,7 +344,8 @@ var setProperties = (view, projection, properties) => {
|
|
|
344
344
|
var touch = (value) => value;
|
|
345
345
|
|
|
346
346
|
// packages/ui/react-ui-table/src/util/table.ts
|
|
347
|
-
import {
|
|
347
|
+
import { Schema as Schema2, SchemaAST } from "effect";
|
|
348
|
+
import { Format, FormatEnum, TypedObject, TypeEnum } from "@dxos/echo-schema";
|
|
348
349
|
import { PublicKey } from "@dxos/react-client";
|
|
349
350
|
import { live as live3, makeRef as makeRef2 } from "@dxos/react-client/echo";
|
|
350
351
|
import { createFieldId, createView as createView2, getSchemaProperties, ViewProjection as ViewProjection2 } from "@dxos/schema";
|
|
@@ -385,13 +386,13 @@ var ContactSchema = TypedObject({
|
|
|
385
386
|
typename: `example.com/type/${PublicKey.random().truncate()}`,
|
|
386
387
|
version: "0.1.0"
|
|
387
388
|
})({
|
|
388
|
-
name:
|
|
389
|
-
[
|
|
389
|
+
name: Schema2.optional(Schema2.String).annotations({
|
|
390
|
+
[SchemaAST.TitleAnnotationId]: "Name"
|
|
390
391
|
}),
|
|
391
|
-
active:
|
|
392
|
-
email:
|
|
393
|
-
salary:
|
|
394
|
-
[
|
|
392
|
+
active: Schema2.optional(Schema2.Boolean),
|
|
393
|
+
email: Schema2.optional(Format.Email),
|
|
394
|
+
salary: Schema2.optional(Format.Currency()).annotations({
|
|
395
|
+
[SchemaAST.TitleAnnotationId]: "Salary"
|
|
395
396
|
})
|
|
396
397
|
});
|
|
397
398
|
var ContactFields = [
|
|
@@ -2284,8 +2285,8 @@ var DynamicTable = ({ classNames, name = "example.com/dynamic-table", rows, prop
|
|
|
2284
2285
|
import React8, { useCallback as useCallback6, useMemo as useMemo6 } from "react";
|
|
2285
2286
|
import { live as live4 } from "@dxos/live-object";
|
|
2286
2287
|
import { createGapSeparator, createMenuAction, MenuProvider, ToolbarMenu, useMenuActions } from "@dxos/react-ui-menu";
|
|
2287
|
-
var createTableToolbarActions = (state) => {
|
|
2288
|
-
const add = createMenuAction("add-row", {
|
|
2288
|
+
var createTableToolbarActions = (state, onAction) => {
|
|
2289
|
+
const add = createMenuAction("add-row", () => onAction(add), {
|
|
2289
2290
|
type: "add-row",
|
|
2290
2291
|
icon: "ph--plus--regular",
|
|
2291
2292
|
label: [
|
|
@@ -2296,7 +2297,7 @@ var createTableToolbarActions = (state) => {
|
|
|
2296
2297
|
],
|
|
2297
2298
|
testId: "table.toolbar.add-row"
|
|
2298
2299
|
});
|
|
2299
|
-
const save = createMenuAction("save-view", {
|
|
2300
|
+
const save = createMenuAction("save-view", () => onAction(save), {
|
|
2300
2301
|
type: "save-view",
|
|
2301
2302
|
icon: "ph--floppy-disk--regular",
|
|
2302
2303
|
label: [
|
|
@@ -2310,7 +2311,7 @@ var createTableToolbarActions = (state) => {
|
|
|
2310
2311
|
hidden: !state.viewDirty
|
|
2311
2312
|
});
|
|
2312
2313
|
const gap = createGapSeparator();
|
|
2313
|
-
const comment = createMenuAction("comment", {
|
|
2314
|
+
const comment = createMenuAction("comment", () => onAction(comment), {
|
|
2314
2315
|
type: "comment",
|
|
2315
2316
|
icon: "ph--chat-text--regular",
|
|
2316
2317
|
label: [
|
|
@@ -2339,14 +2340,14 @@ var TableToolbar = ({ classNames, viewDirty, attendableId, onAction }) => {
|
|
|
2339
2340
|
const state = useMemo6(() => live4({
|
|
2340
2341
|
viewDirty
|
|
2341
2342
|
}), []);
|
|
2342
|
-
const actionsCreator = useCallback6(() => createTableToolbarActions(state), [
|
|
2343
|
-
state
|
|
2343
|
+
const actionsCreator = useCallback6(() => createTableToolbarActions(state, onAction), [
|
|
2344
|
+
state,
|
|
2345
|
+
onAction
|
|
2344
2346
|
]);
|
|
2345
2347
|
const menu = useMenuActions(actionsCreator);
|
|
2346
2348
|
return /* @__PURE__ */ React8.createElement(MenuProvider, {
|
|
2347
2349
|
...menu,
|
|
2348
|
-
attendableId
|
|
2349
|
-
onAction
|
|
2350
|
+
attendableId
|
|
2350
2351
|
}, /* @__PURE__ */ React8.createElement(ToolbarMenu, {
|
|
2351
2352
|
classNames
|
|
2352
2353
|
}));
|