diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 9139f961b..e61ccfd90 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -28,6 +28,7 @@ jobs: - name: build gh-pages run: | npm i --legacy-peer-deps + npm run build --workspaces sh deploy-gh-pages.sh - name: Deploy 🚀 uses: JamesIves/github-pages-deploy-action@3.7.1 diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index 5d5d7f594..7c2555be1 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -25,5 +25,6 @@ jobs: - name: test run: | npm i --legacy-peer-deps - npm test + npm run build --workspaces + npm test --workspaces sh deploy-gh-pages.sh diff --git a/fis-conf.js b/fis-conf.js index 82fbc674e..d6bd9f4d3 100644 --- a/fis-conf.js +++ b/fis-conf.js @@ -7,7 +7,13 @@ const package = require('./packages/amis/package.json'); const parserMarkdown = require('./scripts/md-parser'); const convertSCSSIE11 = require('./scripts/scss-ie11'); const parserCodeMarkdown = require('./scripts/code-md-parser'); -fis.get('project.ignore').push('public/**', 'npm/**', 'gh-pages/**'); +fis.set('project.ignore', [ + 'public/**', + 'scripts/**', + 'npm/**', + 'gh-pages/**', + '.*/**' +]); // 配置只编译哪些文件。 const Resource = fis.require('postpackager-loader/lib/resource.js'); diff --git a/package.json b/package.json index 5a17b5212..8439d2f1b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,10 @@ { "name": "aisuda", "workspaces": [ - "packages/*" + "packages/amis-formula", + "packages/amis-core", + "packages/amis-ui", + "packages/amis" ], "scripts": { "serve": "fis3 server start --www ./public --port 8888 --no-daemon --no-browse", diff --git a/packages/amis-core/package.json b/packages/amis-core/package.json index 780e8526a..64a8ca8c2 100644 --- a/packages/amis-core/package.json +++ b/packages/amis-core/package.json @@ -57,7 +57,8 @@ "react-visibility-sensor": "5.1.1", "tslib": "^2.3.1", "markdown-it": "^12.0.6", - "markdown-it-html5-media": "^0.7.1" + "markdown-it-html5-media": "^0.7.1", + "uncontrollable": "7.2.1" }, "jest": { "testEnvironment": "jsdom", diff --git a/packages/amis-core/rollup.config.js b/packages/amis-core/rollup.config.js index d4f7ec9de..5c37c5907 100644 --- a/packages/amis-core/rollup.config.js +++ b/packages/amis-core/rollup.config.js @@ -15,6 +15,8 @@ import { } from './package.json'; import path from 'path'; +const isDev = process.env.NODE_ENV !== 'production'; + const settings = { globals: {} }; @@ -55,23 +57,25 @@ export default [ plugins: getPlugins('cjs') }, - { - input, + isDev + ? null + : { + input, - output: [ - { - ...settings, - dir: path.dirname(module), - format: 'esm', - exports: 'named', - preserveModulesRoot: './src', - preserveModules: true // Keep directory structure and files + output: [ + { + ...settings, + dir: path.dirname(module), + format: 'esm', + exports: 'named', + preserveModulesRoot: './src', + preserveModules: true // Keep directory structure and files + } + ], + external, + plugins: getPlugins('esm') } - ], - external, - plugins: getPlugins('esm') - } -]; +].filter(item => item); function transpileDynamicImportForCJS(options) { return { diff --git a/packages/amis-core/src/factory.tsx b/packages/amis-core/src/factory.tsx index 22eba6326..6711567ec 100644 --- a/packages/amis-core/src/factory.tsx +++ b/packages/amis-core/src/factory.tsx @@ -156,6 +156,10 @@ export function registerRenderer(config: RendererConfig): RendererConfig { throw new Error( `The renderer with name "${config.name}" has already exists, please try another name!` ); + } else if (renderersMap.hasOwnProperty(config.name)) { + // 后面补充的 + const idx = findIndex(renderers, item => item.name === config.name); + ~idx && renderers.splice(idx, 0, config); } if (config.storeType && config.component) { @@ -175,7 +179,7 @@ export function registerRenderer(config: RendererConfig): RendererConfig { item => (config.weight as number) < item.weight ); ~idx ? renderers.splice(idx, 0, config) : renderers.push(config); - renderersMap[config.name] = config.Renderer !== Placeholder; + renderersMap[config.name] = config.component !== Placeholder; return config; } @@ -419,6 +423,7 @@ export function resolveRenderer( // 因为自定义 test 函数的有可能依赖 schema 的结果 if ( renderer !== null && + (renderer as RendererConfig).component !== Placeholder && ((renderer as RendererConfig).type || (renderer as RendererConfig).test instanceof RegExp || (typeof (renderer as RendererConfig).test === 'function' && diff --git a/packages/amis-core/src/theme.tsx b/packages/amis-core/src/theme.tsx index 31795b99a..aee2c1b59 100644 --- a/packages/amis-core/src/theme.tsx +++ b/packages/amis-core/src/theme.tsx @@ -97,8 +97,10 @@ export function getTheme(theme: string): ThemeInstance { const config = themes[theme || 'cxd']; if (!config.getRendererConfig) { - config.getRendererConfig = (name?: string) => - config.renderers && name ? config.renderers[name] : null; + config.getRendererConfig = (name?: string) => { + const config = themes[theme || 'cxd']; + return config.renderers && name ? config.renderers[name] : null; + }; } if (!config.classnames) { diff --git a/packages/amis-core/src/utils/index.ts b/packages/amis-core/src/utils/index.ts index 8c18e2328..58f37e3b4 100644 --- a/packages/amis-core/src/utils/index.ts +++ b/packages/amis-core/src/utils/index.ts @@ -48,6 +48,7 @@ export * from './style'; export * from './tokenize'; export * from './tpl-builtin'; export * from './tpl'; +export * from './uncontrollable'; export * from './validations'; import animation from './Animation'; diff --git a/packages/amis-core/src/utils/uncontrollable.tsx b/packages/amis-core/src/utils/uncontrollable.tsx new file mode 100644 index 000000000..82e67ae65 --- /dev/null +++ b/packages/amis-core/src/utils/uncontrollable.tsx @@ -0,0 +1,12 @@ +import {uncontrollable as baseuncontrollable} from 'uncontrollable'; +import hoistNonReactStatic from 'hoist-non-react-statics'; + +export function uncontrollable< + T extends React.ComponentType, + P extends { + [propName: string]: any; + } +>(arg: T, config: P, mapping?: any): T { + const result = baseuncontrollable(arg, config, mapping); + return hoistNonReactStatic(result, arg); +} diff --git a/packages/amis/__tests__/components/404.test.tsx b/packages/amis-ui/__tests__/404.test.tsx similarity index 96% rename from packages/amis/__tests__/components/404.test.tsx rename to packages/amis-ui/__tests__/404.test.tsx index 4fd5ffcea..84291cfb1 100644 --- a/packages/amis/__tests__/components/404.test.tsx +++ b/packages/amis-ui/__tests__/404.test.tsx @@ -1,7 +1,6 @@ import React = require('react'); import {NotFound} from 'amis-ui'; import * as renderer from 'react-test-renderer'; -import '../../src'; import {render, fireEvent, cleanup} from '@testing-library/react'; afterEach(cleanup); diff --git a/packages/amis/__tests__/components/__snapshots__/404.test.tsx.snap b/packages/amis-ui/__tests__/__snapshots__/404.test.tsx.snap similarity index 100% rename from packages/amis/__tests__/components/__snapshots__/404.test.tsx.snap rename to packages/amis-ui/__tests__/__snapshots__/404.test.tsx.snap diff --git a/packages/amis-ui/package.json b/packages/amis-ui/package.json index 7b6a782c9..ae7df61f5 100644 --- a/packages/amis-ui/package.json +++ b/packages/amis-ui/package.json @@ -77,5 +77,40 @@ "rollup-plugin-scss": "^3.0.0", "sass": "^1.52.1", "typescript": "^4.6.4" + }, + "jest": { + "testEnvironment": "jsdom", + "collectCoverageFrom": [ + "src/**/*" + ], + "moduleFileExtensions": [ + "ts", + "tsx", + "js" + ], + "transform": { + "\\.(ts|tsx)$": "ts-jest" + }, + "setupFiles": [ + "jest-canvas-mock" + ], + "testRegex": "/.*\\.test\\.(ts|tsx|js)$", + "moduleNameMapper": { + "\\.(css|less|sass|scss)$": "/../../__mocks__/styleMock.js", + "\\.(svg)$": "/../../__mocks__/svgMock.js", + "\\.svg\\.js$": "/../../__mocks__/svgJsMock.js" + }, + "setupFilesAfterEnv": [ + "/../amis-core/__tests__/jest.setup.js" + ], + "testPathIgnorePatterns": [ + "/node_modules/", + "/.rollup.cache/" + ], + "globals": { + "ts-jest": { + "diagnostics": false + } + } } } diff --git a/packages/amis-ui/src/components/AnchorNav.tsx b/packages/amis-ui/src/components/AnchorNav.tsx index 7bb6160cb..6cd95ec52 100644 --- a/packages/amis-ui/src/components/AnchorNav.tsx +++ b/packages/amis-ui/src/components/AnchorNav.tsx @@ -8,7 +8,7 @@ import React from 'react'; import {ThemeProps, themeable} from 'amis-core'; import {autobind} from 'amis-core'; -import {uncontrollable} from 'uncontrollable'; +import {uncontrollable} from 'amis-core'; import find from 'lodash/find'; import type {PlainObject, Schema} from 'amis-core'; diff --git a/packages/amis-ui/src/components/ArrayInput.tsx b/packages/amis-ui/src/components/ArrayInput.tsx index bf67d9e34..11262e68b 100644 --- a/packages/amis-ui/src/components/ArrayInput.tsx +++ b/packages/amis-ui/src/components/ArrayInput.tsx @@ -5,7 +5,7 @@ import InputBox from './InputBox'; import {Icon} from './icons'; import Button from './Button'; import {autobind, guid} from 'amis-core'; -import {uncontrollable} from 'uncontrollable'; +import {uncontrollable} from 'amis-core'; import Sortable from 'sortablejs'; import {findDOMNode} from 'react-dom'; diff --git a/packages/amis-ui/src/components/AssociatedSelection.tsx b/packages/amis-ui/src/components/AssociatedSelection.tsx index b992a9b99..a0b2b1c35 100644 --- a/packages/amis-ui/src/components/AssociatedSelection.tsx +++ b/packages/amis-ui/src/components/AssociatedSelection.tsx @@ -9,7 +9,7 @@ import {BaseSelectionProps, BaseSelection} from './Selection'; import {Options, Option} from './Select'; import {autobind} from 'amis-core'; import {themeable} from 'amis-core'; -import {uncontrollable} from 'uncontrollable'; +import {uncontrollable} from 'amis-core'; import GroupedSelection from './GroupedSelection'; import TableSelection from './TableSelection'; import GroupedSelecton from './GroupedSelection'; diff --git a/packages/amis-ui/src/components/ChainedSelection.tsx b/packages/amis-ui/src/components/ChainedSelection.tsx index 7ea91d878..840f6eae3 100644 --- a/packages/amis-ui/src/components/ChainedSelection.tsx +++ b/packages/amis-ui/src/components/ChainedSelection.tsx @@ -4,7 +4,7 @@ import {BaseSelection, BaseSelectionProps} from './Selection'; import {themeable} from 'amis-core'; import React from 'react'; -import {uncontrollable} from 'uncontrollable'; +import {uncontrollable} from 'amis-core'; import Checkbox from './Checkbox'; import {Option} from './Select'; import {getTreeDepth} from 'amis-core'; diff --git a/packages/amis-ui/src/components/CityArea.tsx b/packages/amis-ui/src/components/CityArea.tsx index c732017ad..c24a9939f 100644 --- a/packages/amis-ui/src/components/CityArea.tsx +++ b/packages/amis-ui/src/components/CityArea.tsx @@ -8,7 +8,7 @@ import ResultBox from './ResultBox'; import {useSetState, useUpdateEffect} from '../hooks'; import {localeable, LocaleProps} from 'amis-core'; import {themeable, ThemeProps} from 'amis-core'; -import {uncontrollable} from 'uncontrollable'; +import {uncontrollable} from 'amis-core'; import PopUp from './PopUp'; import {PickerObjectOption} from './PickerColumn'; diff --git a/packages/amis-ui/src/components/ColorPicker.tsx b/packages/amis-ui/src/components/ColorPicker.tsx index 36b61641c..ebe1597c3 100644 --- a/packages/amis-ui/src/components/ColorPicker.tsx +++ b/packages/amis-ui/src/components/ColorPicker.tsx @@ -9,7 +9,7 @@ import {findDOMNode} from 'react-dom'; import {SketchPicker, GithubPicker, ColorResult} from 'react-color'; import {Icon} from './icons'; import Overlay from './Overlay'; -import {uncontrollable} from 'uncontrollable'; +import {uncontrollable} from 'amis-core'; import PopOver from './PopOver'; import PopUp from './PopUp'; import {ClassNamesFn, themeable, ThemeProps} from 'amis-core'; diff --git a/packages/amis-ui/src/components/GroupedSelection.tsx b/packages/amis-ui/src/components/GroupedSelection.tsx index 6c338cf4c..a013c782e 100644 --- a/packages/amis-ui/src/components/GroupedSelection.tsx +++ b/packages/amis-ui/src/components/GroupedSelection.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import {uncontrollable} from 'uncontrollable'; +import {uncontrollable} from 'amis-core'; import {BaseSelection, BaseSelectionProps} from './Selection'; import {themeable} from 'amis-core'; diff --git a/packages/amis-ui/src/components/Picker.tsx b/packages/amis-ui/src/components/Picker.tsx index 093ef6009..7a94e05d8 100644 --- a/packages/amis-ui/src/components/Picker.tsx +++ b/packages/amis-ui/src/components/Picker.tsx @@ -3,7 +3,7 @@ * @description 移动端列滚动选择器 */ import React, {memo, ReactNode, useState, useEffect} from 'react'; -import {uncontrollable} from 'uncontrollable'; +import {uncontrollable} from 'amis-core'; import {themeable, ThemeProps} from 'amis-core'; import {localeable, LocaleProps} from 'amis-core'; diff --git a/packages/amis-ui/src/components/PickerColumn.tsx b/packages/amis-ui/src/components/PickerColumn.tsx index 8d78384d0..90de584fc 100644 --- a/packages/amis-ui/src/components/PickerColumn.tsx +++ b/packages/amis-ui/src/components/PickerColumn.tsx @@ -12,7 +12,7 @@ import React, { } from 'react'; import isObject from 'lodash/isObject'; import cloneDeep from 'lodash/cloneDeep'; -import {uncontrollable} from 'uncontrollable'; +import {uncontrollable} from 'amis-core'; import {useSetState, useUpdateEffect} from '../hooks'; import {range} from 'amis-core'; diff --git a/packages/amis-ui/src/components/Radios.tsx b/packages/amis-ui/src/components/Radios.tsx index 63e016ae2..eecd69efc 100644 --- a/packages/amis-ui/src/components/Radios.tsx +++ b/packages/amis-ui/src/components/Radios.tsx @@ -15,7 +15,7 @@ */ import React from 'react'; -import {uncontrollable} from 'uncontrollable'; +import {uncontrollable} from 'amis-core'; import Checkbox from './Checkbox'; import Button from './Button'; import {value2array, OptionProps, Option} from './Select'; diff --git a/packages/amis-ui/src/components/Range.tsx b/packages/amis-ui/src/components/Range.tsx index fbe68d62a..49797dff6 100644 --- a/packages/amis-ui/src/components/Range.tsx +++ b/packages/amis-ui/src/components/Range.tsx @@ -9,7 +9,7 @@ import keys from 'lodash/keys'; import isString from 'lodash/isString'; import difference from 'lodash/difference'; import React from 'react'; -import {uncontrollable} from 'uncontrollable'; +import {uncontrollable} from 'amis-core'; import Overlay from './Overlay'; import type {ThemeProps} from 'amis-core'; diff --git a/packages/amis-ui/src/components/ResultBox.tsx b/packages/amis-ui/src/components/ResultBox.tsx index d5dd04c04..324593fbd 100644 --- a/packages/amis-ui/src/components/ResultBox.tsx +++ b/packages/amis-ui/src/components/ResultBox.tsx @@ -3,7 +3,7 @@ import React from 'react'; import omit from 'lodash/omit'; import isInteger from 'lodash/isInteger'; import {InputBoxProps} from './InputBox'; -import {uncontrollable} from 'uncontrollable'; +import {uncontrollable} from 'amis-core'; import {Icon} from './icons'; import Input from './Input'; import {autobind, isMobile, ucFirst} from 'amis-core'; diff --git a/packages/amis-ui/src/components/SearchBox.tsx b/packages/amis-ui/src/components/SearchBox.tsx index eebc78089..59e1551b3 100644 --- a/packages/amis-ui/src/components/SearchBox.tsx +++ b/packages/amis-ui/src/components/SearchBox.tsx @@ -1,7 +1,7 @@ import React from 'react'; import {ThemeProps, themeable} from 'amis-core'; import {Icon} from './icons'; -import {uncontrollable} from 'uncontrollable'; +import {uncontrollable} from 'amis-core'; import {autobind} from 'amis-core'; import {LocaleProps, localeable} from 'amis-core'; import debounce from 'lodash/debounce'; diff --git a/packages/amis-ui/src/components/Select.tsx b/packages/amis-ui/src/components/Select.tsx index 55bb790b9..03ee95cda 100644 --- a/packages/amis-ui/src/components/Select.tsx +++ b/packages/amis-ui/src/components/Select.tsx @@ -5,7 +5,7 @@ * @date 2017-11-07 */ -import {uncontrollable} from 'uncontrollable'; +import {uncontrollable} from 'amis-core'; import React from 'react'; import isInteger from 'lodash/isInteger'; import omit from 'lodash/omit'; diff --git a/packages/amis-ui/src/components/Selection.tsx b/packages/amis-ui/src/components/Selection.tsx index 49e1aa93e..e85430980 100644 --- a/packages/amis-ui/src/components/Selection.tsx +++ b/packages/amis-ui/src/components/Selection.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import {uncontrollable} from 'uncontrollable'; +import {uncontrollable} from 'amis-core'; import Checkbox from './Checkbox'; import chunk from 'lodash/chunk'; import {ClassNamesFn, themeable, ThemeProps} from 'amis-core'; diff --git a/packages/amis-ui/src/components/TableSelection.tsx b/packages/amis-ui/src/components/TableSelection.tsx index 08f840009..560f82632 100644 --- a/packages/amis-ui/src/components/TableSelection.tsx +++ b/packages/amis-ui/src/components/TableSelection.tsx @@ -1,7 +1,7 @@ import {BaseSelection, BaseSelectionProps} from './Selection'; import {noop, themeable} from 'amis-core'; import React from 'react'; -import {uncontrollable} from 'uncontrollable'; +import {uncontrollable} from 'amis-core'; import Checkbox from './Checkbox'; import {Option} from './Select'; import {resolveVariable} from 'amis-core'; diff --git a/packages/amis-ui/src/components/Tabs.tsx b/packages/amis-ui/src/components/Tabs.tsx index c340f4944..0da3b7602 100644 --- a/packages/amis-ui/src/components/Tabs.tsx +++ b/packages/amis-ui/src/components/Tabs.tsx @@ -8,7 +8,7 @@ import React from 'react'; import type {ClassName, Schema} from 'amis-core'; import Transition, {ENTERED, ENTERING} from 'react-transition-group/Transition'; import {themeable, ThemeProps} from 'amis-core'; -import {uncontrollable} from 'uncontrollable'; +import {uncontrollable} from 'amis-core'; import {generateIcon} from 'amis-core'; import {autobind, guid} from 'amis-core'; import {Icon} from './icons'; diff --git a/packages/amis-ui/src/components/TabsTransferPicker.tsx b/packages/amis-ui/src/components/TabsTransferPicker.tsx index 24743556d..61648ffd2 100644 --- a/packages/amis-ui/src/components/TabsTransferPicker.tsx +++ b/packages/amis-ui/src/components/TabsTransferPicker.tsx @@ -1,6 +1,6 @@ import {localeable} from 'amis-core'; import {themeable} from 'amis-core'; -import {uncontrollable} from 'uncontrollable'; +import {uncontrollable} from 'amis-core'; import React from 'react'; import ResultBox from './ResultBox'; import {Icon} from './icons'; diff --git a/packages/amis-ui/src/components/TooltipWrapper.tsx b/packages/amis-ui/src/components/TooltipWrapper.tsx index ae4c32443..64ee627b9 100644 --- a/packages/amis-ui/src/components/TooltipWrapper.tsx +++ b/packages/amis-ui/src/components/TooltipWrapper.tsx @@ -6,7 +6,7 @@ import React from 'react'; import Html from './Html'; -import {uncontrollable} from 'uncontrollable'; +import {uncontrollable} from 'amis-core'; import {findDOMNode} from 'react-dom'; import Tooltip from './Tooltip'; import {ClassNamesFn, themeable} from 'amis-core'; diff --git a/packages/amis-ui/src/components/Transfer.tsx b/packages/amis-ui/src/components/Transfer.tsx index 913f76af0..8eb3355ff 100644 --- a/packages/amis-ui/src/components/Transfer.tsx +++ b/packages/amis-ui/src/components/Transfer.tsx @@ -10,7 +10,7 @@ import { import {ThemeProps, themeable} from 'amis-core'; import {BaseSelectionProps, BaseSelection, ItemRenderStates} from './Selection'; import {Options, Option} from './Select'; -import {uncontrollable} from 'uncontrollable'; +import {uncontrollable} from 'amis-core'; import ResultList from './ResultList'; import TableSelection from './TableSelection'; import {autobind, flattenTree} from 'amis-core'; diff --git a/packages/amis-ui/src/components/TransferDropDown.tsx b/packages/amis-ui/src/components/TransferDropDown.tsx index 0ad3b5c77..139b820d2 100644 --- a/packages/amis-ui/src/components/TransferDropDown.tsx +++ b/packages/amis-ui/src/components/TransferDropDown.tsx @@ -1,7 +1,7 @@ import {localeable} from 'amis-core'; import {themeable} from 'amis-core'; import {Transfer, TransferProps} from './Transfer'; -import {uncontrollable} from 'uncontrollable'; +import {uncontrollable} from 'amis-core'; import React from 'react'; import ResultBox from './ResultBox'; import {Icon} from './icons'; diff --git a/packages/amis-ui/src/components/TransferPicker.tsx b/packages/amis-ui/src/components/TransferPicker.tsx index a6f80c766..fc3024ef2 100644 --- a/packages/amis-ui/src/components/TransferPicker.tsx +++ b/packages/amis-ui/src/components/TransferPicker.tsx @@ -1,7 +1,7 @@ import {localeable} from 'amis-core'; import {themeable} from 'amis-core'; import Transfer, {TransferProps} from './Transfer'; -import {uncontrollable} from 'uncontrollable'; +import {uncontrollable} from 'amis-core'; import React from 'react'; import ResultBox from './ResultBox'; import {Icon} from './icons'; diff --git a/packages/amis-ui/src/components/TreeSelection.tsx b/packages/amis-ui/src/components/TreeSelection.tsx index f85559241..eb68163b7 100644 --- a/packages/amis-ui/src/components/TreeSelection.tsx +++ b/packages/amis-ui/src/components/TreeSelection.tsx @@ -1,7 +1,7 @@ import {BaseSelection, BaseSelectionProps} from './Selection'; import {themeable} from 'amis-core'; import React from 'react'; -import {uncontrollable} from 'uncontrollable'; +import {uncontrollable} from 'amis-core'; import Checkbox from './Checkbox'; import {Option} from './Select'; import {autobind, eachTree, everyTree} from 'amis-core'; diff --git a/packages/amis-ui/src/components/condition-builder/index.tsx b/packages/amis-ui/src/components/condition-builder/index.tsx index e7ef055f4..59e8b1993 100644 --- a/packages/amis-ui/src/components/condition-builder/index.tsx +++ b/packages/amis-ui/src/components/condition-builder/index.tsx @@ -13,7 +13,7 @@ import { mapTree, guid } from 'amis-core'; -import {uncontrollable} from 'uncontrollable'; +import {uncontrollable} from 'amis-core'; import { ConditionBuilderFields, ConditionGroupValue, diff --git a/packages/amis-ui/src/components/formula/Editor.tsx b/packages/amis-ui/src/components/formula/Editor.tsx index cf6ab7e8a..a43131951 100644 --- a/packages/amis-ui/src/components/formula/Editor.tsx +++ b/packages/amis-ui/src/components/formula/Editor.tsx @@ -2,7 +2,7 @@ * @file 公式编辑器 */ import React from 'react'; -import {uncontrollable} from 'uncontrollable'; +import {uncontrollable} from 'amis-core'; import { parse, autobind, diff --git a/packages/amis-ui/src/components/formula/Picker.tsx b/packages/amis-ui/src/components/formula/Picker.tsx index 2a323bc15..cf26ce98c 100644 --- a/packages/amis-ui/src/components/formula/Picker.tsx +++ b/packages/amis-ui/src/components/formula/Picker.tsx @@ -1,4 +1,4 @@ -import {uncontrollable} from 'uncontrollable'; +import {uncontrollable} from 'amis-core'; import React from 'react'; import { FormulaEditor, diff --git a/packages/amis-ui/src/components/schema-editor/index.tsx b/packages/amis-ui/src/components/schema-editor/index.tsx index b825ba372..099ca6680 100644 --- a/packages/amis-ui/src/components/schema-editor/index.tsx +++ b/packages/amis-ui/src/components/schema-editor/index.tsx @@ -11,7 +11,7 @@ import { autobind, JSONSchema } from 'amis-core'; -import {uncontrollable} from 'uncontrollable'; +import {uncontrollable} from 'amis-core'; import {SchemaEditorItem} from './Item'; import type {JSONSchema7TypeName} from 'json-schema'; diff --git a/packages/amis-ui/tsconfig.json b/packages/amis-ui/tsconfig.json index 96434460d..2735e705f 100644 --- a/packages/amis-ui/tsconfig.json +++ b/packages/amis-ui/tsconfig.json @@ -9,11 +9,6 @@ "../../node_modules/@types" ] }, - "include": [ - "src/**/*", - "__tests__/**/*", - "src/custom.d.ts", - "../amis-core/src/utils/formula.ts" - ], + "include": ["src/**/*", "__tests__/**/*", "src/custom.d.ts"], "references": [{"path": "../amis-core"}] } diff --git a/packages/amis/__tests__/renderers/Form/__snapshots__/inputFormula.test.tsx.snap b/packages/amis/__tests__/renderers/Form/__snapshots__/inputFormula.test.tsx.snap index 9df267479..d27f67076 100644 --- a/packages/amis/__tests__/renderers/Form/__snapshots__/inputFormula.test.tsx.snap +++ b/packages/amis/__tests__/renderers/Form/__snapshots__/inputFormula.test.tsx.snap @@ -381,12 +381,17 @@ exports[`Renderer:input-formula input-group 1`] = `
- +
+ +
diff --git a/packages/amis/__tests__/renderers/Form/array.test.tsx b/packages/amis/__tests__/renderers/Form/array.test.tsx index 962c17b8f..efa3b2bc0 100644 --- a/packages/amis/__tests__/renderers/Form/array.test.tsx +++ b/packages/amis/__tests__/renderers/Form/array.test.tsx @@ -3,7 +3,7 @@ import {render, cleanup} from '@testing-library/react'; import '../../../src'; import {render as amisRender} from '../../../src'; import {makeEnv} from '../../helper'; -import {clearStoresCache} from 'amis'; +import {clearStoresCache} from '../../../src'; afterEach(() => { cleanup(); diff --git a/packages/amis/__tests__/renderers/Form/autoFill.test.tsx b/packages/amis/__tests__/renderers/Form/autoFill.test.tsx index 4d8b6dbe1..647f03d2d 100644 --- a/packages/amis/__tests__/renderers/Form/autoFill.test.tsx +++ b/packages/amis/__tests__/renderers/Form/autoFill.test.tsx @@ -3,7 +3,7 @@ import {render, cleanup, fireEvent, waitFor} from '@testing-library/react'; import '../../../src'; import {render as amisRender} from '../../../src'; import {makeEnv, wait} from '../../helper'; -import {clearStoresCache} from 'amis'; +import {clearStoresCache} from '../../../src'; afterEach(() => { cleanup(); diff --git a/packages/amis/__tests__/renderers/Form/button.test.tsx b/packages/amis/__tests__/renderers/Form/button.test.tsx index 840f07a6b..b22e22f07 100644 --- a/packages/amis/__tests__/renderers/Form/button.test.tsx +++ b/packages/amis/__tests__/renderers/Form/button.test.tsx @@ -3,7 +3,7 @@ import {render, cleanup, fireEvent} from '@testing-library/react'; import '../../../src'; import {render as amisRender} from '../../../src'; import {wait, makeEnv} from '../../helper'; -import {clearStoresCache} from 'amis'; +import {clearStoresCache} from '../../../src'; afterEach(() => { cleanup(); diff --git a/packages/amis/__tests__/renderers/Form/buttonGroup.test.tsx b/packages/amis/__tests__/renderers/Form/buttonGroup.test.tsx index 7a4a4afdc..4cb4ba0c2 100644 --- a/packages/amis/__tests__/renderers/Form/buttonGroup.test.tsx +++ b/packages/amis/__tests__/renderers/Form/buttonGroup.test.tsx @@ -3,7 +3,7 @@ import {render, cleanup, fireEvent, waitFor} from '@testing-library/react'; import '../../../src'; import {render as amisRender} from '../../../src'; import {makeEnv, wait} from '../../helper'; -import {clearStoresCache} from 'amis'; +import {clearStoresCache} from '../../../src'; afterEach(() => { cleanup(); diff --git a/packages/amis/__tests__/renderers/Form/buttonToolBar.test.tsx b/packages/amis/__tests__/renderers/Form/buttonToolBar.test.tsx index 697fdd850..f9f06ad0d 100644 --- a/packages/amis/__tests__/renderers/Form/buttonToolBar.test.tsx +++ b/packages/amis/__tests__/renderers/Form/buttonToolBar.test.tsx @@ -3,7 +3,7 @@ import {render, cleanup, fireEvent} from '@testing-library/react'; import '../../../src'; import {render as amisRender} from '../../../src'; import {makeEnv, wait} from '../../helper'; -import {clearStoresCache} from 'amis'; +import {clearStoresCache} from '../../../src'; afterEach(() => { cleanup(); diff --git a/packages/amis/__tests__/renderers/Form/checkbox.test.tsx b/packages/amis/__tests__/renderers/Form/checkbox.test.tsx index b78227e5f..8f690e570 100644 --- a/packages/amis/__tests__/renderers/Form/checkbox.test.tsx +++ b/packages/amis/__tests__/renderers/Form/checkbox.test.tsx @@ -3,7 +3,7 @@ import {render, cleanup, fireEvent} from '@testing-library/react'; import '../../../src'; import {render as amisRender} from '../../../src'; import {makeEnv} from '../../helper'; -import {clearStoresCache} from 'amis'; +import {clearStoresCache} from '../../../src'; afterEach(() => { cleanup(); diff --git a/packages/amis/__tests__/renderers/Form/checkboxes.test.tsx b/packages/amis/__tests__/renderers/Form/checkboxes.test.tsx index ade41bb6a..03ca8d47b 100644 --- a/packages/amis/__tests__/renderers/Form/checkboxes.test.tsx +++ b/packages/amis/__tests__/renderers/Form/checkboxes.test.tsx @@ -3,7 +3,7 @@ import {render, cleanup, fireEvent} from '@testing-library/react'; import '../../../src'; import {render as amisRender} from '../../../src'; import {makeEnv, wait} from '../../helper'; -import {clearStoresCache} from 'amis'; +import {clearStoresCache} from '../../../src'; afterEach(() => { cleanup(); diff --git a/packages/amis/__tests__/renderers/Form/control.test.tsx b/packages/amis/__tests__/renderers/Form/control.test.tsx index 56a773bb0..0057fc0af 100644 --- a/packages/amis/__tests__/renderers/Form/control.test.tsx +++ b/packages/amis/__tests__/renderers/Form/control.test.tsx @@ -3,7 +3,7 @@ import {render, cleanup, fireEvent, waitFor} from '@testing-library/react'; import '../../../src'; import {render as amisRender} from '../../../src'; import {makeEnv, wait} from '../../helper'; -import {clearStoresCache} from 'amis'; +import {clearStoresCache} from '../../../src'; afterEach(() => { cleanup(); diff --git a/packages/amis/__tests__/renderers/Form/formitem.test.tsx b/packages/amis/__tests__/renderers/Form/formitem.test.tsx index 8c6f73f67..eab8e5fcb 100644 --- a/packages/amis/__tests__/renderers/Form/formitem.test.tsx +++ b/packages/amis/__tests__/renderers/Form/formitem.test.tsx @@ -3,7 +3,7 @@ import {render, fireEvent, cleanup} from '@testing-library/react'; import '../../../src'; import {render as amisRender} from '../../../src'; import {wait, makeEnv} from '../../helper'; -import {clearStoresCache} from 'amis'; +import {clearStoresCache} from '../../../src'; afterEach(() => { cleanup(); diff --git a/packages/amis/__tests__/renderers/Form/grid.test.tsx b/packages/amis/__tests__/renderers/Form/grid.test.tsx index 7e371187a..e14576cff 100644 --- a/packages/amis/__tests__/renderers/Form/grid.test.tsx +++ b/packages/amis/__tests__/renderers/Form/grid.test.tsx @@ -3,7 +3,7 @@ import {render, cleanup} from '@testing-library/react'; import '../../../src'; import {render as amisRender} from '../../../src'; import {makeEnv} from '../../helper'; -import {clearStoresCache} from 'amis'; +import {clearStoresCache} from '../../../src'; afterEach(() => { cleanup(); diff --git a/packages/amis/__tests__/renderers/Form/group.test.tsx b/packages/amis/__tests__/renderers/Form/group.test.tsx index e847d2f6f..f4c1e09a4 100644 --- a/packages/amis/__tests__/renderers/Form/group.test.tsx +++ b/packages/amis/__tests__/renderers/Form/group.test.tsx @@ -3,7 +3,7 @@ import {render, cleanup} from '@testing-library/react'; import '../../../src'; import {render as amisRender} from '../../../src'; import {makeEnv} from '../../helper'; -import {clearStoresCache} from 'amis'; +import {clearStoresCache} from '../../../src'; afterEach(() => { cleanup(); diff --git a/packages/amis/__tests__/renderers/Form/hbox.test.tsx b/packages/amis/__tests__/renderers/Form/hbox.test.tsx index f2b52b84b..dfe8f7e2c 100644 --- a/packages/amis/__tests__/renderers/Form/hbox.test.tsx +++ b/packages/amis/__tests__/renderers/Form/hbox.test.tsx @@ -3,7 +3,7 @@ import {render, cleanup} from '@testing-library/react'; import '../../../src'; import {render as amisRender} from '../../../src'; import {makeEnv} from '../../helper'; -import {clearStoresCache} from 'amis'; +import {clearStoresCache} from '../../../src'; afterEach(() => { cleanup(); diff --git a/packages/amis/__tests__/renderers/Form/index.test.tsx b/packages/amis/__tests__/renderers/Form/index.test.tsx index b81bd7d95..4c1d12b7c 100644 --- a/packages/amis/__tests__/renderers/Form/index.test.tsx +++ b/packages/amis/__tests__/renderers/Form/index.test.tsx @@ -11,7 +11,7 @@ import { import '../../../src'; import {render as amisRender} from '../../../src'; import {wait, makeEnv} from '../../helper'; -import {clearStoresCache} from 'amis'; +import {clearStoresCache} from '../../../src'; import {createMemoryHistory} from 'history'; // mock getComputedStyle diff --git a/packages/amis/__tests__/renderers/Form/initData.test.tsx b/packages/amis/__tests__/renderers/Form/initData.test.tsx index 2a77e7816..dcae7db7c 100644 --- a/packages/amis/__tests__/renderers/Form/initData.test.tsx +++ b/packages/amis/__tests__/renderers/Form/initData.test.tsx @@ -3,7 +3,7 @@ import {render, cleanup, fireEvent, waitFor} from '@testing-library/react'; import '../../../src'; import {render as amisRender} from '../../../src'; import {makeEnv, wait} from '../../helper'; -import {clearStoresCache} from 'amis'; +import {clearStoresCache} from '../../../src'; afterEach(() => { cleanup(); diff --git a/packages/amis/__tests__/renderers/Form/list.test.tsx b/packages/amis/__tests__/renderers/Form/list.test.tsx index 2894007a4..f8f66651c 100644 --- a/packages/amis/__tests__/renderers/Form/list.test.tsx +++ b/packages/amis/__tests__/renderers/Form/list.test.tsx @@ -3,7 +3,7 @@ import {render, cleanup, fireEvent, waitFor} from '@testing-library/react'; import '../../../src'; import {render as amisRender} from '../../../src'; import {makeEnv, wait} from '../../helper'; -import {clearStoresCache} from 'amis'; +import {clearStoresCache} from '../../../src'; afterEach(() => { cleanup(); diff --git a/packages/amis/__tests__/renderers/Form/options.test.tsx b/packages/amis/__tests__/renderers/Form/options.test.tsx index 3468bf34d..32d7359b3 100644 --- a/packages/amis/__tests__/renderers/Form/options.test.tsx +++ b/packages/amis/__tests__/renderers/Form/options.test.tsx @@ -3,7 +3,7 @@ import {render, cleanup, fireEvent} from '@testing-library/react'; import '../../../src'; import {render as amisRender} from '../../../src'; import {makeEnv, wait} from '../../helper'; -import {clearStoresCache} from 'amis'; +import {clearStoresCache} from '../../../src'; afterEach(() => { cleanup(); diff --git a/packages/amis/__tests__/renderers/Form/panel.test.tsx b/packages/amis/__tests__/renderers/Form/panel.test.tsx index 1392cbf99..e32fe6b53 100644 --- a/packages/amis/__tests__/renderers/Form/panel.test.tsx +++ b/packages/amis/__tests__/renderers/Form/panel.test.tsx @@ -3,7 +3,7 @@ import {render, cleanup} from '@testing-library/react'; import '../../../src'; import {render as amisRender} from '../../../src'; import {makeEnv} from '../../helper'; -import {clearStoresCache} from 'amis'; +import {clearStoresCache} from '../../../src'; afterEach(() => { cleanup(); diff --git a/packages/amis/__tests__/renderers/Form/radios.test.tsx b/packages/amis/__tests__/renderers/Form/radios.test.tsx index 507c97340..424e5bed7 100644 --- a/packages/amis/__tests__/renderers/Form/radios.test.tsx +++ b/packages/amis/__tests__/renderers/Form/radios.test.tsx @@ -3,7 +3,7 @@ import {render, cleanup, fireEvent, waitFor} from '@testing-library/react'; import '../../../src'; import {render as amisRender} from '../../../src'; import {makeEnv, wait} from '../../helper'; -import {clearStoresCache} from 'amis'; +import {clearStoresCache} from '../../../src'; afterEach(() => { cleanup(); diff --git a/packages/amis/__tests__/renderers/Form/service.test.tsx b/packages/amis/__tests__/renderers/Form/service.test.tsx index 61edb4900..652847bac 100644 --- a/packages/amis/__tests__/renderers/Form/service.test.tsx +++ b/packages/amis/__tests__/renderers/Form/service.test.tsx @@ -3,7 +3,7 @@ import {render, cleanup, fireEvent, waitFor} from '@testing-library/react'; import '../../../src'; import {render as amisRender} from '../../../src'; import {makeEnv, wait} from '../../helper'; -import {clearStoresCache} from 'amis'; +import {clearStoresCache} from '../../../src'; afterEach(() => { cleanup(); diff --git a/packages/amis/__tests__/renderers/Form/static.test.tsx b/packages/amis/__tests__/renderers/Form/static.test.tsx index bfaf68e97..af524f744 100644 --- a/packages/amis/__tests__/renderers/Form/static.test.tsx +++ b/packages/amis/__tests__/renderers/Form/static.test.tsx @@ -3,7 +3,7 @@ import {render, cleanup} from '@testing-library/react'; import '../../../src'; import {render as amisRender} from '../../../src'; import {makeEnv} from '../../helper'; -import {clearStoresCache} from 'amis'; +import {clearStoresCache} from '../../../src'; afterEach(() => { cleanup(); diff --git a/packages/amis/__tests__/renderers/Form/switch.test.tsx b/packages/amis/__tests__/renderers/Form/switch.test.tsx index f04cc02b7..e33df62a4 100644 --- a/packages/amis/__tests__/renderers/Form/switch.test.tsx +++ b/packages/amis/__tests__/renderers/Form/switch.test.tsx @@ -3,7 +3,7 @@ import {render, cleanup} from '@testing-library/react'; import '../../../src'; import {render as amisRender} from '../../../src'; import {makeEnv} from '../../helper'; -import {clearStoresCache} from 'amis'; +import {clearStoresCache} from '../../../src'; afterEach(() => { cleanup(); diff --git a/packages/amis/__tests__/renderers/Form/tabs.test.tsx b/packages/amis/__tests__/renderers/Form/tabs.test.tsx index 3dba12673..5261d2c5a 100644 --- a/packages/amis/__tests__/renderers/Form/tabs.test.tsx +++ b/packages/amis/__tests__/renderers/Form/tabs.test.tsx @@ -3,7 +3,7 @@ import {render, cleanup} from '@testing-library/react'; import '../../../src'; import {render as amisRender} from '../../../src'; import {makeEnv} from '../../helper'; -import {clearStoresCache} from 'amis'; +import {clearStoresCache} from '../../../src'; afterEach(() => { cleanup(); diff --git a/packages/amis/__tests__/renderers/Form/text.test.tsx b/packages/amis/__tests__/renderers/Form/text.test.tsx index 661231bc5..00b33b6ab 100644 --- a/packages/amis/__tests__/renderers/Form/text.test.tsx +++ b/packages/amis/__tests__/renderers/Form/text.test.tsx @@ -3,7 +3,7 @@ import {render, cleanup, fireEvent, waitFor} from '@testing-library/react'; import '../../../src'; import {render as amisRender} from '../../../src'; import {makeEnv, wait} from '../../helper'; -import {clearStoresCache} from 'amis'; +import {clearStoresCache} from '../../../src'; afterEach(() => { cleanup(); diff --git a/packages/amis/__tests__/renderers/Page.test.tsx b/packages/amis/__tests__/renderers/Page.test.tsx index 9911f8416..a0c9c3888 100644 --- a/packages/amis/__tests__/renderers/Page.test.tsx +++ b/packages/amis/__tests__/renderers/Page.test.tsx @@ -5,7 +5,7 @@ import {render, fireEvent, cleanup, waitFor} from '@testing-library/react'; import '../../src'; import {render as amisRender} from '../../src'; import {wait, makeEnv} from '../helper'; -import {clearStoresCache} from 'amis'; +import {clearStoresCache} from '../../src'; import {createMemoryHistory} from 'history'; afterEach(() => { diff --git a/packages/amis/__tests__/renderers/Tabs.test.tsx b/packages/amis/__tests__/renderers/Tabs.test.tsx index f4a078f95..7b3cbc455 100644 --- a/packages/amis/__tests__/renderers/Tabs.test.tsx +++ b/packages/amis/__tests__/renderers/Tabs.test.tsx @@ -3,7 +3,7 @@ import {render, cleanup} from '@testing-library/react'; import '../../src'; import {render as amisRender} from '../../src'; import {makeEnv} from '../helper'; -import {clearStoresCache} from 'amis'; +import {clearStoresCache} from '../../src'; afterEach(() => { cleanup(); diff --git a/packages/amis/__tests__/renderers/Timeline.test.tsx b/packages/amis/__tests__/renderers/Timeline.test.tsx index 57a3f8771..3837c2672 100644 --- a/packages/amis/__tests__/renderers/Timeline.test.tsx +++ b/packages/amis/__tests__/renderers/Timeline.test.tsx @@ -3,7 +3,7 @@ import {render, cleanup} from '@testing-library/react'; import '../../src'; import {render as amisRender} from '../../src'; import {makeEnv} from '../helper'; -import {clearStoresCache} from 'amis'; +import {clearStoresCache} from '../../src'; afterEach(() => { cleanup(); diff --git a/packages/amis/__tests__/renderers/Wizard.test.tsx b/packages/amis/__tests__/renderers/Wizard.test.tsx index 73e38a780..b0f5dce57 100644 --- a/packages/amis/__tests__/renderers/Wizard.test.tsx +++ b/packages/amis/__tests__/renderers/Wizard.test.tsx @@ -10,7 +10,7 @@ import { import '../../src'; import {render as amisRender} from '../../src'; import {wait, makeEnv} from '../helper'; -import {clearStoresCache} from 'amis'; +import {clearStoresCache} from '../../src'; afterEach(() => { cleanup(); diff --git a/packages/amis/__tests__/renderers/__snapshots__/Breadcrumb.test.tsx.snap b/packages/amis/__tests__/renderers/__snapshots__/Breadcrumb.test.tsx.snap index d037aa9c5..96c96f8bc 100644 --- a/packages/amis/__tests__/renderers/__snapshots__/Breadcrumb.test.tsx.snap +++ b/packages/amis/__tests__/renderers/__snapshots__/Breadcrumb.test.tsx.snap @@ -104,17 +104,10 @@ exports[`Renderer:breadcrumb className 1`] = ` - - - + />