mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-07 22:49:26 +08:00
* 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>
17 lines
610 B
TypeScript
17 lines
610 B
TypeScript
import React from 'react';
|
|
import { CollectionContext } from './context';
|
|
import { useCollectionManager } from './hooks';
|
|
import { CollectionOptions } from './types';
|
|
|
|
export const CollectionProvider: React.FC<{ allowNull?: boolean; name?: string; collection?: CollectionOptions }> = (
|
|
props,
|
|
) => {
|
|
const { allowNull, name, collection, children } = props;
|
|
const { getCollection } = useCollectionManager();
|
|
const value = getCollection(collection || name);
|
|
if (!value && !allowNull) {
|
|
return null;
|
|
}
|
|
return <CollectionContext.Provider value={value}>{children}</CollectionContext.Provider>;
|
|
};
|