initial commit 2

This commit is contained in:
equippedcoding-master
2025-09-17 15:19:57 -05:00
parent e2c98790b2
commit 1c59875b8a
55391 changed files with 15 additions and 0 deletions

View File

@@ -0,0 +1,281 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href='https://unpkg.com/boxicons@2.0.7/css/boxicons.min.css' rel='stylesheet'>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta2/css/all.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.6.3.min.js" integrity="sha256-pvPw+upLPUjgMXY0G+8O0xUf+/Im1MZjXxxgOcBQBXU=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.13.6/underscore-min.js" integrity="sha512-2V49R8ndaagCOnwmj8QnbT1Gz/rie17UouD9Re5WxbzRVUGoftCu5IuqqtAM9+UC3fwfHCSJR1hkzNQh/2wdtg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.4.1/backbone-min.js" integrity="sha512-TztyCWDNoN0YKl30gDCMKsiWs35juID+W7ZM2uvPeLLmiNvZg789SglgB/QeUbewqIF2Z4mVq3PyIEa+YXXADQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.4/moment.min.js"></script>
<script src="/portal/admin/core/api/js/libs/appfactory/appfactory3.js"></script>
<script src="/portal/admin/core/api/js/libs/appfactory/afssponsorship.js"></script>
<script src="/portal/admin/core/api/js/libs/appfactory/afssubscriber.js"></script>
<script src="/portal/admin/core/api/js/libs/appfactory/afsnotifications.js"></script>
<script src="/portal/admin/core/api/js/libs/appfactory/afspayments.js"></script>
<script src="/portal/admin/core/api/js/libs/appfactory/afsform.js"></script>
<script src="/portal/admin/core/api/js/libs/appfactory/afsextras.js"></script>
<script src="/portal/admin/core/api/js/libs/appfactory/afsevents.js"></script>
<script src="/portal/admin/core/api/js/libs/appfactory/afsdocuments.js"></script>
<script src="/portal/admin/core/api/js/libs/appfactory/afsaccount.js"></script>
<script src="/portal/admin/core/api/js/libs/appfactory/afsemail.js"></script>
<script src="/portal/admin/core/api/js/libs/appfactory/afsanalytics.js"></script>
<script src="/portal/admin/core/api/js/libs/appfactory/afsdonations.js"></script>
<script src="/portal/admin/core/api/js/libs/appfactory/afsspinner.js"></script>
<link href="/portal/admin/core/api/styles/tabler/tabler.min.css" rel="stylesheet"/>
<script src="/portal/admin/core/api/js/libs/tabler/tabler.js"></script>
<link rel="stylesheet" href="/portal/admin/core/api/php/includes/playground/link/kanban/one/jkanban/dist/jkanban.min.css" />
<link
href="https://fonts.googleapis.com/css?family=Lato"
rel="stylesheet"
/>
<style>
body {
font-family: "Lato";
margin: 0;
padding: 0;
}
#myKanban {
overflow-x: auto;
padding: 20px 0;
}
.success {
background: #00b961;
}
.info {
background: #2a92bf;
}
.warning {
background: #f4ce46;
}
.error {
background: #fb7d44;
}
.custom-button {
background-color: #4CAF50;
border: none;
color: white;
padding: 7px 15px;
margin: 10px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
}
</style>
</head>
<body>
<div class="container-fluid">
<div class="row d-flex justify-content-center">
<div class="col-12">
<div id="myKanban"></div>
<button id="addDefault">Add "Default" board</button>
<br />
<button id="addToDo">Add element in "To Do" Board</button>
<br />
<button id="addToDoAtPosition">Add element in "To Do" Board at position 2</button>
<br />
<button id="removeBoard">Remove "Done" Board</button>
<br />
<button id="removeElement">Remove "My Task Test"</button>
</div>
</div>
</div>
<script src="/portal/admin/core/api/php/includes/playground/link/kanban/one/jkanban/dist/jkanban.js"></script>
<script>
var KanbanTest = new jKanban({
element: "#myKanban",
gutter: "10px",
widthBoard: "300px",
itemHandleOptions:{
enabled: true,
},
click: function(el) {
console.log("Trigger on all items click!");
},
context: function(el, e) {
console.log("Trigger on all items right-click!");
},
dropEl: function(el, target, source, sibling){
console.log(target.parentElement.getAttribute('data-id'));
console.log(el, target, source, sibling)
},
buttonClick: function(el, boardId) {
console.log(el);
console.log(boardId);
// create a form to enter element
var formItem = document.createElement("form");
formItem.setAttribute("class", "itemform");
formItem.innerHTML =
'<div class="form-group"><textarea class="form-control" rows="2" autofocus></textarea></div><div class="form-group"><button type="submit" class="btn btn-primary btn-xs pull-right">Submit</button><button type="button" id="CancelBtn" class="btn btn-default btn-xs pull-right">Cancel</button></div>';
KanbanTest.addForm(boardId, formItem);
formItem.addEventListener("submit", function(e) {
e.preventDefault();
var text = e.target[0].value;
KanbanTest.addElement(boardId, {
title: text
});
formItem.parentNode.removeChild(formItem);
});
document.getElementById("CancelBtn").onclick = function() {
formItem.parentNode.removeChild(formItem);
};
},
itemAddOptions: {
enabled: true,
content: '+ Add New Card',
class: 'custom-button',
footer: true
},
boards: [
{
id: "_todo",
title: "To Do (Can drop item only in working)",
class: "info,good",
dragTo: ["_working"],
item: [
{
id: "_test_delete",
title: "Try drag this (Look the console)",
drag: function(el, source) {
console.log("START DRAG: " + el.dataset.eid);
},
dragend: function(el) {
console.log("END DRAG: " + el.dataset.eid);
},
drop: function(el) {
console.log("DROPPED: " + el.dataset.eid);
}
},
{
title: "Try Click This!",
click: function(el) {
alert("click");
},
context: function(el, e){
alert("right-click at (" + `${e.pageX}` + "," + `${e.pageX}` + ")")
},
class: ["peppe", "bello"]
}
]
},
{
id: "_working",
title: "Working (Try drag me too)",
class: "warning",
item: [
{
title: "Do Something!"
},
{
title: "Run?"
}
]
},
{
id: "_done",
title: "Done (Can drop item only in working)",
class: "success",
dragTo: ["_working"],
item: [
{
title: "All right"
},
{
title: "Ok!"
}
]
}
]
});
var toDoButton = document.getElementById("addToDo");
toDoButton.addEventListener("click", function() {
KanbanTest.addElement("_todo", {
title: "Test Add"
});
});
var toDoButtonAtPosition = document.getElementById("addToDoAtPosition");
toDoButtonAtPosition.addEventListener("click", function() {
KanbanTest.addElement("_todo", {
title: "Test Add at Pos"
}, 1);
});
var addBoardDefault = document.getElementById("addDefault");
addBoardDefault.addEventListener("click", function() {
KanbanTest.addBoards([
{
id: "_default",
title: "Kanban Default",
item: [
{
title: "Default Item"
},
{
title: "Default Item 2"
},
{
title: "Default Item 3"
}
]
}
]);
});
var removeBoard = document.getElementById("removeBoard");
removeBoard.addEventListener("click", function() {
KanbanTest.removeBoard("_done");
});
var removeElement = document.getElementById("removeElement");
removeElement.addEventListener("click", function() {
KanbanTest.removeElement("_test_delete");
});
var allEle = KanbanTest.getBoardElements("_todo");
allEle.forEach(function(item, index) {
//console.log(item);
});
</script>
</body>
</html>

View File

@@ -0,0 +1 @@
dist/* linguist-generated=true

View File

@@ -0,0 +1,12 @@
# These are supported funding model platforms
github: [riktar]
patreon: #riccardotartaglia
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
# custom: ['https://donorbox.org/jkanban'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

View File

@@ -0,0 +1,7 @@
# folder to ignore
.idea
node_modules
#files to ignore
*.iml
/jkanban.dev.scss
.DS_Store

View File

@@ -0,0 +1,5 @@
{
"hooks": {
"pre-push": "npm run test"
}
}

View File

@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -0,0 +1,155 @@
# jKanban
> Javascript plugin for Kanban boards
jKanban allow you to create and manage Kanban Board in your project!
Please try out the live [demo][1]!
[1]: http://www.riccardotartaglia.it/jkanban/
## Install
Clone the repo and use the javascript and the css files in the `dist` folder.
You have to include
`<link rel="stylesheet" href="path/to/jkanban.min.css">`
and
`<script src="path/to/jkanban.min.js"></script>`
in your page and you are done.
## Usage
Init jKanban is a piece of cake!
### `var kanban = new jKanban(options)`
Here's an **overview of the default values**.
```js
var kanban = new jKanban({
element : '', // selector of the kanban container
gutter : '15px', // gutter of the board
widthBoard : '250px', // width of the board
responsivePercentage: false, // if it is true I use percentage in the width of the boards and it is not necessary gutter and widthBoard
dragItems : true, // if false, all items are not draggable
boards : [], // json of boards
dragBoards : true, // the boards are draggable, if false only item can be dragged
itemAddOptions: {
enabled: false, // add a button to board for easy item creation
content: '+', // text or html content of the board button
class: 'kanban-title-button btn btn-default btn-xs', // default class of the button
footer: false // position the button on footer
},
itemHandleOptions: {
enabled : false, // if board item handle is enabled or not
handleClass : "item_handle", // css class for your custom item handle
customCssHandler : "drag_handler", // when customHandler is undefined, jKanban will use this property to set main handler class
customCssIconHandler: "drag_handler_icon", // when customHandler is undefined, jKanban will use this property to set main icon handler class. If you want, you can use font icon libraries here
customHandler : "<span class='item_handle'>+</span> %title% " // your entirely customized handler. Use %title% to position item title
// any key's value included in item collection can be replaced with %key%
},
click : function (el) {}, // callback when any board's item are clicked
context : function (el, event) {}, // callback when any board's item are right clicked
dragEl : function (el, source) {}, // callback when any board's item are dragged
dragendEl : function (el) {}, // callback when any board's item stop drag
dropEl : function (el, target, source, sibling) {}, // callback when any board's item drop in a board
dragBoard : function (el, source) {}, // callback when any board stop drag
dragendBoard : function (el) {}, // callback when any board stop drag
buttonClick : function(el, boardId) {}, // callback when the board's button is clicked
propagationHandlers: [], // the specified callback does not cancel the browser event. possible values: "click", "context"
})
```
Now take a look to the `boards` object
```js
[
{
"id" : "board-id-1", // id of the board
"title" : "Board Title", // title of the board
"class" : "class1,class2,...", // css classes to add at the title
"dragTo": ['another-board-id',...], // array of ids of boards where items can be dropped (default: [])
"item" : [ // item of this board
{
"id" : "item-id-1", // id of the item
"title" : "Item 1" // title of the item
"class" : ["myClass",...] // array of additional classes
},
{
"id" : "item-id-2",
"title" : "Item 2"
}
]
},
{
"id" : "board-id-2",
"title" : "Board Title 2"
}
]
```
**WARNING: all ids are unique!**
### About custom properties
jKanban also support custom properties on items to improve your applications with html data- properties. You can define them at like:
```js
[
{
"id" : "board-id-1",
"title" : "Board Title",
"item" : [
{
"id" : "item-id-1",
"title" : "Item 1",
"username": "username1"
},
{
"id" : "item-id-2",
"title" : "Item 2",
"username": "username2"
}
]
}
]
```
Which jKanban will convert to:
```html
<main class="kanban-drag">
<div class="kanban-item" data-eid="item-id-1" data-username="username1">Item 1</div>
<div class="kanban-item" data-eid="item-id-2" data-username="username2">Item 2</div>
</main>
```
## API
jKanban provides the easiest possible API to make your boards awesome!
Method Name | Arguments | Description
----------------------|----------------------------------|------------------------------------------------------------------------------------------------------------------------------
`addElement` | `boardID, element, position` | Add `element` in the board with ID `boardID`, `element` is the standard format. If `position` is set, inserts at position starting from 0
`addForm` | `boardID, formItem` | Add `formItem` as html element into the board with ID `boardID`
`addBoards` | `boards` | Add one or more boards in the kanban, `boards` are in the standard format
`findElement` | `id` | Find board's item by `id`
`replaceElement` | `id, element` | Replace item by `id` with `element` JSON standard format
`getParentBoardID` | `id` | Get board ID of item `id` passed
`findBoard` | `id` | Find board by `id`
`getBoardElements` | `id` | Get all item of a board
`removeElement` | `id` | Remove a board's element by id
`removeBoard` | `id` | Remove a board by id
## Example
Clone the repo and look in the `example` folder
## Thanks
jKanban use [dragula](https://github.com/bevacqua/dragula) for drag&drop
## Develop
Clone the repo then use `npm install` for download all the dependencies then launch `npm run build` for build the project
### Pull Requests?
I'd love them!
### Comments?
Let's hear them! (The nice ones please!)
### Me?
In case you're interested I'm [@riktarweb](http://twitter.com/riktarweb)

View File

@@ -0,0 +1,159 @@
.kanban-container {
position: relative;
box-sizing: border-box;
width: auto;
}
.kanban-container * {
box-sizing: border-box;
}
.kanban-container:after {
clear: both;
display: block;
content: "";
}
.kanban-board {
position: relative;
float: left;
background: #e2e4e6;
transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}
.kanban-board.disabled-board {
opacity: 0.3;
}
.kanban-board.is-moving.gu-mirror {
transform: rotate(3deg);
}
.kanban-board.is-moving.gu-mirror .kanban-drag {
overflow: hidden;
padding-right: 50px;
}
.kanban-board header {
font-size: 16px;
padding: 15px;
}
.kanban-board header .kanban-title-board {
font-weight: 700;
margin: 0;
padding: 0;
display: inline;
}
.kanban-board header .kanban-title-button {
float: right;
}
.kanban-board .kanban-drag {
min-height: 200px;
padding: 20px;
}
.kanban-board:after {
clear: both;
display: block;
content: "";
}
.kanban-item {
background: #fff;
padding: 15px;
margin-bottom: 20px;
transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
animation: append-animate 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}
@keyframes append-animate {
from {
transform: translateY(-20px);
}
to {
transform: translateY(0px);
}
}
.kanban-item:hover {
cursor: move;
}
.kanban-item:last-child {
margin: 0;
}
.kanban-item.is-moving.gu-mirror {
transform: rotate(3deg);
height: auto !important;
}
/* Dragula CSS */
.gu-mirror {
position: fixed !important;
margin: 0 !important;
z-index: 9999 !important;
}
.gu-hide {
display: none !important;
}
.gu-unselectable {
-webkit-user-select: none !important;
-moz-user-select: none !important;
-ms-user-select: none !important;
user-select: none !important;
}
.gu-transit {
opacity: 0.2 !important;
transform: rotate(0deg) !important;
}
.drag_handler {
background: #fff;
border-radius: 50%;
width: 24px;
height: 24px;
position: relative;
float: left;
top: -3px;
margin-right: 4px;
}
.drag_handler:hover {
cursor: move;
}
.drag_handler_icon {
position: relative;
display: block;
background: #000;
width: 24px;
height: 2px;
top: 12px;
transition: .5s ease-in-out;
}
.drag_handler_icon:before,
.drag_handler_icon:after {
background: #000;
content: '';
display: block;
width: 100%;
height: 100%;
position: absolute;
transition: .5s ease-in-out;
}
.drag_handler_icon:before {
top: 6px;
}
.drag_handler_icon:after {
bottom: 6px;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1 @@
.kanban-container{position:relative;box-sizing:border-box;width:auto}.kanban-container *{box-sizing:border-box}.kanban-container:after{clear:both;display:block;content:""}.kanban-board{position:relative;float:left;background:#e2e4e6;transition:all .3s cubic-bezier(.23,1,.32,1)}.kanban-board.disabled-board{opacity:.3}.kanban-board.is-moving.gu-mirror{transform:rotate(3deg)}.kanban-board.is-moving.gu-mirror .kanban-drag{overflow:hidden;padding-right:50px}.kanban-board header{font-size:16px;padding:15px}.kanban-board header .kanban-title-board{font-weight:700;margin:0;padding:0;display:inline}.kanban-board header .kanban-title-button{float:right}.kanban-board .kanban-drag{min-height:200px;padding:20px}.kanban-board:after{clear:both;display:block;content:""}.kanban-item{background:#fff;padding:15px;margin-bottom:20px;transition:all .3s cubic-bezier(.23,1,.32,1);animation:append-animate .3s cubic-bezier(.23,1,.32,1)}@keyframes append-animate{from{transform:translateY(-20px)}to{transform:translateY(0)}}.kanban-item:hover{cursor:move}.kanban-item:last-child{margin:0}.kanban-item.is-moving.gu-mirror{transform:rotate(3deg);height:auto!important}.gu-mirror{position:fixed!important;margin:0!important;z-index:9999!important}.gu-hide{display:none!important}.gu-unselectable{-webkit-user-select:none!important;-moz-user-select:none!important;-ms-user-select:none!important;user-select:none!important}.gu-transit{opacity:.2!important;transform:rotate(0)!important}.drag_handler{background:#fff;border-radius:50%;width:24px;height:24px;position:relative;float:left;top:-3px;margin-right:4px}.drag_handler:hover{cursor:move}.drag_handler_icon{position:relative;display:block;background:#000;width:24px;height:2px;top:12px;transition:.5s ease-in-out}.drag_handler_icon:after,.drag_handler_icon:before{background:#000;content:'';display:block;width:100%;height:100%;position:absolute;transition:.5s ease-in-out}.drag_handler_icon:before{top:6px}.drag_handler_icon:after{bottom:6px}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,718 @@
function drag_auto_scroll(el_drg) {
//Thanks to StackOverFlow
//Thanks to Peter-Paul Koch for Some of his concepts borrowed from http://www.quirksmode.org/js/dragdrop.html
this.addEventSimple = function (obj, evt, fn) {
if (obj.addEventListener)
obj.addEventListener(evt, fn, false);
else if (obj.attachEvent)
obj.attachEvent('on' + evt, fn);
};
this.removeEventSimple = function (obj, evt, fn) {
if (obj.removeEventListener)
obj.removeEventListener(evt, fn, false);
else if (obj.detachEvent)
obj.detachEvent('on' + evt, fn);
};
this.fade = function (el_f, o) {
var oo = o / 100;
el_f.style.opacity = oo;
el_f.style['-ms-filter'] = "progid:DXImageTransform.Microsoft.Alpha(Opacity=" + o + ")";
el_f.style['-khtml-opacity'] = oo;
el_f.style['-moz-opacity'] = oo;
el_f.style.filter = "Alpha(Opacity=" + o + "); -moz-opacity:" + oo + "; opacity:" + oo + ";-khtml-opacity:" + oo + ";";
if (o >= 100) {
el_f.style.filter = '';
}
};
this.intersectRect = function (r1, r2) {
return !(r2.left > r1.right ||
r2.right < r1.left ||
r2.top > r1.bottom ||
r2.bottom < r1.top);
};
this.getposition=function(el){
var rect = el.getBoundingClientRect(),
scrollLeft = window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
var l, t, w, h, sw, sh, sbw, sbh;
if (el == document.body) {
l = 0;
t = 0;
w = document.body.clientWidth || document.documentElement.clientWidth || window.innerWidth ;//don't change this order
h = document.body.clientHeight || document.documentElement.clientHeight || window.innerHeight; //don't change this order
sw = Math.max(document.body.scrollWidth, document.documentElement.scrollWidth);
sh = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
sbw = (document.documentElement.clientWidth - document.body.offsetWidth); //16
sbh = (document.documentElement.clientHeight - document.body.offsetHeight); //16
} else {
l=rect.left + scrollLeft;
t=rect.top + scrollTop ;
w=rect.right - rect.left;
h = rect.bottom - rect.top;
sw = el.scrollWidth;
sh = el.scrollHeight;
sbw = el.offsetWidth - el.clientWidth; //17
sbh = el.offsetHeight - el.clientHeight; //17
}
return { left: l, top: t
, width: w, height: h
, right: l + w
, bottom: t + h
, scrollLeft: scrollLeft
, scrollTop: scrollTop
, scrollWidth: sw
, scrollHeight: sh
};
};
this.getoffset=function(){
var el=arguments[0];
var rect = el.getBoundingClientRect();
var includescroll=(arguments.length==1 || arguments[1]!==false);
var l,t,w, h,scrollLeft=0,scrollTop=0,isbody=false,sw,sh,sbw,sbh;
if (el == document.body) {
scrollLeft = window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft;
scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
isbody = true;
l = (includescroll==true?scrollLeft:0);//scrollLeft//
t= (includescroll==true?scrollTop:0) ;//scrollTop//
w = document.body.clientWidth || document.documentElement.clientWidth || window.innerWidth ;//don't change this order
h = document.body.clientHeight || document.documentElement.clientHeight || window.innerHeight; //don't change this order
sw = Math.max(document.body.scrollWidth, document.documentElement.scrollWidth);
sh = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
sbw = (document.documentElement.clientWidth - document.body.offsetWidth); //16
sbh = (document.documentElement.clientHeight - document.body.offsetHeight); //16
} else {
scrollLeft = el.parentNode.scrollLeft;
scrollTop = el.parentNode.scrollTop;
l=rect.left + (includescroll==true?scrollLeft:0);
t=rect.top + (includescroll==true?scrollTop:0) ;
w=rect.right - rect.left;
h = rect.bottom - rect.top;
sw = el.parentNode.scrollWidth;
sh = el.parentNode.scrollHeight;
sbw = el.parentNode.offsetWidth - el.parentNode.clientWidth; //17
sbh = el.parentNode.offsetHeight - el.parentNode.clientHeight; //17
}
return { left: l, top: t
, width: w, height: h
, offsetLeft: (isbody == true ?0:rect.left), offsetTop:(isbody == true ?0: rect.top)
, right: l + w
, bottom: t + h
, scrollLeft: scrollLeft
, scrollTop: scrollTop
, isBody: isbody
, scrollWidth: sw
, scrollHeight: sh
, scrollBarWidth: sbw
, scrollBarHeight: sbh
};
};
this.rectoverlap = function (target, drgpos, xpos, ypos) {
var targetpos = {};
if (target.getBoundingClientRect) {
targetpos = target.getBoundingClientRect();
}
var x_overlap = Math.max(0, Math.min(drgpos.right, targetpos.right) - Math.max(drgpos.left, targetpos.left))
var y_overlap = Math.max(0, Math.min(drgpos.bottom, targetpos.bottom) - Math.max(drgpos.top, targetpos.top));
var lp = Math.floor(x_overlap / Math.min((drgpos.right - drgpos.left), (targetpos.right - targetpos.left)) * 100);
var tp = Math.floor(y_overlap / Math.min((drgpos.bottom - drgpos.top), (targetpos.bottom - targetpos.top)) * 100);
if (lp > 0 && tp > 0) {
// if (this.intersectRect(drgpos, targetpos) == true) {
return { target: target, lp: lp, tp: tp };
}
return null;
}; /*rectoverlap*/
this.hittest = function (target, x, y ) {
var offset=this.getposition(target);
x+=offset.scrollLeft;
y+=offset.scrollTop;
//info.innerHTML=scrollLeft+'x'+scrollTop;
//info.innerHTML+='<br>'+JSON.stringify(offset);
//info.innerHTML+='<br>'+x+'x'+y;
if ((x > offset.left && y > offset.top) && (x < offset.right && y < offset.bottom)) {
var lp = Math.floor(Math.min(x-offset.left,offset.right-x )*2/ offset.width * 100);
var tp = Math.floor(Math.min(y-offset.top,offset.bottom-y )*2 / offset.height * 100);
//info.innerHTML+='<br>'+lp+'x'+tp;
return { target: target, lp: lp, tp: tp };
}
return null;
}; /*hittest*/
this.getevent = function (e) {
e = e || window.event;
// if (e.originalEvent && e.originalEvent.touches) {
// var oe = e.originalEvent;
// e = oe.touches.length ? oe.touches[0] : oe.changedTouches[0];
// }
if (e.touches) {
e = e.touches[0];
}
};
this.scrollLeft = function (el_s, left, top) {
if (el_s == document.body || el_s == null) {
if (left == undefined) {
//return (window.pageXOffset !== undefined) ? window.pageXOffset : (document.body || document.documentElement || document.body.parentNode).scrollLeft;
return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft;
} else {
document.body.scrollLeft = left; //Chrome
document.documentElement.scrollLeft = left; //IE8
// window.scrollTo(left, top); //All
}
} else {
if (left == undefined) {
return el_s.scrollLeft;
} else {
el_s.scrollLeft = left;
}
}
};
this.scrollTop = function (el_s, top, left) {
if (el_s == document.body || el_s == null) {
if (top == undefined) {
//return (window.pageYOffset !== undefined) ? window.pageYOffset : (document.body || document.documentElement || document.body.parentNode).scrollTop;
return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
} else {
document.body.scrollTop = top; //Chrome
document.documentElement.scrollTop = top; //IE8
// window.scrollTo(left, top); //All
}
} else {
if (top == undefined) {
return el_s.scrollTop;
} else {
el_s.scrollTop = top;
}
}
};
this.extend = function extend(obj, src) {
for (var key in src) {
try {
// if (src.hasOwnProperty(key)) obj[key] = src[key];
obj[key] = src[key];
} catch (e) { }
}
return obj;
};
this.autoscroll = function (offset, poffset, parentNode) {
//info.innerHTML=JSON.stringify(offset);
//info.innerHTML+='<br>'+JSON.stringify(poffset);
// var xb = this.xcell;
// var yb = this.ycell;
var xb = 0;
var yb = 0;
// var xb = -this.xcell;
// var yb = -this.ycell;
if (poffset.isBody == true) {
var scrollLeft = poffset.scrollLeft;
var scrollTop = poffset.scrollTop;
//var scrollbarwidth = window.pageXOffset ? (document.documentElement.scrollWidth - document.body.clientWidth) : (document.documentElement.clientWidth - document.body.offsetWidth); //Chrome & IE 16
// info.innerHTML = '<br>' + (document.documentElement.scrollWidth - document.body.clientWidth);
// info.innerHTML += '<br>' + (document.documentElement.clientWidth - document.body.offsetWidth);//IE
var scrollbarwidth = (document.documentElement.clientWidth - document.body.offsetWidth); //All
var scrollspeed = (offset.right + xb) - (poffset.right + scrollbarwidth);
//info.innerHTML+='<br>'+scrollspeed;
if (scrollspeed > 0) {
this.scrollLeft(parentNode, scrollLeft + scrollspeed);
}
scrollspeed = offset.left - (xb);
if (scrollspeed < 0) {
this.scrollLeft(parentNode, scrollLeft + scrollspeed);
}
scrollspeed = (offset.bottom + yb) - (poffset.bottom);
//info.innerHTML+='<br>'+scrollspeed;
if (scrollspeed > 0) {
this.scrollTop(parentNode, scrollTop + scrollspeed);
}
scrollspeed = offset.top - (yb);
if (scrollspeed < 0) {
this.scrollTop(parentNode, scrollTop + scrollspeed);
}
} else {
var scrollLeft = offset.scrollLeft;
var scrollTop = offset.scrollTop;
var scrollbarwidth = parentNode.offsetWidth - parentNode.clientWidth; //17
var scrollbarheight = parentNode.offsetHeight - parentNode.clientHeight; //17
var scrollspeed = (offset.right + xb) - (poffset.right - scrollbarwidth);
//info.innerHTML+='<br>'+scrollspeed;
if (scrollspeed > 0) {
this.scrollLeft(parentNode, scrollLeft + scrollspeed);
}
scrollspeed = offset.left - (xb + poffset.left);
if (scrollspeed < 0) {
this.scrollLeft(parentNode, scrollLeft + scrollspeed);
}
scrollspeed = (offset.bottom + scrollbarheight + yb) - (poffset.bottom);
//info.innerHTML+='<br>'+scrollspeed;
if (scrollspeed > 0) {
this.scrollTop(parentNode, scrollTop + scrollspeed);
}
scrollspeed = offset.top - (yb + poffset.top);
if (scrollspeed < 0) {
this.scrollTop(parentNode, scrollTop + scrollspeed);
}
}
};
this.el = el_drg;
this.dragstarted = false;
this.dragmoved = false;
this.droppables = [];
this.dropinfo = null;
this.helper = null;
this.xcell = 1;//snap to grid x must be >=1
this.ycell = 1; //snap to grid y must be >=1
this.parentNode = null;
this.forceobjectmove = false;
this.dragforce = 1;
this.restricttoscrollview = true;
this.restrictlimit = null;
this.draghandle = null;
this.axis = 'both'; //'both,x,y
this.keyboardcontrol = false;
this.keySpeed = 10;
this.keys_on = false;
this.start = function (e) {
e = e || window.event;
var relTarg = e.relatedTarget || e.fromElement;
var relTarg = e.relatedTarget || e.toElement;
this.mx = e.clientX;
this.my = e.clientY;
// e.preventDefault();
(e.preventDefault) ? e.preventDefault() : e.returnValue = false;
if (this.dragstarted == true) {
return this;
}
this.dragstarted = true;
this.dragmoved = false;
document.onselectstart = function (e) {
return false;
};
if (this.mousedown) {
this.mousedown(e);
}
this.kx = 0;
this.ky = 0;
if (this.keyboardcontrol == true) {
// this.starte = e;
this.cur_e = this.extend({}, e);
this.starte = null;
// this.cur_e = null;
this.canmove = true;
this.keys_on = false;
this.l_l = true;
this.w_l = true;
this.t_l = true;
this.h_l = true;
this.el.focus();
}
return false;
};
this.move = function (e) {
e = e || window.event;
//if (this.dragstarted == true) {
// this.el.innerHTML = 'move ' + e.clientX;
//}
if (this.keys_on == true) {
if (!e.keys_on) {
return;
}
}
if (this.dragstarted == true && (this.dragmoved == false && !e.keys_on ? (Math.abs(this.mx - e.clientX) > this.dragforce || Math.abs(this.my - e.clientY) > this.dragforce) : true)) {
// this.kx = e.clientX;
// this.ky = e.clientY;
// e.preventDefault();
if (!e.keys_on) {
(e.preventDefault) ? e.preventDefault() : e.returnValue = false;
}
if (this.dragmoved == false) {
var offset = {};
var parentNode;
var eld;
if (this.helper) {
eld = this.helper;
if (this.helper.style.left == '') {
offset = this.getposition(this.el);
if (this.helper.parentNode != document.body) {
var poffset = this.helper.parentNode.getBoundingClientRect();
offset.left -= poffset.left + offset.scrollLeft;
offset.top -= poffset.top + offset.scrollTop;
}
var scrollLeft = this.scrollLeft(this.el.parentNode);
var scrollTop = this.scrollTop(this.el.parentNode);
offset.left += scrollLeft;
offset.top += scrollTop;
this.helper.style.left = (offset.left) + 'px'; //+this.scrollLeft(this.el.parentNode)
this.helper.style.top = (offset.top) + 'px'; //+this.scrollTop(this.el.parentNode)
}
this.helper.style.display = '';
} else {
eld = this.el;
}
if (this.draghandle) {
eld = this.draghandle;
}
parentNode = eld.parentNode;
offset = eld.getBoundingClientRect();
if (this.parentNode) {
parentNode = this.parentNode;
}
var ol = 0, ot = 0;
this.parents = [];
if (parentNode != document.body) {
var poffset = parentNode.getBoundingClientRect();
ol = poffset.left;
ot = poffset.top;
var obj = parentNode;
while (obj.offsetParent) {
this.parents.push(obj);
if (obj == document.body) {
break;
}
obj = obj.offsetParent;
}
// if (obj == document.body) {
// this.parents.push(obj);
// }
}
var scrollLeft = this.scrollLeft(parentNode);
var scrollTop = this.scrollTop(parentNode);
this.initialMouseX = scrollLeft + e.clientX;
this.initialMouseY = scrollTop + e.clientY;
this.startX = offset.left + scrollLeft;
this.startY = offset.top + scrollTop;
this.ol = ol;
this.ot = ot;
var dx = this.startX - this.ol + scrollLeft + e.clientX - this.initialMouseX;
var dy = this.startY - this.ot + scrollTop + e.clientY - this.initialMouseY;
dx = Math.floor(dx / this.xcell) * this.xcell;
dy = Math.floor(dy / this.ycell) * this.ycell;
if (parentNode == document.body) {
this.sw = Math.max(document.body.scrollWidth, document.documentElement.scrollWidth);
this.sh = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
} else {
this.sw = parentNode.scrollWidth;
this.sh = parentNode.scrollHeight;
}
this.dx = dx;
this.dy = dy;
if (this.beforedrag) {
if (this.beforedrag(dx, dy, scrollLeft + e.clientX, scrollTop + e.clientY, e) === false) {
this.dragmoved = true;
this.end(e);
return false;
}
}
if (this.keyboardcontrol == true) {
this.starte = e;
this.cur_e = this.extend({}, this.starte);
}
} //this.dragmoved==false
this.dragmoved = true;
var parentNode;
var eld;
if (this.helper) {
eld = this.helper;
} else {
eld = this.el;
}
if (this.draghandle) {
eld = this.draghandle;
}
parentNode = eld.parentNode;
if (this.parentNode) {
parentNode = this.parentNode;
}
var offset = this.getoffset(eld, false);
var poffset = this.getoffset(parentNode, false);
for (var i = 0; i < this.parents.length; i++) {
var o1 = this.getoffset(this.parents[i], false);
var o2 = this.getoffset(this.parents[i].parentNode, false);
o1.left = offset.left;
o1.right = offset.right;
o1.top = offset.top;
o1.bottom = offset.bottom;
var scrollspeed = (o1.right + this.xcell) - (o2.right - 16);
this.autoscroll(o1, o2, this.parents[i].parentNode);
}
if (this.parents.length > 0) {
//offset = this.getoffset(eld,false);
//poffset = this.getoffset(parentNode,false);
if (parentNode != document.body) {
var poffset = parentNode.getBoundingClientRect();
this.ol = poffset.left;
this.ot = poffset.top;
}
}
var scrollLeft = this.scrollLeft(parentNode);
var scrollTop = this.scrollTop(parentNode);
var dx = this.startX - this.ol + scrollLeft + e.clientX - this.initialMouseX;
var dy = this.startY - this.ot + scrollTop + e.clientY - this.initialMouseY;
dx = Math.floor(dx / this.xcell) * this.xcell;
dy = Math.floor(dy / this.ycell) * this.ycell;
var b = true;
this.l_l = false;
this.w_l = false;
this.t_l = false;
this.h_l = false;
if (this.restricttoscrollview == true) {
//info.innerHTML = (dx + offset.width - this.xcell) + 'x' + (this.sw);
if ((dx + offset.width - this.xcell) > (this.sw)) {
// b = false;
dx = this.sw - offset.width;
// this.kx -= (this.keySpeed*1);
this.w_l = true;
}
if (dx < 0) {
// b = false;
dx = 0;
// this.kx += (this.keySpeed * 1);
this.l_l = true;
}
if ((dy + offset.height - this.ycell) > (this.sh)) {
// b = false;
dy = this.sh - offset.height;
// this.ky -= (this.keySpeed * 1);
this.h_l = true;
}
if (dy < 0) {
// b = false;
dy = 0;
// this.ky += (this.keySpeed * 1);
this.t_l = true;
}
}
if (this.restrictlimit) {
if ((dx + offset.width - this.xcell) > (this.restrictlimit.width)) {
dx = this.restrictlimit.width - offset.width;
// this.kx -= (this.keySpeed * 2);
this.w_l = true;
}
if (dx < this.restrictlimit.left) {
dx = this.restrictlimit.left;
// this.kx += (this.keySpeed * 2);
this.l_l = true;
}
if ((dy + offset.height - this.ycell) > (this.restrictlimit.height)) {
dy = this.restrictlimit.height - offset.height;
// this.ky -= (this.keySpeed * 2);
this.h_l = true;
}
if (dy < this.restrictlimit.top) {
dy = this.restrictlimit.top;
// this.ky += (this.keySpeed * 2);
this.t_l = true;
}
}
if (this.keyboardcontrol == true) {
// this.kx = this.startX - this.ol + scrollLeft + e.clientX - this.initialMouseX;
// this.ky = this.startY - this.ot + scrollTop + e.clientY - this.initialMouseY;
// info.innerHTML = e.clientX + 'x' + (dx - (this.startX - this.ol + scrollLeft - this.initialMouseX));
// this.kx = dx - (this.startX + this.ol + scrollLeft - this.initialMouseX);
// this.ky = dy - (this.startY + this.ot + scrollTop - this.initialMouseY);
// this.kx = dx - (this.startX - this.initialMouseX+ this.ol + scrollLeft);
// this.ky = dy - (this.startY - this.initialMouseY+ this.ot + scrollTop);
// if (this.kx < (poffset.left - (this.starte.clientX))) {
// this.kx = (poffset.left - (this.starte.clientX));
// }
this.cur_e.clientX=(dx - (this.startX - this.ol + scrollLeft - this.initialMouseX));
}
if (b == true) {
if (this.axis == 'both' || this.axis == 'x') {
eld.style.left = dx + 'px';
}
if (this.axis == 'both' || this.axis == 'y') {
eld.style.top = dy + 'px';
}
this.autoscroll(offset, poffset, parentNode);
this.dx = dx;
this.dy = dy;
this.dropinfo = null;
for (var n = this.droppables.length - 1; n >= 0; n--) {
// this.droppables[n].style.border = '1px solid black';
if (this.droppables[n] != this.el) {
//var x=dx+this.initialMouseX-this.startX-this.ol;
//var y=dy+this.initialMouseY-this.startY-this.ot;
var x = e.clientX;
var y = e.clientY;
this.dropinfo = this.hittest(this.droppables[n], x, y);
if (this.dropinfo !== null) {
// dropped.target.style.border = '1px solid red';
break;
}
}
}
if (this.dragover) {
this.dragover(this.dropinfo, this.el, dx, dy, scrollLeft + e.clientX, scrollTop + e.clientY, e);
}
}
}
};
this.end = function (e) {
e = e || window.event;
//this.el.innerHTML = 'end ' + e.clientX;
if (this.dragstarted == true) {
this.dragstarted = false;
document.onselectstart = null;
if (this.dragmoved == true) {
(e.preventDefault) ? e.preventDefault() : e.returnValue = false;
e.cancelBubble = true;
if (e.stopPropagation) e.stopPropagation();
if (this.helper) {
if (this.forceobjectmove == true && this.dragmoved == true) {
this.el.style.left = this.dx + 'px';
this.el.style.top = this.dy + 'px';
}
this.helper.style.display = 'none';
}
if (this.dragdrop) {
this.dragdrop(this.dropinfo, this.el, this.dx, this.dy, e);
}
this.dragmoved = false;
this.canmove = false;
return false;
} else {
if (this.click) {
this.click(e);
}
}
}
if (this.mouseup) {
this.mouseup(e);
}
};
this.keycontrol = function (e) {
e = e || window.event;
if (this.canmove !== true) {
return true;
}
this.dragstarted = true;
this.keys_on = true;
if (this.starte) {
var key = e.keyCode;
switch (key) {
case 37: case 63234: // left
if (this.l_l == false) {
// this.kx -= ;
this.cur_e.clientX -= this.keySpeed ;
}
break;
case 39: case 63235: // right
if (this.w_l == false) {
// this.kx += this.keySpeed;
this.cur_e.clientX += this.keySpeed ;
}
break;
case 38: case 63232: // up
if (this.t_l == false) {
// this.ky -= this.keySpeed;
this.cur_e.clientY -= this.keySpeed ;
}
break;
case 40: case 63233: // down
if (this.h_l == false) {
// this.ky += this.keySpeed;
this.cur_e.clientY += this.keySpeed ;
}
break;
case 13: case 27:
this.end(e);
return false;
default:
return true;
}
// var ne = this.extend({}, this.starte);
// ne.keys_on = true;
// ne.clientX += this.kx;
// ne.clientY += this.ky;
// this.cur_e.clientX = this.starte.clientX + this.kx;
// this.cur_e.clientY = this.starte.clientY + this.ky;
}
this.cur_e.keys_on = true;
this.move(this.cur_e);
(e.preventDefault) ? e.preventDefault() : e.returnValue = false;
};
this.bindevents = function (b) {
var fn;
if (b == true) {
fn = this.addEventSimple;
} else {
fn = this.removeEventSimple;
}
var _this = this;
fn(this.el, 'mousedown', function (e) {
return _this.start(e);
});
fn(this.el, 'mousemove', function (e) {
return _this.move(e);
});
fn(this.el, 'mouseup', function (e) {
return _this.end(e);
});
fn(document, 'mousemove', function (e) {
return _this.move(e);
});
fn(document, 'mouseup', function (e) {
return _this.end(e);
});
fn(document, 'click', function (e) {
return _this.end(e);
});
this.addEventSimple(this.el, 'selectstart', function (e) {
return false;
});
if (this.el.addEventListener) {
this.el.addEventListener('touchstart', function (e) {
//_this.el.innerHTML = 'start ' + e.touches[0].clientX;
e.preventDefault();
_this.start(e.touches[0]);
});
this.el.addEventListener('touchmove', function (e) {
//_this.el.innerHTML = 'move ' + e.touches[0].clientX;
e.preventDefault();
_this.move(e.touches[0]);
});
this.el.addEventListener('touchend', function (e) {
//_this.el.innerHTML = 'end ' + e.touches[0].clientX;
e.stopPropagation();
e.preventDefault();
_this.end(e.touches[0]);
});
document.addEventListener('touchmove', function (e) {
e.preventDefault();
_this.move(e.touches[0]);
});
document.addEventListener('touchend', function (e) {
e.stopPropagation();
e.preventDefault();
_this.end(e.touches[0]);
});
}
if (this.keyboardcontrol == true) {
var tabIndex = this.el.getAttribute('tabIndex');
if (!tabIndex) {
tabIndex = 0;
}
if (b == true) {
this.el.setAttribute('tabIndex', 0);
} else {
if (tabIndex == 0) {
this.el.removeAttribute('tabIndex');
}
}
fn(this.el, 'keydown', function (e) {
return _this.keycontrol(e);
});
}
};
this.attach=function(){
this.bindevents(true);
};
this.detach=function(){
this.bindevents(false);
};
this.reattach=function(){
this.bindevents(false);
this.bindevents(true);
};
this.attach();
return this;
} /*drag_auto_scroll*/

View File

@@ -0,0 +1,227 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Title</title>
<link rel="stylesheet" href="../dist/jkanban.min.css" />
<link
href="https://fonts.googleapis.com/css?family=Lato"
rel="stylesheet"
/>
<style>
body {
font-family: "Lato";
margin: 0;
padding: 0;
}
#myKanban {
overflow-x: auto;
padding: 20px 0;
}
.success {
background: #00b961;
}
.info {
background: #2a92bf;
}
.warning {
background: #f4ce46;
}
.error {
background: #fb7d44;
}
.custom-button {
background-color: #4CAF50;
border: none;
color: white;
padding: 7px 15px;
margin: 10px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
}
</style>
</head>
<body>
<div id="myKanban"></div>
<button id="addDefault">Add "Default" board</button>
<br />
<button id="addToDo">Add element in "To Do" Board</button>
<br />
<button id="addToDoAtPosition">Add element in "To Do" Board at position 2</button>
<br />
<button id="removeBoard">Remove "Done" Board</button>
<br />
<button id="removeElement">Remove "My Task Test"</button>
<script src="../dist/jkanban.js"></script>
<script>
var KanbanTest = new jKanban({
element: "#myKanban",
gutter: "10px",
widthBoard: "450px",
itemHandleOptions:{
enabled: true,
},
click: function(el) {
console.log("Trigger on all items click!");
},
context: function(el, e) {
console.log("Trigger on all items right-click!");
},
dropEl: function(el, target, source, sibling){
console.log(target.parentElement.getAttribute('data-id'));
console.log(el, target, source, sibling)
},
buttonClick: function(el, boardId) {
console.log(el);
console.log(boardId);
// create a form to enter element
var formItem = document.createElement("form");
formItem.setAttribute("class", "itemform");
formItem.innerHTML =
'<div class="form-group"><textarea class="form-control" rows="2" autofocus></textarea></div><div class="form-group"><button type="submit" class="btn btn-primary btn-xs pull-right">Submit</button><button type="button" id="CancelBtn" class="btn btn-default btn-xs pull-right">Cancel</button></div>';
KanbanTest.addForm(boardId, formItem);
formItem.addEventListener("submit", function(e) {
e.preventDefault();
var text = e.target[0].value;
KanbanTest.addElement(boardId, {
title: text
});
formItem.parentNode.removeChild(formItem);
});
document.getElementById("CancelBtn").onclick = function() {
formItem.parentNode.removeChild(formItem);
};
},
itemAddOptions: {
enabled: true,
content: '+ Add New Card',
class: 'custom-button',
footer: true
},
boards: [
{
id: "_todo",
title: "To Do (Can drop item only in working)",
class: "info,good",
dragTo: ["_working"],
item: [
{
id: "_test_delete",
title: "Try drag this (Look the console)",
drag: function(el, source) {
console.log("START DRAG: " + el.dataset.eid);
},
dragend: function(el) {
console.log("END DRAG: " + el.dataset.eid);
},
drop: function(el) {
console.log("DROPPED: " + el.dataset.eid);
}
},
{
title: "Try Click This!",
click: function(el) {
alert("click");
},
context: function(el, e){
alert("right-click at (" + `${e.pageX}` + "," + `${e.pageX}` + ")")
},
class: ["peppe", "bello"]
}
]
},
{
id: "_working",
title: "Working (Try drag me too)",
class: "warning",
item: [
{
title: "Do Something!"
},
{
title: "Run?"
}
]
},
{
id: "_done",
title: "Done (Can drop item only in working)",
class: "success",
dragTo: ["_working"],
item: [
{
title: "All right"
},
{
title: "Ok!"
}
]
}
]
});
var toDoButton = document.getElementById("addToDo");
toDoButton.addEventListener("click", function() {
KanbanTest.addElement("_todo", {
title: "Test Add"
});
});
var toDoButtonAtPosition = document.getElementById("addToDoAtPosition");
toDoButtonAtPosition.addEventListener("click", function() {
KanbanTest.addElement("_todo", {
title: "Test Add at Pos"
}, 1);
});
var addBoardDefault = document.getElementById("addDefault");
addBoardDefault.addEventListener("click", function() {
KanbanTest.addBoards([
{
id: "_default",
title: "Kanban Default",
item: [
{
title: "Default Item"
},
{
title: "Default Item 2"
},
{
title: "Default Item 3"
}
]
}
]);
});
var removeBoard = document.getElementById("removeBoard");
removeBoard.addEventListener("click", function() {
KanbanTest.removeBoard("_done");
});
var removeElement = document.getElementById("removeElement");
removeElement.addEventListener("click", function() {
KanbanTest.removeElement("_test_delete");
});
var allEle = KanbanTest.getBoardElements("_todo");
allEle.forEach(function(item, index) {
//console.log(item);
});
</script>
</body>
</html>

View File

@@ -0,0 +1,3 @@
const config = require('./jest.config')
config.testMatch = ['**/*.spec.js']
module.exports = config

View File

@@ -0,0 +1,5 @@
module.exports = {
coverageDirectory: 'coverage',
testEnvironment: 'node',
collectCoverageFrom: ['jkanban.js']
}

View File

@@ -0,0 +1,159 @@
.kanban-container {
position: relative;
box-sizing: border-box;
width: auto;
}
.kanban-container * {
box-sizing: border-box;
}
.kanban-container:after {
clear: both;
display: block;
content: "";
}
.kanban-board {
position: relative;
float: left;
background: #e2e4e6;
transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}
.kanban-board.disabled-board {
opacity: 0.3;
}
.kanban-board.is-moving.gu-mirror {
transform: rotate(3deg);
}
.kanban-board.is-moving.gu-mirror .kanban-drag {
overflow: hidden;
padding-right: 50px;
}
.kanban-board header {
font-size: 16px;
padding: 15px;
}
.kanban-board header .kanban-title-board {
font-weight: 700;
margin: 0;
padding: 0;
display: inline;
}
.kanban-board header .kanban-title-button {
float: right;
}
.kanban-board .kanban-drag {
min-height: 200px;
padding: 20px;
}
.kanban-board:after {
clear: both;
display: block;
content: "";
}
.kanban-item {
background: #fff;
padding: 15px;
margin-bottom: 20px;
transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
animation: append-animate 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}
@keyframes append-animate {
from {
transform: translateY(-20px);
}
to {
transform: translateY(0px);
}
}
.kanban-item:hover {
cursor: move;
}
.kanban-item:last-child {
margin: 0;
}
.kanban-item.is-moving.gu-mirror {
transform: rotate(3deg);
height: auto !important;
}
/* Dragula CSS */
.gu-mirror {
position: fixed !important;
margin: 0 !important;
z-index: 9999 !important;
}
.gu-hide {
display: none !important;
}
.gu-unselectable {
-webkit-user-select: none !important;
-moz-user-select: none !important;
-ms-user-select: none !important;
user-select: none !important;
}
.gu-transit {
opacity: 0.2 !important;
transform: rotate(0deg) !important;
}
.drag_handler {
background: #fff;
border-radius: 50%;
width: 24px;
height: 24px;
position: relative;
float: left;
top: -3px;
margin-right: 4px;
}
.drag_handler:hover {
cursor: move;
}
.drag_handler_icon {
position: relative;
display: block;
background: #000;
width: 24px;
height: 2px;
top: 12px;
transition: .5s ease-in-out;
}
.drag_handler_icon:before,
.drag_handler_icon:after {
background: #000;
content: '';
display: block;
width: 100%;
height: 100%;
position: absolute;
transition: .5s ease-in-out;
}
.drag_handler_icon:before {
top: 6px;
}
.drag_handler_icon:after {
bottom: 6px;
}

View File

@@ -0,0 +1,608 @@
/**
* jKanban
* Vanilla Javascript plugin for manage kanban boards
*
* @site: http://www.riccardotartaglia.it/jkanban/
* @author: Riccardo Tartaglia
*/
//Require dragula
var dragula = require('dragula');
(function () {
this.jKanban = function () {
var self = this
var __DEFAULT_ITEM_HANDLE_OPTIONS = {
enabled: false
}
var __DEFAULT_ITEM_ADD_OPTIONS = {
enabled: false
}
this._disallowedItemProperties = [
'id',
'title',
'click',
'context',
'drag',
'dragend',
'drop',
'order'
]
this.element = ''
this.container = ''
this.boardContainer = []
this.handlers = []
this.dragula = dragula
this.drake = ''
this.drakeBoard = ''
this.itemAddOptions = __DEFAULT_ITEM_ADD_OPTIONS
this.itemHandleOptions = __DEFAULT_ITEM_HANDLE_OPTIONS
var defaults = {
element: '',
gutter: '15px',
widthBoard: '250px',
responsive: '700',
responsivePercentage: false,
boards: [],
dragBoards: true,
dragItems: true, //whether can drag cards or not, useful when set permissions on it.
itemAddOptions: __DEFAULT_ITEM_ADD_OPTIONS,
itemHandleOptions: __DEFAULT_ITEM_HANDLE_OPTIONS,
dragEl: function (el, source) {},
dragendEl: function (el) {},
dropEl: function (el, target, source, sibling) {},
dragBoard: function (el, source) {},
dragendBoard: function (el) {},
dropBoard: function (el, target, source, sibling) {},
click: function (el) {},
context: function (el, e) {},
buttonClick: function (el, boardId) {},
propagationHandlers: [],
}
if (arguments[0] && typeof arguments[0] === 'object') {
this.options = __extendDefaults(defaults, arguments[0])
}
this.__getCanMove = function (handle) {
if (!self.options.itemHandleOptions.enabled) {
return !!self.options.dragItems
}
if (self.options.itemHandleOptions.handleClass) {
return handle.classList.contains(self.options.itemHandleOptions.handleClass)
}
return handle.classList.contains('item_handle')
}
this.init = function () {
//set initial boards
__setBoard()
//set drag with dragula
if (window.innerWidth > self.options.responsive) {
//Init Drag Board
self.drakeBoard = self
.dragula([self.container], {
moves: function (el, source, handle, sibling) {
if (!self.options.dragBoards) return false
return (
handle.classList.contains('kanban-board-header') ||
handle.classList.contains('kanban-title-board')
)
},
accepts: function (el, target, source, sibling) {
return target.classList.contains('kanban-container')
},
revertOnSpill: true,
direction: 'horizontal'
})
.on('drag', function (el, source) {
el.classList.add('is-moving')
self.options.dragBoard(el, source)
if (typeof el.dragfn === 'function') el.dragfn(el, source)
})
.on('dragend', function (el) {
__updateBoardsOrder()
el.classList.remove('is-moving')
self.options.dragendBoard(el)
if (typeof el.dragendfn === 'function') el.dragendfn(el)
})
.on('drop', function (el, target, source, sibling) {
el.classList.remove('is-moving')
self.options.dropBoard(el, target, source, sibling)
if (typeof el.dropfn === 'function')
el.dropfn(el, target, source, sibling)
})
//Init Drag Item
self.drake = self
.dragula(self.boardContainer, {
moves: function (el, source, handle, sibling) {
return self.__getCanMove(handle)
},
revertOnSpill: true
})
.on('cancel', function (el, container, source) {
self.enableAllBoards()
})
.on('drag', function (el, source) {
var elClass = el.getAttribute('class')
if (elClass !== '' && elClass.indexOf('not-draggable') > -1) {
self.drake.cancel(true)
return
}
el.classList.add('is-moving')
self.options.dragEl(el, source)
var boardJSON = __findBoardJSON(source.parentNode.dataset.id)
if (boardJSON.dragTo !== undefined) {
self.options.boards.map(function (board) {
if (
boardJSON.dragTo.indexOf(board.id) === -1 &&
board.id !== source.parentNode.dataset.id
) {
self.findBoard(board.id).classList.add('disabled-board')
}
})
}
if (el !== null && typeof el.dragfn === 'function')
el.dragfn(el, source)
})
.on('dragend', function (el) {
self.options.dragendEl(el)
if (el !== null && typeof el.dragendfn === 'function')
el.dragendfn(el)
})
.on('drop', function (el, target, source, sibling) {
self.enableAllBoards()
var boardJSON = __findBoardJSON(source.parentNode.dataset.id)
if (boardJSON.dragTo !== undefined) {
if (
boardJSON.dragTo.indexOf(target.parentNode.dataset.id) === -1 &&
target.parentNode.dataset.id !== source.parentNode.dataset.id
) {
self.drake.cancel(true)
}
}
if (el !== null) {
var result = self.options.dropEl(el, target, source, sibling)
if (result === false) {
self.drake.cancel(true)
}
el.classList.remove('is-moving')
if (typeof el.dropfn === 'function')
el.dropfn(el, target, source, sibling)
}
})
}
}
this.enableAllBoards = function () {
var allB = document.querySelectorAll('.kanban-board')
if (allB.length > 0 && allB !== undefined) {
for (var i = 0; i < allB.length; i++) {
allB[i].classList.remove('disabled-board')
}
}
}
this.addElement = function (boardID, element, position) {
if (typeof position === 'undefined') {
position = -1
}
var board = self.element.querySelector(
'[data-id="' + boardID + '"] .kanban-drag'
)
var refElement = board.childNodes[position]
var nodeItem = document.createElement('div')
nodeItem.classList.add('kanban-item')
if (typeof element.id !== 'undefined' && element.id !== '') {
nodeItem.setAttribute('data-eid', element.id)
}
if (element.class && Array.isArray(element.class)) {
element.class.forEach(function (cl) {
nodeItem.classList.add(cl)
})
}
nodeItem.innerHTML = __buildItemCard(element)
//add function
nodeItem.clickfn = element.click
nodeItem.contextfn = element.context;
nodeItem.dragfn = element.drag
nodeItem.dragendfn = element.dragend
nodeItem.dropfn = element.drop
__appendCustomProperties(nodeItem, element)
__onclickHandler(nodeItem)
__onContextHandler(nodeItem)
if (self.options.itemHandleOptions.enabled) {
nodeItem.style.cursor = 'default'
}
board.insertBefore(nodeItem, refElement)
return self
}
this.addForm = function (boardID, formItem) {
var board = self.element.querySelector(
'[data-id="' + boardID + '"] .kanban-drag'
)
var _attribute = formItem.getAttribute('class')
formItem.setAttribute('class', _attribute + ' not-draggable')
board.appendChild(formItem)
return self
}
this.addBoards = function (boards, isInit) {
if (self.options.responsivePercentage) {
self.container.style.width = '100%'
self.options.gutter = '1%'
if (window.innerWidth > self.options.responsive) {
var boardWidth = (100 - boards.length * 2) / boards.length
} else {
var boardWidth = 100 - boards.length * 2
}
} else {
var boardWidth = self.options.widthBoard
}
var addButton = self.options.itemAddOptions.enabled
var buttonContent = self.options.itemAddOptions.content
var buttonClass = self.options.itemAddOptions.class
var buttonFooter = self.options.itemAddOptions.footer
//for on all the boards
for (var boardkey in boards) {
// single board
var board = boards[boardkey]
if (!isInit) {
self.options.boards.push(board)
}
if (!self.options.responsivePercentage) {
//add width to container
if (self.container.style.width === '') {
self.container.style.width =
parseInt(boardWidth) + parseInt(self.options.gutter) * 2 + 'px'
} else {
self.container.style.width =
parseInt(self.container.style.width) +
parseInt(boardWidth) +
parseInt(self.options.gutter) * 2 +
'px'
}
}
//create node
var boardNode = document.createElement('div')
boardNode.dataset.id = board.id
boardNode.dataset.order = self.container.childNodes.length + 1
boardNode.classList.add('kanban-board')
//set style
if (self.options.responsivePercentage) {
boardNode.style.width = boardWidth + '%'
} else {
boardNode.style.width = boardWidth
}
boardNode.style.marginLeft = self.options.gutter
boardNode.style.marginRight = self.options.gutter
// header board
var headerBoard = document.createElement('header')
if (board.class !== '' && board.class !== undefined)
var allClasses = board.class.split(',')
else allClasses = []
headerBoard.classList.add('kanban-board-header')
allClasses.map(function (value) {
// Remove empty spaces
value = value.replace(/^[ ]+/g, '')
headerBoard.classList.add(value)
})
headerBoard.innerHTML =
'<div class="kanban-title-board">' + board.title + '</div>'
//content board
var contentBoard = document.createElement('main')
contentBoard.classList.add('kanban-drag')
if (board.bodyClass !== '' && board.bodyClass !== undefined)
var bodyClasses = board.bodyClass.split(',')
else bodyClasses = []
bodyClasses.map(function (value) {
contentBoard.classList.add(value)
})
//add drag to array for dragula
self.boardContainer.push(contentBoard)
for (var itemkey in board.item) {
//create item
var itemKanban = board.item[itemkey]
var nodeItem = document.createElement('div')
nodeItem.classList.add('kanban-item')
if (itemKanban.id) {
nodeItem.dataset.eid = itemKanban.id
}
if (itemKanban.class && Array.isArray(itemKanban.class)) {
itemKanban.class.forEach(function (cl) {
nodeItem.classList.add(cl)
})
}
nodeItem.innerHTML = __buildItemCard(itemKanban)
//add function
nodeItem.clickfn = itemKanban.click
nodeItem.contextfn = itemKanban.context
nodeItem.dragfn = itemKanban.drag
nodeItem.dragendfn = itemKanban.dragend
nodeItem.dropfn = itemKanban.drop
__appendCustomProperties(nodeItem, itemKanban)
//add click handler of item
__onclickHandler(nodeItem)
__onContextHandler(nodeItem)
if (self.options.itemHandleOptions.enabled) {
nodeItem.style.cursor = 'default'
}
contentBoard.appendChild(nodeItem)
}
//footer board
var footerBoard = document.createElement('footer')
// if add button is true, add button to the board
if (addButton) {
var btn = document.createElement('BUTTON')
var t = document.createTextNode(buttonContent ? buttonContent : '+')
btn.setAttribute(
'class',
buttonClass ? buttonClass : 'kanban-title-button btn btn-default btn-xs'
)
btn.appendChild(t)
//var buttonHtml = '<button class="kanban-title-button btn btn-default btn-xs">'+buttonContent+'</button>'
if (buttonFooter) {
footerBoard.appendChild(btn)
} else {
headerBoard.appendChild(btn)
}
__onButtonClickHandler(btn, board.id)
}
//board assembly
boardNode.appendChild(headerBoard)
boardNode.appendChild(contentBoard)
boardNode.appendChild(footerBoard)
//board add
self.container.appendChild(boardNode)
}
return self
}
this.findBoard = function (id) {
var el = self.element.querySelector('[data-id="' + id + '"]')
return el
}
this.getParentBoardID = function (el) {
if (typeof el === 'string') {
el = self.element.querySelector('[data-eid="' + el + '"]')
}
if (el === null) {
return null
}
return el.parentNode.parentNode.dataset.id
}
this.moveElement = function (targetBoardID, elementID, element) {
if (targetBoardID === this.getParentBoardID(elementID)) {
return
}
this.removeElement(elementID)
return this.addElement(targetBoardID, element)
}
this.replaceElement = function (el, element) {
var nodeItem = el
if (typeof nodeItem === 'string') {
nodeItem = self.element.querySelector('[data-eid="' + el + '"]')
}
nodeItem.innerHTML = __buildItemCard(element)
// add function
nodeItem.clickfn = element.click
nodeItem.contextfn = element.context
nodeItem.dragfn = element.drag
nodeItem.dragendfn = element.dragend
nodeItem.dropfn = element.drop
__appendCustomProperties(nodeItem, element)
__onclickHandler(nodeItem)
__onContextHandler(nodeItem)
return self
}
this.findElement = function (id) {
var el = self.element.querySelector('[data-eid="' + id + '"]')
return el
}
this.getBoardElements = function (id) {
var board = self.element.querySelector(
'[data-id="' + id + '"] .kanban-drag'
)
return board.childNodes
}
this.removeElement = function (el) {
if (typeof el === 'string')
el = self.element.querySelector('[data-eid="' + el + '"]')
if (el !== null) {
//fallback for IE
if (typeof el.remove == 'function') {
el.remove()
} else {
el.parentNode.removeChild(el)
}
}
return self
}
this.removeBoard = function (board) {
var boardElement = null
if (typeof board === 'string')
boardElement = self.element.querySelector('[data-id="' + board + '"]')
if (boardElement !== null) {
//fallback for IE
if (typeof boardElement.remove == 'function') {
boardElement.remove()
} else {
boardElement.parentNode.removeChild(boardElement)
}
}
// remove thboard in options.boards
for (var i = 0; i < self.options.boards.length; i++) {
if (self.options.boards[i].id === board) {
self.options.boards.splice(i, 1)
break
}
}
return self
}
// board button on click function
this.onButtonClick = function (el) {}
//PRIVATE FUNCTION
function __extendDefaults (source, properties) {
var property
for (property in properties) {
if (properties.hasOwnProperty(property)) {
source[property] = properties[property]
}
}
return source
}
function __setBoard () {
self.element = document.querySelector(self.options.element)
//create container
var boardContainer = document.createElement('div')
boardContainer.classList.add('kanban-container')
self.container = boardContainer
//add boards
if (document.querySelector(self.options.element).dataset.hasOwnProperty('board')) {
url = document.querySelector(self.options.element).dataset.board
window.fetch(url, {
method: 'GET',
headers: { 'Content-Type': 'application/json' }
})
.then(function (response) {
// log response text
response.json().then(function (data) {
self.options.boards = data
self.addBoards(self.options.boards, true)
})
})
.catch(function (error) {
console.log('Error: ', error)
})
} else {
self.addBoards(self.options.boards, true)
}
//appends to container
self.element.appendChild(self.container)
}
function __onclickHandler (nodeItem, clickfn) {
nodeItem.addEventListener('click', function (e) {
if (!self.options.propagationHandlers.includes('click')) e.preventDefault()
self.options.click(this)
if (typeof this.clickfn === 'function') this.clickfn(this)
})
}
function __onContextHandler(nodeItem, contextfn) {
if (nodeItem.addEventListener) {
nodeItem.addEventListener('contextmenu', function (e) {
if (!self.options.propagationHandlers.includes('context')) e.preventDefault()
self.options.context(this, e)
if (typeof this.contextfn === 'function') this.contextfn(this, e)
}, false)
} else {
nodeItem.attachEvent('oncontextmenu', function () {
self.options.context(this)
if (typeof this.contextfn === 'function') this.contextfn(this)
if (!self.options.propagationHandlers.includes('context')) window.event.returnValue = false
})
}
}
function __onButtonClickHandler (nodeItem, boardId) {
nodeItem.addEventListener('click', function (e) {
e.preventDefault()
self.options.buttonClick(this, boardId)
// if(typeof(this.clickfn) === 'function')
// this.clickfn(this);
})
}
function __findBoardJSON (id) {
var el = []
self.options.boards.map(function (board) {
if (board.id === id) {
return el.push(board)
}
})
return el[0]
}
function __appendCustomProperties (element, parentObject) {
for (var propertyName in parentObject) {
if (self._disallowedItemProperties.indexOf(propertyName) > -1) {
continue
}
element.setAttribute(
'data-' + propertyName,
parentObject[propertyName]
)
}
}
function __updateBoardsOrder () {
var index = 1
for (var i = 0; i < self.container.childNodes.length; i++) {
self.container.childNodes[i].dataset.order = index++
}
}
function __buildItemCard(item) {
var result = 'title' in item ? item.title : '';
if (self.options.itemHandleOptions.enabled) {
if ((self.options.itemHandleOptions.customHandler || undefined) === undefined) {
var customCssHandler = self.options.itemHandleOptions.customCssHandler
var customCssIconHandler = self.options.itemHandleOptions.customCssIconHandler
var customItemLayout = self.options.itemHandleOptions.customItemLayout
if ((customCssHandler || undefined) === undefined) {
customCssHandler = 'drag_handler';
}
if ((customCssIconHandler || undefined) === undefined) {
customCssIconHandler = customCssHandler + '_icon';
}
if ((customItemLayout || undefined) === undefined) {
customItemLayout = '';
}
result = '<div class=\'item_handle ' + customCssHandler + '\'><i class=\'item_handle ' + customCssIconHandler + '\'></i></div><div>' + result + '</div>'
} else {
result = '<div> ' + self.options.itemHandleOptions.customHandler.replace(/%([^%]+)%/g, function (match, key)
{ return item[key] !== undefined ? item[key] : '' }) + ' </div>'
return result
}
}
return result
}
//init plugin
this.init()
}
})()

View File

@@ -0,0 +1,49 @@
require('./jkanban');
const initializeDom = () => {
document.body.innerHTML = '<div id="test"></div>';
}
beforeEach(() => {
initializeDom();
})
const makeSut = (additionalParams) => {
let options = {
element: "#test"
}
if (additionalParams !== undefined) {
for (var prop in additionalParams) {
options[prop] = additionalParams[prop];
}
}
let jkanban = new jKanban(options);
return jkanban;
}
describe('jKanban TestCase', () => {
test('Should init jKanban', async () => {
const sut = makeSut()
const expected = document.createElement("div")
expected.setAttribute("id", "test")
expected.innerHTML = "<div class=\"kanban-container\"></div>"
expect(sut.element).toStrictEqual(expected);
})
test('Should add a board with no items', async () => {
const boardName = "test-board"
const sut = makeSut({
boards: [
{
"id": boardName
}
]
})
expect(sut.findBoard(boardName)).not.toBeUndefined()
expect(sut.getBoardElements(boardName).length).toEqual(0)
})
});

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,46 @@
{
"name": "jkanban",
"version": "1.3.1",
"description": "Javascript plugin for Kanban boards",
"main": "jkanban.js",
"watch": {
"build": [
"jkanban.js",
"jkanban.css"
]
},
"scripts": {
"watch_build": "npm-watch build",
"build": "npm run scripts && npm run styles",
"scripts": "browserify ./jkanban.js -o dist/jkanban.js && uglifyjs -m -c -o dist/jkanban.min.js dist/jkanban.js",
"styles": "npm-css ./jkanban.css > dist/jkanban.css && cleancss dist/jkanban.css -o dist/jkanban.min.css",
"test": "jest --env=jsdom"
},
"repository": {
"type": "git",
"url": "https://github.com/riktar/jkanban.git"
},
"homepage": "http://www.riccardotartaglia.it/jkanban",
"keywords": [
"kanban",
"js",
"drag",
"todo list",
"javascript",
"plugin"
],
"author": "Riccardo Tartaglia",
"license": "Apache 2.0",
"dependencies": {
"dragula": "^3.7.3",
"npm-watch": "^0.7.0"
},
"devDependencies": {
"browserify": "^17.0.0",
"clean-css-cli": "^4.3.0",
"husky": "^5.0.6",
"jest": "^26.6.3",
"npm-css": "0.2.3",
"uglify-es": "^3.3.9"
}
}

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,14 @@
<?php
date_default_timezone_set('America/Chicago');
require dirname( __DIR__, 4 ) . "/includes/init.php";
require dirname( __DIR__, 4 ) . "/includes/functions.php";
if(Input::get("init")){
init();
}
function init(){
echo json_encode(array("success" => true));
}
?>

View File

@@ -0,0 +1,70 @@
/* styles */
#maincontainer {
/* height: 100vh; */
}
/* Let's highlight canvas boundaries */
#gjs {
border: 3px solid #444;
}
/* Reset some default styling */
.gjs-cv-canvas {
top: 0;
width: 100%;
height: 100%;
}
.gjs-block {
width: auto;
height: auto;
min-height: auto;
}
.panel__top {
padding: 0;
width: 100%;
display: flex;
position: initial;
justify-content: center;
justify-content: space-between;
}
.panel__basic-actions {
position: initial;
}
.editor-row {
display: flex;
justify-content: flex-start;
align-items: stretch;
flex-wrap: nowrap;
height: 300px;
}
.editor-canvas {
flex-grow: 1;
}
.panel__right {
flex-basis: 230px;
position: relative;
overflow-y: auto;
}
.panel__switcher {
position: initial;
}

View File

@@ -0,0 +1,82 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8">
<title>SurveyJS Test</title>
<!-- Boxiocns CDN Link -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href='https://unpkg.com/boxicons@2.0.7/css/boxicons.min.css' rel='stylesheet'>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta2/css/all.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.6.3.min.js" integrity="sha256-pvPw+upLPUjgMXY0G+8O0xUf+/Im1MZjXxxgOcBQBXU=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.13.6/underscore-min.js" integrity="sha512-2V49R8ndaagCOnwmj8QnbT1Gz/rie17UouD9Re5WxbzRVUGoftCu5IuqqtAM9+UC3fwfHCSJR1hkzNQh/2wdtg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.4.1/backbone-min.js" integrity="sha512-TztyCWDNoN0YKl30gDCMKsiWs35juID+W7ZM2uvPeLLmiNvZg789SglgB/QeUbewqIF2Z4mVq3PyIEa+YXXADQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.4/moment.min.js"></script>
<script src="/portal/admin/core/api/js/libs/appfactory/appfactory3.js"></script>
<script src="/portal/admin/core/api/js/libs/appfactory/afssponsorship.js"></script>
<script src="/portal/admin/core/api/js/libs/appfactory/afssubscriber.js"></script>
<script src="/portal/admin/core/api/js/libs/appfactory/afsnotifications.js"></script>
<script src="/portal/admin/core/api/js/libs/appfactory/afspayments.js"></script>
<script src="/portal/admin/core/api/js/libs/appfactory/afsform.js"></script>
<script src="/portal/admin/core/api/js/libs/appfactory/afsextras.js"></script>
<script src="/portal/admin/core/api/js/libs/appfactory/afsevents.js"></script>
<script src="/portal/admin/core/api/js/libs/appfactory/afsdocuments.js"></script>
<script src="/portal/admin/core/api/js/libs/appfactory/afsaccount.js"></script>
<script src="/portal/admin/core/api/js/libs/appfactory/afsemail.js"></script>
<script src="/portal/admin/core/api/js/libs/appfactory/afsanalytics.js"></script>
<script src="/portal/admin/core/api/js/libs/appfactory/afsdonations.js"></script>
<script src="/portal/admin/core/api/js/libs/appfactory/afsspinner.js"></script>
<link href="/portal/admin/core/api/styles/tabler/tabler.min.css" rel="stylesheet"/>
<script src="/portal/admin/core/api/js/libs/tabler/tabler.js"></script>
</head>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container-fluid">
<div id="surveyContainer"></div>
<div id="resultsContainer" style="display:none;">
<p>Result JSON:</p>
<code id="surveyResults" style="white-space:pre;"></code>
</div>
<!-- <div class="row d-flex justify-content-center">
<div class="col-4">
<div id="surveyContainer"></div>
</div>
</div> -->
</div>
<script data-main="main" src="/portal/admin/core/api/js/libs/require.js"></script>
</body>
</html>

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,14 @@
<?php
date_default_timezone_set('America/Chicago');
require dirname( __DIR__, 4 ) . "/includes/init.php";
require dirname( __DIR__, 4 ) . "/includes/functions.php";
if(Input::get("init")){
init();
}
function init(){
echo json_encode(array("success" => true));
}
?>

View File

@@ -0,0 +1,70 @@
/* styles */
#maincontainer {
/* height: 100vh; */
}
/* Let's highlight canvas boundaries */
#gjs {
border: 3px solid #444;
}
/* Reset some default styling */
.gjs-cv-canvas {
top: 0;
width: 100%;
height: 100%;
}
.gjs-block {
width: auto;
height: auto;
min-height: auto;
}
.panel__top {
padding: 0;
width: 100%;
display: flex;
position: initial;
justify-content: center;
justify-content: space-between;
}
.panel__basic-actions {
position: initial;
}
.editor-row {
display: flex;
justify-content: flex-start;
align-items: stretch;
flex-wrap: nowrap;
height: 300px;
}
.editor-canvas {
flex-grow: 1;
}
.panel__right {
flex-basis: 230px;
position: relative;
overflow-y: auto;
}
.panel__switcher {
position: initial;
}