@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
@@ -8,7 +8,7 @@ var translations = [
8
8
  "hidden fields label": "Hidden Fields",
9
9
  "empty readonly ref field label": "(none)",
10
10
  // TODO(burdon): Standardize field/property.
11
- "add property button": "Add property",
11
+ "add property button label": "Add property",
12
12
  "field property label": "Property",
13
13
  "field property placeholder": "Property name",
14
14
  "field format label": "Type",
@@ -25,7 +25,8 @@ var translations = [
25
25
  "ref field placeholder_one": "Select\u2026",
26
26
  "ref field placeholder_other": "Select items\u2026",
27
27
  // TODO(burdon): Factor out?
28
- "save button": "Save",
28
+ "cancel button label": "Cancel",
29
+ "save button label": "Save",
29
30
  // FormatEnum
30
31
  "format boolean": "Boolean",
31
32
  "format currency": "Currency",
@@ -65,8 +66,8 @@ var translations = [
65
66
  "select option delete": "Delete",
66
67
  "select option add": "Add option",
67
68
  // System schema message.
68
- "system schema title": "System record type",
69
- "system schema description": "This is a system record type and cannot be modified, though the view can still be configured."
69
+ "system schema title": "System type",
70
+ "system schema description": "This is a system type and cannot be modified, though the view can still be configured."
70
71
  }
71
72
  }
72
73
  }
@@ -215,7 +216,7 @@ var ControlFrameItem = ({ title, description, children }) => {
215
216
  // src/components/FieldEditor/FieldEditor.tsx
216
217
  import { useSignals as _useSignals14 } from "@preact-signals/safe-react/tracking";
217
218
  import React14, { useCallback as useCallback12, useEffect as useEffect8, useMemo as useMemo7, useState as useState6 } from "react";
218
- import { FormatEnum as FormatEnum5, FormatEnums, formatToType } from "@dxos/echo/internal";
219
+ import { Format as Format5, FormatEnums, formatToType } from "@dxos/echo/internal";
219
220
  import { log as log3 } from "@dxos/log";
220
221
  import { useAsyncEffect, useTranslation as useTranslation9 } from "@dxos/react-ui";
221
222
  import { formatToAdditionalPropertyAttributes, getFormatSchema, getSchemaProperties as getSchemaProperties3, sortProperties } from "@dxos/schema";
@@ -953,7 +954,6 @@ var flatMap = (errors) => {
953
954
  // src/hooks/useRefQueryLookupHandler.ts
954
955
  import { useCallback as useCallback5 } from "react";
955
956
  import { Obj } from "@dxos/echo";
956
- import { getObjectDXN } from "@dxos/echo/internal";
957
957
  import { Filter } from "@dxos/react-client/echo";
958
958
  import { isNonNullable } from "@dxos/util";
959
959
  var useRefQueryLookupHandler = ({ space }) => {
@@ -964,7 +964,7 @@ var useRefQueryLookupHandler = ({ space }) => {
964
964
  const query = space.db.query(Filter.typename(typeInfo.typename));
965
965
  const { objects } = await query.run();
966
966
  return objects.map((object) => {
967
- const dxn = getObjectDXN(object);
967
+ const dxn = Obj.getDXN(object);
968
968
  if (!dxn) {
969
969
  return void 0;
970
970
  }
@@ -1116,14 +1116,14 @@ var FormActions = ({ readonly, onCancel, outerSpacing = true }) => {
1116
1116
  }, onCancel && !readonly && /* @__PURE__ */ React8.createElement(IconButton2, {
1117
1117
  "data-testid": "cancel-button",
1118
1118
  icon: "ph--x--regular",
1119
- label: t("cancel button"),
1119
+ label: t("cancel button label"),
1120
1120
  onClick: onCancel
1121
1121
  }), handleSave && /* @__PURE__ */ React8.createElement(IconButton2, {
1122
1122
  type: "submit",
1123
1123
  "data-testid": "save-button",
1124
1124
  disabled: !canSave,
1125
1125
  icon: "ph--check--regular",
1126
- label: t("save button"),
1126
+ label: t("save button label"),
1127
1127
  onClick: handleSave
1128
1128
  }));
1129
1129
  } finally {
@@ -1144,7 +1144,7 @@ import { getSchemaProperties as getSchemaProperties2 } from "@dxos/schema";
1144
1144
  import { isTruthy } from "@dxos/util";
1145
1145
 
1146
1146
  // src/util/field.ts
1147
- import { FormatEnum, GeoLocation as GeoLocation2, TypeEnum } from "@dxos/echo/internal";
1147
+ import { Format, GeoLocation as GeoLocation2, TypeEnum } from "@dxos/echo/internal";
1148
1148
  var parseValue = ({ type, format, value: value2 }) => {
1149
1149
  if (value2 === void 0 || value2 === null || value2 === "") {
1150
1150
  return void 0;
@@ -1179,26 +1179,26 @@ var parseValue = ({ type, format, value: value2 }) => {
1179
1179
  return parseScalar(type);
1180
1180
  }
1181
1181
  switch (format) {
1182
- case FormatEnum.Boolean:
1182
+ case Format.TypeFormat.Boolean:
1183
1183
  return parseScalar(TypeEnum.Boolean);
1184
- case FormatEnum.Number:
1185
- case FormatEnum.Percent:
1186
- case FormatEnum.Currency:
1184
+ case Format.TypeFormat.Number:
1185
+ case Format.TypeFormat.Percent:
1186
+ case Format.TypeFormat.Currency:
1187
1187
  return parseScalar(TypeEnum.Number);
1188
- case FormatEnum.String:
1189
- case FormatEnum.Markdown: {
1188
+ case Format.TypeFormat.String:
1189
+ case Format.TypeFormat.Markdown: {
1190
1190
  return parseScalar(TypeEnum.String);
1191
1191
  }
1192
- case FormatEnum.Ref:
1193
- throw new Error(`unexpected format: ${FormatEnum.Ref}`);
1194
- case FormatEnum.DateTime:
1195
- case FormatEnum.Date:
1196
- case FormatEnum.Time:
1197
- case FormatEnum.Timestamp: {
1192
+ case Format.TypeFormat.Ref:
1193
+ throw new Error(`unexpected format: ${Format.TypeFormat.Ref}`);
1194
+ case Format.TypeFormat.DateTime:
1195
+ case Format.TypeFormat.Date:
1196
+ case Format.TypeFormat.Time:
1197
+ case Format.TypeFormat.Timestamp: {
1198
1198
  const date = new Date(value2);
1199
1199
  return isNaN(date.getTime()) ? null : date;
1200
1200
  }
1201
- case FormatEnum.GeoPoint: {
1201
+ case Format.TypeFormat.GeoPoint: {
1202
1202
  if (typeof value2 === "string") {
1203
1203
  const cleaned = value2.replace(/[^0-9.,-]+/g, "");
1204
1204
  const parts = cleaned.split(",");
@@ -1225,23 +1225,23 @@ var parseValue = ({ type, format, value: value2 }) => {
1225
1225
  };
1226
1226
  var cellClassesForFieldType = ({ type, format }) => {
1227
1227
  switch (format || type) {
1228
- case FormatEnum.Markdown:
1228
+ case Format.TypeFormat.Markdown:
1229
1229
  return void 0;
1230
- case FormatEnum.Time:
1231
- case FormatEnum.Timestamp:
1232
- case FormatEnum.DateTime:
1233
- case FormatEnum.Date:
1234
- case FormatEnum.Duration:
1230
+ case Format.TypeFormat.Time:
1231
+ case Format.TypeFormat.Timestamp:
1232
+ case Format.TypeFormat.DateTime:
1233
+ case Format.TypeFormat.Date:
1234
+ case Format.TypeFormat.Duration:
1235
1235
  return [
1236
1236
  "font-mono",
1237
1237
  "text-right"
1238
1238
  ];
1239
- case FormatEnum.Currency:
1239
+ case Format.TypeFormat.Currency:
1240
1240
  return [
1241
1241
  "text-right"
1242
1242
  ];
1243
- case FormatEnum.JSON:
1244
- case FormatEnum.DID:
1243
+ case Format.TypeFormat.JSON:
1244
+ case Format.TypeFormat.DID:
1245
1245
  return [
1246
1246
  "font-mono"
1247
1247
  ];
@@ -1266,7 +1266,7 @@ var pathNotUniqueError = (path) => ({
1266
1266
 
1267
1267
  // src/util/formatting.ts
1268
1268
  import { format as formatDate } from "date-fns/format";
1269
- import { FormatEnum as FormatEnum2, GeoLocation as GeoLocation3, TypeEnum as TypeEnum2 } from "@dxos/echo/internal";
1269
+ import { Format as Format2, GeoLocation as GeoLocation3, TypeEnum as TypeEnum2 } from "@dxos/echo/internal";
1270
1270
  var formatForDisplay = ({ type, format, value: value2, locale = void 0 }) => {
1271
1271
  const formatScalar = (type2) => {
1272
1272
  switch (type2) {
@@ -1286,20 +1286,20 @@ var formatForDisplay = ({ type, format, value: value2, locale = void 0 }) => {
1286
1286
  return formatScalar(type);
1287
1287
  }
1288
1288
  switch (format) {
1289
- case FormatEnum2.Boolean: {
1289
+ case Format2.TypeFormat.Boolean: {
1290
1290
  return formatScalar(TypeEnum2.Boolean);
1291
1291
  }
1292
- case FormatEnum2.Number: {
1292
+ case Format2.TypeFormat.Number: {
1293
1293
  return formatScalar(TypeEnum2.Number);
1294
1294
  }
1295
- case FormatEnum2.String:
1296
- case FormatEnum2.Ref: {
1295
+ case Format2.TypeFormat.String:
1296
+ case Format2.TypeFormat.Ref: {
1297
1297
  return formatScalar(TypeEnum2.String);
1298
1298
  }
1299
- case FormatEnum2.Percent: {
1299
+ case Format2.TypeFormat.Percent: {
1300
1300
  return `${value2 * 100}%`;
1301
1301
  }
1302
- case FormatEnum2.Currency: {
1302
+ case Format2.TypeFormat.Currency: {
1303
1303
  return value2.toLocaleString(locale, {
1304
1304
  style: "currency",
1305
1305
  currency: "USD",
@@ -1307,28 +1307,28 @@ var formatForDisplay = ({ type, format, value: value2, locale = void 0 }) => {
1307
1307
  maximumFractionDigits: 2
1308
1308
  });
1309
1309
  }
1310
- case FormatEnum2.Date: {
1310
+ case Format2.TypeFormat.Date: {
1311
1311
  try {
1312
1312
  return formatDate(new Date(value2), "yyyy-MM-dd");
1313
1313
  } catch (error) {
1314
1314
  return "Invalid Date";
1315
1315
  }
1316
1316
  }
1317
- case FormatEnum2.Time: {
1317
+ case Format2.TypeFormat.Time: {
1318
1318
  try {
1319
1319
  return formatDate(new Date(value2), "HH:mm:ss");
1320
1320
  } catch (error) {
1321
1321
  return "Invalid Time";
1322
1322
  }
1323
1323
  }
1324
- case FormatEnum2.DateTime: {
1324
+ case Format2.TypeFormat.DateTime: {
1325
1325
  try {
1326
1326
  return formatDate(new Date(value2), "yyyy-MM-dd HH:mm:ss");
1327
1327
  } catch (error) {
1328
1328
  return "Invalid DateTime";
1329
1329
  }
1330
1330
  }
1331
- case FormatEnum2.GeoPoint: {
1331
+ case Format2.TypeFormat.GeoPoint: {
1332
1332
  if (value2 === null || value2 === void 0) {
1333
1333
  return "";
1334
1334
  }
@@ -1362,31 +1362,31 @@ var formatForEditing = ({ type, format, value: value2, locale = void 0 }) => {
1362
1362
  return formatScalar(type);
1363
1363
  }
1364
1364
  switch (format) {
1365
- case FormatEnum2.Boolean:
1366
- case FormatEnum2.Number:
1367
- case FormatEnum2.String:
1368
- case FormatEnum2.Ref: {
1365
+ case Format2.TypeFormat.Boolean:
1366
+ case Format2.TypeFormat.Number:
1367
+ case Format2.TypeFormat.String:
1368
+ case Format2.TypeFormat.Ref: {
1369
1369
  return formatScalar(type);
1370
1370
  }
1371
- case FormatEnum2.Percent: {
1371
+ case Format2.TypeFormat.Percent: {
1372
1372
  return String(value2 * 100);
1373
1373
  }
1374
- case FormatEnum2.Currency: {
1374
+ case Format2.TypeFormat.Currency: {
1375
1375
  return String(value2);
1376
1376
  }
1377
- case FormatEnum2.DateTime: {
1377
+ case Format2.TypeFormat.DateTime: {
1378
1378
  const date = new Date(value2);
1379
1379
  return date.toISOString();
1380
1380
  }
1381
- case FormatEnum2.Date: {
1381
+ case Format2.TypeFormat.Date: {
1382
1382
  const date = new Date(value2);
1383
1383
  return date.toISOString().split("T")[0];
1384
1384
  }
1385
- case FormatEnum2.Time: {
1385
+ case Format2.TypeFormat.Time: {
1386
1386
  const date = new Date(value2);
1387
1387
  return date.toISOString().split("T")[1].split(".")[0];
1388
1388
  }
1389
- case FormatEnum2.GeoPoint: {
1389
+ case Format2.TypeFormat.GeoPoint: {
1390
1390
  if (value2 === null || value2 === void 0) {
1391
1391
  return "";
1392
1392
  }
@@ -1403,7 +1403,7 @@ var formatForEditing = ({ type, format, value: value2, locale = void 0 }) => {
1403
1403
  };
1404
1404
 
1405
1405
  // src/util/refs.ts
1406
- import { FormatEnum as FormatEnum3, ReferenceAnnotationId } from "@dxos/echo/internal";
1406
+ import { Format as Format3, ReferenceAnnotationId } from "@dxos/echo/internal";
1407
1407
  import { findAnnotation } from "@dxos/effect";
1408
1408
 
1409
1409
  // src/util/schema.ts
@@ -1429,7 +1429,7 @@ var getRefProps = (property) => {
1429
1429
  }
1430
1430
  }
1431
1431
  }
1432
- if (format === FormatEnum3.Ref) {
1432
+ if (format === Format3.TypeFormat.Ref) {
1433
1433
  return {
1434
1434
  ast,
1435
1435
  isArray: false
@@ -1472,7 +1472,9 @@ var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponen
1472
1472
  if (!typeLiteral) {
1473
1473
  return {};
1474
1474
  }
1475
- return Object.fromEntries(getSchemaProperties(typeLiteral, {}).map((prop) => [
1475
+ return Object.fromEntries(getSchemaProperties(typeLiteral, {}, {
1476
+ form: true
1477
+ }).map((prop) => [
1476
1478
  prop.name,
1477
1479
  prop.defaultValue
1478
1480
  ]));
@@ -1545,12 +1547,12 @@ var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponen
1545
1547
  };
1546
1548
 
1547
1549
  // src/components/Form/factory.tsx
1548
- import { FormatEnum as FormatEnum4 } from "@dxos/echo/internal";
1550
+ import { Format as Format4 } from "@dxos/echo/internal";
1549
1551
  var getInputComponent = (type, format) => {
1550
1552
  switch (format) {
1551
- case FormatEnum4.GeoPoint:
1553
+ case Format4.TypeFormat.GeoPoint:
1552
1554
  return GeoPointInput;
1553
- case FormatEnum4.Markdown:
1555
+ case Format4.TypeFormat.Markdown:
1554
1556
  return MarkdownInput;
1555
1557
  }
1556
1558
  switch (type) {
@@ -2006,7 +2008,9 @@ var FormFields = /* @__PURE__ */ forwardRef2(({ classNames, schema, path, filter
2006
2008
  try {
2007
2009
  const values = useFormValues(path);
2008
2010
  const properties = useMemo6(() => {
2009
- const props2 = getSchemaProperties2(schema.ast, values);
2011
+ const props2 = getSchemaProperties2(schema.ast, values, {
2012
+ form: true
2013
+ });
2010
2014
  if (projection) {
2011
2015
  const fieldProjections = projection.getFieldProjections();
2012
2016
  const hiddenProperties = new Set(projection.getHiddenProperties());
@@ -2258,7 +2262,7 @@ var FieldEditor = ({ readonly, projection, field, registry, onSave, onCancel, ou
2258
2262
  const custom = useMemo7(() => ({
2259
2263
  ["format"]: (props2) => /* @__PURE__ */ React14.createElement(SelectInput, {
2260
2264
  ...props2,
2261
- options: FormatEnums.filter((value2) => value2 !== FormatEnum5.None).map((value2) => ({
2265
+ options: FormatEnums.filter((value2) => value2 !== Format5.TypeFormat.None).map((value2) => ({
2262
2266
  value: value2,
2263
2267
  label: t(`format ${value2}`)
2264
2268
  }))
@@ -2271,7 +2275,9 @@ var FieldEditor = ({ readonly, projection, field, registry, onSave, onCancel, ou
2271
2275
  }),
2272
2276
  ["referencePath"]: (props2) => /* @__PURE__ */ React14.createElement(SelectInput, {
2273
2277
  ...props2,
2274
- options: referenceSchema ? getSchemaProperties3(referenceSchema.ast).sort(sortProperties).map((p) => ({
2278
+ options: referenceSchema ? getSchemaProperties3(referenceSchema.ast, {}, {
2279
+ form: true
2280
+ }).sort(sortProperties).map((p) => ({
2275
2281
  value: p.name
2276
2282
  })) : []
2277
2283
  }),
@@ -2324,7 +2330,7 @@ import * as Option from "effect/Option";
2324
2330
  import * as Schema2 from "effect/Schema";
2325
2331
  import React15, { forwardRef as forwardRef3, useCallback as useCallback13, useImperativeHandle, useMemo as useMemo8, useState as useState7 } from "react";
2326
2332
  import { QueryAST } from "@dxos/echo";
2327
- import { EchoSchema, Format, isMutable, toJsonSchema } from "@dxos/echo/internal";
2333
+ import { EchoSchema, Format as Format6, isMutable, toJsonSchema } from "@dxos/echo/internal";
2328
2334
  import { Filter as Filter2, Query } from "@dxos/echo-db";
2329
2335
  import { invariant as invariant3 } from "@dxos/invariant";
2330
2336
  import { Callout, IconButton as IconButton4, Input as Input8, useTranslation as useTranslation10 } from "@dxos/react-ui";
@@ -2359,23 +2365,15 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2359
2365
  }), Match.orElse(() => void 0));
2360
2366
  const viewSchema = useMemo8(() => {
2361
2367
  const base = Schema2.Struct({
2362
- query: mode === "schema" ? Format.URL.annotations({
2368
+ query: mode === "schema" ? Format6.URL.annotations({
2363
2369
  title: "Record type"
2364
2370
  }) : QueryAST.Query.annotations({
2365
2371
  title: "Query"
2366
2372
  })
2367
2373
  });
2368
- if (mode === "query" || mode === "named-query") {
2369
- const name = Schema2.Struct({
2370
- name: Schema2.optional(Schema2.String.annotations({
2371
- title: "Name"
2372
- }))
2373
- });
2374
+ if (mode === "tag") {
2374
2375
  return Schema2.Struct({
2375
- ...mode === "named-query" ? {
2376
- ...name.fields,
2377
- ...base.fields
2378
- } : base.fields,
2376
+ ...base.fields,
2379
2377
  target: Schema2.optional(Schema2.String.annotations({
2380
2378
  title: "Target Queue"
2381
2379
  }))
@@ -2386,11 +2384,9 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2386
2384
  mode
2387
2385
  ]);
2388
2386
  const viewValues = useMemo8(() => ({
2389
- name: view.name,
2390
2387
  query: mode === "schema" ? getTypenameFromQuery(view.query.ast) : view.query.ast,
2391
2388
  target: queueTarget
2392
2389
  }), [
2393
- view.name,
2394
2390
  mode,
2395
2391
  view.query.ast,
2396
2392
  queueTarget
@@ -2403,7 +2399,7 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2403
2399
  const handleAdd = useCallback13(() => {
2404
2400
  invariant3(!readonly, void 0, {
2405
2401
  F: __dxlog_file5,
2406
- L: 134,
2402
+ L: 129,
2407
2403
  S: void 0,
2408
2404
  A: [
2409
2405
  "!readonly",
@@ -2418,26 +2414,12 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2418
2414
  readonly
2419
2415
  ]);
2420
2416
  const handleUpdate = useCallback13((values) => {
2421
- invariant3(!readonly, void 0, {
2422
- F: __dxlog_file5,
2423
- L: 141,
2424
- S: void 0,
2425
- A: [
2426
- "!readonly",
2427
- ""
2428
- ]
2429
- });
2430
2417
  requestAnimationFrame(() => {
2431
- if ("name" in values && view.name !== values.name) {
2432
- view.name = values.name;
2433
- return;
2434
- }
2435
2418
  const query = mode === "schema" ? Query.select(Filter2.typename(values.query)).ast : values.query;
2436
2419
  onQueryChanged?.(query, values.target);
2437
2420
  });
2438
2421
  }, [
2439
2422
  onQueryChanged,
2440
- readonly,
2441
2423
  view,
2442
2424
  queueTarget,
2443
2425
  mode
@@ -2445,7 +2427,7 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2445
2427
  const handleDelete = useCallback13((fieldId) => {
2446
2428
  invariant3(!readonly, void 0, {
2447
2429
  F: __dxlog_file5,
2448
- L: 157,
2430
+ L: 146,
2449
2431
  S: void 0,
2450
2432
  A: [
2451
2433
  "!readonly",
@@ -2464,7 +2446,7 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2464
2446
  const handleMove = useCallback13((fromIndex, toIndex) => {
2465
2447
  invariant3(!readonly, void 0, {
2466
2448
  F: __dxlog_file5,
2467
- L: 169,
2449
+ L: 158,
2468
2450
  S: void 0,
2469
2451
  A: [
2470
2452
  "!readonly",
@@ -2494,7 +2476,7 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2494
2476
  }, [
2495
2477
  projectionModel
2496
2478
  ]);
2497
- const custom = useMemo8(() => mode === "query" ? customFields({
2479
+ const custom = useMemo8(() => mode === "tag" ? customFields({
2498
2480
  types,
2499
2481
  tags
2500
2482
  }) : void 0, [
@@ -2505,7 +2487,7 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2505
2487
  return /* @__PURE__ */ React15.createElement("div", {
2506
2488
  role: "none",
2507
2489
  className: mx7(classNames)
2508
- }, schemaReadonly && mode === "schema" && /* @__PURE__ */ React15.createElement(Callout.Root, {
2490
+ }, schemaReadonly && !readonly && /* @__PURE__ */ React15.createElement(Callout.Root, {
2509
2491
  valence: "info",
2510
2492
  classNames: [
2511
2493
  "mlb-cardSpacingBlock",
@@ -2515,7 +2497,6 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2515
2497
  autoSave: true,
2516
2498
  schema: viewSchema,
2517
2499
  values: viewValues,
2518
- readonly: readonly ? "disabled-input" : false,
2519
2500
  onSave: handleUpdate,
2520
2501
  outerSpacing,
2521
2502
  Custom: custom
@@ -2546,7 +2527,7 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2546
2527
  role: "none",
2547
2528
  className: mx7(subtleHover2, listItemGrid, "rounded-sm cursor-pointer min-bs-10")
2548
2529
  }, /* @__PURE__ */ React15.createElement(List2.ItemDragHandle, {
2549
- disabled: readonly
2530
+ disabled: readonly || schemaReadonly
2550
2531
  }), /* @__PURE__ */ React15.createElement(List2.ItemTitle, {
2551
2532
  classNames: hidden && "text-subdued",
2552
2533
  onClick: () => handleToggleField(field)
@@ -2557,7 +2538,7 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2557
2538
  autoHide: false,
2558
2539
  disabled: readonly || !hidden && projectionModel.fields.length <= 1,
2559
2540
  onClick: () => hidden ? handleShow(field.path) : handleHide(field.id)
2560
- }), mode === "schema" && /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(List2.ItemDeleteButton, {
2541
+ }), !readonly && /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(List2.ItemDeleteButton, {
2561
2542
  label: t("delete field label"),
2562
2543
  autoHide: false,
2563
2544
  disabled: readonly || schemaReadonly || view.projection.fields.length <= 1,
@@ -2571,7 +2552,7 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2571
2552
  }),
2572
2553
  icon: expandedField === field.id ? "ph--caret-down--regular" : "ph--caret-right--regular",
2573
2554
  onClick: () => handleToggleField(field)
2574
- }))), expandedField === field.id && mode === "schema" && /* @__PURE__ */ React15.createElement("div", {
2555
+ }))), expandedField === field.id && !readonly && /* @__PURE__ */ React15.createElement("div", {
2575
2556
  role: "none",
2576
2557
  className: "col-span-5 mbs-1 mbe-1 border border-separator rounded-md"
2577
2558
  }, /* @__PURE__ */ React15.createElement(FieldEditor, {
@@ -2581,12 +2562,12 @@ var ViewEditor = /* @__PURE__ */ forwardRef3(({ classNames, schema, view, mode =
2581
2562
  registry,
2582
2563
  onSave: handleClose
2583
2564
  })));
2584
- }))))), !readonly && !expandedField && mode === "schema" && /* @__PURE__ */ React15.createElement("div", {
2565
+ }))))), !readonly && !expandedField && /* @__PURE__ */ React15.createElement("div", {
2585
2566
  role: "none",
2586
2567
  className: outerSpacing ? cardSpacing3 : "mlb-cardSpacingBlock"
2587
2568
  }, /* @__PURE__ */ React15.createElement(IconButton4, {
2588
2569
  icon: "ph--plus--regular",
2589
- label: t("add property button"),
2570
+ label: t("add property button label"),
2590
2571
  onClick: readonly ? void 0 : handleAdd,
2591
2572
  // TODO(burdon): Show field limit in ux (not tooltip).
2592
2573
  disabled: view.projection.fields.length >= VIEW_FIELD_LIMIT,