Merge pull request #1378 from ONLYOFFICE/feature/combo-data-view-animation

Feature/combo data view animation
This commit is contained in:
Julia Radzhabova 2021-12-03 12:28:09 +03:00 committed by GitHub
commit c8707f2bc5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 143 additions and 78 deletions

View file

@ -81,6 +81,7 @@ define([
this.style = this.options.style; this.style = this.options.style;
this.hint = this.options.hint; this.hint = this.options.hint;
this.store = this.options.store || new Common.UI.DataViewStore(); this.store = this.options.store || new Common.UI.DataViewStore();
this.groups = this.options.groups;
this.itemWidth = this.options.itemWidth; this.itemWidth = this.options.itemWidth;
this.itemHeight = this.options.itemHeight; this.itemHeight = this.options.itemHeight;
this.menuMaxHeight = this.options.menuMaxHeight; this.menuMaxHeight = this.options.menuMaxHeight;
@ -92,18 +93,19 @@ define([
this.needFillComboView = false; this.needFillComboView = false;
this.minWidth = this.options.minWidth; this.minWidth = this.options.minWidth;
this.delayRenderTips = this.options.delayRenderTips || false; this.delayRenderTips = this.options.delayRenderTips || false;
this.itemTemplate = this.options.itemTemplate || _.template([
'<div class="style" id="<%= id %>">',
'<img src="<%= imageUrl %>" width="' + this.itemWidth + '" height="' + this.itemHeight + '"/>',
'<% if (typeof title !== "undefined") {%>',
'<span class="title"><%= title %></span>',
'<% } %>',
'</div>'
].join(''));
this.fieldPicker = new Common.UI.DataView({ this.fieldPicker = new Common.UI.DataView({
cls: 'field-picker', cls: 'field-picker',
allowScrollbar: false, allowScrollbar: false,
itemTemplate : _.template([ itemTemplate : this.itemTemplate,
'<div class="style" id="<%= id %>">',
'<img src="<%= imageUrl %>" width="' + this.itemWidth + '" height="' + this.itemHeight + '"/>',
'<% if (typeof title !== "undefined") {%>',
'<span class="title"><%= title %></span>',
'<% } %>',
'</div>'
].join('')),
delayRenderTips: this.delayRenderTips delayRenderTips: this.delayRenderTips
}); });
@ -128,15 +130,9 @@ define([
restoreHeight: this.menuMaxHeight, restoreHeight: this.menuMaxHeight,
style: 'max-height: '+this.menuMaxHeight+'px;', style: 'max-height: '+this.menuMaxHeight+'px;',
enableKeyEvents: this.options.enableKeyEvents, enableKeyEvents: this.options.enableKeyEvents,
groups: this.groups,
store: this.store, store: this.store,
itemTemplate : _.template([ itemTemplate : this.itemTemplate,
'<div class="style" id="<%= id %>">',
'<img src="<%= imageUrl %>" width="' + this.itemWidth + '" height="' + this.itemHeight + '"/>',
'<% if (typeof title !== "undefined") {%>',
'<span class="title"><%= title %></span>',
'<% } %>',
'</div>'
].join('')),
delayRenderTips: this.delayRenderTips delayRenderTips: this.delayRenderTips
}); });

View file

@ -790,11 +790,10 @@ define(function(){ 'use strict';
getEffectGroupData: function () { getEffectGroupData: function () {
return [ return [
{id: 'menu-effect-group-entrance', value: AscFormat.PRESET_CLASS_ENTR, displayValue: this.textEntrance}, {id: 'menu-effect-group-entrance', value: AscFormat.PRESET_CLASS_ENTR, caption: this.textEntrance},
{id: 'menu-effect-group-emphasis', value: AscFormat.PRESET_CLASS_EMPH, displayValue: this.textEmphasis}, {id: 'menu-effect-group-emphasis', value: AscFormat.PRESET_CLASS_EMPH, caption: this.textEmphasis},
{id: 'menu-effect-group-exit', value: AscFormat.PRESET_CLASS_EXIT, displayValue: this.textExit}, {id: 'menu-effect-group-exit', value: AscFormat.PRESET_CLASS_EXIT, caption: this.textExit},
{id: 'menu-effect-group-path', value: AscFormat.PRESET_CLASS_PATH, displayValue: this.textPath} {id: 'menu-effect-group-path', value: AscFormat.PRESET_CLASS_PATH, caption: this.textPath}
]; ];
}, },
@ -845,32 +844,32 @@ define(function(){ 'use strict';
{group: 'menu-effect-group-exit', value: AscFormat.EXIT_ZOOM, iconCls: 'transition-push', displayValue: this.textZoom}, {group: 'menu-effect-group-exit', value: AscFormat.EXIT_ZOOM, iconCls: 'transition-push', displayValue: this.textZoom},
{group: 'menu-effect-group-exit', value: AscFormat.EXIT_BASIC_SWIVEL, iconCls: 'transition-push', displayValue: this.textSwivel}, {group: 'menu-effect-group-exit', value: AscFormat.EXIT_BASIC_SWIVEL, iconCls: 'transition-push', displayValue: this.textSwivel},
{group: 'menu-effect-group-exit', value: AscFormat.EXIT_BOUNCE, iconCls: 'transition-push', displayValue: this.textBounce}, {group: 'menu-effect-group-exit', value: AscFormat.EXIT_BOUNCE, iconCls: 'transition-push', displayValue: this.textBounce},
{group: 'menu-effect-group-motion', value: AscFormat.MOTION_DOWN, iconCls: 'transition-push', displayValue: this.textDown}, {group: 'menu-effect-group-path', value: AscFormat.MOTION_DOWN, iconCls: 'transition-push', displayValue: this.textDown},
{group: 'menu-effect-group-motion', value: AscFormat.MOTION_LEFT, iconCls: 'transition-push', displayValue: this.textLeft}, {group: 'menu-effect-group-path', value: AscFormat.MOTION_LEFT, iconCls: 'transition-push', displayValue: this.textLeft},
{group: 'menu-effect-group-motion', value: AscFormat.MOTION_RIGHT, iconCls: 'transition-push', displayValue: this.textRight}, {group: 'menu-effect-group-path', value: AscFormat.MOTION_RIGHT, iconCls: 'transition-push', displayValue: this.textRight},
{group: 'menu-effect-group-motion', value: AscFormat.MOTION_UP, iconCls: 'transition-push', displayValue: this.textUp}, {group: 'menu-effect-group-path', value: AscFormat.MOTION_UP, iconCls: 'transition-push', displayValue: this.textUp},
{group: 'menu-effect-group-motion', value: AscFormat.MOTION_ARC_DOWN, iconCls: 'transition-push', displayValue: this.textArcDown}, {group: 'menu-effect-group-path', value: AscFormat.MOTION_ARC_DOWN, iconCls: 'transition-push', displayValue: this.textArcDown},
{group: 'menu-effect-group-motion', value: AscFormat.MOTION_ARC_LEFT, iconCls: 'transition-push', displayValue: this.textArcLeft}, {group: 'menu-effect-group-path', value: AscFormat.MOTION_ARC_LEFT, iconCls: 'transition-push', displayValue: this.textArcLeft},
{group: 'menu-effect-group-motion', value: AscFormat.MOTION_ARC_RIGHT, iconCls: 'transition-push', displayValue: this.textArcRight}, {group: 'menu-effect-group-path', value: AscFormat.MOTION_ARC_RIGHT, iconCls: 'transition-push', displayValue: this.textArcRight},
{group: 'menu-effect-group-motion', value: AscFormat.MOTION_ARC_UP, iconCls: 'transition-push', displayValue: this.textArcUp}, {group: 'menu-effect-group-path', value: AscFormat.MOTION_ARC_UP, iconCls: 'transition-push', displayValue: this.textArcUp},
{group: 'menu-effect-group-motion', value: AscFormat.MOTION_TURN_DOWN, iconCls: 'transition-push', displayValue: this.textTurnDown}, {group: 'menu-effect-group-path', value: AscFormat.MOTION_TURN_DOWN, iconCls: 'transition-push', displayValue: this.textTurnDown},
{group: 'menu-effect-group-motion', value: AscFormat.MOTION_TURN_DOWN_RIGHT, iconCls: 'transition-push', displayValue: this.textTurnDownRight}, {group: 'menu-effect-group-path', value: AscFormat.MOTION_TURN_DOWN_RIGHT, iconCls: 'transition-push', displayValue: this.textTurnDownRight},
{group: 'menu-effect-group-motion', value: AscFormat.MOTION_TURN_UP, iconCls: 'transition-push', displayValue: this.textTurnUp}, {group: 'menu-effect-group-path', value: AscFormat.MOTION_TURN_UP, iconCls: 'transition-push', displayValue: this.textTurnUp},
{group: 'menu-effect-group-motion', value: AscFormat.MOTION_TURN_UP_RIGHT, iconCls: 'transition-push', displayValue: this.textTurnUpRight}, {group: 'menu-effect-group-path', value: AscFormat.MOTION_TURN_UP_RIGHT, iconCls: 'transition-push', displayValue: this.textTurnUpRight},
{group: 'menu-effect-group-motion', value: AscFormat.MOTION_CIRCLE, iconCls: 'transition-push', displayValue: this.textCircle}, {group: 'menu-effect-group-path', value: AscFormat.MOTION_CIRCLE, iconCls: 'transition-push', displayValue: this.textCircle},
{group: 'menu-effect-group-motion', value: AscFormat.MOTION_DIAMOND, iconCls: 'transition-push', displayValue: this.textDiamond}, {group: 'menu-effect-group-path', value: AscFormat.MOTION_DIAMOND, iconCls: 'transition-push', displayValue: this.textDiamond},
{group: 'menu-effect-group-motion', value: AscFormat.MOTION_EQUAL_TRIANGLE, iconCls: 'transition-push', displayValue: this.textEqualTriangle}, {group: 'menu-effect-group-path', value: AscFormat.MOTION_EQUAL_TRIANGLE, iconCls: 'transition-push', displayValue: this.textEqualTriangle},
{group: 'menu-effect-group-motion', value: AscFormat.MOTION_HEXAGON, iconCls: 'transition-push', displayValue: this.textHexagon}, {group: 'menu-effect-group-path', value: AscFormat.MOTION_HEXAGON, iconCls: 'transition-push', displayValue: this.textHexagon},
{group: 'menu-effect-group-motion', value: AscFormat.MOTION_OCTAGON, iconCls: 'transition-push', displayValue: this.textOctagon}, {group: 'menu-effect-group-path', value: AscFormat.MOTION_OCTAGON, iconCls: 'transition-push', displayValue: this.textOctagon},
{group: 'menu-effect-group-motion', value: AscFormat.MOTION_PARALLELOGRAM, iconCls: 'transition-push', displayValue: this.textParallelogram}, {group: 'menu-effect-group-path', value: AscFormat.MOTION_PARALLELOGRAM, iconCls: 'transition-push', displayValue: this.textParallelogram},
{group: 'menu-effect-group-motion', value: AscFormat.MOTION_PENTAGON, iconCls: 'transition-push', displayValue: this.textPentagon}, {group: 'menu-effect-group-path', value: AscFormat.MOTION_PENTAGON, iconCls: 'transition-push', displayValue: this.textPentagon},
{group: 'menu-effect-group-motion', value: AscFormat.MOTION_RIGHT_TRIANGLE, iconCls: 'transition-push', displayValue: this.textRightTriangle}, {group: 'menu-effect-group-path', value: AscFormat.MOTION_RIGHT_TRIANGLE, iconCls: 'transition-push', displayValue: this.textRightTriangle},
{group: 'menu-effect-group-motion', value: AscFormat.MOTION_SQUARE, iconCls: 'transition-push', displayValue: this.textSquare}, {group: 'menu-effect-group-path', value: AscFormat.MOTION_SQUARE, iconCls: 'transition-push', displayValue: this.textSquare},
{group: 'menu-effect-group-motion', value: AscFormat.MOTION_TRAPEZOID, iconCls: 'transition-push', displayValue: this.textTrapezoid}, {group: 'menu-effect-group-path', value: AscFormat.MOTION_TRAPEZOID, iconCls: 'transition-push', displayValue: this.textTrapezoid},
{group: 'menu-effect-group-motion', value: AscFormat.MOTION_HORIZONTAL_FIGURE_8_FOUR, iconCls: 'transition-push', displayValue: this.textHorizontalFigure}, {group: 'menu-effect-group-path', value: AscFormat.MOTION_HORIZONTAL_FIGURE_8_FOUR, iconCls: 'transition-push', displayValue: this.textHorizontalFigure},
{group: 'menu-effect-group-motion', value: AscFormat.MOTION_VERTICAL_FIGURE_8, iconCls: 'transition-push', displayValue: this.textVerticalFigure}, {group: 'menu-effect-group-path', value: AscFormat.MOTION_VERTICAL_FIGURE_8, iconCls: 'transition-push', displayValue: this.textVerticalFigure},
{group: 'menu-effect-group-motion', value: AscFormat.MOTION_LOOP_DE_LOOP, iconCls: 'transition-push', displayValue: this.textLoopDeLoop}, {group: 'menu-effect-group-path', value: AscFormat.MOTION_LOOP_DE_LOOP, iconCls: 'transition-push', displayValue: this.textLoopDeLoop},
{group: 'menu-effect-group-motion', value: AscFormat.MOTION_CUSTOM_PATH, iconCls: 'transition-push', displayValue: this.textCustomPath} {group: 'menu-effect-group-path', value: AscFormat.MOTION_CUSTOM_PATH, iconCls: 'transition-push', displayValue: this.textCustomPath}
]; ];
}, },

View file

@ -72,7 +72,7 @@ define([
'animation:addanimation': _.bind(this.onAddAnimation, this), 'animation:addanimation': _.bind(this.onAddAnimation, this),
'animation:startselect': _.bind(this.onStartSelect, this), 'animation:startselect': _.bind(this.onStartSelect, this),
'animation:checkrewind': _.bind(this.onCheckRewindChange,this), 'animation:checkrewind': _.bind(this.onCheckRewindChange,this),
'animation:repeat': _.bind(this.onRepeatChange, this), 'animation:repeat': _.bind(this.onRepeatChange, this)
}, },
'Toolbar': { 'Toolbar': {
'tab:active': _.bind(this.onActiveTab, this) 'tab:active': _.bind(this.onActiveTab, this)
@ -136,11 +136,10 @@ define([
})).show(); })).show();
}, },
onAddAnimation: function(combo, record) { onAddAnimation: function(picker, record) {
var type = record.get('value'); var type = record.get('value');
var group = Common.define.effectData.getEffectGroupData().findWhere({id: record.group}).get('value'); var group = _.findWhere(Common.define.effectData.getEffectGroupData(), {id: record.get('group')}).value;
this.addNewEffect(type, group, false); this.addNewEffect(type, group, false);
}, },
addNewEffect: function (type, group, replace) { addNewEffect: function (type, group, replace) {
@ -325,7 +324,6 @@ define([
item = me.cmbStart.store.findWhere({value: this._state.StartSelect}); item = me.cmbStart.store.findWhere({value: this._state.StartSelect});
me.cmbStart.selectRecord(item); me.cmbStart.selectRecord(item);
me.chRewind.setValue(this._state.Rewind, true); me.chRewind.setValue(this._state.Rewind, true);
} }
}, PE.Controllers.Animation || {})); }, PE.Controllers.Animation || {}));

View file

@ -80,11 +80,6 @@ define([
me.fireEvent('animation:animationpane', [me.btnAnimationPane]); me.fireEvent('animation:animationpane', [me.btnAnimationPane]);
}, me)); }, me));
} }
if (me.btnAddAnimation) {
me.btnAddAnimation.on('click', _.bind(function(btn) {
me.fireEvent('animation:addanimation', [me.btnAddAnimation]);
}, me));
}
if (me.numDuration) { if (me.numDuration) {
me.numDuration.on('change', function(bth) { me.numDuration.on('change', function(bth) {
@ -133,12 +128,22 @@ define([
var _set = PE.enumLock; var _set = PE.enumLock;
this.lockedControls = []; this.lockedControls = [];
this._arrEffectName = [{group:'none', value: AscFormat.ANIM_PRESET_NONE, iconCls: 'transition-none', displayValue: this.textNone}]; this._arrEffectName = [{group:'none', value: AscFormat.ANIM_PRESET_NONE, iconCls: 'transition-none', displayValue: this.textNone}].concat(Common.define.effectData.getEffectData());
Array.prototype.push.apply( this._arrEffectName, Common.define.effectData.getEffectData()); this._arrEffectOptions = [];
var itemWidth = 87,
itemHeight = 40;
this.listEffects = new Common.UI.ComboDataView({ this.listEffects = new Common.UI.ComboDataView({
cls: 'combo-styles', cls: 'combo-styles animation',
itemWidth: 87, itemWidth: itemWidth,
itemHeight: 40, itemHeight: itemHeight,
itemTemplate: _.template([
'<div class = "btn_item x-huge" id = "<%= id %>" style = "width: ' + itemWidth + 'px;height: ' + itemHeight + 'px;">',
'<div class = "icon toolbar__icon <%= iconCls %>"></div>',
'<div class = "caption"><%= displayValue %></div>',
'</div>'
].join('')),
groups: new Common.UI.DataViewGroupStore([{id: 'none', value: -10, caption: this.textNone}].concat(Common.define.effectData.getEffectGroupData())),
store: new Common.UI.DataViewStore(this._arrEffectName),
enableKeyEvents: true, enableKeyEvents: true,
//lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart, _set.transitLock], //lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart, _set.transitLock],
dataHint: '1', dataHint: '1',
@ -167,15 +172,6 @@ define([
} }
}); });
this.lockedControls.push(this.listEffects); this.lockedControls.push(this.listEffects);
this.listEffects.menuPicker.store.add(this._arrEffectName);
this.listEffects.fieldPicker.itemTemplate = _.template([
'<div class = "btn_item x-huge" id = "<%= id %>" style = "width: ' + (this.listEffects.itemWidth) + 'px;height: ' + (this.listEffects.itemHeight) + 'px;">',
'<div class = "icon toolbar__icon <%= iconCls %>"></div>',
'<div class = "caption"><%= displayValue %></div>',
'</div>'
].join(''));
this.listEffects.menuPicker.itemTemplate = this.listEffects.fieldPicker.itemTemplate;
this.btnPreview = new Common.UI.Button({ this.btnPreview = new Common.UI.Button({
cls: 'btn-toolbar', // x-huge icon-top', cls: 'btn-toolbar', // x-huge icon-top',
@ -216,7 +212,6 @@ define([
this.btnAddAnimation = new Common.UI.Button({ this.btnAddAnimation = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top', cls: 'btn-toolbar x-huge icon-top',
caption: this.txtAddEffect, caption: this.txtAddEffect,
split: true,
iconCls: 'toolbar__icon icon btn-addslide', iconCls: 'toolbar__icon icon btn-addslide',
menu: true, menu: true,
//lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart, _set.transitLock], //lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart, _set.transitLock],
@ -331,8 +326,39 @@ define([
(new Promise(function (accept, reject) { (new Promise(function (accept, reject) {
accept(); accept();
})).then(function() { })).then(function() {
setEvents.call(me); setEvents.call(me);
me.btnAddAnimation.setMenu( new Common.UI.Menu({
style: 'width: 403px;padding-top: 12px;',
items: [
{template: _.template('<div id="id-toolbar-menu-addanimation" class="menu-animation"></div>')}
]
}));
var itemWidth = 87,
itemHeight = 40;
var onShowBefore = function(menu) {
var picker = new Common.UI.DataView({
el: $('#id-toolbar-menu-addanimation'),
parentMenu: menu,
showLast: false,
restoreHeight: 465,
groups: new Common.UI.DataViewGroupStore(Common.define.effectData.getEffectGroupData()),
store: new Common.UI.DataViewStore(Common.define.effectData.getEffectData()),
itemTemplate: _.template([
'<div class = "btn_item x-huge" id = "<%= id %>" style = "width: ' + itemWidth + 'px;height: ' + itemHeight + 'px;">',
'<div class = "icon toolbar__icon <%= iconCls %>"></div>',
'<div class = "caption"><%= displayValue %></div>',
'</div>'
].join(''))
});
picker.on('item:click', function (picker, item, record, e) {
if (record)
me.fireEvent('animation:addanimation', [picker, record]);
});
menu.off('show:before', onShowBefore);
};
me.btnAddAnimation.menu.on('show:before', onShowBefore);
}); });
}, },
@ -420,7 +446,6 @@ define([
this.btnParameters.menu.addItem(opt); this.btnParameters.menu.addItem(opt);
(opt.value==option) && (selectedElement = this.btnParameters.menu.items[index]); (opt.value==option) && (selectedElement = this.btnParameters.menu.items[index]);
}, this); }, this);
} }
else { else {
this.btnParameters.menu.items.forEach(function (opt) { this.btnParameters.menu.items.forEach(function (opt) {

View file

@ -34,7 +34,50 @@
} }
} }
} }
.menu-picker-container .dataview {
padding: 10px 0 0 2px;
.group-description {
padding: 3px 0 3px 10px;
font-weight: bold;
}
.group-items-container > div {
margin: 0;
}
}
} }
.menu-animation {
margin: 0 5px 0 2px;
.group-description {
padding: 3px 0 3px 10px;
font-weight: bold;
}
.group-items-container {
float: left;
position: relative;
}
.item {
padding: 2px;
margin:0 ;
border: calc(2*@scaled-one-px-value-ie) solid transparent;
border: calc(@scaled-two-px-value) solid transparent;
.box-shadow(none);
&:hover{
border-color: @border-preview-hover-ie;
border-color: @border-preview-hover;
}
&.selected
{
border-color: @border-preview-select-ie;
border-color: @border-preview-select;
}
}
}
label { label {
margin-right: 10px; margin-right: 10px;
@ -58,10 +101,6 @@
} }
} }
.caption{
line-height: 18px;
font-size: 11px;
}
.btn_item { .btn_item {
color: @text-normal-ie; color: @text-normal-ie;
color: @text-normal; color: @text-normal;
@ -76,4 +115,12 @@
margin-top: -2px; margin-top: -2px;
} }
.caption{
line-height: 18px;
font-size: 11px;
text-overflow: ellipsis;
overflow: hidden;
width: 100%;
text-align: center;
}
} }