@dxos/react-ui-form 0.8.4-main.f9ba587 → 0.8.4-main.fd6878d
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/index.mjs +184 -171
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +184 -171
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/ControlSection/ControlSection.stories.d.ts.map +1 -1
- package/dist/types/src/components/FieldEditor/FieldEditor.d.ts +4 -4
- package/dist/types/src/components/FieldEditor/FieldEditor.d.ts.map +1 -1
- package/dist/types/src/components/FieldEditor/FieldEditor.stories.d.ts +2 -2
- package/dist/types/src/components/FieldEditor/FieldEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/Form/ArrayField.d.ts.map +1 -1
- package/dist/types/src/components/Form/Defaults.d.ts.map +1 -1
- package/dist/types/src/components/Form/Form.d.ts +2 -2
- package/dist/types/src/components/Form/Form.d.ts.map +1 -1
- package/dist/types/src/components/Form/Form.stories.d.ts.map +1 -1
- package/dist/types/src/components/Form/FormActions.d.ts.map +1 -1
- package/dist/types/src/components/Form/FormContent.d.ts +1 -1
- package/dist/types/src/components/Form/FormContent.d.ts.map +1 -1
- package/dist/types/src/components/Form/FormContext.d.ts +1 -1
- package/dist/types/src/components/Form/FormContext.d.ts.map +1 -1
- package/dist/types/src/components/Form/RefField.d.ts +1 -1
- package/dist/types/src/components/Form/RefField.d.ts.map +1 -1
- package/dist/types/src/components/Form/custom/SelectOptionsInput.d.ts.map +1 -1
- package/dist/types/src/components/Form/custom/SelectOptionsInput.stories.d.ts.map +1 -1
- package/dist/types/src/components/Form/factory.d.ts.map +1 -1
- package/dist/types/src/components/ViewEditor/ViewEditor.d.ts +2 -2
- package/dist/types/src/components/ViewEditor/ViewEditor.d.ts.map +1 -1
- package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts +3 -3
- package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/deprecated/Form.d.ts +3 -3
- package/dist/types/src/components/deprecated/Form.d.ts.map +1 -1
- package/dist/types/src/components/deprecated/Form.stories.d.ts.map +1 -1
- package/dist/types/src/hooks/useForm.d.ts +1 -1
- package/dist/types/src/hooks/useForm.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -2
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +30 -29
- package/src/components/ControlSection/ControlSection.stories.tsx +2 -1
- package/src/components/FieldEditor/FieldEditor.stories.tsx +16 -13
- package/src/components/FieldEditor/FieldEditor.test.tsx +14 -13
- package/src/components/FieldEditor/FieldEditor.tsx +11 -11
- package/src/components/Form/ArrayField.tsx +8 -7
- package/src/components/Form/Defaults.tsx +2 -1
- package/src/components/Form/Form.stories.tsx +4 -3
- package/src/components/Form/Form.tsx +4 -3
- package/src/components/Form/FormActions.tsx +2 -1
- package/src/components/Form/FormContent.tsx +6 -5
- package/src/components/Form/FormContext.tsx +5 -5
- package/src/components/Form/RefField.tsx +6 -5
- package/src/components/Form/custom/GeoPointInput.tsx +2 -2
- package/src/components/Form/custom/SelectOptionsInput.stories.tsx +3 -2
- package/src/components/Form/custom/SelectOptionsInput.tsx +28 -29
- package/src/components/Form/factory.tsx +1 -1
- package/src/components/ViewEditor/ViewEditor.stories.tsx +19 -12
- package/src/components/ViewEditor/ViewEditor.test.tsx +18 -15
- package/src/components/ViewEditor/ViewEditor.tsx +81 -81
- package/src/components/deprecated/Form.stories.tsx +6 -5
- package/src/components/deprecated/Form.tsx +6 -6
- package/src/hooks/useForm.ts +5 -3
- package/src/hooks/useRefQueryLookupHandler.ts +1 -1
- package/src/translations.ts +3 -2
|
@@ -18,6 +18,7 @@ var translations = [
|
|
|
18
18
|
"field limit reached": "Maximum number of fields reached",
|
|
19
19
|
"boolean input true value": "Yes",
|
|
20
20
|
"boolean input false value": "No",
|
|
21
|
+
"delete field label": "Delete field",
|
|
21
22
|
// TODO(burdon): Factor out?
|
|
22
23
|
"button cancel": "Cancel",
|
|
23
24
|
"button save": "Save",
|
|
@@ -60,8 +61,8 @@ var translations = [
|
|
|
60
61
|
"select option delete": "Delete",
|
|
61
62
|
"select option add": "Add option",
|
|
62
63
|
// System schema message.
|
|
63
|
-
"system schema title": "System
|
|
64
|
-
"system schema description": "This is a system
|
|
64
|
+
"system schema title": "System record type",
|
|
65
|
+
"system schema description": "This is a system record type and cannot be modified."
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
68
|
}
|
|
@@ -260,7 +261,7 @@ import { getFormatSchema, getSchemaProperties as getSchemaProperties3, sortPrope
|
|
|
260
261
|
|
|
261
262
|
// src/components/Form/custom/GeoPointInput.tsx
|
|
262
263
|
import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
|
|
263
|
-
import React4, { useCallback,
|
|
264
|
+
import React4, { useCallback, useEffect, useMemo, useState } from "react";
|
|
264
265
|
import { GeoLocation } from "@dxos/echo-schema";
|
|
265
266
|
import { Input as Input4, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
266
267
|
import { safeParseFloat } from "@dxos/util";
|
|
@@ -374,12 +375,12 @@ var GeoPointInput = ({ type, label, disabled, getStatus, getValue: getValue3, on
|
|
|
374
375
|
|
|
375
376
|
// src/components/Form/custom/SelectOptionsInput.tsx
|
|
376
377
|
import { useSignals as _useSignals5 } from "@preact-signals/safe-react/tracking";
|
|
377
|
-
import React5, { useCallback as useCallback2, useEffect as useEffect2, useState as useState2
|
|
378
|
+
import React5, { useCallback as useCallback2, useEffect as useEffect2, useRef, useState as useState2 } from "react";
|
|
378
379
|
import { PublicKey } from "@dxos/keys";
|
|
379
|
-
import {
|
|
380
|
+
import { IconButton, Input as Input5, Tag, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
380
381
|
import { List } from "@dxos/react-ui-list";
|
|
381
382
|
import { HuePicker } from "@dxos/react-ui-pickers";
|
|
382
|
-
import { hues,
|
|
383
|
+
import { hues, subtleHover } from "@dxos/react-ui-theme";
|
|
383
384
|
var SelectOptionInput = ({ type, label, disabled, getStatus, getValue: getValue3, onValueChange }) => {
|
|
384
385
|
var _effect = _useSignals5();
|
|
385
386
|
try {
|
|
@@ -499,7 +500,8 @@ var SelectOptionInput = ({ type, label, disabled, getStatus, getValue: getValue3
|
|
|
499
500
|
}, options && /* @__PURE__ */ React5.createElement(List.Root, {
|
|
500
501
|
items: options,
|
|
501
502
|
isItem: (item) => true,
|
|
502
|
-
onMove: handleMove
|
|
503
|
+
onMove: disabled ? void 0 : handleMove,
|
|
504
|
+
readonly: disabled
|
|
503
505
|
}, ({ items }) => /* @__PURE__ */ React5.createElement("div", {
|
|
504
506
|
role: "list",
|
|
505
507
|
className: "w-full overflow-auto"
|
|
@@ -508,25 +510,36 @@ var SelectOptionInput = ({ type, label, disabled, getStatus, getValue: getValue3
|
|
|
508
510
|
}, /* @__PURE__ */ React5.createElement(List.Item, {
|
|
509
511
|
role: "button",
|
|
510
512
|
item,
|
|
511
|
-
classNames:
|
|
513
|
+
classNames: [
|
|
514
|
+
subtleHover,
|
|
515
|
+
"flex flex-col cursor-pointer rounded-sm"
|
|
516
|
+
],
|
|
512
517
|
"aria-expanded": selected === item.id
|
|
513
518
|
}, /* @__PURE__ */ React5.createElement("div", {
|
|
514
519
|
className: "flex items-center"
|
|
515
|
-
}, /* @__PURE__ */ React5.createElement(List.ItemDragHandle,
|
|
520
|
+
}, /* @__PURE__ */ React5.createElement(List.ItemDragHandle, {
|
|
521
|
+
disabled
|
|
522
|
+
}), /* @__PURE__ */ React5.createElement(List.ItemTitle, {
|
|
516
523
|
onClick: () => handleClick(item.id),
|
|
517
524
|
classNames: "flex-1"
|
|
518
525
|
}, /* @__PURE__ */ React5.createElement(Tag, {
|
|
519
526
|
palette: item.color
|
|
520
|
-
}, item.title || "\u200B")), /* @__PURE__ */ React5.createElement(
|
|
527
|
+
}, item.title || "\u200B")), /* @__PURE__ */ React5.createElement(IconButton, {
|
|
528
|
+
iconOnly: true,
|
|
529
|
+
variant: "ghost",
|
|
530
|
+
label: t(selected === item.id ? "collapse label" : "expand label", {
|
|
531
|
+
ns: "os"
|
|
532
|
+
}),
|
|
521
533
|
icon: selected === item.id ? "ph--caret-down--regular" : "ph--caret-right--regular",
|
|
522
534
|
onClick: () => handleClick(item.id)
|
|
523
535
|
})), selected === item.id && /* @__PURE__ */ React5.createElement("div", {
|
|
524
|
-
className: "
|
|
536
|
+
className: "pli-cardSpacingInline plb-cardSpacingBlock flex flex-col gap-1 density-fine"
|
|
525
537
|
}, /* @__PURE__ */ React5.createElement(Input5.Label, {
|
|
526
538
|
classNames: "text-xs"
|
|
527
539
|
}, t("select option label")), /* @__PURE__ */ React5.createElement("div", {
|
|
528
|
-
className: "
|
|
540
|
+
className: "grid grid-cols-[1fr_min-content_min-content] gap-1"
|
|
529
541
|
}, /* @__PURE__ */ React5.createElement(Input5.TextInput, {
|
|
542
|
+
disabled,
|
|
530
543
|
placeholder: t("select option label placeholder"),
|
|
531
544
|
ref: selected === item.id ? inputRef : void 0,
|
|
532
545
|
value: item.title,
|
|
@@ -534,30 +547,24 @@ var SelectOptionInput = ({ type, label, disabled, getStatus, getValue: getValue3
|
|
|
534
547
|
onKeyDown: handleKeyDown,
|
|
535
548
|
classNames: "flex-1",
|
|
536
549
|
"data-no-submit": true
|
|
537
|
-
}), /* @__PURE__ */ React5.createElement(
|
|
538
|
-
|
|
539
|
-
}, /* @__PURE__ */ React5.createElement(HuePicker, {
|
|
550
|
+
}), /* @__PURE__ */ React5.createElement(HuePicker, {
|
|
551
|
+
disabled,
|
|
540
552
|
value: item.color,
|
|
541
|
-
onChange: handleColorChange(item.id)
|
|
542
|
-
|
|
543
|
-
|
|
553
|
+
onChange: handleColorChange(item.id)
|
|
554
|
+
}), /* @__PURE__ */ React5.createElement(IconButton, {
|
|
555
|
+
disabled,
|
|
544
556
|
icon: "ph--trash--fill",
|
|
545
557
|
iconOnly: true,
|
|
546
558
|
label: t("select option delete"),
|
|
547
559
|
onClick: () => handleDelete(item.id)
|
|
548
|
-
})))))), /* @__PURE__ */ React5.createElement(
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
}, /* @__PURE__ */ React5.createElement(Icon2, {
|
|
557
|
-
icon: "ph--plus--regular"
|
|
558
|
-
}), /* @__PURE__ */ React5.createElement("span", {
|
|
559
|
-
className: "text-sm"
|
|
560
|
-
}, t("select option add")))))))));
|
|
560
|
+
})))))), /* @__PURE__ */ React5.createElement(IconButton, {
|
|
561
|
+
variant: "ghost",
|
|
562
|
+
icon: "ph--plus--regular",
|
|
563
|
+
label: t("select option add"),
|
|
564
|
+
onClick: handleAdd,
|
|
565
|
+
disabled,
|
|
566
|
+
classNames: "is-full"
|
|
567
|
+
})))));
|
|
561
568
|
} finally {
|
|
562
569
|
_effect.f();
|
|
563
570
|
}
|
|
@@ -567,7 +574,7 @@ var SelectOptionInput = ({ type, label, disabled, getStatus, getValue: getValue3
|
|
|
567
574
|
import { useSignals as _useSignals6 } from "@preact-signals/safe-react/tracking";
|
|
568
575
|
import React6 from "react";
|
|
569
576
|
import { Input as Input6 } from "@dxos/react-ui";
|
|
570
|
-
import { mx as
|
|
577
|
+
import { mx as mx4 } from "@dxos/react-ui-theme";
|
|
571
578
|
import { safeParseFloat as safeParseFloat2 } from "@dxos/util";
|
|
572
579
|
var gridCols = [
|
|
573
580
|
"grid-cols-1",
|
|
@@ -586,7 +593,7 @@ var TupleInput = ({ binding, type, label, disabled, getStatus, getValue: getValu
|
|
|
586
593
|
error,
|
|
587
594
|
label
|
|
588
595
|
}), /* @__PURE__ */ React6.createElement("div", {
|
|
589
|
-
className:
|
|
596
|
+
className: mx4("grid gap-2", gridCols[binding.length - 1])
|
|
590
597
|
}, binding.map((prop) => /* @__PURE__ */ React6.createElement(Input6.TextInput, {
|
|
591
598
|
key: prop,
|
|
592
599
|
type: "number",
|
|
@@ -755,11 +762,11 @@ import { useSignals as _useSignals9 } from "@preact-signals/safe-react/tracking"
|
|
|
755
762
|
import React9 from "react";
|
|
756
763
|
import { IconButton as IconButton2, useTranslation as useTranslation5 } from "@dxos/react-ui";
|
|
757
764
|
import { cardSpacing } from "@dxos/react-ui-stack";
|
|
758
|
-
import { mx as
|
|
765
|
+
import { mx as mx5 } from "@dxos/react-ui-theme";
|
|
759
766
|
|
|
760
767
|
// src/components/Form/FormContext.tsx
|
|
761
768
|
import { useSignals as _useSignals8 } from "@preact-signals/safe-react/tracking";
|
|
762
|
-
import React8, { createContext, useContext, useEffect as useEffect6, useMemo as useMemo3
|
|
769
|
+
import React8, { createContext, useCallback as useCallback6, useContext, useEffect as useEffect6, useMemo as useMemo3 } from "react";
|
|
763
770
|
import { raise } from "@dxos/debug";
|
|
764
771
|
import { getValue as getValue2 } from "@dxos/echo-schema";
|
|
765
772
|
import { createJsonPath as createJsonPath2 } from "@dxos/effect";
|
|
@@ -776,7 +783,7 @@ var __dxlog_file = "/__w/dxos/dxos/packages/ui/react-ui-form/src/hooks/useForm.t
|
|
|
776
783
|
var useForm = ({ schema, initialValues, onValuesChanged, onValidate, onValid, onSave }) => {
|
|
777
784
|
invariant(SchemaAST.isTypeLiteral(schema.ast), void 0, {
|
|
778
785
|
F: __dxlog_file,
|
|
779
|
-
L:
|
|
786
|
+
L: 95,
|
|
780
787
|
S: void 0,
|
|
781
788
|
A: [
|
|
782
789
|
"SchemaAST.isTypeLiteral(schema.ast)",
|
|
@@ -880,7 +887,7 @@ var useForm = ({ schema, initialValues, onValuesChanged, onValidate, onValid, on
|
|
|
880
887
|
} catch (err) {
|
|
881
888
|
log.catch(err, void 0, {
|
|
882
889
|
F: __dxlog_file,
|
|
883
|
-
L:
|
|
890
|
+
L: 215,
|
|
884
891
|
S: void 0,
|
|
885
892
|
C: (f, a) => f(...a)
|
|
886
893
|
});
|
|
@@ -951,7 +958,7 @@ var useForm = ({ schema, initialValues, onValuesChanged, onValidate, onValid, on
|
|
|
951
958
|
var createKeySet = (obj, value) => {
|
|
952
959
|
invariant(obj, void 0, {
|
|
953
960
|
F: __dxlog_file,
|
|
954
|
-
L:
|
|
961
|
+
L: 277,
|
|
955
962
|
S: void 0,
|
|
956
963
|
A: [
|
|
957
964
|
"obj",
|
|
@@ -1128,7 +1135,7 @@ var FormActions = ({ readonly, onCancel, outerSpacing = true }) => {
|
|
|
1128
1135
|
const { canSave, handleSave } = useFormContext();
|
|
1129
1136
|
return /* @__PURE__ */ React9.createElement("div", {
|
|
1130
1137
|
role: "none",
|
|
1131
|
-
className:
|
|
1138
|
+
className: mx5(outerSpacing === "scroll-fields" ? "pli-cardSpacingInline mbe-cardSpacingBlock" : outerSpacing ? cardSpacing : "mbs-cardSpacingBlock", "flex [&_button]:grow gap-1 first:mbs-0")
|
|
1132
1139
|
}, onCancel && !readonly && /* @__PURE__ */ React9.createElement(IconButton2, {
|
|
1133
1140
|
"data-testid": "cancel-button",
|
|
1134
1141
|
icon: "ph--x--regular",
|
|
@@ -1153,20 +1160,10 @@ import { Schema, SchemaAST as SchemaAST4, pipe as pipe2 } from "effect";
|
|
|
1153
1160
|
import { capitalize as capitalize2 } from "effect/String";
|
|
1154
1161
|
import React12, { forwardRef, useMemo as useMemo5 } from "react";
|
|
1155
1162
|
import { createJsonPath as createJsonPath3, findNode as findNode3, getDiscriminatedType as getDiscriminatedType2, isDiscriminatedUnion as isDiscriminatedUnion2 } from "@dxos/effect";
|
|
1156
|
-
import { mx as
|
|
1163
|
+
import { mx as mx7 } from "@dxos/react-ui-theme";
|
|
1157
1164
|
import { getSchemaProperties as getSchemaProperties2 } from "@dxos/schema";
|
|
1158
1165
|
import { isNotFalsy } from "@dxos/util";
|
|
1159
1166
|
|
|
1160
|
-
// src/components/Form/ArrayField.tsx
|
|
1161
|
-
import { useSignals as _useSignals10 } from "@preact-signals/safe-react/tracking";
|
|
1162
|
-
import { SchemaAST as SchemaAST3, pipe } from "effect";
|
|
1163
|
-
import { capitalize } from "effect/String";
|
|
1164
|
-
import React10, { Fragment, useCallback as useCallback7 } from "react";
|
|
1165
|
-
import { findNode as findNode2, getDiscriminatedType, isDiscriminatedUnion, SimpleType } from "@dxos/effect";
|
|
1166
|
-
import { invariant as invariant2 } from "@dxos/invariant";
|
|
1167
|
-
import { IconButton as IconButton3, useTranslation as useTranslation6 } from "@dxos/react-ui";
|
|
1168
|
-
import { getSchemaProperties } from "@dxos/schema";
|
|
1169
|
-
|
|
1170
1167
|
// src/util/field.ts
|
|
1171
1168
|
import { FormatEnum, GeoLocation as GeoLocation2, TypeEnum } from "@dxos/echo-schema";
|
|
1172
1169
|
var parseValue = ({ type, format, value }) => {
|
|
@@ -1475,6 +1472,14 @@ var getRefProps = (property) => {
|
|
|
1475
1472
|
};
|
|
1476
1473
|
|
|
1477
1474
|
// src/components/Form/ArrayField.tsx
|
|
1475
|
+
import { useSignals as _useSignals10 } from "@preact-signals/safe-react/tracking";
|
|
1476
|
+
import { SchemaAST as SchemaAST3, pipe } from "effect";
|
|
1477
|
+
import { capitalize } from "effect/String";
|
|
1478
|
+
import React10, { Fragment, useCallback as useCallback7 } from "react";
|
|
1479
|
+
import { SimpleType, findNode as findNode2, getDiscriminatedType, isDiscriminatedUnion } from "@dxos/effect";
|
|
1480
|
+
import { invariant as invariant2 } from "@dxos/invariant";
|
|
1481
|
+
import { IconButton as IconButton3, useTranslation as useTranslation6 } from "@dxos/react-ui";
|
|
1482
|
+
import { getSchemaProperties } from "@dxos/schema";
|
|
1478
1483
|
var __dxlog_file3 = "/__w/dxos/dxos/packages/ui/react-ui-form/src/components/Form/ArrayField.tsx";
|
|
1479
1484
|
var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponent }) => {
|
|
1480
1485
|
var _effect = _useSignals10();
|
|
@@ -1484,7 +1489,7 @@ var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponen
|
|
|
1484
1489
|
const values = useFormValues(path ?? []) ?? [];
|
|
1485
1490
|
invariant2(Array.isArray(values), `Values at path ${path?.join(".")} must be an array.`, {
|
|
1486
1491
|
F: __dxlog_file3,
|
|
1487
|
-
L:
|
|
1492
|
+
L: 37,
|
|
1488
1493
|
S: void 0,
|
|
1489
1494
|
A: [
|
|
1490
1495
|
"Array.isArray(values)",
|
|
@@ -1561,7 +1566,7 @@ var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponen
|
|
|
1561
1566
|
classNames: "self-center"
|
|
1562
1567
|
}));
|
|
1563
1568
|
})), !readonly && /* @__PURE__ */ React10.createElement(IconButton3, {
|
|
1564
|
-
classNames: "is-full mlb-
|
|
1569
|
+
classNames: "is-full mlb-cardSpacingBlock flex",
|
|
1565
1570
|
icon: "ph--plus--regular",
|
|
1566
1571
|
label: t("add field"),
|
|
1567
1572
|
onClick: handleAdd
|
|
@@ -1571,16 +1576,35 @@ var ArrayField = ({ property, readonly, path, inputProps, Custom, lookupComponen
|
|
|
1571
1576
|
}
|
|
1572
1577
|
};
|
|
1573
1578
|
|
|
1579
|
+
// src/components/Form/factory.tsx
|
|
1580
|
+
import { FormatEnum as FormatEnum4 } from "@dxos/echo-schema";
|
|
1581
|
+
var getInputComponent = (type, format) => {
|
|
1582
|
+
switch (format) {
|
|
1583
|
+
case FormatEnum4.GeoPoint:
|
|
1584
|
+
return GeoPointInput;
|
|
1585
|
+
case FormatEnum4.Markdown:
|
|
1586
|
+
return MarkdownInput;
|
|
1587
|
+
}
|
|
1588
|
+
switch (type) {
|
|
1589
|
+
case "string":
|
|
1590
|
+
return TextInput;
|
|
1591
|
+
case "number":
|
|
1592
|
+
return NumberInput;
|
|
1593
|
+
case "boolean":
|
|
1594
|
+
return BooleanInput;
|
|
1595
|
+
}
|
|
1596
|
+
};
|
|
1597
|
+
|
|
1574
1598
|
// src/components/Form/RefField.tsx
|
|
1575
1599
|
import { useSignals as _useSignals11 } from "@preact-signals/safe-react/tracking";
|
|
1576
1600
|
import React11, { useCallback as useCallback8, useMemo as useMemo4 } from "react";
|
|
1577
|
-
import { Expando,
|
|
1601
|
+
import { Expando, Ref, ReferenceAnnotationId as ReferenceAnnotationId2, getTypeAnnotation } from "@dxos/echo-schema";
|
|
1578
1602
|
import { findAnnotation as findAnnotation2 } from "@dxos/effect";
|
|
1579
1603
|
import { DXN } from "@dxos/keys";
|
|
1580
1604
|
import { DxRefTag } from "@dxos/lit-ui/react";
|
|
1581
1605
|
import { Input as Input8, useTranslation as useTranslation7 } from "@dxos/react-ui";
|
|
1582
1606
|
import { TagPicker } from "@dxos/react-ui-tag-picker";
|
|
1583
|
-
import { descriptionText, mx as
|
|
1607
|
+
import { descriptionText, mx as mx6 } from "@dxos/react-ui-theme";
|
|
1584
1608
|
import { isNonNullable as isNonNullable2 } from "@dxos/util";
|
|
1585
1609
|
var RefField = ({ type, label, disabled, placeholder, inputOnly, array, ast, getValue: getValue3, onBlur, onQueryRefOptions, onValueChange, ...restInputProps }) => {
|
|
1586
1610
|
var _effect = _useSignals11();
|
|
@@ -1679,7 +1703,7 @@ var RefField = ({ type, label, disabled, placeholder, inputOnly, array, ast, get
|
|
|
1679
1703
|
}), /* @__PURE__ */ React11.createElement("div", {
|
|
1680
1704
|
"data-no-submit": true
|
|
1681
1705
|
}, disabled ? items.length < 1 ? /* @__PURE__ */ React11.createElement("p", {
|
|
1682
|
-
className:
|
|
1706
|
+
className: mx6(descriptionText, "mbe-2")
|
|
1683
1707
|
}, t("empty readonly ref field label")) : items.map((item) => /* @__PURE__ */ React11.createElement(DxRefTag, {
|
|
1684
1708
|
key: item.id,
|
|
1685
1709
|
refid: item.id,
|
|
@@ -1738,25 +1762,6 @@ var RefFieldFallback = ({ type, label, disabled, placeholder, inputOnly, getValu
|
|
|
1738
1762
|
}
|
|
1739
1763
|
};
|
|
1740
1764
|
|
|
1741
|
-
// src/components/Form/factory.tsx
|
|
1742
|
-
import { FormatEnum as FormatEnum4 } from "@dxos/echo-schema";
|
|
1743
|
-
var getInputComponent = (type, format) => {
|
|
1744
|
-
switch (format) {
|
|
1745
|
-
case FormatEnum4.GeoPoint:
|
|
1746
|
-
return GeoPointInput;
|
|
1747
|
-
case FormatEnum4.Markdown:
|
|
1748
|
-
return MarkdownInput;
|
|
1749
|
-
}
|
|
1750
|
-
switch (type) {
|
|
1751
|
-
case "string":
|
|
1752
|
-
return TextInput;
|
|
1753
|
-
case "number":
|
|
1754
|
-
return NumberInput;
|
|
1755
|
-
case "boolean":
|
|
1756
|
-
return BooleanInput;
|
|
1757
|
-
}
|
|
1758
|
-
};
|
|
1759
|
-
|
|
1760
1765
|
// src/components/Form/FormContent.tsx
|
|
1761
1766
|
var FormField = ({ property, path, readonly, inline, onQueryRefOptions, lookupComponent, Custom }) => {
|
|
1762
1767
|
var _effect = _useSignals12();
|
|
@@ -1855,7 +1860,7 @@ var FormField = ({ property, path, readonly, inline, onQueryRefOptions, lookupCo
|
|
|
1855
1860
|
const typeLiteral = baseNode ? getDiscriminatedType2(baseNode, inputProps.getValue()) : findNode3(ast, SchemaAST4.isTypeLiteral);
|
|
1856
1861
|
if (typeLiteral) {
|
|
1857
1862
|
return /* @__PURE__ */ React12.createElement(React12.Fragment, null, !inline && /* @__PURE__ */ React12.createElement("h3", {
|
|
1858
|
-
className:
|
|
1863
|
+
className: mx7("text-lg mlb-inputSpacingBlock first:mbs-0")
|
|
1859
1864
|
}, label), /* @__PURE__ */ React12.createElement(FormFields, {
|
|
1860
1865
|
schema: Schema.make(typeLiteral),
|
|
1861
1866
|
path,
|
|
@@ -1887,7 +1892,7 @@ var FormFields = /* @__PURE__ */ forwardRef(({ classNames, testId, schema, path,
|
|
|
1887
1892
|
]);
|
|
1888
1893
|
return /* @__PURE__ */ React12.createElement("div", {
|
|
1889
1894
|
role: "form",
|
|
1890
|
-
className:
|
|
1895
|
+
className: mx7("is-full", classNames),
|
|
1891
1896
|
ref: forwardRef2
|
|
1892
1897
|
}, properties.map((property) => {
|
|
1893
1898
|
return /* @__PURE__ */ React12.createElement(FormField, {
|
|
@@ -1950,7 +1955,7 @@ var Form = ({ classNames, testId, values: initialValues, autoFocus, readonly, au
|
|
|
1950
1955
|
],
|
|
1951
1956
|
readonly,
|
|
1952
1957
|
schema
|
|
1953
|
-
}), (onCancel || onSave) && !autoSave && /* @__PURE__ */ React13.createElement(FormActions, {
|
|
1958
|
+
}), (onCancel || onSave) && !autoSave && !readonly && /* @__PURE__ */ React13.createElement(FormActions, {
|
|
1954
1959
|
readonly,
|
|
1955
1960
|
onCancel,
|
|
1956
1961
|
outerSpacing
|
|
@@ -1962,7 +1967,7 @@ var Form = ({ classNames, testId, values: initialValues, autoFocus, readonly, au
|
|
|
1962
1967
|
|
|
1963
1968
|
// src/components/FieldEditor/FieldEditor.tsx
|
|
1964
1969
|
var __dxlog_file4 = "/__w/dxos/dxos/packages/ui/react-ui-form/src/components/FieldEditor/FieldEditor.tsx";
|
|
1965
|
-
var FieldEditor = ({
|
|
1970
|
+
var FieldEditor = ({ readonly, projection, field, registry, onSave, onCancel, outerSpacing }) => {
|
|
1966
1971
|
var _effect = _useSignals14();
|
|
1967
1972
|
try {
|
|
1968
1973
|
const { t } = useTranslation8(translationKey);
|
|
@@ -2036,7 +2041,7 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel, outerS
|
|
|
2036
2041
|
props.referenceSchema
|
|
2037
2042
|
]);
|
|
2038
2043
|
const handleValidate = useCallback9(({ property }) => {
|
|
2039
|
-
if (property &&
|
|
2044
|
+
if (property && projection.fields.find((f) => f.path === property && f.path !== field.path)) {
|
|
2040
2045
|
return [
|
|
2041
2046
|
{
|
|
2042
2047
|
path: "property",
|
|
@@ -2045,7 +2050,7 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel, outerS
|
|
|
2045
2050
|
];
|
|
2046
2051
|
}
|
|
2047
2052
|
}, [
|
|
2048
|
-
|
|
2053
|
+
projection.fields,
|
|
2049
2054
|
field
|
|
2050
2055
|
]);
|
|
2051
2056
|
const handleSave = useCallback9((props2) => {
|
|
@@ -2097,7 +2102,7 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel, outerS
|
|
|
2097
2102
|
props
|
|
2098
2103
|
}, {
|
|
2099
2104
|
F: __dxlog_file4,
|
|
2100
|
-
L:
|
|
2105
|
+
L: 182,
|
|
2101
2106
|
S: void 0,
|
|
2102
2107
|
C: (f, a) => f(...a)
|
|
2103
2108
|
});
|
|
@@ -2106,6 +2111,7 @@ var FieldEditor = ({ view, projection, field, registry, onSave, onCancel, outerS
|
|
|
2106
2111
|
return /* @__PURE__ */ React14.createElement(Form, {
|
|
2107
2112
|
key: field.id,
|
|
2108
2113
|
autoFocus: true,
|
|
2114
|
+
readonly,
|
|
2109
2115
|
values: props,
|
|
2110
2116
|
schema: fieldSchema,
|
|
2111
2117
|
filter: propIsNotType,
|
|
@@ -2134,16 +2140,14 @@ import { invariant as invariant3 } from "@dxos/invariant";
|
|
|
2134
2140
|
import { Callout, IconButton as IconButton4, useTranslation as useTranslation9 } from "@dxos/react-ui";
|
|
2135
2141
|
import { List as List2 } from "@dxos/react-ui-list";
|
|
2136
2142
|
import { cardSpacing as cardSpacing3 } from "@dxos/react-ui-stack";
|
|
2137
|
-
import {
|
|
2138
|
-
import { FieldSchema,
|
|
2143
|
+
import { inputTextLabel, mx as mx8, subtleHover as subtleHover2 } from "@dxos/react-ui-theme";
|
|
2144
|
+
import { FieldSchema, ProjectionModel, VIEW_FIELD_LIMIT } from "@dxos/schema";
|
|
2139
2145
|
var __dxlog_file5 = "/__w/dxos/dxos/packages/ui/react-ui-form/src/components/ViewEditor/ViewEditor.tsx";
|
|
2140
|
-
var
|
|
2146
|
+
var listGrid = "grid grid-cols-[min-content_1fr_min-content_min-content_min-content]";
|
|
2147
|
+
var listItemGrid = "grid grid-cols-subgrid col-span-5";
|
|
2141
2148
|
var ViewMetaSchema = Schema2.Struct({
|
|
2142
|
-
name: Schema2.String.annotations({
|
|
2143
|
-
title: "View"
|
|
2144
|
-
}),
|
|
2145
2149
|
typename: Format.URL.annotations({
|
|
2146
|
-
title: "
|
|
2150
|
+
title: "Record type"
|
|
2147
2151
|
})
|
|
2148
2152
|
}).pipe(Schema2.mutable);
|
|
2149
2153
|
var ViewEditor = ({ classNames, schema, view, registry, readonly: _readonly, showHeading = false, onTypenameChanged, onDelete, outerSpacing = true }) => {
|
|
@@ -2152,52 +2156,48 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly: _readonly, sho
|
|
|
2152
2156
|
const { t } = useTranslation9(translationKey);
|
|
2153
2157
|
const projection = useMemo8(() => {
|
|
2154
2158
|
const jsonSchema = schema instanceof EchoSchema ? schema.jsonSchema : toJsonSchema(schema);
|
|
2155
|
-
return new
|
|
2159
|
+
return new ProjectionModel(jsonSchema, view.projection);
|
|
2156
2160
|
}, [
|
|
2157
2161
|
schema,
|
|
2158
|
-
view
|
|
2162
|
+
view.projection
|
|
2159
2163
|
]);
|
|
2160
|
-
const [
|
|
2164
|
+
const [expandedField, setExpandedField] = useState6();
|
|
2161
2165
|
const readonly = _readonly || !isMutable(schema);
|
|
2162
2166
|
const viewValues = useMemo8(() => {
|
|
2163
2167
|
return {
|
|
2164
|
-
name: view.name,
|
|
2165
2168
|
// TODO(burdon): Need to warn user of possible consequences of editing.
|
|
2166
2169
|
// TODO(burdon): Settings should have domain name owned by user.
|
|
2167
2170
|
typename: view.query.typename
|
|
2168
2171
|
};
|
|
2169
2172
|
}, [
|
|
2170
|
-
view
|
|
2173
|
+
view.query.typename
|
|
2171
2174
|
]);
|
|
2172
|
-
const
|
|
2173
|
-
|
|
2174
|
-
return;
|
|
2175
|
-
}
|
|
2176
|
-
setField((f) => f === field2 ? void 0 : field2);
|
|
2175
|
+
const handleToggleField = useCallback10((field) => {
|
|
2176
|
+
setExpandedField((prevExpandedFieldId) => prevExpandedFieldId === field.id ? void 0 : field.id);
|
|
2177
2177
|
}, [
|
|
2178
2178
|
readonly
|
|
2179
2179
|
]);
|
|
2180
2180
|
const handleAdd = useCallback10(() => {
|
|
2181
2181
|
invariant3(!readonly, void 0, {
|
|
2182
2182
|
F: __dxlog_file5,
|
|
2183
|
-
L:
|
|
2183
|
+
L: 86,
|
|
2184
2184
|
S: void 0,
|
|
2185
2185
|
A: [
|
|
2186
2186
|
"!readonly",
|
|
2187
2187
|
""
|
|
2188
2188
|
]
|
|
2189
2189
|
});
|
|
2190
|
-
const
|
|
2191
|
-
|
|
2190
|
+
const field = projection.createFieldProjection();
|
|
2191
|
+
setExpandedField(field.id);
|
|
2192
2192
|
}, [
|
|
2193
2193
|
schema,
|
|
2194
|
-
|
|
2194
|
+
projection,
|
|
2195
2195
|
readonly
|
|
2196
2196
|
]);
|
|
2197
|
-
const handleUpdate = useCallback10(({
|
|
2197
|
+
const handleUpdate = useCallback10(({ typename }) => {
|
|
2198
2198
|
invariant3(!readonly, void 0, {
|
|
2199
2199
|
F: __dxlog_file5,
|
|
2200
|
-
L:
|
|
2200
|
+
L: 93,
|
|
2201
2201
|
S: void 0,
|
|
2202
2202
|
A: [
|
|
2203
2203
|
"!readonly",
|
|
@@ -2205,43 +2205,38 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly: _readonly, sho
|
|
|
2205
2205
|
]
|
|
2206
2206
|
});
|
|
2207
2207
|
requestAnimationFrame(() => {
|
|
2208
|
-
if (view.name !== name) {
|
|
2209
|
-
view.name = name;
|
|
2210
|
-
}
|
|
2211
2208
|
if (view.query.typename !== typename && !readonly) {
|
|
2212
2209
|
onTypenameChanged?.(typename);
|
|
2213
2210
|
}
|
|
2214
2211
|
});
|
|
2215
2212
|
}, [
|
|
2216
|
-
|
|
2217
|
-
view,
|
|
2213
|
+
view.query.typename,
|
|
2218
2214
|
onTypenameChanged,
|
|
2219
2215
|
readonly
|
|
2220
2216
|
]);
|
|
2221
2217
|
const handleDelete = useCallback10((fieldId) => {
|
|
2222
2218
|
invariant3(!readonly, void 0, {
|
|
2223
2219
|
F: __dxlog_file5,
|
|
2224
|
-
L:
|
|
2220
|
+
L: 105,
|
|
2225
2221
|
S: void 0,
|
|
2226
2222
|
A: [
|
|
2227
2223
|
"!readonly",
|
|
2228
2224
|
""
|
|
2229
2225
|
]
|
|
2230
2226
|
});
|
|
2231
|
-
if (fieldId ===
|
|
2232
|
-
|
|
2227
|
+
if (fieldId === expandedField) {
|
|
2228
|
+
setExpandedField(void 0);
|
|
2233
2229
|
}
|
|
2234
2230
|
onDelete?.(fieldId);
|
|
2235
2231
|
}, [
|
|
2236
|
-
|
|
2237
|
-
field,
|
|
2232
|
+
expandedField,
|
|
2238
2233
|
onDelete,
|
|
2239
2234
|
readonly
|
|
2240
2235
|
]);
|
|
2241
2236
|
const handleMove = useCallback10((fromIndex, toIndex) => {
|
|
2242
2237
|
invariant3(!readonly, void 0, {
|
|
2243
2238
|
F: __dxlog_file5,
|
|
2244
|
-
L:
|
|
2239
|
+
L: 117,
|
|
2245
2240
|
S: void 0,
|
|
2246
2241
|
A: [
|
|
2247
2242
|
"!readonly",
|
|
@@ -2249,39 +2244,39 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly: _readonly, sho
|
|
|
2249
2244
|
]
|
|
2250
2245
|
});
|
|
2251
2246
|
const fields = [
|
|
2252
|
-
...view.fields
|
|
2247
|
+
...view.projection.fields
|
|
2253
2248
|
];
|
|
2254
2249
|
const [moved] = fields.splice(fromIndex, 1);
|
|
2255
2250
|
fields.splice(toIndex, 0, moved);
|
|
2256
|
-
view.fields = fields;
|
|
2251
|
+
view.projection.fields = fields;
|
|
2257
2252
|
}, [
|
|
2258
|
-
|
|
2259
|
-
view.fields,
|
|
2253
|
+
view.projection.fields,
|
|
2260
2254
|
readonly
|
|
2261
2255
|
]);
|
|
2262
|
-
const handleClose = useCallback10(() =>
|
|
2256
|
+
const handleClose = useCallback10(() => setExpandedField(void 0), []);
|
|
2263
2257
|
const hiddenProperties = projection.getHiddenProperties();
|
|
2264
2258
|
const handleHide = useCallback10((fieldId) => {
|
|
2265
|
-
|
|
2259
|
+
setExpandedField(void 0);
|
|
2266
2260
|
projection.hideFieldProjection(fieldId);
|
|
2267
2261
|
}, [
|
|
2268
2262
|
projection
|
|
2269
2263
|
]);
|
|
2270
2264
|
const handleShow = useCallback10((property) => {
|
|
2271
|
-
|
|
2265
|
+
setExpandedField(void 0);
|
|
2272
2266
|
projection.showFieldProjection(property);
|
|
2273
2267
|
}, [
|
|
2274
2268
|
projection
|
|
2275
2269
|
]);
|
|
2276
2270
|
return /* @__PURE__ */ React15.createElement("div", {
|
|
2277
2271
|
role: "none",
|
|
2278
|
-
className:
|
|
2279
|
-
}, readonly && /* @__PURE__ */ React15.createElement(
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2272
|
+
className: mx8(classNames)
|
|
2273
|
+
}, readonly && /* @__PURE__ */ React15.createElement(Callout.Root, {
|
|
2274
|
+
valence: "info",
|
|
2275
|
+
classNames: [
|
|
2276
|
+
"is-full mlb-cardSpacingBlock",
|
|
2277
|
+
outerSpacing && "mli-cardSpacingInline"
|
|
2278
|
+
]
|
|
2279
|
+
}, /* @__PURE__ */ React15.createElement(Callout.Title, null, t("system schema description"))), /* @__PURE__ */ React15.createElement(Form, {
|
|
2285
2280
|
autoSave: true,
|
|
2286
2281
|
schema: ViewMetaSchema,
|
|
2287
2282
|
values: viewValues,
|
|
@@ -2291,64 +2286,82 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly: _readonly, sho
|
|
|
2291
2286
|
}), /* @__PURE__ */ React15.createElement("div", {
|
|
2292
2287
|
role: "none",
|
|
2293
2288
|
className: outerSpacing ? cardSpacing3 : "mlb-cardSpacingBlock"
|
|
2294
|
-
}, /* @__PURE__ */ React15.createElement("
|
|
2295
|
-
className:
|
|
2289
|
+
}, /* @__PURE__ */ React15.createElement("h2", {
|
|
2290
|
+
className: mx8(inputTextLabel)
|
|
2296
2291
|
}, t("fields label")), /* @__PURE__ */ React15.createElement(List2.Root, {
|
|
2297
|
-
items: view.fields,
|
|
2292
|
+
items: view.projection.fields,
|
|
2298
2293
|
isItem: Schema2.is(FieldSchema),
|
|
2299
|
-
getId: (
|
|
2300
|
-
readonly,
|
|
2301
|
-
|
|
2302
|
-
}, ({ items: fields }) => /* @__PURE__ */ React15.createElement(React15.Fragment, null, showHeading && /* @__PURE__ */ React15.createElement("
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
}, /* @__PURE__ */ React15.createElement("div", null), /* @__PURE__ */ React15.createElement("div", {
|
|
2306
|
-
className: "flex items-center text-sm"
|
|
2307
|
-
}, t("field path label"))), /* @__PURE__ */ React15.createElement("div", {
|
|
2294
|
+
getId: (field) => field.id,
|
|
2295
|
+
onMove: readonly ? void 0 : handleMove,
|
|
2296
|
+
readonly
|
|
2297
|
+
}, ({ items: fields }) => /* @__PURE__ */ React15.createElement(React15.Fragment, null, showHeading && /* @__PURE__ */ React15.createElement("h3", {
|
|
2298
|
+
className: "text-sm"
|
|
2299
|
+
}, t("field path label")), /* @__PURE__ */ React15.createElement("div", {
|
|
2308
2300
|
role: "list",
|
|
2309
|
-
className:
|
|
2310
|
-
}, fields?.map((
|
|
2311
|
-
key:
|
|
2312
|
-
item:
|
|
2313
|
-
classNames:
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2301
|
+
className: listGrid
|
|
2302
|
+
}, fields?.map((field) => /* @__PURE__ */ React15.createElement(List2.Item, {
|
|
2303
|
+
key: field.id,
|
|
2304
|
+
item: field,
|
|
2305
|
+
classNames: listItemGrid,
|
|
2306
|
+
"aria-expanded": expandedField === field.id
|
|
2307
|
+
}, /* @__PURE__ */ React15.createElement("div", {
|
|
2308
|
+
role: "none",
|
|
2309
|
+
className: mx8(subtleHover2, listItemGrid, "rounded-sm cursor-pointer min-bs-10")
|
|
2310
|
+
}, /* @__PURE__ */ React15.createElement(List2.ItemDragHandle, {
|
|
2311
|
+
disabled: readonly
|
|
2312
|
+
}), /* @__PURE__ */ React15.createElement(List2.ItemTitle, {
|
|
2313
|
+
onClick: () => handleToggleField(field)
|
|
2314
|
+
}, field.path), /* @__PURE__ */ React15.createElement(List2.ItemButton, {
|
|
2315
|
+
label: t("hide field label"),
|
|
2317
2316
|
"data-testid": "hide-field-button",
|
|
2318
2317
|
icon: "ph--eye-slash--regular",
|
|
2318
|
+
autoHide: false,
|
|
2319
2319
|
// TDOO(burdon): Is this the correct test?
|
|
2320
|
-
disabled: view.fields.length <= 1,
|
|
2321
|
-
onClick: () => handleHide(
|
|
2322
|
-
}),
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2320
|
+
disabled: readonly || view.projection.fields.length <= 1,
|
|
2321
|
+
onClick: () => handleHide(field.id)
|
|
2322
|
+
}), /* @__PURE__ */ React15.createElement(List2.ItemDeleteButton, {
|
|
2323
|
+
label: t("delete field label"),
|
|
2324
|
+
autoHide: false,
|
|
2325
|
+
disabled: readonly || view.projection.fields.length <= 1,
|
|
2326
|
+
onClick: () => handleDelete(field.id),
|
|
2327
|
+
"data-testid": "field.delete"
|
|
2328
|
+
}), /* @__PURE__ */ React15.createElement(IconButton4, {
|
|
2329
|
+
iconOnly: true,
|
|
2330
|
+
variant: "ghost",
|
|
2331
|
+
label: t("toggle expand label", {
|
|
2332
|
+
ns: "os"
|
|
2333
|
+
}),
|
|
2334
|
+
icon: expandedField === field.id ? "ph--caret-down--regular" : "ph--caret-right--regular",
|
|
2335
|
+
onClick: () => handleToggleField(field)
|
|
2336
|
+
})), expandedField === field.id && /* @__PURE__ */ React15.createElement("div", {
|
|
2337
|
+
role: "none",
|
|
2338
|
+
className: "col-span-5"
|
|
2339
|
+
}, /* @__PURE__ */ React15.createElement(FieldEditor, {
|
|
2340
|
+
readonly,
|
|
2341
|
+
projection,
|
|
2342
|
+
field,
|
|
2343
|
+
registry,
|
|
2344
|
+
onSave: handleClose
|
|
2345
|
+
}))))))), hiddenProperties.length > 0 && /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement("h2", {
|
|
2346
|
+
className: mx8(inputTextLabel)
|
|
2327
2347
|
}, t("hidden fields label")), /* @__PURE__ */ React15.createElement(List2.Root, {
|
|
2328
2348
|
items: hiddenProperties,
|
|
2329
2349
|
isItem: (item) => typeof item === "string",
|
|
2330
2350
|
getId: (property) => property
|
|
2331
2351
|
}, ({ items: properties }) => /* @__PURE__ */ React15.createElement("div", {
|
|
2332
2352
|
role: "list",
|
|
2333
|
-
className: "
|
|
2353
|
+
className: "grid grid-cols-[1fr_min-content]"
|
|
2334
2354
|
}, properties?.map((property) => /* @__PURE__ */ React15.createElement(List2.Item, {
|
|
2335
2355
|
key: property,
|
|
2336
2356
|
item: property,
|
|
2337
|
-
classNames:
|
|
2338
|
-
}, /* @__PURE__ */ React15.createElement(List2.
|
|
2339
|
-
|
|
2340
|
-
|
|
2357
|
+
classNames: mx8("grid grid-cols-subgrid col-span-2 rounded-sm", subtleHover2)
|
|
2358
|
+
}, /* @__PURE__ */ React15.createElement(List2.ItemTitle, null, property), /* @__PURE__ */ React15.createElement(List2.ItemButton, {
|
|
2359
|
+
label: t("show field label"),
|
|
2360
|
+
disabled: readonly,
|
|
2341
2361
|
icon: "ph--eye--regular",
|
|
2342
2362
|
onClick: () => handleShow(property),
|
|
2343
2363
|
"data-testid": "show-field-button"
|
|
2344
|
-
}))))))),
|
|
2345
|
-
key: field.id,
|
|
2346
|
-
view,
|
|
2347
|
-
projection,
|
|
2348
|
-
field,
|
|
2349
|
-
registry,
|
|
2350
|
-
onSave: handleClose
|
|
2351
|
-
}), !readonly && !field && /* @__PURE__ */ React15.createElement("div", {
|
|
2364
|
+
}))))))), !readonly && !expandedField && /* @__PURE__ */ React15.createElement("div", {
|
|
2352
2365
|
role: "none",
|
|
2353
2366
|
className: outerSpacing ? cardSpacing3 : "mlb-cardSpacingBlock"
|
|
2354
2367
|
}, /* @__PURE__ */ React15.createElement(IconButton4, {
|
|
@@ -2356,8 +2369,8 @@ var ViewEditor = ({ classNames, schema, view, registry, readonly: _readonly, sho
|
|
|
2356
2369
|
label: t("button add property"),
|
|
2357
2370
|
onClick: readonly ? void 0 : handleAdd,
|
|
2358
2371
|
// TODO(burdon): Show field limit in ux (not tooltip).
|
|
2359
|
-
disabled: view.fields.length >= VIEW_FIELD_LIMIT,
|
|
2360
|
-
classNames: "
|
|
2372
|
+
disabled: view.projection.fields.length >= VIEW_FIELD_LIMIT,
|
|
2373
|
+
classNames: "is-full"
|
|
2361
2374
|
})));
|
|
2362
2375
|
} finally {
|
|
2363
2376
|
_effect.f();
|