[amis-saas-6692]merge pre-release code

Change-Id: I336d46180fae1d9b2807a6254af545da1d0312db
This commit is contained in:
qianchuan 2022-09-08 17:10:43 +08:00
commit 886c30d6f5
13 changed files with 5607 additions and 13 deletions

View File

@ -0,0 +1,37 @@
module.exports = {
entry: {
dir: './src'
},
file: {
test: /.*(ts|tsx|js|jsx)$/
},
ignore: {
list: ['src/icons', 'src/locale']
},
importInfo: {
source: 'i18n-runtime',
imported: 'i18n',
local: '_i18n'
},
i18nModule: 'i18n-runtime',
languages: [
{
name: 'en-US',
path: './src/locale'
},
{
name: 'zh-CN',
path: './src/locale'
}
],
output: {
fileName: 'editor-i18n',
fileExtension: 'xlsx',
path: './'
},
translate: {
appId: '20220810001301703',
key: 'WW7jKaJJBrtCawTOkCpk',
host: 'http://api.fanyi.baidu.com'
}
};

View File

@ -1,6 +1,6 @@
{ {
"name": "amis-editor", "name": "amis-editor",
"version": "5.2.0-beta.50", "version": "5.2.0-beta.62",
"description": "amis 可视化编辑器", "description": "amis 可视化编辑器",
"main": "lib/index.js", "main": "lib/index.js",
"module": "esm/index.js", "module": "esm/index.js",
@ -8,7 +8,9 @@
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"build": "npm run clean-dist && NODE_ENV=production rollup -c ", "build": "npm run clean-dist && NODE_ENV=production rollup -c ",
"clean-dist": "rimraf lib/* esm/*" "clean-dist": "rimraf lib/* esm/*",
"i18n:update": "npx i18n update --config=./i18nConfig.js",
"i18n:translate": "npx i18n translate --config=./i18nConfig.js --l=en-US"
}, },
"keywords": [ "keywords": [
"amis", "amis",
@ -22,12 +24,16 @@
"lint-staged": { "lint-staged": {
"{src,scss,examples}/**/**/*.{js,jsx,ts,tsx,scss,json}": [ "{src,scss,examples}/**/**/*.{js,jsx,ts,tsx,scss,json}": [
"prettier --write" "prettier --write"
],
"{src,scss,examples}/**/**/*.scss": [
"stylelint"
] ]
}, },
"dependencies": { "dependencies": {
"@webcomponents/webcomponentsjs": "^2.6.0", "@webcomponents/webcomponentsjs": "^2.6.0",
"amis-editor-core": "*", "amis-editor-core": "*",
"lodash": "^4.17.15" "lodash": "^4.17.15",
"i18n-runtime": "0.0.4"
}, },
"devDependencies": { "devDependencies": {
"@fortawesome/fontawesome-free": "^5.15.3", "@fortawesome/fontawesome-free": "^5.15.3",
@ -87,6 +93,7 @@
"sass": "^1.49.7", "sass": "^1.49.7",
"sass-loader": "^12.5.0", "sass-loader": "^12.5.0",
"style-loader": "^3.2.1", "style-loader": "^3.2.1",
"stylelint": "^14.11.0",
"ts-jest": "^28.0.3", "ts-jest": "^28.0.3",
"ts-json-schema-generator": "0.96.0", "ts-json-schema-generator": "0.96.0",
"ts-loader": "^9.2.5", "ts-loader": "^9.2.5",
@ -102,6 +109,7 @@
"amis": "*", "amis": "*",
"amis-core": "*", "amis-core": "*",
"amis-formula": "*", "amis-formula": "*",
"amis-ui": "*" "amis-ui": "*",
"i18n-runtime": "*"
} }
} }

View File

@ -16,6 +16,9 @@ import {
import path from 'path'; import path from 'path';
import svgr from '@svgr/rollup'; import svgr from '@svgr/rollup';
import fs from 'fs'; import fs from 'fs';
import i18nPlugin from 'plugin-react-i18n';
const i18nConfig = require('./i18nConfig');
const settings = { const settings = {
globals: {} globals: {}
@ -48,6 +51,22 @@ export default [
], ],
external, external,
plugins: getPlugins('cjs') plugins: getPlugins('cjs')
},
{
input,
output: [
{
...settings,
dir: path.dirname(module),
format: 'esm',
exports: 'named',
preserveModulesRoot: './src',
preserveModules: true // Keep directory structure and files
}
],
external,
plugins: getPlugins('esm')
} }
]; ];
@ -97,6 +116,7 @@ function getPlugins(format = 'esm') {
}; };
return [ return [
i18nPlugin(i18nConfig),
typescript(typeScriptOptions), typescript(typeScriptOptions),
svgr({ svgr({
svgProps: { svgProps: {

View File

@ -1,3 +1,5 @@
import 'amis';
import './locale/index';
export * from 'amis-editor-core'; export * from 'amis-editor-core';
import './tpl/index'; import './tpl/index';

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,2 @@
import './en-US';
import './zh-CN';

File diff suppressed because it is too large Load Diff

View File

@ -200,8 +200,9 @@ export class RangeControlPlugin extends BasePlugin {
value: 0 value: 0
}, },
{ {
type: 'tpl', type: 'html',
tpl: '-' html: '-',
className: 'inputGroup-split-line'
}, },
{ {
type: 'input-number', type: 'input-number',

View File

@ -13,7 +13,7 @@ import isString from 'lodash/isString';
import isEqual from 'lodash/isEqual'; import isEqual from 'lodash/isEqual';
import omit from 'lodash/omit'; import omit from 'lodash/omit';
import cx from 'classnames'; import cx from 'classnames';
import {FormItem, Button, InputBox, Icon, ResultBox} from 'amis'; import {FormItem, Button, InputBox, Icon, ResultBox, render} from 'amis';
import {FormulaExec, isExpression} from 'amis'; import {FormulaExec, isExpression} from 'amis';
import {PickerContainer} from 'amis'; import {PickerContainer} from 'amis';
import {FormulaEditor} from 'amis-ui/lib/components/formula/Editor'; import {FormulaEditor} from 'amis-ui/lib/components/formula/Editor';
@ -300,7 +300,8 @@ export default class FormulaControl extends React.Component<
if (rendererSchema) { if (rendererSchema) {
curRendererSchema = Object.assign({}, rendererSchema, data, { curRendererSchema = Object.assign({}, rendererSchema, data, {
type: rendererSchema.type ?? data.type, type: rendererSchema.type ?? data.type,
value: this.props.value ?? rendererSchema.value ?? data.value // 说明: props.value 最后会同步到 rendererSchema.value 中
value: rendererSchema.value // this.props.value ?? rendererSchema.value ?? data.value
}); });
// 默认要剔除的字段 // 默认要剔除的字段
@ -334,7 +335,7 @@ export default class FormulaControl extends React.Component<
'unitOptions', 'unitOptions',
'keyboard', 'keyboard',
'kilobitSeparator', 'kilobitSeparator',
'value' // 'value'
]; ];
// 当前组件要剔除的字段 // 当前组件要剔除的字段
@ -362,7 +363,8 @@ export default class FormulaControl extends React.Component<
// 设置统一的占位提示 // 设置统一的占位提示
if (curRendererSchema.type === 'select') { if (curRendererSchema.type === 'select') {
curRendererSchema.placeholder = '请选择默认值'; curRendererSchema.placeholder = '请选择默认值';
curRendererSchema.inputClassName= 'ae-editor-FormulaControl-select-style' curRendererSchema.inputClassName =
'ae-editor-FormulaControl-select-style';
} else { } else {
curRendererSchema.placeholder = '请输入静态默认值'; curRendererSchema.placeholder = '请输入静态默认值';
} }
@ -405,7 +407,7 @@ export default class FormulaControl extends React.Component<
rendererWrapper, rendererWrapper,
manager, manager,
useExternalFormData = false, useExternalFormData = false,
render, // render,
...rest ...rest
} = this.props; } = this.props;
@ -461,7 +463,7 @@ export default class FormulaControl extends React.Component<
rendererWrapper ? 'border-wrapper' : '' rendererWrapper ? 'border-wrapper' : ''
)} )}
> >
{render('left', this.filterCustomRendererProps(rendererSchema), { {render(this.filterCustomRendererProps(rendererSchema), {
inputOnly: true, inputOnly: true,
value: value, value: value,
data: useExternalFormData data: useExternalFormData

View File

@ -77,6 +77,7 @@ export default class ActionDialog extends React.Component<ActionDialogProp> {
labelField: 'actionLabel', labelField: 'actionLabel',
valueField: 'actionType', valueField: 'actionType',
inputClassName: 'no-border action-tree-control', inputClassName: 'no-border action-tree-control',
placeholder: '未匹配到数据',
onChange: (value: string, oldVal: any, data: any, form: any) => { onChange: (value: string, oldVal: any, data: any, form: any) => {
// 因为不知道动作都有哪些字段,这里只保留基础配置 // 因为不知道动作都有哪些字段,这里只保留基础配置
let removeKeys: { let removeKeys: {
@ -163,11 +164,12 @@ export default class ActionDialog extends React.Component<ActionDialogProp> {
title: '动作配置', title: '动作配置',
headerClassName: 'font-bold', headerClassName: 'font-bold',
className: 'action-config-dialog', className: 'action-config-dialog',
bodyClassName: "action-config-dialog-body",
closeOnEsc: true, closeOnEsc: true,
closeOnOutside: false, closeOnOutside: false,
show, show,
showCloseButton: true, showCloseButton: true,
size: 'lg', size: "md",
body: [ body: [
{ {
type: 'form', type: 'form',
@ -200,6 +202,7 @@ export default class ActionDialog extends React.Component<ActionDialogProp> {
type: 'input-text', type: 'input-text',
name: '__keywords', name: '__keywords',
className: 'action-tree-search', className: 'action-tree-search',
inputClassName: 'action-tree-search-input',
placeholder: '请搜索执行动作', placeholder: '请搜索执行动作',
clearable: true, clearable: true,
onChange: ( onChange: (

View File

@ -161,6 +161,7 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
value: 'dialog', value: 'dialog',
required: true, required: true,
pipeIn: defaultValue('dialog'), pipeIn: defaultValue('dialog'),
inputClassName: 'event-action-radio',
options: [ options: [
{ {
label: '弹窗', label: '弹窗',
@ -248,6 +249,7 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
value: 'closeDialog', value: 'closeDialog',
required: true, required: true,
pipeIn: defaultValue('closeDialog'), pipeIn: defaultValue('closeDialog'),
inputClassName: 'event-action-radio',
options: [ options: [
{ {
label: '弹窗', label: '弹窗',
@ -584,6 +586,7 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
value: 'show', value: 'show',
required: true, required: true,
pipeIn: defaultValue('show'), pipeIn: defaultValue('show'),
inputClassName: 'event-action-radio',
options: [ options: [
{ {
label: '显示', label: '显示',
@ -643,6 +646,7 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
label: '启用/禁用', label: '启用/禁用',
name: 'groupType', name: 'groupType',
mode: 'horizontal', mode: 'horizontal',
inputClassName: 'event-action-radio',
value: 'enabled', value: 'enabled',
required: true, required: true,
pipeIn: defaultValue('enabled'), pipeIn: defaultValue('enabled'),
@ -710,6 +714,7 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
type: 'radios', type: 'radios',
required: true, required: true,
name: '__comboType', name: '__comboType',
inputClassName: 'event-action-radio',
mode: 'horizontal', mode: 'horizontal',
label: '赋值方式', label: '赋值方式',
visibleOn: `data.__rendererName && __rendererName === 'combo'`, visibleOn: `data.__rendererName && __rendererName === 'combo'`,

View File

@ -1053,6 +1053,7 @@ setSchemaTpl(
visibleOn, visibleOn,
label: '图标', label: '图标',
type: 'icon-picker', type: 'icon-picker',
className: 'fix-icon-picker-overflow',
placeholder: '点击选择图标', placeholder: '点击选择图标',
clearable: true, clearable: true,
description: '' description: ''