@dxos/plugin-space 0.8.4-main.e098934 → 0.8.4-main.ead640a
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/{CollectionMain-D2B75XBS.mjs → CollectionMain-AX7KKXWP.mjs} +4 -4
- package/dist/lib/browser/CollectionMain-AX7KKXWP.mjs.map +7 -0
- package/dist/lib/browser/ObjectDetailsPanel-MQBHG666.mjs +145 -0
- package/dist/lib/browser/ObjectDetailsPanel-MQBHG666.mjs.map +7 -0
- package/dist/lib/browser/ObjectSettings-KNUZFCGS.mjs +151 -0
- package/dist/lib/browser/ObjectSettings-KNUZFCGS.mjs.map +7 -0
- package/dist/lib/browser/RecordMain-MV535I2C.mjs +119 -0
- package/dist/lib/browser/RecordMain-MV535I2C.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-AFC6PNAB.mjs → app-graph-builder-6SNKPPKD.mjs} +61 -58
- package/dist/lib/browser/app-graph-builder-6SNKPPKD.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-serializer-Q7QG4EKW.mjs → app-graph-serializer-YGUHIKUW.mjs} +14 -14
- package/dist/lib/browser/app-graph-serializer-YGUHIKUW.mjs.map +7 -0
- package/dist/lib/browser/{chunk-WZYRDFW7.mjs → chunk-2IAM4LHT.mjs} +12 -4
- package/dist/lib/browser/chunk-2IAM4LHT.mjs.map +7 -0
- package/dist/lib/browser/{chunk-S33AYKSS.mjs → chunk-AB7EFWFA.mjs} +47 -38
- package/dist/lib/browser/chunk-AB7EFWFA.mjs.map +7 -0
- package/dist/lib/browser/chunk-EIXZABXD.mjs +19 -0
- package/dist/lib/browser/chunk-EIXZABXD.mjs.map +7 -0
- package/dist/lib/browser/chunk-IRKDREHY.mjs +11 -0
- package/dist/lib/browser/chunk-IRKDREHY.mjs.map +7 -0
- package/dist/lib/browser/{chunk-6GRF7NEF.mjs → chunk-KXSDZJ5T.mjs} +258 -289
- package/dist/lib/browser/chunk-KXSDZJ5T.mjs.map +7 -0
- package/dist/lib/browser/chunk-RLI2IAHK.mjs +20 -0
- package/dist/lib/browser/chunk-RLI2IAHK.mjs.map +7 -0
- package/dist/lib/browser/chunk-TIVKWB5L.mjs +166 -0
- package/dist/lib/browser/chunk-TIVKWB5L.mjs.map +7 -0
- package/dist/lib/browser/{chunk-URST7EEN.mjs → chunk-WS2PJDES.mjs} +13 -9
- package/dist/lib/browser/chunk-WS2PJDES.mjs.map +7 -0
- package/dist/lib/browser/{identity-created-T6ZNVE7S.mjs → identity-created-PW2BA46S.mjs} +3 -3
- package/dist/lib/browser/{identity-created-T6ZNVE7S.mjs.map → identity-created-PW2BA46S.mjs.map} +1 -1
- package/dist/lib/browser/index.mjs +34 -31
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-CO262Q44.mjs → intent-resolver-XQSUBM5U.mjs} +30 -28
- package/dist/lib/browser/intent-resolver-XQSUBM5U.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-root-K4IVLFYZ.mjs → react-root-OIXDY6US.mjs} +11 -11
- package/dist/lib/browser/react-root-OIXDY6US.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-TPUOK2LC.mjs → react-surface-I4BQVF7V.mjs} +42 -73
- package/dist/lib/browser/react-surface-I4BQVF7V.mjs.map +7 -0
- package/dist/lib/browser/{schema-defs-YDPFZELA.mjs → schema-defs-7R7RKCAE.mjs} +5 -5
- package/dist/lib/browser/{schema-defs-YDPFZELA.mjs.map → schema-defs-7R7RKCAE.mjs.map} +1 -1
- package/dist/lib/browser/{settings-ZYH2JWNI.mjs → settings-OBFJ67ZG.mjs} +5 -5
- package/dist/lib/browser/{settings-ZYH2JWNI.mjs.map → settings-OBFJ67ZG.mjs.map} +1 -1
- package/dist/lib/browser/{spaces-ready-3I5LISH4.mjs → spaces-ready-6YB55EJK.mjs} +8 -8
- package/dist/lib/browser/spaces-ready-6YB55EJK.mjs.map +7 -0
- package/dist/lib/browser/{state-2RGW7FQG.mjs → state-LSPRFIRO.mjs} +7 -7
- package/dist/lib/browser/state-LSPRFIRO.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +2 -2
- package/dist/lib/node-esm/{CollectionMain-ZJIFCWKZ.mjs → CollectionMain-EU57SRYK.mjs} +4 -4
- package/dist/lib/node-esm/CollectionMain-EU57SRYK.mjs.map +7 -0
- package/dist/lib/node-esm/ObjectDetailsPanel-NABA2S56.mjs +146 -0
- package/dist/lib/node-esm/ObjectDetailsPanel-NABA2S56.mjs.map +7 -0
- package/dist/lib/node-esm/ObjectSettings-GXGTITF5.mjs +152 -0
- package/dist/lib/node-esm/ObjectSettings-GXGTITF5.mjs.map +7 -0
- package/dist/lib/node-esm/RecordMain-ME2BU65P.mjs +120 -0
- package/dist/lib/node-esm/RecordMain-ME2BU65P.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-OW2EBYRI.mjs → app-graph-builder-PYG5N3FB.mjs} +61 -58
- package/dist/lib/node-esm/app-graph-builder-PYG5N3FB.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-serializer-6PGC5WR5.mjs → app-graph-serializer-FVQ2WB3U.mjs} +14 -14
- package/dist/lib/node-esm/app-graph-serializer-FVQ2WB3U.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-RXDT5LA5.mjs → chunk-4F25JKVT.mjs} +13 -9
- package/dist/lib/node-esm/chunk-4F25JKVT.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-LGNPMOXU.mjs → chunk-DNRBVD2G.mjs} +12 -4
- package/dist/lib/node-esm/chunk-DNRBVD2G.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-GHL2523Z.mjs +167 -0
- package/dist/lib/node-esm/chunk-GHL2523Z.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-H5UPFRRH.mjs +21 -0
- package/dist/lib/node-esm/chunk-H5UPFRRH.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-HWNG4MEU.mjs → chunk-MWNATOXL.mjs} +2 -4
- package/dist/lib/node-esm/chunk-MWNATOXL.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-TEUN2E4F.mjs → chunk-QHAVT7PC.mjs} +47 -38
- package/dist/lib/node-esm/chunk-QHAVT7PC.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-SVFKU7EW.mjs +20 -0
- package/dist/lib/node-esm/chunk-SVFKU7EW.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-NMCD2PSG.mjs → chunk-X55EOSEF.mjs} +258 -289
- package/dist/lib/node-esm/chunk-X55EOSEF.mjs.map +7 -0
- package/dist/lib/node-esm/{identity-created-AL7NNCKH.mjs → identity-created-MWTLGQRU.mjs} +3 -3
- package/dist/lib/node-esm/{identity-created-AL7NNCKH.mjs.map → identity-created-MWTLGQRU.mjs.map} +1 -1
- package/dist/lib/node-esm/index.mjs +34 -31
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-EXPK4B76.mjs → intent-resolver-27YPEIWX.mjs} +30 -28
- package/dist/lib/node-esm/intent-resolver-27YPEIWX.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-root-4OQ7MPGW.mjs → react-root-K7YPW753.mjs} +11 -11
- package/dist/lib/node-esm/react-root-K7YPW753.mjs.map +7 -0
- package/dist/lib/node-esm/{react-surface-WXEXIDB7.mjs → react-surface-F5LL3JUY.mjs} +42 -73
- package/dist/lib/node-esm/react-surface-F5LL3JUY.mjs.map +7 -0
- package/dist/lib/node-esm/{schema-defs-OYBCWKAS.mjs → schema-defs-RYG5DSUE.mjs} +5 -5
- package/dist/lib/node-esm/{schema-defs-OYBCWKAS.mjs.map → schema-defs-RYG5DSUE.mjs.map} +1 -1
- package/dist/lib/node-esm/{settings-2RYFMMTP.mjs → settings-QGWWNMMZ.mjs} +5 -5
- package/dist/lib/node-esm/{settings-2RYFMMTP.mjs.map → settings-QGWWNMMZ.mjs.map} +1 -1
- package/dist/lib/node-esm/{spaces-ready-JAP22P57.mjs → spaces-ready-EPHL7RGX.mjs} +8 -8
- package/dist/lib/node-esm/spaces-ready-EPHL7RGX.mjs.map +7 -0
- package/dist/lib/node-esm/{state-7VBVBGNS.mjs → state-TCGOPLRO.mjs} +7 -7
- package/dist/lib/node-esm/state-TCGOPLRO.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +2 -2
- package/dist/types/src/SpacePlugin.d.ts +1 -1
- package/dist/types/src/SpacePlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts +4 -3
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/CreateDialog/CreateObjectDialog.d.ts +1 -1
- package/dist/types/src/components/CreateDialog/CreateObjectDialog.d.ts.map +1 -1
- package/dist/types/src/components/CreateDialog/CreateObjectDialog.stories.d.ts +80 -1
- package/dist/types/src/components/CreateDialog/CreateObjectDialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/CreateDialog/CreateObjectPanel.d.ts +1 -1
- package/dist/types/src/components/CreateDialog/CreateObjectPanel.d.ts.map +1 -1
- package/dist/types/src/components/CreateDialog/CreateSpaceDialog.d.ts +1 -1
- package/dist/types/src/components/CreateDialog/CreateSpaceDialog.d.ts.map +1 -1
- package/dist/types/src/components/JoinDialog.d.ts +1 -1
- package/dist/types/src/components/JoinDialog.d.ts.map +1 -1
- package/dist/types/src/components/MembersContainer.stories.d.ts +80 -1
- package/dist/types/src/components/MembersContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/ObjectDetailsPanel/ObjectDetailsPanel.d.ts +9 -0
- package/dist/types/src/components/ObjectDetailsPanel/ObjectDetailsPanel.d.ts.map +1 -0
- package/dist/types/src/components/ObjectDetailsPanel/ObjectForm.d.ts +10 -0
- package/dist/types/src/components/ObjectDetailsPanel/ObjectForm.d.ts.map +1 -0
- package/dist/types/src/components/ObjectDetailsPanel/index.d.ts +3 -0
- package/dist/types/src/components/ObjectDetailsPanel/index.d.ts.map +1 -0
- package/dist/types/src/components/ObjectSettings/BaseObjectSettings.d.ts +1 -1
- package/dist/types/src/components/ObjectSettings/BaseObjectSettings.d.ts.map +1 -1
- package/dist/types/src/components/ObjectSettings/BaseObjectSettings.stories.d.ts +1500 -0
- package/dist/types/src/components/ObjectSettings/BaseObjectSettings.stories.d.ts.map +1 -0
- package/dist/types/src/components/ObjectSettings/ForeignKeys.d.ts +1 -1
- package/dist/types/src/components/ObjectSettings/ForeignKeys.d.ts.map +1 -1
- package/dist/types/src/components/ObjectSettings/index.d.ts +2 -1
- package/dist/types/src/components/ObjectSettings/index.d.ts.map +1 -1
- package/dist/types/src/components/PopoverRenameObject.d.ts +1 -1
- package/dist/types/src/components/PopoverRenameObject.d.ts.map +1 -1
- package/dist/types/src/components/PopoverRenameSpace.d.ts +1 -1
- package/dist/types/src/components/PopoverRenameSpace.d.ts.map +1 -1
- package/dist/types/src/components/RecordMain.d.ts +1 -1
- package/dist/types/src/components/RecordMain.d.ts.map +1 -1
- package/dist/types/src/components/SpacePresence.stories.d.ts +82 -3
- package/dist/types/src/components/SpacePresence.stories.d.ts.map +1 -1
- package/dist/types/src/components/SpaceSettings/SpaceSettingsContainer.d.ts.map +1 -1
- package/dist/types/src/components/SpaceSettings/SpaceSettingsContainer.stories.d.ts +80 -1
- package/dist/types/src/components/SpaceSettings/SpaceSettingsContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/SyncStatus/SyncStatus.d.ts.map +1 -1
- package/dist/types/src/components/SyncStatus/SyncStatus.stories.d.ts +81 -2
- package/dist/types/src/components/SyncStatus/SyncStatus.stories.d.ts.map +1 -1
- package/dist/types/src/components/ViewEditor.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useInputSurfaceLookup.d.ts +1 -1
- package/dist/types/src/hooks/useInputSurfaceLookup.d.ts.map +1 -1
- package/dist/types/src/hooks/usePath.d.ts +1 -1
- package/dist/types/src/hooks/usePath.d.ts.map +1 -1
- package/dist/types/src/hooks/useTypeOptions.d.ts +10 -0
- package/dist/types/src/hooks/useTypeOptions.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts +0 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +80 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +54 -52
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +6 -3
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +61 -59
- package/src/SpacePlugin.ts +206 -200
- package/src/capabilities/app-graph-builder.ts +53 -46
- package/src/capabilities/app-graph-serializer.ts +7 -7
- package/src/capabilities/capabilities.ts +15 -10
- package/src/capabilities/intent-resolver.ts +19 -19
- package/src/capabilities/react-root.tsx +2 -2
- package/src/capabilities/react-surface.tsx +31 -102
- package/src/capabilities/spaces-ready.ts +1 -1
- package/src/capabilities/state.ts +2 -2
- package/src/components/AwaitingObject.tsx +2 -2
- package/src/components/CollectionMain.tsx +2 -2
- package/src/components/CollectionSection.tsx +2 -2
- package/src/components/CreateDialog/CreateObjectDialog.stories.tsx +5 -5
- package/src/components/CreateDialog/CreateObjectDialog.tsx +8 -7
- package/src/components/CreateDialog/CreateObjectPanel.tsx +6 -6
- package/src/components/CreateDialog/CreateSpaceDialog.tsx +5 -4
- package/src/components/JoinDialog.tsx +6 -6
- package/src/components/MembersContainer.stories.tsx +6 -5
- package/src/components/MembersContainer.tsx +6 -6
- package/src/components/MenuFooter.tsx +2 -2
- package/src/components/{ObjectDetailsPanel.tsx → ObjectDetailsPanel/ObjectDetailsPanel.tsx} +9 -36
- package/src/components/ObjectDetailsPanel/ObjectForm.tsx +75 -0
- package/src/components/ObjectDetailsPanel/index.ts +7 -0
- package/src/components/ObjectSettings/AdvancedObjectSettings.tsx +3 -3
- package/src/components/ObjectSettings/BaseObjectSettings.stories.tsx +63 -0
- package/src/components/ObjectSettings/BaseObjectSettings.tsx +96 -26
- package/src/components/ObjectSettings/ForeignKeys.tsx +3 -3
- package/src/components/ObjectSettings/index.ts +3 -1
- package/src/components/PersistenceStatus.tsx +2 -2
- package/src/components/PopoverRenameObject.tsx +3 -3
- package/src/components/PopoverRenameSpace.tsx +3 -3
- package/src/components/RecordMain.tsx +61 -9
- package/src/components/SchemaContainer.tsx +3 -3
- package/src/components/SpacePluginSettings.tsx +2 -2
- package/src/components/SpacePresence.stories.tsx +22 -24
- package/src/components/SpacePresence.tsx +3 -3
- package/src/components/SpaceSettings/SpaceSettingsContainer.stories.tsx +9 -4
- package/src/components/SpaceSettings/SpaceSettingsContainer.tsx +13 -12
- package/src/components/SyncStatus/InlineSyncStatus.tsx +7 -7
- package/src/components/SyncStatus/SyncStatus.stories.tsx +4 -5
- package/src/components/SyncStatus/SyncStatus.tsx +92 -5
- package/src/components/ViewEditor.tsx +6 -7
- package/src/components/index.ts +1 -1
- package/src/events.ts +6 -6
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useInputSurfaceLookup.tsx +1 -1
- package/src/hooks/usePath.ts +1 -1
- package/src/hooks/useTypeOptions.ts +59 -0
- package/src/meta.ts +1 -3
- package/src/translations.ts +10 -1
- package/src/types/types.ts +11 -7
- package/src/util.tsx +46 -32
- package/dist/lib/browser/CollectionMain-D2B75XBS.mjs.map +0 -7
- package/dist/lib/browser/ObjectDetailsPanel-J7KGPJJK.mjs +0 -90
- package/dist/lib/browser/ObjectDetailsPanel-J7KGPJJK.mjs.map +0 -7
- package/dist/lib/browser/RecordMain-TEBGAVSL.mjs +0 -68
- package/dist/lib/browser/RecordMain-TEBGAVSL.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-AFC6PNAB.mjs.map +0 -7
- package/dist/lib/browser/app-graph-serializer-Q7QG4EKW.mjs.map +0 -7
- package/dist/lib/browser/chunk-6GRF7NEF.mjs.map +0 -7
- package/dist/lib/browser/chunk-CBYL62HG.mjs +0 -19
- package/dist/lib/browser/chunk-CBYL62HG.mjs.map +0 -7
- package/dist/lib/browser/chunk-ELJDGQTO.mjs +0 -94
- package/dist/lib/browser/chunk-ELJDGQTO.mjs.map +0 -7
- package/dist/lib/browser/chunk-FBCGT5YY.mjs +0 -13
- package/dist/lib/browser/chunk-FBCGT5YY.mjs.map +0 -7
- package/dist/lib/browser/chunk-S33AYKSS.mjs.map +0 -7
- package/dist/lib/browser/chunk-TUQZO5P4.mjs +0 -20
- package/dist/lib/browser/chunk-TUQZO5P4.mjs.map +0 -7
- package/dist/lib/browser/chunk-URST7EEN.mjs.map +0 -7
- package/dist/lib/browser/chunk-WZYRDFW7.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-CO262Q44.mjs.map +0 -7
- package/dist/lib/browser/react-root-K4IVLFYZ.mjs.map +0 -7
- package/dist/lib/browser/react-surface-TPUOK2LC.mjs.map +0 -7
- package/dist/lib/browser/spaces-ready-3I5LISH4.mjs.map +0 -7
- package/dist/lib/browser/state-2RGW7FQG.mjs.map +0 -7
- package/dist/lib/node-esm/CollectionMain-ZJIFCWKZ.mjs.map +0 -7
- package/dist/lib/node-esm/ObjectDetailsPanel-7ADOXZ5W.mjs +0 -91
- package/dist/lib/node-esm/ObjectDetailsPanel-7ADOXZ5W.mjs.map +0 -7
- package/dist/lib/node-esm/RecordMain-WLYJMYER.mjs +0 -70
- package/dist/lib/node-esm/RecordMain-WLYJMYER.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-OW2EBYRI.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-serializer-6PGC5WR5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FJZNSJC4.mjs +0 -20
- package/dist/lib/node-esm/chunk-FJZNSJC4.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HC677WUJ.mjs +0 -21
- package/dist/lib/node-esm/chunk-HC677WUJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HWNG4MEU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-LGNPMOXU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-NMCD2PSG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Q6AAQLQG.mjs +0 -96
- package/dist/lib/node-esm/chunk-Q6AAQLQG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RXDT5LA5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-TEUN2E4F.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-EXPK4B76.mjs.map +0 -7
- package/dist/lib/node-esm/react-root-4OQ7MPGW.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-WXEXIDB7.mjs.map +0 -7
- package/dist/lib/node-esm/spaces-ready-JAP22P57.mjs.map +0 -7
- package/dist/lib/node-esm/state-7VBVBGNS.mjs.map +0 -7
- package/dist/types/src/components/ObjectDetailsPanel.d.ts +0 -9
- package/dist/types/src/components/ObjectDetailsPanel.d.ts.map +0 -1
|
@@ -9,11 +9,11 @@ import { type Obj } from '@dxos/echo';
|
|
|
9
9
|
import { useClient } from '@dxos/react-client';
|
|
10
10
|
import { DropdownMenu, Icon, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
11
11
|
|
|
12
|
-
import {
|
|
12
|
+
import { meta } from '../meta';
|
|
13
13
|
import { getSpaceDisplayName } from '../util';
|
|
14
14
|
|
|
15
15
|
export const MenuFooter = ({ object }: { object: Obj.Any }) => {
|
|
16
|
-
const { t } = useTranslation(
|
|
16
|
+
const { t } = useTranslation(meta.id);
|
|
17
17
|
const client = useClient();
|
|
18
18
|
const space = getSpace(object);
|
|
19
19
|
const spaceName = space ? getSpaceDisplayName(space, { personal: client.spaces.default === space }) : '';
|
|
@@ -2,52 +2,33 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React
|
|
5
|
+
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import { type JsonPath, setValue } from '@dxos/echo-schema';
|
|
8
|
-
import { invariant } from '@dxos/invariant';
|
|
9
7
|
import { useClient } from '@dxos/react-client';
|
|
10
8
|
import { Filter, getSpace, useQuery, useSchema } from '@dxos/react-client/echo';
|
|
11
9
|
import { Callout, useTranslation } from '@dxos/react-ui';
|
|
12
10
|
import { useSelected } from '@dxos/react-ui-attention';
|
|
13
|
-
import { Form, useRefQueryLookupHandler } from '@dxos/react-ui-form';
|
|
14
11
|
import { type DataType } from '@dxos/schema';
|
|
15
|
-
import {
|
|
12
|
+
import { getTypenameFromQuery } from '@dxos/schema';
|
|
16
13
|
import { isNonNullable } from '@dxos/util';
|
|
17
14
|
|
|
18
|
-
import {
|
|
15
|
+
import { meta } from '../../meta';
|
|
16
|
+
|
|
17
|
+
import { ObjectForm } from './ObjectForm';
|
|
19
18
|
|
|
20
19
|
type RowDetailsPanelProps = { objectId: string; view: DataType.View };
|
|
21
20
|
|
|
22
|
-
const ObjectDetailsPanel = ({ objectId, view }: RowDetailsPanelProps) => {
|
|
23
|
-
const { t } = useTranslation(
|
|
21
|
+
export const ObjectDetailsPanel = ({ objectId, view }: RowDetailsPanelProps) => {
|
|
22
|
+
const { t } = useTranslation(meta.id);
|
|
24
23
|
const client = useClient();
|
|
25
24
|
const space = getSpace(view);
|
|
26
|
-
const typename = view.query ?
|
|
25
|
+
const typename = view.query ? getTypenameFromQuery(view.query.ast) : undefined;
|
|
27
26
|
const schema = useSchema(client, space, typename);
|
|
28
27
|
|
|
29
28
|
const queriedObjects = useQuery(space, schema ? Filter.type(schema) : Filter.nothing());
|
|
30
29
|
const selectedRows = useSelected(objectId, 'multi');
|
|
31
30
|
const selectedObjects = selectedRows.map((id) => queriedObjects.find((obj) => obj.id === id)).filter(isNonNullable);
|
|
32
31
|
|
|
33
|
-
const handleRefQueryLookup = useRefQueryLookupHandler({ space });
|
|
34
|
-
|
|
35
|
-
const handleSave = useCallback(
|
|
36
|
-
(values: any, { changed }: { changed: Record<JsonPath, boolean> }) => {
|
|
37
|
-
const id = values.id;
|
|
38
|
-
invariant(typeof id === 'string');
|
|
39
|
-
const object = queriedObjects.find((obj) => obj.id === id);
|
|
40
|
-
invariant(object);
|
|
41
|
-
|
|
42
|
-
const changedPaths = Object.keys(changed).filter((path) => changed[path as JsonPath]) as JsonPath[];
|
|
43
|
-
for (const path of changedPaths) {
|
|
44
|
-
const value = values[path];
|
|
45
|
-
setValue(object, path, value);
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
[queriedObjects],
|
|
49
|
-
);
|
|
50
|
-
|
|
51
32
|
if (selectedObjects.length === 0) {
|
|
52
33
|
return (
|
|
53
34
|
<div role='none' className='plb-cardSpacingBlock pli-cardSpacingInline'>
|
|
@@ -63,17 +44,9 @@ const ObjectDetailsPanel = ({ objectId, view }: RowDetailsPanelProps) => {
|
|
|
63
44
|
{schema &&
|
|
64
45
|
selectedObjects.map((object) => (
|
|
65
46
|
<div key={object.id} className='border border-separator rounded'>
|
|
66
|
-
<
|
|
67
|
-
autoSave
|
|
68
|
-
schema={schema}
|
|
69
|
-
values={object}
|
|
70
|
-
onSave={handleSave}
|
|
71
|
-
onQueryRefOptions={handleRefQueryLookup}
|
|
72
|
-
/>
|
|
47
|
+
<ObjectForm object={object} schema={schema} />
|
|
73
48
|
</div>
|
|
74
49
|
))}
|
|
75
50
|
</div>
|
|
76
51
|
);
|
|
77
52
|
};
|
|
78
|
-
|
|
79
|
-
export default ObjectDetailsPanel;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
import React, { useCallback, useMemo } from 'react';
|
|
7
|
+
|
|
8
|
+
import { DXN, Obj, Tag, Type } from '@dxos/echo';
|
|
9
|
+
import { type JsonPath, setValue } from '@dxos/echo/internal';
|
|
10
|
+
import { invariant } from '@dxos/invariant';
|
|
11
|
+
import { getSpace } from '@dxos/react-client/echo';
|
|
12
|
+
import { Form, useRefQueryLookupHandler } from '@dxos/react-ui-form';
|
|
13
|
+
|
|
14
|
+
import { meta as pluginMeta } from '../../meta';
|
|
15
|
+
|
|
16
|
+
const TagSchema = Tag.Tag.pipe(Schema.omit('id'));
|
|
17
|
+
|
|
18
|
+
type ObjectFormProps = { object: Obj.Any; schema: Schema.Schema.AnyNoContext };
|
|
19
|
+
|
|
20
|
+
export const ObjectForm = ({ object, schema }: ObjectFormProps) => {
|
|
21
|
+
const space = getSpace(object);
|
|
22
|
+
const handleRefQueryLookup = useRefQueryLookupHandler({ space });
|
|
23
|
+
|
|
24
|
+
const formSchema = useMemo(
|
|
25
|
+
() => Schema.Struct({ tag: Type.Ref(Tag.Tag).pipe(Schema.optional) }).pipe(Schema.extend(schema)),
|
|
26
|
+
[schema],
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const meta = Obj.getMeta(object);
|
|
30
|
+
const tag = meta.tags?.[0] ? space?.db.ref(DXN.parse(meta.tags?.[0])) : undefined;
|
|
31
|
+
const values = useMemo(() => ({ tag, ...object }), [object, tag]);
|
|
32
|
+
|
|
33
|
+
const handleCreateTag = useCallback((values: Schema.Schema.Type<typeof TagSchema>) => {
|
|
34
|
+
invariant(space);
|
|
35
|
+
const tag = space.db.add(Tag.make(values));
|
|
36
|
+
const meta = Obj.getMeta(object);
|
|
37
|
+
meta.tags = [Obj.getDXN(tag).toString()];
|
|
38
|
+
}, []);
|
|
39
|
+
|
|
40
|
+
const handleSave = useCallback(
|
|
41
|
+
(values: any, { changed }: { changed: Record<JsonPath, boolean> }) => {
|
|
42
|
+
const changedPaths = Object.keys(changed).filter((path) => changed[path as JsonPath]) as JsonPath[];
|
|
43
|
+
for (const path of changedPaths) {
|
|
44
|
+
if (path === 'tag') {
|
|
45
|
+
const tag = values[path];
|
|
46
|
+
const meta = Obj.getMeta(object);
|
|
47
|
+
const currentTag = meta.tags?.[0];
|
|
48
|
+
if (currentTag !== tag?.dxn.toString()) {
|
|
49
|
+
meta.tags = tag ? [tag.dxn.toString()] : [];
|
|
50
|
+
}
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const value = values[path];
|
|
55
|
+
setValue(object, path, value);
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
[object],
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<Form
|
|
63
|
+
autoSave
|
|
64
|
+
schema={formSchema}
|
|
65
|
+
values={values}
|
|
66
|
+
createSchema={TagSchema}
|
|
67
|
+
createOptionIcon='ph--plus--regular'
|
|
68
|
+
createOptionLabel={['add tag label', { ns: pluginMeta.id }]}
|
|
69
|
+
createInitialValuePath='label'
|
|
70
|
+
onCreate={handleCreateTag}
|
|
71
|
+
onSave={handleSave}
|
|
72
|
+
onQueryRefOptions={handleRefQueryLookup}
|
|
73
|
+
/>
|
|
74
|
+
);
|
|
75
|
+
};
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
import React, { useCallback, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { Obj } from '@dxos/echo';
|
|
8
|
-
import { ForeignKey } from '@dxos/echo
|
|
8
|
+
import { ForeignKey } from '@dxos/echo/internal';
|
|
9
9
|
import { IconButton, useTranslation } from '@dxos/react-ui';
|
|
10
10
|
import { Form } from '@dxos/react-ui-form';
|
|
11
11
|
|
|
12
|
-
import {
|
|
12
|
+
import { meta } from '../../meta';
|
|
13
13
|
|
|
14
14
|
import { ForeignKeys } from './ForeignKeys';
|
|
15
15
|
|
|
@@ -23,7 +23,7 @@ export type AdvancedObjectSettingsProps = {
|
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
export const AdvancedObjectSettings = ({ object }: AdvancedObjectSettingsProps) => {
|
|
26
|
-
const { t } = useTranslation(
|
|
26
|
+
const { t } = useTranslation(meta.id);
|
|
27
27
|
const [adding, setAdding] = useState(false);
|
|
28
28
|
const { keys } = Obj.getMeta(object);
|
|
29
29
|
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import React, { useEffect, useState } from 'react';
|
|
7
|
+
|
|
8
|
+
import { Obj, Tag } from '@dxos/echo';
|
|
9
|
+
import { Expando } from '@dxos/react-client/echo';
|
|
10
|
+
import { useClientProvider, withClientProvider } from '@dxos/react-client/testing';
|
|
11
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
12
|
+
import { render } from '@dxos/storybook-utils';
|
|
13
|
+
|
|
14
|
+
import { translations } from '../../translations';
|
|
15
|
+
|
|
16
|
+
import { BaseObjectSettings } from './BaseObjectSettings';
|
|
17
|
+
|
|
18
|
+
const DefaultStory = () => {
|
|
19
|
+
const { space } = useClientProvider();
|
|
20
|
+
const [object, setObject] = useState<Obj.Any>();
|
|
21
|
+
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (space && !object) {
|
|
24
|
+
const object = space.db.add(Obj.make(Expando, {}));
|
|
25
|
+
setObject(object as Obj.Any);
|
|
26
|
+
}
|
|
27
|
+
}, [space, object]);
|
|
28
|
+
|
|
29
|
+
if (!object) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return <BaseObjectSettings object={object} />;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const meta = {
|
|
37
|
+
title: 'plugins/plugin-space/BaseObjectSettings',
|
|
38
|
+
component: BaseObjectSettings as any,
|
|
39
|
+
render: render(DefaultStory),
|
|
40
|
+
decorators: [
|
|
41
|
+
withTheme,
|
|
42
|
+
withClientProvider({
|
|
43
|
+
createIdentity: true,
|
|
44
|
+
createSpace: true,
|
|
45
|
+
types: [Tag.Tag],
|
|
46
|
+
onCreateSpace: async ({ space }) => {
|
|
47
|
+
space.db.add(Tag.make({ label: 'Tag 1' }));
|
|
48
|
+
space.db.add(Tag.make({ label: 'Tag 2' }));
|
|
49
|
+
space.db.add(Tag.make({ label: 'Tag 3' }));
|
|
50
|
+
},
|
|
51
|
+
}),
|
|
52
|
+
],
|
|
53
|
+
parameters: {
|
|
54
|
+
layout: 'fullscreen',
|
|
55
|
+
translations,
|
|
56
|
+
},
|
|
57
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
58
|
+
|
|
59
|
+
export default meta;
|
|
60
|
+
|
|
61
|
+
type Story = StoryObj<typeof meta>;
|
|
62
|
+
|
|
63
|
+
export const Default: Story = {};
|
|
@@ -2,12 +2,35 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Function from 'effect/Function';
|
|
6
|
+
import * as Option from 'effect/Option';
|
|
7
|
+
import * as Schema from 'effect/Schema';
|
|
8
|
+
import React, { type PropsWithChildren, useCallback, useMemo } from 'react';
|
|
6
9
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
10
|
+
import { DXN, Obj, Tag, Type } from '@dxos/echo';
|
|
11
|
+
import { DescriptionAnnotation } from '@dxos/echo/internal';
|
|
12
|
+
import { invariant } from '@dxos/invariant';
|
|
13
|
+
import { getSpace } from '@dxos/react-client/echo';
|
|
14
|
+
import { type ThemedClassName } from '@dxos/react-ui';
|
|
15
|
+
import { Form, useRefQueryLookupHandler } from '@dxos/react-ui-form';
|
|
9
16
|
|
|
10
|
-
import { meta } from '../../meta';
|
|
17
|
+
import { meta as pluginMeta } from '../../meta';
|
|
18
|
+
|
|
19
|
+
const BaseSchema = Schema.Struct({
|
|
20
|
+
label: Schema.String.pipe(Schema.optional),
|
|
21
|
+
// TODO(wittjosiah): Support multiple tags.
|
|
22
|
+
tag: Type.Ref(Tag.Tag).pipe(Schema.optional),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// TODO(wittjosiah): Use extend but need to be able to control order of fields.
|
|
26
|
+
const BaseSchemaWithDescription = Schema.Struct({
|
|
27
|
+
label: Schema.String.pipe(Schema.optional),
|
|
28
|
+
description: Schema.String.pipe(Schema.optional),
|
|
29
|
+
tag: Type.Ref(Tag.Tag).pipe(Schema.optional),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// TODO(wittjosiah): Better way to support validation of object schemas?
|
|
33
|
+
const TagSchema = Tag.Tag.pipe(Schema.omit('id'));
|
|
11
34
|
|
|
12
35
|
export type BaseObjectSettingsProps = ThemedClassName<
|
|
13
36
|
PropsWithChildren<{
|
|
@@ -15,32 +38,79 @@ export type BaseObjectSettingsProps = ThemedClassName<
|
|
|
15
38
|
}>
|
|
16
39
|
>;
|
|
17
40
|
|
|
41
|
+
// TODO(wittjosiah): Reconcile w/ ObjectDetailsPanel.
|
|
18
42
|
export const BaseObjectSettings = ({ classNames, children, object }: BaseObjectSettingsProps) => {
|
|
19
|
-
const
|
|
20
|
-
const
|
|
43
|
+
const space = getSpace(object);
|
|
44
|
+
const handleRefQueryLookup = useRefQueryLookupHandler({ space });
|
|
45
|
+
|
|
46
|
+
const formSchema = useMemo(() => {
|
|
47
|
+
const description = Function.pipe(
|
|
48
|
+
Obj.getSchema(object),
|
|
49
|
+
Option.fromNullable,
|
|
50
|
+
Option.flatMap((schema) => DescriptionAnnotation.get(schema)),
|
|
51
|
+
Option.getOrUndefined,
|
|
52
|
+
);
|
|
53
|
+
if (description) {
|
|
54
|
+
return BaseSchemaWithDescription;
|
|
55
|
+
} else {
|
|
56
|
+
return BaseSchema;
|
|
57
|
+
}
|
|
58
|
+
}, [object]);
|
|
59
|
+
|
|
60
|
+
const meta = Obj.getMeta(object);
|
|
61
|
+
const tag = meta.tags?.[0] ? space?.db.ref(DXN.parse(meta.tags?.[0])) : undefined;
|
|
62
|
+
const values = useMemo(
|
|
63
|
+
() => ({
|
|
64
|
+
label: Obj.getLabel(object),
|
|
65
|
+
description: Obj.getDescription(object),
|
|
66
|
+
tag,
|
|
67
|
+
}),
|
|
68
|
+
[object, tag],
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
const handleCreateTag = useCallback((values: Schema.Schema.Type<typeof TagSchema>) => {
|
|
72
|
+
invariant(space);
|
|
73
|
+
const tag = space.db.add(Tag.make(values));
|
|
74
|
+
const meta = Obj.getMeta(object);
|
|
75
|
+
meta.tags = [Obj.getDXN(tag).toString()];
|
|
76
|
+
}, []);
|
|
77
|
+
|
|
78
|
+
const handleSave = useCallback(
|
|
79
|
+
(values: Schema.Schema.Type<typeof BaseSchemaWithDescription>) => {
|
|
80
|
+
if (values.label !== undefined && Obj.getLabel(object) !== values.label) {
|
|
81
|
+
Obj.setLabel(object, values.label);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (values.description !== undefined && Obj.getDescription(object) !== values.description) {
|
|
85
|
+
Obj.setDescription(object, values.description);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const meta = Obj.getMeta(object);
|
|
89
|
+
const currentTag = meta.tags?.[0];
|
|
90
|
+
if (values.tag !== undefined && currentTag !== values.tag?.dxn.toString()) {
|
|
91
|
+
meta.tags = [values.tag.dxn.toString()];
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
[object],
|
|
95
|
+
);
|
|
21
96
|
|
|
22
|
-
// TODO(wittjosiah):
|
|
23
|
-
//
|
|
24
|
-
// Perhaps also including the field of the title annotation as well.
|
|
97
|
+
// TODO(wittjosiah): The schema for this form should be based on the schema of the object.
|
|
98
|
+
// Perhaps with fields filtered down to only those with a specific settings annotation.
|
|
25
99
|
return (
|
|
26
100
|
<>
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
}}
|
|
42
|
-
/>
|
|
43
|
-
</Input.Root>
|
|
101
|
+
<Form
|
|
102
|
+
outerSpacing={false}
|
|
103
|
+
autoSave
|
|
104
|
+
schema={formSchema}
|
|
105
|
+
values={values}
|
|
106
|
+
createSchema={TagSchema}
|
|
107
|
+
createOptionIcon='ph--plus--regular'
|
|
108
|
+
createOptionLabel={['add tag label', { ns: pluginMeta.id }]}
|
|
109
|
+
createInitialValuePath='label'
|
|
110
|
+
onCreate={handleCreateTag}
|
|
111
|
+
onSave={handleSave}
|
|
112
|
+
onQueryRefOptions={handleRefQueryLookup}
|
|
113
|
+
/>
|
|
44
114
|
{children}
|
|
45
115
|
</>
|
|
46
116
|
);
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback } from 'react';
|
|
6
6
|
|
|
7
|
-
import { type ForeignKey } from '@dxos/echo
|
|
7
|
+
import { type ForeignKey } from '@dxos/echo/internal';
|
|
8
8
|
import { IconButton, List, ListItem, useTranslation } from '@dxos/react-ui';
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { meta } from '../../meta';
|
|
11
11
|
|
|
12
12
|
export type ForeignKeysProps = {
|
|
13
13
|
keys: ForeignKey[];
|
|
@@ -31,7 +31,7 @@ type KeyItemProps = {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
const KeyItem = ({ forignKey, onDelete }: KeyItemProps) => {
|
|
34
|
-
const { t } = useTranslation(
|
|
34
|
+
const { t } = useTranslation(meta.id);
|
|
35
35
|
|
|
36
36
|
const handleDelete = useCallback(() => {
|
|
37
37
|
onDelete?.(forignKey);
|
|
@@ -9,7 +9,7 @@ import { type EchoDatabase } from '@dxos/react-client/echo';
|
|
|
9
9
|
import { Icon, Tooltip, useTranslation } from '@dxos/react-ui';
|
|
10
10
|
import { mx, staticPlaceholderText, warningText } from '@dxos/react-ui-theme';
|
|
11
11
|
|
|
12
|
-
import {
|
|
12
|
+
import { meta } from '../meta';
|
|
13
13
|
|
|
14
14
|
enum Status {
|
|
15
15
|
PERSISTED_LOCALLY = 0,
|
|
@@ -19,7 +19,7 @@ enum Status {
|
|
|
19
19
|
|
|
20
20
|
// TODO(zan): This now has no usages. Remove it?
|
|
21
21
|
export const PersistenceStatus = ({ db }: { db: EchoDatabase }) => {
|
|
22
|
-
const { t } = useTranslation(
|
|
22
|
+
const { t } = useTranslation(meta.id);
|
|
23
23
|
const [displayMessage, setDisplayMessage] = useState(false);
|
|
24
24
|
const [status, naturalSetStatus] = useState<Status>(Status.PERSISTED_LOCALLY);
|
|
25
25
|
const [prevStatus, setPrevStatus] = useState<Status>(Status.PERSISTED_LOCALLY);
|
|
@@ -10,12 +10,12 @@ import { type Live } from '@dxos/live-object';
|
|
|
10
10
|
import { log } from '@dxos/log';
|
|
11
11
|
import { Button, Input, useTranslation } from '@dxos/react-ui';
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import { meta } from '../meta';
|
|
14
14
|
|
|
15
|
-
export const POPOVER_RENAME_OBJECT = `${
|
|
15
|
+
export const POPOVER_RENAME_OBJECT = `${meta.id}/PopoverRenameObject`;
|
|
16
16
|
|
|
17
17
|
export const PopoverRenameObject = ({ object }: { object: Live<any> }) => {
|
|
18
|
-
const { t } = useTranslation(
|
|
18
|
+
const { t } = useTranslation(meta.id);
|
|
19
19
|
const doneButton = useRef<HTMLButtonElement>(null);
|
|
20
20
|
const [name, setName] = useState(Obj.getLabel(object));
|
|
21
21
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
@@ -8,12 +8,12 @@ import { LayoutAction, createIntent, useIntentDispatcher } from '@dxos/app-frame
|
|
|
8
8
|
import { type Space } from '@dxos/react-client/echo';
|
|
9
9
|
import { Button, Input, Popover, useTranslation } from '@dxos/react-ui';
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { meta } from '../meta';
|
|
12
12
|
|
|
13
|
-
export const POPOVER_RENAME_SPACE = `${
|
|
13
|
+
export const POPOVER_RENAME_SPACE = `${meta.id}/PopoverRenameSpace`;
|
|
14
14
|
|
|
15
15
|
export const PopoverRenameSpace = ({ space }: { space: Space }) => {
|
|
16
|
-
const { t } = useTranslation(
|
|
16
|
+
const { t } = useTranslation(meta.id);
|
|
17
17
|
const doneButton = useRef<HTMLButtonElement>(null);
|
|
18
18
|
const [name, setName] = useState(space.properties.name ?? '');
|
|
19
19
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
@@ -2,18 +2,58 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, { useCallback } from 'react';
|
|
5
|
+
import React, { useCallback, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { Surface } from '@dxos/app-framework';
|
|
8
|
+
import { Filter, Obj, Ref } from '@dxos/echo';
|
|
9
|
+
import { type JsonPath, setValue } from '@dxos/echo/internal';
|
|
9
10
|
import { invariant } from '@dxos/invariant';
|
|
10
|
-
import { getSpace } from '@dxos/react-client/echo';
|
|
11
|
+
import { getSpace, useQuery } from '@dxos/react-client/echo';
|
|
12
|
+
import { useTranslation } from '@dxos/react-ui';
|
|
11
13
|
import { Form, useRefQueryLookupHandler } from '@dxos/react-ui-form';
|
|
14
|
+
import { Masonry } from '@dxos/react-ui-masonry';
|
|
15
|
+
import { StackItem } from '@dxos/react-ui-stack';
|
|
16
|
+
import { isNonNullable } from '@dxos/util';
|
|
17
|
+
|
|
18
|
+
import { meta } from '../meta';
|
|
19
|
+
|
|
20
|
+
const getReferencesFromObject = (obj: Obj.Any): Ref.Any[] => {
|
|
21
|
+
return Object.getOwnPropertyNames(obj)
|
|
22
|
+
.map((name) => obj[name as keyof Obj.Any])
|
|
23
|
+
.filter((value) => Ref.isRef(value)) as Ref.Any[];
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const Card = ({ data: subject }: { data: Obj.Any }) => {
|
|
27
|
+
const data = useMemo(() => ({ subject }), [subject]);
|
|
28
|
+
return <Surface role='card' data={data} limit={1} />;
|
|
29
|
+
};
|
|
12
30
|
|
|
13
31
|
export const RecordMain = ({ record }: { record: Obj.Any }) => {
|
|
32
|
+
const { t } = useTranslation(meta.id);
|
|
14
33
|
const space = getSpace(record);
|
|
15
34
|
const schema = Obj.getSchema(record);
|
|
16
|
-
|
|
35
|
+
|
|
36
|
+
// TODO(wittjosiah): This is a hack. ECHO needs to have a back reference index to easily query for related objects.
|
|
37
|
+
const objects = useQuery(space, Filter.everything());
|
|
38
|
+
const related = useMemo(() => {
|
|
39
|
+
// TODO(wittjosiah): Support links via relations as well.
|
|
40
|
+
// const relations = objects.filter((obj) => Relation.isRelation(obj));
|
|
41
|
+
// const targetObjects = relations
|
|
42
|
+
// .filter((relation) => Relation.getSource(relation) === record)
|
|
43
|
+
// .map((relation) => Relation.getTarget(relation));
|
|
44
|
+
// const sourceObjects = relations
|
|
45
|
+
// .filter((relation) => Relation.getTarget(relation) === record)
|
|
46
|
+
// .map((relation) => Relation.getSource(relation));
|
|
47
|
+
|
|
48
|
+
const references = getReferencesFromObject(record);
|
|
49
|
+
const referencedObjects = references.map((ref) => ref.target).filter(isNonNullable);
|
|
50
|
+
const referencingObjects = objects.filter((obj) => {
|
|
51
|
+
const refs = getReferencesFromObject(obj);
|
|
52
|
+
return refs.some((ref) => ref.target === record);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
return [...referencedObjects, ...referencingObjects];
|
|
56
|
+
}, [record, objects]);
|
|
17
57
|
|
|
18
58
|
const handleRefQueryLookup = useRefQueryLookupHandler({ space });
|
|
19
59
|
|
|
@@ -31,12 +71,24 @@ export const RecordMain = ({ record }: { record: Obj.Any }) => {
|
|
|
31
71
|
[record],
|
|
32
72
|
);
|
|
33
73
|
|
|
74
|
+
if (!schema) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
|
|
34
78
|
return (
|
|
35
|
-
<
|
|
36
|
-
<div
|
|
37
|
-
<
|
|
79
|
+
<StackItem.Content classNames='container-max-width' scrollable>
|
|
80
|
+
<div role='none' className='flex flex-col gap-4 p-2'>
|
|
81
|
+
<div key={record.id} className='border border-separator rounded'>
|
|
82
|
+
<Form autoSave schema={schema} values={record} onSave={handleSave} onQueryRefOptions={handleRefQueryLookup} />
|
|
83
|
+
</div>
|
|
84
|
+
{related.length > 0 && (
|
|
85
|
+
<div className='flex flex-col gap-1 p-2'>
|
|
86
|
+
<label className='text-description text-sm'>{t('related objects label')}</label>
|
|
87
|
+
<Masonry.Root<Obj.Any> items={related} render={Card} intrinsicHeight />
|
|
88
|
+
</div>
|
|
89
|
+
)}
|
|
38
90
|
</div>
|
|
39
|
-
</
|
|
91
|
+
</StackItem.Content>
|
|
40
92
|
);
|
|
41
93
|
};
|
|
42
94
|
|
|
@@ -10,7 +10,7 @@ import { useTranslation } from '@dxos/react-ui';
|
|
|
10
10
|
import { ControlPage, ControlSection, controlItemClasses } from '@dxos/react-ui-form';
|
|
11
11
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import { meta } from '../meta';
|
|
14
14
|
|
|
15
15
|
type SchemaPanelProps = { space: Space };
|
|
16
16
|
|
|
@@ -37,11 +37,11 @@ export const useQuerySpaceSchemas = (space: Space): Type.Schema[] => {
|
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
export const SchemaContainer = ({ space }: SchemaPanelProps) => {
|
|
40
|
-
const { t } = useTranslation(
|
|
40
|
+
const { t } = useTranslation(meta.id);
|
|
41
41
|
const schemas = useQuerySpaceSchemas(space);
|
|
42
42
|
|
|
43
43
|
return (
|
|
44
|
-
<StackItem.Content
|
|
44
|
+
<StackItem.Content scrollable>
|
|
45
45
|
<ControlPage>
|
|
46
46
|
<ControlSection title={t('schema verbose label')} description={t('schema description')}>
|
|
47
47
|
<div role='none' className={controlItemClasses}>
|
|
@@ -10,12 +10,12 @@ import { useSpaces } from '@dxos/react-client/echo';
|
|
|
10
10
|
import { IconButton, Input, List, ListItem, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
11
11
|
import { ControlGroup, ControlItemInput, ControlPage, ControlSection, controlItemClasses } from '@dxos/react-ui-form';
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import { meta } from '../meta';
|
|
14
14
|
import { SpaceAction, type SpaceSettingsProps } from '../types';
|
|
15
15
|
import { getSpaceDisplayName } from '../util';
|
|
16
16
|
|
|
17
17
|
export const SpacePluginSettings = ({ settings }: { settings: SpaceSettingsProps }) => {
|
|
18
|
-
const { t } = useTranslation(
|
|
18
|
+
const { t } = useTranslation(meta.id);
|
|
19
19
|
const client = useClient();
|
|
20
20
|
const spaces = useSpaces({ all: settings.showHidden });
|
|
21
21
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|