ac-upload
Advanced tools
Comparing version 0.1.6 to 0.1.7
145
lib/index.js
@@ -7,2 +7,6 @@ 'use strict'; | ||
var _from = require('babel-runtime/core-js/array/from'); | ||
var _from2 = _interopRequireDefault(_from); | ||
var _defineProperty = require('babel-runtime/core-js/object/define-property'); | ||
@@ -36,2 +40,28 @@ | ||
var _zh = require('react-intl/locale-data/zh'); | ||
var _zh2 = _interopRequireDefault(_zh); | ||
var _en = require('react-intl/locale-data/en'); | ||
var _en2 = _interopRequireDefault(_en); | ||
var _zh_CN = require('./locale/zh_CN.js'); | ||
var _zh_CN2 = _interopRequireDefault(_zh_CN); | ||
var _en_US = require('./locale/en_US.js'); | ||
var _en_US2 = _interopRequireDefault(_en_US); | ||
var _zh_TW = require('./locale/zh_TW.js'); | ||
var _zh_TW2 = _interopRequireDefault(_zh_TW); | ||
var _reactIntl = require('react-intl'); | ||
var _reactCookies = require('react-cookies'); | ||
var _reactCookies2 = _interopRequireDefault(_reactCookies); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -45,2 +75,25 @@ | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return (0, _from2.default)(arr); } } | ||
(0, _reactIntl.addLocaleData)([].concat(_toConsumableArray(_en2.default), _toConsumableArray(_zh2.default))); | ||
var messages = {}; | ||
messages['en'] = _en_US2.default; | ||
messages['en-US'] = _en_US2.default; | ||
messages['en_US'] = _en_US2.default; | ||
messages['zh'] = _zh_CN2.default; | ||
messages['zh-CN'] = _zh_CN2.default; | ||
messages['zh_CN'] = _zh_CN2.default; | ||
messages['zh-TW'] = _zh_TW2.default; | ||
messages['zh_TW'] = _zh_TW2.default; | ||
var localeMap = { | ||
'en-US': 'en', | ||
'en_US': 'en', | ||
'zh-CN': 'zh', | ||
'zh_CN': 'zh', | ||
'zh-TW': 'zh', | ||
'zh_TW': 'zh' | ||
}; | ||
var propTypes = { | ||
@@ -150,58 +203,65 @@ title: _propTypes2.default.string, | ||
}; | ||
var localeSrc = this.props.locale || _reactCookies2.default.load('u_locale') || 'zh'; | ||
var locale = localeMap[localeSrc] || localeSrc; | ||
return _react2.default.createElement( | ||
'span', | ||
{ className: 'ac-upload-wrap' }, | ||
_reactIntl.IntlProvider, | ||
{ locale: locale, messages: messages[localeSrc] }, | ||
_react2.default.createElement( | ||
'span', | ||
{ onClick: this.showModeHandler }, | ||
this.props.children | ||
), | ||
_react2.default.createElement( | ||
_tinperBee.Modal, | ||
{ | ||
dialogClassName: 'ac-upload-modal', | ||
backdrop: false, | ||
autoFocus: false, | ||
enforceFocus: false, | ||
show: this.state.show, | ||
onHide: this.hideModelHandler }, | ||
{ className: 'ac-upload-wrap' }, | ||
_react2.default.createElement( | ||
_tinperBee.Modal.Header, | ||
{ | ||
closeButton: true }, | ||
_react2.default.createElement( | ||
_tinperBee.Modal.Title, | ||
null, | ||
this.props.title | ||
) | ||
'span', | ||
{ onClick: this.showModeHandler }, | ||
this.props.children | ||
), | ||
_react2.default.createElement( | ||
_tinperBee.Modal.Body, | ||
null, | ||
_tinperBee.Modal, | ||
{ | ||
dialogClassName: 'ac-upload-modal', | ||
backdrop: false, | ||
autoFocus: false, | ||
enforceFocus: false, | ||
show: this.state.show, | ||
onHide: this.hideModelHandler }, | ||
_react2.default.createElement( | ||
'div', | ||
{ className: 'ac-upload-wrap' }, | ||
_tinperBee.Modal.Header, | ||
{ | ||
closeButton: true }, | ||
_react2.default.createElement( | ||
_tinperBee.Upload, | ||
uploadProps, | ||
!this.props.isView && _react2.default.createElement( | ||
_tinperBee.Modal.Title, | ||
null, | ||
_react2.default.createElement(_reactIntl.FormattedMessage, { id: 'intl.title', defaultMessage: this.props.title }) | ||
) | ||
), | ||
_react2.default.createElement( | ||
_tinperBee.Modal.Body, | ||
null, | ||
_react2.default.createElement( | ||
'div', | ||
{ className: 'ac-upload-wrap' }, | ||
_react2.default.createElement( | ||
_tinperBee.Upload, | ||
uploadProps, | ||
!this.props.isView && _react2.default.createElement( | ||
'div', | ||
{ className: 'opeat' }, | ||
_react2.default.createElement('div', { className: 'svg-ready' }), | ||
_react2.default.createElement( | ||
'div', | ||
{ className: 'upload-tips' }, | ||
_react2.default.createElement(_reactIntl.FormattedMessage, { id: 'intl.msg.upload' }) | ||
) | ||
) | ||
), | ||
this.props.isView && this.props.defaultFileList.length == 0 && _react2.default.createElement( | ||
'div', | ||
{ className: 'opeat' }, | ||
_react2.default.createElement('div', { className: 'svg-ready' }), | ||
_react2.default.createElement('div', { className: 'svg-no-pic' }), | ||
_react2.default.createElement( | ||
'div', | ||
{ className: 'upload-tips' }, | ||
'\u70B9\u51FB\u9009\u62E9\u4E0A\u4F20\u6587\u4EF6' | ||
{ style: { "fontSize": "14px" }, className: 'upload-tips' }, | ||
_react2.default.createElement(_reactIntl.FormattedMessage, { id: 'intl.msg.empty' }) | ||
) | ||
) | ||
), | ||
this.props.isView && this.props.defaultFileList.length == 0 && _react2.default.createElement( | ||
'div', | ||
{ className: 'opeat' }, | ||
_react2.default.createElement('div', { className: 'svg-no-pic' }), | ||
_react2.default.createElement( | ||
'div', | ||
{ style: { "fontSize": "14px" }, className: 'upload-tips' }, | ||
'\u6682\u65E0\u9644\u4EF6' | ||
) | ||
) | ||
@@ -231,2 +291,3 @@ ) | ||
}; | ||
exports.default = AcUpload; |
{ | ||
"name": "ac-upload", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"description": "tinper-bee ac upload components", | ||
@@ -10,3 +10,4 @@ "main": "./lib/index.js", | ||
"build": "rm -rf build && rm -rf lib && rm -rf dist && babel src -d lib --no-comments", | ||
"bundle": "webpack --progress --mode=development && webpack --progress -p --output-filename ac-upload.min.js" | ||
"bundle": "webpack --progress --mode=development && webpack --progress -p --output-filename ac-upload.min.js", | ||
"all": "npm run build && npm run bundle" | ||
}, | ||
@@ -58,3 +59,7 @@ "keywords": [ | ||
"webpack-cli": "^3.1.0" | ||
}, | ||
"dependencies": { | ||
"react-cookies": "^0.1.0", | ||
"react-intl": "^2.8.0" | ||
} | ||
} |
@@ -59,6 +59,7 @@ ## AC-Upload | ||
7|name|string|上传设置的参数file名字默认`files[]` | ||
8|onSuccess|function|上传成功后的回调,返回所有response | ||
9|onError|function|上传失败后的回调,用于处理后续失败操作 | ||
10|maxSize|number|附件限制大小 | ||
11|onDelete|function|删除的时候触发的回调参数为file对象 | ||
12|beforeUpload|function|在上传之前执行的函数,当Promise返回false或者被拒绝,函数被中指。不兼容老ie | ||
8|locale|string|语言设置选项,默认为简体中文(zh_CN),目前支持简体中文(zh_CN),繁体中文(zh_TW),英文(en_US)三种 | ||
9|onSuccess|function|上传成功后的回调,返回所有response | ||
10|onError|function|上传失败后的回调,用于处理后续失败操作 | ||
11|maxSize|number|附件限制大小 | ||
12|onDelete|function|删除的时候触发的回调参数为file对象 | ||
13|beforeUpload|function|在上传之前执行的函数,当Promise返回false或者被拒绝,函数被中指。不兼容老ie |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
568969
11
3050
64
2
29
109
+ Addedreact-cookies@^0.1.0
+ Addedreact-intl@^2.8.0
+ Addedcookie@0.3.1(transitive)
+ Addedhoist-non-react-statics@3.3.2(transitive)
+ Addedintl-format-cache@2.2.9(transitive)
+ Addedintl-messageformat@2.2.0(transitive)
+ Addedintl-messageformat-parser@1.4.0(transitive)
+ Addedintl-relativeformat@2.2.0(transitive)
+ Addedinvariant@2.2.4(transitive)
+ Addedjs-tokens@4.0.0(transitive)
+ Addedloose-envify@1.4.0(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedprop-types@15.8.1(transitive)
+ Addedreact@16.14.0(transitive)
+ Addedreact-cookies@0.1.1(transitive)
+ Addedreact-intl@2.9.0(transitive)
+ Addedreact-is@16.13.1(transitive)