From f733c52db97e73f25d4657d86e0a08b96634e923 Mon Sep 17 00:00:00 2001
From: afeiship <1290657123@qq.com>
Date: Wed, 24 May 2017 21:14:04 +0800
Subject: [PATCH] udpate pkg&docs scripts
---
README.MD | 106 ++++++++++++++++++++++---
_README.MD | 19 +++++
build/auto-readme.js | 25 ++++++
dist/react-status-manager.js.map | 2 +-
package.json | 4 +-
src/components/react-status-manager.js | 2 +
src/dev.js | 22 ++++-
src/dev.scss | 10 +++
8 files changed, 175 insertions(+), 15 deletions(-)
create mode 100644 _README.MD
create mode 100644 build/auto-readme.js
diff --git a/README.MD b/README.MD
index c6b60e4..215bca4 100644
--- a/README.MD
+++ b/README.MD
@@ -2,19 +2,103 @@
> React component for status manager.
-## resource:
-+ http://www.cnblogs.com/Kummy/p/4966937.html
-+ https://github.com/steven5538/vue-button
-+ https://yarnpkg.com/en/docs/install
-
+## properties:
+```javascript
-## props:
-| name | type | value | description |
-| :----| :----| :----| :----|
-| visible | Boolean | true/false | v-show |
+ static propTypes = {
+ className:PropTypes.string,
+ statusList:PropTypes.array
+ };
+ static defaultProps = {
+ statusList:[]
+ };
+
+```
## usage:
-```html
-
+```jsx
+class App extends React.Component{
+ constructor(props){
+ super(props);
+ this.state = {
+ status:'init',
+ smStatus:'N',
+ step:0,
+ };
+ }
+
+ click1 = (e)=>{
+ this.setState({status:'init'});
+ console.log('click1');
+ }
+ click2 = (e)=>{
+ this.setState({status:'active'});
+ console.log('click2');
+ }
+ click3 = (e)=>{
+ this.setState({status:'running'});
+ console.log('click3');
+ }
+ click4 = (e)=>{
+ this.setState({status:'finish'});
+ console.log('click4');
+ }
+
+ _click5 =(e)=>{
+ this.setState({
+ smStatus:'A'
+ })
+ };
+
+ _clickStep = (e) =>{
+ let step = this.state.step;
+ this.setState({
+ step: step ===3 ? 0: step+1
+ })
+ };
+
+ render(){
+ return (
+
+
+ 下拉刷新
+ 释放更新
+
+ 更新完毕
+
+
+
+
+ 未开始
+ 进行中
+ 已经结束
+
+
+
+
+
+
+
+
+
+
Wizard
+
+
+ step1,input password
+ step2,input phone
+ step3,input other info
+ step4,do submit!
+
+
+ );
+ }
+}
+
```
+
+
+
+## resource:
++ http://ionicframework.com/docs/components/#full-buttons
+
diff --git a/_README.MD b/_README.MD
new file mode 100644
index 0000000..900a94f
--- /dev/null
+++ b/_README.MD
@@ -0,0 +1,19 @@
+# react-status-manager
+> React component for status manager.
+
+
+## properties:
+```javascript
+BACKUP_PROPERTIES
+```
+
+## usage:
+```jsx
+BACKUP_USAGE
+```
+
+
+
+## resource:
++ http://ionicframework.com/docs/components/#full-buttons
+
diff --git a/build/auto-readme.js b/build/auto-readme.js
new file mode 100644
index 0000000..9284984
--- /dev/null
+++ b/build/auto-readme.js
@@ -0,0 +1,25 @@
+const fs = require('fs');
+const path = require('path');
+const fileRegExp = require('file-regexp');
+const exampleRE = /\/\*===example start===\*\/\n([a-zA-Z.{\s()<="-<_>}?:+0-9\[\]\u4E00-\u9FA5`!]*)\/\*===example end===\*\//;
+const templateRE = /\/\*===properties start===\*\/([()\[\]\w\s={}:.;,'"]*)\/\*===properties end===\*\//;
+
+const targetPropsRE = /## properties:\n```javascript\n(.*)\n```/;
+const targetUsageRE = /## usage:\n```jsx\n(.*)\n```/;
+
+let readmeFile = path.join(__dirname,'../README.MD');
+let _readmeFile = path.join(__dirname,'../_README.MD');
+let exampleFile = path.join(__dirname,'../src/dev.js');
+let templateFile = path.join(__dirname,'../src/components/react-status-manager.js');
+
+
+
+let exampleRs = fileRegExp.fileGetContent(exampleFile,exampleRE);
+let templateRs = fileRegExp.fileGetContent(templateFile,templateRE);
+
+// set default readme file:
+fs.writeFileSync(readmeFile, fs.readFileSync(_readmeFile,'utf-8'));
+
+//do replace:
+fileRegExp.fileReplaceContent(readmeFile,targetPropsRE,templateRs);
+fileRegExp.fileReplaceContent(readmeFile,targetUsageRE,exampleRs);
diff --git a/dist/react-status-manager.js.map b/dist/react-status-manager.js.map
index 6c50fd7..5248222 100644
--- a/dist/react-status-manager.js.map
+++ b/dist/react-status-manager.js.map
@@ -1 +1 @@
-{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///react-status-manager.js","webpack:///webpack/bootstrap 884dbe16afa8de9e4ab3","webpack:///./src/main.js","webpack:///external \"react\"","webpack:///./src/components/react-status-manager.js","webpack:///external \"classnames\"","webpack:///external \"prop-types\""],"names":["root","factory","exports","module","require","define","amd","this","__WEBPACK_EXTERNAL_MODULE_1__","__WEBPACK_EXTERNAL_MODULE_3__","__WEBPACK_EXTERNAL_MODULE_4__","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","_interopRequireDefault","obj","__esModule","default","Object","defineProperty","value","_reactStatusManager","_reactStatusManager2","React","_objectWithoutProperties","keys","target","i","indexOf","prototype","hasOwnProperty","_classCallCheck","instance","Constructor","TypeError","_possibleConstructorReturn","self","ReferenceError","_inherits","subClass","superClass","create","constructor","enumerable","writable","configurable","setPrototypeOf","__proto__","undefined","_extends","assign","arguments","length","source","key","_createClass","defineProperties","props","descriptor","protoProps","staticProps","_react","_propTypes","_propTypes2","_classnames","_classnames2","_default","_PureComponent","getPrototypeOf","apply","_props","className","status","statusList","children","size","createElement","data-status","map","child","index","PureComponent","propTypes","string","array","defaultProps"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,EAAAG,QAAA,SAAAA,QAAA,cAAAA,QAAA,eACA,kBAAAC,gBAAAC,IACAD,QAAA,mCAAAJ,GACA,gBAAAC,SACAA,QAAA,mBAAAD,EAAAG,QAAA,SAAAA,QAAA,cAAAA,QAAA,eAEAJ,EAAA,mBAAAC,EAAAD,EAAA,MAAAA,EAAA,WAAAA,EAAA,gBACCO,KAAA,SAAAC,EAAAC,EAAAC,GACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAX,OAGA,IAAAC,GAAAW,EAAAD,IACAX,WACAa,GAAAF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OAAQC,EADrBH,EACqBG,WAAkBC,GADvCJ,EACiCK,KADjCL,EACuCI,UAAYjB,EADnDjC,EAAA8C,GAAA,qDAEN,OACE/C,GAAAqD,cAAA,MAAA3B,GACAsB,WAAW,EAAAN,EAAAhD,SAAW,uBAAuBsD,GAC7CM,cAAaL,GACTf,GAGAiB,EAASI,IAAI,SAACC,EAAMC,GAClB,MAAOR,KAAWC,EAAWO,IAAUD,SJuHzCb,GACPL,EAAOoB,cAETf,GI7IQgB,WACLX,UAAUR,EAAA9C,QAAUkE,OACpBV,WAAWV,EAAA9C,QAAUmE,OJ+IxBlB,EI5IQmB,cACLZ,eJ8IH9E,EAAQsB,QAAUiD,IACWxD,KAAKf,EAASU,EAAoB,KAI1D,SAAST,EAAQD,GK/JvBC,EAAAD,QAAAO,GLqKM,SAASN,EAAQD,GMrKvBC,EAAAD,QAAAQ","file":"react-status-manager.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"react\"), require(\"classnames\"), require(\"prop-types\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"react\", \"classnames\", \"prop-types\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ReactStatusManager\"] = factory(require(\"react\"), require(\"classnames\"), require(\"prop-types\"));\n\telse\n\t\troot[\"ReactStatusManager\"] = factory(root[\"react\"], root[\"classnames\"], root[\"prop-types\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_3__, __WEBPACK_EXTERNAL_MODULE_4__) {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"react\"), require(\"classnames\"), require(\"prop-types\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"react\", \"classnames\", \"prop-types\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ReactStatusManager\"] = factory(require(\"react\"), require(\"classnames\"), require(\"prop-types\"));\n\telse\n\t\troot[\"ReactStatusManager\"] = factory(root[\"react\"], root[\"classnames\"], root[\"prop-types\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_3__, __WEBPACK_EXTERNAL_MODULE_4__) {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"/\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _reactStatusManager = __webpack_require__(2);\n\t\n\tvar _reactStatusManager2 = _interopRequireDefault(_reactStatusManager);\n\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n\texports.default = _reactStatusManager2.default;\n\n/***/ },\n/* 1 */\n/***/ function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n/***/ },\n/* 2 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(React) {'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.default = undefined;\n\t\n\tvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\t\n\tvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\t\n\tvar _react = __webpack_require__(1);\n\t\n\tvar _propTypes = __webpack_require__(4);\n\t\n\tvar _propTypes2 = _interopRequireDefault(_propTypes);\n\t\n\tvar _classnames = __webpack_require__(3);\n\t\n\tvar _classnames2 = _interopRequireDefault(_classnames);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\tfunction _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\tfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _default = function (_PureComponent) {\n\t _inherits(_default, _PureComponent);\n\t\n\t function _default() {\n\t _classCallCheck(this, _default);\n\t\n\t return _possibleConstructorReturn(this, (_default.__proto__ || Object.getPrototypeOf(_default)).apply(this, arguments));\n\t }\n\t\n\t _createClass(_default, [{\n\t key: 'render',\n\t value: function render() {\n\t var _props = this.props,\n\t className = _props.className,\n\t status = _props.status,\n\t statusList = _props.statusList,\n\t size = _props.size,\n\t children = _props.children,\n\t props = _objectWithoutProperties(_props, ['className', 'status', 'statusList', 'size', 'children']);\n\t\n\t return React.createElement(\n\t 'div',\n\t _extends({\n\t className: (0, _classnames2.default)('react-status-manager', className),\n\t 'data-status': status\n\t }, props),\n\t children.map(function (child, index) {\n\t return status === statusList[index] && child;\n\t })\n\t );\n\t }\n\t }]);\n\t\n\t return _default;\n\t}(_react.PureComponent);\n\t\n\t_default.propTypes = {\n\t className: _propTypes2.default.string,\n\t statusList: _propTypes2.default.array\n\t};\n\t_default.defaultProps = {\n\t statusList: []\n\t};\n\texports.default = _default;\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ },\n/* 3 */\n/***/ function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_3__;\n\n/***/ },\n/* 4 */\n/***/ function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_4__;\n\n/***/ }\n/******/ ])\n});\n;\n\n\n// WEBPACK FOOTER //\n// react-status-manager.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 884dbe16afa8de9e4ab3","import ReactStatusManager from 'components/react-status-manager';\nexport default ReactStatusManager;\n\n\n\n// WEBPACK FOOTER //\n// ./src/main.js","module.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"react\"\n// module id = 1\n// module chunks = 0","import {PureComponent, createElement} from 'react';\n\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\n\nexport default class extends PureComponent{\n static propTypes = {\n className:PropTypes.string,\n statusList:PropTypes.array\n };\n\n static defaultProps = {\n statusList:[]\n };\n\n render(){\n const { className, status, statusList, size ,children,...props} = this.props;\n return (\n \n {\n children.map((child,index)=>{\n return status === statusList[index] && child;\n })\n }\n
\n );\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/react-status-manager.js","module.exports = __WEBPACK_EXTERNAL_MODULE_3__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"classnames\"\n// module id = 3\n// module chunks = 0","module.exports = __WEBPACK_EXTERNAL_MODULE_4__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"prop-types\"\n// module id = 4\n// module chunks = 0"],"sourceRoot":""}
\ No newline at end of file
+{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///react-status-manager.js","webpack:///webpack/bootstrap fb5864e45235a780d896","webpack:///./src/main.js","webpack:///external \"react\"","webpack:///./src/components/react-status-manager.js","webpack:///external \"classnames\"","webpack:///external \"prop-types\""],"names":["root","factory","exports","module","require","define","amd","this","__WEBPACK_EXTERNAL_MODULE_1__","__WEBPACK_EXTERNAL_MODULE_3__","__WEBPACK_EXTERNAL_MODULE_4__","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","_interopRequireDefault","obj","__esModule","default","Object","defineProperty","value","_reactStatusManager","_reactStatusManager2","React","_objectWithoutProperties","keys","target","i","indexOf","prototype","hasOwnProperty","_classCallCheck","instance","Constructor","TypeError","_possibleConstructorReturn","self","ReferenceError","_inherits","subClass","superClass","create","constructor","enumerable","writable","configurable","setPrototypeOf","__proto__","undefined","_extends","assign","arguments","length","source","key","_createClass","defineProperties","props","descriptor","protoProps","staticProps","_react","_propTypes","_propTypes2","_classnames","_classnames2","_default","_PureComponent","getPrototypeOf","apply","_props","className","status","statusList","children","size","createElement","data-status","map","child","index","PureComponent","propTypes","string","array","defaultProps"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,EAAAG,QAAA,SAAAA,QAAA,cAAAA,QAAA,eACA,kBAAAC,gBAAAC,IACAD,QAAA,mCAAAJ,GACA,gBAAAC,SACAA,QAAA,mBAAAD,EAAAG,QAAA,SAAAA,QAAA,cAAAA,QAAA,eAEAJ,EAAA,mBAAAC,EAAAD,EAAA,MAAAA,EAAA,WAAAA,EAAA,gBACCO,KAAA,SAAAC,EAAAC,EAAAC,GACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAX,OAGA,IAAAC,GAAAW,EAAAD,IACAX,W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ADbF,EACaE,OAAQC,EADrBH,EACqBG,WAAkBC,GADvCJ,EACiCK,KADjCL,EACuCI,UAAYjB,EADnDjC,EAAA8C,GAAA,qDAEN,OACE/C,GAAAqD,cAAA,MAAA3B,GACAsB,WAAW,EAAAN,EAAAhD,SAAW,uBAAuBsD,GAC7CM,cAAaL,GACTf,GAGAiB,EAASI,IAAI,SAACC,EAAMC,GAClB,MAAOR,KAAWC,EAAWO,IAAUD,SJyHzCb,GACPL,EAAOoB,cAETf,GIhJQgB,WACLX,UAAUR,EAAA9C,QAAUkE,OACpBV,WAAWV,EAAA9C,QAAUmE,OJkJxBlB,EI/IQmB,cACLZ,eJiJH9E,EAAQsB,QAAUiD,IACWxD,KAAKf,EAASU,EAAoB,KAI1D,SAAST,EAAQD,GKnKvBC,EAAAD,QAAAO,GLyKM,SAASN,EAAQD,GMzKvBC,EAAAD,QAAAQ","file":"react-status-manager.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"react\"), require(\"classnames\"), require(\"prop-types\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"react\", \"classnames\", \"prop-types\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ReactStatusManager\"] = factory(require(\"react\"), require(\"classnames\"), require(\"prop-types\"));\n\telse\n\t\troot[\"ReactStatusManager\"] = factory(root[\"react\"], root[\"classnames\"], root[\"prop-types\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_3__, __WEBPACK_EXTERNAL_MODULE_4__) {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"react\"), require(\"classnames\"), require(\"prop-types\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"react\", \"classnames\", \"prop-types\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ReactStatusManager\"] = factory(require(\"react\"), require(\"classnames\"), require(\"prop-types\"));\n\telse\n\t\troot[\"ReactStatusManager\"] = factory(root[\"react\"], root[\"classnames\"], root[\"prop-types\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_3__, __WEBPACK_EXTERNAL_MODULE_4__) {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"/\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _reactStatusManager = __webpack_require__(2);\n\t\n\tvar _reactStatusManager2 = _interopRequireDefault(_reactStatusManager);\n\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n\texports.default = _reactStatusManager2.default;\n\n/***/ },\n/* 1 */\n/***/ function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n/***/ },\n/* 2 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(React) {'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.default = undefined;\n\t\n\tvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\t\n\tvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\t\n\tvar _react = __webpack_require__(1);\n\t\n\tvar _propTypes = __webpack_require__(4);\n\t\n\tvar _propTypes2 = _interopRequireDefault(_propTypes);\n\t\n\tvar _classnames = __webpack_require__(3);\n\t\n\tvar _classnames2 = _interopRequireDefault(_classnames);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\tfunction _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\tfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _default = function (_PureComponent) {\n\t _inherits(_default, _PureComponent);\n\t\n\t function _default() {\n\t _classCallCheck(this, _default);\n\t\n\t return _possibleConstructorReturn(this, (_default.__proto__ || Object.getPrototypeOf(_default)).apply(this, arguments));\n\t }\n\t\n\t _createClass(_default, [{\n\t key: 'render',\n\t\n\t /*===properties end===*/\n\t\n\t /*===properties start===*/\n\t value: function render() {\n\t var _props = this.props,\n\t className = _props.className,\n\t status = _props.status,\n\t statusList = _props.statusList,\n\t size = _props.size,\n\t children = _props.children,\n\t props = _objectWithoutProperties(_props, ['className', 'status', 'statusList', 'size', 'children']);\n\t\n\t return React.createElement(\n\t 'div',\n\t _extends({\n\t className: (0, _classnames2.default)('react-status-manager', className),\n\t 'data-status': status\n\t }, props),\n\t children.map(function (child, index) {\n\t return status === statusList[index] && child;\n\t })\n\t );\n\t }\n\t }]);\n\t\n\t return _default;\n\t}(_react.PureComponent);\n\t\n\t_default.propTypes = {\n\t className: _propTypes2.default.string,\n\t statusList: _propTypes2.default.array\n\t};\n\t_default.defaultProps = {\n\t statusList: []\n\t};\n\texports.default = _default;\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ },\n/* 3 */\n/***/ function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_3__;\n\n/***/ },\n/* 4 */\n/***/ function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_4__;\n\n/***/ }\n/******/ ])\n});\n;\n\n\n// WEBPACK FOOTER //\n// react-status-manager.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap fb5864e45235a780d896","import ReactStatusManager from 'components/react-status-manager';\nexport default ReactStatusManager;\n\n\n\n// WEBPACK FOOTER //\n// ./src/main.js","module.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"react\"\n// module id = 1\n// module chunks = 0","import {PureComponent, createElement} from 'react';\n\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\n\nexport default class extends PureComponent{\n /*===properties start===*/\n static propTypes = {\n className:PropTypes.string,\n statusList:PropTypes.array\n };\n\n static defaultProps = {\n statusList:[]\n };\n /*===properties end===*/\n\n render(){\n const { className, status, statusList, size ,children,...props} = this.props;\n return (\n \n {\n children.map((child,index)=>{\n return status === statusList[index] && child;\n })\n }\n
\n );\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/react-status-manager.js","module.exports = __WEBPACK_EXTERNAL_MODULE_3__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"classnames\"\n// module id = 3\n// module chunks = 0","module.exports = __WEBPACK_EXTERNAL_MODULE_4__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"prop-types\"\n// module id = 4\n// module chunks = 0"],"sourceRoot":""}
\ No newline at end of file
diff --git a/package.json b/package.json
index c865c61..14962be 100644
--- a/package.json
+++ b/package.json
@@ -24,7 +24,8 @@
"homepage": "https://github.com/afeiship/react-status-manager",
"scripts": {
"dev": "node build/dev-server.js",
- "build": "node build/build.js"
+ "build": "node build/build.js",
+ "docs": "node build/auto-readme.js"
},
"main": "./dist/react-status-manager.js",
"devDependencies": {
@@ -54,6 +55,7 @@
"express": "^4.13.3",
"extract-text-webpack-plugin": "^1.0.1",
"file-loader": "^0.9.0",
+ "file-regexp": "github:afeiship/file-regexp",
"function-bind": "^1.0.2",
"html-loader": "^0.4.4",
"html-webpack-plugin": "^2.8.1",
diff --git a/src/components/react-status-manager.js b/src/components/react-status-manager.js
index e7fa3cf..8ca38f3 100644
--- a/src/components/react-status-manager.js
+++ b/src/components/react-status-manager.js
@@ -4,6 +4,7 @@ import PropTypes from 'prop-types';
import classNames from 'classnames';
export default class extends PureComponent{
+ /*===properties start===*/
static propTypes = {
className:PropTypes.string,
statusList:PropTypes.array
@@ -12,6 +13,7 @@ export default class extends PureComponent{
static defaultProps = {
statusList:[]
};
+ /*===properties end===*/
render(){
const { className, status, statusList, size ,children,...props} = this.props;
diff --git a/src/dev.js b/src/dev.js
index b563485..49c7e83 100644
--- a/src/dev.js
+++ b/src/dev.js
@@ -3,12 +3,14 @@ import './dev.scss';
import ReactStatusManager from './main';
import loadingImg from 'assets/loading.svg';
+/*===example start===*/
class App extends React.Component{
constructor(props){
super(props);
this.state = {
status:'init',
- smStatus:'N'
+ smStatus:'N',
+ step:0,
};
}
@@ -35,6 +37,13 @@ class App extends React.Component{
})
};
+ _clickStep = (e) =>{
+ let step = this.state.step;
+ this.setState({
+ step: step ===3 ? 0: step+1
+ })
+ };
+
render(){
return (
@@ -58,11 +67,20 @@ class App extends React.Component{
+
+
Wizard
+
+
+ step1,input password
+ step2,input phone
+ step3,input other info
+ step4,do submit!
+
);
}
}
-
+/*===example end===*/
ReactDOM.render(
,
diff --git a/src/dev.scss b/src/dev.scss
index d9e50ab..f9c0164 100644
--- a/src/dev.scss
+++ b/src/dev.scss
@@ -40,4 +40,14 @@ ul,li{list-style: none;}
outline: none;
}
}
+
+ .step{
+ background: #f60;
+ color:#fff;
+ padding:10px;
+ button{
+ width:30%;
+ padding:10px;
+ }
+ }
}