Rename draggable into sortable
This commit is contained in:
parent
c6e5b4a385
commit
3dddb2db94
10 changed files with 3499 additions and 19 deletions
|
@ -6,9 +6,9 @@
|
|||
</head>
|
||||
<body style="margin:0">
|
||||
|
||||
<tab-group new-tab-button="true" draggable="true"></tab-group>
|
||||
<tab-group new-tab-button="true" sortable="true"></tab-group>
|
||||
|
||||
<script src="../dist/electron-tabs.draggable.js"></script>
|
||||
<script src="../dist/electron-tabs.sortable.js"></script>
|
||||
<script>
|
||||
const tabGroup = document.querySelector("tab-group");
|
||||
|
||||
|
|
8
dist/electron-tabs.draggable.js
vendored
8
dist/electron-tabs.draggable.js
vendored
|
@ -552,7 +552,7 @@ class TabGroup extends HTMLElement {
|
|||
title: "New Tab",
|
||||
active: true
|
||||
},
|
||||
draggable: this.getAttribute("draggable") || false
|
||||
sortable: this.getAttribute("sortable") || false
|
||||
};
|
||||
// Create custom element
|
||||
const shadow = this.attachShadow({
|
||||
|
@ -583,14 +583,14 @@ class TabGroup extends HTMLElement {
|
|||
this.newTabId = 0;
|
||||
TabGroupPrivate.initNewTabButton.bind(this)();
|
||||
TabGroupPrivate.initVisibility.bind(this)();
|
||||
// Init draggable tabs
|
||||
if (this.options.draggable) {
|
||||
// Init sortable tabs
|
||||
if (this.options.sortable) {
|
||||
const initSortable = ()=>{
|
||||
const options = Object.assign({
|
||||
direction: "horizontal",
|
||||
animation: 150,
|
||||
swapThreshold: 0.20
|
||||
}, this.options.draggableOptions);
|
||||
}, this.options.sortableOptions);
|
||||
new window.Sortable(this.tabContainer, options);
|
||||
};
|
||||
if (window.Sortable) initSortable();
|
||||
|
|
2
dist/electron-tabs.draggable.js.map
vendored
2
dist/electron-tabs.draggable.js.map
vendored
File diff suppressed because one or more lines are too long
8
dist/electron-tabs.js
vendored
8
dist/electron-tabs.js
vendored
|
@ -17,7 +17,7 @@ class $4fa36e821943b400$var$TabGroup extends HTMLElement {
|
|||
title: "New Tab",
|
||||
active: true
|
||||
},
|
||||
draggable: this.getAttribute("draggable") || false
|
||||
sortable: this.getAttribute("sortable") || false
|
||||
};
|
||||
// Create custom element
|
||||
const shadow = this.attachShadow({
|
||||
|
@ -48,14 +48,14 @@ class $4fa36e821943b400$var$TabGroup extends HTMLElement {
|
|||
this.newTabId = 0;
|
||||
$4fa36e821943b400$var$TabGroupPrivate.initNewTabButton.bind(this)();
|
||||
$4fa36e821943b400$var$TabGroupPrivate.initVisibility.bind(this)();
|
||||
// Init draggable tabs
|
||||
if (this.options.draggable) {
|
||||
// Init sortable tabs
|
||||
if (this.options.sortable) {
|
||||
const initSortable = ()=>{
|
||||
const options = Object.assign({
|
||||
direction: "horizontal",
|
||||
animation: 150,
|
||||
swapThreshold: 0.20
|
||||
}, this.options.draggableOptions);
|
||||
}, this.options.sortableOptions);
|
||||
new window.Sortable(this.tabContainer, options);
|
||||
};
|
||||
if (window.Sortable) initSortable();
|
||||
|
|
2
dist/electron-tabs.js.map
vendored
2
dist/electron-tabs.js.map
vendored
File diff suppressed because one or more lines are too long
3479
dist/electron-tabs.sortable.js
vendored
Normal file
3479
dist/electron-tabs.sortable.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
1
dist/electron-tabs.sortable.js.map
vendored
Normal file
1
dist/electron-tabs.sortable.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -3,13 +3,13 @@
|
|||
"version": "1.0.0-dev",
|
||||
"description": "Simple tabs for Electron applications",
|
||||
"main": "dist/electron-tabs.js",
|
||||
"draggable": "dist/electron-tabs.draggable.js",
|
||||
"sortable": "dist/electron-tabs.sortable.js",
|
||||
"targets": {
|
||||
"main": {
|
||||
"source": "src/index.js"
|
||||
},
|
||||
"draggable": {
|
||||
"source": "src/draggable.js"
|
||||
"sortable": {
|
||||
"source": "src/sortable.js"
|
||||
}
|
||||
},
|
||||
"repository": {
|
||||
|
|
|
@ -17,7 +17,7 @@ class TabGroup extends HTMLElement {
|
|||
viewClass: this.getAttribute("view-class") || "etabs-view",
|
||||
newTabButton: this.getAttribute("new-tab-button") || false,
|
||||
defaultTab: { title: "New Tab", active: true },
|
||||
draggable: this.getAttribute("draggable") || false
|
||||
sortable: this.getAttribute("sortable") || false
|
||||
// TODO: replace this callback
|
||||
// ready: args.ready
|
||||
};
|
||||
|
@ -58,14 +58,14 @@ class TabGroup extends HTMLElement {
|
|||
TabGroupPrivate.initNewTabButton.bind(this)();
|
||||
TabGroupPrivate.initVisibility.bind(this)();
|
||||
|
||||
// Init draggable tabs
|
||||
if (this.options.draggable) {
|
||||
// Init sortable tabs
|
||||
if (this.options.sortable) {
|
||||
const initSortable = () => {
|
||||
const options = Object.assign({
|
||||
direction: "horizontal",
|
||||
animation: 150,
|
||||
swapThreshold: 0.20
|
||||
}, this.options.draggableOptions);
|
||||
}, this.options.sortableOptions);
|
||||
new window.Sortable(this.tabContainer, options);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue