New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@smt-ui/component

Package Overview
Dependencies
Maintainers
10
Versions
150
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@smt-ui/component - npm Package Compare versions

Comparing version 1.1.98 to 1.1.99

src/icon/dist/smt-icon/index.css

4

package.json
{
"name": "@smt-ui/component",
"version": "1.1.98",
"version": "1.1.99",
"description": "extension base",

@@ -47,3 +47,3 @@ "author": "jialipeng <jialipeng@baidu.com>",

},
"gitHead": "562bcd41a40a67b4d62f528247d639620372ee71"
"gitHead": "df0b27cb40268ec0b3149134289b1b9c91a91ae2"
}

@@ -13,8 +13,7 @@ "use strict";

function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
/**
* @file 下拉刷新
* @author LipengJia (jialipeng@baidu.com)
* @date 2019-12-19
*/
var STATUS = {

@@ -160,7 +159,9 @@ IDLE: 0,

},
touchHdl: function touchHdl(_ref2) {
var _this2 = this;
touchHdl: function () {
var _touchHdl = (0, _asyncToGenerator2["default"])(
/*#__PURE__*/
_regenerator["default"].mark(function _callee(_ref2) {
var _this2 = this;
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
var type, _ref2$touches, touches, _ref2$changedTouches, changedTouches, _ref2$manual, manual, disabled, _iterator, _step, touch, id, pageY, distance, _iterator2, _step2, _touch, _id, _pageY, offsetY, pullDown, circleInfo, setOffsetY, _iterator3, _step3, _touch2, _id2, _pageY2, shouldLoad, result;
var type, _ref2$touches, touches, _ref2$changedTouches, changedTouches, _ref2$manual, manual, disabled, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, touch, id, pageY, distance, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, _touch, _id, _pageY, offsetY, pullDown, circleInfo, setOffsetY, _iteratorNormalCompletion3, _didIteratorError3, _iteratorError3, _iterator3, _step3, _touch2, _id2, _pageY2, shouldLoad, result;

@@ -173,3 +174,3 @@ return _regenerator["default"].wrap(function _callee$(_context) {

if (!(_this2.closing || _this2.data.disableTouch && !manual)) {
if (!(this.closing || this.data.disableTouch && !manual)) {
_context.next = 3;

@@ -183,18 +184,19 @@ break;

// ue规定: 如果api调用下拉刷新,则不启用手势刷新
disabled = !_this2.data.pullToRefresh && !manual && _this2.data.status === STATUS.IDLE; // 禁用多点触控
disabled = !this.data.pullToRefresh && !manual && this.data.status === STATUS.IDLE; // 禁用多点触控
_context.t0 = type;
_context.next = _context.t0 === 'touchstart' ? 7 : _context.t0 === 'touchmove' ? 28 : _context.t0 === 'touchend' ? 44 : 56;
_context.next = _context.t0 === 'touchstart' ? 7 : _context.t0 === 'touchmove' ? 37 : _context.t0 === 'touchend' ? 70 : 99;
break;
case 7:
_this2.touching = true;
_iterator = _createForOfIteratorHelper(touches);
_context.prev = 9;
this.touching = true;
_iteratorNormalCompletion = true;
_didIteratorError = false;
_iteratorError = undefined;
_context.prev = 11;
_iterator = touches[Symbol.iterator]();
_iterator.s();
case 11:
if ((_step = _iterator.n()).done) {
_context.next = 19;
case 13:
if (_iteratorNormalCompletion = (_step = _iterator.next()).done) {
_context.next = 22;
break;

@@ -206,82 +208,128 @@ }

if (!(_this2.pos[id] == null)) {
_context.next = 17;
if (!(this.pos[id] == null)) {
_context.next = 19;
break;
}
_this2.pos[id] = pageY + _this2.scrollTop;
return _context.abrupt("break", 19);
this.pos[id] = pageY + this.scrollTop;
return _context.abrupt("break", 22);
case 17:
_context.next = 11;
case 19:
_iteratorNormalCompletion = true;
_context.next = 13;
break;
case 19:
_context.next = 24;
case 22:
_context.next = 28;
break;
case 21:
_context.prev = 21;
_context.t1 = _context["catch"](9);
_iterator.e(_context.t1);
case 24:
_context.prev = 24;
_context.t1 = _context["catch"](11);
_didIteratorError = true;
_iteratorError = _context.t1;
_iterator.f();
case 28:
_context.prev = 28;
_context.prev = 29;
return _context.finish(24);
if (!_iteratorNormalCompletion && _iterator["return"] != null) {
_iterator["return"]();
}
case 27:
return _context.abrupt("break", 56);
case 31:
_context.prev = 31;
case 28:
if (!_didIteratorError) {
_context.next = 34;
break;
}
throw _iteratorError;
case 34:
return _context.finish(31);
case 35:
return _context.finish(28);
case 36:
return _context.abrupt("break", 99);
case 37:
distance = 0;
_iterator2 = _createForOfIteratorHelper(touches);
_iteratorNormalCompletion2 = true;
_didIteratorError2 = false;
_iteratorError2 = undefined;
_context.prev = 41;
try {
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
_touch = _step2.value;
_id = _touch.identifier, _pageY = _touch.pageY;
for (_iterator2 = touches[Symbol.iterator](); !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
_touch = _step2.value;
_id = _touch.identifier, _pageY = _touch.pageY;
if (_this2.pos[_id]) {
distance += Math.round(_pageY - _this2.pos[_id]);
}
if (this.pos[_id]) {
distance += Math.round(_pageY - this.pos[_id]);
}
} catch (err) {
_iterator2.e(err);
} finally {
_iterator2.f();
}
offsetY = _this2.offsetY = _this2.dumping(distance + _this2.lastOffsetY);
_context.next = 49;
break;
case 45:
_context.prev = 45;
_context.t2 = _context["catch"](41);
_didIteratorError2 = true;
_iteratorError2 = _context.t2;
case 49:
_context.prev = 49;
_context.prev = 50;
if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) {
_iterator2["return"]();
}
case 52:
_context.prev = 52;
if (!_didIteratorError2) {
_context.next = 55;
break;
}
throw _iteratorError2;
case 55:
return _context.finish(52);
case 56:
return _context.finish(49);
case 57:
offsetY = this.offsetY = this.dumping(distance + this.lastOffsetY);
pullDown = distance > 0; // 没loading动画时下拉计算动画
if (_this2.data.status === STATUS.IDLE) {
circleInfo = (0, _index.calcCircle)(offsetY, _this2.data.loadingHeight);
circleInfo && _this2.setData(circleInfo);
if (this.data.status === STATUS.IDLE) {
circleInfo = (0, _index.calcCircle)(offsetY, this.data.loadingHeight);
circleInfo && this.setData(circleInfo);
} // 还未加载时,向上划要收起loading
if (!(!pullDown && _this2.data.status !== STATUS.IDLE && Math.abs(offsetY) > 20)) {
_context.next = 40;
if (!(!pullDown && this.data.status !== STATUS.IDLE && Math.abs(offsetY) > 20)) {
_context.next = 66;
break;
}
_this2.fadeCircle();
_this2.setData({
this.fadeCircle();
this.setData({
status: STATUS.IDLE,
offsetY: 0
});
_this2.triggerEvent('statuschange', STATUS.IDLE);
_this2.lastOffsetY = _this2.offsetY = 0;
this.triggerEvent('statuschange', STATUS.IDLE);
this.lastOffsetY = this.offsetY = 0;
return _context.abrupt("return");
case 40:
case 66:
if (!disabled) {
_context.next = 42;
_context.next = 68;
break;

@@ -292,6 +340,6 @@ }

case 42:
case 68:
// offsetY快,setData慢,可能造成向上划没到顶。
// 要注意 初始就向下划,过滤掉
if (offsetY > 0 || _this2.data.offsetY > 0) {
if (offsetY > 0 || this.data.offsetY > 0) {
setOffsetY = function setOffsetY() {

@@ -304,6 +352,6 @@ return _this2.setData({

if (!_this2.data.enableScroll) {
if (!this.data.enableScroll) {
setOffsetY();
} else {
_this2.setData({
this.setData({
// 该setData 不会多次执行

@@ -315,24 +363,55 @@ enableScroll: false

return _context.abrupt("break", 56);
return _context.abrupt("break", 99);
case 44:
_iterator3 = _createForOfIteratorHelper(changedTouches);
case 70:
_iteratorNormalCompletion3 = true;
_didIteratorError3 = false;
_iteratorError3 = undefined;
_context.prev = 73;
try {
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
_touch2 = _step3.value;
_id2 = _touch2.identifier, _pageY2 = _touch2.pageY;
for (_iterator3 = changedTouches[Symbol.iterator](); !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
_touch2 = _step3.value;
_id2 = _touch2.identifier, _pageY2 = _touch2.pageY;
if (_this2.pos[_id2]) {
_this2.lastOffsetY += _pageY2 - _this2.pos[_id2];
}
if (this.pos[_id2]) {
this.lastOffsetY += _pageY2 - this.pos[_id2];
}
} catch (err) {
_iterator3.e(err);
} finally {
_iterator3.f();
}
_context.next = 81;
break;
case 77:
_context.prev = 77;
_context.t3 = _context["catch"](73);
_didIteratorError3 = true;
_iteratorError3 = _context.t3;
case 81:
_context.prev = 81;
_context.prev = 82;
if (!_iteratorNormalCompletion3 && _iterator3["return"] != null) {
_iterator3["return"]();
}
case 84:
_context.prev = 84;
if (!_didIteratorError3) {
_context.next = 87;
break;
}
throw _iteratorError3;
case 87:
return _context.finish(84);
case 88:
return _context.finish(81);
case 89:
if (!(touches.length || disabled)) {
_context.next = 48;
_context.next = 91;
break;

@@ -343,7 +422,7 @@ }

case 48:
_this2.touching = false;
_this2.pos = {}; // 判断是否加载
case 91:
this.touching = false;
this.pos = {}; // 判断是否加载
shouldLoad = _this2.scrollTop <= 0 && _this2.offsetY >= _this2.data.loadingHeight;
shouldLoad = this.scrollTop <= 0 && this.offsetY >= this.data.loadingHeight;
result = 0;

@@ -353,19 +432,17 @@

// 只有status === 0时,触发加载
if (_this2.data.status === STATUS.IDLE) {
_this2.triggerEvent('refresh');
_this2.setData({
if (this.data.status === STATUS.IDLE) {
this.triggerEvent('refresh');
this.setData({
status: STATUS.LOADING
});
_this2.triggerEvent('statuschange', STATUS.LOADING);
this.triggerEvent('statuschange', STATUS.LOADING);
}
_this2.startRefreshTime = Date.now();
result = _this2.data.loadingHeight;
this.startRefreshTime = Date.now();
result = this.data.loadingHeight;
} else {
_this2.fadeCircle();
this.fadeCircle();
}
_this2.setData({
this.setData({
enableScroll: true

@@ -377,7 +454,6 @@ }, function () {

});
this.lastOffsetY = this.offsetY = result;
return _context.abrupt("break", 99);
_this2.lastOffsetY = _this2.offsetY = result;
return _context.abrupt("break", 56);
case 56:
case 99:
case "end":

@@ -387,6 +463,12 @@ return _context.stop();

}
}, _callee, null, [[9, 21, 24, 27]]);
}))();
},
}, _callee, this, [[11, 24, 28, 36], [29,, 31, 35], [41, 45, 49, 57], [50,, 52, 56], [73, 77, 81, 89], [82,, 84, 88]]);
}));
function touchHdl(_x) {
return _touchHdl.apply(this, arguments);
}
return touchHdl;
}(),
/**

@@ -412,6 +494,6 @@ * circle渐隐

*/
closeLoading: function closeLoading() {
var _this4 = this;
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
closeLoading: function () {
var _closeLoading = (0, _asyncToGenerator2["default"])(
/*#__PURE__*/
_regenerator["default"].mark(function _callee2() {
return _regenerator["default"].wrap(function _callee2$(_context2) {

@@ -422,7 +504,6 @@ while (1) {

// 防止关闭后,touchend还在触发中
_this4.closing = true;
this.closing = true;
this.debCloseLoading.cancel();
_this4.debCloseLoading.cancel();
if (_this4.data.enableScroll) {
if (this.data.enableScroll) {
_context2.next = 5;

@@ -433,3 +514,3 @@ break;

_context2.next = 5;
return (0, _index.syncSetData)(_this4, {
return (0, _index.syncSetData)(this, {
enableScroll: true

@@ -440,3 +521,3 @@ });

_context2.next = 7;
return (0, _index.syncSetData)(_this4, {
return (0, _index.syncSetData)(this, {
offsetY: 0

@@ -453,3 +534,3 @@ });

_context2.next = 11;
return (0, _index.syncSetData)(_this4, {
return (0, _index.syncSetData)(this, {
status: STATUS.IDLE

@@ -459,7 +540,6 @@ });

case 11:
_this4.triggerEvent('statuschange', STATUS.IDLE);
this.triggerEvent('statuschange', STATUS.IDLE);
this.lastOffsetY = this.offsetY = 0;
this.closing = false;
_this4.lastOffsetY = _this4.offsetY = 0;
_this4.closing = false;
case 14:

@@ -470,13 +550,21 @@ case "end":

}
}, _callee2);
}))();
},
}, _callee2, this);
}));
function closeLoading() {
return _closeLoading.apply(this, arguments);
}
return closeLoading;
}(),
/**
* 调用模拟下拉刷新
*/
startRefresh: function startRefresh() {
var _this5 = this;
startRefresh: function () {
var _startRefresh = (0, _asyncToGenerator2["default"])(
/*#__PURE__*/
_regenerator["default"].mark(function _callee3() {
var _this4 = this;
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
return _regenerator["default"].wrap(function _callee3$(_context3) {

@@ -486,3 +574,3 @@ while (1) {

case 0:
if (!(_this5.data.status !== STATUS.IDLE)) {
if (!(this.data.status !== STATUS.IDLE)) {
_context3.next = 4;

@@ -492,19 +580,18 @@ break;

_this5.debCloseLoading.cancel();
this.debCloseLoading.cancel();
_context3.next = 4;
return _this5.closeLoading();
return this.closeLoading();
case 4:
_this5.setData({
this.setData({
enableScroll: false,
status: STATUS.LOADING
}, function () {
if (_this5.closing) {
if (_this4.closing) {
return;
}
_this5.offsetY = _this5.data.loadingHeight;
_this4.offsetY = _this4.data.loadingHeight;
_this5.touchHdl({
_this4.touchHdl({
type: 'touchend',

@@ -514,5 +601,4 @@ manual: true

});
this.triggerEvent('statuschange', STATUS.LOADING);
_this5.triggerEvent('statuschange', STATUS.LOADING);
case 6:

@@ -523,13 +609,19 @@ case "end":

}
}, _callee3);
}))();
},
}, _callee3, this);
}));
function startRefresh() {
return _startRefresh.apply(this, arguments);
}
return startRefresh;
}(),
/**
* 停止当前刷新
*/
stopRefresh: function stopRefresh() {
var _this6 = this;
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
stopRefresh: function () {
var _stopRefresh = (0, _asyncToGenerator2["default"])(
/*#__PURE__*/
_regenerator["default"].mark(function _callee4() {
var time;

@@ -541,3 +633,3 @@ return _regenerator["default"].wrap(function _callee4$(_context4) {

// 用户下拉,至少保证小球转1圈
time = 500 - (Date.now() - _this6.startRefreshTime);
time = 500 - (Date.now() - this.startRefreshTime);
time = time > 0 ? time : 0;

@@ -550,10 +642,8 @@ _context4.next = 4;

case 4:
_this6.setData({
this.setData({
status: STATUS.SHOWTEXT
});
_this6.triggerEvent('statuschange', STATUS.SHOWTEXT);
this.triggerEvent('statuschange', STATUS.SHOWTEXT);
_context4.next = 8;
return _this6.debCloseLoading();
return this.debCloseLoading();

@@ -565,6 +655,12 @@ case 8:

}
}, _callee4);
}))();
},
}, _callee4, this);
}));
function stopRefresh() {
return _stopRefresh.apply(this, arguments);
}
return stopRefresh;
}(),
/**

@@ -585,3 +681,3 @@ * 滚动到底部时触发

created: function created() {
var _this7 = this;
var _this5 = this;

@@ -607,3 +703,3 @@ this.clipText(this.data.text); // 记录用户下拉开始时间,到加载结束至少保证小球转3圈

var timer = setInterval(function () {
if (_this7.touching) {
if (_this5.touching) {
return;

@@ -619,3 +715,7 @@ }

this.debCloseLoading = (0, _index.promiseDebounce)( /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
this.debCloseLoading = (0, _index.promiseDebounce)(
/*#__PURE__*/
(0, _asyncToGenerator2["default"])(
/*#__PURE__*/
_regenerator["default"].mark(function _callee5() {
return _regenerator["default"].wrap(function _callee5$(_context5) {

@@ -626,3 +726,3 @@ while (1) {

_context5.next = 2;
return _this7.debOffsetCheck();
return _this5.debOffsetCheck();

@@ -632,3 +732,3 @@ case 2:

return new Promise(function (r) {
return setTimeout(r, _this7.data.textStayTime);
return setTimeout(r, _this5.data.textStayTime);
});

@@ -638,3 +738,3 @@

_context5.next = 6;
return _this7.closeLoading();
return _this5.closeLoading();

@@ -650,3 +750,3 @@ case 6:

ready: function ready() {
var _this8 = this;
var _this6 = this;

@@ -662,3 +762,3 @@ // 计算滑动区域高度,用于计算阻尼值

_this8.setData({
_this6.setData({
clientHeight: clientHeight

@@ -665,0 +765,0 @@ });

@@ -69,3 +69,3 @@ /**

init(value, fillback) {
init(value, fillback, callback) {
if (!Array.isArray(value)) {

@@ -91,7 +91,3 @@ value = this.initValue(value);

});
swan.nextTick(() => {
const last = value.length - 1;
const lastVal = value[last];
this.handelClick(last, lastVal, currentOptions[last][lastVal], fillback);
});
callback && callback(value, currentOptions, fillback);
},

@@ -196,4 +192,10 @@

setValue(value) {
this.init(value, true);
this.init(value, true, (value, currentOptions, fillback) => {
swan.nextTick(() => {
const last = value.length - 1;
const lastVal = value[last];
this.handelClick(last, lastVal, currentOptions[last][lastVal], fillback);
});
});
}
});

@@ -5,14 +5,8 @@ "use strict";

var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
/**

@@ -52,6 +46,6 @@ * @file index.js 图标组件

},
attached: function attached() {
var _this = this;
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
attached: function () {
var _attached = (0, _asyncToGenerator2["default"])(
/*#__PURE__*/
_regenerator["default"].mark(function _callee() {
var _this$data, name, color, len, iconType, localIconType, hasRequested;

@@ -63,3 +57,3 @@

case 0:
_this$data = _this.data, name = _this$data.name, color = _this$data.color;
_this$data = this.data, name = _this$data.name, color = _this$data.color;
len = name.length; // 根据名字,获取icon的模式

@@ -69,8 +63,6 @@

localIconType = "".concat(iconType, "_").concat(md5Config[iconType]);
_this.setData({
this.setData({
inited: true
}); // 该类型,已经发起过请求:尝试获取缓存,不再发起相同请求
hasRequested = app["".concat(localIconType, "has_requested")];

@@ -83,5 +75,4 @@

_this.getLocalThrottleCount = 0;
_this.getLocalDataThrottle({
this.getLocalThrottleCount = 0;
this.getLocalDataThrottle({
localIconType: localIconType,

@@ -92,3 +83,2 @@ iconType: iconType,

});
return _context.abrupt("return");

@@ -98,3 +88,3 @@

// 该类型,未发起过请求:根据不同的icon模式发起对应的请求
_this.requestIconData({
this.requestIconData({
iconType: iconType,

@@ -104,3 +94,2 @@ name: name

app["".concat(localIconType, "has_requested")] = true;

@@ -113,6 +102,12 @@

}
}, _callee);
}))();
},
}, _callee, this);
}));
function attached() {
return _attached.apply(this, arguments);
}
return attached;
}(),
/**

@@ -123,6 +118,8 @@ * 本地缓存因为有请求时机的diff,进行多次重试

*/
getLocalDataThrottle: function getLocalDataThrottle(options) {
var _this2 = this;
getLocalDataThrottle: function () {
var _getLocalDataThrottle = (0, _asyncToGenerator2["default"])(
/*#__PURE__*/
_regenerator["default"].mark(function _callee2(options) {
var _this = this;
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
var iconType, localIconType, color, name, localIconsData;

@@ -135,3 +132,3 @@ return _regenerator["default"].wrap(function _callee2$(_context2) {

_context2.next = 3;
return _this2.getLocalData(localIconType);
return this.getLocalData(localIconType);

@@ -143,13 +140,13 @@ case 3:

if (localIconsData) {
_this2.colorFormatAndSetIconData(color, localIconsData[name]);
} else if (_this2.getLocalThrottleCount < 20) {
this.colorFormatAndSetIconData(color, localIconsData[name]);
} else if (this.getLocalThrottleCount < 20) {
// getLocalThrottleCount作用:防止特殊case时,无限递归,导致内存溢出
setTimeout(function () {
_this2.getLocalDataThrottle(options);
_this.getLocalDataThrottle(options);
_this2.getLocalThrottleCount++;
_this.getLocalThrottleCount++;
}, 10);
} else {
// 重试20次,依旧没有读到缓存,则从新发起请求
_this2.requestIconData({
this.requestIconData({
iconType: iconType,

@@ -165,6 +162,12 @@ name: name

}
}, _callee2);
}))();
},
}, _callee2, this);
}));
function getLocalDataThrottle(_x) {
return _getLocalDataThrottle.apply(this, arguments);
}
return getLocalDataThrottle;
}(),
/**

@@ -178,3 +181,3 @@ * 根据icon的模式,请求对应的接口数据,并对数据进行持久化处理

requestIconData: function requestIconData(_ref) {
var _this3 = this;
var _this2 = this;

@@ -193,5 +196,5 @@ var iconType = _ref.iconType,

var iconData = _this3.translateIconData(data[name]);
var iconData = _this2.translateIconData(data[name]);
_this3.setData({
_this2.setData({
iconData: iconData,

@@ -317,3 +320,3 @@ inited: true

colorFormatAndSetIconData: function colorFormatAndSetIconData(color, data) {
var _this4 = this;
var _this3 = this;

@@ -334,8 +337,8 @@ var rgbColor = color || this.data.color;

rgbColor = [];
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
var _iterator = _createForOfIteratorHelper(color),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
for (var _iterator = color[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var i = _step.value;

@@ -345,5 +348,14 @@ rgbColor.push(trans(i));

} catch (err) {
_iterator.e(err);
_didIteratorError = true;
_iteratorError = err;
} finally {
_iterator.f();
try {
if (!_iteratorNormalCompletion && _iterator["return"] != null) {
_iterator["return"]();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}

@@ -362,5 +374,5 @@ }

var iconData = _this4.translateIconData(data);
var iconData = _this3.translateIconData(data);
_this4.setData({
_this3.setData({
iconData: iconData

@@ -367,0 +379,0 @@ });

{
"component": true,
"usingComponents": {
"smt-icon": "../../icon/lib/index"
"smt-icon": "../../icon/src/index"
}
}

@@ -100,7 +100,9 @@ "use strict";

*/
init: function init() {
var _this2 = this;
init: function () {
var _init = (0, _asyncToGenerator2["default"])(
/*#__PURE__*/
_regenerator["default"].mark(function _callee() {
var _this2 = this;
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
var _this2$data, scroll, speed, delay, containerWidth, duration;
var _this$data, scroll, speed, delay, containerWidth, duration;

@@ -111,3 +113,3 @@ return _regenerator["default"].wrap(function _callee$(_context) {

case 0:
_this2$data = _this2.data, scroll = _this2$data.scroll, speed = _this2$data.speed, delay = _this2$data.delay; // 不开启滚动,则退出
_this$data = this.data, scroll = _this$data.scroll, speed = _this$data.speed, delay = _this$data.delay; // 不开启滚动,则退出

@@ -123,3 +125,3 @@ if (scroll) {

_context.next = 5;
return _this2.getWidths('.notice-bar .text-container');
return this.getWidths('.notice-bar .text-container');

@@ -129,3 +131,3 @@ case 5:

_context.next = 8;
return _this2.getWidths('.notice-bar .text-container .text');
return this.getWidths('.notice-bar .text-container .text');

@@ -135,4 +137,3 @@ case 8:

duration = +(textWidth / speed * 1000).toFixed(2);
_this2.setData({
this.setData({
containerWidth: containerWidth

@@ -152,6 +153,12 @@ }, function () {

}
}, _callee);
}))();
},
}, _callee, this);
}));
function init() {
return _init.apply(this, arguments);
}
return init;
}(),
/**

@@ -192,6 +199,6 @@ * 生成动画

var _this$data = this.data,
speed = _this$data.speed,
containerWidth = _this$data.containerWidth,
infinite = _this$data.infinite;
var _this$data2 = this.data,
speed = _this$data2.speed,
containerWidth = _this$data2.containerWidth,
infinite = _this$data2.infinite;
var duration = +((textWidth + containerWidth) / speed * 1000).toFixed(2);

@@ -198,0 +205,0 @@

{
"component": true,
"usingComponents": {
"smt-icon": "../../icon/lib/index"
"smt-icon": "../../icon/src/index"
}
}
{
"component": true,
"usingComponents": {
"smt-icon": "../../icon/lib/index"
"smt-icon": "../../icon/src/index"
}
}
{
"component": true,
"usingComponents": {
"smt-icon": "../../icon/lib/index",
"smt-icon": "../../icon/src/index",
"custom-icon": "../component/icon"
}
}

@@ -1,1 +0,1 @@

{"name":"component","label":"通用","type":"component","configPath":"./smart-design-config.json","version":"1.1.97"}
{"name":"component","label":"通用","type":"component","configPath":"./smart-design-config.json","version":"1.1.98"}

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc