2019-03-19 23:27:21 +01:00
|
|
|
/**
|
|
|
|
* @provides javelin-workboard-drop-effect
|
|
|
|
* @requires javelin-install
|
|
|
|
* javelin-dom
|
|
|
|
* @javelin
|
|
|
|
*/
|
|
|
|
|
|
|
|
JX.install('WorkboardDropEffect', {
|
|
|
|
|
|
|
|
properties: {
|
|
|
|
icon: null,
|
|
|
|
color: null,
|
2019-03-20 03:29:33 +01:00
|
|
|
content: null,
|
2019-03-21 21:19:12 +01:00
|
|
|
isTriggerEffect: false,
|
|
|
|
isHeader: false,
|
2019-03-20 03:29:33 +01:00
|
|
|
conditions: []
|
2019-03-19 23:27:21 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
statics: {
|
|
|
|
newFromDictionary: function(map) {
|
|
|
|
return new JX.WorkboardDropEffect()
|
|
|
|
.setIcon(map.icon)
|
|
|
|
.setColor(map.color)
|
2019-03-20 03:29:33 +01:00
|
|
|
.setContent(JX.$H(map.content))
|
2019-03-21 21:19:12 +01:00
|
|
|
.setIsTriggerEffect(map.isTriggerEffect)
|
|
|
|
.setIsHeader(map.isHeader)
|
2019-03-20 03:29:33 +01:00
|
|
|
.setConditions(map.conditions || []);
|
2019-03-19 23:27:21 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
members: {
|
|
|
|
newNode: function() {
|
|
|
|
var icon = new JX.PHUIXIconView()
|
|
|
|
.setIcon(this.getIcon())
|
|
|
|
.setColor(this.getColor())
|
|
|
|
.getNode();
|
|
|
|
|
2019-03-21 21:19:12 +01:00
|
|
|
var attributes = {};
|
|
|
|
|
|
|
|
if (this.getIsHeader()) {
|
|
|
|
attributes.className = 'workboard-drop-preview-header';
|
|
|
|
}
|
|
|
|
|
|
|
|
return JX.$N('li', attributes, [icon, this.getContent()]);
|
2019-03-20 03:29:33 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
isEffectVisibleForCard: function(card) {
|
|
|
|
var conditions = this.getConditions();
|
|
|
|
|
|
|
|
var properties = card.getProperties();
|
|
|
|
for (var ii = 0; ii < conditions.length; ii++) {
|
|
|
|
var condition = conditions[ii];
|
|
|
|
|
|
|
|
var field = properties[condition.field];
|
|
|
|
var value = condition.value;
|
|
|
|
|
|
|
|
var result = true;
|
|
|
|
switch (condition.operator) {
|
|
|
|
case '!=':
|
|
|
|
result = (field !== value);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!result) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
2019-03-19 23:27:21 +01:00
|
|
|
}
|
2019-03-20 03:29:33 +01:00
|
|
|
|
2019-03-19 23:27:21 +01:00
|
|
|
}
|
|
|
|
});
|