From f9488963658d44e02b2ee1dc7c8c8db77a719efe Mon Sep 17 00:00:00 2001 From: chenos Date: Wed, 9 Dec 2020 23:04:53 +0800 Subject: [PATCH] fix: missing options when finding --- packages/plugin-collections/src/__tests__/collections.test.ts | 2 +- packages/plugin-collections/src/models/field.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/plugin-collections/src/__tests__/collections.test.ts b/packages/plugin-collections/src/__tests__/collections.test.ts index 564077be90..443436265c 100644 --- a/packages/plugin-collections/src/__tests__/collections.test.ts +++ b/packages/plugin-collections/src/__tests__/collections.test.ts @@ -143,6 +143,7 @@ describe('collection hooks', () => { }); expect(createdField.body).toMatchObject({ + ...types['string'].options, ...{ interface: 'string', title: '名称', @@ -152,7 +153,6 @@ describe('collection hooks', () => { sortable: true, filterable: true, }, - ...types['string'].options, sort: 1, collection_name: 'tests', }); diff --git a/packages/plugin-collections/src/models/field.ts b/packages/plugin-collections/src/models/field.ts index b3b9049a6a..815e75df0f 100644 --- a/packages/plugin-collections/src/models/field.ts +++ b/packages/plugin-collections/src/models/field.ts @@ -14,7 +14,8 @@ export class FieldModel extends BaseModel { constructor(values: any = {}, options: any = {}) { let data = { ...(values.options||{}), - ..._.omit(values, 'options'), + ...values, + // ..._.omit(values, 'options'), }; const interfaceType = data.interface; if (interfaceType) { @@ -25,6 +26,7 @@ export class FieldModel extends BaseModel { } // @ts-ignore super(data, options); + // console.log(data); } generateName() {