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

cosmic-components

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cosmic-components - npm Package Compare versions

Comparing version 0.0.1-alpha.41 to 0.0.1-alpha.42

20

dist/Tabs/index.js

@@ -117,2 +117,6 @@ var __extends = (this && this.__extends) || (function () {

Tabs.prototype.attached = function () {
var _this = this;
this.watch && this.watch('index', function (index) {
_this.scrollToTarget(index);
});
// 获取 tabPaneList

@@ -183,14 +187,14 @@ var paneList = [];

};
// 标签项点击
Tabs.prototype.handleLabelClick = function (label, index, e) {
var _this = this;
var _a, _b;
Tabs.prototype.scrollToTarget = function (index) {
// 计算滚动位置
var scroller = this.ref('scroll');
if (scroller && this.data.get('targetCenter')) {
// @ts-ignore
var scrollLeft = ((_a = e.target) === null || _a === void 0 ? void 0 : _a.offsetLeft) - (scroller.offsetWidth - ((_b = e.target) === null || _b === void 0 ? void 0 : _b.offsetWidth)) / 2;
// @ts-ignore
var target = scroller.children[index];
if (scroller && this.data.get('targetCenter') && target) {
var scrollLeft = target.offsetLeft - (scroller.offsetWidth - target.offsetWidth) / 2;
scroller.scroll(scrollLeft, 0);
}
};
// 标签项点击
Tabs.prototype.handleLabelClick = function (label, index, e) {
var _this = this;
this.fire('tab-click', {

@@ -197,0 +201,0 @@ index: index,

2

package.json
{
"name": "cosmic-components",
"version": "0.0.1-alpha.41",
"version": "0.0.1-alpha.42",
"main": "./dist/index.js",

@@ -5,0 +5,0 @@ "module": "./src/index.ts",

@@ -199,2 +199,6 @@ /**

this.watch && this.watch('index', index => {
this.scrollToTarget(index);
});
// 获取 tabPaneList

@@ -275,13 +279,16 @@ const paneList: Node[] = [];

// 标签项点击
handleLabelClick(label: Label, index: number, e: Event) {
scrollToTarget(index: number) {
// 计算滚动位置
let scroller = this.ref('scroll');
if (scroller && this.data.get('targetCenter')) {
// @ts-ignore
let scrollLeft = e.target?.offsetLeft - (scroller.offsetWidth - e.target?.offsetWidth)/2;
// @ts-ignore
let scroller = this.ref('scroll') as unknown as HTMLElement;
let target = scroller.children[index] as HTMLElement;
if (scroller && this.data.get('targetCenter') && target) {
let scrollLeft = target.offsetLeft - (scroller.offsetWidth - target.offsetWidth)/2;
scroller.scroll(scrollLeft, 0);
}
}
// 标签项点击
handleLabelClick(label: Label, index: number, e: Event) {
this.fire('tab-click', {

@@ -288,0 +295,0 @@ index,

@@ -18,4 +18,5 @@ import Base from '../Base';

updateController(): void;
scrollToTarget(index: number): void;
handleLabelClick(label: Label, index: number, e: Event): void;
}
export {};

Sorry, the diff of this file is not supported yet

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