@dxos/react-ui-table 0.8.4-main.c85a9c8dae → 0.8.4-main.d05673bc65

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.
@@ -8,7 +8,6 @@ var __export = (target, all) => {
8
8
  var Table_exports = {};
9
9
  __export(Table_exports, {
10
10
  Table: () => Table,
11
- TableV1: () => TableV1,
12
11
  make: () => make
13
12
  });
14
13
  import * as Match from "effect/Match";
@@ -27,8 +26,8 @@ var Table = Schema.Struct({
27
26
  value: Schema.Number
28
27
  }).pipe(Schema.mutable, FormInputAnnotation.set(false))
29
28
  }).pipe(Type.object({
30
- typename: "dxos.org/type/Table",
31
- version: "0.2.0"
29
+ typename: "org.dxos.type.table",
30
+ version: "0.1.0"
32
31
  }), LabelAnnotation.set([
33
32
  "name"
34
33
  ]), ViewAnnotation.set(true), Annotation.IconAnnotation.set({
@@ -64,17 +63,8 @@ var make = ({ name, sizes = {}, view, jsonSchema }) => {
64
63
  }
65
64
  return table;
66
65
  };
67
- var TableV1 = Schema.Struct({
68
- sizes: Schema.Record({
69
- key: Schema.String,
70
- value: Schema.Number
71
- }).pipe(Schema.mutable)
72
- }).pipe(Type.object({
73
- typename: "dxos.org/type/Table",
74
- version: "0.1.0"
75
- }));
76
66
 
77
67
  export {
78
68
  Table_exports
79
69
  };
80
- //# sourceMappingURL=chunk-DSR2MRZB.mjs.map
70
+ //# sourceMappingURL=chunk-BF54SSNL.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/types/Table.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Match from 'effect/Match';\nimport * as Schema from 'effect/Schema';\nimport * as SchemaAST from 'effect/SchemaAST';\n\nimport { Annotation, JsonSchema, Obj, Ref, Type } from '@dxos/echo';\nimport { View } from '@dxos/echo';\nimport { FormInputAnnotation, type JsonPath, type JsonSchemaType, LabelAnnotation } from '@dxos/echo/internal';\nimport { ViewAnnotation } from '@dxos/schema';\n\nexport const Table = Schema.Struct({\n name: Schema.String.pipe(Schema.optional),\n\n view: Ref.Ref(View.View).pipe(FormInputAnnotation.set(false)),\n\n sizes: Schema.Record({\n // TODO(wittjosiah): Should be JsonPath.\n key: Schema.String,\n value: Schema.Number,\n }).pipe(Schema.mutable, FormInputAnnotation.set(false)),\n}).pipe(\n Type.object({\n typename: 'dxos.org/type/Table',\n version: '0.2.0',\n }),\n LabelAnnotation.set(['name']),\n ViewAnnotation.set(true),\n Annotation.IconAnnotation.set({\n icon: 'ph--table--regular',\n hue: 'green',\n }),\n);\n\nexport interface Table extends Schema.Schema.Type<typeof Table> {}\n\ntype MakeProps = {\n name?: string;\n sizes?: Record<string, number>;\n view: View.View;\n /** Required to auto-size columns. */\n jsonSchema?: JsonSchemaType;\n};\n\n/**\n * Make a table as a view of a data set.\n */\nexport const make = ({ name, sizes = {}, view, jsonSchema }: MakeProps): Table => {\n const table = Obj.make(Table, { name, view: Ref.make(view), sizes } as Obj.MakeProps<typeof Table>);\n\n // Preset sizes.\n if (jsonSchema) {\n const schema = JsonSchema.toEffectSchema(jsonSchema);\n const properties = SchemaAST.getPropertySignatures(schema.ast);\n for (const property of properties) {\n const name = property.name.toString() as JsonPath;\n if (sizes?.[name]) {\n table.sizes[name] = sizes[name];\n continue;\n }\n\n Match.type<SchemaAST.AST>().pipe(\n Match.when({ _tag: 'BooleanKeyword' }, () => {\n table.sizes[name] = 100;\n }),\n Match.when({ _tag: 'NumberKeyword' }, () => {\n table.sizes[name] = 100;\n }),\n Match.orElse(() => {\n // Noop.\n }),\n )(property.type);\n }\n }\n\n return table;\n};\n\n//\n// V1\n//\n\nexport const TableV1 = Schema.Struct({\n sizes: Schema.Record({\n key: Schema.String,\n value: Schema.Number,\n }).pipe(Schema.mutable),\n}).pipe(\n Type.object({\n typename: 'dxos.org/type/Table',\n version: '0.1.0',\n }),\n);\n"],
5
- "mappings": ";;;;;;;;AAAA;;;;;;AA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AAA,GACMuC,WAAK;QAAEC,MAAM;MAAgB,GAAG,MAAA;AACpCb,cAAMlB,MAAMT,KAAAA,IAAQ;MACtB,CAAA,GACMyC,aAAO,MAAA;MAEb,CAAA,CAAA,EACAN,SAASG,IAAI;IACjB;EACF;AAEA,SAAOX;AACT;AAMO,IAAMe,UAAiB3C,cAAO;EACnCU,OAAcC,cAAO;IACnBC,KAAYV;IACZW,OAAcC;EAChB,CAAA,EAAGX,KAAYY,cAAO;AACxB,CAAA,EAAGZ,KACDa,KAAKC,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,CAAA;",
6
- "names": ["Match", "Schema", "SchemaAST", "Annotation", "JsonSchema", "Obj", "Ref", "Type", "View", "FormInputAnnotation", "LabelAnnotation", "ViewAnnotation", "Table", "Struct", "name", "String", "pipe", "optional", "view", "Ref", "View", "FormInputAnnotation", "set", "sizes", "Record", "key", "value", "Number", "mutable", "Type", "object", "typename", "version", "LabelAnnotation", "ViewAnnotation", "Annotation", "IconAnnotation", "icon", "hue", "make", "jsonSchema", "table", "Obj", "schema", "JsonSchema", "toEffectSchema", "properties", "getPropertySignatures", "ast", "property", "toString", "Match", "type", "when", "_tag", "orElse", "TableV1"]
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Match from 'effect/Match';\nimport * as Schema from 'effect/Schema';\nimport * as SchemaAST from 'effect/SchemaAST';\n\nimport { Annotation, JsonSchema, Obj, Ref, Type } from '@dxos/echo';\nimport { View } from '@dxos/echo';\nimport { FormInputAnnotation, type JsonPath, type JsonSchemaType, LabelAnnotation } from '@dxos/echo/internal';\nimport { ViewAnnotation } from '@dxos/schema';\n\nexport const Table = Schema.Struct({\n name: Schema.String.pipe(Schema.optional),\n\n view: Ref.Ref(View.View).pipe(FormInputAnnotation.set(false)),\n\n sizes: Schema.Record({\n // TODO(wittjosiah): Should be JsonPath.\n key: Schema.String,\n value: Schema.Number,\n }).pipe(Schema.mutable, FormInputAnnotation.set(false)),\n}).pipe(\n Type.object({\n typename: 'org.dxos.type.table',\n version: '0.1.0',\n }),\n LabelAnnotation.set(['name']),\n ViewAnnotation.set(true),\n Annotation.IconAnnotation.set({\n icon: 'ph--table--regular',\n hue: 'green',\n }),\n);\n\nexport interface Table extends Schema.Schema.Type<typeof Table> {}\n\ntype MakeProps = {\n name?: string;\n sizes?: Record<string, number>;\n view: View.View;\n /** Required to auto-size columns. */\n jsonSchema?: JsonSchemaType;\n};\n\n/**\n * Make a table as a view of a data set.\n */\nexport const make = ({ name, sizes = {}, view, jsonSchema }: MakeProps): Table => {\n const table = Obj.make(Table, { name, view: Ref.make(view), sizes } as Obj.MakeProps<typeof Table>);\n\n // Preset sizes.\n if (jsonSchema) {\n const schema = JsonSchema.toEffectSchema(jsonSchema);\n const properties = SchemaAST.getPropertySignatures(schema.ast);\n for (const property of properties) {\n const name = property.name.toString() as JsonPath;\n if (sizes?.[name]) {\n table.sizes[name] = sizes[name];\n continue;\n }\n\n Match.type<SchemaAST.AST>().pipe(\n Match.when({ _tag: 'BooleanKeyword' }, () => {\n table.sizes[name] = 100;\n }),\n Match.when({ _tag: 'NumberKeyword' }, () => {\n table.sizes[name] = 100;\n }),\n Match.orElse(() => {\n // Noop.\n }),\n )(property.type);\n }\n }\n\n return table;\n};\n"],
5
+ "mappings": ";;;;;;;AAAA;;;;;AAIA,YAAYA,WAAW;AACvB,YAAYC,YAAY;AACxB,YAAYC,eAAe;AAE3B,SAASC,YAAYC,YAAYC,KAAKC,KAAKC,YAAY;AACvD,SAASC,YAAY;AACrB,SAASC,qBAAyDC,uBAAuB;AACzF,SAASC,sBAAsB;AAExB,IAAMC,QAAeC,cAAO;EACjCC,MAAaC,cAAOC,KAAYC,eAAQ;EAExCC,MAAMC,IAAIA,IAAIC,KAAKA,IAAI,EAAEJ,KAAKK,oBAAoBC,IAAI,KAAA,CAAA;EAEtDC,OAAcC,cAAO;;IAEnBC,KAAYV;IACZW,OAAcC;EAChB,CAAA,EAAGX,KAAYY,gBAASP,oBAAoBC,IAAI,KAAA,CAAA;AAClD,CAAA,EAAGN,KACDa,KAAKC,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,GACAC,gBAAgBX,IAAI;EAAC;CAAO,GAC5BY,eAAeZ,IAAI,IAAA,GACnBa,WAAWC,eAAed,IAAI;EAC5Be,MAAM;EACNC,KAAK;AACP,CAAA,CAAA;AAgBK,IAAMC,OAAO,CAAC,EAAEzB,MAAMS,QAAQ,CAAC,GAAGL,MAAMsB,WAAU,MAAa;AACpE,QAAMC,QAAQC,IAAIH,KAAK3B,OAAO;IAAEE;IAAMI,MAAMC,IAAIoB,KAAKrB,IAAAA;IAAOK;EAAM,CAAA;AAGlE,MAAIiB,YAAY;AACd,UAAMG,SAASC,WAAWC,eAAeL,UAAAA;AACzC,UAAMM,aAAuBC,gCAAsBJ,OAAOK,GAAG;AAC7D,eAAWC,YAAYH,YAAY;AACjC,YAAMhC,QAAOmC,SAASnC,KAAKoC,SAAQ;AACnC,UAAI3B,QAAQT,KAAAA,GAAO;AACjB2B,cAAMlB,MAAMT,KAAAA,IAAQS,MAAMT,KAAAA;AAC1B;MACF;AAEAqC,MAAMC,WAAI,EAAkBpC,KACpBqC,WAAK;QAAEC,MAAM;MAAiB,GAAG,MAAA;AACrCb,cAAMlB,MAAMT,KAAAA,IAAQ;MACtB,CAAA,GACMuC,WAAK;QAAEC,MAAM;MAAgB,GAAG,MAAA;AACpCb,cAAMlB,MAAMT,KAAAA,IAAQ;MACtB,CAAA,GACMyC,aAAO,MAAA;MAEb,CAAA,CAAA,EACAN,SAASG,IAAI;IACjB;EACF;AAEA,SAAOX;AACT;",
6
+ "names": ["Match", "Schema", "SchemaAST", "Annotation", "JsonSchema", "Obj", "Ref", "Type", "View", "FormInputAnnotation", "LabelAnnotation", "ViewAnnotation", "Table", "Struct", "name", "String", "pipe", "optional", "view", "Ref", "View", "FormInputAnnotation", "set", "sizes", "Record", "key", "value", "Number", "mutable", "Type", "object", "typename", "version", "LabelAnnotation", "ViewAnnotation", "Annotation", "IconAnnotation", "icon", "hue", "make", "jsonSchema", "table", "Obj", "schema", "JsonSchema", "toEffectSchema", "properties", "getPropertySignatures", "ast", "property", "toString", "Match", "type", "when", "_tag", "orElse"]
7
7
  }
@@ -19,7 +19,7 @@ import {
19
19
  } from "./chunk-PTHMYAAM.mjs";
20
20
  import {
21
21
  Table_exports
22
- } from "./chunk-DSR2MRZB.mjs";
22
+ } from "./chunk-BF54SSNL.mjs";
23
23
 
24
24
  // src/translations.ts
25
25
  var translationKey = "@dxos/react-ui-table";
@@ -61,7 +61,7 @@ import { log } from "@dxos/log";
61
61
  import { useAttention } from "@dxos/react-ui-attention";
62
62
  import { Grid, closestCell, gridSeparatorBlockEnd, gridSeparatorInlineEnd } from "@dxos/react-ui-grid";
63
63
  import { DxEditRequest } from "@dxos/react-ui-grid";
64
- import { mx, useComposableProps } from "@dxos/ui-theme";
64
+ import { composableProps, mx } from "@dxos/ui-theme";
65
65
 
66
66
  // src/util/dynamic-table.ts
67
67
  import { Filter, JsonSchema, Obj, Order, Query, Ref, Type } from "@dxos/echo";
@@ -1246,12 +1246,10 @@ var TableMainInner = ({ schema, model, presentation, ignoreAttention, onCreate,
1246
1246
  className: "dx-attention-surface"
1247
1247
  });
1248
1248
  }
1249
- const { className, ...rest } = useComposableProps(props);
1250
- return /* @__PURE__ */ React8.createElement("div", {
1251
- ...rest,
1249
+ return /* @__PURE__ */ React8.createElement("div", composableProps(props, {
1252
1250
  role: "none",
1253
- className: mx("dx-container relative", className)
1254
- }, /* @__PURE__ */ React8.createElement(Grid.Root, {
1251
+ className: "dx-container relative"
1252
+ }), /* @__PURE__ */ React8.createElement(Grid.Root, {
1255
1253
  id: model.id ?? "table-grid"
1256
1254
  }, /* @__PURE__ */ React8.createElement(TableValueEditor, {
1257
1255
  model,
@@ -1301,7 +1299,7 @@ import { RegistryContext as RegistryContext3 } from "@effect-atom/atom-react";
1301
1299
  import React9, { useCallback as useCallback5, useContext as useContext3, useEffect as useEffect5, useMemo as useMemo6, useRef as useRef3, useState as useState5 } from "react";
1302
1300
  import { useDefaultValue } from "@dxos/react-ui";
1303
1301
  import { mx as mx2 } from "@dxos/ui-theme";
1304
- var DynamicTable = ({ classNames, schema, name = "example.com/dynamic-table", rows, properties, jsonSchema: jsonSchemaProp, rowActions, onRowClick, onRowAction, ...props }) => {
1302
+ var DynamicTable = ({ classNames, schema, name = "com.example.dynamic-table", rows, properties, jsonSchema: jsonSchemaProp, rowActions, onRowClick, onRowAction, ...props }) => {
1305
1303
  const registry = useContext3(RegistryContext3);
1306
1304
  const [dynamicTable, setDynamicTable] = useState5();
1307
1305
  const { jsonSchema } = useMemo6(() => getBaseSchema({