@dxos/react-ui-table 0.8.2-main.12df754 → 0.8.2-main.36232bc

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.
@@ -42,7 +42,7 @@ import { invariant as invariant3 } from "@dxos/invariant";
42
42
  import { Filter } from "@dxos/react-client/echo";
43
43
  import { useTranslation as useTranslation3 } from "@dxos/react-ui";
44
44
  import { useAttention } from "@dxos/react-ui-attention";
45
- import { closestCell, Grid } from "@dxos/react-ui-grid";
45
+ import { closestCell, Grid, gridSeparatorInlineEnd, gridSeparatorBlockEnd } from "@dxos/react-ui-grid";
46
46
  import { mx as mx2 } from "@dxos/react-ui-theme";
47
47
  import { isNotFalsy, safeParseInt } from "@dxos/util";
48
48
 
@@ -392,7 +392,7 @@ var initializeTable = async ({ client, space, table, typename, initialRow = true
392
392
  if (!schema) {
393
393
  throw new Error(`Schema not found: ${typename}`);
394
394
  }
395
- const fields = getSchemaProperties(schema.ast).filter((prop) => prop.format !== FormatEnum.Ref).map((prop) => prop.name);
395
+ const fields = getSchemaProperties(schema.ast).map((prop) => prop.name);
396
396
  table.view = makeRef2(createView2({
397
397
  // TODO(ZaymonFC): Don't hardcode name?
398
398
  name: "View",
@@ -893,6 +893,22 @@ var TableSorting = class {
893
893
  }
894
894
  };
895
895
 
896
+ // packages/ui/react-ui-table/src/util/tag.ts
897
+ var TAG_PATTERN_REGEX = /\[([^\]]+)\]\(([^)]+)\)/g;
898
+ var extractTagIds = (value) => {
899
+ if (typeof value !== "string") {
900
+ return void 0;
901
+ }
902
+ const ids = [];
903
+ let match;
904
+ while ((match = TAG_PATTERN_REGEX.exec(value)) !== null) {
905
+ if (match[2]) {
906
+ ids.push(match[2]);
907
+ }
908
+ }
909
+ return ids.length > 0 ? ids : void 0;
910
+ };
911
+
896
912
  // packages/ui/react-ui-table/src/model/table-model.ts
897
913
  var __dxlog_file = "/home/runner/work/dxos/dxos/packages/ui/react-ui-table/src/model/table-model.ts";
898
914
  var defaultFeatures = {
@@ -997,6 +1013,20 @@ var TableModel = class extends Resource2 {
997
1013
  }
998
1014
  break;
999
1015
  }
1016
+ case FormatEnum3.SingleSelect: {
1017
+ const ids = extractTagIds(value);
1018
+ if (ids && ids.length > 0) {
1019
+ setValue(this._rows.value[rowIdx], field.path, ids[0]);
1020
+ }
1021
+ break;
1022
+ }
1023
+ case FormatEnum3.MultiSelect: {
1024
+ const ids = extractTagIds(value);
1025
+ if (ids) {
1026
+ setValue(this._rows.value[rowIdx], field.path, ids);
1027
+ }
1028
+ break;
1029
+ }
1000
1030
  default: {
1001
1031
  setValue(this._rows.value[rowIdx], field.path, parseValue({
1002
1032
  type: props.type,
@@ -1017,7 +1047,7 @@ var TableModel = class extends Resource2 {
1017
1047
  };
1018
1048
  invariant(!(this._features.dataEditable && this._features.selection.enabled && this._features.selection.mode === "single"), "Single selection is not compatible with editable tables.", {
1019
1049
  F: __dxlog_file,
1020
- L: 114,
1050
+ L: 115,
1021
1051
  S: this,
1022
1052
  A: [
1023
1053
  "!(this._features.dataEditable && this._features.selection.enabled && this._features.selection.mode === 'single')",
@@ -1077,7 +1107,7 @@ var TableModel = class extends Resource2 {
1077
1107
  get columnMeta() {
1078
1108
  invariant(this._columnMeta, void 0, {
1079
1109
  F: __dxlog_file,
1080
- L: 183,
1110
+ L: 184,
1081
1111
  S: this,
1082
1112
  A: [
1083
1113
  "this._columnMeta",
@@ -1888,8 +1918,6 @@ var determineNavigationDelta = ({ key, shift }) => {
1888
1918
 
1889
1919
  // packages/ui/react-ui-table/src/components/Table/Table.tsx
1890
1920
  var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-table/src/components/Table/Table.tsx";
1891
- var inlineEndLine = "[&>.dx-grid]:relative [&>.dx-grid]:after:absolute [&>.dx-grid]:after:inset-block-0 [&>.dx-grid]:after:-inline-end-px [&>.dx-grid]:after:is-px [&>.dx-grid]:after:bg-separator";
1892
- var blockEndLine = "[&>.dx-grid]:before:absolute [&>.dx-grid]:before:inset-inline-0 [&>.dx-grid]:before:-block-end-px [&>.dx-grid]:before:bs-px [&>.dx-grid]:before:bg-separator";
1893
1921
  var TableRoot = ({ children, role }) => {
1894
1922
  return /* @__PURE__ */ React7.createElement("div", {
1895
1923
  role: "none",
@@ -1911,14 +1939,18 @@ var TableMain = /* @__PURE__ */ forwardRef(({ model, presentation, ignoreAttenti
1911
1939
  }, [
1912
1940
  model
1913
1941
  ]);
1942
+ const getCells = useCallback4((range, plane) => presentation?.getCells(range, plane) ?? {}, [
1943
+ presentation
1944
+ ]);
1914
1945
  useEffect2(() => {
1915
1946
  if (!presentation || !dxGrid) {
1916
1947
  return;
1917
1948
  }
1918
- dxGrid.getCells = (range, plane) => presentation.getCells(range, plane);
1949
+ dxGrid.getCells = getCells;
1919
1950
  }, [
1920
1951
  presentation,
1921
- dxGrid
1952
+ dxGrid,
1953
+ getCells
1922
1954
  ]);
1923
1955
  useImperativeHandle(forwardedRef, () => {
1924
1956
  if (!presentation || !dxGrid) {
@@ -2140,7 +2172,7 @@ var TableMain = /* @__PURE__ */ forwardRef(({ model, presentation, ignoreAttenti
2140
2172
  onFocus: handleFocus,
2141
2173
  onQuery: handleQuery
2142
2174
  }), /* @__PURE__ */ React7.createElement(Grid.Content, {
2143
- className: mx2("[--dx-grid-base:var(--surface-bg)]", inlineEndLine, blockEndLine),
2175
+ className: mx2("[--dx-grid-base:var(--surface-bg)]", gridSeparatorInlineEnd, gridSeparatorBlockEnd),
2144
2176
  frozen,
2145
2177
  // getCells={getCells}
2146
2178
  columns: model.columnMeta.value,