style: rax-render

This commit is contained in:
wuji.xwt 2020-09-11 17:13:59 +08:00
parent a8ffb0d773
commit 00a10e8b65
9 changed files with 22 additions and 19 deletions

View File

@ -2,6 +2,7 @@
node_modules
build
dist
demo
es
lib
.*

View File

@ -0,0 +1,9 @@
module.exports = {
extends: 'eslint-config-ali/typescript/react',
rules: {
'no-proto': 1,
'no-new-func': 1,
'no-shadow': 1,
'@typescript-eslint/no-unused-vars': 1,
}
}

View File

@ -43,6 +43,7 @@ export default class BaseEngine extends Component {
messages: PropTypes.object,
__appHelper: PropTypes.object,
__components: PropTypes.object,
// eslint-disable-next-line react/no-unused-prop-types
__componentsMap: PropTypes.object,
__ctx: PropTypes.object,
__schema: PropTypes.object,
@ -293,7 +294,6 @@ export default class BaseEngine extends Component {
__schema: schema,
__appHelper: appHelper,
__components: components,
// __componentsMap: componentsMap,
}
: {};
if (engine && engine.props.designMode) {
@ -334,9 +334,8 @@ export default class BaseEngine extends Component {
}
props.__id = schema.id;
let Child = null;
if (!isFileSchema(schema) && schema.children) {
Child = this.__createVirtualDom(
this.__createVirtualDom(
isJSExpression(schema.children) ? parseExpression(schema.children, self) : schema.children,
self,
{
@ -460,7 +459,7 @@ export default class BaseEngine extends Component {
return checkProps(function () {
const args = {};
if (Array.isArray(params) && params.length) {
params.map((item, idx) => {
params.forEach((item, idx) => {
if (typeof item === 'string') {
args[item] = arguments[idx];
} else if (item && typeof item === 'object') {

View File

@ -61,7 +61,7 @@ export default class CompEngine extends BaseEngine {
debug(`comp.componentWillUnmount - ${this.props.__schema.fileName}`);
}
async componentDidCatch(e) {
async componentDidCatch() {
super.componentDidCatch(...arguments);
debug(`comp.componentDidCatch - ${this.props.__schema.fileName}`);
}

View File

@ -79,7 +79,7 @@ export default class PageEngine extends BaseEngine {
debug(`page.render - ${__schema.fileName}`);
const {
id, className, style, autoLoading, defaultHeight = 300, loading,
id, className, style,
} = this.__parseData(__schema.props);
const { Page } = __components;
@ -89,9 +89,6 @@ export default class PageEngine extends BaseEngine {
<AppContext.Consumer>
{(context) => {
this.context = context;
{
/* this.__generateCtx(currCtx); */
}
this.__render();
return (
<AppContext.Provider

View File

@ -40,7 +40,7 @@ export default class TempEngine extends BaseEngine {
debug(`temp.componentDidMount - ${this.props.__schema.fileName}`);
}
componentDidUpdate(prevProps, prevState, snapshot) {
componentDidUpdate() {
debug(`temp.componentDidUpdate - ${this.props.__schema.fileName}`);
}

View File

@ -4,10 +4,6 @@ import { createElement, Component } from 'rax';
export default function (Comp) {
return class CompWrapper extends Component {
constructor(props, context) {
super(props, context);
}
render() {
return createElement(Comp, {
...this.props,

View File

@ -159,7 +159,7 @@ export default class DataHelper {
const afterRequest = this.appHelper && this.appHelper.utils && this.appHelper.utils.afterRequest;
const csrfInput = document.getElementById('_csrf_token');
const _tb_token_ = csrfInput && csrfInput.value;
asyncDataList.map(req => {
asyncDataList.forEach(req => {
const { id, type, options } = req;
if (!id || !type) return;
if (type === 'doServer') {
@ -272,6 +272,7 @@ export default class DataHelper {
}
fetchOne(type, options) {
// eslint-disable-next-line prefer-const
let { uri, method = 'GET', headers, params, ...otherProps } = options;
otherProps = otherProps || {};
switch (type) {

View File

@ -50,8 +50,6 @@ const EXPRESSION_TYPE = {
JSSLOT: 'JSSlot',
};
const EXPRESSION_REG = /^\{\{(\{.*\}|.*?)\}\}$/;
const hasSymbol = typeof Symbol === 'function' && Symbol.for;
const REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
const debug = Debug('utils:index');
const ENV = {
@ -180,6 +178,7 @@ export function fillObj(receiver = {}, ...suppliers) {
// 中划线转驼峰
export function toHump(name) {
// eslint-disable-next-line no-useless-escape
return name.replace(/\-(\w)/g, (all, letter) => letter.toUpperCase());
}
// 驼峰转中划线
@ -525,7 +524,7 @@ export function addCssTag(id, content) {
// 注册快捷
export function registShortCuts(config, appHelper) {
const keyboardFilter = (keymaster.filter = (event) => {
keymaster.filter = (event) => {
const eTarget = event.target || event.srcElement;
const { tagName } = eTarget;
const isInput = !!(tagName == 'INPUT' || tagName == 'SELECT' || tagName == 'TEXTAREA');
@ -541,7 +540,8 @@ export function registShortCuts(config, appHelper) {
return false;
}
return true;
});
};
const keyboardFilter = keymaster.filter;
const ideMessage = appHelper.utils && appHelper.utils.ideMessage;