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/core": "^2.0.7",
"@formily/react": "^2.0.7", "@formily/react": "^2.0.7",
"ahooks": "^3.0.5", "ahooks": "^3.0.5",
"antd": "^4.18.5",
"axios": "^0.24.0", "axios": "^0.24.0",
"file-saver": "^2.0.5", "file-saver": "^2.0.5",
"i18next": "^21.6.0", "i18next": "^21.6.0",
@ -32,16 +33,15 @@
"react-helmet": "^6.1.0", "react-helmet": "^6.1.0",
"react-i18next": "^11.15.1", "react-i18next": "^11.15.1",
"react-image-lightbox": "^5.1.4", "react-image-lightbox": "^5.1.4",
"react-router-dom": "^5.2.0",
"use-deep-compare-effect": "^1.8.1" "use-deep-compare-effect": "^1.8.1"
}, },
"peerDependencies": { "peerDependencies": {
"@types/react": ">=16.8.0 || >=17.0.0", "@types/react": ">=16.8.0 || >=17.0.0",
"@types/react-dom": ">=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": ">=16.8.0 || >=17.0.0",
"react-dom": ">=16.8.0", "react-dom": ">=16.8.0",
"react-is": ">=16.8.0 || >=17.0.0", "react-is": ">=16.8.0 || >=17.0.0"
"react-router-dom": "^5.2.0"
}, },
"scripts": { "scripts": {
"build": "rimraf -rf lib esm dist && npm run build:cjs && npm run build:esm", "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 React from 'react';
import { SchemaInitializer } from '../../../schema-initializer'; import { SchemaInitializer } from '../../../schema-initializer';
const useTableColumnInitializerFields = () => { const useTableColumnInitializerFields = () => {
const fieldSchema = useFieldSchema();
const fields = [ const fields = [
{ {
key: 'field1',
title: 'Field1', title: 'Field1',
component: fieldSchema['x-column-initializer'], name: 'field1',
component: ArrayTableColumnInitializer,
}, },
{ {
key: 'field2',
title: 'Field2', title: 'Field2',
component: fieldSchema['x-column-initializer'], name: 'field2',
component: ArrayTableColumnInitializer,
}, },
].filter((field) => field.component); ].filter((field) => field.component);
return fields; return fields;
@ -22,10 +21,10 @@ const useTableColumnInitializerFields = () => {
export const TableColumnInitializeButton = observer((props: any) => { export const TableColumnInitializeButton = observer((props: any) => {
return ( return (
<SchemaInitializer.Button <SchemaInitializer.Button
wrap={(schema) => schema}
insertPosition={'beforeEnd'} insertPosition={'beforeEnd'}
items={[ items={[
{ {
type: 'item',
title: 'Display fields', title: 'Display fields',
children: useTableColumnInitializerFields(), children: useTableColumnInitializerFields(),
}, },
@ -36,11 +35,11 @@ export const TableColumnInitializeButton = observer((props: any) => {
); );
}); });
export const ArrayTableColumnInitializer = (props) => { export const ArrayTableColumnInitializer = SchemaInitializer.itemWrap((props) => {
const { title, insert } = props; const { insert } = props;
return ( return (
<SchemaInitializer.Item <SchemaInitializer.Item
onClick={(info) => { onClick={() => {
insert({ insert({
type: 'void', type: 'void',
title: 'Name', 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 { ISchema, observer } from '@formily/react';
import { useDesignable } from '@nocobase/client';
import { Button, Dropdown, Menu } from 'antd'; import { Button, Dropdown, Menu } from 'antd';
import React, { createContext, useContext, useState } from 'react'; import React, { createContext, useContext, useState } from 'react';
import { useDesignable } from '../schema-component/hooks';
import { import {
SchemaInitializerButtonProps, SchemaInitializerButtonProps,
SchemaInitializerItemComponent, SchemaInitializerItemComponent,

View File

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