Comparing version 1.3.0 to 1.3.1
@@ -31,2 +31,3 @@ "use strict"; | ||
default_1.prototype.marquee = function (root, step) { | ||
var container = $('#' + this.id).parent(); | ||
root.animate({ | ||
@@ -36,2 +37,5 @@ marginTop: '-=1' | ||
var s = Math.abs(parseInt($(this).css("margin-top"))); | ||
// container.css({ | ||
// height:'calc(100% + )' | ||
// }) | ||
if (s >= step) { | ||
@@ -56,4 +60,6 @@ $(this).find('li').slice(0, 1).appendTo($(this)); | ||
if (sh * root.children().length <= root.height()) { | ||
window.clearInterval(interval); | ||
return; | ||
if (!this.props.alaysScroll) { | ||
window.clearInterval(interval); | ||
return; | ||
} | ||
} | ||
@@ -80,3 +86,3 @@ var speed = this.props.speed || 50; | ||
var _this = this; | ||
return React.createElement("ul", { id: this.id, className: this.props.className, style: { width: '100%', height: '100%', overflow: 'hidden' } }, this.props.list.map(function (item) { return _this.props.render(item); })); | ||
return React.createElement("ul", { id: this.id, className: this.props.className, style: { width: '100%', height: '100%' } }, this.props.list.map(function (item) { return _this.props.render(item); })); | ||
}; | ||
@@ -83,0 +89,0 @@ return default_1; |
{ | ||
"name": "vap", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "vap", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -38,2 +38,8 @@ "use strict"; | ||
/** | ||
* 清空缓存 | ||
*/ | ||
function sessionClear() { | ||
session.clear(); | ||
} | ||
/** | ||
* 删除SESSION缓存 | ||
@@ -40,0 +46,0 @@ */ |
export default abstract class { | ||
/** | ||
* 字符串截取,把字符串按最大长度进行截取 | ||
* @param txt 需要截取的字符串 | ||
* @param len 最大长度,默认为20 | ||
* @param hasDot 超长后是否以 `...` 进行结尾,默认为 `true` | ||
* | ||
*/ | ||
static formatString(txt: string, len?: number, hasDot?: boolean): string; | ||
/** | ||
* @param number 一个数字 | ||
@@ -4,0 +12,0 @@ * @return 格式化后的字符串 |
@@ -15,2 +15,35 @@ "use strict"; | ||
/** | ||
* 字符串截取,把字符串按最大长度进行截取 | ||
* @param txt 需要截取的字符串 | ||
* @param len 最大长度,默认为20 | ||
* @param hasDot 超长后是否以 `...` 进行结尾,默认为 `true` | ||
* | ||
*/ | ||
default_1.formatString = function (txt, len, hasDot) { | ||
if (len === void 0) { len = 20; } | ||
if (hasDot === void 0) { hasDot = true; } | ||
var newLength = 0; | ||
var newStr = []; | ||
var chineseRegex = /[^\x00-\xff]/g; | ||
var singleChar = ""; | ||
var strLength = txt.replace(chineseRegex, "**").length; | ||
for (var i = 0; i < strLength; i++) { | ||
singleChar = txt.charAt(i).toString(); | ||
if (singleChar.match(chineseRegex) !== null) { | ||
newLength += 2; | ||
} | ||
else { | ||
newLength++; | ||
} | ||
if (newLength > len) { | ||
break; | ||
} | ||
newStr.push(singleChar); | ||
} | ||
if (hasDot && strLength > len) { | ||
newStr.push("..."); | ||
} | ||
return newStr.join(''); | ||
}; | ||
/** | ||
* @param number 一个数字 | ||
@@ -17,0 +50,0 @@ * @return 格式化后的字符串 |
@@ -7,1 +7,2 @@ export { default as Ajax } from './Ajax'; | ||
export { default as Format } from './Format'; | ||
export { default as Page } from './Page'; |
@@ -15,1 +15,3 @@ "use strict"; | ||
exports.Format = Format_1.default; | ||
var Page_1 = require("./Page"); | ||
exports.Page = Page_1.default; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var React = require("react"); | ||
var Format_1 = require("./Format"); | ||
var _ = require("lodash"); | ||
@@ -18,24 +19,3 @@ var antd_1 = require("antd"); | ||
var fn = function (str) { | ||
var newLength = 0; | ||
var newStr = []; | ||
var chineseRegex = /[^\x00-\xff]/g; | ||
var singleChar = ""; | ||
var strLength = str.replace(chineseRegex, "**").length; | ||
for (var i = 0; i < strLength; i++) { | ||
singleChar = str.charAt(i).toString(); | ||
if (singleChar.match(chineseRegex) !== null) { | ||
newLength += 2; | ||
} | ||
else { | ||
newLength++; | ||
} | ||
if (newLength > len) { | ||
break; | ||
} | ||
newStr.push(singleChar); | ||
} | ||
if (hasDot && strLength > len) { | ||
newStr.push("..."); | ||
} | ||
return React.createElement("span", { className: className }, newStr.join('')); | ||
return React.createElement("span", { className: className }, Format_1.default.formatString(str, len, hasDot)); | ||
}; | ||
@@ -42,0 +22,0 @@ return fn; |
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
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
194130
87
5148