init repo
This commit is contained in:
572
OfficeWeb/3rdparty/extjs/src/panel/AbstractPanel.js
vendored
Normal file
572
OfficeWeb/3rdparty/extjs/src/panel/AbstractPanel.js
vendored
Normal file
@@ -0,0 +1,572 @@
|
||||
/*
|
||||
|
||||
This file is part of Ext JS 4
|
||||
|
||||
Copyright (c) 2011 Sencha Inc
|
||||
|
||||
Contact: http://www.sencha.com/contact
|
||||
|
||||
GNU General Public License Usage
|
||||
This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
|
||||
|
||||
*/
|
||||
/**
|
||||
* @class Ext.panel.AbstractPanel
|
||||
* @extends Ext.container.Container
|
||||
* A base class which provides methods common to Panel classes across the Sencha product range.
|
||||
* @private
|
||||
*/
|
||||
Ext.define('Ext.panel.AbstractPanel', {
|
||||
|
||||
/* Begin Definitions */
|
||||
|
||||
extend: 'Ext.container.Container',
|
||||
|
||||
requires: ['Ext.util.MixedCollection', 'Ext.Element', 'Ext.toolbar.Toolbar'],
|
||||
|
||||
/* End Definitions */
|
||||
|
||||
/**
|
||||
* @cfg {String} [baseCls='x-panel']
|
||||
* The base CSS class to apply to this panel's element.
|
||||
*/
|
||||
baseCls : Ext.baseCSSPrefix + 'panel',
|
||||
|
||||
/**
|
||||
* @cfg {Number/String} bodyPadding
|
||||
* A shortcut for setting a padding style on the body element. The value can either be
|
||||
* a number to be applied to all sides, or a normal css string describing padding.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @cfg {Boolean} bodyBorder
|
||||
* A shortcut to add or remove the border on the body of a panel. This only applies to a panel
|
||||
* which has the {@link #frame} configuration set to `true`.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @cfg {String/Object/Function} bodyStyle
|
||||
* Custom CSS styles to be applied to the panel's body element, which can be supplied as a valid CSS style string,
|
||||
* an object containing style property name/value pairs or a function that returns such a string or object.
|
||||
* For example, these two formats are interpreted to be equivalent:<pre><code>
|
||||
bodyStyle: 'background:#ffc; padding:10px;'
|
||||
|
||||
bodyStyle: {
|
||||
background: '#ffc',
|
||||
padding: '10px'
|
||||
}
|
||||
* </code></pre>
|
||||
*/
|
||||
|
||||
/**
|
||||
* @cfg {String/String[]} bodyCls
|
||||
* A CSS class, space-delimited string of classes, or array of classes to be applied to the panel's body element.
|
||||
* The following examples are all valid:<pre><code>
|
||||
bodyCls: 'foo'
|
||||
bodyCls: 'foo bar'
|
||||
bodyCls: ['foo', 'bar']
|
||||
* </code></pre>
|
||||
*/
|
||||
|
||||
isPanel: true,
|
||||
|
||||
componentLayout: 'dock',
|
||||
|
||||
/**
|
||||
* @cfg {Object} defaultDockWeights
|
||||
* This object holds the default weights applied to dockedItems that have no weight. These start with a
|
||||
* weight of 1, to allow negative weights to insert before top items and are odd numbers
|
||||
* so that even weights can be used to get between different dock orders.
|
||||
*
|
||||
* To make default docking order match border layout, do this:
|
||||
* <pre><code>
|
||||
Ext.panel.AbstractPanel.prototype.defaultDockWeights = { top: 1, bottom: 3, left: 5, right: 7 };</code></pre>
|
||||
* Changing these defaults as above or individually on this object will effect all Panels.
|
||||
* To change the defaults on a single panel, you should replace the entire object:
|
||||
* <pre><code>
|
||||
initComponent: function () {
|
||||
// NOTE: Don't change members of defaultDockWeights since the object is shared.
|
||||
this.defaultDockWeights = { top: 1, bottom: 3, left: 5, right: 7 };
|
||||
|
||||
this.callParent();
|
||||
}</code></pre>
|
||||
*
|
||||
* To change only one of the default values, you do this:
|
||||
* <pre><code>
|
||||
initComponent: function () {
|
||||
// NOTE: Don't change members of defaultDockWeights since the object is shared.
|
||||
this.defaultDockWeights = Ext.applyIf({ top: 10 }, this.defaultDockWeights);
|
||||
|
||||
this.callParent();
|
||||
}</code></pre>
|
||||
*/
|
||||
defaultDockWeights: { top: 1, left: 3, right: 5, bottom: 7 },
|
||||
|
||||
renderTpl: [
|
||||
'<div id="{id}-body" class="{baseCls}-body<tpl if="bodyCls"> {bodyCls}</tpl>',
|
||||
' {baseCls}-body-{ui}<tpl if="uiCls">',
|
||||
'<tpl for="uiCls"> {parent.baseCls}-body-{parent.ui}-{.}</tpl>',
|
||||
'</tpl>"<tpl if="bodyStyle"> style="{bodyStyle}"</tpl>>',
|
||||
'</div>'
|
||||
],
|
||||
|
||||
// TODO: Move code examples into product-specific files. The code snippet below is Touch only.
|
||||
/**
|
||||
* @cfg {Object/Object[]} dockedItems
|
||||
* A component or series of components to be added as docked items to this panel.
|
||||
* The docked items can be docked to either the top, right, left or bottom of a panel.
|
||||
* This is typically used for things like toolbars or tab bars:
|
||||
* <pre><code>
|
||||
var panel = new Ext.panel.Panel({
|
||||
fullscreen: true,
|
||||
dockedItems: [{
|
||||
xtype: 'toolbar',
|
||||
dock: 'top',
|
||||
items: [{
|
||||
text: 'Docked to the top'
|
||||
}]
|
||||
}]
|
||||
});</code></pre>
|
||||
*/
|
||||
|
||||
border: true,
|
||||
|
||||
initComponent : function() {
|
||||
var me = this;
|
||||
|
||||
me.addEvents(
|
||||
/**
|
||||
* @event bodyresize
|
||||
* Fires after the Panel has been resized.
|
||||
* @param {Ext.panel.Panel} p the Panel which has been resized.
|
||||
* @param {Number} width The Panel body's new width.
|
||||
* @param {Number} height The Panel body's new height.
|
||||
*/
|
||||
'bodyresize'
|
||||
// // inherited
|
||||
// 'activate',
|
||||
// // inherited
|
||||
// 'deactivate'
|
||||
);
|
||||
|
||||
me.addChildEls('body');
|
||||
|
||||
//!frame
|
||||
//!border
|
||||
|
||||
if (me.frame && me.border && me.bodyBorder === undefined) {
|
||||
me.bodyBorder = false;
|
||||
}
|
||||
if (me.frame && me.border && (me.bodyBorder === false || me.bodyBorder === 0)) {
|
||||
me.manageBodyBorders = true;
|
||||
}
|
||||
|
||||
me.callParent();
|
||||
},
|
||||
|
||||
// @private
|
||||
initItems : function() {
|
||||
var me = this,
|
||||
items = me.dockedItems;
|
||||
|
||||
me.callParent();
|
||||
me.dockedItems = Ext.create('Ext.util.MixedCollection', false, me.getComponentId);
|
||||
if (items) {
|
||||
me.addDocked(items);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Finds a docked component by id, itemId or position. Also see {@link #getDockedItems}
|
||||
* @param {String/Number} comp The id, itemId or position of the docked component (see {@link #getComponent} for details)
|
||||
* @return {Ext.Component} The docked component (if found)
|
||||
*/
|
||||
getDockedComponent: function(comp) {
|
||||
if (Ext.isObject(comp)) {
|
||||
comp = comp.getItemId();
|
||||
}
|
||||
return this.dockedItems.get(comp);
|
||||
},
|
||||
|
||||
/**
|
||||
* Attempts a default component lookup (see {@link Ext.container.Container#getComponent}). If the component is not found in the normal
|
||||
* items, the dockedItems are searched and the matched component (if any) returned (see {@link #getDockedComponent}). Note that docked
|
||||
* items will only be matched by component id or itemId -- if you pass a numeric index only non-docked child components will be searched.
|
||||
* @param {String/Number} comp The component id, itemId or position to find
|
||||
* @return {Ext.Component} The component (if found)
|
||||
*/
|
||||
getComponent: function(comp) {
|
||||
var component = this.callParent(arguments);
|
||||
if (component === undefined && !Ext.isNumber(comp)) {
|
||||
// If the arg is a numeric index skip docked items
|
||||
component = this.getDockedComponent(comp);
|
||||
}
|
||||
return component;
|
||||
},
|
||||
|
||||
/**
|
||||
* Parses the {@link bodyStyle} config if available to create a style string that will be applied to the body element.
|
||||
* This also includes {@link bodyPadding} and {@link bodyBorder} if available.
|
||||
* @return {String} A CSS style string with body styles, padding and border.
|
||||
* @private
|
||||
*/
|
||||
initBodyStyles: function() {
|
||||
var me = this,
|
||||
bodyStyle = me.bodyStyle,
|
||||
styles = [],
|
||||
Element = Ext.Element,
|
||||
prop;
|
||||
|
||||
if (Ext.isFunction(bodyStyle)) {
|
||||
bodyStyle = bodyStyle();
|
||||
}
|
||||
if (Ext.isString(bodyStyle)) {
|
||||
styles = bodyStyle.split(';');
|
||||
} else {
|
||||
for (prop in bodyStyle) {
|
||||
if (bodyStyle.hasOwnProperty(prop)) {
|
||||
styles.push(prop + ':' + bodyStyle[prop]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (me.bodyPadding !== undefined) {
|
||||
styles.push('padding: ' + Element.unitizeBox((me.bodyPadding === true) ? 5 : me.bodyPadding));
|
||||
}
|
||||
if (me.frame && me.bodyBorder) {
|
||||
if (!Ext.isNumber(me.bodyBorder)) {
|
||||
me.bodyBorder = 1;
|
||||
}
|
||||
styles.push('border-width: ' + Element.unitizeBox(me.bodyBorder));
|
||||
}
|
||||
delete me.bodyStyle;
|
||||
return styles.length ? styles.join(';') : undefined;
|
||||
},
|
||||
|
||||
/**
|
||||
* Parse the {@link bodyCls} config if available to create a comma-delimited string of
|
||||
* CSS classes to be applied to the body element.
|
||||
* @return {String} The CSS class(es)
|
||||
* @private
|
||||
*/
|
||||
initBodyCls: function() {
|
||||
var me = this,
|
||||
cls = '',
|
||||
bodyCls = me.bodyCls;
|
||||
|
||||
if (bodyCls) {
|
||||
Ext.each(bodyCls, function(v) {
|
||||
cls += " " + v;
|
||||
});
|
||||
delete me.bodyCls;
|
||||
}
|
||||
return cls.length > 0 ? cls : undefined;
|
||||
},
|
||||
|
||||
/**
|
||||
* Initialized the renderData to be used when rendering the renderTpl.
|
||||
* @return {Object} Object with keys and values that are going to be applied to the renderTpl
|
||||
* @private
|
||||
*/
|
||||
initRenderData: function() {
|
||||
return Ext.applyIf(this.callParent(), {
|
||||
bodyStyle: this.initBodyStyles(),
|
||||
bodyCls: this.initBodyCls()
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Adds docked item(s) to the panel.
|
||||
* @param {Object/Object[]} component The Component or array of components to add. The components
|
||||
* must include a 'dock' parameter on each component to indicate where it should be docked ('top', 'right',
|
||||
* 'bottom', 'left').
|
||||
* @param {Number} pos (optional) The index at which the Component will be added
|
||||
*/
|
||||
addDocked : function(items, pos) {
|
||||
var me = this,
|
||||
i = 0,
|
||||
item, length;
|
||||
|
||||
items = me.prepareItems(items);
|
||||
length = items.length;
|
||||
|
||||
for (; i < length; i++) {
|
||||
item = items[i];
|
||||
item.dock = item.dock || 'top';
|
||||
|
||||
// Allow older browsers to target docked items to style without borders
|
||||
if (me.border === false) {
|
||||
// item.cls = item.cls || '' + ' ' + me.baseCls + '-noborder-docked-' + item.dock;
|
||||
}
|
||||
|
||||
if (pos !== undefined) {
|
||||
me.dockedItems.insert(pos + i, item);
|
||||
}
|
||||
else {
|
||||
me.dockedItems.add(item);
|
||||
}
|
||||
item.onAdded(me, i);
|
||||
me.onDockedAdd(item);
|
||||
}
|
||||
|
||||
// Set flag which means that beforeLayout will not veto the layout due to the size not changing
|
||||
me.componentLayout.childrenChanged = true;
|
||||
if (me.rendered && !me.suspendLayout) {
|
||||
me.doComponentLayout();
|
||||
}
|
||||
return items;
|
||||
},
|
||||
|
||||
// Placeholder empty functions
|
||||
onDockedAdd : Ext.emptyFn,
|
||||
onDockedRemove : Ext.emptyFn,
|
||||
|
||||
/**
|
||||
* Inserts docked item(s) to the panel at the indicated position.
|
||||
* @param {Number} pos The index at which the Component will be inserted
|
||||
* @param {Object/Object[]} component. The Component or array of components to add. The components
|
||||
* must include a 'dock' paramater on each component to indicate where it should be docked ('top', 'right',
|
||||
* 'bottom', 'left').
|
||||
*/
|
||||
insertDocked : function(pos, items) {
|
||||
this.addDocked(items, pos);
|
||||
},
|
||||
|
||||
/**
|
||||
* Removes the docked item from the panel.
|
||||
* @param {Ext.Component} item. The Component to remove.
|
||||
* @param {Boolean} autoDestroy (optional) Destroy the component after removal.
|
||||
*/
|
||||
removeDocked : function(item, autoDestroy) {
|
||||
var me = this,
|
||||
layout,
|
||||
hasLayout;
|
||||
|
||||
if (!me.dockedItems.contains(item)) {
|
||||
return item;
|
||||
}
|
||||
|
||||
layout = me.componentLayout;
|
||||
hasLayout = layout && me.rendered;
|
||||
|
||||
if (hasLayout) {
|
||||
layout.onRemove(item);
|
||||
}
|
||||
|
||||
me.dockedItems.remove(item);
|
||||
item.onRemoved();
|
||||
me.onDockedRemove(item);
|
||||
|
||||
if (autoDestroy === true || (autoDestroy !== false && me.autoDestroy)) {
|
||||
item.destroy();
|
||||
} else if (hasLayout) {
|
||||
// not destroying, make any layout related removals
|
||||
layout.afterRemove(item);
|
||||
}
|
||||
|
||||
|
||||
// Set flag which means that beforeLayout will not veto the layout due to the size not changing
|
||||
me.componentLayout.childrenChanged = true;
|
||||
if (!me.destroying && !me.suspendLayout) {
|
||||
me.doComponentLayout();
|
||||
}
|
||||
|
||||
return item;
|
||||
},
|
||||
|
||||
/**
|
||||
* Retrieve an array of all currently docked Components.
|
||||
* @param {String} cqSelector A {@link Ext.ComponentQuery ComponentQuery} selector string to filter the returned items.
|
||||
* @return {Ext.Component[]} An array of components.
|
||||
*/
|
||||
getDockedItems : function(cqSelector) {
|
||||
var me = this,
|
||||
defaultWeight = me.defaultDockWeights,
|
||||
dockedItems;
|
||||
|
||||
if (me.dockedItems && me.dockedItems.items.length) {
|
||||
// Allow filtering of returned docked items by CQ selector.
|
||||
if (cqSelector) {
|
||||
dockedItems = Ext.ComponentQuery.query(cqSelector, me.dockedItems.items);
|
||||
} else {
|
||||
dockedItems = me.dockedItems.items.slice();
|
||||
}
|
||||
|
||||
Ext.Array.sort(dockedItems, function(a, b) {
|
||||
// Docked items are ordered by their visual representation by default (t,l,r,b)
|
||||
var aw = a.weight || defaultWeight[a.dock],
|
||||
bw = b.weight || defaultWeight[b.dock];
|
||||
if (Ext.isNumber(aw) && Ext.isNumber(bw)) {
|
||||
return aw - bw;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
|
||||
return dockedItems;
|
||||
}
|
||||
return [];
|
||||
},
|
||||
|
||||
// inherit docs
|
||||
addUIClsToElement: function(cls, force) {
|
||||
var me = this,
|
||||
result = me.callParent(arguments),
|
||||
classes = [Ext.baseCSSPrefix + cls, me.baseCls + '-body-' + cls, me.baseCls + '-body-' + me.ui + '-' + cls],
|
||||
array, i;
|
||||
|
||||
if (!force && me.rendered) {
|
||||
if (me.bodyCls) {
|
||||
me.body.addCls(me.bodyCls);
|
||||
} else {
|
||||
me.body.addCls(classes);
|
||||
}
|
||||
} else {
|
||||
if (me.bodyCls) {
|
||||
array = me.bodyCls.split(' ');
|
||||
|
||||
for (i = 0; i < classes.length; i++) {
|
||||
if (!Ext.Array.contains(array, classes[i])) {
|
||||
array.push(classes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
me.bodyCls = array.join(' ');
|
||||
} else {
|
||||
me.bodyCls = classes.join(' ');
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
// inherit docs
|
||||
removeUIClsFromElement: function(cls, force) {
|
||||
var me = this,
|
||||
result = me.callParent(arguments),
|
||||
classes = [Ext.baseCSSPrefix + cls, me.baseCls + '-body-' + cls, me.baseCls + '-body-' + me.ui + '-' + cls],
|
||||
array, i;
|
||||
|
||||
if (!force && me.rendered) {
|
||||
if (me.bodyCls) {
|
||||
me.body.removeCls(me.bodyCls);
|
||||
} else {
|
||||
me.body.removeCls(classes);
|
||||
}
|
||||
} else {
|
||||
if (me.bodyCls) {
|
||||
array = me.bodyCls.split(' ');
|
||||
|
||||
for (i = 0; i < classes.length; i++) {
|
||||
Ext.Array.remove(array, classes[i]);
|
||||
}
|
||||
|
||||
me.bodyCls = array.join(' ');
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
// inherit docs
|
||||
addUIToElement: function(force) {
|
||||
var me = this,
|
||||
cls = me.baseCls + '-body-' + me.ui,
|
||||
array;
|
||||
|
||||
me.callParent(arguments);
|
||||
|
||||
if (!force && me.rendered) {
|
||||
if (me.bodyCls) {
|
||||
me.body.addCls(me.bodyCls);
|
||||
} else {
|
||||
me.body.addCls(cls);
|
||||
}
|
||||
} else {
|
||||
if (me.bodyCls) {
|
||||
array = me.bodyCls.split(' ');
|
||||
|
||||
if (!Ext.Array.contains(array, cls)) {
|
||||
array.push(cls);
|
||||
}
|
||||
|
||||
me.bodyCls = array.join(' ');
|
||||
} else {
|
||||
me.bodyCls = cls;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// inherit docs
|
||||
removeUIFromElement: function() {
|
||||
var me = this,
|
||||
cls = me.baseCls + '-body-' + me.ui,
|
||||
array;
|
||||
|
||||
me.callParent(arguments);
|
||||
|
||||
if (me.rendered) {
|
||||
if (me.bodyCls) {
|
||||
me.body.removeCls(me.bodyCls);
|
||||
} else {
|
||||
me.body.removeCls(cls);
|
||||
}
|
||||
} else {
|
||||
if (me.bodyCls) {
|
||||
array = me.bodyCls.split(' ');
|
||||
Ext.Array.remove(array, cls);
|
||||
me.bodyCls = array.join(' ');
|
||||
} else {
|
||||
me.bodyCls = cls;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// @private
|
||||
getTargetEl : function() {
|
||||
return this.body;
|
||||
},
|
||||
|
||||
getRefItems: function(deep) {
|
||||
var items = this.callParent(arguments),
|
||||
// deep fetches all docked items, and their descendants using '*' selector and then '* *'
|
||||
dockedItems = this.getDockedItems(deep ? '*,* *' : undefined),
|
||||
ln = dockedItems.length,
|
||||
i = 0,
|
||||
item;
|
||||
|
||||
// Find the index where we go from top/left docked items to right/bottom docked items
|
||||
for (; i < ln; i++) {
|
||||
item = dockedItems[i];
|
||||
if (item.dock === 'right' || item.dock === 'bottom') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Return docked items in the top/left position before our container items, and
|
||||
// return right/bottom positioned items after our container items.
|
||||
// See AbstractDock.renderItems() for more information.
|
||||
return Ext.Array.splice(dockedItems, 0, i).concat(items).concat(dockedItems);
|
||||
},
|
||||
|
||||
beforeDestroy: function(){
|
||||
var docked = this.dockedItems,
|
||||
c;
|
||||
|
||||
if (docked) {
|
||||
while ((c = docked.first())) {
|
||||
this.removeDocked(c, true);
|
||||
}
|
||||
}
|
||||
this.callParent();
|
||||
},
|
||||
|
||||
setBorder: function(border) {
|
||||
var me = this;
|
||||
me.border = (border !== undefined) ? border : true;
|
||||
if (me.rendered) {
|
||||
me.doComponentLayout();
|
||||
}
|
||||
}
|
||||
});
|
||||
69
OfficeWeb/3rdparty/extjs/src/panel/DD.js
vendored
Normal file
69
OfficeWeb/3rdparty/extjs/src/panel/DD.js
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
|
||||
This file is part of Ext JS 4
|
||||
|
||||
Copyright (c) 2011 Sencha Inc
|
||||
|
||||
Contact: http://www.sencha.com/contact
|
||||
|
||||
GNU General Public License Usage
|
||||
This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
|
||||
|
||||
*/
|
||||
// private - DD implementation for Panels
|
||||
Ext.define('Ext.panel.DD', {
|
||||
extend: 'Ext.dd.DragSource',
|
||||
requires: ['Ext.panel.Proxy'],
|
||||
|
||||
constructor : function(panel, cfg){
|
||||
this.panel = panel;
|
||||
this.dragData = {panel: panel};
|
||||
this.proxy = Ext.create('Ext.panel.Proxy', panel, cfg);
|
||||
|
||||
this.callParent([panel.el, cfg]);
|
||||
|
||||
Ext.defer(function() {
|
||||
var header = panel.header,
|
||||
el = panel.body;
|
||||
|
||||
if(header){
|
||||
this.setHandleElId(header.id);
|
||||
el = header.el;
|
||||
}
|
||||
el.setStyle('cursor', 'move');
|
||||
this.scroll = false;
|
||||
}, 200, this);
|
||||
},
|
||||
|
||||
showFrame: Ext.emptyFn,
|
||||
startDrag: Ext.emptyFn,
|
||||
b4StartDrag: function(x, y) {
|
||||
this.proxy.show();
|
||||
},
|
||||
b4MouseDown: function(e) {
|
||||
var x = e.getPageX(),
|
||||
y = e.getPageY();
|
||||
this.autoOffset(x, y);
|
||||
},
|
||||
onInitDrag : function(x, y){
|
||||
this.onStartDrag(x, y);
|
||||
return true;
|
||||
},
|
||||
createFrame : Ext.emptyFn,
|
||||
getDragEl : function(e){
|
||||
return this.proxy.ghost.el.dom;
|
||||
},
|
||||
endDrag : function(e){
|
||||
this.proxy.hide();
|
||||
this.panel.saveState();
|
||||
},
|
||||
|
||||
autoOffset : function(x, y) {
|
||||
x -= this.startPageX;
|
||||
y -= this.startPageY;
|
||||
this.setDelta(x, y);
|
||||
}
|
||||
});
|
||||
|
||||
432
OfficeWeb/3rdparty/extjs/src/panel/Header.js
vendored
Normal file
432
OfficeWeb/3rdparty/extjs/src/panel/Header.js
vendored
Normal file
@@ -0,0 +1,432 @@
|
||||
/*
|
||||
|
||||
This file is part of Ext JS 4
|
||||
|
||||
Copyright (c) 2011 Sencha Inc
|
||||
|
||||
Contact: http://www.sencha.com/contact
|
||||
|
||||
GNU General Public License Usage
|
||||
This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
|
||||
|
||||
*/
|
||||
/**
|
||||
* @class Ext.panel.Header
|
||||
* @extends Ext.container.Container
|
||||
* Simple header class which is used for on {@link Ext.panel.Panel} and {@link Ext.window.Window}
|
||||
*/
|
||||
Ext.define('Ext.panel.Header', {
|
||||
extend: 'Ext.container.Container',
|
||||
uses: ['Ext.panel.Tool', 'Ext.draw.Component', 'Ext.util.CSS'],
|
||||
alias: 'widget.header',
|
||||
|
||||
isHeader : true,
|
||||
defaultType : 'tool',
|
||||
indicateDrag : false,
|
||||
weight : -1,
|
||||
|
||||
renderTpl: [
|
||||
'<div id="{id}-body" class="{baseCls}-body<tpl if="bodyCls"> {bodyCls}</tpl>',
|
||||
'<tpl if="uiCls">',
|
||||
'<tpl for="uiCls"> {parent.baseCls}-body-{parent.ui}-{.}</tpl>',
|
||||
'</tpl>"',
|
||||
'<tpl if="bodyStyle"> style="{bodyStyle}"</tpl>></div>'],
|
||||
|
||||
/**
|
||||
* @cfg {String} title
|
||||
* The title text to display
|
||||
*/
|
||||
|
||||
/**
|
||||
* @cfg {String} iconCls
|
||||
* CSS class for icon in header. Used for displaying an icon to the left of a title.
|
||||
*/
|
||||
|
||||
initComponent: function() {
|
||||
var me = this,
|
||||
ruleStyle,
|
||||
rule,
|
||||
style,
|
||||
titleTextEl,
|
||||
ui;
|
||||
|
||||
me.indicateDragCls = me.baseCls + '-draggable';
|
||||
me.title = me.title || ' ';
|
||||
me.tools = me.tools || [];
|
||||
me.items = me.items || [];
|
||||
me.orientation = me.orientation || 'horizontal';
|
||||
me.dock = (me.dock) ? me.dock : (me.orientation == 'horizontal') ? 'top' : 'left';
|
||||
|
||||
//add the dock as a ui
|
||||
//this is so we support top/right/left/bottom headers
|
||||
me.addClsWithUI(me.orientation);
|
||||
me.addClsWithUI(me.dock);
|
||||
|
||||
me.addChildEls('body');
|
||||
|
||||
// Add Icon
|
||||
if (!Ext.isEmpty(me.iconCls)) {
|
||||
me.initIconCmp();
|
||||
me.items.push(me.iconCmp);
|
||||
}
|
||||
|
||||
// Add Title
|
||||
if (me.orientation == 'vertical') {
|
||||
// Hack for IE6/7's inability to display an inline-block
|
||||
if (Ext.isIE6 || Ext.isIE7) {
|
||||
me.width = this.width || 24;
|
||||
} else if (Ext.isIEQuirks) {
|
||||
me.width = this.width || 25;
|
||||
}
|
||||
|
||||
me.layout = {
|
||||
type : 'vbox',
|
||||
align: 'center',
|
||||
clearInnerCtOnLayout: true,
|
||||
bindToOwnerCtContainer: false
|
||||
};
|
||||
me.textConfig = {
|
||||
cls: me.baseCls + '-text',
|
||||
type: 'text',
|
||||
text: me.title,
|
||||
rotate: {
|
||||
degrees: 90
|
||||
}
|
||||
};
|
||||
ui = me.ui;
|
||||
if (Ext.isArray(ui)) {
|
||||
ui = ui[0];
|
||||
}
|
||||
ruleStyle = '.' + me.baseCls + '-text-' + ui;
|
||||
if (Ext.scopeResetCSS) {
|
||||
ruleStyle = '.' + Ext.baseCSSPrefix + 'reset ' + ruleStyle;
|
||||
}
|
||||
rule = Ext.util.CSS.getRule(ruleStyle);
|
||||
if (rule) {
|
||||
style = rule.style;
|
||||
}
|
||||
if (style) {
|
||||
Ext.apply(me.textConfig, {
|
||||
'font-family': style.fontFamily,
|
||||
'font-weight': style.fontWeight,
|
||||
'font-size': style.fontSize,
|
||||
fill: style.color
|
||||
});
|
||||
}
|
||||
me.titleCmp = Ext.create('Ext.draw.Component', {
|
||||
ariaRole : 'heading',
|
||||
focusable: false,
|
||||
viewBox: false,
|
||||
flex : 1,
|
||||
autoSize: true,
|
||||
margins: '5 0 0 0',
|
||||
items: [ me.textConfig ],
|
||||
// this is a bit of a cheat: we are not selecting an element of titleCmp
|
||||
// but rather of titleCmp.items[0] (so we cannot use childEls)
|
||||
renderSelectors: {
|
||||
textEl: '.' + me.baseCls + '-text'
|
||||
}
|
||||
});
|
||||
} else {
|
||||
me.layout = {
|
||||
type : 'hbox',
|
||||
align: 'middle',
|
||||
clearInnerCtOnLayout: true,
|
||||
bindToOwnerCtContainer: false
|
||||
};
|
||||
me.titleCmp = Ext.create('Ext.Component', {
|
||||
xtype : 'component',
|
||||
ariaRole : 'heading',
|
||||
focusable: false,
|
||||
flex : 1,
|
||||
cls: me.baseCls + '-text-container',
|
||||
renderTpl : [
|
||||
'<span id="{id}-textEl" class="{cls}-text {cls}-text-{ui}">{title}</span>'
|
||||
],
|
||||
renderData: {
|
||||
title: me.title,
|
||||
cls : me.baseCls,
|
||||
ui : me.ui
|
||||
},
|
||||
childEls: ['textEl']
|
||||
});
|
||||
}
|
||||
me.items.push(me.titleCmp);
|
||||
|
||||
// Add Tools
|
||||
me.items = me.items.concat(me.tools);
|
||||
this.callParent();
|
||||
},
|
||||
|
||||
initIconCmp: function() {
|
||||
this.iconCmp = Ext.create('Ext.Component', {
|
||||
focusable: false,
|
||||
renderTpl : [
|
||||
'<img id="{id}-iconEl" alt="" src="{blank}" class="{cls}-icon {iconCls}"/>'
|
||||
],
|
||||
renderData: {
|
||||
blank : Ext.BLANK_IMAGE_URL,
|
||||
cls : this.baseCls,
|
||||
iconCls: this.iconCls,
|
||||
orientation: this.orientation
|
||||
},
|
||||
childEls: ['iconEl'],
|
||||
iconCls: this.iconCls
|
||||
});
|
||||
},
|
||||
|
||||
afterRender: function() {
|
||||
var me = this;
|
||||
|
||||
me.el.unselectable();
|
||||
if (me.indicateDrag) {
|
||||
me.el.addCls(me.indicateDragCls);
|
||||
}
|
||||
me.mon(me.el, {
|
||||
click: me.onClick,
|
||||
scope: me
|
||||
});
|
||||
me.callParent();
|
||||
},
|
||||
|
||||
afterLayout: function() {
|
||||
var me = this;
|
||||
me.callParent(arguments);
|
||||
|
||||
// IE7 needs a forced repaint to make the top framing div expand to full width
|
||||
if (Ext.isIE7) {
|
||||
me.el.repaint();
|
||||
}
|
||||
},
|
||||
|
||||
// inherit docs
|
||||
addUIClsToElement: function(cls, force) {
|
||||
var me = this,
|
||||
result = me.callParent(arguments),
|
||||
classes = [me.baseCls + '-body-' + cls, me.baseCls + '-body-' + me.ui + '-' + cls],
|
||||
array, i;
|
||||
|
||||
if (!force && me.rendered) {
|
||||
if (me.bodyCls) {
|
||||
me.body.addCls(me.bodyCls);
|
||||
} else {
|
||||
me.body.addCls(classes);
|
||||
}
|
||||
} else {
|
||||
if (me.bodyCls) {
|
||||
array = me.bodyCls.split(' ');
|
||||
|
||||
for (i = 0; i < classes.length; i++) {
|
||||
if (!Ext.Array.contains(array, classes[i])) {
|
||||
array.push(classes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
me.bodyCls = array.join(' ');
|
||||
} else {
|
||||
me.bodyCls = classes.join(' ');
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
// inherit docs
|
||||
removeUIClsFromElement: function(cls, force) {
|
||||
var me = this,
|
||||
result = me.callParent(arguments),
|
||||
classes = [me.baseCls + '-body-' + cls, me.baseCls + '-body-' + me.ui + '-' + cls],
|
||||
array, i;
|
||||
|
||||
if (!force && me.rendered) {
|
||||
if (me.bodyCls) {
|
||||
me.body.removeCls(me.bodyCls);
|
||||
} else {
|
||||
me.body.removeCls(classes);
|
||||
}
|
||||
} else {
|
||||
if (me.bodyCls) {
|
||||
array = me.bodyCls.split(' ');
|
||||
|
||||
for (i = 0; i < classes.length; i++) {
|
||||
Ext.Array.remove(array, classes[i]);
|
||||
}
|
||||
|
||||
me.bodyCls = array.join(' ');
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
// inherit docs
|
||||
addUIToElement: function(force) {
|
||||
var me = this,
|
||||
array, cls;
|
||||
|
||||
me.callParent(arguments);
|
||||
|
||||
cls = me.baseCls + '-body-' + me.ui;
|
||||
if (!force && me.rendered) {
|
||||
if (me.bodyCls) {
|
||||
me.body.addCls(me.bodyCls);
|
||||
} else {
|
||||
me.body.addCls(cls);
|
||||
}
|
||||
} else {
|
||||
if (me.bodyCls) {
|
||||
array = me.bodyCls.split(' ');
|
||||
|
||||
if (!Ext.Array.contains(array, cls)) {
|
||||
array.push(cls);
|
||||
}
|
||||
|
||||
me.bodyCls = array.join(' ');
|
||||
} else {
|
||||
me.bodyCls = cls;
|
||||
}
|
||||
}
|
||||
|
||||
if (!force && me.titleCmp && me.titleCmp.rendered && me.titleCmp.textEl) {
|
||||
me.titleCmp.textEl.addCls(me.baseCls + '-text-' + me.ui);
|
||||
}
|
||||
},
|
||||
|
||||
// inherit docs
|
||||
removeUIFromElement: function() {
|
||||
var me = this,
|
||||
array, cls;
|
||||
|
||||
me.callParent(arguments);
|
||||
|
||||
cls = me.baseCls + '-body-' + me.ui;
|
||||
if (me.rendered) {
|
||||
if (me.bodyCls) {
|
||||
me.body.removeCls(me.bodyCls);
|
||||
} else {
|
||||
me.body.removeCls(cls);
|
||||
}
|
||||
} else {
|
||||
if (me.bodyCls) {
|
||||
array = me.bodyCls.split(' ');
|
||||
Ext.Array.remove(array, cls);
|
||||
me.bodyCls = array.join(' ');
|
||||
} else {
|
||||
me.bodyCls = cls;
|
||||
}
|
||||
}
|
||||
|
||||
if (me.titleCmp && me.titleCmp.rendered && me.titleCmp.textEl) {
|
||||
me.titleCmp.textEl.removeCls(me.baseCls + '-text-' + me.ui);
|
||||
}
|
||||
},
|
||||
|
||||
onClick: function(e) {
|
||||
if (!e.getTarget(Ext.baseCSSPrefix + 'tool')) {
|
||||
this.fireEvent('click', e);
|
||||
}
|
||||
},
|
||||
|
||||
getTargetEl: function() {
|
||||
return this.body || this.frameBody || this.el;
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the title of the header.
|
||||
* @param {String} title The title to be set
|
||||
*/
|
||||
setTitle: function(title) {
|
||||
var me = this;
|
||||
if (me.rendered) {
|
||||
if (me.titleCmp.rendered) {
|
||||
if (me.titleCmp.surface) {
|
||||
me.title = title || '';
|
||||
var sprite = me.titleCmp.surface.items.items[0],
|
||||
surface = me.titleCmp.surface;
|
||||
|
||||
surface.remove(sprite);
|
||||
me.textConfig.type = 'text';
|
||||
me.textConfig.text = title;
|
||||
sprite = surface.add(me.textConfig);
|
||||
sprite.setAttributes({
|
||||
rotate: {
|
||||
degrees: 90
|
||||
}
|
||||
}, true);
|
||||
me.titleCmp.autoSizeSurface();
|
||||
} else {
|
||||
me.title = title || ' ';
|
||||
me.titleCmp.textEl.update(me.title);
|
||||
}
|
||||
} else {
|
||||
me.titleCmp.on({
|
||||
render: function() {
|
||||
me.setTitle(title);
|
||||
},
|
||||
single: true
|
||||
});
|
||||
}
|
||||
} else {
|
||||
me.on({
|
||||
render: function() {
|
||||
me.layout.layout();
|
||||
me.setTitle(title);
|
||||
},
|
||||
single: true
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the CSS class that provides the icon image for this header. This method will replace any existing
|
||||
* icon class if one has already been set.
|
||||
* @param {String} cls The new CSS class name
|
||||
*/
|
||||
setIconCls: function(cls) {
|
||||
var me = this,
|
||||
isEmpty = !cls || !cls.length,
|
||||
iconCmp = me.iconCmp,
|
||||
el;
|
||||
|
||||
me.iconCls = cls;
|
||||
if (!me.iconCmp && !isEmpty) {
|
||||
me.initIconCmp();
|
||||
me.insert(0, me.iconCmp);
|
||||
} else if (iconCmp) {
|
||||
if (isEmpty) {
|
||||
me.iconCmp.destroy();
|
||||
} else {
|
||||
el = iconCmp.iconEl;
|
||||
el.removeCls(iconCmp.iconCls);
|
||||
el.addCls(cls);
|
||||
iconCmp.iconCls = cls;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Add a tool to the header
|
||||
* @param {Object} tool
|
||||
*/
|
||||
addTool: function(tool) {
|
||||
this.tools.push(this.add(tool));
|
||||
},
|
||||
|
||||
/**
|
||||
* @private
|
||||
* Set up the tools.<tool type> link in the owning Panel.
|
||||
* Bind the tool to its owning Panel.
|
||||
* @param component
|
||||
* @param index
|
||||
*/
|
||||
onAdd: function(component, index) {
|
||||
this.callParent([arguments]);
|
||||
if (component instanceof Ext.panel.Tool) {
|
||||
component.bindTo(this.ownerCt);
|
||||
this.tools[component.type] = component;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
1620
OfficeWeb/3rdparty/extjs/src/panel/Panel.js
vendored
Normal file
1620
OfficeWeb/3rdparty/extjs/src/panel/Panel.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
134
OfficeWeb/3rdparty/extjs/src/panel/Proxy.js
vendored
Normal file
134
OfficeWeb/3rdparty/extjs/src/panel/Proxy.js
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
|
||||
This file is part of Ext JS 4
|
||||
|
||||
Copyright (c) 2011 Sencha Inc
|
||||
|
||||
Contact: http://www.sencha.com/contact
|
||||
|
||||
GNU General Public License Usage
|
||||
This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
|
||||
|
||||
*/
|
||||
/**
|
||||
* A custom drag proxy implementation specific to {@link Ext.panel.Panel}s. This class
|
||||
* is primarily used internally for the Panel's drag drop implementation, and
|
||||
* should never need to be created directly.
|
||||
* @private
|
||||
*/
|
||||
Ext.define('Ext.panel.Proxy', {
|
||||
|
||||
alternateClassName: 'Ext.dd.PanelProxy',
|
||||
|
||||
/**
|
||||
* Creates new panel proxy.
|
||||
* @param {Ext.panel.Panel} panel The {@link Ext.panel.Panel} to proxy for
|
||||
* @param {Object} [config] Config object
|
||||
*/
|
||||
constructor: function(panel, config){
|
||||
/**
|
||||
* @property panel
|
||||
* @type Ext.panel.Panel
|
||||
*/
|
||||
this.panel = panel;
|
||||
this.id = this.panel.id +'-ddproxy';
|
||||
Ext.apply(this, config);
|
||||
},
|
||||
|
||||
/**
|
||||
* @cfg {Boolean} insertProxy
|
||||
* True to insert a placeholder proxy element while dragging the panel, false to drag with no proxy.
|
||||
* Most Panels are not absolute positioned and therefore we need to reserve this space.
|
||||
*/
|
||||
insertProxy: true,
|
||||
|
||||
// private overrides
|
||||
setStatus: Ext.emptyFn,
|
||||
reset: Ext.emptyFn,
|
||||
update: Ext.emptyFn,
|
||||
stop: Ext.emptyFn,
|
||||
sync: Ext.emptyFn,
|
||||
|
||||
/**
|
||||
* Gets the proxy's element
|
||||
* @return {Ext.Element} The proxy's element
|
||||
*/
|
||||
getEl: function(){
|
||||
return this.ghost.el;
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the proxy's ghost Panel
|
||||
* @return {Ext.panel.Panel} The proxy's ghost Panel
|
||||
*/
|
||||
getGhost: function(){
|
||||
return this.ghost;
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the proxy element. This is the element that represents where the
|
||||
* Panel was before we started the drag operation.
|
||||
* @return {Ext.Element} The proxy's element
|
||||
*/
|
||||
getProxy: function(){
|
||||
return this.proxy;
|
||||
},
|
||||
|
||||
/**
|
||||
* Hides the proxy
|
||||
*/
|
||||
hide : function(){
|
||||
if (this.ghost) {
|
||||
if (this.proxy) {
|
||||
this.proxy.remove();
|
||||
delete this.proxy;
|
||||
}
|
||||
|
||||
// Unghost the Panel, do not move the Panel to where the ghost was
|
||||
this.panel.unghost(null, false);
|
||||
delete this.ghost;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Shows the proxy
|
||||
*/
|
||||
show: function(){
|
||||
if (!this.ghost) {
|
||||
var panelSize = this.panel.getSize();
|
||||
this.panel.el.setVisibilityMode(Ext.Element.DISPLAY);
|
||||
this.ghost = this.panel.ghost();
|
||||
if (this.insertProxy) {
|
||||
// bc Panels aren't absolute positioned we need to take up the space
|
||||
// of where the panel previously was
|
||||
this.proxy = this.panel.el.insertSibling({cls: Ext.baseCSSPrefix + 'panel-dd-spacer'});
|
||||
this.proxy.setSize(panelSize);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// private
|
||||
repair: function(xy, callback, scope) {
|
||||
this.hide();
|
||||
if (typeof callback == "function") {
|
||||
callback.call(scope || this);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Moves the proxy to a different position in the DOM. This is typically
|
||||
* called while dragging the Panel to keep the proxy sync'd to the Panel's
|
||||
* location.
|
||||
* @param {HTMLElement} parentNode The proxy's parent DOM node
|
||||
* @param {HTMLElement} [before] The sibling node before which the
|
||||
* proxy should be inserted (defaults to the parent's last child if not
|
||||
* specified)
|
||||
*/
|
||||
moveProxy : function(parentNode, before){
|
||||
if (this.proxy) {
|
||||
parentNode.insertBefore(this.proxy.dom, before);
|
||||
}
|
||||
}
|
||||
});
|
||||
1286
OfficeWeb/3rdparty/extjs/src/panel/Table.js
vendored
Normal file
1286
OfficeWeb/3rdparty/extjs/src/panel/Table.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
304
OfficeWeb/3rdparty/extjs/src/panel/Tool.js
vendored
Normal file
304
OfficeWeb/3rdparty/extjs/src/panel/Tool.js
vendored
Normal file
@@ -0,0 +1,304 @@
|
||||
/*
|
||||
|
||||
This file is part of Ext JS 4
|
||||
|
||||
Copyright (c) 2011 Sencha Inc
|
||||
|
||||
Contact: http://www.sencha.com/contact
|
||||
|
||||
GNU General Public License Usage
|
||||
This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
|
||||
|
||||
*/
|
||||
/**
|
||||
* This class is used to display small visual icons in the header of a panel. There are a set of
|
||||
* 25 icons that can be specified by using the {@link #type} config. The {@link #handler} config
|
||||
* can be used to provide a function that will respond to any click events. In general, this class
|
||||
* will not be instantiated directly, rather it will be created by specifying the {@link Ext.panel.Panel#tools}
|
||||
* configuration on the Panel itself.
|
||||
*
|
||||
* @example
|
||||
* Ext.create('Ext.panel.Panel', {
|
||||
* width: 200,
|
||||
* height: 200,
|
||||
* renderTo: document.body,
|
||||
* title: 'A Panel',
|
||||
* tools: [{
|
||||
* type: 'help',
|
||||
* handler: function(){
|
||||
* // show help here
|
||||
* }
|
||||
* }, {
|
||||
* itemId: 'refresh',
|
||||
* type: 'refresh',
|
||||
* hidden: true,
|
||||
* handler: function(){
|
||||
* // do refresh
|
||||
* }
|
||||
* }, {
|
||||
* type: 'search',
|
||||
* handler: function(event, target, owner, tool){
|
||||
* // do search
|
||||
* owner.child('#refresh').show();
|
||||
* }
|
||||
* }]
|
||||
* });
|
||||
*/
|
||||
Ext.define('Ext.panel.Tool', {
|
||||
extend: 'Ext.Component',
|
||||
requires: ['Ext.tip.QuickTipManager'],
|
||||
alias: 'widget.tool',
|
||||
|
||||
baseCls: Ext.baseCSSPrefix + 'tool',
|
||||
disabledCls: Ext.baseCSSPrefix + 'tool-disabled',
|
||||
toolPressedCls: Ext.baseCSSPrefix + 'tool-pressed',
|
||||
toolOverCls: Ext.baseCSSPrefix + 'tool-over',
|
||||
ariaRole: 'button',
|
||||
renderTpl: ['<img id="{id}-toolEl" src="{blank}" class="{baseCls}-{type}" role="presentation"/>'],
|
||||
|
||||
/**
|
||||
* @cfg {Function} handler
|
||||
* A function to execute when the tool is clicked. Arguments passed are:
|
||||
*
|
||||
* - **event** : Ext.EventObject - The click event.
|
||||
* - **toolEl** : Ext.Element - The tool Element.
|
||||
* - **owner** : Ext.panel.Header - The host panel header.
|
||||
* - **tool** : Ext.panel.Tool - The tool object
|
||||
*/
|
||||
|
||||
/**
|
||||
* @cfg {Object} scope
|
||||
* The scope to execute the {@link #handler} function. Defaults to the tool.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @cfg {String} type
|
||||
* The type of tool to render. The following types are available:
|
||||
*
|
||||
* - <span class="x-tool"><img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="x-tool-close"></span> close
|
||||
* - <span class="x-tool"><img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="x-tool-minimize"></span> minimize
|
||||
* - <span class="x-tool"><img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="x-tool-maximize"></span> maximize
|
||||
* - <span class="x-tool"><img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="x-tool-restore"></span> restore
|
||||
* - <span class="x-tool"><img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="x-tool-toggle"></span> toggle
|
||||
* - <span class="x-tool"><img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="x-tool-gear"></span> gear
|
||||
* - <span class="x-tool"><img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="x-tool-prev"></span> prev
|
||||
* - <span class="x-tool"><img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="x-tool-next"></span> next
|
||||
* - <span class="x-tool"><img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="x-tool-pin"></span> pin
|
||||
* - <span class="x-tool"><img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="x-tool-unpin"></span> unpin
|
||||
* - <span class="x-tool"><img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="x-tool-right"></span> right
|
||||
* - <span class="x-tool"><img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="x-tool-left"></span> left
|
||||
* - <span class="x-tool"><img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="x-tool-down"></span> down
|
||||
* - <span class="x-tool"><img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="x-tool-up"></span> up
|
||||
* - <span class="x-tool"><img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="x-tool-refresh"></span> refresh
|
||||
* - <span class="x-tool"><img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="x-tool-plus"></span> plus
|
||||
* - <span class="x-tool"><img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="x-tool-minus"></span> minus
|
||||
* - <span class="x-tool"><img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="x-tool-search"></span> search
|
||||
* - <span class="x-tool"><img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="x-tool-save"></span> save
|
||||
* - <span class="x-tool"><img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="x-tool-help"></span> help
|
||||
* - <span class="x-tool"><img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="x-tool-print"></span> print
|
||||
* - <span class="x-tool"><img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="x-tool-expand"></span> expand
|
||||
* - <span class="x-tool"><img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="x-tool-collapse"></span> collapse
|
||||
*/
|
||||
|
||||
/**
|
||||
* @cfg {String/Object} tooltip
|
||||
* The tooltip for the tool - can be a string to be used as innerHTML (html tags are accepted) or QuickTips config
|
||||
* object
|
||||
*/
|
||||
|
||||
/**
|
||||
* @cfg {String} tooltipType
|
||||
* The type of tooltip to use. Either 'qtip' (default) for QuickTips or 'title' for title attribute.
|
||||
*/
|
||||
tooltipType: 'qtip',
|
||||
|
||||
/**
|
||||
* @cfg {Boolean} stopEvent
|
||||
* Specify as false to allow click event to propagate.
|
||||
*/
|
||||
stopEvent: true,
|
||||
|
||||
initComponent: function() {
|
||||
var me = this;
|
||||
me.addEvents(
|
||||
/**
|
||||
* @event click
|
||||
* Fires when the tool is clicked
|
||||
* @param {Ext.panel.Tool} this
|
||||
* @param {Ext.EventObject} e The event object
|
||||
*/
|
||||
'click'
|
||||
);
|
||||
|
||||
//<debug>
|
||||
var types = [
|
||||
'close',
|
||||
'collapse',
|
||||
'down',
|
||||
'expand',
|
||||
'gear',
|
||||
'help',
|
||||
'left',
|
||||
'maximize',
|
||||
'minimize',
|
||||
'minus',
|
||||
'move',
|
||||
'next',
|
||||
'pin',
|
||||
'plus',
|
||||
'prev',
|
||||
'print',
|
||||
'refresh',
|
||||
'resize',
|
||||
'restore',
|
||||
'right',
|
||||
'save',
|
||||
'search',
|
||||
'toggle',
|
||||
'unpin',
|
||||
'up'
|
||||
];
|
||||
|
||||
if (me.id && Ext.Array.indexOf(types, me.id) > -1 && Ext.global.console) {
|
||||
Ext.global.console.warn('When specifying a tool you should use the type option, the id can conflict now that tool is a Component');
|
||||
}
|
||||
//</debug>
|
||||
|
||||
me.type = me.type || me.id;
|
||||
|
||||
Ext.applyIf(me.renderData, {
|
||||
baseCls: me.baseCls,
|
||||
blank: Ext.BLANK_IMAGE_URL,
|
||||
type: me.type
|
||||
});
|
||||
|
||||
me.addChildEls('toolEl');
|
||||
|
||||
// alias qtip, should use tooltip since it's what we have in the docs
|
||||
me.tooltip = me.tooltip || me.qtip;
|
||||
me.callParent();
|
||||
},
|
||||
|
||||
// inherit docs
|
||||
afterRender: function() {
|
||||
var me = this,
|
||||
attr;
|
||||
|
||||
me.callParent(arguments);
|
||||
if (me.tooltip) {
|
||||
if (Ext.isObject(me.tooltip)) {
|
||||
Ext.tip.QuickTipManager.register(Ext.apply({
|
||||
target: me.id
|
||||
}, me.tooltip));
|
||||
}
|
||||
else {
|
||||
attr = me.tooltipType == 'qtip' ? 'data-qtip' : 'title';
|
||||
me.toolEl.dom.setAttribute(attr, me.tooltip);
|
||||
}
|
||||
}
|
||||
|
||||
me.mon(me.toolEl, {
|
||||
click: me.onClick,
|
||||
mousedown: me.onMouseDown,
|
||||
mouseover: me.onMouseOver,
|
||||
mouseout: me.onMouseOut,
|
||||
scope: me
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the type of the tool. Allows the icon to be changed.
|
||||
* @param {String} type The new type. See the {@link #type} config.
|
||||
* @return {Ext.panel.Tool} this
|
||||
*/
|
||||
setType: function(type) {
|
||||
var me = this;
|
||||
|
||||
me.type = type;
|
||||
if (me.rendered) {
|
||||
me.toolEl.dom.className = me.baseCls + '-' + type;
|
||||
}
|
||||
return me;
|
||||
},
|
||||
|
||||
/**
|
||||
* Binds this tool to a component.
|
||||
* @private
|
||||
* @param {Ext.Component} component The component
|
||||
*/
|
||||
bindTo: function(component) {
|
||||
this.owner = component;
|
||||
},
|
||||
|
||||
/**
|
||||
* Called when the tool element is clicked
|
||||
* @private
|
||||
* @param {Ext.EventObject} e
|
||||
* @param {HTMLElement} target The target element
|
||||
*/
|
||||
onClick: function(e, target) {
|
||||
var me = this,
|
||||
owner;
|
||||
|
||||
if (me.disabled) {
|
||||
return false;
|
||||
}
|
||||
owner = me.owner || me.ownerCt;
|
||||
|
||||
//remove the pressed + over class
|
||||
me.el.removeCls(me.toolPressedCls);
|
||||
me.el.removeCls(me.toolOverCls);
|
||||
|
||||
if (me.stopEvent !== false) {
|
||||
e.stopEvent();
|
||||
}
|
||||
|
||||
Ext.callback(me.handler, me.scope || me, [e, target, owner, me]);
|
||||
me.fireEvent('click', me, e);
|
||||
return true;
|
||||
},
|
||||
|
||||
// inherit docs
|
||||
onDestroy: function(){
|
||||
if (Ext.isObject(this.tooltip)) {
|
||||
Ext.tip.QuickTipManager.unregister(this.id);
|
||||
}
|
||||
this.callParent();
|
||||
},
|
||||
|
||||
/**
|
||||
* Called when the user presses their mouse button down on a tool
|
||||
* Adds the press class ({@link #toolPressedCls})
|
||||
* @private
|
||||
*/
|
||||
onMouseDown: function() {
|
||||
if (this.disabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.el.addCls(this.toolPressedCls);
|
||||
},
|
||||
|
||||
/**
|
||||
* Called when the user rolls over a tool
|
||||
* Adds the over class ({@link #toolOverCls})
|
||||
* @private
|
||||
*/
|
||||
onMouseOver: function() {
|
||||
if (this.disabled) {
|
||||
return false;
|
||||
}
|
||||
this.el.addCls(this.toolOverCls);
|
||||
},
|
||||
|
||||
/**
|
||||
* Called when the user rolls out from a tool.
|
||||
* Removes the over class ({@link #toolOverCls})
|
||||
* @private
|
||||
*/
|
||||
onMouseOut: function() {
|
||||
this.el.removeCls(this.toolOverCls);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user