alinea 2.0.0-preview.7 → 2.0.0-preview.8
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/.init/content/pages/welcome.json +1 -1
- package/dist/LICENSES.md +120 -120
- package/dist/adapter/next/cms.d.ts +18 -4
- package/dist/adapter/next/cms.js +125 -36
- package/dist/adapter/next/handler.d.ts +5 -1
- package/dist/adapter/next/handler.js +14 -7
- package/dist/adapter/next/node.d.ts +5 -0
- package/dist/adapter/next/node.js +16 -0
- package/dist/adapter/next/previews.d.ts +4 -1
- package/dist/adapter/next/previews.js +13 -1
- package/dist/adapter/next/renderStats.d.ts +24 -0
- package/dist/adapter/next/renderStats.js +74 -0
- package/dist/adapter/next/syncCheck.d.ts +8 -2
- package/dist/adapter/next/syncCheck.js +3 -3
- package/dist/adapter/next/with-alinea.js +0 -18
- package/dist/backend/Handler.d.ts +2 -2
- package/dist/backend/Handler.js +33 -12
- package/dist/backend/api/CreateBackend.js +15 -3
- package/dist/backend/api/DatabaseApi.js +22 -135
- package/dist/backend/api/database.js +15 -3
- package/dist/backend/resolver/ParsePreview.d.ts +2 -2
- package/dist/backend/router/NodeHandler.js +2 -0
- package/dist/backend/store/GeneratedDatabase.d.ts +5 -0
- package/dist/backend/store/GeneratedDatabase.js +31 -0
- package/dist/backend/store/GeneratedDatabaseNode.d.ts +4 -0
- package/dist/backend/store/GeneratedDatabaseNode.js +35 -0
- package/dist/backend/util/ORM.js +4 -2
- package/dist/bundled.d.ts +1470 -442
- package/dist/chunks/bun-sqlite-ZZDB7YQQ.js +18 -0
- package/dist/chunks/chunk-2BJ2IFQM.js +1085 -0
- package/dist/chunks/chunk-2PIFHEYR.js +364 -0
- package/dist/chunks/{chunk-X47OVDF3.js → chunk-2U43BB6P.js} +356 -1000
- package/dist/chunks/chunk-76VMZTLN.js +55 -0
- package/dist/chunks/chunk-A42DP5T7.js +94 -0
- package/dist/chunks/chunk-ATF42T2B.js +35 -0
- package/dist/chunks/{chunk-NWQXN4SB.js → chunk-ETBQTP2S.js} +40 -29
- package/dist/chunks/chunk-IL7FJQAY.js +94 -0
- package/dist/chunks/chunk-K62JP6HR.js +22 -0
- package/dist/chunks/chunk-K7LHQXI4.js +103 -0
- package/dist/chunks/chunk-M7KDJEGH.js +495 -0
- package/dist/chunks/chunk-N47Y62CI.js +396 -0
- package/dist/chunks/chunk-NLZLRQ5U.js +100 -0
- package/dist/chunks/chunk-QBPYWU6C.js +24 -0
- package/dist/chunks/{chunk-6P4UVRPH.js → chunk-RWWYUNVX.js} +2 -1
- package/dist/chunks/chunk-TFMUSWGG.js +605 -0
- package/dist/chunks/{chunk-I4GC3E65.js → chunk-UPY2RUZF.js} +0 -1
- package/dist/chunks/chunk-XCZXR3C2.js +112 -0
- package/dist/chunks/chunk-XTWYBWP2.js +81 -0
- package/dist/chunks/node-sqlite-7CSGL27V.js +18 -0
- package/dist/cli/Generate.js +74 -64
- package/dist/cli/Serve.js +1 -1
- package/dist/cli/bin.js +2 -1
- package/dist/cli/generate/CopyStaticFiles.js +17 -14
- package/dist/cli/generate/DevDB.d.ts +22 -5
- package/dist/cli/generate/DevDB.js +136 -24
- package/dist/cli/serve/CreateLocalServer.js +22 -4
- package/dist/cli/serve/LiveReload.d.ts +1 -1
- package/dist/cli/serve/LiveReload.js +3 -0
- package/dist/cloud/CloudRemote.js +2 -1
- package/dist/components/Calendar.js +6 -6
- package/dist/components/Checkbox.js +3 -3
- package/dist/components/ColorSwatchPicker.js +2 -2
- package/dist/components/ComboBox.js +9 -9
- package/dist/components/DateField.js +1 -1
- package/dist/components/DatePicker.js +6 -6
- package/dist/components/DateRangePicker.js +6 -6
- package/dist/components/Disclosure.js +9 -9
- package/dist/components/Label.js +5 -5
- package/dist/components/List.js +33 -33
- package/dist/components/Menu.js +3 -3
- package/dist/components/Modal.js +3 -3
- package/dist/components/MultipleSelect.js +25 -25
- package/dist/components/NumberField.js +6 -6
- package/dist/components/ProgressCircle.js +3 -3
- package/dist/components/RadioGroup.js +2 -2
- package/dist/components/SearchField.js +5 -5
- package/dist/components/Select.js +7 -7
- package/dist/components/Surface.js +2 -2
- package/dist/components/Table.js +6 -6
- package/dist/components/Tabs.js +2 -2
- package/dist/components/TextField.js +6 -6
- package/dist/components/Toggle.js +2 -2
- package/dist/components/Toolbar.js +2 -2
- package/dist/components/Tooltip.js +4 -4
- package/dist/components/Tree.d.ts +2 -1
- package/dist/components/Tree.js +5 -5
- package/dist/core/Document.js +15 -3
- package/dist/core/Entry.d.ts +3 -0
- package/dist/core/Entry.js +4 -0
- package/dist/core/EntrySeed.d.ts +19 -0
- package/dist/core/EntrySeed.js +136 -0
- package/dist/core/Field.d.ts +7 -0
- package/dist/core/Field.js +4 -0
- package/dist/core/Filter.d.ts +40 -2
- package/dist/core/Filter.js +145 -0
- package/dist/core/Graph.d.ts +9 -0
- package/dist/core/ListRow.d.ts +1 -0
- package/dist/core/ListRow.js +1 -0
- package/dist/core/Reference.d.ts +1 -0
- package/dist/core/Root.js +1 -1
- package/dist/core/Scope.d.ts +2 -0
- package/dist/core/Scope.js +16 -1
- package/dist/core/Type.d.ts +2 -1
- package/dist/core/Type.js +13 -1
- package/dist/core/db/EntryAliases.js +1 -11
- package/dist/core/db/EntryReference.d.ts +0 -6
- package/dist/core/db/IndexEvent.d.ts +2 -1
- package/dist/core/db/IndexEvent.js +11 -3
- package/dist/core/db/LinkResolver.d.ts +6 -6
- package/dist/core/db/LinkResolver.js +0 -52
- package/dist/core/db/LocalStore.d.ts +25 -0
- package/dist/core/field/ListField.js +19 -0
- package/dist/core/field/RecordField.js +8 -0
- package/dist/core/field/RichTextField.js +42 -0
- package/dist/core/field/UnionField.js +8 -0
- package/dist/core/source/FSSource.d.ts +14 -2
- package/dist/core/source/FSSource.js +58 -13
- package/dist/core/source/GitUtils.d.ts +4 -0
- package/dist/core/source/GitUtils.js +9 -10
- package/dist/core/source/GithubSource.js +22 -11
- package/dist/core/source/IndexedDBSource.d.ts +2 -1
- package/dist/core/source/IndexedDBSource.js +67 -53
- package/dist/core/source/MemorySource.js +5 -3
- package/dist/core/source/OverlaySource.d.ts +5 -2
- package/dist/core/source/OverlaySource.js +31 -3
- package/dist/core/source/Source.d.ts +3 -0
- package/dist/core/source/Source.js +15 -2
- package/dist/core/source/Tree.d.ts +10 -7
- package/dist/core/source/Tree.js +118 -70
- package/dist/core/source/Utils.js +6 -3
- package/dist/core/util/Arrays.d.ts +1 -0
- package/dist/core/util/Arrays.js +10 -0
- package/dist/core/util/Async.d.ts +7 -0
- package/dist/core/util/Async.js +15 -0
- package/dist/core/util/Checks.js +1 -1
- package/dist/core/util/EntryFilenames.d.ts +22 -1
- package/dist/core/util/EntryFilenames.js +56 -2
- package/dist/core/util/IndexedDB.d.ts +4 -0
- package/dist/core/util/IndexedDB.js +20 -0
- package/dist/core/util/Paths.js +5 -1
- package/dist/dashboard/App.js +3 -3
- package/dist/dashboard/ViewKeys.d.ts +1 -0
- package/dist/dashboard/ViewKeys.js +1 -0
- package/dist/dashboard/app/AccessDenied.js +4 -4
- package/dist/dashboard/app/ActivityStatus.js +11 -11
- package/dist/dashboard/app/AppShell.js +2 -2
- package/dist/dashboard/app/AuthView.js +9 -9
- package/dist/dashboard/app/Badge.js +2 -2
- package/dist/dashboard/app/CompactField.js +10 -10
- package/dist/dashboard/app/DashboardErrorBoundary.js +6 -6
- package/dist/dashboard/app/EntryFields.js +2 -2
- package/dist/dashboard/app/EntryHeader.js +10 -10
- package/dist/dashboard/app/EntryReferences.js +8 -8
- package/dist/dashboard/app/EntrySidebar.js +8 -8
- package/dist/dashboard/app/EntrySidebarPreview.js +11 -11
- package/dist/dashboard/app/EntryTranslationBanner.js +6 -6
- package/dist/dashboard/app/Explorer.js +44 -44
- package/dist/dashboard/app/ExplorerCards.js +30 -30
- package/dist/dashboard/app/ExplorerFileCard.js +17 -17
- package/dist/dashboard/app/ExplorerList.js +14 -14
- package/dist/dashboard/app/ExplorerModal.js +5 -5
- package/dist/dashboard/app/ExplorerTable.js +47 -47
- package/dist/dashboard/app/LinkPicker.js +2 -2
- package/dist/dashboard/app/LocaleMenu.js +6 -6
- package/dist/dashboard/app/SidebarTree.js +76 -40
- package/dist/dashboard/app/WorkspaceMenu.js +10 -10
- package/dist/dashboard/app/WorkspaceRoots.js +27 -27
- package/dist/dashboard/app/editor/FileEditor.js +24 -24
- package/dist/dashboard/app/editor/FilePreview.js +6 -6
- package/dist/dashboard/app/modals/CreateEntry.js +4 -4
- package/dist/dashboard/app/pages/EntryPage.js +15 -15
- package/dist/dashboard/app/pages/RootPage.js +3 -3
- package/dist/dashboard/app/pages/SplashPage.js +47 -47
- package/dist/dashboard/app/pages/UsersPage.js +36 -36
- package/dist/dashboard/app/ui/DashboardModal.js +17 -17
- package/dist/dashboard/app/ui/Rail.js +4 -4
- package/dist/dashboard/atoms/config.d.ts +4 -4
- package/dist/dashboard/atoms/entry.d.ts +8 -9
- package/dist/dashboard/atoms/entry.js +34 -4
- package/dist/dashboard/atoms/explorer.d.ts +2 -0
- package/dist/dashboard/atoms/explorer.js +7 -2
- package/dist/dashboard/boot/Boot.js +2 -3
- package/dist/dashboard/boot/DashboardWorker.d.ts +3 -3
- package/dist/dashboard/boot/DashboardWorker.js +78 -27
- package/dist/dashboard/boot/LoadWorker.js +2 -3
- package/dist/dashboard/icons.d.ts +2 -0
- package/dist/dashboard/icons.js +40 -0
- package/dist/dashboard/plugins/alineaFixturePlugin.js +14 -3
- package/dist/database/BrowserEntryStore.d.ts +30 -0
- package/dist/database/BrowserEntryStore.js +168 -0
- package/dist/database/DatabaseSource.d.ts +13 -0
- package/dist/database/DatabaseSource.js +25 -0
- package/dist/database/DatabaseTables.d.ts +38 -0
- package/dist/database/DatabaseTables.js +53 -0
- package/dist/database/EntryDatabase.d.ts +21 -0
- package/dist/database/EntryDatabase.js +138 -0
- package/dist/database/EntryLayer.d.ts +93 -0
- package/dist/database/EntryLayer.js +459 -0
- package/dist/database/EntryStore.d.ts +60 -0
- package/dist/database/EntryStore.js +269 -0
- package/dist/database/EntryTransaction.d.ts +33 -0
- package/dist/database/EntryTransaction.js +889 -0
- package/dist/database/EntryUrlAliases.d.ts +2 -0
- package/dist/database/EntryUrlAliases.js +69 -0
- package/dist/database/LocalDB.d.ts +39 -0
- package/dist/database/LocalDB.js +79 -0
- package/dist/database/Version.d.ts +9 -0
- package/dist/database/Version.js +13 -0
- package/dist/database/driver/RuntimeDatabase.d.ts +8 -0
- package/dist/database/driver/RuntimeDatabase.js +33 -0
- package/dist/database/driver/WasmDatabase.d.ts +8 -0
- package/dist/database/driver/WasmDatabase.js +33 -0
- package/dist/database/entry/EntryData.d.ts +13 -0
- package/dist/database/entry/EntryData.js +51 -0
- package/dist/database/entry/EntryTable.d.ts +173 -0
- package/dist/database/entry/EntryTable.js +137 -0
- package/dist/database/entry/EntryView.d.ts +22 -0
- package/dist/database/entry/EntryView.js +106 -0
- package/dist/database/query/Condition.d.ts +8 -0
- package/dist/database/query/Condition.js +117 -0
- package/dist/database/query/EntryQuery.d.ts +43 -0
- package/dist/database/query/EntryQuery.js +414 -0
- package/dist/database/query/EntryReferences.d.ts +6 -0
- package/dist/database/query/EntryReferences.js +68 -0
- package/dist/database/query/Relation.d.ts +11 -0
- package/dist/database/query/Relation.js +113 -0
- package/dist/database/query/ResolveQuery.d.ts +15 -0
- package/dist/database/query/ResolveQuery.js +154 -0
- package/dist/database/query/Search.d.ts +47 -0
- package/dist/database/query/Search.js +169 -0
- package/dist/database/sync/Derive.d.ts +8 -0
- package/dist/database/sync/Derive.js +270 -0
- package/dist/database/sync/EntryParser.d.ts +4 -0
- package/dist/database/sync/EntryParser.js +87 -0
- package/dist/database/sync/EntrySyncer.d.ts +37 -0
- package/dist/database/sync/EntrySyncer.js +117 -0
- package/dist/database/sync/Ingest.d.ts +21 -0
- package/dist/database/sync/Ingest.js +136 -0
- package/dist/database/sync/SyncQueries.d.ts +157 -0
- package/dist/database/sync/SyncQueries.js +192 -0
- package/dist/field/code/CodeField.view.js +12 -12
- package/dist/field/link/LinkField.js +23 -0
- package/dist/field/link/LinkField.view.js +41 -40
- package/dist/field/list/ListField.view.js +177 -155
- package/dist/field/metadata/MetadataField.d.ts +28 -3
- package/dist/field/metadata/MetadataField.js +44 -7
- package/dist/field/metadata/MetadataField.view.d.ts +5 -0
- package/dist/field/metadata/MetadataField.view.js +34 -19
- package/dist/field/richtext/RichTextBlock.js +2 -2
- package/dist/field/richtext/RichTextDocument.js +4 -3
- package/dist/field/richtext/RichTextExtensions.d.ts +1 -1
- package/dist/field/richtext/RichTextExtensions.js +32 -28
- package/dist/field/richtext/RichTextField.view.js +15 -6
- package/dist/field/views.js +2 -0
- package/dist/next.cjs +0 -18
- package/dist/next.d.ts +4 -3
- package/dist/next.edge.d.ts +1 -1
- package/dist/next.js +1 -2
- package/dist/picker/entry/EntryPicker.js +2 -1
- package/dist/picker/url/UrlPicker.js +1 -0
- package/dist/preview/widget.d.ts +16 -0
- package/dist/preview/widget.js +70 -1
- package/dist/query.d.ts +28 -0
- package/package.json +2 -1
- package/dist/backend/store/GeneratedSource.d.ts +0 -2
- package/dist/backend/store/GeneratedSource.js +0 -21
- package/dist/chunks/chunk-G6E35DMJ.js +0 -1997
- package/dist/core/db/EntryDB.d.ts +0 -19
- package/dist/core/db/EntryDB.js +0 -48
- package/dist/core/db/EntryIndex.d.ts +0 -143
- package/dist/core/db/EntryIndex.js +0 -2773
- package/dist/core/db/EntryReferenceIndex.d.ts +0 -21
- package/dist/core/db/EntryReferenceIndex.js +0 -131
- package/dist/core/db/EntryResolver.d.ts +0 -56
- package/dist/core/db/EntryResolver.js +0 -699
- package/dist/core/db/EntryTarget.d.ts +0 -5
- package/dist/core/db/EntryTransaction.d.ts +0 -31
- package/dist/core/db/EntryTransaction.js +0 -956
- package/dist/core/db/LocalDB.d.ts +0 -42
- package/dist/core/db/LocalDB.js +0 -127
- package/dist/core/db/TestDB.d.ts +0 -19
- package/dist/core/db/TestDB.js +0 -50
- /package/dist/core/db/{EntryTarget.js → LocalStore.js} +0 -0
|
@@ -87,6 +87,8 @@ import { SlugField } from "alinea/field/path/SlugField";
|
|
|
87
87
|
import {
|
|
88
88
|
createContext,
|
|
89
89
|
Fragment,
|
|
90
|
+
memo,
|
|
91
|
+
useCallback,
|
|
90
92
|
useContext,
|
|
91
93
|
useMemo,
|
|
92
94
|
useRef,
|
|
@@ -95,29 +97,29 @@ import {
|
|
|
95
97
|
|
|
96
98
|
// src/field/list/ListField.module.css
|
|
97
99
|
var ListField_default = {
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
+
"ListFieldTypePicker-dialog": "alinea-ListFieldTypePicker-dialog",
|
|
101
|
+
"ListFieldTypePickerDialog": "alinea-ListFieldTypePicker-dialog",
|
|
102
|
+
"ListFieldTypePicker-list": "alinea-ListFieldTypePicker-list",
|
|
103
|
+
"ListFieldTypePickerList": "alinea-ListFieldTypePicker-list",
|
|
100
104
|
"ListFieldView-rowDropTarget": "alinea-ListFieldView-rowDropTarget",
|
|
101
105
|
"ListFieldViewRowDropTarget": "alinea-ListFieldView-rowDropTarget",
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"ListFieldViewInsertAction": "alinea-ListFieldView-insertAction",
|
|
105
|
-
"ListFieldView-dropIndicator": "alinea-ListFieldView-dropIndicator",
|
|
106
|
-
"ListFieldViewDropIndicator": "alinea-ListFieldView-dropIndicator",
|
|
106
|
+
"ListFieldTypePicker-search": "alinea-ListFieldTypePicker-search",
|
|
107
|
+
"ListFieldTypePickerSearch": "alinea-ListFieldTypePicker-search",
|
|
107
108
|
"ListFieldTypePicker-trigger": "alinea-ListFieldTypePicker-trigger",
|
|
108
109
|
"ListFieldTypePickerTrigger": "alinea-ListFieldTypePicker-trigger",
|
|
109
|
-
"
|
|
110
|
-
"
|
|
111
|
-
"ListFieldTypePicker-list": "alinea-ListFieldTypePicker-list",
|
|
112
|
-
"ListFieldTypePickerList": "alinea-ListFieldTypePicker-list",
|
|
113
|
-
"ListFieldTypePicker-dialog": "alinea-ListFieldTypePicker-dialog",
|
|
114
|
-
"ListFieldTypePickerDialog": "alinea-ListFieldTypePicker-dialog",
|
|
110
|
+
"ListFieldView-insertAction": "alinea-ListFieldView-insertAction",
|
|
111
|
+
"ListFieldViewInsertAction": "alinea-ListFieldView-insertAction",
|
|
115
112
|
"ListFieldTypePicker-item": "alinea-ListFieldTypePicker-item",
|
|
116
113
|
"ListFieldTypePickerItem": "alinea-ListFieldTypePicker-item",
|
|
117
|
-
"
|
|
118
|
-
"
|
|
114
|
+
"ListFieldCreateActions-button": "alinea-ListFieldCreateActions-button",
|
|
115
|
+
"ListFieldCreateActionsButton": "alinea-ListFieldCreateActions-button",
|
|
116
|
+
"ListFieldView-dropIndicator": "alinea-ListFieldView-dropIndicator",
|
|
117
|
+
"ListFieldViewDropIndicator": "alinea-ListFieldView-dropIndicator",
|
|
118
|
+
"ListFieldCreateActions": "alinea-ListFieldCreateActions",
|
|
119
119
|
"ListFieldTypePicker-empty": "alinea-ListFieldTypePicker-empty",
|
|
120
|
-
"ListFieldTypePickerEmpty": "alinea-ListFieldTypePicker-empty"
|
|
120
|
+
"ListFieldTypePickerEmpty": "alinea-ListFieldTypePicker-empty",
|
|
121
|
+
"ListFieldTypePicker-popover": "alinea-ListFieldTypePicker-popover",
|
|
122
|
+
"ListFieldTypePickerPopover": "alinea-ListFieldTypePicker-popover"
|
|
121
123
|
};
|
|
122
124
|
|
|
123
125
|
// src/field/list/ListField.view.tsx
|
|
@@ -191,14 +193,28 @@ function ListFieldView({ field }) {
|
|
|
191
193
|
function toggleAll() {
|
|
192
194
|
setFoldedIds(allExpanded ? new Set(rowIds) : /* @__PURE__ */ new Set());
|
|
193
195
|
}
|
|
194
|
-
|
|
196
|
+
const toggleRow = useCallback((rowId) => {
|
|
195
197
|
setFoldedIds((current) => {
|
|
196
198
|
const next = new Set(current);
|
|
197
199
|
if (next.has(rowId)) next.delete(rowId);
|
|
198
200
|
else next.add(rowId);
|
|
199
201
|
return next;
|
|
200
202
|
});
|
|
201
|
-
}
|
|
203
|
+
}, []);
|
|
204
|
+
const endRowDrag = useCallback(() => {
|
|
205
|
+
setDraggingRowId(null);
|
|
206
|
+
setDropIndicator(null);
|
|
207
|
+
}, []);
|
|
208
|
+
const changeDropIndicator = useCallback(
|
|
209
|
+
(index, position) => {
|
|
210
|
+
setDropIndicator((current) => {
|
|
211
|
+
if (current?.index === index && current.position === position)
|
|
212
|
+
return current;
|
|
213
|
+
return position ? { index, position } : null;
|
|
214
|
+
});
|
|
215
|
+
},
|
|
216
|
+
[]
|
|
217
|
+
);
|
|
202
218
|
function addRow(typeName, type) {
|
|
203
219
|
pushRow(createRow(typeName, type));
|
|
204
220
|
}
|
|
@@ -223,21 +239,18 @@ function ListFieldView({ field }) {
|
|
|
223
239
|
/* @__PURE__ */ jsx(
|
|
224
240
|
ListFieldRow,
|
|
225
241
|
{
|
|
226
|
-
addBetweenRow: (value, position = "after") => insertRow(insertIndex(index, position), value),
|
|
227
242
|
canCreate,
|
|
228
243
|
draggingRowId,
|
|
229
|
-
foldedIds,
|
|
244
|
+
expanded: !foldedIds.has(rowIds[index]),
|
|
230
245
|
index,
|
|
231
246
|
list,
|
|
232
247
|
readOnly,
|
|
233
248
|
onCopyRow: copyRow,
|
|
249
|
+
onInsertRow: insertRow,
|
|
234
250
|
onMoveRow: moveRow,
|
|
235
|
-
onRowDragEnd:
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
},
|
|
239
|
-
onRowDragStart: () => setDraggingRowId(rowIds[index] ?? null),
|
|
240
|
-
onDropIndicatorChange: (position) => setDropIndicator(position ? { index, position } : null),
|
|
251
|
+
onRowDragEnd: endRowDrag,
|
|
252
|
+
onRowDragStart: setDraggingRowId,
|
|
253
|
+
onDropIndicatorChange: changeDropIndicator,
|
|
241
254
|
onToggleRow: toggleRow,
|
|
242
255
|
row,
|
|
243
256
|
rows: nodes.length,
|
|
@@ -444,9 +457,10 @@ function ListFieldInsertPanel({
|
|
|
444
457
|
)
|
|
445
458
|
] }) });
|
|
446
459
|
}
|
|
447
|
-
|
|
460
|
+
var ListFieldRow = memo(function ListFieldRow2({
|
|
448
461
|
canCreate,
|
|
449
462
|
draggingRowId,
|
|
463
|
+
expanded,
|
|
450
464
|
index,
|
|
451
465
|
list,
|
|
452
466
|
readOnly,
|
|
@@ -455,14 +469,13 @@ function ListFieldRow({
|
|
|
455
469
|
schema,
|
|
456
470
|
typeItems,
|
|
457
471
|
pasted,
|
|
458
|
-
foldedIds,
|
|
459
472
|
onToggleRow,
|
|
460
473
|
onCopyRow,
|
|
474
|
+
onInsertRow,
|
|
461
475
|
onMoveRow,
|
|
462
476
|
onRowDragEnd,
|
|
463
477
|
onRowDragStart,
|
|
464
|
-
onDropIndicatorChange
|
|
465
|
-
addBetweenRow
|
|
478
|
+
onDropIndicatorChange
|
|
466
479
|
}) {
|
|
467
480
|
const itemId = useAtomValueRaw(row.field("_id"));
|
|
468
481
|
const typeName = useAtomValueRaw(row.field("_type"));
|
|
@@ -483,7 +496,7 @@ function ListFieldRow({
|
|
|
483
496
|
return ["move"];
|
|
484
497
|
},
|
|
485
498
|
onDragEnd: onRowDragEnd,
|
|
486
|
-
onDragStart: onRowDragStart,
|
|
499
|
+
onDragStart: () => onRowDragStart(itemId),
|
|
487
500
|
isDisabled: readOnly,
|
|
488
501
|
preview: dragPreview
|
|
489
502
|
});
|
|
@@ -500,19 +513,19 @@ function ListFieldRow({
|
|
|
500
513
|
},
|
|
501
514
|
onDropEnter(event) {
|
|
502
515
|
const position = rowDropPosition(rowRef.current, event.y);
|
|
503
|
-
onDropIndicatorChange(position);
|
|
516
|
+
onDropIndicatorChange(index, position);
|
|
504
517
|
},
|
|
505
518
|
onDropMove(event) {
|
|
506
519
|
const position = rowDropPosition(rowRef.current, event.y);
|
|
507
|
-
onDropIndicatorChange(position);
|
|
520
|
+
onDropIndicatorChange(index, position);
|
|
508
521
|
},
|
|
509
522
|
onDropExit() {
|
|
510
|
-
onDropIndicatorChange(null);
|
|
523
|
+
onDropIndicatorChange(index, null);
|
|
511
524
|
},
|
|
512
525
|
async onDrop(event) {
|
|
513
526
|
const position = rowDropPosition(rowRef.current, event.y);
|
|
514
527
|
const rowId = await getDraggedRowId(event.items, LIST_FIELD_ROW_DRAG_TYPE);
|
|
515
|
-
onDropIndicatorChange(null);
|
|
528
|
+
onDropIndicatorChange(index, null);
|
|
516
529
|
if (!rowId) return;
|
|
517
530
|
onMoveRow(rowId, insertIndex(index, position));
|
|
518
531
|
}
|
|
@@ -521,7 +534,6 @@ function ListFieldRow({
|
|
|
521
534
|
if (!type) return null;
|
|
522
535
|
const label = Type.label(type);
|
|
523
536
|
const typeIcon = getType(type).icon;
|
|
524
|
-
const expanded = !foldedIds.has(itemId);
|
|
525
537
|
function moveCurrentRow(direction) {
|
|
526
538
|
moveListRow(index, index + direction);
|
|
527
539
|
}
|
|
@@ -573,8 +585,8 @@ function ListFieldRow({
|
|
|
573
585
|
onCustomLabelChange: updateCustomLabel,
|
|
574
586
|
onCopy: () => onCopyRow(itemId),
|
|
575
587
|
onDelete: deleteRow,
|
|
576
|
-
onInsertBefore: (value) =>
|
|
577
|
-
onInsertAfter: (value) =>
|
|
588
|
+
onInsertBefore: (value) => onInsertRow(insertIndex(index, "before"), value),
|
|
589
|
+
onInsertAfter: (value) => onInsertRow(insertIndex(index, "after"), value),
|
|
578
590
|
onMoveDown: () => moveCurrentRow(1),
|
|
579
591
|
onMoveUp: () => moveCurrentRow(-1),
|
|
580
592
|
onToggle: () => onToggleRow(itemId)
|
|
@@ -586,7 +598,7 @@ function ListFieldRow({
|
|
|
586
598
|
)
|
|
587
599
|
}
|
|
588
600
|
) });
|
|
589
|
-
}
|
|
601
|
+
});
|
|
590
602
|
function ListFieldDropIndicator({ active }) {
|
|
591
603
|
return /* @__PURE__ */ jsx(
|
|
592
604
|
"div",
|
|
@@ -663,134 +675,144 @@ function ListFieldRowHeader({
|
|
|
663
675
|
] })
|
|
664
676
|
] }) }),
|
|
665
677
|
/* @__PURE__ */ jsxs(ListRowActions, { children: [
|
|
666
|
-
/* @__PURE__ */ jsxs(
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
),
|
|
676
|
-
/* @__PURE__ */ jsx(Popover, { placement: "bottom right", children: insertPosition ? /* @__PURE__ */ jsx(
|
|
677
|
-
ListFieldInsertPanel,
|
|
678
|
-
{
|
|
679
|
-
items: insertItems,
|
|
680
|
-
label: `Insert ${insertPosition}`,
|
|
681
|
-
pasted,
|
|
682
|
-
pasteLabel: pasted ? pasteBlockLabel(pasted, insertItems) : void 0,
|
|
683
|
-
onPaste: (row) => {
|
|
684
|
-
if (insertPosition === "before") onInsertBefore(cloneRow(row));
|
|
685
|
-
else onInsertAfter(cloneRow(row));
|
|
686
|
-
closeActions();
|
|
687
|
-
},
|
|
688
|
-
onSelect: (item) => {
|
|
689
|
-
const row = createRow(item.id, item.type);
|
|
690
|
-
if (insertPosition === "before") onInsertBefore(row);
|
|
691
|
-
else onInsertAfter(row);
|
|
692
|
-
closeActions();
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
) : /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
696
|
-
/* @__PURE__ */ jsxs(ListRowSettings, { children: [
|
|
697
|
-
/* @__PURE__ */ jsx(
|
|
698
|
-
TextField,
|
|
699
|
-
{
|
|
700
|
-
label: "Label",
|
|
701
|
-
autoFocus: true,
|
|
702
|
-
isDisabled: readOnly || isPreview,
|
|
703
|
-
onChange: onCustomLabelChange,
|
|
704
|
-
value: customLabel
|
|
705
|
-
}
|
|
706
|
-
),
|
|
678
|
+
/* @__PURE__ */ jsxs(
|
|
679
|
+
DialogTrigger,
|
|
680
|
+
{
|
|
681
|
+
isOpen: actionsOpen,
|
|
682
|
+
onOpenChange: (isOpen) => {
|
|
683
|
+
if (isOpen) setActionsOpen(true);
|
|
684
|
+
else closeActions();
|
|
685
|
+
},
|
|
686
|
+
children: [
|
|
707
687
|
/* @__PURE__ */ jsx(
|
|
708
|
-
SlugField,
|
|
709
|
-
{
|
|
710
|
-
fieldValue: anchor,
|
|
711
|
-
label: "Anchor",
|
|
712
|
-
isDisabled: readOnly || isPreview,
|
|
713
|
-
onChange: onAnchorChange,
|
|
714
|
-
source: customLabel
|
|
715
|
-
}
|
|
716
|
-
)
|
|
717
|
-
] }),
|
|
718
|
-
/* @__PURE__ */ jsx(MenuSeparator, {}),
|
|
719
|
-
/* @__PURE__ */ jsx(ListRowSettings, { actions: true, children: /* @__PURE__ */ jsxs(
|
|
720
|
-
Button,
|
|
721
|
-
{
|
|
722
|
-
appearance: "plain",
|
|
723
|
-
onPress: () => {
|
|
724
|
-
onCopy?.();
|
|
725
|
-
closeActions();
|
|
726
|
-
},
|
|
727
|
-
children: [
|
|
728
|
-
/* @__PURE__ */ jsx(Icon, { icon: IcBaselineContentCopy }),
|
|
729
|
-
"Copy"
|
|
730
|
-
]
|
|
731
|
-
}
|
|
732
|
-
) }),
|
|
733
|
-
/* @__PURE__ */ jsx(MenuSeparator, {}),
|
|
734
|
-
/* @__PURE__ */ jsxs(ListRowSettings, { actions: true, children: [
|
|
735
|
-
!isFirstRow && /* @__PURE__ */ jsxs(
|
|
736
688
|
Button,
|
|
737
689
|
{
|
|
738
690
|
appearance: "plain",
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
},
|
|
743
|
-
children: [
|
|
744
|
-
/* @__PURE__ */ jsx(Icon, { icon: IcRoundArrowUpward }),
|
|
745
|
-
"Move up"
|
|
746
|
-
]
|
|
691
|
+
"aria-label": `${label} actions`,
|
|
692
|
+
icon: IcRoundMoreHoriz,
|
|
693
|
+
size: "icon-small"
|
|
747
694
|
}
|
|
748
695
|
),
|
|
749
|
-
|
|
750
|
-
|
|
696
|
+
/* @__PURE__ */ jsx(Popover, { placement: "bottom right", children: insertPosition ? /* @__PURE__ */ jsx(
|
|
697
|
+
ListFieldInsertPanel,
|
|
751
698
|
{
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
699
|
+
items: insertItems,
|
|
700
|
+
label: `Insert ${insertPosition}`,
|
|
701
|
+
pasted,
|
|
702
|
+
pasteLabel: pasted ? pasteBlockLabel(pasted, insertItems) : void 0,
|
|
703
|
+
onPaste: (row) => {
|
|
704
|
+
if (insertPosition === "before") onInsertBefore(cloneRow(row));
|
|
705
|
+
else onInsertAfter(cloneRow(row));
|
|
755
706
|
closeActions();
|
|
756
707
|
},
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
"
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
),
|
|
763
|
-
canInsert && /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
764
|
-
/* @__PURE__ */ jsx(
|
|
765
|
-
ListFieldInsertAction,
|
|
766
|
-
{
|
|
767
|
-
icon: IcRoundFirstPage,
|
|
768
|
-
isDisabled: Boolean(readOnly || isPreview),
|
|
769
|
-
items: insertItems,
|
|
770
|
-
label: "Insert before",
|
|
771
|
-
pasted,
|
|
772
|
-
onClose: closeActions,
|
|
773
|
-
onOpenPicker: () => setInsertPosition("before"),
|
|
774
|
-
onSelect: (item) => onInsertBefore(createRow(item.id, item.type))
|
|
708
|
+
onSelect: (item) => {
|
|
709
|
+
const row = createRow(item.id, item.type);
|
|
710
|
+
if (insertPosition === "before") onInsertBefore(row);
|
|
711
|
+
else onInsertAfter(row);
|
|
712
|
+
closeActions();
|
|
775
713
|
}
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
714
|
+
}
|
|
715
|
+
) : /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
716
|
+
/* @__PURE__ */ jsxs(ListRowSettings, { children: [
|
|
717
|
+
/* @__PURE__ */ jsx(
|
|
718
|
+
TextField,
|
|
719
|
+
{
|
|
720
|
+
label: "Label",
|
|
721
|
+
autoFocus: true,
|
|
722
|
+
isDisabled: readOnly || isPreview,
|
|
723
|
+
onChange: onCustomLabelChange,
|
|
724
|
+
value: customLabel
|
|
725
|
+
}
|
|
726
|
+
),
|
|
727
|
+
/* @__PURE__ */ jsx(
|
|
728
|
+
SlugField,
|
|
729
|
+
{
|
|
730
|
+
fieldValue: anchor,
|
|
731
|
+
label: "Anchor",
|
|
732
|
+
isDisabled: readOnly || isPreview,
|
|
733
|
+
onChange: onAnchorChange,
|
|
734
|
+
source: customLabel
|
|
735
|
+
}
|
|
736
|
+
)
|
|
737
|
+
] }),
|
|
738
|
+
/* @__PURE__ */ jsx(MenuSeparator, {}),
|
|
739
|
+
/* @__PURE__ */ jsx(ListRowSettings, { actions: true, children: /* @__PURE__ */ jsxs(
|
|
740
|
+
Button,
|
|
779
741
|
{
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
742
|
+
appearance: "plain",
|
|
743
|
+
onPress: () => {
|
|
744
|
+
onCopy?.();
|
|
745
|
+
closeActions();
|
|
746
|
+
},
|
|
747
|
+
children: [
|
|
748
|
+
/* @__PURE__ */ jsx(Icon, { icon: IcBaselineContentCopy }),
|
|
749
|
+
"Copy"
|
|
750
|
+
]
|
|
788
751
|
}
|
|
789
|
-
)
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
752
|
+
) }),
|
|
753
|
+
/* @__PURE__ */ jsx(MenuSeparator, {}),
|
|
754
|
+
/* @__PURE__ */ jsxs(ListRowSettings, { actions: true, children: [
|
|
755
|
+
!isFirstRow && /* @__PURE__ */ jsxs(
|
|
756
|
+
Button,
|
|
757
|
+
{
|
|
758
|
+
appearance: "plain",
|
|
759
|
+
onPress: () => {
|
|
760
|
+
onMoveUp?.();
|
|
761
|
+
closeActions();
|
|
762
|
+
},
|
|
763
|
+
children: [
|
|
764
|
+
/* @__PURE__ */ jsx(Icon, { icon: IcRoundArrowUpward }),
|
|
765
|
+
"Move up"
|
|
766
|
+
]
|
|
767
|
+
}
|
|
768
|
+
),
|
|
769
|
+
!isLastRow && /* @__PURE__ */ jsxs(
|
|
770
|
+
Button,
|
|
771
|
+
{
|
|
772
|
+
appearance: "plain",
|
|
773
|
+
onPress: () => {
|
|
774
|
+
onMoveDown?.();
|
|
775
|
+
closeActions();
|
|
776
|
+
},
|
|
777
|
+
children: [
|
|
778
|
+
/* @__PURE__ */ jsx(Icon, { icon: IcRoundArrowDownward }),
|
|
779
|
+
"Move down"
|
|
780
|
+
]
|
|
781
|
+
}
|
|
782
|
+
),
|
|
783
|
+
canInsert && /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
784
|
+
/* @__PURE__ */ jsx(
|
|
785
|
+
ListFieldInsertAction,
|
|
786
|
+
{
|
|
787
|
+
icon: IcRoundFirstPage,
|
|
788
|
+
isDisabled: Boolean(readOnly || isPreview),
|
|
789
|
+
items: insertItems,
|
|
790
|
+
label: "Insert before",
|
|
791
|
+
pasted,
|
|
792
|
+
onClose: closeActions,
|
|
793
|
+
onOpenPicker: () => setInsertPosition("before"),
|
|
794
|
+
onSelect: (item) => onInsertBefore(createRow(item.id, item.type))
|
|
795
|
+
}
|
|
796
|
+
),
|
|
797
|
+
/* @__PURE__ */ jsx(
|
|
798
|
+
ListFieldInsertAction,
|
|
799
|
+
{
|
|
800
|
+
icon: IcRoundLastPage,
|
|
801
|
+
isDisabled: Boolean(readOnly || isPreview),
|
|
802
|
+
items: insertItems,
|
|
803
|
+
label: "Insert after",
|
|
804
|
+
pasted,
|
|
805
|
+
onClose: closeActions,
|
|
806
|
+
onOpenPicker: () => setInsertPosition("after"),
|
|
807
|
+
onSelect: (item) => onInsertAfter(createRow(item.id, item.type))
|
|
808
|
+
}
|
|
809
|
+
)
|
|
810
|
+
] })
|
|
811
|
+
] })
|
|
812
|
+
] }) })
|
|
813
|
+
]
|
|
814
|
+
}
|
|
815
|
+
),
|
|
794
816
|
/* @__PURE__ */ jsx(
|
|
795
817
|
Button,
|
|
796
818
|
{
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { FieldOptions } from 'alinea/core/Field';
|
|
2
2
|
import { RecordField } from 'alinea/core/field/RecordField';
|
|
3
3
|
import { ScalarField } from 'alinea/core/field/ScalarField';
|
|
4
|
+
import { type Section, type SectionData } from 'alinea/core/Section';
|
|
4
5
|
import { Type } from 'alinea/core/Type';
|
|
5
6
|
import { type ImageField, type ImageLink } from 'alinea/field/link';
|
|
6
7
|
import { type ObjectField } from 'alinea/field/object';
|
|
@@ -13,19 +14,23 @@ export interface MetadataTimestampOptions extends FieldOptions<number | null> {
|
|
|
13
14
|
export interface MetadataUserOptions extends FieldOptions<MetadataAuditUser> {
|
|
14
15
|
width?: number;
|
|
15
16
|
}
|
|
16
|
-
export interface
|
|
17
|
+
export interface MetadataSeoFields {
|
|
17
18
|
title: TextField;
|
|
18
19
|
description: TextField;
|
|
19
|
-
aliases: AliasesField;
|
|
20
20
|
openGraph: ObjectField<{
|
|
21
21
|
image: ImageField;
|
|
22
22
|
title: TextField;
|
|
23
23
|
description: TextField;
|
|
24
24
|
}>;
|
|
25
|
+
}
|
|
26
|
+
export interface MetadataDetailsFields {
|
|
25
27
|
createdAt: MetadataTimestampField;
|
|
26
28
|
createdBy: MetadataUserField;
|
|
27
29
|
updatedAt: MetadataTimestampField;
|
|
28
30
|
updatedBy: MetadataUserField;
|
|
31
|
+
aliases: AliasesField;
|
|
32
|
+
}
|
|
33
|
+
export interface MetadataFields extends MetadataSeoFields, MetadataDetailsFields {
|
|
29
34
|
}
|
|
30
35
|
export interface MetadataAuditUser {
|
|
31
36
|
name: string;
|
|
@@ -47,6 +52,15 @@ export interface Metadata {
|
|
|
47
52
|
}
|
|
48
53
|
export interface MetadataOptions extends FieldOptions<Metadata> {
|
|
49
54
|
fields: Type<MetadataFields>;
|
|
55
|
+
seo: Type<MetadataSeoFields>;
|
|
56
|
+
details: Type<MetadataDetailsFields>;
|
|
57
|
+
/** The details are rendered by a separate `metadataDetails` section */
|
|
58
|
+
detailsSection?: boolean;
|
|
59
|
+
}
|
|
60
|
+
export interface MetadataConfig {
|
|
61
|
+
/** Leave the details out of the field view, render them with
|
|
62
|
+
* `metadataDetails(field)` instead */
|
|
63
|
+
detailsSection?: boolean;
|
|
50
64
|
}
|
|
51
65
|
export declare class MetadataField extends RecordField<Metadata, MetadataOptions> {
|
|
52
66
|
}
|
|
@@ -56,4 +70,15 @@ export declare class MetadataTimestampField extends ScalarField<number | null, M
|
|
|
56
70
|
}
|
|
57
71
|
export declare class MetadataUserField extends ScalarField<MetadataAuditUser, MetadataUserOptions> {
|
|
58
72
|
}
|
|
59
|
-
export declare function metadata(label?: string): MetadataField;
|
|
73
|
+
export declare function metadata(label?: string, { detailsSection }?: MetadataConfig): MetadataField;
|
|
74
|
+
export declare class MetadataDetailsSection implements SectionData {
|
|
75
|
+
field: MetadataField;
|
|
76
|
+
view: string;
|
|
77
|
+
definition: {};
|
|
78
|
+
fields: {};
|
|
79
|
+
sections: never[];
|
|
80
|
+
constructor(field: MetadataField);
|
|
81
|
+
}
|
|
82
|
+
/** Renders the created/updated details and aliases of a metadata field
|
|
83
|
+
* created with `detailsSection: true` */
|
|
84
|
+
export declare function metadataDetails(field: MetadataField): Section;
|
|
@@ -3,6 +3,7 @@ import "../../chunks/chunk-CQ52GEHY.js";
|
|
|
3
3
|
// src/field/metadata/MetadataField.ts
|
|
4
4
|
import { RecordField } from "alinea/core/field/RecordField";
|
|
5
5
|
import { ScalarField } from "alinea/core/field/ScalarField";
|
|
6
|
+
import { section } from "alinea/core/Section";
|
|
6
7
|
import { Type, type } from "alinea/core/Type";
|
|
7
8
|
import { isRecord } from "alinea/core/util/Objects";
|
|
8
9
|
import { viewKeys } from "alinea/dashboard/ViewKeys";
|
|
@@ -21,8 +22,8 @@ var MetadataTimestampField = class extends ScalarField {
|
|
|
21
22
|
};
|
|
22
23
|
var MetadataUserField = class extends ScalarField {
|
|
23
24
|
};
|
|
24
|
-
function metadata(label = "Metadata") {
|
|
25
|
-
const
|
|
25
|
+
function metadata(label = "Metadata", { detailsSection } = {}) {
|
|
26
|
+
const seo = type("SEO", {
|
|
26
27
|
fields: {
|
|
27
28
|
title: text("Title"),
|
|
28
29
|
description: text("Description", {
|
|
@@ -32,7 +33,6 @@ function metadata(label = "Metadata") {
|
|
|
32
33
|
if (value.length > 160) return "Too many characters.";
|
|
33
34
|
}
|
|
34
35
|
}),
|
|
35
|
-
aliases: aliases(),
|
|
36
36
|
openGraph: object("Open Graph", {
|
|
37
37
|
fields: {
|
|
38
38
|
image: image("Image", {
|
|
@@ -44,17 +44,39 @@ function metadata(label = "Metadata") {
|
|
|
44
44
|
help: "If empty, default description"
|
|
45
45
|
})
|
|
46
46
|
}
|
|
47
|
-
})
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
const details = type("Details", {
|
|
51
|
+
fields: {
|
|
48
52
|
createdAt: timestamp("Created at"),
|
|
49
53
|
createdBy: user("Created by"),
|
|
50
54
|
updatedAt: timestamp("Updated at"),
|
|
51
|
-
updatedBy: user("Updated by")
|
|
55
|
+
updatedBy: user("Updated by"),
|
|
56
|
+
aliases: aliases()
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
const { title, description, openGraph } = seo;
|
|
60
|
+
const { createdAt, createdBy, updatedAt, updatedBy } = details;
|
|
61
|
+
const fields = type("Fields", {
|
|
62
|
+
fields: {
|
|
63
|
+
title,
|
|
64
|
+
description,
|
|
65
|
+
aliases: details.aliases,
|
|
66
|
+
openGraph,
|
|
67
|
+
createdAt,
|
|
68
|
+
createdBy,
|
|
69
|
+
updatedAt,
|
|
70
|
+
updatedBy
|
|
52
71
|
}
|
|
53
72
|
});
|
|
54
73
|
const result = new MetadataField(fields, {
|
|
55
74
|
options: {
|
|
56
75
|
label,
|
|
57
|
-
fields
|
|
76
|
+
fields,
|
|
77
|
+
seo,
|
|
78
|
+
details,
|
|
79
|
+
detailsSection
|
|
58
80
|
},
|
|
59
81
|
defaultValue() {
|
|
60
82
|
return Type.initialValue(fields);
|
|
@@ -75,6 +97,19 @@ function metadata(label = "Metadata") {
|
|
|
75
97
|
});
|
|
76
98
|
return Object.assign(result, fields);
|
|
77
99
|
}
|
|
100
|
+
var MetadataDetailsSection = class {
|
|
101
|
+
constructor(field) {
|
|
102
|
+
this.field = field;
|
|
103
|
+
}
|
|
104
|
+
field;
|
|
105
|
+
view = viewKeys.MetadataDetailsView;
|
|
106
|
+
definition = {};
|
|
107
|
+
fields = {};
|
|
108
|
+
sections = [];
|
|
109
|
+
};
|
|
110
|
+
function metadataDetails(field) {
|
|
111
|
+
return section(new MetadataDetailsSection(field));
|
|
112
|
+
}
|
|
78
113
|
function timestamp(label) {
|
|
79
114
|
return new MetadataTimestampField({
|
|
80
115
|
options: {
|
|
@@ -145,9 +180,11 @@ function isMetadataAuditUser(value) {
|
|
|
145
180
|
return typeof value.name === "string" && typeof value.email === "string";
|
|
146
181
|
}
|
|
147
182
|
export {
|
|
183
|
+
MetadataDetailsSection,
|
|
148
184
|
MetadataField,
|
|
149
185
|
MetadataTimestampField,
|
|
150
186
|
MetadataUserField,
|
|
151
187
|
aliases2 as aliases,
|
|
152
|
-
metadata
|
|
188
|
+
metadata,
|
|
189
|
+
metadataDetails
|
|
153
190
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Section } from 'alinea/core/Section';
|
|
1
2
|
import { MetadataField, MetadataTimestampField, MetadataUserField } from 'alinea/field/metadata';
|
|
2
3
|
export interface MetadataFieldViewProps {
|
|
3
4
|
field: MetadataField;
|
|
@@ -11,3 +12,7 @@ export interface MetadataUserFieldViewProps {
|
|
|
11
12
|
}
|
|
12
13
|
export declare function MetadataUserFieldView({ field }: MetadataUserFieldViewProps): import("react").JSX.Element;
|
|
13
14
|
export declare function MetadataFieldView({ field }: MetadataFieldViewProps): import("react").JSX.Element;
|
|
15
|
+
export interface MetadataDetailsViewProps {
|
|
16
|
+
section: Section;
|
|
17
|
+
}
|
|
18
|
+
export declare function MetadataDetailsView({ section }: MetadataDetailsViewProps): import("react").JSX.Element;
|