Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/zh-CN/components/form/switch.md
Original file line number Diff line number Diff line change
Expand Up @@ -420,9 +420,9 @@ switch 值更新时弹出确认提示,确认后发送请求。
当前组件对外暴露以下特性动作,其他组件可以通过指定`actionType: 动作名称`、`componentId: 该组件id`来触发这些动作,动作配置可以通过`args: {动作配置项名称: xxx}`来配置具体的参数,详细请查看[事件动作](../../docs/concepts/event-action#触发其他组件的动作)。

| 动作名称 | 动作配置 | 说明 |
| -------- | ------------------------------------- | ---------------------------------------------------------------------- | --- |
| -------- | ------------------------------------- | ---------------------------------------------------------------------- |
| clear | - | 清空,6.3.1 及以上版本支持 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue`,6.3.1 及以上版本支持 | |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue`,6.3.1 及以上版本支持 |
| setValue | `value: string \| boolean` 更新的数据 | 更新数据 |

### clear
Expand Down
11 changes: 1 addition & 10 deletions packages/amis-editor/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,7 @@
rel="stylesheet"
href="../../../node_modules/@fortawesome/fontawesome-free/css/v4-shims.css"
/>
<link
rel="stylesheet"
title="cxd"
id="baseStyle"
href="../amis-ui/scss/themes/cxd.scss"
/>
<link rel="stylesheet" title="cxd" href="../amis-ui/scss/helper.scss" />
<link rel="stylesheet" href="../amis-editor-core/scss/editor.scss" />
<link rel="stylesheet" href="../../../examples/doc.css" />
<link rel="stylesheet" href="./examples/style.scss" />

<style>
.app-wrapper {
position: relative;
Expand Down
7 changes: 7 additions & 0 deletions packages/amis-editor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ import {
} from 'react-router-dom';
import Doc from './examples/component/Doc';

// 样式导入
import '../amis-ui/scss/themes/cxd.scss';
import '../amis-ui/scss/helper.scss';
import '../amis-editor-core/scss/editor.scss';
import '../../examples/doc.css';
import './examples/style.scss';

function MDComponent(fN: () => Promise<{default: {raw: string}}>) {
return React.lazy(() =>
fN().then(ret => ({default: () => <Doc children={ret.default.raw} />}))
Expand Down
10 changes: 9 additions & 1 deletion packages/amis-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
}
},
"scripts": {
"dev": "vite",
"test": "echo \"Warnings: no test specified\"",
"build": "npm run clean-dist && cross-env NODE_ENV=production rollup -c ",
"build-esm": "npm run clean-dist && cross-env NODE_ENV=production rollup -c rollup.esm.config.js",
Expand Down Expand Up @@ -49,6 +50,9 @@
"mobx-state-tree": "^3.17.3"
},
"devDependencies": {
"@babel/plugin-proposal-decorators": "^7.28.0",
"@babel/plugin-transform-class-properties": "^7.27.1",
"@babel/plugin-transform-typescript": "^7.28.5",
"@fortawesome/fontawesome-free": "^6.1.1",
"@rollup/plugin-commonjs": "^22.0.0",
"@rollup/plugin-json": "^4.1.0",
Expand All @@ -69,6 +73,7 @@
"@types/react-router-dom": "^5.1.7",
"@types/sortablejs": "^1.10.7",
"@types/tinycolor2": "^1.4.3",
"@vitejs/plugin-react": "^4.7.0",
"ajv": "^8.8.2",
"axios": "0.21.1",
"concurrently": "^6.2.0",
Expand All @@ -95,7 +100,10 @@
"ts-loader": "^9.2.5",
"ts-node": "^10.5.0",
"tslib": "^2.3.1",
"typescript": "^5.8.3"
"typescript": "^5.8.3",
"vite": "^6.4.1",
"vite-plugin-monaco-editor": "^1.1.0",
"vite-plugin-svgr": "^4.5.0"
},
"peerDependencies": {
"amis": "*",
Expand Down
132 changes: 132 additions & 0 deletions packages/amis-editor/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
import {defineConfig} from 'vite';
import react from '@vitejs/plugin-react';
import svgr from 'vite-plugin-svgr';
import monacoEditorPlugin from 'vite-plugin-monaco-editor';
import path from 'path';

export default defineConfig({
plugins: [
svgr({
include: '**/*.svg',
svgrOptions: {
exportType: 'default',
icon: true
}
}),
react({
babel: {
plugins: [
// TypeScript transform MUST come first to handle 'declare' fields
[
'@babel/plugin-transform-typescript',
{
isTSX: true,
allowDeclareFields: true
}
],
['@babel/plugin-proposal-decorators', {legacy: true}],
['@babel/plugin-transform-class-properties', {loose: true}]
],
parserOpts: {
plugins: ['decorators-legacy', 'classProperties']
}
},
// Only apply babel to .tsx files
include: ['**/*.tsx', '**/*.ts']
}),
// Monaco Editor 插件 - 处理 Web Worker
monacoEditorPlugin({
languageWorkers: [
'editorWorkerService',
'json',
'css',
'html',
'typescript'
]
}) as any
],
resolve: {
alias: [
// 特殊文件路径
{
find: 'amis/schema.json',
replacement: path.resolve(__dirname, '../amis/schema.json')
},
// lib 路径映射到 src (更具体的路径优先)
{
find: 'amis-core/lib',
replacement: path.resolve(__dirname, '../amis-core/src')
},
{
find: 'amis-ui/lib',
replacement: path.resolve(__dirname, '../amis-ui/src')
},
{
find: 'amis-formula/lib',
replacement: path.resolve(__dirname, '../amis-formula/src')
},
{find: 'amis/lib', replacement: path.resolve(__dirname, '../amis/src')},
{
find: 'amis-editor-core/lib',
replacement: path.resolve(__dirname, '../amis-editor-core/src')
},
// 源码路径别名
{
find: 'amis-core',
replacement: path.resolve(__dirname, '../amis-core/src')
},
{find: 'amis-ui', replacement: path.resolve(__dirname, '../amis-ui/src')},
{
find: 'amis-formula',
replacement: path.resolve(__dirname, '../amis-formula/src')
},
{find: 'amis', replacement: path.resolve(__dirname, '../amis/src')},
{
find: 'amis-editor-core',
replacement: path.resolve(__dirname, '../amis-editor-core/src')
},
{
find: 'amis-theme-editor-helper',
replacement: path.resolve(__dirname, '../amis-theme-editor-helper/src')
}
]
},
server: {
port: 3000,
open: true
},
css: {
preprocessorOptions: {
scss: {
api: 'modern-compiler'
}
}
},
optimizeDeps: {
include: [
'react',
'react-dom',
'mobx',
'mobx-react',
'mobx-state-tree',
'monaco-editor'
],
esbuildOptions: {
target: 'esnext'
}
},
esbuild: {
tsconfigRaw: {
compilerOptions: {
useDefineForClassFields: false,
experimentalDecorators: true
}
}
},
define: {
__editor_i18n: JSON.stringify(false)
},
worker: {
format: 'es'
}
});
Loading