Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List item menu #1929

Open
wants to merge 78 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
8ba6a6d
Initial commit for ListItemMenu Component.
thibaultzanini Jan 4, 2018
cc56061
Add ListItemMenu .info
thibaultzanini Jan 4, 2018
103edd4
Fix an issue when sliding left and right.
thibaultzanini Jan 5, 2018
0a01b5c
Can swipe for opening ListItemMenu
thibaultzanini Jan 5, 2018
a6f0ac4
Close an opened ListItemMenu after an user click
thibaultzanini Jan 5, 2018
f6cb50e
Fix an issue when sliding an opened ListItemMenu
thibaultzanini Jan 5, 2018
2ec8c1d
Auto open ListItemMenu when min distance is reached.
thibaultzanini Jan 5, 2018
8013aaa
Improvements
thibaultzanini Jan 5, 2018
b2e2038
Remove console.log
thibaultzanini Jan 5, 2018
51d2712
Fix wrong isOpened value
thibaultzanini Jan 5, 2018
f9c5965
Add Math.sign Polyfill
thibaultzanini Jan 8, 2018
5491411
Center text button
thibaultzanini Jan 15, 2018
140a5fe
Cleaning up
Jan 15, 2018
9cee95f
Fix animation glitch and improvements.
thibaultzanini Jan 16, 2018
e04fdd8
Improve list item menu demo
thibaultzanini Jan 16, 2018
800752f
Avoid to have conflict between active items
thibaultzanini Jan 16, 2018
f3e9b44
Better verification
thibaultzanini Jan 16, 2018
2e1472f
Cancel swipe/translate if not options are shown.
thibaultzanini Jan 16, 2018
beb143b
Fix typo
thibaultzanini Jan 16, 2018
d863922
Fix a visual glitch with the button label.
thibaultzanini Jan 17, 2018
8c4cfce
Better computation of the distance
thibaultzanini Jan 18, 2018
87d8f34
Support multiple buttons
thibaultzanini Jan 19, 2018
ecf538f
Add more list item menu sample
thibaultzanini Jan 19, 2018
81f6c30
Css improvements
thibaultzanini Jan 19, 2018
e7e090a
Fix visual glitch with the more button.
thibaultzanini Jan 19, 2018
600b291
Better Swipe detection
thibaultzanini Jan 19, 2018
1d2c9e8
Add some css hooks for the list item menu
thibaultzanini Jan 19, 2018
5bb189c
Add more example of the list item menu.
thibaultzanini Jan 19, 2018
fafe288
Raise an Action event when the edge of a side has been reached.
thibaultzanini Jan 19, 2018
44c7628
Fix visual glitch
thibaultzanini Jan 19, 2018
bf222e3
Add an animation when side reached the end and improvements
thibaultzanini Jan 19, 2018
17ac9b9
Css clean up
thibaultzanini Jan 19, 2018
d7bc7de
Change animation
thibaultzanini Jan 19, 2018
6914464
Preparatory work for better elastic effect
thibaultzanini Jan 19, 2018
990631f
Workaround in order to animate the label of a button
thibaultzanini Jan 20, 2018
ef1ff14
Make smoother the elastic effect
thibaultzanini Jan 20, 2018
f8e1bac
Fix visual glich
thibaultzanini Jan 20, 2018
5124787
Cleaning up and Optimisation.
thibaultzanini Jan 23, 2018
9a8e457
Cleaning up and performance optimisation of the draw function
thibaultzanini Jan 24, 2018
842affd
fix lint
thibaultzanini Jan 24, 2018
c66bcd3
css improvements
thibaultzanini Apr 13, 2018
d9f200e
Add default list item component to the list item menu component
thibaultzanini Apr 13, 2018
b446c8e
Update list item menu sample
thibaultzanini Apr 13, 2018
ea6001f
Unlod/load the press-composer of the repetition when it's needed
thibaultzanini Apr 13, 2018
6f94de7
Update list item menu sample css.
thibaultzanini Apr 13, 2018
293505c
Make the list item menu working within a repetition
thibaultzanini Apr 13, 2018
64b09e2
Add default delete button to the list item menu
thibaultzanini Apr 13, 2018
018dc65
Make the list working with the list item menu
thibaultzanini Apr 13, 2018
ee670e4
Set the property targetElement when the translate composer dispatches…
thibaultzanini Apr 16, 2018
2abc5da
Make the list item menu compatible with the cascading list.
thibaultzanini Apr 16, 2018
20ed119
remove debugger statement
thibaultzanini Apr 18, 2018
c4fcc78
Refactor List Item menu logic
thibaultzanini Apr 20, 2018
59e0291
Fix glitches with the list item menu
thibaultzanini Apr 20, 2018
736f9d5
Cleaning up
thibaultzanini Apr 20, 2018
8229a12
Preparatory works for folding/unfloding an item when hovering it.
thibaultzanini Apr 21, 2018
96eefdc
Allow to fold the 2 sides of a list item menu.
thibaultzanini Apr 23, 2018
3e334b5
Cleaning up
thibaultzanini Apr 23, 2018
c7c3357
Sneak options when folding a list item menu
thibaultzanini Apr 23, 2018
daf55a9
Improvements
thibaultzanini Apr 23, 2018
7eb0b7c
Code clean up and document list item properties
thibaultzanini Apr 23, 2018
37ba727
Make sure the list item menu compute again its boundaries after resizing
thibaultzanini Apr 23, 2018
c9cb0e7
Only fold list item menu when the pointer is a mouse
thibaultzanini Apr 23, 2018
66382ee
Fix jshint warnings
thibaultzanini Apr 23, 2018
f91a3ad
Fix regression.
thibaultzanini Apr 24, 2018
c9b9999
Fix an issue when resizing
thibaultzanini Apr 24, 2018
1d58536
Refactor List Item Menu
thibaultzanini Apr 24, 2018
13a3654
Remove console logs
thibaultzanini Apr 25, 2018
e6bd3fb
Fix wrong distance logic
thibaultzanini Apr 25, 2018
73e6856
Fix wrong openedSide value
thibaultzanini Apr 25, 2018
0f31829
Fix open method
thibaultzanini Apr 25, 2018
9649af7
Make isTranslating property public
thibaultzanini Apr 25, 2018
01dc409
Rearrange code and cleaning up.
thibaultzanini Apr 25, 2018
0262457
Fix jshint warning
thibaultzanini Apr 25, 2018
f05b5b3
Can tweak min and max distance for automatically open/close a list it…
thibaultzanini Apr 25, 2018
8752882
Fix bad position for the hot corners
thibaultzanini Apr 25, 2018
2777b3e
Update the font awesome version dependency of some .info sample.
thibaultzanini Jul 16, 2018
0fabee7
performance improvements
thibaultzanini Jul 16, 2018
38196ee
Update the list item menu
thibaultzanini Jul 16, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions composer/translate-composer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1333,6 +1333,7 @@ var TranslateComposer = exports.TranslateComposer = Composer.specialize(/** @len
translateStartEvent.initCustomEvent("translateStart", true, true, null);
translateStartEvent.translateX = x;
translateStartEvent.translateY = y;
translateStartEvent.targetElement = this.element;
// Event needs to be the same shape as the one in flow-translate-composer
translateStartEvent.scroll = 0;
translateStartEvent.pointer = this._observedPointer;
Expand All @@ -1347,6 +1348,7 @@ var TranslateComposer = exports.TranslateComposer = Composer.specialize(/** @len
translateEndEvent.initCustomEvent("translateEnd", true, true, null);
translateEndEvent.translateX = this._translateX;
translateEndEvent.translateY = this._translateY;
translateEndEvent.targetElement = this.element;
// Event needs to be the same shape as the one in flow-translate-composer
translateEndEvent.scroll = 0;
translateEndEvent.pointer = this._observedPointer;
Expand All @@ -1361,6 +1363,7 @@ var TranslateComposer = exports.TranslateComposer = Composer.specialize(/** @len
translateCancelEvent.initCustomEvent("translateCancel", true, true, null);
translateCancelEvent.translateX = this._translateX;
translateCancelEvent.translateY = this._translateY;
translateCancelEvent.targetElement = this.element;
// Event needs to be the same shape as the one in flow-translate-composer
translateCancelEvent.scroll = 0;
translateCancelEvent.pointer = this._observedPointer;
Expand All @@ -1374,6 +1377,7 @@ var TranslateComposer = exports.TranslateComposer = Composer.specialize(/** @len
translateEvent.initCustomEvent("translate", true, true, null);
translateEvent.translateX = this._translateX;
translateEvent.translateY = this._translateY;
translateEvent.targetElement = this.element;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this to workaround the fact that today the target is the translate composer itself?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

// Event needs to be the same shape as the one in flow-translate-composer
translateEvent.scroll = 0;
translateEvent.pointer = this._observedPointer;
Expand Down
1 change: 1 addition & 0 deletions core/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
require("collections/shim");
require("./shim/object");
require("./shim/array");
require("./shim/math");
require("./extras/object");
require("./extras/date");
require("./extras/element");
Expand Down
8 changes: 8 additions & 0 deletions core/shim/math.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
if (!Math.sign) {
/**
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign
*/
Math.sign = function (x) {
return ((x > 0) - (x < 0)) || +x;
};
}
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ <h4>Components:</h4>
<a href="ui/html-fragment.info/sample/index.html">HTML Fragment</a>
<a href="ui/list.info/sample/index.html">List</a>
<a href="ui/list-item.info/sample/index.html">ListItem</a>
<a href="ui/list-item-menu.info/sample/index.html">ListItemMenu</a>
<a href="ui/number-field.info/sample/index.html">NumberField</a>
<a href="ui/placeholder.info/sample/index.html">Placeholder</a>
<a href="ui/radio.info/sample/index.html">Radio</a>
Expand Down
2 changes: 1 addition & 1 deletion test/mocks/data/icons/check.reel/check.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="check.css">
<link href="https://use.fontawesome.com/releases/v5.0.7/css/all.css" rel="stylesheet">
<link href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" rel="stylesheet">
<script type="text/montage-serialization">
{
"owner": {
Expand Down
2 changes: 1 addition & 1 deletion test/mocks/data/icons/department.reel/department.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<link href="https://use.fontawesome.com/releases/v5.0.7/css/all.css" rel="stylesheet">
<link href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" rel="stylesheet">
<script type="text/montage-serialization">
{
"owner": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"root": {
"prototype": "core/meta/user-interface-descriptor",
"values": {
"listItemMenuDeleteNameExpression": "'Delete'"
}
}
}
5 changes: 4 additions & 1 deletion test/mocks/data/models/employee-ui-descriptor.mjson
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
},
"collectionNameExpression": "'Employees'",
"nameExpression": "lastname + ' ' + firstname",
"descriptionExpression": "department"
"descriptionExpression": "department",
"collectionItemComponentModule": {
"%": "ui/list-item-menu.reel"
}
}
}
}
3 changes: 3 additions & 0 deletions test/mocks/data/models/employee.mjson
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
},
"montage/ui/cascading-list.reel": {
"%": "test/mocks/data/models/employee-cascading-list-ui-descriptor.mjson"
},
"montage/ui/list-item-menu.reel": {
"%": "test/mocks/data/models/employee-list-item-menu-ui-descriptor.mjson"
}
}
}
Expand Down
13 changes: 6 additions & 7 deletions ui/button.reel/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,13 +374,12 @@ var Button = exports.Button = Control.specialize(/** @lends module:"montage/ui/n
this._label = this.originalElement.firstChild.data;
}
if (!this.element.firstChild) {
this.element.appendChild(document.createTextNode(""));
var span = document.createElement("span");
span.appendChild(document.createTextNode(''));
this.element.appendChild(span);
}

this._labelNode = this.element.firstChild;
// this.setLabelInitialValue(this._labelNode.data)
// if (this._label === undefined) {
// this._label = this._labelNode.data;
// }
}

//this.classList.add("montage-Button");
Expand All @@ -403,8 +402,8 @@ var Button = exports.Button = Control.specialize(/** @lends module:"montage/ui/n
}
if (this.isInputElement) {
this._element.value = value;
} else if (this._labelNode) {
this._labelNode.data = value;
} else if (this._labelNode && this._labelNode.firstChild) {
this._labelNode.firstChild.data = value;
}
}
},
Expand Down
2 changes: 0 additions & 2 deletions ui/cascading-list.info/sample/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
<meta charset="utf-8">

<title>Cascading List Samples</title>
<link href="https://use.fontawesome.com/releases/v5.0.7/css/all.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/emojione/2.2.7/assets/css/emojione.min.css" rel="stylesheet">

<script src="../../../montage.js" async></script>
<script type="text/montage-serialization">
Expand Down
19 changes: 19 additions & 0 deletions ui/list-item-menu.info/sample/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">

<title>List Item Menu Sample</title>
<link href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" rel="stylesheet">
<script src="../../../montage.js" async></script>
<script type="text/montage-serialization">
{
"owner": {
"prototype": "montage/ui/loader.reel"
}
}
</script>
</head>
<body>
</body>
</html>
11 changes: 11 additions & 0 deletions ui/list-item-menu.info/sample/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "list-item-menu-sample",
"version": "0.1.0",
"private": true,
"dependencies": {
"montage": "*"
},
"mappings": {
"montage": "../../../"
}
}
82 changes: 82 additions & 0 deletions ui/list-item-menu.info/sample/ui/main.reel/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
html, body, .Main {
padding: 0;
margin: 0;
height: 100%;
font-family: "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}

.Main {
padding: 20px;
}

header {
margin: 60px 0;
font-size: 2rem;
text-align: center;
color: #33495d;
height: 40px;
}

.items {
margin: auto;
height: 500px;
width: 300px;
}

.ListItemMenu.gray .ListItemMenu-options button {
font-size: 14px;
white-space: nowrap;
color: rgb(100, 100, 100);
}

.ListItemMenu.gray .ListItemMenu-options button .dot {
background-color: rgb(100, 100, 100);
}

.ListItemMenu.gray.is-opened.right-side .ListItemMenu-content {
border-right: 1px solid #bdc3c7;
}

.ListItemMenu.gray.is-opened.left-side .ListItemMenu-content {
border-left: 1px solid #bdc3c7;
}

.ListItemMenu .archive {
background-color: #2C82C9;
}

.ListItemMenu .delete {
background-color: #e74c3c;
}

.ListItemMenu .more {
background-color: #9E9D9B;
}

.ListItemMenu .dot {
height: 5px;
width: 5px;
background-color: white;
border-radius: 50%;
display: inline-block;
}

.ListItemMenu .move {
background-color: #5659C9;
}

.ListItemMenu .pin {
background-color: #2CC990;
}

.ListItemMenu[data-montage-id='list-item-menu-8'] .ListItemMenu-content {
padding-left: 16px;
padding-right: 16px;
}
Loading