├── packages ├── core │ ├── README.md │ ├── tsconfig.json │ ├── src │ │ ├── Store.ts │ │ └── index.ts │ └── tsconfig.build.json ├── ui │ ├── src │ │ ├── overlay │ │ │ ├── src │ │ │ │ ├── formConfig.ts │ │ │ │ ├── initValue.ts │ │ │ │ └── event.ts │ │ │ └── index.ts │ │ ├── page │ │ │ ├── src │ │ │ │ ├── event.ts │ │ │ │ ├── initValue.ts │ │ │ │ └── index.vue │ │ │ └── index.ts │ │ ├── shims-vue.d.ts │ │ ├── img │ │ │ ├── src │ │ │ │ ├── index.vue │ │ │ │ ├── formConfig.ts │ │ │ │ └── initValue.ts │ │ │ └── index.ts │ │ ├── qrcode │ │ │ ├── src │ │ │ │ ├── formConfig.ts │ │ │ │ ├── initValue.ts │ │ │ │ └── index.vue │ │ │ └── index.ts │ │ ├── button │ │ │ ├── src │ │ │ │ ├── formConfig.ts │ │ │ │ └── initValue.ts │ │ │ └── index.ts │ │ ├── container │ │ │ ├── src │ │ │ │ └── initValue.ts │ │ │ └── index.ts │ │ ├── text │ │ │ ├── src │ │ │ │ ├── initValue.ts │ │ │ │ └── formConfig.ts │ │ │ └── index.ts │ │ ├── useCommonMethod.ts │ │ ├── Component.vue │ │ └── index.ts │ ├── README.md │ ├── tsconfig.json │ ├── .npmignore │ └── package.json ├── ui-vue2 │ ├── src │ │ ├── overlay │ │ │ ├── src │ │ │ │ ├── formConfig.ts │ │ │ │ ├── initValue.ts │ │ │ │ └── event.ts │ │ │ └── index.ts │ │ ├── page │ │ │ ├── event.ts │ │ │ ├── initValue.ts │ │ │ ├── index.ts │ │ │ └── Page.vue │ │ ├── img │ │ │ ├── src │ │ │ │ ├── index.vue │ │ │ │ ├── formConfig.ts │ │ │ │ └── initValue.ts │ │ │ └── index.ts │ │ ├── button │ │ │ ├── formConfig.ts │ │ │ ├── index.ts │ │ │ └── initValue.ts │ │ ├── qrcode │ │ │ ├── src │ │ │ │ ├── formConfig.ts │ │ │ │ ├── index.vue │ │ │ │ └── initValue.ts │ │ │ └── index.ts │ │ ├── container │ │ │ ├── initValue.ts │ │ │ └── index.ts │ │ ├── text │ │ │ ├── initValue.ts │ │ │ ├── index.ts │ │ │ └── formConfig.ts │ │ ├── useCommonMethod.ts │ │ └── index.ts │ ├── .npmignore │ └── package.json ├── editor │ ├── README.md │ ├── src │ │ ├── theme │ │ │ ├── index.scss │ │ │ ├── icon.scss │ │ │ ├── code-editor.scss │ │ │ ├── layout.scss │ │ │ ├── workspace.scss │ │ │ ├── common │ │ │ │ └── var.scss │ │ │ ├── theme.scss │ │ │ ├── stage.scss │ │ │ ├── props-panel.scss │ │ │ ├── ruler.scss │ │ │ ├── content-menu.scss │ │ │ └── resizer.scss │ │ ├── shims-vue.d.ts │ │ ├── components │ │ │ └── Icon.vue │ │ ├── layouts │ │ │ ├── Resizer.vue │ │ │ └── AddPageBox.vue │ │ ├── fields │ │ │ └── Code.vue │ │ └── utils │ │ │ ├── index.ts │ │ │ ├── compose.ts │ │ │ └── config.ts │ ├── tsconfig.json │ ├── tsconfig.build.json │ ├── .npmignore │ └── tests │ │ └── unit │ │ └── services │ │ ├── ui.spec.ts │ │ └── props.spec.ts ├── form │ ├── README.md │ ├── src │ │ ├── theme │ │ │ ├── select.scss │ │ │ ├── link.scss │ │ │ ├── date-time.scss │ │ │ ├── index.scss │ │ │ ├── form-dialog.scss │ │ │ ├── panel.scss │ │ │ ├── group-list.scss │ │ │ ├── tabs.scss │ │ │ ├── fieldset.scss │ │ │ └── form.scss │ │ ├── shims-vue.d.ts │ │ ├── fields │ │ │ ├── SelectOptions.vue │ │ │ ├── Hidden.vue │ │ │ ├── SelectOptionGroups.vue │ │ │ ├── Display.vue │ │ │ ├── ColorPicker.vue │ │ │ ├── RadioGroup.vue │ │ │ ├── Time.vue │ │ │ ├── Date.vue │ │ │ └── CheckboxGroup.vue │ │ └── utils │ │ │ ├── createForm.ts │ │ │ ├── config.ts │ │ │ └── fieldProps.ts │ ├── tsconfig.json │ ├── tsconfig.build.json │ ├── .npmignore │ └── tests │ │ └── unit │ │ └── utils │ │ └── createForm.spec.ts ├── schema │ ├── README.md │ ├── tsconfig.json │ ├── vite.config.ts │ ├── tsconfig.build.json │ └── package.json ├── stage │ ├── README.md │ ├── tsconfig.json │ ├── tsconfig.build.json │ ├── src │ │ ├── style.css │ │ ├── index.ts │ │ └── logger.ts │ └── .npmignore ├── table │ ├── README.md │ ├── tsconfig.json │ ├── src │ │ ├── shims-vue.d.ts │ │ ├── ExpandColumn.vue │ │ ├── index.ts │ │ └── PopoverColumn.vue │ ├── tsconfig.build.json │ └── .npmignore ├── cli │ ├── src │ │ ├── index.ts │ │ ├── utils │ │ │ ├── index.ts │ │ │ ├── defineUserConfig.ts │ │ │ ├── allowTs.ts │ │ │ └── loadUserConfig.ts │ │ ├── cli.ts │ │ └── Core.ts │ ├── tsconfig.build.json │ ├── bin │ │ └── tmagic.js │ ├── .gitignore │ └── package.json ├── utils │ ├── tsconfig.json │ ├── tsconfig.build.json │ ├── .npmignore │ └── package.json └── ui-react │ ├── src │ ├── page │ │ ├── event.ts │ │ ├── initValue.ts │ │ └── index.ts │ ├── overlay │ │ ├── initValue.ts │ │ ├── event.ts │ │ ├── formConfig.ts │ │ └── index.ts │ ├── qrcode │ │ ├── formConfig.ts │ │ ├── index.ts │ │ └── initValue.ts │ ├── container │ │ ├── initValue.ts │ │ └── index.ts │ ├── AppContent.ts │ ├── img │ │ ├── formConfig.ts │ │ ├── index.ts │ │ └── initValue.ts │ ├── text │ │ ├── initValue.ts │ │ ├── index.ts │ │ └── formConfig.ts │ ├── button │ │ ├── index.ts │ │ ├── formConfig.ts │ │ └── initValue.ts │ └── useCommonMethod.tsx │ ├── .npmignore │ ├── tsconfig.json │ └── package.json ├── runtime ├── vue3 │ ├── .gitignore │ ├── public │ │ └── favicon.png │ ├── page │ │ ├── shims-vue.d.ts │ │ ├── App.vue │ │ ├── index.html │ │ └── utils │ │ │ └── index.ts │ ├── playground │ │ ├── shims-vue.d.ts │ │ └── index.html │ └── tmagic.config.ts ├── react │ ├── .gitignore │ ├── public │ │ └── favicon.png │ ├── tmagic.config.ts │ ├── tsconfig.json │ ├── page │ │ └── index.html │ └── playground │ │ └── index.html └── vue2 │ ├── .gitignore │ ├── public │ └── favicon.png │ ├── page │ ├── shims-vue.d.ts │ ├── App.vue │ ├── index.html │ └── utils │ │ └── index.ts │ ├── playground │ ├── shims-vue.d.ts │ └── index.html │ └── tmagic.config.ts ├── docs ├── .gitignore ├── src │ ├── .vuepress │ │ ├── styles │ │ │ └── index.scss │ │ ├── public │ │ │ ├── favicon.png │ │ │ └── tutorial │ │ │ │ └── one │ │ │ │ └── init.png │ │ ├── polyfills.ts │ │ └── client.ts │ ├── api │ │ └── form-config │ │ │ ├── fields │ │ │ ├── color-picker.md │ │ │ ├── hidden.md │ │ │ ├── display.md │ │ │ └── time-picker.md │ │ │ └── relate.md │ ├── README.md │ └── guide │ │ └── advanced │ │ └── layout.md └── package.json ├── vite-env.d.ts ├── playground ├── .gitignore ├── src │ ├── vite-env.d.ts │ ├── shims-vue.d.ts │ ├── App.vue │ ├── components │ │ └── NavMenu.vue │ └── route.ts ├── .env.react ├── .env.vue2 ├── .env.vue3 ├── public │ └── favicon.png ├── tsconfig.json ├── index.html └── package.json ├── magic-admin ├── server │ ├── .eslintignore │ ├── static │ │ └── vue3 │ │ │ ├── runtime │ │ │ ├── playground │ │ │ │ ├── assets │ │ │ │ │ ├── plugin-entry.b765d2c2.js │ │ │ │ │ ├── plugin-entry-legacy.7d9da6d6.js │ │ │ │ │ ├── plugin-entry.b765d2c2.js.map │ │ │ │ │ └── plugin-entry-legacy.7d9da6d6.js.map │ │ │ │ └── favicon.png │ │ │ └── page │ │ │ │ └── favicon.png │ │ │ └── entry │ │ │ └── event │ │ │ └── index.umd.js │ ├── .babelrc │ ├── jest.config.ts │ ├── .gitignore │ ├── tsconfig.json │ └── src │ │ ├── config │ │ ├── key-example.ts │ │ └── database-example.ts │ │ ├── models │ │ └── index.ts │ │ ├── template │ │ └── editor │ │ │ └── get-web-plugins.ts │ │ ├── service │ │ └── editor.ts │ │ └── routers │ │ ├── publish.ts │ │ └── editor.ts ├── web │ ├── .browserslistrc │ ├── babel.config.js │ ├── .eslintignore │ ├── public │ │ ├── favicon.png │ │ └── index.html │ ├── src │ │ ├── shims-vue.d.ts │ │ ├── views │ │ │ └── list-view.vue │ │ ├── use │ │ │ ├── use-status.ts │ │ │ └── use-comp.ts │ │ ├── plugins │ │ │ └── element.ts │ │ ├── config │ │ │ └── status.ts │ │ ├── util │ │ │ └── set-env.ts │ │ └── api │ │ │ └── user.ts │ ├── jest.config.js │ ├── .gitignore │ ├── index_index.html │ ├── typings │ │ ├── axios-jsonp │ │ │ └── index.d.ts │ │ ├── index.d.ts │ │ └── shims-vue.d.ts │ ├── tsconfig.json │ ├── vue.config.js │ └── tests │ │ └── unit │ │ ├── components │ │ └── act-create-card.spec.ts │ │ └── views │ │ └── list-view.spec.ts ├── package.json └── setup.sh ├── .husky ├── pre-push ├── commit-msg └── pre-commit ├── commitlint.config.js ├── babel.config.js ├── pnpm-workspace.yaml ├── .editorconfig ├── .eslintignore ├── .gitignore ├── .github ├── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md └── workflows │ └── pages.yml ├── tsconfig.json └── vitest.config.ts /packages/core/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /runtime/vue3/.gitignore: -------------------------------------------------------------------------------- 1 | .tmagic 2 | -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .temp 3 | .cache 4 | -------------------------------------------------------------------------------- /runtime/react/.gitignore: -------------------------------------------------------------------------------- 1 | .tmagic 2 | entry-dist 3 | -------------------------------------------------------------------------------- /runtime/vue2/.gitignore: -------------------------------------------------------------------------------- 1 | .tmagic 2 | entry-dist 3 | -------------------------------------------------------------------------------- /vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /playground/.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | public/entry 3 | public/runtime -------------------------------------------------------------------------------- /packages/ui/src/overlay/src/formConfig.ts: -------------------------------------------------------------------------------- 1 | export default []; 2 | -------------------------------------------------------------------------------- /magic-admin/server/.eslintignore: -------------------------------------------------------------------------------- 1 | dist 2 | node_modules 3 | pm2.config.js -------------------------------------------------------------------------------- /packages/ui-vue2/src/overlay/src/formConfig.ts: -------------------------------------------------------------------------------- 1 | export default []; 2 | -------------------------------------------------------------------------------- /playground/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /packages/editor/README.md: -------------------------------------------------------------------------------- 1 | # [文档](https://tencent.github.io/tmagic-editor/docs/) -------------------------------------------------------------------------------- /packages/form/README.md: -------------------------------------------------------------------------------- 1 | # [文档](https://tencent.github.io/tmagic-editor/docs/) -------------------------------------------------------------------------------- /packages/form/src/theme/select.scss: -------------------------------------------------------------------------------- 1 | .m-select { 2 | width: 100%; 3 | } 4 | -------------------------------------------------------------------------------- /packages/schema/README.md: -------------------------------------------------------------------------------- 1 | # [文档](https://tencent.github.io/tmagic-editor/docs/) -------------------------------------------------------------------------------- /packages/stage/README.md: -------------------------------------------------------------------------------- 1 | # [文档](https://tencent.github.io/tmagic-editor/docs/) -------------------------------------------------------------------------------- /packages/table/README.md: -------------------------------------------------------------------------------- 1 | # [文档](https://tencent.github.io/tmagic-editor/docs/) -------------------------------------------------------------------------------- /packages/ui/README.md: -------------------------------------------------------------------------------- 1 | # [文档](https://tencent.github.io/tmagic-editor/docs/) -------------------------------------------------------------------------------- /.husky/pre-push: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npm test 5 | -------------------------------------------------------------------------------- /docs/src/.vuepress/styles/index.scss: -------------------------------------------------------------------------------- 1 | :root { 2 | --c-brand: #2882e0; 3 | } 4 | -------------------------------------------------------------------------------- /magic-admin/web/.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | not dead 4 | not ie 11 5 | -------------------------------------------------------------------------------- /commitlint.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { extends: ['@commitlint/config-conventional'] }; 2 | -------------------------------------------------------------------------------- /packages/form/src/theme/link.scss: -------------------------------------------------------------------------------- 1 | div.m-fields-link { 2 | width: fit-content; 3 | } 4 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['@vue/cli-plugin-babel/preset'], 3 | }; 4 | -------------------------------------------------------------------------------- /packages/editor/src/theme/index.scss: -------------------------------------------------------------------------------- 1 | @import "./common/var.scss"; 2 | @import "./theme.scss"; 3 | -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - 'packages/*' 3 | - 'playground' 4 | - 'docs' 5 | - 'runtime/*' -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npx --no-install commitlint --edit $1 5 | -------------------------------------------------------------------------------- /magic-admin/web/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['@vue/cli-plugin-babel/preset'], 3 | }; 4 | -------------------------------------------------------------------------------- /playground/.env.react: -------------------------------------------------------------------------------- 1 | VITE_RUNTIME_PATH=/tmagic-editor/playground/runtime/react 2 | VITE_ENTRY_PATH=./entry/react -------------------------------------------------------------------------------- /playground/.env.vue2: -------------------------------------------------------------------------------- 1 | VITE_RUNTIME_PATH=/tmagic-editor/playground/runtime/vue2 2 | VITE_ENTRY_PATH=./entry/vue2 -------------------------------------------------------------------------------- /playground/.env.vue3: -------------------------------------------------------------------------------- 1 | VITE_RUNTIME_PATH=/tmagic-editor/playground/runtime/vue3 2 | VITE_ENTRY_PATH=./entry/vue3 -------------------------------------------------------------------------------- /playground/public/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dynamic-form/tmagic-editor/master/playground/public/favicon.png -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npx lint-staged 5 | pnpm --filter "@tmagic/*" build:type -------------------------------------------------------------------------------- /magic-admin/web/.eslintignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | node_modules/ 3 | babel.config.js 4 | vue.config.js 5 | jest.config.js 6 | tscofnig.json -------------------------------------------------------------------------------- /runtime/react/public/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dynamic-form/tmagic-editor/master/runtime/react/public/favicon.png -------------------------------------------------------------------------------- /runtime/vue2/public/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dynamic-form/tmagic-editor/master/runtime/vue2/public/favicon.png -------------------------------------------------------------------------------- /runtime/vue3/public/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dynamic-form/tmagic-editor/master/runtime/vue3/public/favicon.png -------------------------------------------------------------------------------- /magic-admin/web/public/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dynamic-form/tmagic-editor/master/magic-admin/web/public/favicon.png -------------------------------------------------------------------------------- /docs/src/.vuepress/public/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dynamic-form/tmagic-editor/master/docs/src/.vuepress/public/favicon.png -------------------------------------------------------------------------------- /packages/editor/src/theme/icon.scss: -------------------------------------------------------------------------------- 1 | .magic-editor-icon { 2 | img { 3 | max-width: 100%; 4 | max-height: 100%; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/cli/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './cli'; 2 | export * from './utils'; 3 | export * from './types'; 4 | export * from './commands'; 5 | -------------------------------------------------------------------------------- /packages/core/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "../..", 5 | }, 6 | } 7 | -------------------------------------------------------------------------------- /packages/editor/src/theme/code-editor.scss: -------------------------------------------------------------------------------- 1 | .magic-code-editor { 2 | width: 100%; 3 | 4 | .margin { 5 | margin: 0; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/editor/src/theme/layout.scss: -------------------------------------------------------------------------------- 1 | .m-editor-layout { 2 | width: 100%; 3 | display: flex; 4 | justify-self: space-between; 5 | } 6 | -------------------------------------------------------------------------------- /packages/form/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "../..", 5 | }, 6 | } 7 | -------------------------------------------------------------------------------- /packages/editor/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "../..", 5 | }, 6 | } 7 | -------------------------------------------------------------------------------- /packages/schema/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "../..", 5 | }, 6 | } 7 | -------------------------------------------------------------------------------- /packages/stage/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "../..", 5 | }, 6 | } 7 | -------------------------------------------------------------------------------- /packages/table/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "../..", 5 | }, 6 | } 7 | -------------------------------------------------------------------------------- /packages/utils/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "../..", 5 | }, 6 | } 7 | -------------------------------------------------------------------------------- /packages/cli/src/utils/index.ts: -------------------------------------------------------------------------------- 1 | export * from './defineUserConfig'; 2 | export * from './prepareEntryFile'; 3 | export * from './resolveAppPackages'; 4 | -------------------------------------------------------------------------------- /docs/src/.vuepress/public/tutorial/one/init.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dynamic-form/tmagic-editor/master/docs/src/.vuepress/public/tutorial/one/init.png -------------------------------------------------------------------------------- /packages/ui-react/src/page/event.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | methods: [ 3 | { 4 | label: '刷新页面', 5 | value: 'refresh', 6 | }, 7 | ], 8 | }; 9 | -------------------------------------------------------------------------------- /packages/ui-vue2/src/page/event.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | methods: [ 3 | { 4 | label: '刷新页面', 5 | value: 'refresh', 6 | }, 7 | ], 8 | }; 9 | -------------------------------------------------------------------------------- /packages/ui/src/page/src/event.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | methods: [ 3 | { 4 | label: '刷新页面', 5 | value: 'refresh', 6 | }, 7 | ], 8 | }; 9 | -------------------------------------------------------------------------------- /magic-admin/server/static/vue3/runtime/playground/assets/plugin-entry.b765d2c2.js: -------------------------------------------------------------------------------- 1 | const s={};export{s as default}; 2 | //# sourceMappingURL=plugin-entry.b765d2c2.js.map 3 | -------------------------------------------------------------------------------- /magic-admin/server/static/vue3/runtime/page/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dynamic-form/tmagic-editor/master/magic-admin/server/static/vue3/runtime/page/favicon.png -------------------------------------------------------------------------------- /magic-admin/server/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | [ 4 | "@babel/preset-env" 5 | ], 6 | [ 7 | "@babel/preset-typescript" 8 | ] 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /magic-admin/server/static/vue3/runtime/playground/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dynamic-form/tmagic-editor/master/magic-admin/server/static/vue3/runtime/playground/favicon.png -------------------------------------------------------------------------------- /packages/cli/src/utils/defineUserConfig.ts: -------------------------------------------------------------------------------- 1 | import { UserConfig } from '../types'; 2 | 3 | export const defineConfig = (config: Partial): Partial => config; 4 | -------------------------------------------------------------------------------- /packages/form/src/theme/date-time.scss: -------------------------------------------------------------------------------- 1 | .magic-datetime-picker-popper { 2 | .el-picker-panel__footer { 3 | button:first-child { 4 | display: none; 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /magic-admin/server/jest.config.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | collectCoverage: true, 3 | coverageProvider: 'v8', 4 | moduleNameMapper: { 5 | '^@src/(.*)$': '/src/$1', 6 | }, 7 | }; 8 | -------------------------------------------------------------------------------- /playground/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "..", 5 | }, 6 | "exclude": [ 7 | "**/dist/**/*" 8 | ], 9 | } 10 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | [*.{js,jsx,ts,tsx,vue}] 2 | indent_style = space 3 | indent_size = 2 4 | end_of_line = lf 5 | trim_trailing_whitespace = true 6 | insert_final_newline = true 7 | max_line_length = 100 8 | -------------------------------------------------------------------------------- /packages/editor/src/theme/workspace.scss: -------------------------------------------------------------------------------- 1 | .m-editor-workspace { 2 | height: 100%; 3 | width: 100%; 4 | user-select: none; 5 | 6 | &:focus-visible { 7 | outline: 0; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/form/src/shims-vue.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.vue' { 2 | import { DefineComponent } from 'vue'; 3 | 4 | const component: DefineComponent<{}, {}, any>; 5 | export default component; 6 | } 7 | -------------------------------------------------------------------------------- /packages/table/src/shims-vue.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.vue' { 2 | import { DefineComponent } from 'vue'; 3 | 4 | const component: DefineComponent<{}, {}, any>; 5 | export default component; 6 | } 7 | -------------------------------------------------------------------------------- /packages/ui/src/shims-vue.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.vue' { 2 | import { DefineComponent } from 'vue'; 3 | 4 | const component: DefineComponent<{}, {}, any>; 5 | export default component; 6 | } 7 | -------------------------------------------------------------------------------- /packages/ui/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "../..", 5 | }, 6 | "exclude": [ 7 | "**/dist/**/*" 8 | ], 9 | } 10 | -------------------------------------------------------------------------------- /playground/src/shims-vue.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.vue' { 2 | import { DefineComponent } from 'vue'; 3 | 4 | const component: DefineComponent<{}, {}, any>; 5 | export default component; 6 | } 7 | -------------------------------------------------------------------------------- /runtime/vue2/page/shims-vue.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.vue' { 2 | import { DefineComponent } from 'vue'; 3 | 4 | const component: DefineComponent<{}, {}, any>; 5 | export default component; 6 | } 7 | -------------------------------------------------------------------------------- /runtime/vue3/page/shims-vue.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.vue' { 2 | import { DefineComponent } from 'vue'; 3 | 4 | const component: DefineComponent<{}, {}, any>; 5 | export default component; 6 | } 7 | -------------------------------------------------------------------------------- /magic-admin/web/src/shims-vue.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.vue' { 2 | import type { DefineComponent } from 'vue'; 3 | const component: DefineComponent<{}, {}, any>; 4 | export default component; 5 | } 6 | -------------------------------------------------------------------------------- /packages/editor/src/shims-vue.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.vue' { 2 | import { DefineComponent } from 'vue'; 3 | 4 | const component: DefineComponent<{}, {}, any>; 5 | export default component; 6 | } 7 | -------------------------------------------------------------------------------- /runtime/vue2/playground/shims-vue.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.vue' { 2 | import { DefineComponent } from 'vue'; 3 | 4 | const component: DefineComponent<{}, {}, any>; 5 | export default component; 6 | } 7 | -------------------------------------------------------------------------------- /runtime/vue3/playground/shims-vue.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.vue' { 2 | import { DefineComponent } from 'vue'; 3 | 4 | const component: DefineComponent<{}, {}, any>; 5 | export default component; 6 | } 7 | -------------------------------------------------------------------------------- /magic-admin/server/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | yarn.lock 4 | package.json.lock 5 | coverage 6 | .vscode 7 | assets 8 | !static/**/assets 9 | src/config/database.ts 10 | src/config/key.ts 11 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | dist 2 | coverage 3 | node_modules 4 | dest 5 | types 6 | public/entry 7 | public/runtime 8 | 9 | comp-entry.ts 10 | config-entry.ts 11 | value-entry.ts 12 | 13 | magic-admin/web/public/runtime 14 | magic-admin/server/static -------------------------------------------------------------------------------- /magic-admin/server/static/vue3/runtime/playground/assets/plugin-entry-legacy.7d9da6d6.js: -------------------------------------------------------------------------------- 1 | System.register([],(function(e){"use strict";return{execute:function(){e("default",{})}}})); 2 | //# sourceMappingURL=plugin-entry-legacy.7d9da6d6.js.map 3 | -------------------------------------------------------------------------------- /runtime/vue2/tmagic.config.ts: -------------------------------------------------------------------------------- 1 | import path from 'path'; 2 | 3 | import { defineConfig } from '@tmagic/cli'; 4 | 5 | export default defineConfig({ 6 | packages: [path.join(__dirname, '../../packages/ui-vue2')], 7 | componentFileAffix: '.vue', 8 | }); 9 | -------------------------------------------------------------------------------- /magic-admin/web/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: '@vue/cli-plugin-unit-jest/presets/typescript-and-babel', 3 | 4 | moduleNameMapper: { 5 | '^@src/(.*)$': '/src/$1', 6 | '^@tests/(.*)$': '/tests/$1', 7 | }, 8 | }; 9 | -------------------------------------------------------------------------------- /runtime/react/tmagic.config.ts: -------------------------------------------------------------------------------- 1 | import path from 'path'; 2 | 3 | import { defineConfig } from '@tmagic/cli'; 4 | 5 | export default defineConfig({ 6 | packages: [path.join(__dirname, '../../packages/ui-react')], 7 | componentFileAffix: '.tsx', 8 | }); 9 | -------------------------------------------------------------------------------- /packages/cli/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "module": "CommonJS", 5 | "rootDir": "./src", 6 | "outDir": "./lib", 7 | "declaration": true, 8 | }, 9 | "include": ["./src"], 10 | } 11 | -------------------------------------------------------------------------------- /packages/ui-react/src/overlay/initValue.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | style: { 3 | position: 'fixed', 4 | width: '100%', 5 | height: '100%', 6 | top: 0, 7 | left: 0, 8 | backgroundColor: 'rgba(0, 0, 0, 0.8)', 9 | }, 10 | items: [], 11 | }; 12 | -------------------------------------------------------------------------------- /packages/ui/src/overlay/src/initValue.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | style: { 3 | position: 'fixed', 4 | width: '100%', 5 | height: '100%', 6 | top: 0, 7 | left: 0, 8 | backgroundColor: 'rgba(0, 0, 0, 0.8)', 9 | }, 10 | items: [], 11 | }; 12 | -------------------------------------------------------------------------------- /packages/cli/bin/tmagic.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const { cli } = require('../lib'); 4 | 5 | cli({ 6 | source: process.cwd(), 7 | packages: {}, 8 | componentFileAffix: '', 9 | cleanTemp: true, 10 | temp: '.tmagic', 11 | dynamicImport: false, 12 | }); 13 | -------------------------------------------------------------------------------- /packages/ui-vue2/src/overlay/src/initValue.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | style: { 3 | position: 'fixed', 4 | width: '100%', 5 | height: '100%', 6 | top: 0, 7 | left: 0, 8 | backgroundColor: 'rgba(0, 0, 0, 0.8)', 9 | }, 10 | items: [], 11 | }; 12 | -------------------------------------------------------------------------------- /packages/core/src/Store.ts: -------------------------------------------------------------------------------- 1 | export default class Store { 2 | private data: Record = {}; 3 | 4 | public set(key: string, value: any) { 5 | this.data[key] = value; 6 | } 7 | 8 | public get(key: string) { 9 | return this.data[key]; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/form/src/theme/index.scss: -------------------------------------------------------------------------------- 1 | @use "./form-dialog.scss"; 2 | @use "./form.scss"; 3 | @use "./date-time.scss"; 4 | @use "./link.scss"; 5 | @use "./fieldset.scss"; 6 | @use "./group-list.scss"; 7 | @use "./panel.scss"; 8 | @use "./table.scss"; 9 | @use "./select.scss"; 10 | -------------------------------------------------------------------------------- /packages/form/src/theme/form-dialog.scss: -------------------------------------------------------------------------------- 1 | .m-form-dialog { 2 | .el-dialog__body { 3 | padding: 0 !important; 4 | } 5 | 6 | .m-dialog-body { 7 | padding: 0 20px; 8 | } 9 | 10 | .el-table .m-form-item .el-form-item { 11 | margin-bottom: 0; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /runtime/vue3/tmagic.config.ts: -------------------------------------------------------------------------------- 1 | import path from 'path'; 2 | 3 | import { defineConfig } from '@tmagic/cli'; 4 | 5 | export default defineConfig({ 6 | packages: [path.join(__dirname, '../../packages/ui')], 7 | componentFileAffix: '.vue', 8 | dynamicImport: true, 9 | }); 10 | -------------------------------------------------------------------------------- /docs/src/.vuepress/polyfills.ts: -------------------------------------------------------------------------------- 1 | // serialize-javascript 依赖的 randombytes 依赖全局的 global 对象,因此此处需添加 global polyfill 2 | if (typeof global === 'undefined') { 3 | (window as any).global = window; 4 | } 5 | 6 | if (typeof globalThis === 'undefined') { 7 | (window as any).globalThis = window; 8 | } 9 | -------------------------------------------------------------------------------- /magic-admin/server/static/vue3/runtime/playground/assets/plugin-entry.b765d2c2.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"plugin-entry.b765d2c2.js","sources":["../../../../.tmagic/plugin-entry.ts"],"sourcesContent":["const plugins: Record = {};\nexport default plugins;"],"names":[],"mappings":"AAAA,KAAM,GAA+B,CAAA"} -------------------------------------------------------------------------------- /packages/schema/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite'; 2 | 3 | export default defineConfig({ 4 | build: { 5 | sourcemap: true, 6 | 7 | lib: { 8 | entry: 'src/index.ts', 9 | name: 'TMagicSchema', 10 | fileName: 'tmagic-schema', 11 | }, 12 | }, 13 | }); 14 | -------------------------------------------------------------------------------- /packages/core/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": ".", 5 | "declaration": true, 6 | "declarationDir": "types", 7 | "forceConsistentCasingInFileNames": true, 8 | "paths": {}, 9 | }, 10 | "include": [ 11 | "src" 12 | ], 13 | } 14 | -------------------------------------------------------------------------------- /packages/form/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": ".", 5 | "declaration": true, 6 | "declarationDir": "types", 7 | "forceConsistentCasingInFileNames": true, 8 | "paths": {}, 9 | }, 10 | "include": [ 11 | "src" 12 | ], 13 | } 14 | -------------------------------------------------------------------------------- /packages/editor/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": ".", 5 | "declaration": true, 6 | "declarationDir": "types", 7 | "forceConsistentCasingInFileNames": true, 8 | "paths": {}, 9 | }, 10 | "include": [ 11 | "src" 12 | ], 13 | } 14 | -------------------------------------------------------------------------------- /packages/form/src/theme/panel.scss: -------------------------------------------------------------------------------- 1 | .m-form-panel { 2 | .el-card__header { 3 | &:hover { 4 | background: #f2f6fc; 5 | } 6 | a { 7 | color: #409eff; 8 | } 9 | } 10 | 11 | .el-card__body { 12 | padding: 10px; 13 | } 14 | 15 | .m-form-tip { 16 | margin-left: 5px; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/schema/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": ".", 5 | "declaration": true, 6 | "declarationDir": "types", 7 | "forceConsistentCasingInFileNames": true, 8 | "paths": {}, 9 | }, 10 | "include": [ 11 | "src" 12 | ], 13 | } 14 | -------------------------------------------------------------------------------- /packages/stage/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": ".", 5 | "declaration": true, 6 | "declarationDir": "types", 7 | "forceConsistentCasingInFileNames": true, 8 | "paths": {}, 9 | }, 10 | "include": [ 11 | "src" 12 | ], 13 | } 14 | -------------------------------------------------------------------------------- /packages/table/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": ".", 5 | "declaration": true, 6 | "declarationDir": "types", 7 | "forceConsistentCasingInFileNames": true, 8 | "paths": {}, 9 | }, 10 | "include": [ 11 | "src" 12 | ], 13 | } 14 | -------------------------------------------------------------------------------- /packages/utils/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": ".", 5 | "declaration": true, 6 | "declarationDir": "types", 7 | "forceConsistentCasingInFileNames": true, 8 | "paths": {}, 9 | }, 10 | "include": [ 11 | "src" 12 | ], 13 | } 14 | -------------------------------------------------------------------------------- /magic-admin/server/static/vue3/runtime/playground/assets/plugin-entry-legacy.7d9da6d6.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"plugin-entry-legacy.7d9da6d6.js","sources":["../../../../.tmagic/plugin-entry.ts"],"sourcesContent":["const plugins: Record = {};\nexport default plugins;"],"names":["exports"],"mappings":"uEAAqCA,EAAA,UAAA,CAAA"} -------------------------------------------------------------------------------- /playground/src/App.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | 11 | 21 | -------------------------------------------------------------------------------- /packages/stage/src/style.css: -------------------------------------------------------------------------------- 1 | .tmagic-stage-container-highlight::after { 2 | content: ''; 3 | position: absolute; 4 | width: 100%; 5 | height: 100%; 6 | top: 0; 7 | left: 0; 8 | background-color: #000; 9 | opacity: .1; 10 | pointer-events: none; 11 | } 12 | 13 | .magic-ui-container.magic-layout-relative { 14 | min-height: 50px; 15 | } 16 | -------------------------------------------------------------------------------- /docs/src/api/form-config/fields/color-picker.md: -------------------------------------------------------------------------------- 1 | # ColorPicker 颜色选择器 2 | 3 | 用于颜色选择,支持多种格式。 4 | 5 | ## 基础用法 6 | 7 | 12 | 17 | 18 | -------------------------------------------------------------------------------- /packages/cli/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | lib 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | pnpm-debug.log* 14 | 15 | # Editor directories and files 16 | .idea 17 | .vscode 18 | *.suo 19 | *.ntvs* 20 | *.njsproj 21 | *.sln 22 | *.sw? 23 | 24 | coverage 25 | -------------------------------------------------------------------------------- /magic-admin/web/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | pnpm-debug.log* 14 | 15 | # Editor directories and files 16 | .idea 17 | *.suo 18 | *.ntvs* 19 | *.njsproj 20 | *.sln 21 | *.sw? 22 | .vscode 23 | 24 | # test coverage 25 | coverage 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | dist 4 | types 5 | 6 | .temp 7 | .cache 8 | 9 | # local env files 10 | .env.local 11 | .env.*.local 12 | 13 | # Log files 14 | npm-debug.log* 15 | yarn-debug.log* 16 | yarn-error.log* 17 | pnpm-debug.log* 18 | 19 | # Editor directories and files 20 | .idea 21 | .vscode 22 | *.suo 23 | *.ntvs* 24 | *.njsproj 25 | *.sln 26 | *.sw? 27 | 28 | coverage 29 | -------------------------------------------------------------------------------- /packages/editor/src/theme/common/var.scss: -------------------------------------------------------------------------------- 1 | $--theme-color: #2882e0; 2 | 3 | $--font-color: #070303; 4 | $--border-color: #d9dbdd; 5 | $--hover-color: #f3f5f9; 6 | 7 | $--nav-height: 35px; 8 | $--nav-color: #070303; 9 | $--nav--background-color: #ffffff; 10 | 11 | $--sidebar-heder-background-color: $--theme-color; 12 | $--sidebar-content-background-color: #ffffff; 13 | 14 | $--page-bar-height: 32px; 15 | -------------------------------------------------------------------------------- /packages/ui-react/src/overlay/event.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | methods: [ 3 | { 4 | label: '打开蒙层', 5 | value: 'openOverlay', 6 | }, 7 | { 8 | label: '关闭蒙层', 9 | value: 'closeOverlay', 10 | }, 11 | ], 12 | events: [ 13 | { 14 | label: '打开蒙层', 15 | value: 'overlay:open', 16 | }, 17 | { 18 | label: '关闭蒙层', 19 | value: 'overlay:close', 20 | }, 21 | ], 22 | }; 23 | -------------------------------------------------------------------------------- /packages/ui/src/overlay/src/event.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | methods: [ 3 | { 4 | label: '打开蒙层', 5 | value: 'openOverlay', 6 | }, 7 | { 8 | label: '关闭蒙层', 9 | value: 'closeOverlay', 10 | }, 11 | ], 12 | events: [ 13 | { 14 | label: '打开蒙层', 15 | value: 'overlay:open', 16 | }, 17 | { 18 | label: '关闭蒙层', 19 | value: 'overlay:close', 20 | }, 21 | ], 22 | }; 23 | -------------------------------------------------------------------------------- /packages/ui-vue2/src/overlay/src/event.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | methods: [ 3 | { 4 | label: '打开蒙层', 5 | value: 'openOverlay', 6 | }, 7 | { 8 | label: '关闭蒙层', 9 | value: 'closeOverlay', 10 | }, 11 | ], 12 | events: [ 13 | { 14 | label: '打开蒙层', 15 | value: 'overlay:open', 16 | }, 17 | { 18 | label: '关闭蒙层', 19 | value: 'overlay:close', 20 | }, 21 | ], 22 | }; 23 | -------------------------------------------------------------------------------- /playground/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Magic Editor Playground 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /packages/ui/.npmignore: -------------------------------------------------------------------------------- 1 | .babelrc 2 | .eslintrc 3 | .editorconfig 4 | node_modules 5 | .DS_Store 6 | examples 7 | tests 8 | .code.yml 9 | reports 10 | tsconfig.json 11 | vite.config.ts 12 | 13 | # local env files 14 | .env.local 15 | .env.*.local 16 | 17 | # Log files 18 | npm-debug.log* 19 | pnpm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | 23 | # Editor directories and files 24 | .idea 25 | .vscode 26 | *.suo 27 | *.ntvs* 28 | *.njsproj 29 | *.sln 30 | *.sw? 31 | -------------------------------------------------------------------------------- /magic-admin/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "magic-admin", 3 | "version": "1.0.0", 4 | "description": "Magic Admin 可视化搭建平台管理端。magic-admin 为独立项目目录,分为 web 端和 server 端,请按照下面指引操作", 5 | "main": "index.js", 6 | "scripts": { 7 | "admin:run": "chmod u+x setup.sh && ./setup.sh", 8 | "init": "npm run web:install && npm run server:install", 9 | "web:install": "cd web && npm install", 10 | "server:install": "cd server && npm install" 11 | }, 12 | "author": "" 13 | } 14 | -------------------------------------------------------------------------------- /packages/editor/.npmignore: -------------------------------------------------------------------------------- 1 | .babelrc 2 | .eslintrc 3 | .editorconfig 4 | node_modules 5 | .DS_Store 6 | examples 7 | tests 8 | .code.yml 9 | reports 10 | tsconfig.json 11 | vite.config.ts 12 | 13 | # local env files 14 | .env.local 15 | .env.*.local 16 | 17 | # Log files 18 | npm-debug.log* 19 | pnpm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | 23 | # Editor directories and files 24 | .idea 25 | .vscode 26 | *.suo 27 | *.ntvs* 28 | *.njsproj 29 | *.sln 30 | *.sw? 31 | -------------------------------------------------------------------------------- /packages/form/.npmignore: -------------------------------------------------------------------------------- 1 | .babelrc 2 | .eslintrc 3 | .editorconfig 4 | node_modules 5 | .DS_Store 6 | examples 7 | tests 8 | .code.yml 9 | reports 10 | tsconfig.json 11 | vite.config.ts 12 | 13 | # local env files 14 | .env.local 15 | .env.*.local 16 | 17 | # Log files 18 | npm-debug.log* 19 | pnpm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | 23 | # Editor directories and files 24 | .idea 25 | .vscode 26 | *.suo 27 | *.ntvs* 28 | *.njsproj 29 | *.sln 30 | *.sw? 31 | -------------------------------------------------------------------------------- /packages/stage/.npmignore: -------------------------------------------------------------------------------- 1 | .babelrc 2 | .eslintrc 3 | .editorconfig 4 | node_modules 5 | .DS_Store 6 | examples 7 | tests 8 | .code.yml 9 | reports 10 | tsconfig.json 11 | vite.config.ts 12 | 13 | # local env files 14 | .env.local 15 | .env.*.local 16 | 17 | # Log files 18 | npm-debug.log* 19 | pnpm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | 23 | # Editor directories and files 24 | .idea 25 | .vscode 26 | *.suo 27 | *.ntvs* 28 | *.njsproj 29 | *.sln 30 | *.sw? 31 | -------------------------------------------------------------------------------- /packages/table/.npmignore: -------------------------------------------------------------------------------- 1 | .babelrc 2 | .eslintrc 3 | .editorconfig 4 | node_modules 5 | .DS_Store 6 | examples 7 | tests 8 | .code.yml 9 | reports 10 | tsconfig.json 11 | vite.config.ts 12 | 13 | # local env files 14 | .env.local 15 | .env.*.local 16 | 17 | # Log files 18 | npm-debug.log* 19 | pnpm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | 23 | # Editor directories and files 24 | .idea 25 | .vscode 26 | *.suo 27 | *.ntvs* 28 | *.njsproj 29 | *.sln 30 | *.sw? 31 | -------------------------------------------------------------------------------- /packages/ui-react/.npmignore: -------------------------------------------------------------------------------- 1 | .babelrc 2 | .eslintrc 3 | .editorconfig 4 | node_modules 5 | .DS_Store 6 | examples 7 | tests 8 | .code.yml 9 | reports 10 | tsconfig.json 11 | vite.config.ts 12 | 13 | # local env files 14 | .env.local 15 | .env.*.local 16 | 17 | # Log files 18 | npm-debug.log* 19 | pnpm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | 23 | # Editor directories and files 24 | .idea 25 | .vscode 26 | *.suo 27 | *.ntvs* 28 | *.njsproj 29 | *.sln 30 | *.sw? 31 | -------------------------------------------------------------------------------- /packages/ui-vue2/.npmignore: -------------------------------------------------------------------------------- 1 | .babelrc 2 | .eslintrc 3 | .editorconfig 4 | node_modules 5 | .DS_Store 6 | examples 7 | tests 8 | .code.yml 9 | reports 10 | tsconfig.json 11 | vite.config.ts 12 | 13 | # local env files 14 | .env.local 15 | .env.*.local 16 | 17 | # Log files 18 | npm-debug.log* 19 | pnpm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | 23 | # Editor directories and files 24 | .idea 25 | .vscode 26 | *.suo 27 | *.ntvs* 28 | *.njsproj 29 | *.sln 30 | *.sw? 31 | -------------------------------------------------------------------------------- /packages/utils/.npmignore: -------------------------------------------------------------------------------- 1 | .babelrc 2 | .eslintrc 3 | .editorconfig 4 | node_modules 5 | .DS_Store 6 | examples 7 | tests 8 | .code.yml 9 | reports 10 | tsconfig.json 11 | vite.config.ts 12 | 13 | # local env files 14 | .env.local 15 | .env.*.local 16 | 17 | # Log files 18 | npm-debug.log* 19 | pnpm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | 23 | # Editor directories and files 24 | .idea 25 | .vscode 26 | *.suo 27 | *.ntvs* 28 | *.njsproj 29 | *.sln 30 | *.sw? 31 | -------------------------------------------------------------------------------- /packages/form/src/fields/SelectOptions.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 19 | -------------------------------------------------------------------------------- /packages/form/src/fields/Hidden.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 20 | -------------------------------------------------------------------------------- /packages/form/src/theme/group-list.scss: -------------------------------------------------------------------------------- 1 | .m-fields-group-list { 2 | .el-button--text { 3 | padding: 0; 4 | margin-bottom: 7px; 5 | } 6 | 7 | .el-tree-node__expand-icon { 8 | padding: 0; 9 | margin-bottom: 7px; 10 | &.expand { 11 | transform: rotate(90deg); 12 | } 13 | } 14 | 15 | .m-fields-group-list-item { 16 | border-bottom: 1px solid #ebeef5; 17 | margin-bottom: 7px; 18 | 19 | &:last-of-type { 20 | border-bottom: 0; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/editor/src/theme/theme.scss: -------------------------------------------------------------------------------- 1 | @import "./nav-menu.scss"; 2 | @import "./framework.scss"; 3 | @import "./sidebar.scss"; 4 | @import "./layer-panel.scss"; 5 | @import "./component-list-panel.scss"; 6 | @import "./resizer.scss"; 7 | @import "./workspace.scss"; 8 | @import "./page-bar.scss"; 9 | @import "./props-panel.scss"; 10 | @import "./content-menu.scss"; 11 | @import "./stage.scss"; 12 | @import "./code-editor.scss"; 13 | @import "./icon.scss"; 14 | @import "./code-block.scss"; 15 | @import "./layout.scss"; 16 | -------------------------------------------------------------------------------- /magic-admin/web/index_index.html: -------------------------------------------------------------------------------- 1 | # magic-admin 2 | 3 | ## Project setup 4 | ``` 5 | npm install 6 | ``` 7 | 8 | ### Compiles and hot-reloads for development 9 | ``` 10 | npm run serve 11 | ``` 12 | 13 | ### Compiles and minifies for production 14 | ``` 15 | npm run build 16 | ``` 17 | 18 | ### Run your unit tests 19 | ``` 20 | npm run test:unit 21 | ``` 22 | 23 | ### Lints and fixes files 24 | ``` 25 | npm run lint 26 | ``` 27 | 28 | ### Customize configuration 29 | See [Configuration Reference](https://cli.vuejs.org/config/). 30 | -------------------------------------------------------------------------------- /runtime/vue2/page/App.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 23 | -------------------------------------------------------------------------------- /runtime/vue3/page/App.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 23 | -------------------------------------------------------------------------------- /magic-admin/web/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 魔方 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /docs/src/README.md: -------------------------------------------------------------------------------- 1 | --- 2 | home: true 3 | heroImage: ./favicon.png 4 | heroText: tmagic-editor页面可视化平台 5 | tagline: null 6 | 7 | features: 8 | - title: 所见即所得 9 | details: 体验友好的拖拽编辑方式。 10 | - title: 丰富的拓展能力 11 | details: 支持业务方自定义组件、插件。 12 | - title: 支持多种布局方式 13 | details: tmagic-editor的容器概念,支持配置项目时,自由组合嵌套业务组件,提供超强的组件布局方式。 14 | - title: 强大的配置 15 | details: 支持表单联动等配置能力。 16 | - title: 组件联动 17 | details: 支持组件通信、组件联动,允许页面内各组件提供丰富配置能力。 18 | - title: 低代码 19 | details: 支持在平台写入代码,修改页面样式属性等,提供除组件外的高级编码能力。 20 | 21 | footer: Powered by 腾讯视频会员平台技术中心 22 | --- 23 | -------------------------------------------------------------------------------- /packages/editor/src/theme/stage.scss: -------------------------------------------------------------------------------- 1 | .m-editor-stage { 2 | position: relative; 3 | width: 100%; 4 | height: calc(100% - #{$--page-bar-height}); 5 | overflow: hidden; 6 | display: flex; 7 | justify-content: center; 8 | align-items: center; 9 | } 10 | 11 | .m-editor-stage-container { 12 | width: 100%; 13 | height: 100%; 14 | z-index: 0; 15 | position: relative; 16 | transition: transform 0.3s; 17 | box-sizing: content-box; 18 | box-shadow: rgba(0, 0, 0, 0.04) 0px 3px 5px; 19 | 20 | &::-webkit-scrollbar { 21 | width: 0 !important; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/editor/src/theme/props-panel.scss: -------------------------------------------------------------------------------- 1 | .m-editor-props-panel { 2 | padding: 0 10px; 3 | 4 | &.small { 5 | .el-form-item__label { 6 | font-size: 12px; 7 | } 8 | 9 | .m-fieldset { 10 | legend { 11 | font-size: 12px; 12 | } 13 | } 14 | 15 | .el-tabs__item { 16 | font-size: 12px; 17 | } 18 | } 19 | 20 | .el-input__wrapper { 21 | border-radius: 0; 22 | } 23 | } 24 | 25 | .m-editor-props-panel-popper { 26 | &.small { 27 | span, 28 | a, 29 | p { 30 | font-size: 12px; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /packages/form/src/theme/tabs.scss: -------------------------------------------------------------------------------- 1 | .magic-form-dynamic-tab { 2 | .el-tabs__header.is-top { 3 | display: flex; 4 | flex-direction: row-reverse; 5 | padding-right: 8px; 6 | .el-tabs__new-tab { 7 | margin-right: auto; 8 | min-width: 36px; 9 | outline: none; 10 | border-color: #409eff; 11 | color: #409eff; 12 | width: 36px; 13 | &::before { 14 | content: "添加"; 15 | } 16 | .el-icon-plus { 17 | display: none; 18 | } 19 | } 20 | } 21 | } 22 | 23 | .magic-form-tab { 24 | margin-bottom: 10px; 25 | } 26 | -------------------------------------------------------------------------------- /packages/form/src/fields/SelectOptionGroups.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 21 | -------------------------------------------------------------------------------- /packages/form/src/theme/fieldset.scss: -------------------------------------------------------------------------------- 1 | fieldset.m-fieldset { 2 | position: relative; 3 | border: 1px solid rgb(229, 229, 229); 4 | margin-top: 10px; 5 | margin-bottom: 10px; 6 | min-inline-size: auto; 7 | 8 | .el-checkbox { 9 | height: 22px; 10 | } 11 | 12 | legend { 13 | font-size: 14px; 14 | position: absolute; 15 | border: 0; 16 | top: -10px; 17 | left: 20px; 18 | background: rgb(255, 255, 255); 19 | width: auto; 20 | padding: 0px 3px; 21 | font-weight: bold; 22 | line-height: 20px; 23 | } 24 | 25 | .m-form-tip { 26 | margin-left: 5px; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/form/src/fields/Display.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 25 | -------------------------------------------------------------------------------- /packages/editor/src/components/Icon.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 18 | -------------------------------------------------------------------------------- /packages/ui-vue2/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.2.0-beta.2", 3 | "name": "@tmagic/ui-vue2", 4 | "main": "src/index.ts", 5 | "engines": { 6 | "node": ">=14" 7 | }, 8 | "repository": { 9 | "type": "git", 10 | "url": "https://github.com/Tencent/tmagic-editor.git" 11 | }, 12 | "dependencies": { 13 | "@tmagic/core": "1.2.0-beta.2", 14 | "@tmagic/schema": "1.2.0-beta.2", 15 | "@tmagic/utils": "1.2.0-beta.2", 16 | "qrcode": "^1.5.0", 17 | "vue": "^2.7.4" 18 | }, 19 | "peerDependencies": { 20 | "vue": "^2.7.4" 21 | }, 22 | "devDependencies": { 23 | "vite": "^3.1.3", 24 | "vue-template-compiler": "^2.7.4" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /packages/cli/src/utils/allowTs.ts: -------------------------------------------------------------------------------- 1 | import { transformSync } from 'esbuild'; 2 | import fs from 'fs-extra'; 3 | 4 | /** 5 | * Transform a ts file to cjs code 6 | */ 7 | export const transformTsFileToCodeSync = (filename: string): string => 8 | transformSync(fs.readFileSync(filename).toString(), { 9 | format: 'cjs', 10 | loader: 'ts', 11 | sourcefile: filename, 12 | sourcemap: 'inline', 13 | target: 'node14', 14 | }).code; 15 | 16 | /** 17 | * Globally allow ts files to be loaded via `require()` 18 | */ 19 | export const allowTs = (): void => { 20 | require.extensions['.ts'] = (m: any, filename) => { 21 | m._compile(transformTsFileToCodeSync(filename), filename); 22 | }; 23 | }; 24 | -------------------------------------------------------------------------------- /packages/ui-vue2/src/img/src/index.vue: -------------------------------------------------------------------------------- 1 | 4 | 31 | -------------------------------------------------------------------------------- /packages/ui-react/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "lib": ["DOM", "DOM.Iterable", "ESNext"], 5 | "allowJs": false, 6 | "skipLibCheck": false, 7 | "esModuleInterop": false, 8 | "allowSyntheticDefaultImports": true, 9 | "strict": true, 10 | "forceConsistentCasingInFileNames": true, 11 | "module": "ESNext", 12 | "moduleResolution": "Node", 13 | "resolveJsonModule": true, 14 | "isolatedModules": true, 15 | "noEmit": true, 16 | "jsx": "react", 17 | "baseUrl": ".", 18 | "paths": { 19 | // 内部模块都指向 src/index.ts, 会有更好的代码跳转体验. 20 | "@tmagic/*": ["../packages/*"], 21 | }, 22 | }, 23 | "include": ["./src"] 24 | } 25 | -------------------------------------------------------------------------------- /packages/ui-react/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@tmagic/ui-react", 3 | "version": "1.2.0-beta.2", 4 | "main": "src/index.ts", 5 | "engines": { 6 | "node": ">=14" 7 | }, 8 | "repository": { 9 | "type": "git", 10 | "url": "https://github.com/Tencent/tmagic-editor.git" 11 | }, 12 | "scripts": { 13 | "react:build": "tsc && vite build" 14 | }, 15 | "dependencies": { 16 | "@tmagic/core": "1.2.0-beta.2", 17 | "@tmagic/schema": "1.2.0-beta.2", 18 | "qrcode": "^1.5.0", 19 | "react": "^17.0.0", 20 | "react-dom": "^17.0.0" 21 | }, 22 | "devDependencies": { 23 | "@types/react": "^17.0.37", 24 | "@types/react-dom": "^17.0.11", 25 | "typescript": "^4.7.4" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /runtime/react/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "lib": ["DOM", "DOM.Iterable", "ESNext"], 5 | "allowJs": false, 6 | "skipLibCheck": false, 7 | "esModuleInterop": false, 8 | "allowSyntheticDefaultImports": true, 9 | "strict": true, 10 | "forceConsistentCasingInFileNames": true, 11 | "module": "ESNext", 12 | "moduleResolution": "Node", 13 | "resolveJsonModule": true, 14 | "isolatedModules": true, 15 | "noEmit": true, 16 | "jsx": "react", 17 | "baseUrl": ".", 18 | "paths": { 19 | // 内部模块都指向 src/index.ts, 会有更好的代码跳转体验. 20 | "@tmagic/*": ["../packages/*"], 21 | }, 22 | }, 23 | "include": ["./page", "./playground"] 24 | } 25 | -------------------------------------------------------------------------------- /packages/editor/src/theme/ruler.scss: -------------------------------------------------------------------------------- 1 | #ruler-container { 2 | width: calc(100% + 40px); 3 | position: absolute; 4 | top: -40px; 5 | left: -40px; 6 | height: 40px; 7 | z-index: 100000; 8 | 9 | .moveable-line { 10 | display: none; 11 | } 12 | 13 | .moveable-control.moveable-origin { 14 | display: none; 15 | } 16 | } 17 | 18 | #ruler-container::after { 19 | content: ""; 20 | position: absolute; 21 | left: 100%; 22 | top: 0; 23 | width: calc(2000px - 100%); 24 | height: 100%; 25 | background-color: white; 26 | } 27 | 28 | #horizontal { 29 | width: 2000px; 30 | max-width: fit-content; 31 | } 32 | 33 | #vertical { 34 | position: absolute; 35 | height: 1000px; 36 | top: 0; 37 | left: 0; 38 | } 39 | -------------------------------------------------------------------------------- /packages/editor/src/layouts/Resizer.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 33 | -------------------------------------------------------------------------------- /docs/src/api/form-config/fields/hidden.md: -------------------------------------------------------------------------------- 1 | # Hidden 隐藏域 2 | 3 | 改值体现于最终提交的表单中,用于例如编辑记录的id这种场景中 4 | 5 | ## TS 定义 6 | 7 | ```typescript 8 | interface Hidden extends FormItem { 9 | type: 'hidden'; 10 | } 11 | ``` 12 | 13 | 点击查看[FormItem](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts)的定义 14 | 15 | ## 基础用法 16 | 17 | 21 | 26 | 27 | 28 | 29 | ## Input Attributes 30 | | 参数 | 说明 | 类型 | 可选值 | 默认值 | 31 | |---------- |-------- |---------- |------------- |-------- | 32 | | name | 绑定值 | string | — | — | 33 | -------------------------------------------------------------------------------- /packages/form/src/theme/form.scss: -------------------------------------------------------------------------------- 1 | .fade-enter-active, 2 | .fade-leave-active { 3 | transition: opacity 0.5s; 4 | } 5 | 6 | .fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ { 7 | opacity: 0; 8 | } 9 | 10 | .m-form { 11 | .m-form-tip { 12 | color: rgba(0, 0, 0, 0.45); 13 | font-size: 12px; 14 | transition: color 0.3s cubic-bezier(0.215, 0.61, 0.355, 1); 15 | } 16 | 17 | .m-form-schematic { 18 | max-width: 50%; 19 | height: 100%; 20 | } 21 | 22 | .el-table { 23 | .cell > div.m-form-container { 24 | display: block; 25 | } 26 | } 27 | 28 | .el-tabs { 29 | margin-bottom: 10px; 30 | } 31 | 32 | .el-form-item.hidden { 33 | .el-form-item__label { 34 | display: none; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /packages/ui/src/img/src/index.vue: -------------------------------------------------------------------------------- 1 | 4 | 33 | -------------------------------------------------------------------------------- /packages/form/src/fields/ColorPicker.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 32 | -------------------------------------------------------------------------------- /packages/ui/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.2.0-beta.2", 3 | "name": "@tmagic/ui", 4 | "main": "src/index.ts", 5 | "engines": { 6 | "node": ">=14" 7 | }, 8 | "license": "Apache-2.0", 9 | "repository": { 10 | "type": "git", 11 | "url": "https://github.com/Tencent/tmagic-editor.git" 12 | }, 13 | "dependencies": { 14 | "@tmagic/core": "1.2.0-beta.2", 15 | "@tmagic/schema": "1.2.0-beta.2", 16 | "@tmagic/utils": "1.2.0-beta.2", 17 | "delegate": "^3.2.0", 18 | "qrcode": "^1.5.0", 19 | "tiny-emitter": "^2.1.0", 20 | "vue": "^3.2.37" 21 | }, 22 | "peerDependencies": { 23 | "vue": "^3.2.37" 24 | }, 25 | "devDependencies": { 26 | "@testing-library/vue": "^6.4.2", 27 | "@types/qrcode": "^1.4.2", 28 | "@vue/compiler-sfc": "^3.2.37", 29 | "@vue/test-utils": "^2.0.0" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /runtime/vue2/page/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Vue2 Page 8 | 26 | 27 | 28 | 29 |
30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /docs/src/api/form-config/relate.md: -------------------------------------------------------------------------------- 1 | # 联动 2 | 3 | ## 显隐 4 | 5 | 14 | 15 | ## 输入关联 16 | 17 | 37 | 38 | -------------------------------------------------------------------------------- /runtime/react/page/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | React Page 9 | 27 | 28 | 29 |
30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /docs/src/api/form-config/fields/display.md: -------------------------------------------------------------------------------- 1 | 2 | # Display 只读文本 3 | 4 | 用于显示,不可编辑 5 | 6 | ## TS 定义 7 | 8 | ```typescript 9 | interface Display extends FormItem { 10 | type: 'display'; 11 | } 12 | ``` 13 | 14 | 点击查看[FormItem](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts)的定义 15 | 16 | ## 基础用法 17 | 18 | 24 | 29 | 30 | 31 | 32 | ## Input Attributes 33 | | 参数 | 说明 | 类型 | 可选值 | 默认值 | 34 | |---------- |-------- |---------- |------------- |-------- | 35 | | name | 绑定值 | string | — | — | 36 | | text | 表单标签 | string | — | — | 37 | -------------------------------------------------------------------------------- /packages/ui-react/src/overlay/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 | -------------------------------------------------------------------------------- /runtime/vue3/page/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Vue3 Page 8 | 26 | 27 | 28 | 29 |
30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /packages/cli/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.2.0-beta.2", 3 | "name": "@tmagic/cli", 4 | "main": "lib/index.js", 5 | "types": "lib/index.d.ts", 6 | "license": "Apache-2.0", 7 | "scripts": { 8 | "build": "tsc -b tsconfig.build.json", 9 | "clean": "rimraf lib *.tsbuildinfo" 10 | }, 11 | "bin": { 12 | "tmagic": "bin/tmagic.js" 13 | }, 14 | "files": [ 15 | "bin", 16 | "lib" 17 | ], 18 | "engines": { 19 | "node": ">=14" 20 | }, 21 | "repository": { 22 | "type": "git", 23 | "url": "https://github.com/Tencent/tmagic-editor.git" 24 | }, 25 | "dependencies": { 26 | "cac": "^6.7.12", 27 | "chalk": "^4.1.0", 28 | "chokidar": "^3.5.3", 29 | "esbuild": "^0.15.5", 30 | "fs-extra": "^10.1.0", 31 | "recast": "^0.21.1", 32 | "tslib": "^2.4.0" 33 | }, 34 | "devDependencies": { 35 | "@types/fs-extra": "^9.0.13" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /packages/editor/src/fields/Code.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 35 | -------------------------------------------------------------------------------- /magic-admin/server/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "module": "commonjs", 5 | "jsx": "preserve", 6 | "importHelpers": true, 7 | "moduleResolution": "node", 8 | "experimentalDecorators": true, 9 | "emitDecoratorMetadata": true, 10 | "skipLibCheck": true, 11 | "esModuleInterop": true, 12 | "resolveJsonModule": true, 13 | "allowSyntheticDefaultImports": true, 14 | "sourceMap": true, 15 | "baseUrl": ".", 16 | "outDir": "./dist", 17 | "lib": [ 18 | "esnext", 19 | "dom", 20 | "dom.iterable", 21 | "scripthost" 22 | ], 23 | "paths": { 24 | "@src/*": [ 25 | "src/*" 26 | ], 27 | "@tests/*": [ 28 | "tests/*" 29 | ] 30 | }, 31 | "noEmitOnError": true 32 | }, 33 | "includes": ["src/**/*.ts"], 34 | "exclude": ["node_modules","tests","coverage"], 35 | } 36 | -------------------------------------------------------------------------------- /playground/src/components/NavMenu.vue: -------------------------------------------------------------------------------- 1 | 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 | 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 | 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 | 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 | 13 | 14 | 36 | -------------------------------------------------------------------------------- /packages/ui-vue2/src/qrcode/src/index.vue: -------------------------------------------------------------------------------- 1 | 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 | 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 | 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 | 17 | 18 | 19 | ## 禁用状态 20 | 21 | 27 | 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 | 13 | 14 | 47 | -------------------------------------------------------------------------------- /packages/editor/tests/unit/services/props.spec.ts: -------------------------------------------------------------------------------- 1 | import { describe, expect, test } from 'vitest'; 2 | 3 | import { NodeType } from '@tmagic/schema'; 4 | 5 | import props from '@editor/services/props'; 6 | 7 | test('createId', async () => { 8 | const id = await props.createId('text'); 9 | 10 | expect(id.startsWith('text')).toBeTruthy(); 11 | }); 12 | 13 | describe('setNewItemId', () => { 14 | test('普通', async () => { 15 | const config = { 16 | id: 1, 17 | type: 'text', 18 | }; 19 | // 将组件与组件的子元素配置中的id都设置成一个新的ID 20 | await props.setNewItemId(config); 21 | expect(config.id === 1).toBeFalsy(); 22 | }); 23 | 24 | test('items', async () => { 25 | const config = { 26 | id: 1, 27 | type: NodeType.PAGE, 28 | items: [ 29 | { 30 | type: 'text', 31 | id: 2, 32 | }, 33 | ], 34 | }; 35 | await props.setNewItemId(config); 36 | expect(config.id === 1).toBeFalsy(); 37 | expect(config.items[0].id === 2).toBeFalsy(); 38 | }); 39 | }); 40 | 41 | test('getDefaultValue', async () => { 42 | const value = await props.getDefaultPropsValue('text'); 43 | expect(value.type).toBe('text'); 44 | }); 45 | -------------------------------------------------------------------------------- /runtime/vue2/playground/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Vue2 Playground 9 | 40 | 41 | 42 | 43 |
44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /packages/ui/src/page/src/index.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 47 | -------------------------------------------------------------------------------- /magic-admin/server/src/routers/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 | // 编辑器相关路由 20 | import Router from 'koa-router'; 21 | 22 | import editorController from '@src/controller/editor'; 23 | 24 | const router = new Router(); 25 | // 拉取编辑器左侧展示的组件列表 26 | router.get('/getComponentList', editorController.getComponentList); 27 | 28 | // 拉取活动配置的web插件 29 | router.get('/getWebPlugins', editorController.getWebPlugins); 30 | 31 | export default router; 32 | -------------------------------------------------------------------------------- /runtime/vue3/playground/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Vue3 Playground 9 | 40 | 41 | 42 | 43 |
44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /packages/stage/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 StageCore from './StageCore'; 20 | 21 | export type { MoveableOptions } from 'moveable'; 22 | export { default as StageRender } from './StageRender'; 23 | export { default as StageMask } from './StageMask'; 24 | export { default as StageDragResize } from './StageDragResize'; 25 | export * from './types'; 26 | export * from './const'; 27 | export * from './util'; 28 | export default StageCore; 29 | -------------------------------------------------------------------------------- /magic-admin/web/tests/unit/components/act-create-card.spec.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 { mount } from '@vue/test-utils'; 20 | 21 | import ActCreateCard from '@src/components/act-created-card.vue'; 22 | 23 | describe('ActCreateCard', () => { 24 | it('点击卡片按钮', async () => { 25 | const wrapper = mount(ActCreateCard); 26 | await wrapper.find('el-card').trigger('click'); 27 | expect(wrapper.emitted()).toHaveProperty('add'); 28 | }); 29 | }); 30 | -------------------------------------------------------------------------------- /packages/cli/src/cli.ts: -------------------------------------------------------------------------------- 1 | import { cac } from 'cac'; 2 | import chalk from 'chalk'; 3 | 4 | import { allowTs } from './utils/allowTs'; 5 | import { scripts } from './commands'; 6 | import { UserConfig } from './types'; 7 | 8 | /** 9 | * Wrap raw command to catch errors and exit process 10 | */ 11 | const wrapCommand = (cmd: (...args: any[]) => Promise): typeof cmd => { 12 | const wrappedCommand: typeof cmd = (...args) => 13 | cmd(...args).catch((err) => { 14 | console.error(chalk.red(err.stack)); 15 | process.exit(1); 16 | }); 17 | return wrappedCommand; 18 | }; 19 | 20 | /** 21 | * Vuepress cli 22 | */ 23 | export const cli = (defaultAppConfig: UserConfig): void => { 24 | // allow ts files globally 25 | allowTs(); 26 | 27 | // create cac instance 28 | const program = cac('tmagic'); 29 | 30 | // display core version and cli version 31 | const versionCli = require('../package.json').version; 32 | program.version(`tmagic/cli@${versionCli}`); 33 | 34 | // display help message 35 | program.help(); 36 | 37 | // register `dev` command 38 | program.command('entry', 'Start development server').action(wrapCommand(scripts(defaultAppConfig))); 39 | 40 | program.parse(process.argv); 41 | }; 42 | -------------------------------------------------------------------------------- /packages/form/src/fields/Date.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 48 | -------------------------------------------------------------------------------- /packages/table/src/PopoverColumn.vue: -------------------------------------------------------------------------------- 1 | 18 | 19 | 41 | -------------------------------------------------------------------------------- /packages/stage/src/logger.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 const log = (...args: any[]) => { 20 | console.log(...args); 21 | }; 22 | 23 | export const info = (...args: any[]) => { 24 | console.log(...args); 25 | }; 26 | 27 | export const warn = (...args: any[]) => { 28 | console.warn(...args); 29 | }; 30 | 31 | export const debug = (...args: any[]) => { 32 | console.debug(...args); 33 | }; 34 | 35 | export const error = (...args: any[]) => { 36 | console.error(...args); 37 | }; 38 | -------------------------------------------------------------------------------- /magic-admin/server/static/vue3/entry/event/index.umd.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : 3 | typeof define === 'function' && define.amd ? define(factory) : 4 | (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.magicPresetEvents = factory()); 5 | })(this, (function () { 'use strict'; 6 | 7 | const page = { 8 | methods: [ 9 | { 10 | label: "\u5237\u65B0\u9875\u9762", 11 | value: "refresh" 12 | } 13 | ] 14 | }; 15 | 16 | const overlay = { 17 | methods: [ 18 | { 19 | label: "\u6253\u5F00\u8499\u5C42", 20 | value: "openOverlay" 21 | }, 22 | { 23 | label: "\u5173\u95ED\u8499\u5C42", 24 | value: "closeOverlay" 25 | } 26 | ], 27 | events: [ 28 | { 29 | label: "\u6253\u5F00\u8499\u5C42", 30 | value: "overlay:open" 31 | }, 32 | { 33 | label: "\u5173\u95ED\u8499\u5C42", 34 | value: "overlay:close" 35 | } 36 | ] 37 | }; 38 | 39 | const events = { 40 | "page": page, 41 | "overlay": overlay 42 | }; 43 | 44 | return events; 45 | 46 | })); 47 | //# sourceMappingURL=index.umd.js.map 48 | -------------------------------------------------------------------------------- /packages/editor/src/theme/resizer.scss: -------------------------------------------------------------------------------- 1 | .m-editor-resizer { 2 | border-left: 1px solid transparent; 3 | border-right: 1px solid transparent; 4 | width: 8px; 5 | margin: 0 -5px; 6 | height: 100%; 7 | opacity: 0.9; 8 | background: padding-box #d8dee8; 9 | box-sizing: border-box; 10 | cursor: col-resize; 11 | z-index: 1; 12 | 13 | &:hover { 14 | border-color: #d8dee8; 15 | } 16 | 17 | .icon-container { 18 | visibility: hidden; 19 | opacity: 0; 20 | transition: opacity 0.4s; 21 | width: 20px; 22 | height: 120px; 23 | line-height: 120px; 24 | text-align: center; 25 | background: #d8dee8; 26 | position: absolute; 27 | top: 50%; 28 | left: 50%; 29 | transform: translate(-50%, -50%); 30 | cursor: pointer; 31 | &.position-left { 32 | transform: translate(calc(-100% - 4px), -50%); 33 | } 34 | &.position-right { 35 | transform: translate(calc(100% + 4px), -50%); 36 | } 37 | } 38 | .icon { 39 | color: #fff; 40 | font-size: 18px; 41 | } 42 | } 43 | 44 | .magic-editor-resizer:hover { 45 | .icon-container { 46 | visibility: visible; 47 | opacity: 1; 48 | } 49 | // border-left: 5px solid rgba(0,0,0,.5); 50 | // border-right: 5px solid rgba(0,0,0,.5); 51 | } 52 | -------------------------------------------------------------------------------- /.github/workflows/pages.yml: -------------------------------------------------------------------------------- 1 | name: pages 2 | 3 | on: 4 | push: 5 | branches: [master] 6 | workflow_dispatch: 7 | 8 | jobs: 9 | pages: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - uses: actions/checkout@v2 14 | with: 15 | fetch-depth: 0 16 | 17 | - name: Install pnpm 18 | uses: pnpm/action-setup@v2 19 | 20 | - name: Set node version to 16 21 | uses: actions/setup-node@v2 22 | with: 23 | node-version: 16 24 | cache: 'pnpm' 25 | 26 | - run: pnpm bootstrap 27 | 28 | - name: Build VuePress site 29 | run: npm run build:docs 30 | 31 | - name: Build Playground site 32 | run: npm run build:playground 33 | 34 | - name: clean dist 35 | run: rm -rf dist 36 | 37 | - name: mkdir dist 38 | run: mkdir dist && mkdir dist/docs && mkdir dist/playground 39 | 40 | - name: move to dist 41 | run: mv docs/dist/* dist/docs && mv playground/dist/* dist/playground 42 | 43 | - name: Deploy to GitHub Pages 44 | uses: crazy-max/ghaction-github-pages@v2 45 | with: 46 | target_branch: gh-pages 47 | build_dir: dist 48 | env: 49 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 50 | -------------------------------------------------------------------------------- /magic-admin/web/tests/unit/views/list-view.spec.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 { shallowMount } from '@vue/test-utils'; 20 | 21 | import ListView from '@src/views/list-view.vue'; 22 | 23 | describe('ListView', () => { 24 | it('基础', () => { 25 | shallowMount(ListView, { 26 | global: { 27 | mocks: { 28 | $route: { 29 | params: { 30 | type: 'all', 31 | }, 32 | }, 33 | }, 34 | }, 35 | }); 36 | }); 37 | }); 38 | -------------------------------------------------------------------------------- /packages/form/src/utils/fieldProps.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 { PropType } from 'vue'; 20 | 21 | export default { 22 | model: { 23 | type: Object, 24 | required: true, 25 | default: () => ({}), 26 | }, 27 | name: { 28 | type: String, 29 | default: '', 30 | }, 31 | disabled: { 32 | type: Boolean, 33 | default: false, 34 | }, 35 | size: String as PropType<'mini' | 'small' | 'medium'>, 36 | prop: String, 37 | initValues: Object, 38 | values: Object, 39 | }; 40 | -------------------------------------------------------------------------------- /packages/ui/src/Component.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 48 | -------------------------------------------------------------------------------- /playground/src/route.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 { createRouter, createWebHashHistory } from 'vue-router'; 20 | 21 | import Editor from './pages/Editor.vue'; 22 | import Form from './pages/Form.vue'; 23 | import Table from './pages/Table.vue'; 24 | 25 | const routes = [ 26 | { path: '/', component: Editor }, 27 | { path: '/form', component: Form }, 28 | { path: '/table', component: Table }, 29 | ]; 30 | 31 | export default createRouter({ 32 | history: createWebHashHistory(), 33 | routes, 34 | }); 35 | -------------------------------------------------------------------------------- /packages/form/src/fields/CheckboxGroup.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 45 | -------------------------------------------------------------------------------- /packages/ui/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 Button from './button'; 20 | import Container from './container'; 21 | import Img from './img'; 22 | import Overlay from './overlay'; 23 | import Page from './page'; 24 | import Qrcode from './qrcode'; 25 | import Text from './text'; 26 | 27 | const ui: Record = { 28 | page: Page, 29 | container: Container, 30 | button: Button, 31 | text: Text, 32 | img: Img, 33 | qrcode: Qrcode, 34 | overlay: Overlay, 35 | }; 36 | 37 | export default ui; 38 | -------------------------------------------------------------------------------- /packages/ui-vue2/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 Button from './button'; 20 | import Container from './container'; 21 | import Img from './img'; 22 | import Overlay from './overlay'; 23 | import Page from './page'; 24 | import Qrcode from './qrcode'; 25 | import Text from './text'; 26 | 27 | const ui: Record = { 28 | page: Page, 29 | container: Container, 30 | button: Button, 31 | text: Text, 32 | img: Img, 33 | qrcode: Qrcode, 34 | overlay: Overlay, 35 | }; 36 | 37 | export default ui; 38 | -------------------------------------------------------------------------------- /packages/form/tests/unit/utils/createForm.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 { FormConfig } from '@tmagic/form'; 22 | 23 | import createForm from '../../../src/utils/createForm'; 24 | 25 | describe('createForm', () => { 26 | test('正常创建', () => { 27 | const config: FormConfig = [{ type: 'time' }, { type: 'colorPicker' }]; 28 | expect(createForm(config)).toEqual(config); 29 | }); 30 | 31 | test('参数为空数组', () => { 32 | expect(createForm([])).toEqual([]); 33 | }); 34 | }); 35 | -------------------------------------------------------------------------------- /packages/cli/src/Core.ts: -------------------------------------------------------------------------------- 1 | import path from 'path'; 2 | 3 | import fs from 'fs-extra'; 4 | 5 | import { ModuleMainFilePath, UserConfig } from './types'; 6 | import { prepareEntryFile, resolveAppPackages } from './utils'; 7 | 8 | export default class Core { 9 | public version = require('../package.json').version; 10 | 11 | public options: UserConfig; 12 | 13 | public moduleMainFilePath: ModuleMainFilePath = { 14 | componentMap: {}, 15 | pluginMap: {}, 16 | configMap: {}, 17 | valueMap: {}, 18 | eventMap: {}, 19 | }; 20 | 21 | public dir = { 22 | temp: () => path.resolve(this.options.source, this.options.temp), 23 | }; 24 | 25 | constructor(options: UserConfig) { 26 | this.options = options; 27 | } 28 | 29 | public async writeTemp(file: string, content: string) { 30 | await fs.outputFile(path.resolve(this.dir.temp(), file), content); 31 | } 32 | 33 | public async init() { 34 | this.moduleMainFilePath = resolveAppPackages(this); 35 | if (typeof this.options.onInit === 'function') { 36 | this.moduleMainFilePath = await this.options.onInit(this); 37 | } 38 | } 39 | 40 | public async prepare() { 41 | await prepareEntryFile(this); 42 | 43 | if (typeof this.options.onPrepare === 'function') { 44 | this.options.onPrepare(this); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /playground/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tmagic-playground", 3 | "version": "1.2.0-beta.2", 4 | "private": true, 5 | "scripts": { 6 | "clean:top": "rimraf dist", 7 | "dev": "vite --mode vue3", 8 | "dev:vue2": "vite --mode vue2", 9 | "dev:react": "vite --mode react", 10 | "build": "npm run clean:top && node --max_old_space_size=8192 node_modules/vite/bin/vite.js build --mode vue3", 11 | "serve": "vite preview" 12 | }, 13 | "dependencies": { 14 | "@element-plus/icons-vue": "^2.0.9", 15 | "@tmagic/editor": "1.2.0-beta.2", 16 | "@tmagic/form": "1.2.0-beta.2", 17 | "@tmagic/schema": "1.2.0-beta.2", 18 | "@tmagic/stage": "1.2.0-beta.2", 19 | "@tmagic/utils": "1.2.0-beta.2", 20 | "element-plus": "^2.2.17", 21 | "monaco-editor": "^0.34.0", 22 | "serialize-javascript": "^6.0.0", 23 | "terser": "^5.14.2", 24 | "vue": "^3.2.37", 25 | "vue-router": "^4.0.10" 26 | }, 27 | "devDependencies": { 28 | "@types/node": "^15.12.4", 29 | "@types/serialize-javascript": "^5.0.1", 30 | "@vitejs/plugin-legacy": "^2.2.0", 31 | "@vitejs/plugin-vue": "^3.1.0", 32 | "@vitejs/plugin-vue-jsx": "^1.3.10", 33 | "@vue/compiler-sfc": "^3.2.37", 34 | "sass": "^1.35.1", 35 | "typescript": "^4.7.4", 36 | "vite": "^3.1.3", 37 | "vue-tsc": "^0.39.4" 38 | } 39 | } 40 | --------------------------------------------------------------------------------