Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
andycall committed Mar 10, 2019
0 parents commit 82b56f4
Show file tree
Hide file tree
Showing 98 changed files with 12,329 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .editorconfig
@@ -0,0 +1,8 @@
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
12 changes: 12 additions & 0 deletions .gitignore
@@ -0,0 +1,12 @@
.idea/

# dependencies
node_modules

# testing
/coverage
/coverage/*

packages/rcre/dist

.DS_Store
56 changes: 56 additions & 0 deletions package.json
@@ -0,0 +1,56 @@
{
"name": "rcre",
"version": "0.1.0",
"description": "A out of box application framework designed for CMS development.",
"main": "dist/index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/andycall/RCRE.git"
},
"keywords": [
"application",
"framework",
"CMS"
],
"private": true,
"workspaces": [
"packages/*"
],
"author": "andycall",
"license": "MIT",
"bugs": {
"url": "https://github.com/andycall/RCRE/issues"
},
"homepage": "https://github.com/andycall/RCRE#readme",
"devDependencies": {
"@types/acorn": "^4.0.5",
"@types/lodash": "^4.14.122",
"@types/lru-cache": "^5.1.0",
"@types/node": "^11.11.0",
"@types/qs": "^6.5.2",
"@types/react": "^16.8.7",
"@types/react-dom": "^16.8.2",
"rollup-plugin-postcss": "^2.0.3",
"rollup-plugin-typescript2": "^0.19.3"
},
"scripts": {
"build": "rollup -c ./scripts/rollup/rollup.config.js"
},
"dependencies": {
"@types/react-redux": "^7.0.3",
"acorn": "^5.3.0",
"axios": "^0.16.2",
"chalk": "^2.4.1",
"classnames": "^2.2.5",
"lodash": "^4.17.4",
"lru-cache": "5.1.1",
"moment": "^2.20.1",
"qs": "^6.5.2",
"react": ">=16",
"react-dom": ">=16",
"react-redux": "^5.0.7",
"redux": "^3.7.2",
"rollup": "^1.6.0",
"typescript": "^3.3.3333"
}
}
35 changes: 35 additions & 0 deletions packages/rcre/global.ts
@@ -0,0 +1,35 @@
/**
* @file 全局定义文件
* @author dongtiancheng
*/
declare interface Window {
__REDUX_DEVTOOLS_EXTENSION__: any;
__REDUX_DEVTOOLS_EXTENSION_COMPOSE__: any;
RCRE: any;
RCRE019: any;
RCRE_React: any;
RCRE_ReactDOM: any;
RCRE_VERSION: any;
React: any;
ReactDOM: any;
RCRE_BasicContainer: any;
RCRE_providerLoader: any;
RCRE_customerLoader: any;
RCRE_componentDriver: any;
RCRE_AXIOS_REQUEST_COOKIE: string;
RCRE_AXIOS_REQUEST_BASEURI: string;
/**
* 请求缓存,根据URL, method缓存接口请求,如果接口在参数相同的情况下,返回一定相同,则可以在测试环境中使用
*/
__RCRE_TEST_REQUEST_CACHE__: boolean;
RCRE_filter: any;
loadRightBar: () => void;
RCRE_clearStore: any;
}

declare var __VERSION__: any;

interface System {
import (request: string): Promise<any>;
}
declare var System: System;
36 changes: 36 additions & 0 deletions packages/rcre/package.json
@@ -0,0 +1,36 @@
{
"name": "rcre",
"version": "0.19.150",
"main": "./dist/index.js",
"typings": "./dist/src/index.d.ts",
"repository": "https://github.com/andycall/RCRE",
"homepage": "/",
"proxy": {
"/proxy": {
"target": "http://localhost:8844"
},
"/api": {
"target": "http://localhost:8844"
}
},
"dependencies": {
"acorn": "^5.3.0",
"axios": "^0.16.2",
"bowser": "1.9.4",
"classnames": "^2.2.5",
"events": "^3.0.0",
"lodash": "^4.17.4",
"lru-cache": "5.1.1",
"moment": "^2.20.1",
"prop-types": "^15.7.2",
"qs": "^6.5.2",
"react": ">=16",
"react-dom": ">=16",
"react-redux": "^5.0.7",
"redux": "^3.7.2"
},
"devDependencies": {
"chalk": "^2.4.1"
},
"license": "Apache-2.0"
}
70 changes: 70 additions & 0 deletions packages/rcre/src/core/Connect/Common/Common.tsx
@@ -0,0 +1,70 @@
import React from 'react';
import {BasicConfig} from '../../Container/types';
import {BasicConnect, BasicConnectPropsInterface, CommonOptions, WrapperComponentType} from '../basicConnect';

const defaultMappingProps = {};

export function commonConnect(options: CommonOptions = {}):
(WrapperComponent: WrapperComponentType<any>) => React.ComponentClass {
return (WrapperComponent) => {
class CommonConnect<Config extends BasicConfig> extends BasicConnect<Config, {}> {
static displayName: string;
private mapping = defaultMappingProps;
constructor(props: BasicConnectPropsInterface<Config>, context: object) {
super(props, context, options);
this.mapping = {
...this.mapping,
...options.propsMapping
};
}

render() {
let {
props,
info,
runTime,
registerEvent,
updateNameValue,
getNameValue
} = this.prepareRender(options);

let changeCallBack = options.defaultNameCallBack || 'onChange';
props[changeCallBack] = (value: any) => updateNameValue(value);

this.applyPropsMapping(props, this.mapping);

CommonConnect.displayName = `RCREConnect(${this.props.info.type})`;
WrapperComponent.displayName = `RCRE(${this.props.info.type})`;

let children = (
<WrapperComponent
{...this.props.injectEvents}
{...props}
tools={{
debounceCache: this.debounceCache,
isDebouncing: this.isDebouncing,
runTime: runTime,
env: this.props,
clearNameValue: this.clearNameValue,
updateNameValue: updateNameValue,
registerEvent: registerEvent,
createReactNode: this.createReactNode,
hasTriggerEvent: this.hasTriggerEvent,
getNameValue: getNameValue,
form: {
isUnderForm: !!this.props.$form,
$setFormItem: this.props.$setFormItem,
$deleteFormItem: this.props.$deleteFormItem,
$getFormItem: this.getFormItemControl
}
}}
/>
);

return this.renderChildren(info, children);
}
}

return CommonConnect;
};
}

0 comments on commit 82b56f4

Please sign in to comment.