fix: build error

This commit is contained in:
chenos 2022-02-10 18:38:05 +08:00
parent 34f5c87a1e
commit 47fa83032c
4 changed files with 16 additions and 19 deletions

View File

@ -24,6 +24,7 @@
"@formily/core": "^2.0.7",
"@formily/react": "^2.0.7",
"ahooks": "^3.0.5",
"antd": "^4.18.5",
"axios": "^0.24.0",
"file-saver": "^2.0.5",
"i18next": "^21.6.0",
@ -32,16 +33,15 @@
"react-helmet": "^6.1.0",
"react-i18next": "^11.15.1",
"react-image-lightbox": "^5.1.4",
"react-router-dom": "^5.2.0",
"use-deep-compare-effect": "^1.8.1"
},
"peerDependencies": {
"@types/react": ">=16.8.0 || >=17.0.0",
"@types/react-dom": ">=16.8.0 || >=17.0.0",
"antd": "^4.18.5",
"react": ">=16.8.0 || >=17.0.0",
"react-dom": ">=16.8.0",
"react-is": ">=16.8.0 || >=17.0.0",
"react-router-dom": "^5.2.0"
"react-is": ">=16.8.0 || >=17.0.0"
},
"scripts": {
"build": "rimraf -rf lib esm dist && npm run build:cjs && npm run build:esm",

View File

@ -1,19 +1,18 @@
import { observer, useFieldSchema } from '@formily/react';
import { observer } from '@formily/react';
import React from 'react';
import { SchemaInitializer } from '../../../schema-initializer';
const useTableColumnInitializerFields = () => {
const fieldSchema = useFieldSchema();
const fields = [
{
key: 'field1',
title: 'Field1',
component: fieldSchema['x-column-initializer'],
name: 'field1',
component: ArrayTableColumnInitializer,
},
{
key: 'field2',
title: 'Field2',
component: fieldSchema['x-column-initializer'],
name: 'field2',
component: ArrayTableColumnInitializer,
},
].filter((field) => field.component);
return fields;
@ -22,10 +21,10 @@ const useTableColumnInitializerFields = () => {
export const TableColumnInitializeButton = observer((props: any) => {
return (
<SchemaInitializer.Button
wrap={(schema) => schema}
insertPosition={'beforeEnd'}
items={[
{
type: 'item',
title: 'Display fields',
children: useTableColumnInitializerFields(),
},
@ -36,11 +35,11 @@ export const TableColumnInitializeButton = observer((props: any) => {
);
});
export const ArrayTableColumnInitializer = (props) => {
const { title, insert } = props;
export const ArrayTableColumnInitializer = SchemaInitializer.itemWrap((props) => {
const { insert } = props;
return (
<SchemaInitializer.Item
onClick={(info) => {
onClick={() => {
insert({
type: 'void',
title: 'Name',
@ -54,8 +53,6 @@ export const ArrayTableColumnInitializer = (props) => {
},
});
}}
>
{title}
</SchemaInitializer.Item>
/>
);
};
});

View File

@ -1,7 +1,7 @@
import { ISchema, observer } from '@formily/react';
import { useDesignable } from '@nocobase/client';
import { Button, Dropdown, Menu } from 'antd';
import React, { createContext, useContext, useState } from 'react';
import { useDesignable } from '../schema-component/hooks';
import {
SchemaInitializerButtonProps,
SchemaInitializerItemComponent,

View File

@ -137,7 +137,7 @@ export class Application<StateT = DefaultState, ContextT = DefaultContext> exten
}
findCommand(name: string): Command {
return this.cli._findCommand(name);
return (<any>this.cli)._findCommand(name);
}
async load() {