mirror of
https://bitbucket.org/bellord13/kit.git
synced 2026-11-13 19:06:11 +03:00
fix
This commit is contained in:
@@ -2,26 +2,30 @@
|
|||||||
kit.PluginManager.register('ActionCollection', function(module, exports, require, global) {
|
kit.PluginManager.register('ActionCollection', function(module, exports, require, global) {
|
||||||
|
|
||||||
var Collection = require('Collection');
|
var Collection = require('Collection');
|
||||||
|
var support = require('support');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @class ActionCollection
|
||||||
|
* @extends {kit.Collection}
|
||||||
* @memberOf kit
|
* @memberOf kit
|
||||||
*/
|
*/
|
||||||
var ActionCollection = function (list = []) {
|
var ActionCollection = function (list = []) {
|
||||||
this.collection = new Collection(list);
|
Collection.prototype.constructor.apply(this, arguments);
|
||||||
};
|
};
|
||||||
ActionCollection.prototype.push = function (action) {
|
var proto = ActionCollection.prototype;
|
||||||
this.collection.push(action);
|
|
||||||
};
|
proto.run = function (count = -1) {
|
||||||
ActionCollection.prototype.run = function (count = -1) {
|
this.map(function (action) {
|
||||||
this.collection.map(function (action) {
|
|
||||||
action.run(count);
|
action.run(count);
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
ActionCollection.prototype.stop = function () {
|
proto.stop = function () {
|
||||||
this.collection.map(function (action) {
|
this.map(function (action) {
|
||||||
action.stop();
|
action.stop();
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
support.extend(ActionCollection.prototype, Collection.prototype);
|
||||||
|
|
||||||
return module.exports = ActionCollection;
|
return module.exports = ActionCollection;
|
||||||
});
|
});
|
||||||
+72
-26
@@ -10,12 +10,13 @@ kit.PluginManager.register('Viewer', function(module, exports, require, global)
|
|||||||
|
|
||||||
var AnimationTrap = function (node, callbackBefore = function(){}, callbackAfter = function(){}) {
|
var AnimationTrap = function (node, callbackBefore = function(){}, callbackAfter = function(){}) {
|
||||||
this.node = support.getNode(node);
|
this.node = support.getNode(node);
|
||||||
this.active = 0;
|
this.active = false;
|
||||||
this.__timeoutId = 0;
|
this.__timeoutId = 0;
|
||||||
|
this.__callbackOptions = {};
|
||||||
this.callbackBefore = callbackBefore;
|
this.callbackBefore = callbackBefore;
|
||||||
this.callbackAfter = callbackAfter;
|
this.callbackAfter = callbackAfter;
|
||||||
this.__callbackAfterHandler = function () {
|
this.__callbackAfterHandler = function () {
|
||||||
this.callbackAfter();
|
this.callbackAfter(this.__callbackOptions);
|
||||||
this.stop();
|
this.stop();
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
this.__animationstart = false;
|
this.__animationstart = false;
|
||||||
@@ -28,30 +29,43 @@ kit.PluginManager.register('Viewer', function(module, exports, require, global)
|
|||||||
new Action(this.node, 'animationcancel', this.__callbackAfterHandler)
|
new Action(this.node, 'animationcancel', this.__callbackAfterHandler)
|
||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
AnimationTrap.prototype.run = function () {
|
AnimationTrap.prototype.run = function (options = {}) {
|
||||||
|
|
||||||
if(this.active === 1){
|
if(this.active){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.active = 1;
|
this.__callbackOptions = Object.assign({
|
||||||
|
useAnim: true
|
||||||
|
}, options);
|
||||||
|
|
||||||
|
|
||||||
|
if(!this.__callbackOptions.useAnim){
|
||||||
|
this.callbackBefore(this.__callbackOptions);
|
||||||
|
this.callbackAfter(this.__callbackOptions);
|
||||||
|
this.stop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.active = true;
|
||||||
this.__animationStartAction.run(1);
|
this.__animationStartAction.run(1);
|
||||||
this.callbackBefore();
|
this.callbackBefore(this.__callbackOptions);
|
||||||
this.__animationEndAction.run(1);
|
this.__animationEndAction.run(1);
|
||||||
|
|
||||||
this.__timeoutId = setTimeout(function () {
|
this.__timeoutId = setTimeout(function () {
|
||||||
if(!this.__animationstart) {
|
if(!this.__animationstart) {
|
||||||
this.__callbackAfterHandler();
|
this.__callbackAfterHandler(this.__callbackOptions);
|
||||||
}
|
}
|
||||||
}.bind(this), 100);
|
}.bind(this), 100);
|
||||||
};
|
};
|
||||||
AnimationTrap.prototype.stop = function () {
|
AnimationTrap.prototype.stop = function () {
|
||||||
clearTimeout(this.__timeoutId);
|
clearTimeout(this.__timeoutId);
|
||||||
this.__timeoutId = 0;
|
this.__timeoutId = 0;
|
||||||
|
this.__callbackOptions = {};
|
||||||
this.__animationstart = false;
|
this.__animationstart = false;
|
||||||
this.__animationStartAction.stop();
|
this.__animationStartAction.stop();
|
||||||
this.__animationEndAction.stop();
|
this.__animationEndAction.stop();
|
||||||
this.active = 0;
|
this.active = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -76,26 +90,36 @@ kit.PluginManager.register('Viewer', function(module, exports, require, global)
|
|||||||
this.node = support.getNode(node);
|
this.node = support.getNode(node);
|
||||||
this.masterNode = support.getNode(masterNode);
|
this.masterNode = support.getNode(masterNode);
|
||||||
this.onShow = new Collection();
|
this.onShow = new Collection();
|
||||||
|
this.onShowBefore = new Collection();
|
||||||
this.onHide = new Collection();
|
this.onHide = new Collection();
|
||||||
|
this.onHideBefore = new Collection();
|
||||||
this.animShowClass = '';
|
this.animShowClass = '';
|
||||||
this.animHideClass = '';
|
this.animHideClass = '';
|
||||||
this.delayHide = 0;
|
this.delayHide = 0;
|
||||||
this.activeMasterClass = 'active';
|
this.activeMasterClass = 'active';
|
||||||
|
|
||||||
this.__aminationTrapHide = new AnimationTrap(this.node, function () {
|
this.__aminationTrapHide = new AnimationTrap(this.node, function (options) {
|
||||||
|
if(options.onHideBefore !== false) {
|
||||||
|
this.onHideBefore.eachCall();
|
||||||
|
}
|
||||||
removeAnimation.call(this, this.animShowClass);
|
removeAnimation.call(this, this.animShowClass);
|
||||||
addAnimation.call(this, this.animHideClass);
|
addAnimation.call(this, this.animHideClass);
|
||||||
}.bind(this), function () {
|
}.bind(this), function (options) {
|
||||||
if(this.masterNode && this.activeMasterClass) {
|
if(this.masterNode && this.activeMasterClass) {
|
||||||
this.masterNode.classList.remove(this.activeMasterClass);
|
this.masterNode.classList.remove(this.activeMasterClass);
|
||||||
}
|
}
|
||||||
this.node.classList.add('hide');
|
this.node.classList.add('hide');
|
||||||
this.node.classList.remove('show');
|
this.node.classList.remove('show');
|
||||||
this.onHide.eachCall();
|
if(options.onHide !== false) {
|
||||||
|
this.onHide.eachCall();
|
||||||
|
}
|
||||||
this.node.style.display = 'none';
|
this.node.style.display = 'none';
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
this.__aminationTrapShow = new AnimationTrap(this.node, function () {
|
this.__aminationTrapShow = new AnimationTrap(this.node, function (options = {}) {
|
||||||
|
if(options.onShowBefore !== false) {
|
||||||
|
this.onShowBefore.eachCall();
|
||||||
|
}
|
||||||
this.node.classList.remove('hide');
|
this.node.classList.remove('hide');
|
||||||
this.node.classList.add('show');
|
this.node.classList.add('show');
|
||||||
if(this.node.style.display === 'none') {
|
if(this.node.style.display === 'none') {
|
||||||
@@ -104,10 +128,13 @@ kit.PluginManager.register('Viewer', function(module, exports, require, global)
|
|||||||
if(this.masterNode && this.activeMasterClass) {
|
if(this.masterNode && this.activeMasterClass) {
|
||||||
this.masterNode.classList.add(this.activeMasterClass);
|
this.masterNode.classList.add(this.activeMasterClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
removeAnimation.call(this, this.animHideClass);
|
removeAnimation.call(this, this.animHideClass);
|
||||||
addAnimation.call(this, this.animShowClass);
|
addAnimation.call(this, this.animShowClass);
|
||||||
this.onShow.eachCall();
|
if(options.onShow !== false) {
|
||||||
}.bind(this), function () {
|
this.onShow.eachCall();
|
||||||
|
}
|
||||||
|
}.bind(this), function (options = {}) {
|
||||||
|
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
@@ -121,30 +148,42 @@ kit.PluginManager.register('Viewer', function(module, exports, require, global)
|
|||||||
};
|
};
|
||||||
|
|
||||||
var proto = Viewer.prototype;
|
var proto = Viewer.prototype;
|
||||||
proto.show = function(){
|
proto.show = function(options = {}){
|
||||||
|
|
||||||
if(this.isShown()) {
|
if(this.isShown()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
deferredHideCancel.call(this);
|
|
||||||
this.__aminationTrapHide.stop();
|
options.useAnim = !!this.animHideClass;
|
||||||
this.__aminationTrapShow.run();
|
|
||||||
|
this.stop();
|
||||||
|
|
||||||
|
this.__aminationTrapShow.run(options);
|
||||||
};
|
};
|
||||||
proto.hide = function(){
|
|
||||||
|
proto.hide = function(options = {}){
|
||||||
if(this.isHidden()) {
|
if(this.isHidden()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
options.useAnim = !!this.animHideClass;
|
||||||
|
|
||||||
|
this.__aminationTrapShow.stop();
|
||||||
|
|
||||||
var hideDeferred = function () {
|
var hideDeferred = function () {
|
||||||
deferredHideCancel.call(this);
|
deferredHideCancel.call(this);
|
||||||
this.__deferredHideID = setTimeout(hide.bind(this), this.delayHide);
|
if(this.delayHide) {
|
||||||
|
this.__deferredHideID = setTimeout(hide.bind(this), this.delayHide);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
hide();
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
|
||||||
|
|
||||||
var hide = function() {
|
var hide = function() {
|
||||||
deferredHideCancel.call(this);
|
deferredHideCancel.call(this);
|
||||||
this.__aminationTrapShow.stop();
|
this.__aminationTrapHide.run(options);
|
||||||
this.__aminationTrapHide.run();
|
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
|
||||||
hideDeferred();
|
hideDeferred();
|
||||||
};
|
};
|
||||||
proto.toggle = function(){
|
proto.toggle = function(){
|
||||||
@@ -156,15 +195,22 @@ kit.PluginManager.register('Viewer', function(module, exports, require, global)
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
proto.isShown = function(){
|
proto.isShown = function(){
|
||||||
return !this.isHidden() && !this.__aminationTrapHide.active;
|
return !this.isHidden();
|
||||||
};
|
};
|
||||||
proto.isHidden = function(){
|
proto.isHidden = function(){
|
||||||
var result = this.node.classList.contains('hide');
|
var result = this.node.classList.contains('hide');
|
||||||
|
result = result || getComputedStyle(this.node).display === 'none';
|
||||||
if(this.masterNode && this.activeMasterClass) {
|
if(this.masterNode && this.activeMasterClass) {
|
||||||
result = result || !this.masterNode.classList.contains(this.activeMasterClass);
|
result = result || !this.masterNode.classList.contains(this.activeMasterClass);
|
||||||
}
|
}
|
||||||
return result || this.__aminationTrapHide.active;
|
return result || this.__aminationTrapHide.active || this.__deferredHideID;
|
||||||
|
};
|
||||||
|
proto.stop = function () {
|
||||||
|
this.__aminationTrapHide.stop();
|
||||||
|
this.__aminationTrapShow.stop();
|
||||||
|
deferredHideCancel.call(this);
|
||||||
|
// removeAnimation.call(this, this.animHideClass);
|
||||||
|
// removeAnimation.call(this, this.animShowClass);
|
||||||
};
|
};
|
||||||
|
|
||||||
return module.exports = Viewer;
|
return module.exports = Viewer;
|
||||||
});
|
});
|
||||||
|
|||||||
+28
-9
@@ -457,6 +457,11 @@ kit.PluginManager.register('align',function(module, exports, require) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param node
|
||||||
|
* @return {AlignClass}
|
||||||
|
*/
|
||||||
AlignClass.prototype.setNode = function(node){
|
AlignClass.prototype.setNode = function(node){
|
||||||
this.unset();
|
this.unset();
|
||||||
this.node = support.getNode(node);
|
this.node = support.getNode(node);
|
||||||
@@ -471,6 +476,10 @@ kit.PluginManager.register('align',function(module, exports, require) {
|
|||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param node
|
||||||
|
* @return {AlignClass}
|
||||||
|
*/
|
||||||
AlignClass.prototype.setParentNode = function(node){
|
AlignClass.prototype.setParentNode = function(node){
|
||||||
this.parentNode = support.getNode(node);
|
this.parentNode = support.getNode(node);
|
||||||
if(this.__calc) {
|
if(this.__calc) {
|
||||||
@@ -478,6 +487,7 @@ kit.PluginManager.register('align',function(module, exports, require) {
|
|||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
AlignClass.prototype.setLimiterNode = function(node){
|
AlignClass.prototype.setLimiterNode = function(node){
|
||||||
this.limiterNode = support.getNode(node) || window;
|
this.limiterNode = support.getNode(node) || window;
|
||||||
if(this.__calc) {
|
if(this.__calc) {
|
||||||
@@ -520,18 +530,27 @@ kit.PluginManager.register('align',function(module, exports, require) {
|
|||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param hAlign
|
||||||
|
* @param vAlign
|
||||||
|
* @param hDirection
|
||||||
|
* @param vDirection
|
||||||
|
* @return {AlignClass}
|
||||||
|
*/
|
||||||
AlignClass.prototype.set = function(hAlign, vAlign, hDirection, vDirection){
|
AlignClass.prototype.set = function(hAlign, vAlign, hDirection, vDirection){
|
||||||
this.setEx('vertical', vDirection, vAlign);
|
this.setEx('vertical', vAlign, vDirection);
|
||||||
this.setEx('horizontal', hDirection, hAlign);
|
this.setEx('horizontal', hAlign, hDirection);
|
||||||
return this;
|
|
||||||
};
|
|
||||||
AlignClass.prototype.setVertical = function(direction, align){
|
|
||||||
this.setEx('vertical', direction, align);
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
AlignClass.prototype.setHorizontal = function(direction, align){
|
AlignClass.prototype.setVertical = function(align, direction){
|
||||||
this.setEx('horizontal', direction, align);
|
this.setEx('vertical', align, direction);
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
AlignClass.prototype.setHorizontal = function(align, direction){
|
||||||
|
this.setEx('horizontal', align, direction);
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -544,7 +563,7 @@ kit.PluginManager.register('align',function(module, exports, require) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
AlignClass.prototype.setEx = function(axis, direction, align){
|
AlignClass.prototype.setEx = function(axis, align, direction){
|
||||||
|
|
||||||
this.reset(axis === 'horizontal', axis === 'vertical');
|
this.reset(axis === 'horizontal', axis === 'vertical');
|
||||||
|
|
||||||
|
|||||||
@@ -91,13 +91,16 @@ kit.PluginManager.register('Collection', function(module, exports, require, glob
|
|||||||
return ob;
|
return ob;
|
||||||
};
|
};
|
||||||
Collection.prototype.serialize = function () {
|
Collection.prototype.serialize = function () {
|
||||||
return JSON.stringify(this.all());
|
return JSON.stringify(this.toObject());
|
||||||
|
};
|
||||||
|
Collection.prototype.serializeArray = function () {
|
||||||
|
return JSON.stringify(this.toArray());
|
||||||
};
|
};
|
||||||
Collection.prototype.has = function (key) {
|
Collection.prototype.has = function (key) {
|
||||||
return this.data.hasOwnProperty(key) && this.__keys.includes(safeArrayKey(key));
|
return this.__keys.includes(safeArrayKey(key));
|
||||||
};
|
};
|
||||||
Collection.prototype.indexKey = function (key) {
|
Collection.prototype.indexKey = function (key) {
|
||||||
return this.__keys.indexOf(key);
|
return this.__keys.indexOf(safeArrayKey(key));
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @param key
|
* @param key
|
||||||
@@ -157,17 +160,13 @@ kit.PluginManager.register('Collection', function(module, exports, require, glob
|
|||||||
* @return {kit.Collection}
|
* @return {kit.Collection}
|
||||||
*/
|
*/
|
||||||
Collection.prototype.each = function (callback = true) {
|
Collection.prototype.each = function (callback = true) {
|
||||||
var BreakException = {}, i;
|
var i;
|
||||||
try {
|
if(this.__keys.length)
|
||||||
if(this.__keys.length)
|
for (i = 0; i < this.__keys.length; i++) {
|
||||||
for (i = 0; i < this.__keys.length; i++) {
|
if(valueEx(callback, this.__values[i], this.__keys[i], this.data) === false) {
|
||||||
if(valueEx(callback, this.__values[i], this.__keys[i], this.data) === false) {
|
break;
|
||||||
throw BreakException;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
}
|
||||||
if (e !== BreakException) throw e;
|
|
||||||
}
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
@@ -175,17 +174,13 @@ kit.PluginManager.register('Collection', function(module, exports, require, glob
|
|||||||
* @return {kit.Collection}
|
* @return {kit.Collection}
|
||||||
*/
|
*/
|
||||||
Collection.prototype.eachReverse = function (callback = true) {
|
Collection.prototype.eachReverse = function (callback = true) {
|
||||||
var BreakException = {}, i;
|
var i;
|
||||||
try {
|
if(this.__keys.length)
|
||||||
if(this.__keys.length)
|
for (i = this.__keys.length - 1; i >= 0; i--) {
|
||||||
for (i = this.__keys.length - 1; i >= 0; i--) {
|
if(valueEx(callback, this.__values[i], this.__keys[i], this.data) === false) {
|
||||||
if(valueEx(callback, this.__values[i], this.__keys[i], this.data) === false) {
|
break;
|
||||||
throw BreakException;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
}
|
||||||
if (e !== BreakException) throw e;
|
|
||||||
}
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
@@ -328,7 +323,7 @@ kit.PluginManager.register('Collection', function(module, exports, require, glob
|
|||||||
* Method removes and returns the last item from the collection
|
* Method removes and returns the last item from the collection
|
||||||
*/
|
*/
|
||||||
Collection.prototype.pop = function(){
|
Collection.prototype.pop = function(){
|
||||||
var index = this.length - 1;
|
var index = this.__keys.length - 1;
|
||||||
if(index < 0) {
|
if(index < 0) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
@@ -381,23 +376,19 @@ kit.PluginManager.register('Collection', function(module, exports, require, glob
|
|||||||
* @return {kit.Collection}
|
* @return {kit.Collection}
|
||||||
*/
|
*/
|
||||||
Collection.prototype.eachCall = function (context, args1, args2) {
|
Collection.prototype.eachCall = function (context, args1, args2) {
|
||||||
var args = [];
|
var args = [], i;
|
||||||
if(arguments.length > 1)
|
if(arguments.length > 1)
|
||||||
for(var i = 1; arguments.length - 1 >= i;i++) {
|
for(i = 1; arguments.length - 1 >= i;i++) {
|
||||||
args.push(arguments[i]);
|
args.push(arguments[i]);
|
||||||
}
|
}
|
||||||
var BreakException = {}, i;
|
|
||||||
try {
|
if(this.__keys.length)
|
||||||
if(this.__keys.length)
|
for (i = 0; i < this.__keys.length; i++) {
|
||||||
for (i = 0; i < this.__keys.length; i++) {
|
if(typeof this.__values[i] === 'function' &&
|
||||||
if(typeof this.__values[i] === 'function' &&
|
this.__values[i].apply(context, [].concat(args, this.__keys[i])) === false) {
|
||||||
this.__values[i].apply(context, [].concat(args, this.__keys[i])) === false) {
|
throw BreakException;
|
||||||
throw BreakException;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
}
|
||||||
if (e !== BreakException) throw e;
|
|
||||||
}
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,12 @@ window.kit = window.kit || {};
|
|||||||
*/
|
*/
|
||||||
kit.config = kit.config || {};
|
kit.config = kit.config || {};
|
||||||
|
|
||||||
|
// [PluginManager]
|
||||||
|
|
||||||
kit.config.assetsPath = '/local/templater.dev/kit/assets';
|
kit.config.assetsPath = '/local/templater.dev/kit/assets';
|
||||||
kit.config.requiredDependencies = ['bsCore', 'toolkit', 'support'];
|
kit.config.requiredDependencies = ['bsCore', 'toolkit', 'support'];
|
||||||
kit.config.autoloadPluginList = ['tooltip', 'support'];
|
kit.config.autoloadPluginList = ['tooltip', 'support'];
|
||||||
kit.config.debug = true;
|
kit.config.debug = true;
|
||||||
kit.config.defaultPhoneMask = '+7 (999) 999-99-99';
|
kit.config.defaultPhoneMask = '+7 (999) 999-99-99';
|
||||||
|
|
||||||
|
// [OtherPlugins]
|
||||||
+10
-2
@@ -29,12 +29,20 @@
|
|||||||
border-right: var(--kit-menu-border-width) solid var(--kit-color-primary, #3c9cdd);
|
border-right: var(--kit-menu-border-width) solid var(--kit-color-primary, #3c9cdd);
|
||||||
box-shadow: 0 0 10px 0 #00000033, inset -5px 0 5px -5px var(--kit-color-primary-b2, #2283c3);
|
box-shadow: 0 0 10px 0 #00000033, inset -5px 0 5px -5px var(--kit-color-primary-b2, #2283c3);
|
||||||
}
|
}
|
||||||
.kit-menu.active {
|
.kit-menu.active, .kit-menu.show {
|
||||||
display: block;
|
display: block;
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.kit-text-debug {
|
||||||
|
position: absolute;
|
||||||
|
background-color: #363636;
|
||||||
|
pointer-events: none;
|
||||||
|
color: #dddddd;
|
||||||
|
font-size: 12px;
|
||||||
|
font-family: monospace;
|
||||||
|
line-height: 1.1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+571
-737
File diff suppressed because it is too large
Load Diff
+17
-10
@@ -86,18 +86,23 @@ __PluginManager__.register('support', function(module, exports, require, global)
|
|||||||
if(isNode(selector) || isElement(selector)) {
|
if(isNode(selector) || isElement(selector)) {
|
||||||
return selector;
|
return selector;
|
||||||
}
|
}
|
||||||
return undefined;
|
return null;
|
||||||
}
|
}
|
||||||
var nameFromToStringRegex = /^function\s?([^\s(]*)/;
|
|
||||||
function className(object, defaultName) {
|
var extend = function(target) {
|
||||||
var result = "";
|
if(!arguments[1]) {
|
||||||
if (typeof object === 'function') {
|
return;
|
||||||
result = object.name || object.toString().match(nameFromToStringRegex)[1];
|
|
||||||
} else if (typeof object.constructor === 'function') {
|
|
||||||
result = className(object.constructor, defaultName);
|
|
||||||
}
|
}
|
||||||
return result || defaultName;
|
for(i=1; i < arguments.length; i++) {
|
||||||
}
|
var source = arguments[i];
|
||||||
|
|
||||||
|
for(var prop in source) {
|
||||||
|
if(!target[prop] && source.hasOwnProperty(prop)) {
|
||||||
|
target[prop] = source[prop];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -117,7 +122,9 @@ __PluginManager__.register('support', function(module, exports, require, global)
|
|||||||
isFloat,
|
isFloat,
|
||||||
isString,
|
isString,
|
||||||
isNode,
|
isNode,
|
||||||
|
isElement,
|
||||||
getNode,
|
getNode,
|
||||||
|
extend,
|
||||||
};
|
};
|
||||||
|
|
||||||
return module.exports = support;
|
return module.exports = support;
|
||||||
|
|||||||
@@ -7,7 +7,13 @@ kit.PluginManager.register('userAction', function(module, exports, require, glob
|
|||||||
var Viewer = require('Viewer');
|
var Viewer = require('Viewer');
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param masterNode
|
||||||
|
* @param slaveNode
|
||||||
|
* @return {Popover}
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
var Popover = function (masterNode, slaveNode) {
|
var Popover = function (masterNode, slaveNode) {
|
||||||
this.__setMasterNode(masterNode);
|
this.__setMasterNode(masterNode);
|
||||||
this.__setSlaveNode(slaveNode);
|
this.__setSlaveNode(slaveNode);
|
||||||
@@ -56,6 +62,13 @@ kit.PluginManager.register('userAction', function(module, exports, require, glob
|
|||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param masterNode
|
||||||
|
* @param slaveNode
|
||||||
|
* @return {Hint}
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
var Hint = function (masterNode, slaveNode) {
|
var Hint = function (masterNode, slaveNode) {
|
||||||
this.__setMasterNode(masterNode);
|
this.__setMasterNode(masterNode);
|
||||||
this.__setSlaveNode(slaveNode);
|
this.__setSlaveNode(slaveNode);
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ print_r($x);
|
|||||||
console.log(true, msg);
|
console.log(true, msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.error(msg, value, need);
|
console.error(msg, '-', 'value:', value, 'need:', need);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -213,7 +213,14 @@ kit.ready(['collection'], function () {
|
|||||||
assertSame(x3.last(), 111, 'only last+');
|
assertSame(x3.last(), 111, 'only last+');
|
||||||
assertSame(x3.length, 1, 'only length');
|
assertSame(x3.length, 1, 'only length');
|
||||||
|
|
||||||
x.
|
|
||||||
|
xOb = {a: 'a10', b: 'b11', 10: 101};
|
||||||
|
x = new kit.Collection(xOb);
|
||||||
|
x.set(11, 111);
|
||||||
|
assertSame(x.indexKey(11), 3, 'indexKey (int)');
|
||||||
|
assertSame(x.indexKey('11'), 3, 'indexKey (string)');
|
||||||
|
assertSame(x.indexKey('111'), -1, 'indexKey (-1)');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
+17
-9
@@ -140,7 +140,7 @@ kit.ready(['menu', 'animations'], function () {
|
|||||||
var menu;
|
var menu;
|
||||||
menu = kit.menu.getInstance({
|
menu = kit.menu.getInstance({
|
||||||
alignOffset: [0, 5],
|
alignOffset: [0, 5],
|
||||||
eventType: 'click',
|
eventType: 'popover',
|
||||||
}, [
|
}, [
|
||||||
{
|
{
|
||||||
label: 'еще (' + window.i + ')',
|
label: 'еще (' + window.i + ')',
|
||||||
@@ -161,19 +161,20 @@ kit.ready(['menu', 'animations'], function () {
|
|||||||
|
|
||||||
window.menuBuilder = (function(){
|
window.menuBuilder = (function(){
|
||||||
console.log('menuBuilder');
|
console.log('menuBuilder');
|
||||||
window.menuBase = null;
|
|
||||||
|
|
||||||
var menuBase = new kit.menu.Class();
|
var menuBase = new kit.menu.Class();
|
||||||
|
window.menuBase = menuBase;
|
||||||
|
|
||||||
menuBase.setOptions({
|
menuBase.setOptions({
|
||||||
animation: kit.animations.scaleIn,
|
animation: kit.animations.scaleIn,
|
||||||
alignOffset: [5, 5],
|
alignOffset: [5, 5],
|
||||||
hideDelay: 1000,
|
hideDelay: 1000,
|
||||||
parent: '#chat-message-15 .chat-message--manager-item-menu',
|
parent: '#chat-message-15 .chat-message--manager-item-menu',
|
||||||
/**
|
/**
|
||||||
* доступно 2 режима click / hover,
|
* доступно 2 режима popover / hint,
|
||||||
* понимать так: данное меню появляется по Клику на родитя (по дефолту hover)
|
* понимать так: данное меню появляется по Клику на родитя (по дефолту hover)
|
||||||
*/
|
*/
|
||||||
eventType: 'click',
|
eventType: 'popover',
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -249,7 +250,7 @@ kit.ready(['menu', 'animations'], function () {
|
|||||||
menuItem.remove();
|
menuItem.remove();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
menu.reInit();
|
menu.init();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
/**
|
/**
|
||||||
@@ -262,16 +263,23 @@ kit.ready(['menu', 'animations'], function () {
|
|||||||
var item1 = menuBase.addItem({
|
var item1 = menuBase.addItem({
|
||||||
|
|
||||||
label: 'меняем предка на R',
|
label: 'меняем предка на R',
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param e
|
||||||
|
* @param menuItem
|
||||||
|
* @param {kit.menu.Class} menu
|
||||||
|
*/
|
||||||
click: function(e, menuItem, menu) {
|
click: function(e, menuItem, menu) {
|
||||||
console.log('клик by ' + menuItem.options.label);
|
console.log('клик by ' + menuItem.options.label);
|
||||||
menuItem.setVisible(false);
|
menuItem.setVisible(false);
|
||||||
var tMenu = menu.getItemById(item2.getId());
|
var tMenu = menu.getItemById(item2.getId());
|
||||||
|
|
||||||
if(tMenu) {
|
if(tMenu) {
|
||||||
tMenu.setVisible(true);
|
tMenu.setVisible(true);
|
||||||
}
|
}
|
||||||
menu.setParent(document.querySelector('#change-context-menu-r'));
|
menu.setParent('#change-context-menu-r');
|
||||||
},
|
},
|
||||||
}, true);
|
});
|
||||||
var item2 = menuBase.addItem({
|
var item2 = menuBase.addItem({
|
||||||
label: 'меняем предка на X',
|
label: 'меняем предка на X',
|
||||||
visible: false,
|
visible: false,
|
||||||
@@ -282,9 +290,9 @@ kit.ready(['menu', 'animations'], function () {
|
|||||||
if(tMenu) {
|
if(tMenu) {
|
||||||
tMenu.setVisible(true);
|
tMenu.setVisible(true);
|
||||||
}
|
}
|
||||||
menu.setParent(document.querySelector('#change-context-menu-x'));
|
menu.setParent('#change-context-menu-x');
|
||||||
},
|
},
|
||||||
}, true);
|
});
|
||||||
|
|
||||||
menuBase.init();
|
menuBase.init();
|
||||||
|
|
||||||
|
|||||||
@@ -33,11 +33,24 @@ $APPLICATION->ShowHead();
|
|||||||
m5.viewer.animShowClass = kit.animations.scaleIn;
|
m5.viewer.animShowClass = kit.animations.scaleIn;
|
||||||
m5.viewer.animHideClass = kit.animations.scaleOut;
|
m5.viewer.animHideClass = kit.animations.scaleOut;
|
||||||
m5.run();
|
m5.run();
|
||||||
|
// var m6 = new kit.userAction.Hint();
|
||||||
var m6 = new kit.userAction.Hint('#object8', '#object9');
|
var m6 = new kit.userAction.Hint('#object8', '#object9');
|
||||||
m6.run();
|
m6.run();
|
||||||
m6.viewer.animShowClass = kit.animations.scaleIn;
|
m6.viewer.animShowClass = kit.animations.scaleIn;
|
||||||
m6.viewer.animHideClass = kit.animations.scaleOut;
|
m6.viewer.animHideClass = kit.animations.scaleOut;
|
||||||
|
m6.run();
|
||||||
|
|
||||||
|
var m7 = new kit.userAction.Hint();
|
||||||
|
try {
|
||||||
|
m7.run();
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
m7.stop();
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
Reference in New Issue
Block a user