* feat: snapshota * feat: snapshota i18n & bugs * feat: snapshota association value fix * feat: snapshota remove require true * feat: snapshota params.values null fix * feat: snapshota i18n * feat: snapshota CR fix * feat: snapshota field change fix * feat: snapshota magicstring fix * feat: snapshota field del fix * feat: snapshota CR fix * feat: snapshota tag fix * feat: snapshota depth < 3 * fix: improve code * feat: snapshota test * feat: snapshota remove disabled * fix: disabled isOverride --------- Co-authored-by: chenos <chenlinxh@gmail.com>
55 lines
1.8 KiB
TypeScript
55 lines
1.8 KiB
TypeScript
import {
|
|
CollectionHistoryProvider,
|
|
CollectionManagerProvider,
|
|
registerField,
|
|
SchemaComponentOptions,
|
|
SchemaInitializerContext,
|
|
SchemaInitializerProvider,
|
|
} from '@nocobase/client';
|
|
import React, { useContext, useEffect } from 'react';
|
|
import { useSnapshotInterface } from './interface';
|
|
import { SnapshotRecordPicker } from './SnapshotRecordPicker';
|
|
import { SnapshotBlockInitializers } from './SnapshotBlock/SnapshotBlockInitializers/SnapshotBlockInitializers';
|
|
import { SnapshotBlockInitializersDetailItem } from './SnapshotBlock/SnapshotBlockInitializers/SnapshotBlockInitializersDetailItem';
|
|
import { SnapshotBlockProvider } from './SnapshotBlock/SnapshotBlockProvider';
|
|
import { AppendsTreeSelect } from './components/AppendsTreeSelect';
|
|
import { SnapshotOwnerCollectionFieldsSelect } from './components/SnapshotOwnerCollectionFieldsSelect';
|
|
|
|
export default React.memo((props) => {
|
|
const initializers = useContext(SchemaInitializerContext);
|
|
const snapshot = useSnapshotInterface();
|
|
|
|
useEffect(() => {
|
|
registerField(snapshot.group, snapshot.name as string, snapshot);
|
|
}, []);
|
|
|
|
return (
|
|
<CollectionManagerProvider
|
|
interfaces={{
|
|
snapshot,
|
|
}}
|
|
>
|
|
<CollectionHistoryProvider>
|
|
<SchemaInitializerProvider
|
|
initializers={{
|
|
...initializers,
|
|
SnapshotBlockInitializers,
|
|
}}
|
|
>
|
|
<SchemaComponentOptions
|
|
components={{
|
|
SnapshotRecordPicker,
|
|
SnapshotBlockProvider,
|
|
SnapshotBlockInitializersDetailItem,
|
|
AppendsTreeSelect,
|
|
SnapshotOwnerCollectionFieldsSelect,
|
|
}}
|
|
>
|
|
{props.children}
|
|
</SchemaComponentOptions>
|
|
</SchemaInitializerProvider>
|
|
</CollectionHistoryProvider>
|
|
</CollectionManagerProvider>
|
|
);
|
|
});
|