mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-15 22:22:51 +00:00
feat:插件拆包
This commit is contained in:
parent
9df6769016
commit
e372689c18
@ -1,5 +1,6 @@
|
|||||||
body {
|
body {
|
||||||
font-family: PingFangSC-Regular, Roboto, Helvetica Neue, Helvetica, Tahoma, Arial, PingFang SC-Light, Microsoft YaHei;
|
font-family: PingFangSC-Regular, Roboto, Helvetica Neue, Helvetica, Tahoma,
|
||||||
|
Arial, PingFang SC-Light, Microsoft YaHei;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|||||||
47
packages/editor-skeleton/es/index.d.ts
vendored
47
packages/editor-skeleton/es/index.d.ts
vendored
@ -1,42 +1,5 @@
|
|||||||
import React, { PureComponent } from 'react';
|
import Skeleton from './skeleton';
|
||||||
import Editor from '@ali/lowcode-editor-framework';
|
import Panel from './components/Panel';
|
||||||
import { EditorConfig, Utils, PluginClassSet } from '@ali/lowcode-editor-framework/lib/definitions';
|
import TopIcon from './components/TopIcon';
|
||||||
import './global.scss';
|
export default Skeleton;
|
||||||
declare global {
|
export { Panel, TopIcon };
|
||||||
interface Window {
|
|
||||||
__ctx: {
|
|
||||||
editor: Editor;
|
|
||||||
appHelper: Editor;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export interface SkeletonProps {
|
|
||||||
components: PluginClassSet;
|
|
||||||
config: EditorConfig;
|
|
||||||
history: object;
|
|
||||||
location: object;
|
|
||||||
match: object;
|
|
||||||
utils: Utils;
|
|
||||||
}
|
|
||||||
export interface SkeletonState {
|
|
||||||
initReady?: boolean;
|
|
||||||
skeletonKey?: string;
|
|
||||||
__hasError?: boolean;
|
|
||||||
}
|
|
||||||
export declare class Skeleton extends PureComponent<SkeletonProps, SkeletonState> {
|
|
||||||
static displayName: string;
|
|
||||||
static getDerivedStateFromError(): SkeletonState;
|
|
||||||
private editor;
|
|
||||||
constructor(props: any);
|
|
||||||
componentWillUnmount(): void;
|
|
||||||
componentDidCatch(err: any): void;
|
|
||||||
init: (isReset?: boolean) => void;
|
|
||||||
render(): React.ReactNode;
|
|
||||||
}
|
|
||||||
export interface SkeletonWithRouterProps {
|
|
||||||
components: PluginClassSet;
|
|
||||||
config: EditorConfig;
|
|
||||||
utils: Utils;
|
|
||||||
}
|
|
||||||
declare const SkeletonWithRouter: React.FC<SkeletonWithRouterProps>;
|
|
||||||
export default SkeletonWithRouter;
|
|
||||||
|
|||||||
@ -1,158 +1,5 @@
|
|||||||
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
import Skeleton from './skeleton';
|
||||||
import _ConfigProvider from "@alifd/next/es/config-provider";
|
import Panel from './components/Panel';
|
||||||
import _Loading from "@alifd/next/es/loading";
|
import TopIcon from './components/TopIcon';
|
||||||
import _extends from "@babel/runtime/helpers/extends";
|
export default Skeleton;
|
||||||
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
export { Panel, TopIcon };
|
||||||
import React, { PureComponent } from 'react';
|
|
||||||
import { HashRouter as Router, Route } from 'react-router-dom';
|
|
||||||
import Editor, { utils } from '@ali/lowcode-editor-framework';
|
|
||||||
import defaultConfig from './config/skeleton';
|
|
||||||
import skeletonUtils from './config/utils';
|
|
||||||
import TopArea from './layouts/TopArea';
|
|
||||||
import LeftArea from './layouts/LeftArea';
|
|
||||||
import CenterArea from './layouts/CenterArea';
|
|
||||||
import RightArea from './layouts/RightArea';
|
|
||||||
import './global.scss';
|
|
||||||
var comboEditorConfig = utils.comboEditorConfig,
|
|
||||||
parseSearch = utils.parseSearch;
|
|
||||||
var renderIdx = 0;
|
|
||||||
export var Skeleton = /*#__PURE__*/function (_PureComponent) {
|
|
||||||
_inheritsLoose(Skeleton, _PureComponent);
|
|
||||||
|
|
||||||
Skeleton.getDerivedStateFromError = function getDerivedStateFromError() {
|
|
||||||
return {
|
|
||||||
__hasError: true
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
function Skeleton(props) {
|
|
||||||
var _this;
|
|
||||||
|
|
||||||
_this = _PureComponent.call(this, props) || this;
|
|
||||||
_this.editor = void 0;
|
|
||||||
|
|
||||||
_this.init = function (isReset) {
|
|
||||||
if (isReset === void 0) {
|
|
||||||
isReset = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_this.editor) {
|
|
||||||
_this.editor.destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
var _this$props = _this.props,
|
|
||||||
utils = _this$props.utils,
|
|
||||||
config = _this$props.config,
|
|
||||||
components = _this$props.components;
|
|
||||||
var editor = new Editor(comboEditorConfig(defaultConfig, config), components, _extends({}, skeletonUtils, {}, utils));
|
|
||||||
_this.editor = editor; // eslint-disable-next-line no-underscore-dangle
|
|
||||||
|
|
||||||
window.__ctx = {
|
|
||||||
editor: editor,
|
|
||||||
appHelper: editor
|
|
||||||
};
|
|
||||||
editor.once('editor.reset', function () {
|
|
||||||
_this.setState({
|
|
||||||
initReady: false
|
|
||||||
});
|
|
||||||
|
|
||||||
editor.emit('editor.beforeReset');
|
|
||||||
|
|
||||||
_this.init(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
_this.editor.init().then(function () {
|
|
||||||
_this.setState({
|
|
||||||
initReady: true,
|
|
||||||
// 刷新IDE时生成新的skeletonKey保证插件生命周期重新执行
|
|
||||||
skeletonKey: isReset ? "skeleton" + ++renderIdx : _this.state.skeletonKey
|
|
||||||
}, function () {
|
|
||||||
editor.emit('editor.ready');
|
|
||||||
editor.emit('ide.ready');
|
|
||||||
isReset && editor.emit('ide.afterReset');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
_this.state = {
|
|
||||||
initReady: false,
|
|
||||||
skeletonKey: "skeleton" + renderIdx
|
|
||||||
};
|
|
||||||
|
|
||||||
_this.init();
|
|
||||||
|
|
||||||
return _this;
|
|
||||||
}
|
|
||||||
|
|
||||||
var _proto = Skeleton.prototype;
|
|
||||||
|
|
||||||
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
||||||
this.editor && this.editor.destroy();
|
|
||||||
};
|
|
||||||
|
|
||||||
_proto.componentDidCatch = function componentDidCatch(err) {
|
|
||||||
console.error(err);
|
|
||||||
};
|
|
||||||
|
|
||||||
_proto.render = function render() {
|
|
||||||
var _this$state = this.state,
|
|
||||||
initReady = _this$state.initReady,
|
|
||||||
skeletonKey = _this$state.skeletonKey,
|
|
||||||
__hasError = _this$state.__hasError;
|
|
||||||
var _this$props2 = this.props,
|
|
||||||
location = _this$props2.location,
|
|
||||||
history = _this$props2.history,
|
|
||||||
match = _this$props2.match;
|
|
||||||
|
|
||||||
if (__hasError || !this.editor) {
|
|
||||||
return 'error';
|
|
||||||
}
|
|
||||||
|
|
||||||
location.query = parseSearch(location.search);
|
|
||||||
this.editor.set('location', location);
|
|
||||||
this.editor.set('history', history);
|
|
||||||
this.editor.set('match', match);
|
|
||||||
return React.createElement(_ConfigProvider, null, React.createElement(_Loading, {
|
|
||||||
tip: "Loading",
|
|
||||||
size: "large",
|
|
||||||
visible: !initReady,
|
|
||||||
fullScreen: true
|
|
||||||
}, React.createElement("div", {
|
|
||||||
className: "lowcode-editor",
|
|
||||||
key: skeletonKey
|
|
||||||
}, React.createElement(TopArea, {
|
|
||||||
editor: this.editor
|
|
||||||
}), React.createElement("div", {
|
|
||||||
className: "lowcode-main-content"
|
|
||||||
}, React.createElement(LeftArea.Nav, {
|
|
||||||
editor: this.editor
|
|
||||||
}), React.createElement(LeftArea.Panel, {
|
|
||||||
editor: this.editor
|
|
||||||
}), React.createElement(CenterArea, {
|
|
||||||
editor: this.editor
|
|
||||||
}), React.createElement(RightArea, {
|
|
||||||
editor: this.editor
|
|
||||||
})))));
|
|
||||||
};
|
|
||||||
|
|
||||||
return Skeleton;
|
|
||||||
}(PureComponent); // 通过React-Router包裹,支持编辑器内页面根据路由切换
|
|
||||||
|
|
||||||
Skeleton.displayName = 'LowcodeEditorSkeleton';
|
|
||||||
;
|
|
||||||
|
|
||||||
var SkeletonWithRouter = function SkeletonWithRouter(props) {
|
|
||||||
var config = props.config,
|
|
||||||
otherProps = _objectWithoutPropertiesLoose(props, ["config"]);
|
|
||||||
|
|
||||||
return React.createElement(Router, null, React.createElement(Route, {
|
|
||||||
path: "/*",
|
|
||||||
component: function component(routerProps) {
|
|
||||||
return React.createElement(Skeleton, _extends({}, routerProps, otherProps, config.skeleton && config.skeleton.props, {
|
|
||||||
config: config
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
};
|
|
||||||
|
|
||||||
export default SkeletonWithRouter;
|
|
||||||
42
packages/editor-skeleton/es/skeleton.d.ts
vendored
Normal file
42
packages/editor-skeleton/es/skeleton.d.ts
vendored
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
import React, { PureComponent } from 'react';
|
||||||
|
import Editor from '@ali/lowcode-editor-framework';
|
||||||
|
import { EditorConfig, Utils, PluginClassSet } from '@ali/lowcode-editor-framework/lib/definitions';
|
||||||
|
import './global.scss';
|
||||||
|
declare global {
|
||||||
|
interface Window {
|
||||||
|
__ctx: {
|
||||||
|
editor: Editor;
|
||||||
|
appHelper: Editor;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export interface SkeletonProps {
|
||||||
|
components: PluginClassSet;
|
||||||
|
config: EditorConfig;
|
||||||
|
history: object;
|
||||||
|
location: object;
|
||||||
|
match: object;
|
||||||
|
utils: Utils;
|
||||||
|
}
|
||||||
|
export interface SkeletonState {
|
||||||
|
initReady?: boolean;
|
||||||
|
skeletonKey?: string;
|
||||||
|
__hasError?: boolean;
|
||||||
|
}
|
||||||
|
export declare class Skeleton extends PureComponent<SkeletonProps, SkeletonState> {
|
||||||
|
static displayName: string;
|
||||||
|
static getDerivedStateFromError(): SkeletonState;
|
||||||
|
private editor;
|
||||||
|
constructor(props: any);
|
||||||
|
componentWillUnmount(): void;
|
||||||
|
componentDidCatch(err: any): void;
|
||||||
|
init: (isReset?: boolean) => void;
|
||||||
|
render(): React.ReactNode;
|
||||||
|
}
|
||||||
|
export interface SkeletonWithRouterProps {
|
||||||
|
components: PluginClassSet;
|
||||||
|
config: EditorConfig;
|
||||||
|
utils: Utils;
|
||||||
|
}
|
||||||
|
declare const SkeletonWithRouter: React.FC<SkeletonWithRouterProps>;
|
||||||
|
export default SkeletonWithRouter;
|
||||||
157
packages/editor-skeleton/es/skeleton.js
Normal file
157
packages/editor-skeleton/es/skeleton.js
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
||||||
|
import _ConfigProvider from "@alifd/next/es/config-provider";
|
||||||
|
import _Loading from "@alifd/next/es/loading";
|
||||||
|
import _extends from "@babel/runtime/helpers/extends";
|
||||||
|
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
||||||
|
import React, { PureComponent } from 'react';
|
||||||
|
import { HashRouter as Router, Route } from 'react-router-dom';
|
||||||
|
import Editor, { utils } from '@ali/lowcode-editor-framework';
|
||||||
|
import defaultConfig from './config/skeleton';
|
||||||
|
import skeletonUtils from './config/utils';
|
||||||
|
import TopArea from './layouts/TopArea';
|
||||||
|
import LeftArea from './layouts/LeftArea';
|
||||||
|
import CenterArea from './layouts/CenterArea';
|
||||||
|
import RightArea from './layouts/RightArea';
|
||||||
|
import './global.scss';
|
||||||
|
var comboEditorConfig = utils.comboEditorConfig,
|
||||||
|
parseSearch = utils.parseSearch;
|
||||||
|
var renderIdx = 0;
|
||||||
|
export var Skeleton = /*#__PURE__*/function (_PureComponent) {
|
||||||
|
_inheritsLoose(Skeleton, _PureComponent);
|
||||||
|
|
||||||
|
Skeleton.getDerivedStateFromError = function getDerivedStateFromError() {
|
||||||
|
return {
|
||||||
|
__hasError: true
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
function Skeleton(props) {
|
||||||
|
var _this;
|
||||||
|
|
||||||
|
_this = _PureComponent.call(this, props) || this;
|
||||||
|
_this.editor = void 0;
|
||||||
|
|
||||||
|
_this.init = function (isReset) {
|
||||||
|
if (isReset === void 0) {
|
||||||
|
isReset = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_this.editor) {
|
||||||
|
_this.editor.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
var _this$props = _this.props,
|
||||||
|
utils = _this$props.utils,
|
||||||
|
config = _this$props.config,
|
||||||
|
components = _this$props.components;
|
||||||
|
var editor = new Editor(comboEditorConfig(defaultConfig, config), components, _extends({}, skeletonUtils, {}, utils));
|
||||||
|
_this.editor = editor; // eslint-disable-next-line no-underscore-dangle
|
||||||
|
|
||||||
|
window.__ctx = {
|
||||||
|
editor: editor,
|
||||||
|
appHelper: editor
|
||||||
|
};
|
||||||
|
editor.once('editor.reset', function () {
|
||||||
|
_this.setState({
|
||||||
|
initReady: false
|
||||||
|
});
|
||||||
|
|
||||||
|
editor.emit('editor.beforeReset');
|
||||||
|
|
||||||
|
_this.init(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
_this.editor.init().then(function () {
|
||||||
|
_this.setState({
|
||||||
|
initReady: true,
|
||||||
|
// 刷新IDE时生成新的skeletonKey保证插件生命周期重新执行
|
||||||
|
skeletonKey: isReset ? "skeleton" + ++renderIdx : _this.state.skeletonKey
|
||||||
|
}, function () {
|
||||||
|
editor.emit('editor.ready');
|
||||||
|
editor.emit('ide.ready');
|
||||||
|
isReset && editor.emit('ide.afterReset');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
_this.state = {
|
||||||
|
initReady: false,
|
||||||
|
skeletonKey: "skeleton" + renderIdx
|
||||||
|
};
|
||||||
|
|
||||||
|
_this.init();
|
||||||
|
|
||||||
|
return _this;
|
||||||
|
}
|
||||||
|
|
||||||
|
var _proto = Skeleton.prototype;
|
||||||
|
|
||||||
|
_proto.componentWillUnmount = function componentWillUnmount() {
|
||||||
|
this.editor && this.editor.destroy();
|
||||||
|
};
|
||||||
|
|
||||||
|
_proto.componentDidCatch = function componentDidCatch(err) {
|
||||||
|
console.error(err);
|
||||||
|
};
|
||||||
|
|
||||||
|
_proto.render = function render() {
|
||||||
|
var _this$state = this.state,
|
||||||
|
initReady = _this$state.initReady,
|
||||||
|
skeletonKey = _this$state.skeletonKey,
|
||||||
|
__hasError = _this$state.__hasError;
|
||||||
|
var _this$props2 = this.props,
|
||||||
|
location = _this$props2.location,
|
||||||
|
history = _this$props2.history,
|
||||||
|
match = _this$props2.match;
|
||||||
|
|
||||||
|
if (__hasError || !this.editor) {
|
||||||
|
return 'error';
|
||||||
|
}
|
||||||
|
|
||||||
|
location.query = parseSearch(location.search);
|
||||||
|
this.editor.set('location', location);
|
||||||
|
this.editor.set('history', history);
|
||||||
|
this.editor.set('match', match);
|
||||||
|
return React.createElement(_ConfigProvider, null, React.createElement(_Loading, {
|
||||||
|
tip: "Loading",
|
||||||
|
size: "large",
|
||||||
|
visible: !initReady,
|
||||||
|
fullScreen: true
|
||||||
|
}, React.createElement("div", {
|
||||||
|
className: "lowcode-editor",
|
||||||
|
key: skeletonKey
|
||||||
|
}, React.createElement(TopArea, {
|
||||||
|
editor: this.editor
|
||||||
|
}), React.createElement("div", {
|
||||||
|
className: "lowcode-main-content"
|
||||||
|
}, React.createElement(LeftArea.Nav, {
|
||||||
|
editor: this.editor
|
||||||
|
}), React.createElement(LeftArea.Panel, {
|
||||||
|
editor: this.editor
|
||||||
|
}), React.createElement(CenterArea, {
|
||||||
|
editor: this.editor
|
||||||
|
}), React.createElement(RightArea, {
|
||||||
|
editor: this.editor
|
||||||
|
})))));
|
||||||
|
};
|
||||||
|
|
||||||
|
return Skeleton;
|
||||||
|
}(PureComponent); // 通过React-Router包裹,支持编辑器内页面根据路由切换
|
||||||
|
|
||||||
|
Skeleton.displayName = 'LowcodeEditorSkeleton';
|
||||||
|
|
||||||
|
var SkeletonWithRouter = function SkeletonWithRouter(props) {
|
||||||
|
var config = props.config,
|
||||||
|
otherProps = _objectWithoutPropertiesLoose(props, ["config"]);
|
||||||
|
|
||||||
|
return React.createElement(Router, null, React.createElement(Route, {
|
||||||
|
path: "/*",
|
||||||
|
component: function component(routerProps) {
|
||||||
|
return React.createElement(Skeleton, _extends({}, routerProps, otherProps, config.skeleton && config.skeleton.props, {
|
||||||
|
config: config
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
|
export default SkeletonWithRouter;
|
||||||
10
packages/editor-skeleton/src/index.ts
Normal file
10
packages/editor-skeleton/src/index.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import Skeleton from './skeleton';
|
||||||
|
import Panel from './components/Panel';
|
||||||
|
import TopIcon from './components/TopIcon';
|
||||||
|
|
||||||
|
export default Skeleton;
|
||||||
|
|
||||||
|
export {
|
||||||
|
Panel,
|
||||||
|
TopIcon
|
||||||
|
};
|
||||||
@ -5,6 +5,9 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ali/lowcode-editor-framework": "0.0.1",
|
"@ali/lowcode-editor-framework": "0.0.1",
|
||||||
"@ali/lowcode-editor-skeleton": "0.0.1",
|
"@ali/lowcode-editor-skeleton": "0.0.1",
|
||||||
|
"@ali/lowcode-plugin-logo": "0.0.1",
|
||||||
|
"@ali/lowcode-plugin-undo-redo": "0.0.1",
|
||||||
|
"@ali/lowcode-plugin-save": "0.0.1",
|
||||||
"@ali/iceluna-addon-2": "^1.0.3",
|
"@ali/iceluna-addon-2": "^1.0.3",
|
||||||
"@ali/iceluna-addon-component-list": "^1.0.11",
|
"@ali/iceluna-addon-component-list": "^1.0.11",
|
||||||
"@ali/iceluna-sdk": "^1.0.5-beta.26",
|
"@ali/iceluna-sdk": "^1.0.5-beta.26",
|
||||||
|
|||||||
@ -10,12 +10,12 @@ import rightPanel3 from '@ali/iceluna-addon-2';
|
|||||||
import rightPanel4 from '@ali/iceluna-addon-2';
|
import rightPanel4 from '@ali/iceluna-addon-2';
|
||||||
import componentList from '@ali/iceluna-addon-component-list';
|
import componentList from '@ali/iceluna-addon-component-list';
|
||||||
import Settings from '../../../plugin-settings';
|
import Settings from '../../../plugin-settings';
|
||||||
import undoRedo from '../plugins/undoRedo';
|
import undoRedo from '@ali/lowcode-plugin-undo-redo';
|
||||||
import Designer from '../plugins/designer';
|
import Designer from '../plugins/designer';
|
||||||
import logo from '../plugins/logo';
|
import logo from '@ali/lowcode-plugin-logo';
|
||||||
import save from '../plugins/save';
|
import save from '@ali/lowcode-plugin-save';
|
||||||
|
|
||||||
import PluginFactory from '../framework/pluginFactory';
|
import {PluginFactory} from '@ali/lowcode-editor-framework';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
logo: PluginFactory(logo),
|
logo: PluginFactory(logo),
|
||||||
|
|||||||
12
packages/plugin-logo/.editorconfig
Normal file
12
packages/plugin-logo/.editorconfig
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# http://editorconfig.org
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
||||||
11
packages/plugin-logo/.eslintignore
Normal file
11
packages/plugin-logo/.eslintignore
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# 忽略目录
|
||||||
|
build/
|
||||||
|
tests/
|
||||||
|
demo/
|
||||||
|
|
||||||
|
# node 覆盖率文件
|
||||||
|
coverage/
|
||||||
|
|
||||||
|
# 忽略文件
|
||||||
|
**/*-min.js
|
||||||
|
**/*.min.js
|
||||||
16
packages/plugin-logo/.eslintrc.js
Normal file
16
packages/plugin-logo/.eslintrc.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
const { tslint, deepmerge } = require('@ice/spec');
|
||||||
|
|
||||||
|
module.exports = deepmerge(tslint, {
|
||||||
|
rules: {
|
||||||
|
"global-require": 0,
|
||||||
|
"comma-dangle": 0,
|
||||||
|
"no-unused-expressions": 0,
|
||||||
|
"object-shorthand": 0,
|
||||||
|
"jsx-a11y/anchor-has-content": 0,
|
||||||
|
"react/sort-comp": 0,
|
||||||
|
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx", ".tsx", "ts"] }],
|
||||||
|
"@typescript-eslint/interface-name-prefix": 0,
|
||||||
|
"@typescript-eslint/no-explicit-any": 0,
|
||||||
|
"@typescript-eslint/explicit-member-accessibility": 0
|
||||||
|
},
|
||||||
|
});
|
||||||
20
packages/plugin-logo/.gitignore
vendored
Normal file
20
packages/plugin-logo/.gitignore
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# See https://help.github.com/ignore-files/ for more about ignoring files.
|
||||||
|
|
||||||
|
# dependencies
|
||||||
|
/node_modules
|
||||||
|
|
||||||
|
# production
|
||||||
|
/build
|
||||||
|
/dist
|
||||||
|
|
||||||
|
# misc
|
||||||
|
.idea/
|
||||||
|
.happypack
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
|
||||||
|
# ignore d.ts auto generated by css-modules-typescript-loader
|
||||||
|
*.module.scss.d.ts
|
||||||
7
packages/plugin-logo/.stylelintignore
Normal file
7
packages/plugin-logo/.stylelintignore
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# 忽略目录
|
||||||
|
build/
|
||||||
|
tests/
|
||||||
|
demo/
|
||||||
|
|
||||||
|
# node 覆盖率文件
|
||||||
|
coverage/
|
||||||
3
packages/plugin-logo/.stylelintrc.js
Normal file
3
packages/plugin-logo/.stylelintrc.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
const { stylelint } = require('@ice/spec');
|
||||||
|
|
||||||
|
module.exports = stylelint;
|
||||||
1
packages/plugin-logo/README.md
Normal file
1
packages/plugin-logo/README.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
## todo
|
||||||
4
packages/plugin-logo/abc.json
Normal file
4
packages/plugin-logo/abc.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"type": "ice-scripts",
|
||||||
|
"builder": "@ali/builder-ice-scripts"
|
||||||
|
}
|
||||||
9
packages/plugin-logo/build.json
Normal file
9
packages/plugin-logo/build.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"plugins": [
|
||||||
|
"build-plugin-component",
|
||||||
|
"build-plugin-fusion",
|
||||||
|
["build-plugin-moment-locales", {
|
||||||
|
"locales": ["zh-cn"]
|
||||||
|
}]
|
||||||
|
]
|
||||||
|
}
|
||||||
24
packages/plugin-logo/demo/usage.md
Normal file
24
packages/plugin-logo/demo/usage.md
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
---
|
||||||
|
title: Simple Usage
|
||||||
|
order: 1
|
||||||
|
---
|
||||||
|
|
||||||
|
本 Demo 演示一行文字的用法。
|
||||||
|
|
||||||
|
````jsx
|
||||||
|
import React, { Component } from 'react';
|
||||||
|
import ReactDOM from 'react-dom';
|
||||||
|
|
||||||
|
class App extends Component {
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ReactDOM.render((
|
||||||
|
<App />
|
||||||
|
), mountNode);
|
||||||
|
````
|
||||||
9
packages/plugin-logo/es/index.d.ts
vendored
Normal file
9
packages/plugin-logo/es/index.d.ts
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import './index.scss';
|
||||||
|
import { PluginProps } from '@ali/lowcode-editor-framework/lib/definitions';
|
||||||
|
export interface IProps {
|
||||||
|
logo?: string;
|
||||||
|
href?: string;
|
||||||
|
}
|
||||||
|
declare const Logo: React.FC<IProps & PluginProps>;
|
||||||
|
export default Logo;
|
||||||
17
packages/plugin-logo/es/index.js
Normal file
17
packages/plugin-logo/es/index.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import './index.scss';
|
||||||
|
|
||||||
|
var Logo = function Logo(props) {
|
||||||
|
return /*#__PURE__*/React.createElement("div", {
|
||||||
|
className: "lowcode-plugin-logo"
|
||||||
|
}, /*#__PURE__*/React.createElement("a", {
|
||||||
|
className: "logo",
|
||||||
|
target: "blank",
|
||||||
|
href: props.href || '/',
|
||||||
|
style: {
|
||||||
|
backgroundImage: "url(" + props.logo + ")"
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Logo;
|
||||||
1
packages/plugin-logo/es/style.js
Normal file
1
packages/plugin-logo/es/style.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
import './index.scss';
|
||||||
9
packages/plugin-logo/jsconfig.json
Normal file
9
packages/plugin-logo/jsconfig.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"baseUrl": ".",
|
||||||
|
"jsx": "react",
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["./src/*"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
4179
packages/plugin-logo/package-lock.json
generated
Normal file
4179
packages/plugin-logo/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
55
packages/plugin-logo/package.json
Normal file
55
packages/plugin-logo/package.json
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
{
|
||||||
|
"name": "@ali/lowcode-plugin-logo",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"description": "alibaba lowcode editor logo plugin",
|
||||||
|
"files": [
|
||||||
|
"demo/",
|
||||||
|
"es/",
|
||||||
|
"lib/",
|
||||||
|
"build/"
|
||||||
|
],
|
||||||
|
"main": "lib/index.tsx",
|
||||||
|
"module": "es/index.js",
|
||||||
|
"stylePath": "style.js",
|
||||||
|
"scripts": {
|
||||||
|
"start": "build-scripts start",
|
||||||
|
"build": "build-scripts build --skip-demo",
|
||||||
|
"prepublishOnly": "npm run prettier && npm run build",
|
||||||
|
"lint": "eslint --cache --ext .js,.jsx ./",
|
||||||
|
"prettier": "prettier --write \"./src/**/*.{ts,tsx,js,jsx,ejs,less,css,scss,json}\" "
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"lowcode",
|
||||||
|
"editor"
|
||||||
|
],
|
||||||
|
"author": "xiayang.xy",
|
||||||
|
"dependencies": {
|
||||||
|
"prop-types": "^15.5.8",
|
||||||
|
"react": "^16.8.1",
|
||||||
|
"react-dom": "^16.8.1",
|
||||||
|
"react-router-dom": "^5.1.2"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@ali/lowcode-editor-framework": "0.0.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@alib/build-scripts": "^0.1.3",
|
||||||
|
"@alifd/next": "1.x",
|
||||||
|
"@ice/spec": "^0.1.1",
|
||||||
|
"@types/lodash": "^4.14.149",
|
||||||
|
"@types/react": "^16.9.13",
|
||||||
|
"@types/react-dom": "^16.9.4",
|
||||||
|
"build-plugin-component": "^0.2.7-1",
|
||||||
|
"build-plugin-fusion": "^0.1.0",
|
||||||
|
"build-plugin-moment-locales": "^0.1.0",
|
||||||
|
"eslint": "^6.0.1",
|
||||||
|
"prettier": "^1.19.1",
|
||||||
|
"react": "^16.8.0",
|
||||||
|
"react-dom": "^16.8.0"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/ice-lab/react-materials/tree/master/scaffolds/ice-ts"
|
||||||
|
},
|
||||||
|
"homepage": "https://unpkg.alibaba-inc.com/@ali/lowcode-engine-skeleton@0.0.1/build/index.html"
|
||||||
|
}
|
||||||
13
packages/plugin-logo/src/index.scss
Normal file
13
packages/plugin-logo/src/index.scss
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
.lowcode-plugin-logo {
|
||||||
|
padding: 14px 8px;
|
||||||
|
padding-left: 8px;
|
||||||
|
.logo {
|
||||||
|
display: block;
|
||||||
|
width: 56px;
|
||||||
|
height: 20px;
|
||||||
|
cursor: pointer;
|
||||||
|
background-size: contain;
|
||||||
|
background-position: center;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import './index.scss';
|
import './index.scss';
|
||||||
import { PluginProps } from '../../framework/definitions';
|
import { PluginProps } from '@ali/lowcode-editor-framework/lib/definitions';
|
||||||
|
|
||||||
export interface IProps {
|
export interface IProps {
|
||||||
logo?: string;
|
logo?: string;
|
||||||
1
packages/plugin-logo/tests/index.js
Normal file
1
packages/plugin-logo/tests/index.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
// test file
|
||||||
21
packages/plugin-logo/tsconfig.json
Normal file
21
packages/plugin-logo/tsconfig.json
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"compileOnSave": false,
|
||||||
|
"buildOnSave": false,
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "build",
|
||||||
|
"module": "esnext",
|
||||||
|
"target": "es6",
|
||||||
|
"jsx": "react",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"lib": ["es6", "dom"],
|
||||||
|
"sourceMap": true,
|
||||||
|
"allowJs": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"noImplicitThis": true,
|
||||||
|
"noImplicitAny": true,
|
||||||
|
"skipLibCheck": true
|
||||||
|
},
|
||||||
|
"include": ["src/*.ts", "src/*.tsx"],
|
||||||
|
"exclude": ["node_modules", "build", "public"]
|
||||||
|
}
|
||||||
12
packages/plugin-save/.editorconfig
Normal file
12
packages/plugin-save/.editorconfig
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# http://editorconfig.org
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
||||||
11
packages/plugin-save/.eslintignore
Normal file
11
packages/plugin-save/.eslintignore
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# 忽略目录
|
||||||
|
build/
|
||||||
|
tests/
|
||||||
|
demo/
|
||||||
|
|
||||||
|
# node 覆盖率文件
|
||||||
|
coverage/
|
||||||
|
|
||||||
|
# 忽略文件
|
||||||
|
**/*-min.js
|
||||||
|
**/*.min.js
|
||||||
16
packages/plugin-save/.eslintrc.js
Normal file
16
packages/plugin-save/.eslintrc.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
const { tslint, deepmerge } = require('@ice/spec');
|
||||||
|
|
||||||
|
module.exports = deepmerge(tslint, {
|
||||||
|
rules: {
|
||||||
|
"global-require": 0,
|
||||||
|
"comma-dangle": 0,
|
||||||
|
"no-unused-expressions": 0,
|
||||||
|
"object-shorthand": 0,
|
||||||
|
"jsx-a11y/anchor-has-content": 0,
|
||||||
|
"react/sort-comp": 0,
|
||||||
|
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx", ".tsx", "ts"] }],
|
||||||
|
"@typescript-eslint/interface-name-prefix": 0,
|
||||||
|
"@typescript-eslint/no-explicit-any": 0,
|
||||||
|
"@typescript-eslint/explicit-member-accessibility": 0
|
||||||
|
},
|
||||||
|
});
|
||||||
20
packages/plugin-save/.gitignore
vendored
Normal file
20
packages/plugin-save/.gitignore
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# See https://help.github.com/ignore-files/ for more about ignoring files.
|
||||||
|
|
||||||
|
# dependencies
|
||||||
|
/node_modules
|
||||||
|
|
||||||
|
# production
|
||||||
|
/build
|
||||||
|
/dist
|
||||||
|
|
||||||
|
# misc
|
||||||
|
.idea/
|
||||||
|
.happypack
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
|
||||||
|
# ignore d.ts auto generated by css-modules-typescript-loader
|
||||||
|
*.module.scss.d.ts
|
||||||
7
packages/plugin-save/.stylelintignore
Normal file
7
packages/plugin-save/.stylelintignore
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# 忽略目录
|
||||||
|
build/
|
||||||
|
tests/
|
||||||
|
demo/
|
||||||
|
|
||||||
|
# node 覆盖率文件
|
||||||
|
coverage/
|
||||||
3
packages/plugin-save/.stylelintrc.js
Normal file
3
packages/plugin-save/.stylelintrc.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
const { stylelint } = require('@ice/spec');
|
||||||
|
|
||||||
|
module.exports = stylelint;
|
||||||
1
packages/plugin-save/README.md
Normal file
1
packages/plugin-save/README.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
## todo
|
||||||
4
packages/plugin-save/abc.json
Normal file
4
packages/plugin-save/abc.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"type": "ice-scripts",
|
||||||
|
"builder": "@ali/builder-ice-scripts"
|
||||||
|
}
|
||||||
9
packages/plugin-save/build.json
Normal file
9
packages/plugin-save/build.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"plugins": [
|
||||||
|
"build-plugin-component",
|
||||||
|
"build-plugin-fusion",
|
||||||
|
["build-plugin-moment-locales", {
|
||||||
|
"locales": ["zh-cn"]
|
||||||
|
}]
|
||||||
|
]
|
||||||
|
}
|
||||||
24
packages/plugin-save/demo/usage.md
Normal file
24
packages/plugin-save/demo/usage.md
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
---
|
||||||
|
title: Simple Usage
|
||||||
|
order: 1
|
||||||
|
---
|
||||||
|
|
||||||
|
本 Demo 演示一行文字的用法。
|
||||||
|
|
||||||
|
````jsx
|
||||||
|
import React, { Component } from 'react';
|
||||||
|
import ReactDOM from 'react-dom';
|
||||||
|
|
||||||
|
class App extends Component {
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ReactDOM.render((
|
||||||
|
<App />
|
||||||
|
), mountNode);
|
||||||
|
````
|
||||||
5
packages/plugin-save/es/index.d.ts
vendored
Normal file
5
packages/plugin-save/es/index.d.ts
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import './index.scss';
|
||||||
|
import { PluginProps } from '@ali/lowcode-editor-framework/lib/definitions';
|
||||||
|
declare const Save: React.FC<PluginProps>;
|
||||||
|
export default Save;
|
||||||
18
packages/plugin-save/es/index.js
Normal file
18
packages/plugin-save/es/index.js
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import _Button from "@alifd/next/es/button";
|
||||||
|
import React from 'react';
|
||||||
|
import './index.scss';
|
||||||
|
|
||||||
|
var Save = function Save(props) {
|
||||||
|
var handleClick = function handleClick() {
|
||||||
|
console.log('save data:', props.editor.designer.currentDocument.schema);
|
||||||
|
};
|
||||||
|
|
||||||
|
return /*#__PURE__*/React.createElement("div", {
|
||||||
|
className: "lowcode-plugin-save"
|
||||||
|
}, /*#__PURE__*/React.createElement(_Button, {
|
||||||
|
type: "primary",
|
||||||
|
onClick: handleClick
|
||||||
|
}, "\u4FDD\u5B58"));
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Save;
|
||||||
2
packages/plugin-save/es/style.js
Normal file
2
packages/plugin-save/es/style.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
import '@alifd/next/es/button/style';
|
||||||
|
import './index.scss';
|
||||||
9
packages/plugin-save/jsconfig.json
Normal file
9
packages/plugin-save/jsconfig.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"baseUrl": ".",
|
||||||
|
"jsx": "react",
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["./src/*"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
4179
packages/plugin-save/package-lock.json
generated
Normal file
4179
packages/plugin-save/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
56
packages/plugin-save/package.json
Normal file
56
packages/plugin-save/package.json
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
{
|
||||||
|
"name": "@ali/lowcode-plugin-save",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"description": "alibaba lowcode editor save plugin",
|
||||||
|
"files": [
|
||||||
|
"demo/",
|
||||||
|
"es/",
|
||||||
|
"lib/",
|
||||||
|
"build/"
|
||||||
|
],
|
||||||
|
"main": "lib/index.tsx",
|
||||||
|
"module": "es/index.js",
|
||||||
|
"stylePath": "style.js",
|
||||||
|
"scripts": {
|
||||||
|
"start": "build-scripts start",
|
||||||
|
"build": "build-scripts build --skip-demo",
|
||||||
|
"prepublishOnly": "npm run prettier && npm run build",
|
||||||
|
"lint": "eslint --cache --ext .js,.jsx ./",
|
||||||
|
"prettier": "prettier --write \"./src/**/*.{ts,tsx,js,jsx,ejs,less,css,scss,json}\" "
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"lowcode",
|
||||||
|
"editor"
|
||||||
|
],
|
||||||
|
"author": "xiayang.xy",
|
||||||
|
"dependencies": {
|
||||||
|
"@alifd/next": "^1.x",
|
||||||
|
"prop-types": "^15.5.8",
|
||||||
|
"react": "^16.8.1",
|
||||||
|
"react-dom": "^16.8.1",
|
||||||
|
"react-router-dom": "^5.1.2"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@ali/lowcode-editor-framework": "0.0.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@alib/build-scripts": "^0.1.3",
|
||||||
|
"@alifd/next": "1.x",
|
||||||
|
"@ice/spec": "^0.1.1",
|
||||||
|
"@types/lodash": "^4.14.149",
|
||||||
|
"@types/react": "^16.9.13",
|
||||||
|
"@types/react-dom": "^16.9.4",
|
||||||
|
"build-plugin-component": "^0.2.7-1",
|
||||||
|
"build-plugin-fusion": "^0.1.0",
|
||||||
|
"build-plugin-moment-locales": "^0.1.0",
|
||||||
|
"eslint": "^6.0.1",
|
||||||
|
"prettier": "^1.19.1",
|
||||||
|
"react": "^16.8.0",
|
||||||
|
"react-dom": "^16.8.0"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/ice-lab/react-materials/tree/master/scaffolds/ice-ts"
|
||||||
|
},
|
||||||
|
"homepage": "https://unpkg.alibaba-inc.com/@ali/lowcode-engine-skeleton@0.0.1/build/index.html"
|
||||||
|
}
|
||||||
3
packages/plugin-save/src/index.scss
Normal file
3
packages/plugin-save/src/index.scss
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
.lowcode-plugin-save {
|
||||||
|
padding: 10px 4px;
|
||||||
|
}
|
||||||
@ -1,7 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {Button} from '@alifd/next';
|
import {Button} from '@alifd/next';
|
||||||
import './index.scss';
|
import './index.scss';
|
||||||
import { PluginProps } from '../../framework/definitions';
|
import { PluginProps } from '@ali/lowcode-editor-framework/lib/definitions';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
1
packages/plugin-save/tests/index.js
Normal file
1
packages/plugin-save/tests/index.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
// test file
|
||||||
21
packages/plugin-save/tsconfig.json
Normal file
21
packages/plugin-save/tsconfig.json
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"compileOnSave": false,
|
||||||
|
"buildOnSave": false,
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "build",
|
||||||
|
"module": "esnext",
|
||||||
|
"target": "es6",
|
||||||
|
"jsx": "react",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"lib": ["es6", "dom"],
|
||||||
|
"sourceMap": true,
|
||||||
|
"allowJs": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"noImplicitThis": true,
|
||||||
|
"noImplicitAny": true,
|
||||||
|
"skipLibCheck": true
|
||||||
|
},
|
||||||
|
"include": ["src/*.ts", "src/*.tsx"],
|
||||||
|
"exclude": ["node_modules", "build", "public"]
|
||||||
|
}
|
||||||
12
packages/plugin-undo-redo/.editorconfig
Normal file
12
packages/plugin-undo-redo/.editorconfig
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# http://editorconfig.org
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
||||||
11
packages/plugin-undo-redo/.eslintignore
Normal file
11
packages/plugin-undo-redo/.eslintignore
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# 忽略目录
|
||||||
|
build/
|
||||||
|
tests/
|
||||||
|
demo/
|
||||||
|
|
||||||
|
# node 覆盖率文件
|
||||||
|
coverage/
|
||||||
|
|
||||||
|
# 忽略文件
|
||||||
|
**/*-min.js
|
||||||
|
**/*.min.js
|
||||||
16
packages/plugin-undo-redo/.eslintrc.js
Normal file
16
packages/plugin-undo-redo/.eslintrc.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
const { tslint, deepmerge } = require('@ice/spec');
|
||||||
|
|
||||||
|
module.exports = deepmerge(tslint, {
|
||||||
|
rules: {
|
||||||
|
"global-require": 0,
|
||||||
|
"comma-dangle": 0,
|
||||||
|
"no-unused-expressions": 0,
|
||||||
|
"object-shorthand": 0,
|
||||||
|
"jsx-a11y/anchor-has-content": 0,
|
||||||
|
"react/sort-comp": 0,
|
||||||
|
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx", ".tsx", "ts"] }],
|
||||||
|
"@typescript-eslint/interface-name-prefix": 0,
|
||||||
|
"@typescript-eslint/no-explicit-any": 0,
|
||||||
|
"@typescript-eslint/explicit-member-accessibility": 0
|
||||||
|
},
|
||||||
|
});
|
||||||
20
packages/plugin-undo-redo/.gitignore
vendored
Normal file
20
packages/plugin-undo-redo/.gitignore
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# See https://help.github.com/ignore-files/ for more about ignoring files.
|
||||||
|
|
||||||
|
# dependencies
|
||||||
|
/node_modules
|
||||||
|
|
||||||
|
# production
|
||||||
|
/build
|
||||||
|
/dist
|
||||||
|
|
||||||
|
# misc
|
||||||
|
.idea/
|
||||||
|
.happypack
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
|
||||||
|
# ignore d.ts auto generated by css-modules-typescript-loader
|
||||||
|
*.module.scss.d.ts
|
||||||
7
packages/plugin-undo-redo/.stylelintignore
Normal file
7
packages/plugin-undo-redo/.stylelintignore
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# 忽略目录
|
||||||
|
build/
|
||||||
|
tests/
|
||||||
|
demo/
|
||||||
|
|
||||||
|
# node 覆盖率文件
|
||||||
|
coverage/
|
||||||
3
packages/plugin-undo-redo/.stylelintrc.js
Normal file
3
packages/plugin-undo-redo/.stylelintrc.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
const { stylelint } = require('@ice/spec');
|
||||||
|
|
||||||
|
module.exports = stylelint;
|
||||||
1
packages/plugin-undo-redo/README.md
Normal file
1
packages/plugin-undo-redo/README.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
## todo
|
||||||
4
packages/plugin-undo-redo/abc.json
Normal file
4
packages/plugin-undo-redo/abc.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"type": "ice-scripts",
|
||||||
|
"builder": "@ali/builder-ice-scripts"
|
||||||
|
}
|
||||||
9
packages/plugin-undo-redo/build.json
Normal file
9
packages/plugin-undo-redo/build.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"plugins": [
|
||||||
|
"build-plugin-component",
|
||||||
|
"build-plugin-fusion",
|
||||||
|
["build-plugin-moment-locales", {
|
||||||
|
"locales": ["zh-cn"]
|
||||||
|
}]
|
||||||
|
]
|
||||||
|
}
|
||||||
24
packages/plugin-undo-redo/demo/usage.md
Normal file
24
packages/plugin-undo-redo/demo/usage.md
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
---
|
||||||
|
title: Simple Usage
|
||||||
|
order: 1
|
||||||
|
---
|
||||||
|
|
||||||
|
本 Demo 演示一行文字的用法。
|
||||||
|
|
||||||
|
````jsx
|
||||||
|
import React, { Component } from 'react';
|
||||||
|
import ReactDOM from 'react-dom';
|
||||||
|
|
||||||
|
class App extends Component {
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ReactDOM.render((
|
||||||
|
<App />
|
||||||
|
), mountNode);
|
||||||
|
````
|
||||||
21
packages/plugin-undo-redo/es/index.d.ts
vendored
Normal file
21
packages/plugin-undo-redo/es/index.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import React, { PureComponent } from 'react';
|
||||||
|
import './index.scss';
|
||||||
|
import { PluginProps } from '@ali/lowcode-editor-framework/lib/definitions';
|
||||||
|
export interface IProps {
|
||||||
|
editor: any;
|
||||||
|
logo?: string;
|
||||||
|
}
|
||||||
|
export interface IState {
|
||||||
|
undoEnable: boolean;
|
||||||
|
redoEnable: boolean;
|
||||||
|
}
|
||||||
|
export default class UndoRedo extends PureComponent<IProps & PluginProps, IState> {
|
||||||
|
static display: string;
|
||||||
|
private history;
|
||||||
|
constructor(props: any);
|
||||||
|
init: () => void;
|
||||||
|
updateState: (state: number) => void;
|
||||||
|
handleUndoClick: () => void;
|
||||||
|
handleRedoClick: () => void;
|
||||||
|
render(): React.ReactNode;
|
||||||
|
}
|
||||||
101
packages/plugin-undo-redo/es/index.js
Normal file
101
packages/plugin-undo-redo/es/index.js
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
||||||
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
||||||
|
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
||||||
|
|
||||||
|
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||||
|
|
||||||
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
||||||
|
|
||||||
|
import React, { PureComponent } from 'react';
|
||||||
|
import './index.scss';
|
||||||
|
import { TopIcon } from '@ali/lowcode-editor-skeleton';
|
||||||
|
|
||||||
|
var UndoRedo = /*#__PURE__*/function (_PureComponent) {
|
||||||
|
_inheritsLoose(UndoRedo, _PureComponent);
|
||||||
|
|
||||||
|
var _super = _createSuper(UndoRedo);
|
||||||
|
|
||||||
|
function UndoRedo(props) {
|
||||||
|
var _this;
|
||||||
|
|
||||||
|
_this = _PureComponent.call(this, props) || this;
|
||||||
|
_this.history = void 0;
|
||||||
|
|
||||||
|
_this.init = function () {
|
||||||
|
var _editor$designer, _this$history;
|
||||||
|
|
||||||
|
var editor = _this.props.editor;
|
||||||
|
_this.history = (_editor$designer = editor.designer) === null || _editor$designer === void 0 ? void 0 : _editor$designer.currentHistory;
|
||||||
|
|
||||||
|
_this.updateState(((_this$history = _this.history) === null || _this$history === void 0 ? void 0 : _this$history.getState()) || 0);
|
||||||
|
|
||||||
|
editor.on('designer.history-change', function (history) {
|
||||||
|
var _this$history2;
|
||||||
|
|
||||||
|
_this.history = history;
|
||||||
|
|
||||||
|
_this.updateState(((_this$history2 = _this.history) === null || _this$history2 === void 0 ? void 0 : _this$history2.getState()) || 0);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
_this.updateState = function (state) {
|
||||||
|
_this.setState({
|
||||||
|
undoEnable: !!(state & 1),
|
||||||
|
redoEnable: !!(state & 2)
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
_this.handleUndoClick = function () {
|
||||||
|
var _this$history3;
|
||||||
|
|
||||||
|
(_this$history3 = _this.history) === null || _this$history3 === void 0 ? void 0 : _this$history3.back();
|
||||||
|
};
|
||||||
|
|
||||||
|
_this.handleRedoClick = function () {
|
||||||
|
var _this$history4;
|
||||||
|
|
||||||
|
(_this$history4 = _this.history) === null || _this$history4 === void 0 ? void 0 : _this$history4.forward();
|
||||||
|
};
|
||||||
|
|
||||||
|
_this.state = {
|
||||||
|
undoEnable: false,
|
||||||
|
redoEnable: false
|
||||||
|
};
|
||||||
|
|
||||||
|
if (props.editor.designer) {
|
||||||
|
_this.init();
|
||||||
|
} else {
|
||||||
|
props.editor.on('designer.ready', function () {
|
||||||
|
_this.init();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return _this;
|
||||||
|
}
|
||||||
|
|
||||||
|
var _proto = UndoRedo.prototype;
|
||||||
|
|
||||||
|
_proto.render = function render() {
|
||||||
|
var _this$state = this.state,
|
||||||
|
undoEnable = _this$state.undoEnable,
|
||||||
|
redoEnable = _this$state.redoEnable;
|
||||||
|
return /*#__PURE__*/React.createElement("div", {
|
||||||
|
className: "lowcode-plugin-undo-redo"
|
||||||
|
}, /*#__PURE__*/React.createElement(TopIcon, {
|
||||||
|
icon: "houtui",
|
||||||
|
title: "\u540E\u9000",
|
||||||
|
disabled: !undoEnable,
|
||||||
|
onClick: this.handleUndoClick
|
||||||
|
}), /*#__PURE__*/React.createElement(TopIcon, {
|
||||||
|
icon: "qianjin",
|
||||||
|
title: "\u524D\u8FDB",
|
||||||
|
disabled: !redoEnable,
|
||||||
|
onClick: this.handleRedoClick
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
|
return UndoRedo;
|
||||||
|
}(PureComponent);
|
||||||
|
|
||||||
|
UndoRedo.display = 'LowcodeUndoRedo';
|
||||||
|
export { UndoRedo as default };
|
||||||
2
packages/plugin-undo-redo/es/style.js
Normal file
2
packages/plugin-undo-redo/es/style.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
import '@ali/lowcode-editor-skeleton/es/style';
|
||||||
|
import './index.scss';
|
||||||
9
packages/plugin-undo-redo/jsconfig.json
Normal file
9
packages/plugin-undo-redo/jsconfig.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"baseUrl": ".",
|
||||||
|
"jsx": "react",
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["./src/*"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
4179
packages/plugin-undo-redo/package-lock.json
generated
Normal file
4179
packages/plugin-undo-redo/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
56
packages/plugin-undo-redo/package.json
Normal file
56
packages/plugin-undo-redo/package.json
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
{
|
||||||
|
"name": "@ali/lowcode-plugin-undo-redo",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"description": "alibaba lowcode editor undo redo plugin",
|
||||||
|
"files": [
|
||||||
|
"demo/",
|
||||||
|
"es/",
|
||||||
|
"lib/",
|
||||||
|
"build/"
|
||||||
|
],
|
||||||
|
"main": "lib/index.tsx",
|
||||||
|
"module": "es/index.js",
|
||||||
|
"stylePath": "style.js",
|
||||||
|
"scripts": {
|
||||||
|
"start": "build-scripts start",
|
||||||
|
"build": "build-scripts build --skip-demo",
|
||||||
|
"prepublishOnly": "npm run prettier && npm run build",
|
||||||
|
"lint": "eslint --cache --ext .js,.jsx ./",
|
||||||
|
"prettier": "prettier --write \"./src/**/*.{ts,tsx,js,jsx,ejs,less,css,scss,json}\" "
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"lowcode",
|
||||||
|
"editor"
|
||||||
|
],
|
||||||
|
"author": "xiayang.xy",
|
||||||
|
"dependencies": {
|
||||||
|
"@ali/lowcode-editor-skeleton": "0.0.1",
|
||||||
|
"prop-types": "^15.5.8",
|
||||||
|
"react": "^16.8.1",
|
||||||
|
"react-dom": "^16.8.1",
|
||||||
|
"react-router-dom": "^5.1.2"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@ali/lowcode-editor-framework": "0.0.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@alib/build-scripts": "^0.1.3",
|
||||||
|
"@alifd/next": "1.x",
|
||||||
|
"@ice/spec": "^0.1.1",
|
||||||
|
"@types/lodash": "^4.14.149",
|
||||||
|
"@types/react": "^16.9.13",
|
||||||
|
"@types/react-dom": "^16.9.4",
|
||||||
|
"build-plugin-component": "^0.2.7-1",
|
||||||
|
"build-plugin-fusion": "^0.1.0",
|
||||||
|
"build-plugin-moment-locales": "^0.1.0",
|
||||||
|
"eslint": "^6.0.1",
|
||||||
|
"prettier": "^1.19.1",
|
||||||
|
"react": "^16.8.0",
|
||||||
|
"react-dom": "^16.8.0"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/ice-lab/react-materials/tree/master/scaffolds/ice-ts"
|
||||||
|
},
|
||||||
|
"homepage": "https://unpkg.alibaba-inc.com/@ali/lowcode-engine-skeleton@0.0.1/build/index.html"
|
||||||
|
}
|
||||||
0
packages/plugin-undo-redo/src/index.scss
Normal file
0
packages/plugin-undo-redo/src/index.scss
Normal file
@ -1,7 +1,7 @@
|
|||||||
import React, { PureComponent } from 'react';
|
import React, { PureComponent } from 'react';
|
||||||
import './index.scss';
|
import './index.scss';
|
||||||
import { PluginProps } from '../../framework/definitions';
|
import { PluginProps } from '@ali/lowcode-editor-framework/lib/definitions';
|
||||||
import TopIcon from '../../skeleton/components/TopIcon/index';
|
import {TopIcon} from '@ali/lowcode-editor-skeleton';
|
||||||
|
|
||||||
export interface IProps {
|
export interface IProps {
|
||||||
editor: any;
|
editor: any;
|
||||||
1
packages/plugin-undo-redo/tests/index.js
Normal file
1
packages/plugin-undo-redo/tests/index.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
// test file
|
||||||
21
packages/plugin-undo-redo/tsconfig.json
Normal file
21
packages/plugin-undo-redo/tsconfig.json
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"compileOnSave": false,
|
||||||
|
"buildOnSave": false,
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "build",
|
||||||
|
"module": "esnext",
|
||||||
|
"target": "es6",
|
||||||
|
"jsx": "react",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"lib": ["es6", "dom"],
|
||||||
|
"sourceMap": true,
|
||||||
|
"allowJs": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"noImplicitThis": true,
|
||||||
|
"noImplicitAny": true,
|
||||||
|
"skipLibCheck": true
|
||||||
|
},
|
||||||
|
"include": ["src/*.ts", "src/*.tsx"],
|
||||||
|
"exclude": ["node_modules", "build", "public"]
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user