调试编译脚本

This commit is contained in:
liaoxuezhi 2022-06-02 13:28:23 +08:00
parent 5f077fc31c
commit d6bd8ab0e2
73 changed files with 187 additions and 344 deletions

View File

@ -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

View File

@ -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

View File

@ -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');

View File

@ -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",

View File

@ -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",

View File

@ -15,6 +15,8 @@ import {
} from './package.json';
import path from 'path';
const isDev = process.env.NODE_ENV !== 'production';
const settings = {
globals: {}
};
@ -55,7 +57,9 @@ export default [
plugins: getPlugins('cjs')
},
{
isDev
? null
: {
input,
output: [
@ -71,7 +75,7 @@ export default [
external,
plugins: getPlugins('esm')
}
];
].filter(item => item);
function transpileDynamicImportForCJS(options) {
return {

View File

@ -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' &&

View File

@ -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) {

View File

@ -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';

View File

@ -0,0 +1,12 @@
import {uncontrollable as baseuncontrollable} from 'uncontrollable';
import hoistNonReactStatic from 'hoist-non-react-statics';
export function uncontrollable<
T extends React.ComponentType<any>,
P extends {
[propName: string]: any;
}
>(arg: T, config: P, mapping?: any): T {
const result = baseuncontrollable(arg, config, mapping);
return hoistNonReactStatic(result, arg);
}

View File

@ -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);

View File

@ -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)$": "<rootDir>/../../__mocks__/styleMock.js",
"\\.(svg)$": "<rootDir>/../../__mocks__/svgMock.js",
"\\.svg\\.js$": "<rootDir>/../../__mocks__/svgJsMock.js"
},
"setupFilesAfterEnv": [
"<rootDir>/../amis-core/__tests__/jest.setup.js"
],
"testPathIgnorePatterns": [
"/node_modules/",
"/.rollup.cache/"
],
"globals": {
"ts-jest": {
"diagnostics": false
}
}
}
}

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -13,7 +13,7 @@ import {
mapTree,
guid
} from 'amis-core';
import {uncontrollable} from 'uncontrollable';
import {uncontrollable} from 'amis-core';
import {
ConditionBuilderFields,
ConditionGroupValue,

View File

@ -2,7 +2,7 @@
* @file
*/
import React from 'react';
import {uncontrollable} from 'uncontrollable';
import {uncontrollable} from 'amis-core';
import {
parse,
autobind,

View File

@ -1,4 +1,4 @@
import {uncontrollable} from 'uncontrollable';
import {uncontrollable} from 'amis-core';
import React from 'react';
import {
FormulaEditor,

View File

@ -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';

View File

@ -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"}]
}

View File

@ -380,13 +380,18 @@ exports[`Renderer:input-formula input-group 1`] = `
</label>
<div
class="cxd-FormulaPicker cxd-Form-control is-input-group"
>
<div
class="cxd-ResultBox cxd-FormulaPicker-input cxd-ResultBox--borderFull"
tabindex="-1"
>
<input
autocomplete="off"
class="cxd-FormulaPicker-input"
placeholder="暂无数据"
theme="cxd"
type="text"
value="SUM(1 + 2)"
/>
</div>
<a
class="cxd-FormulaPicker-toggler"
>

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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(() => {

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -104,17 +104,10 @@ exports[`Renderer:breadcrumb className 1`] = `
<span
class="cxd-Breadcrumb-item-caret"
>
<svg
class="icon icon-caret"
<icon-mock
classname="icon icon-caret"
icon="caret"
viewBox="0 0 12 8"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M10.473 0 6 4.8 1.527 0 0 1.6 6 8l6-6.4z"
fill="currentColor"
/>
</svg>
</span>
<ul
class="cxd-Breadcrumb-dropdown dropdownClassName"

View File

@ -1,145 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Renderer: dragging selectable checkable selected hideCheckToggler multiple 1`] = `
<div
className="cxd-Page"
onClick={[Function]}
>
<div
className="cxd-Page-content"
>
<div
className="cxd-Page-main"
>
<div
className="cxd-Page-body"
>
<div
className="cxd-Card"
onClick={[Function]}
>
<div
className="cxd-Card-heading"
>
<div
className="cxd-Card-meta"
/>
<div
className="cxd-Card-toolbar"
>
<label
className="cxd-Checkbox cxd-Checkbox--radio cxd-Card-checkbox cxd-Checkbox--full"
>
<input
checked={false}
disabled={false}
onChange={[Function]}
onClick={[Function]}
type="radio"
/>
<i />
<span
className=""
/>
</label>
<div
className="cxd-Card-dragBtn"
>
<icon-mock
className="icon icon-drag-bar"
icon="drag-bar"
/>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
`;
exports[`Renderer:actionCount:1 1`] = `
<div>
<div
class="cxd-Page"
>
<div
class="cxd-Page-content"
>
<div
class="cxd-Page-main"
>
<div
class="cxd-Page-body"
>
<div
class="cxd-Card className"
>
<div
class="cxd-Card-heading"
>
<div
class="cxd-Card-meta"
>
<div
class="cxd-Card-title"
>
<span
class="cxd-TplField"
>
<span>
标题
</span>
</span>
</div>
</div>
</div>
<div
class="cxd-Card-body bodyClassName"
>
<span
class="cxd-TplField"
>
<span>
这里是内容
</span>
</span>
</div>
<div
class="cxd-Card-footer-wrapper"
>
<div
class="cxd-Card-actions-wrapper"
>
<div
class="cxd-Card-actions"
>
<a
class="cxd-Card-action cxd-Card-action--sm"
>
<span>
编辑
</span>
</a>
<a
class="cxd-Card-action cxd-Card-action--sm"
>
<span>
删除
</span>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
`;
exports[`Renderer:card 1`] = `
<div>
<div
@ -881,88 +741,3 @@ exports[`Renderer:cards media 1`] = `
</div>
</div>
`;
exports[`Renderer:header 1`] = `
<div>
<div
class="cxd-Page"
>
<div
class="cxd-Page-content"
>
<div
class="cxd-Page-main"
>
<div
class="cxd-Page-body"
>
<div
class="cxd-Card"
>
<div
class="cxd-Card-heading className"
>
<span
class="cxd-Card-avtar pull-left thumb-md avatar b-3x m-r"
>
<img
class="cxd-Card-img imageClassName"
src="data:image/svg+xml,%3C%3Fxml version='1.0' standalone='no'%3F%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg t='1631083237695' class='icon' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='2420' xmlns:xlink='http://www.w3.org/1999/xlink' width='1024' height='1024'%3E%3Cdefs%3E%3Cstyle type='text/css'%3E%3C/style%3E%3C/defs%3E%3Cpath d='M959.872 128c0.032 0.032 0.096 0.064 0.128 0.128v767.776c-0.032 0.032-0.064 0.096-0.128 0.128H64.096c-0.032-0.032-0.096-0.064-0.128-0.128V128.128c0.032-0.032 0.064-0.096 0.128-0.128h895.776zM960 64H64C28.8 64 0 92.8 0 128v768c0 35.2 28.8 64 64 64h896c35.2 0 64-28.8 64-64V128c0-35.2-28.8-64-64-64z' p-id='2421' fill='%23bfbfbf'%3E%3C/path%3E%3Cpath d='M832 288c0 53.024-42.976 96-96 96s-96-42.976-96-96 42.976-96 96-96 96 42.976 96 96zM896 832H128V704l224-384 256 320h64l224-192z' p-id='2422' fill='%23bfbfbf'%3E%3C/path%3E%3C/svg%3E"
/>
</span>
<div
class="cxd-Card-meta"
>
<div
class="cxd-Card-title titleClassName"
>
<span
class="cxd-TplField"
>
<span>
标题
</span>
</span>
</div>
<div
class="cxd-Card-subTitle subTitleClassName"
>
<span
class="cxd-TplField"
>
<span>
副标题
</span>
</span>
</div>
<div
class="cxd-Card-desc descriptionClassName"
>
<span
class="cxd-TplField"
>
<span>
这是一段描述
</span>
</span>
</div>
</div>
</div>
<div
class="cxd-Card-body"
>
<span
class="cxd-TplField"
>
<span>
这里是内容
</span>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
`;

View File

@ -6,46 +6,49 @@ export NODE_ENV=production
rm -rf lib
rm -rf output
echo "===fis release==="
./node_modules/.bin/fis3 release publish -c
rm -rf lib/node_modules
echo "===rollup build==="
NODE_ENV=production ../../node_modules/.bin/rollup -c
# 生成 .d.ts 文件
echo "===generate .d.ts==="
./node_modules/.bin/tsc --declaration --emitDeclarationOnly --outDir ./lib --project ./tsconfig-for-declaration.json
# 从 amis-ui 中复制 css
mkdir -p lib/themes
cp ../../node_modules/amis-ui/lib/themes/ang.css lib/themes/ang.css
cp ../../node_modules/amis-ui/lib/themes/dark.css lib/themes/dark.css
cp ../../node_modules/amis-ui/lib/themes/antd.css lib/themes/antd.css
cp ../../node_modules/amis-ui/lib/themes/cxd.css lib/themes/cxd.css
cp ../../node_modules/amis-ui/lib/helper.css lib/helper.css
# 生成 sdk
echo "===fis sdk==="
rm -rf sdk && ./node_modules/.bin/fis3 release publish-sdk -c -f ../../fis-conf.js
rm -rf sdk && ../../node_modules/.bin/fis3 release publish-sdk -c -f ../../fis-conf.js
cp -r node_modules/monaco-editor/min/vs/base/browser sdk/thirds/monaco-editor/min/vs/base
cp -r ../../node_modules/monaco-editor/min/vs/base/browser sdk/thirds/monaco-editor/min/vs/base
echo "===postcss ie11==="
# 生成去掉变量的 css动画设置为零
echo ':root { --animation-duration: 0s;}' >>sdk/ie11-patch.css
cat lib/themes/ang.css | ./node_modules/.bin/postcss >lib/themes/ang-ie11.css
cat lib/themes/dark.css | ./node_modules/.bin/postcss >lib/themes/dark-ie11.css
cat lib/themes/antd.css | ./node_modules/.bin/postcss >lib/themes/antd-ie11.css
cat lib/themes/cxd.css | ./node_modules/.bin/postcss >lib/themes/cxd-ie11.css
cat lib/themes/ang.css | ../../node_modules/.bin/postcss >lib/themes/ang-ie11.css
cat lib/themes/dark.css | ../../node_modules/.bin/postcss >lib/themes/dark-ie11.css
cat lib/themes/antd.css | ../../node_modules/.bin/postcss >lib/themes/antd-ie11.css
cat lib/themes/cxd.css | ../../node_modules/.bin/postcss >lib/themes/cxd-ie11.css
cp lib/themes/cxd-ie11.css lib/themes/default-ie11.css
cat sdk/sdk.css sdk/ie11-patch.css | ./node_modules/.bin/postcss >sdk/sdk-ie11.css
cat sdk/ang.css sdk/ie11-patch.css | ./node_modules/.bin/postcss >sdk/ang-ie11.css
cat sdk/dark.css sdk/ie11-patch.css | ./node_modules/.bin/postcss >sdk/dark-ie11.css
cat sdk/antd.css sdk/ie11-patch.css | ./node_modules/.bin/postcss >sdk/antd-ie11.css
cat sdk/sdk.css sdk/ie11-patch.css | ../../node_modules/.bin/postcss >sdk/sdk-ie11.css
cat sdk/ang.css sdk/ie11-patch.css | ../../node_modules/.bin/postcss >sdk/ang-ie11.css
cat sdk/dark.css sdk/ie11-patch.css | ../../node_modules/.bin/postcss >sdk/dark-ie11.css
cat sdk/antd.css sdk/ie11-patch.css | ../../node_modules/.bin/postcss >sdk/antd-ie11.css
# 默认变成 cxd 了,所以要拷贝一份兼容之前的引用
cp sdk/sdk.css sdk/cxd.css
cp sdk/sdk-ie11.css sdk/cxd-ie11.css
cp ./lib/helper.css sdk/helper.css
cp ./lib/helper.css.map sdk/helper.css.map
# cp ./lib/helper.css.map sdk/helper.css.map
cp ../../examples/static/iconfont.* sdk/
mkdir sdk/locale
echo "===sdk locale==="
node ../../scripts/generate-sdk-locale.js src/locale/de-DE.ts >sdk/locale/de-DE.js
node ../../scripts/generate-sdk-locale.js ../amis-ui/src/locale/de-DE.ts >sdk/locale/de-DE.js
echo "===build-schemas==="
npm run build-schemas

View File

@ -1,7 +1,5 @@
export * from 'amis-core';
export * from 'amis-ui';
import './compat';
import './schemaExtend';
// 注册渲染器
import './renderers/Action';
@ -136,3 +134,7 @@ import './renderers/GridNav';
import './renderers/TooltipWrapper';
import './renderers/Tag';
import './renderers/Table-v2/index';
import './compat';
import './schemaExtend';
export * from './renderers/Form/IconPickerIcons';