fix: duplicated designer setting items (#1028)
Co-authored-by: sealday <sealday@gmail.com> Reviewed-on: daoyoucloud/tachybase#1028
This commit is contained in:
parent
d101d5fafb
commit
b338c51923
@ -11,7 +11,6 @@ export class SchemaSettings<T = {}> {
|
|||||||
|
|
||||||
constructor(options: SchemaSettingOptions<T>) {
|
constructor(options: SchemaSettingOptions<T>) {
|
||||||
this.options = Object.assign({ items: [] }, options);
|
this.options = Object.assign({ items: [] }, options);
|
||||||
this.options.items = defaultSettingItems.concat(this.items);
|
|
||||||
this.name = options.name;
|
this.name = options.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import { SchemaSettingsProps } from '../../../schema-settings';
|
|||||||
import { Schema } from '@tachybase/schema';
|
import { Schema } from '@tachybase/schema';
|
||||||
import { GeneralField } from '@tachybase/schema';
|
import { GeneralField } from '@tachybase/schema';
|
||||||
import { Designable } from '../../../schema-component';
|
import { Designable } from '../../../schema-component';
|
||||||
|
import { defaultSettingItems } from '../SchemaSettingsDefaults';
|
||||||
|
|
||||||
type UseSchemaSettingsRenderOptions<T = {}> = Omit<SchemaSettingOptions<T>, 'name' | 'items'> &
|
type UseSchemaSettingsRenderOptions<T = {}> = Omit<SchemaSettingOptions<T>, 'name' | 'items'> &
|
||||||
Omit<SchemaSettingsProps, 'title' | 'children'> & {
|
Omit<SchemaSettingsProps, 'title' | 'children'> & {
|
||||||
@ -40,8 +41,9 @@ export function useSchemaSettingsRender<T = {}>(name: string, options?: UseSchem
|
|||||||
if (key && renderCache.current[key]) {
|
if (key && renderCache.current[key]) {
|
||||||
return renderCache.current[key];
|
return renderCache.current[key];
|
||||||
}
|
}
|
||||||
|
const newItems = [...defaultSettingItems, ...schemaSetting.options.items];
|
||||||
return (renderCache.current[key] = React.createElement(SchemaSettingsWrapper, {
|
return (renderCache.current[key] = React.createElement(SchemaSettingsWrapper, {
|
||||||
...schemaSetting.options,
|
...{ ...schemaSetting.options, items: newItems },
|
||||||
...options,
|
...options,
|
||||||
...options2,
|
...options2,
|
||||||
}));
|
}));
|
||||||
|
Loading…
Reference in New Issue
Block a user