14 |
15 |
16 |
32 |
33 |
39 |
--------------------------------------------------------------------------------
/packages/ui/src/qrcode/src/formConfig.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | export default [
20 | {
21 | text: '链接',
22 | name: 'url',
23 | },
24 | ];
25 |
--------------------------------------------------------------------------------
/packages/ui-react/src/qrcode/formConfig.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | export default [
20 | {
21 | text: '链接',
22 | name: 'url',
23 | },
24 | ];
25 |
--------------------------------------------------------------------------------
/packages/ui-vue2/src/button/formConfig.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | export default [
20 | {
21 | text: '文本',
22 | name: 'text',
23 | },
24 | ];
25 |
--------------------------------------------------------------------------------
/packages/ui-vue2/src/qrcode/src/formConfig.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | export default [
20 | {
21 | text: '链接',
22 | name: 'url',
23 | },
24 | ];
25 |
--------------------------------------------------------------------------------
/packages/ui/src/button/src/formConfig.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | export default [
20 | {
21 | text: '文本',
22 | name: 'text',
23 | },
24 | ];
25 |
--------------------------------------------------------------------------------
/magic-admin/server/src/config/key-example.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making MagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | // crypto加密key,请开发者自行替换。需要 32 位
20 | export default {
21 | key: 'crypto_algorithm_aes-256-cbc1111',
22 | };
23 |
--------------------------------------------------------------------------------
/packages/core/src/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import App from './App';
20 |
21 | import './resetcss.css';
22 |
23 | export * from './events';
24 |
25 | export default App;
26 |
--------------------------------------------------------------------------------
/packages/form/src/fields/RadioGroup.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{ option.text }}
4 |
5 |
6 |
7 |
34 |
--------------------------------------------------------------------------------
/packages/ui-react/src/page/initValue.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | export default {
20 | items: [],
21 | style: {
22 | width: '100%',
23 | height: '100%',
24 | },
25 | };
26 |
--------------------------------------------------------------------------------
/packages/ui-vue2/src/page/initValue.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | export default {
20 | items: [],
21 | style: {
22 | width: '100%',
23 | height: '100%',
24 | },
25 | };
26 |
--------------------------------------------------------------------------------
/packages/ui/src/page/src/initValue.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | export default {
20 | items: [],
21 | style: {
22 | width: '100%',
23 | height: '100%',
24 | },
25 | };
26 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ESNext",
4 | "module": "ESNext",
5 | "strict": true,
6 | "jsx": "preserve",
7 | "moduleResolution": "Node",
8 | "skipLibCheck": true,
9 | "esModuleInterop": true,
10 | "allowSyntheticDefaultImports": true,
11 | "importHelpers": true,
12 | "experimentalDecorators": true,
13 | "emitDecoratorMetadata": true,
14 | "resolveJsonModule": true,
15 | "sourceMap": true,
16 | "useDefineForClassFields": true,
17 | "baseUrl": ".",
18 | "lib": ["ESNext", "DOM"],
19 | "paths": {
20 | // 内部模块都指向 src/index.ts, 会有更好的代码跳转体验.
21 | "@tmagic/*": ["packages/*/src"],
22 | "@editor/*": ["packages/editor/src/*"],
23 | "@form/*": ["packages/form/src/*"],
24 | },
25 | "types": [
26 | "node",
27 | "vite/client",
28 | ],
29 | },
30 | "exclude": [
31 | "**/dist/**/*",
32 | "**/node_modules/**/*",
33 | ],
34 | }
35 |
--------------------------------------------------------------------------------
/packages/ui-react/src/container/initValue.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | export default {
20 | items: [],
21 | style: {
22 | width: '375',
23 | height: '100',
24 | },
25 | };
26 |
--------------------------------------------------------------------------------
/packages/ui-vue2/src/container/initValue.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | export default {
20 | items: [],
21 | style: {
22 | width: '375',
23 | height: '100',
24 | },
25 | };
26 |
--------------------------------------------------------------------------------
/packages/ui/src/container/src/initValue.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | export default {
20 | items: [],
21 | style: {
22 | width: '375',
23 | height: '100',
24 | },
25 | };
26 |
--------------------------------------------------------------------------------
/magic-admin/setup.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # 项目根目录
4 | WORKSPACE=$(dirname "$PWD")
5 | echo ${WORKSPACE}
6 |
7 | # 全局安装pnpm
8 | npm i pnpm -g
9 |
10 | # magic依赖安装和构建
11 | cd ${WORKSPACE}
12 | npm run reinstall
13 | npm run build:admin
14 |
15 | echo "magic依赖安装完毕 & 打包完毕"
16 |
17 | # 移动runtime打包产物到web
18 | # 管理端demo已包含打包产物,开发者自建流水线打包时可参考产物
19 | #rm -rf ${WORKSPACE}/magic-admin/web/public/runtime
20 | #mv -f ${WORKSPACE}/playground/dist/runtime/ ${WORKSPACE}/magic-admin/web/public
21 |
22 | #echo "移动runtime打包产物到web完毕"
23 |
24 | # magic-admin依赖安装
25 | cd ${WORKSPACE}/magic-admin
26 | npm run init
27 |
28 | # web构建
29 | cd ${WORKSPACE}/magic-admin/web
30 | npm run build
31 |
32 | echo "web依赖安装完毕"
33 |
34 | # 移动web文件到server
35 | mkdir -p ${WORKSPACE}/magic-admin/server/assets
36 | cp -rf ${WORKSPACE}/magic-admin/web/dist/* ${WORKSPACE}/magic-admin/server/assets
37 |
38 | echo "移动web文件到server完毕"
39 |
40 | # 运行server
41 | cd ${WORKSPACE}/magic-admin/server
42 | npm run dev
43 |
--------------------------------------------------------------------------------
/magic-admin/web/typings/axios-jsonp/index.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making MagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | declare module 'axios-jsonp' {
20 | export default function axiosJsonp(options: Record): Promise;
21 | }
22 |
--------------------------------------------------------------------------------
/magic-admin/server/src/models/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making MagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | // 模型汇总
20 | import { ActInfo } from '@src/models/act';
21 | import { Page } from '@src/models/page';
22 | export default [ActInfo, Page];
23 |
--------------------------------------------------------------------------------
/magic-admin/web/src/views/list-view.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
13 |
14 |
15 |
39 |
40 |
45 |
--------------------------------------------------------------------------------
/magic-admin/web/typings/index.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making MagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import './shims-vue';
20 | import './axios-jsonp';
21 |
22 | declare global {
23 | interface Window {
24 | request: Function;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/packages/editor/src/utils/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | export * from './config';
20 | export * from './props';
21 | export * from './logger';
22 | export * from './editor';
23 | export * from './stage';
24 |
--------------------------------------------------------------------------------
/packages/ui-react/src/AppContent.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import React from 'react';
20 |
21 | import Core from '@tmagic/core';
22 |
23 | export default React.createContext(undefined);
24 |
--------------------------------------------------------------------------------
/magic-admin/server/src/template/editor/get-web-plugins.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making MagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | export default {
20 | options: [
21 | {
22 | text: '会员登录认证',
23 | value: '会员登录认证',
24 | },
25 | ],
26 | };
27 |
--------------------------------------------------------------------------------
/packages/table/src/ExpandColumn.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
15 |
16 |
17 |
18 |
19 |
38 |
--------------------------------------------------------------------------------
/packages/ui/src/img/src/formConfig.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | export default [
20 | {
21 | text: '图片',
22 | name: 'src',
23 | },
24 | {
25 | text: '链接',
26 | name: 'url',
27 | },
28 | ];
29 |
--------------------------------------------------------------------------------
/packages/ui-react/src/img/formConfig.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | export default [
20 | {
21 | text: '图片',
22 | name: 'src',
23 | },
24 | {
25 | text: '链接',
26 | name: 'url',
27 | },
28 | ];
29 |
--------------------------------------------------------------------------------
/packages/ui-vue2/src/img/src/formConfig.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | export default [
20 | {
21 | text: '图片',
22 | name: 'src',
23 | },
24 | {
25 | text: '链接',
26 | name: 'url',
27 | },
28 | ];
29 |
--------------------------------------------------------------------------------
/magic-admin/web/src/use/use-status.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making MagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | export const status = {
20 | actStatus: ['修改中', '部分已发布', '已发布'],
21 | pageStatus: ['修改中', '已发布'],
22 | statusTagType: ['info', '', 'success'],
23 | };
24 |
--------------------------------------------------------------------------------
/packages/editor/src/layouts/AddPageBox.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
新增页面
9 |
10 |
11 |
12 |
13 |
14 |
36 |
--------------------------------------------------------------------------------
/packages/ui-vue2/src/qrcode/src/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
47 |
--------------------------------------------------------------------------------
/magic-admin/web/typings/shims-vue.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making MagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | declare module '*.vue' {
20 | import { defineComponent } from 'vue';
21 | const Componet: ReturnType;
22 | export default Componet;
23 | }
24 |
--------------------------------------------------------------------------------
/packages/ui-react/src/img/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import Img from './Img';
20 |
21 | export { default as config } from './formConfig';
22 | export { default as value } from './initValue';
23 |
24 | export default Img;
25 |
--------------------------------------------------------------------------------
/packages/ui-react/src/text/initValue.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | export default {
20 | type: 'text',
21 | text: '请输入文本内容',
22 | multiple: true,
23 | style: {
24 | width: '100',
25 | height: 'auto',
26 | },
27 | };
28 |
--------------------------------------------------------------------------------
/packages/ui-vue2/src/text/initValue.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | export default {
20 | type: 'text',
21 | text: '请输入文本内容',
22 | multiple: true,
23 | style: {
24 | width: '100',
25 | height: 'auto',
26 | },
27 | };
28 |
--------------------------------------------------------------------------------
/packages/ui/src/text/src/initValue.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | export default {
20 | type: 'text',
21 | text: '请输入文本内容',
22 | multiple: true,
23 | style: {
24 | width: '100',
25 | height: 'auto',
26 | },
27 | };
28 |
--------------------------------------------------------------------------------
/packages/ui-react/src/text/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import Text from './Text';
20 |
21 | export { default as config } from './formConfig';
22 | export { default as value } from './initValue';
23 |
24 | export default Text;
25 |
--------------------------------------------------------------------------------
/packages/ui-vue2/src/text/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import Text from './Text.vue';
20 |
21 | export { default as config } from './formConfig';
22 | export { default as value } from './initValue';
23 |
24 | export default Text;
25 |
--------------------------------------------------------------------------------
/docs/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "docs",
3 | "private": true,
4 | "version": "1.2.0-beta.2",
5 | "scripts": {
6 | "clean:top": "rimraf dist",
7 | "dev": "vuepress dev src",
8 | "build": "npm run clean:top && vuepress build src -d dist"
9 | },
10 | "dependencies": {
11 | "@element-plus/icons-vue": "^2.0.9",
12 | "@tmagic/form": "1.2.0-beta.2",
13 | "@tmagic/schema": "1.2.0-beta.2",
14 | "@tmagic/utils": "1.2.0-beta.2",
15 | "element-plus": "^2.2.17",
16 | "highlight.js": "^11.2.0",
17 | "lodash": "^4.17.21",
18 | "lodash-es": "^4.17.21",
19 | "serialize-javascript": "^6.0.0",
20 | "vue": "^3.2.37"
21 | },
22 | "devDependencies": {
23 | "@vuepress/bundler-vite": "^2.0.0-beta.51",
24 | "@vuepress/cli": "^2.0.0-beta.51",
25 | "@vuepress/client": "^2.0.0-beta.51",
26 | "@vuepress/plugin-search": "^2.0.0-beta.51",
27 | "@vuepress/theme-default": "^2.0.0-beta.51",
28 | "vite": "~3.1.3",
29 | "vuepress": "^2.0.0-beta.51"
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/packages/form/src/utils/createForm.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import { FormConfig } from '../schema';
20 |
21 | export const createForm = function (config: FormConfig) {
22 | return config;
23 | };
24 |
25 | export default createForm;
26 |
--------------------------------------------------------------------------------
/packages/schema/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "1.2.0-beta.2",
3 | "name": "@tmagic/schema",
4 | "sideEffects": false,
5 | "main": "dist/tmagic-schema.umd.js",
6 | "module": "dist/tmagic-schema.mjs",
7 | "types": "types/index.d.ts",
8 | "exports": {
9 | ".": {
10 | "import": "./dist/tmagic-schema.mjs",
11 | "require": "./dist/tmagic-schema.umd.js"
12 | },
13 | "./*": "./*"
14 | },
15 | "scripts": {
16 | "build": "npm run build:type && vite build",
17 | "build:type": "npm run clear:type && tsc --declaration --emitDeclarationOnly --project tsconfig.build.json",
18 | "clear:type": "rimraf ./types"
19 | },
20 | "engines": {
21 | "node": ">=14"
22 | },
23 | "license": "Apache-2.0",
24 | "repository": {
25 | "type": "git",
26 | "url": "https://github.com/Tencent/tmagic-editor.git"
27 | },
28 | "devDependencies": {
29 | "@types/node": "^15.12.4",
30 | "rimraf": "^3.0.2",
31 | "typescript": "^4.7.4",
32 | "vite": "^3.1.3"
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/packages/ui-react/src/button/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import Button from './Button';
20 |
21 | export { default as config } from './formConfig';
22 | export { default as value } from './initValue';
23 |
24 | export default Button;
25 |
--------------------------------------------------------------------------------
/packages/ui-react/src/qrcode/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import Qrcode from './Qrcode';
20 |
21 | export { default as config } from './formConfig';
22 | export { default as value } from './initValue';
23 |
24 | export default Qrcode;
25 |
--------------------------------------------------------------------------------
/packages/ui/src/img/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import Img from './src/index.vue';
20 |
21 | export { default as config } from './src/formConfig';
22 | export { default as value } from './src/initValue';
23 |
24 | export default Img;
25 |
--------------------------------------------------------------------------------
/packages/ui-react/src/text/formConfig.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | export default [
20 | {
21 | name: 'text',
22 | text: '文本',
23 | },
24 | {
25 | name: 'multiple',
26 | text: '多行文本',
27 | type: 'switch',
28 | },
29 | ];
30 |
--------------------------------------------------------------------------------
/packages/ui-react/src/useCommonMethod.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | export default (ref: any) => ({
20 | show: () => {
21 | ref.style.display = 'initial';
22 | },
23 | hide: () => {
24 | ref.style.display = 'none';
25 | },
26 | });
27 |
--------------------------------------------------------------------------------
/packages/ui-vue2/src/button/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import Button from './Button.vue';
20 |
21 | export { default as config } from './formConfig';
22 | export { default as value } from './initValue';
23 |
24 | export default Button;
25 |
--------------------------------------------------------------------------------
/packages/ui-vue2/src/img/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import Img from './src/index.vue';
20 |
21 | export { default as config } from './src/formConfig';
22 | export { default as value } from './src/initValue';
23 |
24 | export default Img;
25 |
--------------------------------------------------------------------------------
/packages/ui-vue2/src/text/formConfig.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | export default [
20 | {
21 | name: 'text',
22 | text: '文本',
23 | },
24 | {
25 | name: 'multiple',
26 | text: '多行文本',
27 | type: 'switch',
28 | },
29 | ];
30 |
--------------------------------------------------------------------------------
/packages/ui/src/text/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import Text from './src/index.vue';
20 |
21 | export { default as config } from './src/formConfig';
22 | export { default as value } from './src/initValue';
23 |
24 | export default Text;
25 |
--------------------------------------------------------------------------------
/packages/ui/src/text/src/formConfig.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | export default [
20 | {
21 | name: 'text',
22 | text: '文本',
23 | },
24 | {
25 | name: 'multiple',
26 | text: '多行文本',
27 | type: 'switch',
28 | },
29 | ];
30 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | Steps to reproduce the behavior:
15 | 1. Go to '...'
16 | 2. Click on '....'
17 | 3. Scroll down to '....'
18 | 4. See error
19 |
20 | **Expected behavior**
21 | A clear and concise description of what you expected to happen.
22 |
23 | **Screenshots**
24 | If applicable, add screenshots to help explain your problem.
25 |
26 | **Desktop (please complete the following information):**
27 | - OS: [e.g. iOS]
28 | - Browser [e.g. chrome, safari]
29 | - Version [e.g. 22]
30 |
31 | **Smartphone (please complete the following information):**
32 | - Device: [e.g. iPhone6]
33 | - OS: [e.g. iOS8.1]
34 | - Browser [e.g. stock browser, safari]
35 | - Version [e.g. 22]
36 |
37 | **Additional context**
38 | Add any other context about the problem here.
39 |
--------------------------------------------------------------------------------
/packages/ui-react/src/button/formConfig.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | export default [
20 | {
21 | name: 'text',
22 | text: '文本',
23 | },
24 | {
25 | name: 'multiple',
26 | text: '多行文本',
27 | type: 'switch',
28 | },
29 | ];
30 |
--------------------------------------------------------------------------------
/packages/ui/src/button/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import Button from './src/index.vue';
20 |
21 | export { default as config } from './src/formConfig';
22 | export { default as value } from './src/initValue';
23 |
24 | export default Button;
25 |
--------------------------------------------------------------------------------
/packages/ui/src/qrcode/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import Qrcode from './src/index.vue';
20 |
21 | export { default as config } from './src/formConfig';
22 | export { default as value } from './src/initValue';
23 |
24 | export default Qrcode;
25 |
--------------------------------------------------------------------------------
/packages/ui/src/qrcode/src/initValue.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | export default {
20 | url: 'https://m.film.qq.com',
21 | style: {
22 | position: 'absolute',
23 | left: '57',
24 | width: '176',
25 | height: '176',
26 | },
27 | };
28 |
--------------------------------------------------------------------------------
/packages/ui-react/src/container/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import Container from './Container';
20 |
21 | export { default as config } from './formConfig';
22 | export { default as value } from './initValue';
23 |
24 | export default Container;
25 |
--------------------------------------------------------------------------------
/packages/ui-react/src/qrcode/initValue.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | export default {
20 | url: 'https://m.film.qq.com',
21 | style: {
22 | position: 'absolute',
23 | left: '57',
24 | width: '176',
25 | height: '176',
26 | },
27 | };
28 |
--------------------------------------------------------------------------------
/packages/ui-vue2/src/container/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import Container from './Container.vue';
20 |
21 | export { default as config } from './formConfig';
22 | export { default as value } from './initValue';
23 |
24 | export default Container;
25 |
--------------------------------------------------------------------------------
/packages/ui-vue2/src/qrcode/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import Qrcode from './src/index.vue';
20 |
21 | export { default as config } from './src/formConfig';
22 | export { default as value } from './src/initValue';
23 |
24 | export default Qrcode;
25 |
--------------------------------------------------------------------------------
/packages/ui-vue2/src/qrcode/src/initValue.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | export default {
20 | url: 'https://m.film.qq.com',
21 | style: {
22 | position: 'absolute',
23 | left: '57',
24 | width: '176',
25 | height: '176',
26 | },
27 | };
28 |
--------------------------------------------------------------------------------
/packages/ui/src/useCommonMethod.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | export default (props: any) => ({
20 | show: () => {
21 | props.config.style.display = 'initial';
22 | },
23 | hide: () => {
24 | props.config.style.display = 'none';
25 | },
26 | });
27 |
--------------------------------------------------------------------------------
/packages/ui/src/button/src/initValue.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | export default {
20 | text: '请输入文本内容',
21 | multiple: true,
22 | style: {
23 | width: '270',
24 | height: '37.5',
25 | border: 0,
26 | backgroundColor: '#fb6f00',
27 | },
28 | };
29 |
--------------------------------------------------------------------------------
/packages/ui/src/container/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import Container from './src/Container.vue';
20 |
21 | export { default as config } from './src/formConfig';
22 | export { default as value } from './src/initValue';
23 |
24 | export default Container;
25 |
--------------------------------------------------------------------------------
/packages/ui-react/src/button/initValue.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | export default {
20 | text: '请输入文本内容',
21 | multiple: true,
22 | style: {
23 | width: '270',
24 | height: '37.5',
25 | border: 0,
26 | backgroundColor: '#fb6f00',
27 | },
28 | };
29 |
--------------------------------------------------------------------------------
/packages/ui-vue2/src/button/initValue.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | export default {
20 | text: '请输入文本内容',
21 | multiple: true,
22 | style: {
23 | width: '270',
24 | height: '37.5',
25 | border: 0,
26 | backgroundColor: '#fb6f00',
27 | },
28 | };
29 |
--------------------------------------------------------------------------------
/magic-admin/web/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "esnext",
4 | "module": "esnext",
5 | "strict": true,
6 | "jsx": "preserve",
7 | "importHelpers": true,
8 | "moduleResolution": "node",
9 | "skipLibCheck": true,
10 | "esModuleInterop": true,
11 | "allowSyntheticDefaultImports": true,
12 | "sourceMap": true,
13 | "allowJs": true,
14 | "baseUrl": ".",
15 | "types": [
16 | "webpack-env",
17 | "jest",
18 | "./typings",
19 | "node"
20 | ],
21 | "paths": {
22 | "@src/*": [
23 | "src/*"
24 | ],
25 | "@tests/*": [
26 | "tests/*"
27 | ],
28 | "vue": ["node_modules/vue"],
29 | },
30 | "lib": [
31 | "esnext",
32 | "dom",
33 | "dom.iterable",
34 | "scripthost"
35 | ]
36 | },
37 | "include": [
38 | "src/**/*.ts",
39 | "src/**/*.tsx",
40 | "src/**/*.vue",
41 | "tests/**/*.ts",
42 | "tests/**/*.tsx"
43 | ],
44 | "exclude": [
45 | "node_modules"
46 | ]
47 | }
48 |
--------------------------------------------------------------------------------
/packages/ui-react/src/page/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import Page from './Page';
20 |
21 | export { default as config } from './formConfig';
22 | export { default as value } from './initValue';
23 | export { default as event } from './event';
24 |
25 | export default Page;
26 |
--------------------------------------------------------------------------------
/packages/ui-vue2/src/page/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import Page from './Page.vue';
20 |
21 | export { default as config } from './formConfig';
22 | export { default as value } from './initValue';
23 | export { default as event } from './event';
24 |
25 | export default Page;
26 |
--------------------------------------------------------------------------------
/packages/utils/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "1.2.0-beta.2",
3 | "name": "@tmagic/utils",
4 | "main": "dist/tmagic-utils.umd.js",
5 | "module": "dist/tmagic-utils.mjs",
6 | "types": "types/index.d.ts",
7 | "exports": {
8 | ".": {
9 | "import": "./dist/tmagic-utils.mjs",
10 | "require": "./dist/tmagic-utils.umd.js"
11 | }
12 | },
13 | "license": "Apache-2.0",
14 | "scripts": {
15 | "build": "npm run build:type && vite build",
16 | "build:type": "npm run clear:type && tsc --declaration --emitDeclarationOnly --project tsconfig.build.json",
17 | "clear:type": "rimraf ./types"
18 | },
19 | "engines": {
20 | "node": ">=14"
21 | },
22 | "repository": {
23 | "type": "git",
24 | "url": "https://github.com/Tencent/tmagic-editor.git"
25 | },
26 | "dependencies": {
27 | "@tmagic/schema": "1.2.0-beta.2",
28 | "dayjs": "^1.11.4"
29 | },
30 | "devDependencies": {
31 | "@types/node": "^15.12.4",
32 | "rimraf": "^3.0.2",
33 | "typescript": "^4.7.4",
34 | "vite": "^3.1.3"
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/packages/form/src/utils/config.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | let $MAGIC_FORM = {} as any;
20 |
21 | const setConfig = (option: any): void => {
22 | $MAGIC_FORM = option;
23 | };
24 |
25 | const getConfig = (key: string): unknown => $MAGIC_FORM[key];
26 |
27 | export { getConfig, setConfig };
28 |
--------------------------------------------------------------------------------
/packages/ui-react/src/overlay/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import overlay from './Overlay';
20 |
21 | export { default as config } from './formConfig';
22 | export { default as value } from './initValue';
23 | export { default as event } from './event';
24 |
25 | export default overlay;
26 |
--------------------------------------------------------------------------------
/packages/ui/src/page/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import Page from './src/index.vue';
20 |
21 | export { default as config } from './src/formConfig';
22 | export { default as value } from './src/initValue';
23 | export { default as event } from './src/event';
24 |
25 | export default Page;
26 |
--------------------------------------------------------------------------------
/packages/ui/src/qrcode/src/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
48 |
--------------------------------------------------------------------------------
/packages/ui-react/src/img/initValue.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | export default {
20 | src: 'https://puui.qpic.cn/vupload/0/1573555382625_bhp0wud8l6w.png/0',
21 | url: '',
22 | style: {
23 | position: 'absolute',
24 | left: '57',
25 | width: '176',
26 | height: '176',
27 | },
28 | };
29 |
--------------------------------------------------------------------------------
/packages/ui/src/img/src/initValue.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | export default {
20 | src: 'https://puui.qpic.cn/vupload/0/1573555382625_bhp0wud8l6w.png/0',
21 | url: '',
22 | style: {
23 | position: 'absolute',
24 | left: '57',
25 | width: '176',
26 | height: '176',
27 | },
28 | };
29 |
--------------------------------------------------------------------------------
/packages/ui/src/overlay/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import Overlay from './src/index.vue';
20 |
21 | export { default as config } from './src/formConfig';
22 | export { default as value } from './src/initValue';
23 | export { default as event } from './src/event';
24 |
25 | export default Overlay;
26 |
--------------------------------------------------------------------------------
/packages/form/src/fields/Time.vue:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
47 |
--------------------------------------------------------------------------------
/packages/ui-vue2/src/img/src/initValue.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | export default {
20 | src: 'https://puui.qpic.cn/vupload/0/1573555382625_bhp0wud8l6w.png/0',
21 | url: '',
22 | style: {
23 | position: 'absolute',
24 | left: '57',
25 | width: '176',
26 | height: '176',
27 | },
28 | };
29 |
--------------------------------------------------------------------------------
/packages/ui-vue2/src/overlay/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import Overlay from './src/index.vue';
20 |
21 | export { default as config } from './src/formConfig';
22 | export { default as value } from './src/initValue';
23 | export { default as event } from './src/event';
24 |
25 | export default Overlay;
26 |
--------------------------------------------------------------------------------
/magic-admin/server/src/config/database-example.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making MagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | // 数据库配置文件,需开发者自行替换并更名为database.ts
20 | export default {
21 | connectionLimit: 10,
22 | host: '1.2.3.4',
23 | port: 36000,
24 | user: 'database_username',
25 | password: 'database_password',
26 | database: 'database_name',
27 | };
28 |
--------------------------------------------------------------------------------
/magic-admin/web/src/plugins/element.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making MagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import ElementPlus from 'element-plus';
20 | import locale from 'element-plus/lib/locale/lang/zh-cn';
21 |
22 | import 'element-plus/lib/theme-chalk/index.css';
23 |
24 | export default (app: any) => {
25 | app.use(ElementPlus, { locale });
26 | };
27 |
--------------------------------------------------------------------------------
/packages/editor/src/utils/compose.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @param {Array} middleware
3 | * @return {Function}
4 | */
5 | export const compose = (middleware: Function[]) => {
6 | if (!Array.isArray(middleware)) throw new TypeError('Middleware 必须是一个数组!');
7 | for (const fn of middleware) {
8 | if (typeof fn !== 'function') throw new TypeError('Middleware 必须由函数组成!');
9 | }
10 |
11 | /**
12 | * @param {Object} args
13 | * @return {Promise}
14 | * @api public
15 | */
16 | return (args: any[], next?: Function) => {
17 | // last called middleware #
18 | let index = -1;
19 | return dispatch(0);
20 | function dispatch(i: number): Promise {
21 | if (i <= index) return Promise.reject(new Error('next() 被多次调用'));
22 | index = i;
23 | let fn = middleware[i];
24 | if (i === middleware.length && next) fn = next;
25 | if (!fn) return Promise.resolve();
26 | try {
27 | return Promise.resolve(fn(...args, dispatch.bind(null, i + 1)));
28 | } catch (err) {
29 | return Promise.reject(err);
30 | }
31 | }
32 | };
33 | };
34 |
--------------------------------------------------------------------------------
/magic-admin/web/src/config/status.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making MagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | // 活动状态
20 | export enum ActStatus {
21 | ALL = -1, // 查询传参使用:全部状态占位
22 | MODIFYING, // 修改中
23 | PART_PUBLISHED, // 部分页面已发布
24 | PUBLISHED, // 全部页面已发布
25 | }
26 |
27 | // 页面状态
28 | export enum PageStatus {
29 | MODIFYING = 0, // 修改中
30 | PUBLISHED, // 已预发布
31 | }
32 |
--------------------------------------------------------------------------------
/magic-admin/web/src/util/set-env.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making MagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import Cookies from 'js-cookie';
20 |
21 | import { getUrlParam } from '@src/util/url';
22 |
23 | const env = getUrlParam('magic_env');
24 | if (env) {
25 | Cookies.set('env', env === 'test' ? env : 'production', {
26 | expires: 365,
27 | path: '/',
28 | });
29 | }
30 |
--------------------------------------------------------------------------------
/magic-admin/web/src/api/user.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making MagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import fetch, { Res } from '@src/util/request';
20 |
21 | export interface UserState {
22 | loginName: string;
23 | }
24 |
25 | export default {
26 | getUser(): Promise> {
27 | return fetch.get({
28 | _c: 'user',
29 | _a: 'getUser',
30 | });
31 | },
32 | };
33 |
--------------------------------------------------------------------------------
/packages/editor/src/theme/content-menu.scss:
--------------------------------------------------------------------------------
1 | .magic-editor-content-menu {
2 | position: fixed;
3 | font-size: 12px;
4 | background: #fff;
5 | box-shadow: 0 2px 8px 2px rgba(68, 73, 77, 0.16);
6 | z-index: 9999;
7 | transform-origin: 0% 0%;
8 | font-weight: 600;
9 | padding: 4px 0px;
10 | overflow: auto;
11 | max-height: 100%;
12 |
13 | .menu-item {
14 | color: #333;
15 | display: flex;
16 | -webkit-box-align: center;
17 | align-items: center;
18 | cursor: pointer;
19 | min-width: 140px;
20 | transition: all 0.2s ease 0s;
21 | padding: 5px 14px;
22 | border-left: 2px solid transparent;
23 |
24 | .el-button {
25 | width: 100%;
26 | justify-content: flex-start;
27 | }
28 |
29 | .el-button--text,
30 | i {
31 | color: $--font-color;
32 | }
33 |
34 | .magic-editor-icon {
35 | margin-right: 5px;
36 | }
37 |
38 | &.divider {
39 | padding: 0 14px;
40 |
41 | .el-divider {
42 | margin: 0;
43 | }
44 | }
45 |
46 | &:hover {
47 | background-color: $--hover-color;
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/magic-admin/web/src/use/use-comp.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making MagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import MAside from '@src/components/aside.vue';
20 | import MHeader from '@src/components/header.vue';
21 |
22 | const components: any[] = [MAside, MHeader];
23 |
24 | export default (app: any) => {
25 | components.forEach((comp: any) => {
26 | app.component(comp?.name, comp);
27 | });
28 | };
29 |
--------------------------------------------------------------------------------
/vitest.config.ts:
--------------------------------------------------------------------------------
1 | import { resolve } from 'path';
2 |
3 | import { defineConfig } from 'vitest/config';
4 | import Vue from '@vitejs/plugin-vue';
5 |
6 | const r = (p: string) => resolve(__dirname, p);
7 |
8 | export default defineConfig({
9 | plugins: [Vue()],
10 |
11 | test: {
12 | exclude: [
13 | '**/node_modules/**',
14 | '**/dist/**',
15 | '**/cypress/**',
16 | '**/.{idea,git,cache,output,temp}/**',
17 | 'magic-admin/**',
18 | ],
19 | include: [
20 | './packages/editor/tests/**',
21 | './packages/form/tests/**',
22 | './packages/stage/tests/**',
23 | './packages/utils/tests/**',
24 | ],
25 | environment: 'jsdom',
26 | },
27 |
28 | resolve: {
29 | alias: {
30 | '@editor': r('./packages/editor/src'),
31 | '@form': r('./packages/form/src'),
32 | '@tmagic/core': r('./packages/core/src'),
33 | '@tmagic/utils': r('./packages/utils/src'),
34 | '@tmagic/editor': r('./packages/editor/src'),
35 | '@tmagic/stage': r('./packages/stage/src'),
36 | '@tmagic/schema': r('./packages/schema/src'),
37 | },
38 | },
39 | });
40 |
--------------------------------------------------------------------------------
/runtime/react/playground/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | React Playground
9 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/magic-admin/server/src/service/editor.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making MagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import componetList from '@src/template/editor/get-component-list';
20 | import webPlugins from '@src/template/editor/get-web-plugins';
21 |
22 | export default class EditorService {
23 | // 获取组件列表
24 | getComponentList = () => componetList;
25 | // 获取插件列表
26 | getWebPlugins = () => webPlugins;
27 | }
28 |
--------------------------------------------------------------------------------
/docs/src/api/form-config/fields/time-picker.md:
--------------------------------------------------------------------------------
1 | # TimePicker 时间选择器
2 |
3 | 用于选择或输入日期
4 |
5 | ## 基础用法
6 |
7 |
12 |
13 |
14 | 在开启多选模式后,默认情况下会展示所有已选中的选项的Tag
15 |
16 |
17 |
18 |
19 | ## 禁用状态
20 |
21 |
27 |
28 |
29 | 在开启多选模式后,默认情况下会展示所有已选中的选项的Tag
30 |
31 |
32 |
33 |
34 |
35 | ## Attributes
36 | | 参数 | 说明 | 类型 | 可选值 | 默认值 |
37 | |---------- |-------------- |---------- |-------------------------------- |-------- |
38 | | name | 绑定值 | string | — | — |
39 | | placeholder | 输入框占位文本 | string | — | — |
40 | | text | 表单标签 | string | — | — |
41 | | disabled | 是否禁用 | boolean / [Function](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | false |
42 |
--------------------------------------------------------------------------------
/magic-admin/web/vue.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
3 |
4 | const { defineConfig } = require('@vue/cli-service');
5 |
6 | module.exports = defineConfig({
7 | transpileDependencies: true,
8 |
9 | lintOnSave: true,
10 |
11 | indexPath: 'index.html',
12 |
13 | outputDir: path.resolve(__dirname, './dist'),
14 |
15 | devServer: {
16 | port: 80,
17 | host: '0.0.0.0',
18 | proxy: {
19 | '/api': {
20 | target: 'http://localhost:3001/',
21 | ws: true,
22 | changOrigin: true,
23 | },
24 | '/static': {
25 | target: 'http://localhost:3001/',
26 | ws: true,
27 | changOrigin: true,
28 | },
29 | },
30 | },
31 |
32 | configureWebpack: {
33 | devtool: 'source-map',
34 | entry: '@src/main.ts',
35 |
36 | resolve: {
37 | alias: {
38 | vue$: path.resolve(__dirname, './node_modules/vue/dist/vue.runtime.esm-bundler.js'),
39 | '@src': path.resolve(__dirname, './src'),
40 | },
41 | },
42 |
43 | plugins: [new MonacoWebpackPlugin()],
44 | },
45 | });
46 |
--------------------------------------------------------------------------------
/packages/editor/tests/unit/services/ui.spec.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import { describe, expect, test } from 'vitest';
20 |
21 | import ui from '@editor/services/ui';
22 |
23 | describe('events', () => {
24 | test('init', () => {
25 | ui.set('uiSelectMode', true);
26 | expect(ui.get('uiSelectMode')).toBeTruthy();
27 | expect(ui.get('showSrc')).toBeFalsy();
28 | });
29 | });
30 |
--------------------------------------------------------------------------------
/docs/src/.vuepress/client.ts:
--------------------------------------------------------------------------------
1 | import 'element-plus/dist/index.css';
2 | import 'highlight.js/styles/github.css';
3 |
4 | import './polyfills';
5 | import { defineClientConfig } from '@vuepress/client';
6 | import ElementPlus from 'element-plus';
7 | import MagicForm from '@tmagic/form';
8 | import DemoBlock from './demo-block.vue';
9 |
10 | export default defineClientConfig({
11 | enhance({ app, router, siteData }) {
12 | app.use(ElementPlus);
13 | app.use(MagicForm, {
14 | request: (options: any) => new Promise((resolve) => {
15 | if (options.url === 'select/remote') {
16 | setTimeout(() => {
17 | resolve({
18 | data: [
19 | {
20 | name: 'select-1',
21 | id: 1
22 | },
23 | {
24 | name: 'select-2',
25 | id: 2
26 | },
27 | ],
28 | });
29 | }, 1000);
30 | } else {
31 | resolve({});
32 | }
33 | }),
34 | });
35 | app.component('demo-block', DemoBlock);
36 | },
37 | setup() {},
38 | rootComponents: [],
39 | })
40 |
--------------------------------------------------------------------------------
/packages/editor/src/utils/config.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import { InstallOptions } from '../type';
20 |
21 | let $TMAGIC_EDITOR: InstallOptions = {} as any;
22 |
23 | const setConfig = (option: InstallOptions): void => {
24 | $TMAGIC_EDITOR = option;
25 | };
26 |
27 | const getConfig = (key: keyof InstallOptions): unknown => $TMAGIC_EDITOR[key];
28 |
29 | export { getConfig, setConfig };
30 |
--------------------------------------------------------------------------------
/packages/ui-vue2/src/useCommonMethod.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import { getCurrentInstance } from 'vue';
20 |
21 | export default () => {
22 | const vm = getCurrentInstance()?.proxy;
23 | return {
24 | show: () => {
25 | vm.$set(vm.config.style, 'display', 'initial');
26 | },
27 | hide: () => {
28 | vm.$set(vm.config.style, 'display', 'none');
29 | },
30 | };
31 | };
32 |
--------------------------------------------------------------------------------
/docs/src/guide/advanced/layout.md:
--------------------------------------------------------------------------------
1 | # 布局原理
2 | tmagic-editor的布局实现方式,**关键在于将布局配置指定在容器上,对容器内的所有子组件生效**,这是tmagic-editor页面可以支持各种布局方式混合使用的核心方法。
3 |
4 | ## 容器
5 | 前面概念介绍中有提到,tmagic-editor的容器是组件的基础。组件必属于某个容器,容器下可以放组件,也可以放容器。页面本身就是一个容器,是所有容器和组件的根,整个页面的容器和组件组成一个树状结构。在 DSL 配置中,表现为:
6 |
7 | ```javascript
8 | [{
9 | id: 123456,
10 | type: 'page',
11 | items: [{
12 | id: 222222,
13 | type: 'comp-A',
14 | }, {
15 | id: 333333,
16 | type: 'comp-B',
17 | }]
18 | }]
19 | ```
20 |
21 | ## 顺序/绝对定位
22 | 组件是绝对或者顺序定位,体现在组件的**直属父级容器**上,比如我们将 page 设置为绝对定位,则它的子组件,全都为绝对定位。在 DSL 配置中,表现为:
23 |
24 | ```javascript
25 | [{
26 | id: 123456,
27 | type: 'page',
28 | layout: "absolute",
29 | items: [{
30 | id: 222222,
31 | type: 'comp-A',
32 | style: {
33 | position: 'absolute',
34 | },
35 | }, {
36 | id: 333333,
37 | type: 'comp-B',
38 | style: {
39 | position: 'absolute',
40 | },
41 | }]
42 | }]
43 | ```
44 | 所以,我们对绝对/顺序排布的配置描述 layout,是存在于容器上的。
45 |
46 | ## 混合布局
47 | 因为tmagic-editor的布局配置,是指定在容器上的,所以tmagic-editor的设计方式,就可以支持在页面中实现各种混合布局的嵌套。
48 |
49 |
--------------------------------------------------------------------------------
/packages/cli/src/utils/loadUserConfig.ts:
--------------------------------------------------------------------------------
1 | import { UserConfig, UserConfigLoader } from '../types';
2 |
3 | export const isPlainObject = = Record>(val: unknown): val is T =>
4 | Object.prototype.toString.call(val) === '[object Object]';
5 |
6 | /**
7 | * Check if a module is esm with `export default`
8 | */
9 | export const hasExportDefault = (mod: unknown): mod is { default: T } =>
10 | isPlainObject(mod) && !!mod.__esModule && Object.prototype.hasOwnProperty.call(mod, 'default');
11 |
12 | export const loadUserConfigCjs: UserConfigLoader = async (userConfigPath) => {
13 | const required = require(userConfigPath);
14 | return hasExportDefault(required) ? required.default : required;
15 | };
16 |
17 | const loaderMap: [RegExp, UserConfigLoader][] = [[/\.(js|cjs|ts)$/, loadUserConfigCjs]];
18 |
19 | export const loadUserConfig = async (userConfigPath?: string): Promise> => {
20 | if (!userConfigPath) return {};
21 |
22 | for (const [condition, loader] of loaderMap) {
23 | if (condition.test(userConfigPath)) {
24 | return loader(userConfigPath);
25 | }
26 | }
27 |
28 | return {};
29 | };
30 |
--------------------------------------------------------------------------------
/packages/table/src/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import { App } from 'vue';
20 |
21 | import Table from './Table.vue';
22 |
23 | export { default as MagicTable } from './Table.vue';
24 |
25 | const components = [Table];
26 |
27 | export default {
28 | install(app: App) {
29 | components.forEach((component) => {
30 | app.component(component.name, component);
31 | });
32 | },
33 | };
34 |
--------------------------------------------------------------------------------
/runtime/vue2/page/utils/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import type { MApp } from '@tmagic/schema';
20 |
21 | export const getLocalConfig = (): MApp[] => {
22 | const configStr = localStorage.getItem('magicDSL');
23 | if (!configStr) return [];
24 | try {
25 | // eslint-disable-next-line no-eval
26 | return [eval(`(${configStr})`)];
27 | } catch (err) {
28 | return [];
29 | }
30 | };
31 |
--------------------------------------------------------------------------------
/runtime/vue3/page/utils/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making TMagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import type { MApp } from '@tmagic/schema';
20 |
21 | export const getLocalConfig = (): MApp[] => {
22 | const configStr = localStorage.getItem('magicDSL');
23 | if (!configStr) return [];
24 | try {
25 | // eslint-disable-next-line no-eval
26 | return [eval(`(${configStr})`)];
27 | } catch (err) {
28 | return [];
29 | }
30 | };
31 |
--------------------------------------------------------------------------------
/magic-admin/server/src/routers/publish.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Tencent is pleased to support the open source community by making MagicEditor available.
3 | *
4 | * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | // 保存发布的相关路由
20 | import Router from 'koa-router';
21 |
22 | import PublishController from '@src/controller/publish';
23 |
24 | const router = new Router();
25 | // 保存活动基础信息
26 | router.post('/saveActInfo', PublishController.saveActInfo);
27 |
28 | // 发布
29 | router.post('/publish', PublishController.publish);
30 |
31 | export default router;
32 |
--------------------------------------------------------------------------------
/packages/ui-vue2/src/page/Page.vue:
--------------------------------------------------------------------------------
1 |
2 |