@dxos/react-ui-form 0.8.4-main.72ec0f3 → 0.8.4-main.7ace549

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/lib/browser/index.mjs +82 -101
  2. package/dist/lib/browser/index.mjs.map +3 -3
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node-esm/index.mjs +82 -101
  5. package/dist/lib/node-esm/index.mjs.map +3 -3
  6. package/dist/lib/node-esm/meta.json +1 -1
  7. package/dist/types/src/components/ControlSection/ControlSection.stories.d.ts +5 -4
  8. package/dist/types/src/components/ControlSection/ControlSection.stories.d.ts.map +1 -1
  9. package/dist/types/src/components/FieldEditor/FieldEditor.stories.d.ts +5 -4
  10. package/dist/types/src/components/FieldEditor/FieldEditor.stories.d.ts.map +1 -1
  11. package/dist/types/src/components/Form/ArrayField.d.ts.map +1 -1
  12. package/dist/types/src/components/Form/Form.d.ts +4 -4
  13. package/dist/types/src/components/Form/Form.d.ts.map +1 -1
  14. package/dist/types/src/components/Form/Form.stories.d.ts +46 -31
  15. package/dist/types/src/components/Form/Form.stories.d.ts.map +1 -1
  16. package/dist/types/src/components/Form/FormActions.d.ts.map +1 -1
  17. package/dist/types/src/components/Form/FormContext.d.ts +3 -3
  18. package/dist/types/src/components/Form/FormContext.d.ts.map +1 -1
  19. package/dist/types/src/components/Form/Input.d.ts +2 -2
  20. package/dist/types/src/components/Form/Input.d.ts.map +1 -1
  21. package/dist/types/src/components/Form/custom/SelectOptionsInput.stories.d.ts +5 -4
  22. package/dist/types/src/components/Form/custom/SelectOptionsInput.stories.d.ts.map +1 -1
  23. package/dist/types/src/components/Form/factory.d.ts +2 -2
  24. package/dist/types/src/components/Form/factory.d.ts.map +1 -1
  25. package/dist/types/src/components/ObjectPicker/ObjectPicker.stories.d.ts +5 -4
  26. package/dist/types/src/components/ObjectPicker/ObjectPicker.stories.d.ts.map +1 -1
  27. package/dist/types/src/components/ViewEditor/ViewEditor.d.ts +2 -2
  28. package/dist/types/src/components/ViewEditor/ViewEditor.d.ts.map +1 -1
  29. package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts +6 -5
  30. package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts.map +1 -1
  31. package/dist/types/src/hooks/useForm.d.ts +4 -4
  32. package/dist/types/src/hooks/useForm.d.ts.map +1 -1
  33. package/dist/types/src/translations.d.ts +5 -4
  34. package/dist/types/src/translations.d.ts.map +1 -1
  35. package/dist/types/src/util/field.d.ts +3 -3
  36. package/dist/types/src/util/field.d.ts.map +1 -1
  37. package/dist/types/src/util/formatting.d.ts +2 -2
  38. package/dist/types/src/util/formatting.d.ts.map +1 -1
  39. package/dist/types/tsconfig.tsbuildinfo +1 -1
  40. package/package.json +31 -31
  41. package/src/components/FieldEditor/FieldEditor.stories.tsx +2 -2
  42. package/src/components/FieldEditor/FieldEditor.tsx +3 -3
  43. package/src/components/Form/ArrayField.tsx +3 -1
  44. package/src/components/Form/Form.stories.tsx +21 -21
  45. package/src/components/Form/Form.tsx +4 -4
  46. package/src/components/Form/FormActions.tsx +7 -2
  47. package/src/components/Form/FormContent.tsx +1 -1
  48. package/src/components/Form/FormContext.tsx +4 -4
  49. package/src/components/Form/Input.tsx +2 -2
  50. package/src/components/Form/factory.tsx +7 -4
  51. package/src/components/ViewEditor/ViewEditor.stories.tsx +3 -6
  52. package/src/components/ViewEditor/ViewEditor.tsx +13 -24
  53. package/src/hooks/useForm.ts +5 -5
  54. package/src/hooks/useRefQueryLookupHandler.ts +3 -3
  55. package/src/translations.ts +5 -4
  56. package/src/util/field.ts +25 -25
  57. package/src/util/formatting.ts +22 -22
  58. package/src/util/refs.ts +2 -2
@@ -10,7 +10,7 @@ var translations = [
10
10
  "hidden fields label": "Hidden Fields",
11
11
  "empty readonly ref field label": "(none)",
12
12
  // TODO(burdon): Standardize field/property.
13
- "add property button": "Add property",
13
+ "add property button label": "Add property",
14
14
  "field property label": "Property",
15
15
  "field property placeholder": "Property name",
16
16
  "field format label": "Type",
@@ -27,7 +27,8 @@ var translations = [
27
27
  "ref field placeholder_one": "Select\u2026",
28
28
  "ref field placeholder_other": "Select items\u2026",
29
29
  // TODO(burdon): Factor out?
30
- "save button": "Save",
30
+ "cancel button label": "Cancel",
31
+ "save button label": "Save",
31
32
  // FormatEnum
32
33
  "format boolean": "Boolean",
33
34
  "format currency": "Currency",
@@ -67,8 +68,8 @@ var translations = [
67
68
  "select option delete": "Delete",
68
69
  "select option add": "Add option",
69
70
  // System schema message.
70
- "system schema title": "System record type",
71
- "system schema description": "This is a system record type and cannot be modified, though the view can still be configured."
71
+ "system schema title": "System type",
72
+ "system schema description": "This is a system type and cannot be modified, though the view can still be configured."
72
73
  }
73
74
  }
74
75
  }
@@ -217,7 +218,7 @@ var ControlFrameItem = ({ title, description, children }) => {
217
218
  // src/components/FieldEditor/FieldEditor.tsx
218
219
  import { useSignals as _useSignals14 } from "@preact-signals/safe-react/tracking";
219
220
  import React14, { useCallback as useCallback12, useEffect as useEffect8, useMemo as useMemo7, useState as useState6 } from "react";
220
- import { FormatEnum as FormatEnum5, FormatEnums, formatToType } from "@dxos/echo/internal";
221
+ import { Format as Format5, FormatEnums, formatToType } from "@dxos/echo/internal";
221
222
  import { log as log3 } from "@dxos/log";
222
223
  import { useAsyncEffect, useTranslation as useTranslation9 } from "@dxos/react-ui";
223
224
  import { formatToAdditionalPropertyAttributes, getFormatSchema, getSchemaProperties as getSchemaProperties3, sortProperties } from "@dxos/schema";
@@ -955,7 +956,6 @@ var flatMap = (errors) => {
955
956
  // src/hooks/useRefQueryLookupHandler.ts
956
957
  import { useCallback as useCallback5 } from "react";
957
958
  import { Obj } from "@dxos/echo";
958
- import { getObjectDXN } from "@dxos/echo/internal";
959
959
  import { Filter } from "@dxos/react-client/echo";
960
960
  import { isNonNullable } from "@dxos/util";
961
961
  var useRefQueryLookupHandler = ({ space }) => {
@@ -966,7 +966,7 @@ var useRefQueryLookupHandler = ({ space }) => {
966
966
  const query = space.db.query(Filter.typename(typeInfo.typename));
967
967
  const { objects } = await query.run();
968
968
  return objects.map((object) => {
969
- const dxn = getObjectDXN(object);
969
+ const dxn = Obj.getDXN(object);
970
970
  if (!dxn) {
971
971
  return void 0;
972
972
  }
@@ -1118,14 +1118,14 @@ var FormActions = ({ readonly, onCancel, outerSpacing = true }) => {
1118
1118
  }, onCancel && !readonly && /* @__PURE__ */ React8.createElement(IconButton2, {
1119
1119
  "data-testid": "cancel-button",
1120
1120
  icon: "ph--x--regular",
1121
- label: t("cancel button"),
1121
+ label: t("cancel button label"),
1122
1122
  onClick: onCancel
1123
1123
  }), handleSave && /* @__PURE__ */ React8.createElement(IconButton2, {
1124
1124
  type: "submit",
1125
1125
  "data-testid": "save-button",
1126
1126
  disabled: !canSave,
1127
1127
  icon: "ph--check--regular",
1128
- label: t("save button"),
1128
+ label: t("save button label"),
1129
1129
  onClick: handleSave
1130
1130
  }));
1131
1131
  } finally {
@@ -1146,7 +1146,7 @@ import { getSchemaProperties as getSchemaProperties2 } from "@dxos/schema";
1146
1146
  import { isTruthy } from "@dxos/util";
1147
1147
 
1148
1148
  // src/util/field.ts
1149
- import { FormatEnum, GeoLocation as GeoLocation2, TypeEnum } from "@dxos/echo/internal";
1149
+ import { Format, GeoLocation as GeoLocation2, TypeEnum } from "@dxos/echo/internal";
1150
1150
  var parseValue = ({ type, format, value: value2 }) => {
1151
1151
  if (value2 === void 0 || value2 === null || value2 === "") {
1152
1152
  return void 0;
@@ -1181,26 +1181,26 @@ var parseValue = ({ type, format, value: value2 }) => {
1181
1181
  return parseScalar(type);
1182
1182
  }
1183
1183
  switch (format) {
1184
- case FormatEnum.Boolean:
1184
+ case Format.TypeFormat.Boolean:
1185
1185
  return parseScalar(TypeEnum.Boolean);
1186
- case FormatEnum.Number:
1187
- case FormatEnum.Percent:
1188
- case FormatEnum.Currency:
1186
+ case Format.TypeFormat.Number:
1187
+ case Format.TypeFormat.Percent:
1188
+ case Format.TypeFormat.Currency:
1189
1189
  return parseScalar(TypeEnum.Number);
1190
- case FormatEnum.String:
1191
- case FormatEnum.Markdown: {
1190
+ case Format.TypeFormat.String:
1191
+ case Format.TypeFormat.Markdown: {
1192
1192
  return parseScalar(TypeEnum.String);
1193
1193
  }
1194
- case FormatEnum.Ref:
1195
- throw new Error(`unexpected format: ${FormatEnum.Ref}`);
1196
- case FormatEnum.DateTime:
1197
- case FormatEnum.Date:
1198
- case FormatEnum.Time:
1199
- case FormatEnum.Timestamp: {
1194
+ case Format.TypeFormat.Ref:
1195
+ throw new Error(`unexpected format: ${Format.TypeFormat.Ref}`);
1196
+ case Format.TypeFormat.DateTime:
1197
+ case Format.TypeFormat.Date:
1198
+ case Format.TypeFormat.Time:
1199
+ case Format.TypeFormat.Timestamp: {
1200
1200
  const date = new Date(value2);
1201
1201
  return isNaN(date.getTime()) ? null : date;
1202
1202
  }
1203
- case FormatEnum.GeoPoint: {
1203
+ case Format.TypeFormat.GeoPoint: {
1204
1204
  if (typeof value2 === "string") {
1205
1205
  const cleaned = value2.replace(/[^0-9.,-]+/g, "");
1206
1206
  const parts = cleaned.split(",");
@@ -1227,23 +1227,23 @@ var parseValue = ({ type, format, value: value2 }) => {
1227
1227
  };
1228
1228
  var cellClassesForFieldType = ({ type, format }) => {
1229
1229
  switch (format || type) {
1230
- case FormatEnum.Markdown:
1230
+ case Format.TypeFormat.Markdown:
1231
1231
  return void 0;
1232
- case FormatEnum.Time:
1233
- case FormatEnum.Timestamp:
1234
- case FormatEnum.DateTime:
1235
- case FormatEnum.Date:
1236
- case FormatEnum.Duration:
1232
+ case Format.TypeFormat.Time:
1233
+ case Format.TypeFormat.Timestamp:
1234
+ case Format.TypeFormat.DateTime:
1235
+ case Format.TypeFormat.Date:
1236
+ case Format.TypeFormat.Duration:
1237
1237
  return [
1238
1238
  "font-mono",
1239
1239
  "text-right"
1240
1240
  ];
1241
- case FormatEnum.Currency:
1241
+ case Format.TypeFormat.Currency:
1242
1242
  return [
1243
1243
  "text-right"
1244
1244
  ];
1245
- case FormatEnum.JSON:
1246
- case FormatEnum.DID:
1245
+ case Format.TypeFormat.JSON:
1246
+ case Format.TypeFormat.DID:
1247
1247
  return [
1248
1248
  "font-mono"
1249
1249
  ];
@@ -1268,7 +1268,7 @@ var pathNotUniqueError = (path) => ({
1268
1268
 
1269
1269
  // src/util/formatting.ts
1270
1270
  import { format as formatDate } from "date-fns/format";
1271
- import { FormatEnum as FormatEnum2, GeoLocation as GeoLocation3, TypeEnum as TypeEnum2 } from "@dxos/echo/internal";
1271
+ import { Format as Format2, GeoLocation as GeoLocation3, TypeEnum as TypeEnum2 } from "@dxos/echo/internal";
1272
1272
  var formatForDisplay = ({ type, format, value: value2, locale = void 0 }) => {
1273
1273
  const formatScalar = (type2) => {
1274
1274
  switch (type2) {
@@ -1288,20 +1288,20 @@ var formatForDisplay = ({ type, format, value: value2, locale = void 0 }) => {
1288
1288
  return formatScalar(type);
1289
1289
  }
1290
1290
  switch (format) {
1291
- case FormatEnum2.Boolean: {
1291
+ case Format2.TypeFormat.Boolean: {
1292
1292
  return formatScalar(TypeEnum2.Boolean);
1293
1293
  }
1294
- case FormatEnum2.Number: {
1294
+ case Format2.TypeFormat.Number: {
1295
1295
  return formatScalar(TypeEnum2.Number);
1296
1296
  }
1297
- case FormatEnum2.String:
1298
- case FormatEnum2.Ref: {
1297
+ case Format2.TypeFormat.String:
1298
+ case Format2.TypeFormat.Ref: {
1299
1299
  return formatScalar(TypeEnum2.String);
1300
1300
  }
1301
- case FormatEnum2.Percent: {
1301
+ case Format2.TypeFormat.Percent: {
1302
1302
  return `${value2 * 100}%`;
1303
1303
  }
1304
- case FormatEnum2.Currency: {
1304
+ case Format2.TypeFormat.Currency: {
1305
1305
  return value2.toLocaleString(locale, {
1306
1306
  style: "currency",
1307
1307
  currency: "USD",
@@ -1309,28 +1309,28 @@ var formatForDisplay = ({ type, format, value: value2, locale = void 0 }) => {
1309
1309
  maximumFractionDigits: 2
1310
1310
  });
1311
1311
  }
1312
- case FormatEnum2.Date: {
1312
+ case Format2.TypeFormat.Date: {
1313
1313
  try {
1314
1314
  return formatDate(new Date(value2), "yyyy-MM-dd");
1315
1315
  } catch (error) {
1316
1316
  return "Invalid Date";
1317
1317
  }
1318
1318
  }
1319
- case FormatEnum2.Time: {
1319
+ case Format2.TypeFormat.Time: {
1320
1320
  try {
1321
1321
  return formatDate(new Date(value2), "HH:mm:ss");
1322
1322
  } catch (error) {
1323
1323
  return "Invalid Time";
1324
1324
  }
1325
1325
  }
1326
- case FormatEnum2.DateTime: {
1326
+ case Format2.TypeFormat.DateTime: {
1327
1327
  try {
1328
1328
  return formatDate(new Date(value2), "yyyy-MM-dd HH:mm:ss");
1329
1329
  } catch (error) {
1330
1330
  return "Invalid DateTime";
1331
1331
  }
1332
1332
  }
1333
- case FormatEnum2.GeoPoint: {
1333
+ case Format2.TypeFormat.GeoPoint: {
1334
1334
  if (value2 === null || value2 === void 0) {
1335
1335
  return "";
1336
1336
  }
@@ -1364,31 +1364,31 @@ var formatForEditing = ({ type, format, value: value2, locale = void 0 }) => {
1364
1364
  return formatScalar(type);
1365
1365
  }
1366
1366
  switch (format) {
1367
- case FormatEnum2.Boolean:
1368
- case FormatEnum2.Number:
1369
- case FormatEnum2.String:
1370
- case FormatEnum2.Ref: {
1367
+ case Format2.TypeFormat.Boolean:
1368
+ case Format2.TypeFormat.Number:
1369
+ case Format2.TypeFormat.String:
1370
+ case Format2.TypeFormat.Ref: {
1371
1371
  return formatScalar(type);
1372
1372
  }
1373
- case FormatEnum2.Percent: {
1373
+ case Format2.TypeFormat.Percent: {
1374
1374
  return String(value2 * 100);
1375
1375
  }
1376
- case FormatEnum2.Currency: {
1376
+ case Format2.TypeFormat.Currency: {
1377
1377
  return String(value2);
1378
1378
  }
1379
- case FormatEnum2.DateTime: {
1379
+ case Format2.TypeFormat.DateTime: {
1380
1380
  const date = new Date(value2);
1381
1381
  return date.toISOString();
1382
1382
  }
1383
- case FormatEnum2.Date: {
1383
+ case Format2.TypeFormat.Date: {
1384
1384
  const date = new Date(value2);
1385
1385
  return date.toISOString().split("T")[0];
1386
1386
  }
1387
- case FormatEnum2.Time: {
1387
+ case Format2.TypeFormat.Time: {
1388
1388
  const date = new Date(value2);
1389
1389
  return date.toISOString().split("T")[1].split(".")[0];
1390
1390
  }
1391
- case FormatEnum2.GeoPoint: {
1391
+ case Format2.TypeFormat.GeoPoint: {
1392
1392
  if (value2 === null || value2 === void 0) {
1393
1393
  return "";
1394
1394
  }
@@ -1405,7 +1405,7 @@ var formatForEditing = ({ type, format, value: value2, locale = void 0 }) => {
1405
1405
  };
1406
1406
 
1407
1407
  // src/util/refs.ts
1408
- import { FormatEnum as FormatEnum3, ReferenceAnnotationId } from "@dxos/echo/internal";
1408
+ import { Format as Format3, ReferenceAnnotationId } from "@dxos/echo/internal";
1409
1409
  import { findAnnotation } from "@dxos/effect";
1410
1410
 
1411
1411
  // src/util/schema.ts
@@ -1431,7 +1431,7 @@ var getRefProps = (property) => {
1431
1431
  }
1432
1432
  }
1433
1433
  }
1434
- if (format === FormatEnum3.Ref) {
1434
+ if (format === Format3.TypeFormat.Ref) {
1435
1435
  return {
1436
1436
  ast,
1437
1437
  isArray: false
@@ -1474,7 +1474,9 @@ var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponen
1474
1474
  if (!typeLiteral) {
1475
1475
  return {};
1476
1476
  }
1477
- return Object.fromEntries(getSchemaProperties(typeLiteral, {}).map((prop) => [
1477
+ return Object.fromEntries(getSchemaProperties(typeLiteral, {}, {
1478
+ form: true
1479
+ }).map((prop) => [
1478
1480
  prop.name,
1479
1481
  prop.defaultValue
1480
1482
  ]));
@@ -1547,12 +1549,12 @@ var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponen
1547
1549
  };
1548
1550
 
1549
1551
  // src/components/Form/factory.tsx
1550
- import { FormatEnum as FormatEnum4 } from "@dxos/echo/internal";
1552
+ import { Format as Format4 } from "@dxos/echo/internal";
1551
1553
  var getInputComponent = (type, format) => {
1552
1554
  switch (format) {
1553
- case FormatEnum4.GeoPoint:
1555
+ case Format4.TypeFormat.GeoPoint:
1554
1556
  return GeoPointInput;
1555
- case FormatEnum4.Markdown:
1557
+ case Format4.TypeFormat.Markdown:
1556
1558
  return MarkdownInput;
1557
1559
  }
1558
1560
  switch (type) {
@@ -2008,7 +2010,9 @@ var FormFields = /* @__PURE__ */ forwardRef2(({ classNames, schema, path, filter
2008
2010
  try {
2009
2011
  const values = useFormValues(path);
2010
2012
  const properties = useMemo6(() => {
2011
- const props2 = getSchemaProperties2(schema.ast, values);
2013
+ const props2 = getSchemaProperties2(schema.ast, values, {
2014
+ form: true
2015
+ });
2012
2016
  if (projection) {
2013
2017
  const fieldProjections = projection.getFieldProjections();
2014
2018
  const hiddenProperties = new Set(projection.getHiddenProperties());
@@ -2260,7 +2264,7 @@ var FieldEditor = ({ readonly, projection, field, registry, onSave, onCancel, ou
2260
2264
  const custom = useMemo7(() => ({
2261
2265
  ["format"]: (props2) => /* @__PURE__ */ React14.createElement(SelectInput, {
2262
2266
  ...props2,
2263
- options: FormatEnums.filter((value2) => value2 !== FormatEnum5.None).map((value2) => ({
2267
+ options: FormatEnums.filter((value2) => value2 !== Format5.TypeFormat.None).map((value2) => ({
2264
2268
  value: value2,
2265
2269
  label: t(`format ${value2}`)
2266
2270
  }))
@@ -2273,7 +2277,9 @@ var FieldEditor = ({ readonly, projection, field, registry, onSave, onCancel, ou
2273
2277
  }),
2274
2278
  ["referencePath"]: (props2) => /* @__PURE__ */ React14.createElement(SelectInput, {
2275
2279
  ...props2,
2276
- options: referenceSchema ? getSchemaProperties3(referenceSchema.ast).sort(sortProperties).map((p) => ({
2280
+ options: referenceSchema ? getSchemaProperties3(referenceSchema.ast, {}, {
2281
+ form: true
2282
+ }).sort(sortProperties).map((p) => ({
2277
2283
  value: p.name
2278
2284
  })) : []
2279
2285
  }),
@@ -2326,7 +2332,7 @@ import * as Option from "effect/Option";
2326
2332
  import * as Schema2 from "effect/Schema";
2327
2333
  import React15, { forwardRef as forwardRef3, useCallback as useCallback13, useImperativeHandle, useMemo as useMemo8, useState as useState7 } from "react";
2328
2334
  import { QueryAST } from "@dxos/echo";
2329
- import { EchoSchema, Format, isMutable, toJsonSchema } from "@dxos/echo/internal";
2335
+ import { EchoSchema, Format as Format6, isMutable, toJsonSchema } from "@dxos/echo/internal";
2330
2336
  import { Filter as Filter2, Query } from "@dxos/echo-db";
2331
2337
  import { invariant as invariant3 } from "@dxos/invariant";
2332
2338
  import { Callout, IconButton as IconButton4, Input as Input8, useTranslation as useTranslation10 } from "@dxos/react-ui";
@@ -2361,23 +2367,15 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2361
2367
  }), Match.orElse(() => void 0));
2362
2368
  const viewSchema = useMemo8(() => {
2363
2369
  const base = Schema2.Struct({
2364
- query: mode === "schema" ? Format.URL.annotations({
2370
+ query: mode === "schema" ? Format6.URL.annotations({
2365
2371
  title: "Record type"
2366
2372
  }) : QueryAST.Query.annotations({
2367
2373
  title: "Query"
2368
2374
  })
2369
2375
  });
2370
- if (mode === "query" || mode === "named-query") {
2371
- const name = Schema2.Struct({
2372
- name: Schema2.optional(Schema2.String.annotations({
2373
- title: "Name"
2374
- }))
2375
- });
2376
+ if (mode === "tag") {
2376
2377
  return Schema2.Struct({
2377
- ...mode === "named-query" ? {
2378
- ...name.fields,
2379
- ...base.fields
2380
- } : base.fields,
2378
+ ...base.fields,
2381
2379
  target: Schema2.optional(Schema2.String.annotations({
2382
2380
  title: "Target Queue"
2383
2381
  }))
@@ -2388,11 +2386,9 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2388
2386
  mode
2389
2387
  ]);
2390
2388
  const viewValues = useMemo8(() => ({
2391
- name: view.name,
2392
2389
  query: mode === "schema" ? getTypenameFromQuery(view.query.ast) : view.query.ast,
2393
2390
  target: queueTarget
2394
2391
  }), [
2395
- view.name,
2396
2392
  mode,
2397
2393
  view.query.ast,
2398
2394
  queueTarget
@@ -2405,7 +2401,7 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2405
2401
  const handleAdd = useCallback13(() => {
2406
2402
  invariant3(!readonly, void 0, {
2407
2403
  F: __dxlog_file5,
2408
- L: 134,
2404
+ L: 129,
2409
2405
  S: void 0,
2410
2406
  A: [
2411
2407
  "!readonly",
@@ -2420,26 +2416,12 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2420
2416
  readonly
2421
2417
  ]);
2422
2418
  const handleUpdate = useCallback13((values) => {
2423
- invariant3(!readonly, void 0, {
2424
- F: __dxlog_file5,
2425
- L: 141,
2426
- S: void 0,
2427
- A: [
2428
- "!readonly",
2429
- ""
2430
- ]
2431
- });
2432
2419
  requestAnimationFrame(() => {
2433
- if ("name" in values && view.name !== values.name) {
2434
- view.name = values.name;
2435
- return;
2436
- }
2437
2420
  const query = mode === "schema" ? Query.select(Filter2.typename(values.query)).ast : values.query;
2438
2421
  onQueryChanged?.(query, values.target);
2439
2422
  });
2440
2423
  }, [
2441
2424
  onQueryChanged,
2442
- readonly,
2443
2425
  view,
2444
2426
  queueTarget,
2445
2427
  mode
@@ -2447,7 +2429,7 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2447
2429
  const handleDelete = useCallback13((fieldId) => {
2448
2430
  invariant3(!readonly, void 0, {
2449
2431
  F: __dxlog_file5,
2450
- L: 157,
2432
+ L: 146,
2451
2433
  S: void 0,
2452
2434
  A: [
2453
2435
  "!readonly",
@@ -2466,7 +2448,7 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2466
2448
  const handleMove = useCallback13((fromIndex, toIndex) => {
2467
2449
  invariant3(!readonly, void 0, {
2468
2450
  F: __dxlog_file5,
2469
- L: 169,
2451
+ L: 158,
2470
2452
  S: void 0,
2471
2453
  A: [
2472
2454
  "!readonly",
@@ -2496,7 +2478,7 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2496
2478
  }, [
2497
2479
  projectionModel
2498
2480
  ]);
2499
- const custom = useMemo8(() => mode === "query" ? customFields({
2481
+ const custom = useMemo8(() => mode === "tag" ? customFields({
2500
2482
  types,
2501
2483
  tags
2502
2484
  }) : void 0, [
@@ -2507,7 +2489,7 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2507
2489
  return /* @__PURE__ */ React15.createElement("div", {
2508
2490
  role: "none",
2509
2491
  className: mx7(classNames)
2510
- }, schemaReadonly && mode === "schema" && /* @__PURE__ */ React15.createElement(Callout.Root, {
2492
+ }, schemaReadonly && !readonly && /* @__PURE__ */ React15.createElement(Callout.Root, {
2511
2493
  valence: "info",
2512
2494
  classNames: [
2513
2495
  "mlb-cardSpacingBlock",
@@ -2517,7 +2499,6 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2517
2499
  autoSave: true,
2518
2500
  schema: viewSchema,
2519
2501
  values: viewValues,
2520
- readonly: readonly ? "disabled-input" : false,
2521
2502
  onSave: handleUpdate,
2522
2503
  outerSpacing,
2523
2504
  Custom: custom
@@ -2548,7 +2529,7 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2548
2529
  role: "none",
2549
2530
  className: mx7(subtleHover2, listItemGrid, "rounded-sm cursor-pointer min-bs-10")
2550
2531
  }, /* @__PURE__ */ React15.createElement(List2.ItemDragHandle, {
2551
- disabled: readonly
2532
+ disabled: readonly || schemaReadonly
2552
2533
  }), /* @__PURE__ */ React15.createElement(List2.ItemTitle, {
2553
2534
  classNames: hidden && "text-subdued",
2554
2535
  onClick: () => handleToggleField(field)
@@ -2559,7 +2540,7 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2559
2540
  autoHide: false,
2560
2541
  disabled: readonly || !hidden && projectionModel.fields.length <= 1,
2561
2542
  onClick: () => hidden ? handleShow(field.path) : handleHide(field.id)
2562
- }), mode === "schema" && /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(List2.ItemDeleteButton, {
2543
+ }), !readonly && /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(List2.ItemDeleteButton, {
2563
2544
  label: t("delete field label"),
2564
2545
  autoHide: false,
2565
2546
  disabled: readonly || schemaReadonly || view.projection.fields.length <= 1,
@@ -2573,7 +2554,7 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2573
2554
  }),
2574
2555
  icon: expandedField === field.id ? "ph--caret-down--regular" : "ph--caret-right--regular",
2575
2556
  onClick: () => handleToggleField(field)
2576
- }))), expandedField === field.id && mode === "schema" && /* @__PURE__ */ React15.createElement("div", {
2557
+ }))), expandedField === field.id && !readonly && /* @__PURE__ */ React15.createElement("div", {
2577
2558
  role: "none",
2578
2559
  className: "col-span-5 mbs-1 mbe-1 border border-separator rounded-md"
2579
2560
  }, /* @__PURE__ */ React15.createElement(FieldEditor, {
@@ -2583,12 +2564,12 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2583
2564
  registry,
2584
2565
  onSave: handleClose
2585
2566
  })));
2586
- }))))), !readonly && !expandedField && mode === "schema" && /* @__PURE__ */ React15.createElement("div", {
2567
+ }))))), !readonly && !expandedField && /* @__PURE__ */ React15.createElement("div", {
2587
2568
  role: "none",
2588
2569
  className: outerSpacing ? cardSpacing3 : "mlb-cardSpacingBlock"
2589
2570
  }, /* @__PURE__ */ React15.createElement(IconButton4, {
2590
2571
  icon: "ph--plus--regular",
2591
- label: t("add property button"),
2572
+ label: t("add property button label"),
2592
2573
  onClick: readonly ? void 0 : handleAdd,
2593
2574
  // TODO(burdon): Show field limit in ux (not tooltip).
2594
2575
  disabled: view.projection.fields.length >= VIEW_FIELD_LIMIT,