Ext js 7 现代 panel.Resizer 拆分器配置
Ext js 7 modern panel.Resizer Splitter Config
我有这样的 panel.Resizer 布局:
https://examples.sencha.com/extjs/7.3.0/examples/kitchensink/?modern#panel-splitresize
现在我正在尝试配置分离器,我找到了这个经典文档:
https://docs.sencha.com/extjs/7.0.0/classic/Ext.resizer.Splitter.html#cfg-collapseOnDblClick
但我在现代文档中找不到 collapseOnDblClick 或 collapsible。有没有一种方法可以实现类似的行为,以便合并调整器和折叠器?
以及如何更改调整大小(宽度)?
您可以覆盖 'Ext.panel.Resizer' 以添加此功能。类似于:
Ext.define('override.panel.Resizer', {
override: 'Ext.panel.Resizer',
privates: {
onTargetCollapse: function () {
var me = this,
map = me.edgeMap,
key;
me.disabled = true;
me.dragListeners = Ext.destroy(me.dragListeners);
me.setupCollapsedDragListeners();
for (key in map) {
map[key].addCls(me.disabledCls);
}
},
onTargetExpand: function () {
var me = this,
map = me.edgeMap,
key;
me.disabled = false;
me.setupDragListeners();
for (key in map) {
map[key].removeCls(me.disabledCls);
}
},
setupDragListeners: function () {
var me = this,
delegate = me.edgeDelegateSelector;
me.dragListeners = me.getTarget().element.on({
scope: me,
destroyable: true,
delegate: delegate,
dragstart: {
// Higher priority so that we run before any draggable component handlers.
priority: 1000,
delegate: delegate,
fn: 'handleDragStart'
},
drag: 'handleDrag',
dragend: 'handleDragEnd',
dragcancel: 'handleDragCancel',
touchstart: 'handleTouchStart',
doubletap: 'handleDoubleTap'
});
},
setupCollapsedDragListeners: function () {
var me = this,
delegate = me.edgeDelegateSelector;
me.dragListeners = me.getTarget().element.on({
scope: me,
destroyable: true,
delegate: delegate,
doubletap: 'handleDoubleTap'
});
}
},
handleDoubleTap: function () {
if (!this.getTarget()._collapsible) {
return;
}
if (this.getTarget().collapsed) {
this.getTarget().expand();
} else {
this.getTarget().collapse();
}
}
});
Ext.define('KitchenSink.view.panels.SplitResizable', {
extend: 'Ext.container.Container',
xtype: 'panel-splitresize',
requires: [
'Ext.panel.Resizer',
'Ext.Toolbar'
],
layout: {
type: 'vbox',
align: 'stretch'
},
defaultType: 'panel',
items: [{
title: 'Dock Left',
docked: 'left',
minWidth: 200,
collapsible: 'left',
resizable: {
split: true,
edges: 'east'
},
html: "Content"
}, {
title: 'Dock Right',
docked: 'right',
minWidth: 200,
resizable: {
split: true,
edges: 'west'
}
}, {
title: 'Dock Top',
docked: 'top',
minHeight: 150,
resizable: {
split: true,
edges: 'south'
}
}, {
title: 'Unresizable region',
flex: 1
}, {
title: 'Dock Bottom',
docked: 'bottom',
minHeight: 150,
resizable: {
split: true,
edges: 'north'
}
}]
});
Ext.application({
name: 'Fiddle',
launch: function () {
Ext.create('KitchenSink.view.panels.SplitResizable', {
renderTo: Ext.getBody(),
fullscreen: true
})
}
});
我有这样的 panel.Resizer 布局:
https://examples.sencha.com/extjs/7.3.0/examples/kitchensink/?modern#panel-splitresize
现在我正在尝试配置分离器,我找到了这个经典文档: https://docs.sencha.com/extjs/7.0.0/classic/Ext.resizer.Splitter.html#cfg-collapseOnDblClick
但我在现代文档中找不到 collapseOnDblClick 或 collapsible。有没有一种方法可以实现类似的行为,以便合并调整器和折叠器?
以及如何更改调整大小(宽度)?
您可以覆盖 'Ext.panel.Resizer' 以添加此功能。类似于:
Ext.define('override.panel.Resizer', {
override: 'Ext.panel.Resizer',
privates: {
onTargetCollapse: function () {
var me = this,
map = me.edgeMap,
key;
me.disabled = true;
me.dragListeners = Ext.destroy(me.dragListeners);
me.setupCollapsedDragListeners();
for (key in map) {
map[key].addCls(me.disabledCls);
}
},
onTargetExpand: function () {
var me = this,
map = me.edgeMap,
key;
me.disabled = false;
me.setupDragListeners();
for (key in map) {
map[key].removeCls(me.disabledCls);
}
},
setupDragListeners: function () {
var me = this,
delegate = me.edgeDelegateSelector;
me.dragListeners = me.getTarget().element.on({
scope: me,
destroyable: true,
delegate: delegate,
dragstart: {
// Higher priority so that we run before any draggable component handlers.
priority: 1000,
delegate: delegate,
fn: 'handleDragStart'
},
drag: 'handleDrag',
dragend: 'handleDragEnd',
dragcancel: 'handleDragCancel',
touchstart: 'handleTouchStart',
doubletap: 'handleDoubleTap'
});
},
setupCollapsedDragListeners: function () {
var me = this,
delegate = me.edgeDelegateSelector;
me.dragListeners = me.getTarget().element.on({
scope: me,
destroyable: true,
delegate: delegate,
doubletap: 'handleDoubleTap'
});
}
},
handleDoubleTap: function () {
if (!this.getTarget()._collapsible) {
return;
}
if (this.getTarget().collapsed) {
this.getTarget().expand();
} else {
this.getTarget().collapse();
}
}
});
Ext.define('KitchenSink.view.panels.SplitResizable', {
extend: 'Ext.container.Container',
xtype: 'panel-splitresize',
requires: [
'Ext.panel.Resizer',
'Ext.Toolbar'
],
layout: {
type: 'vbox',
align: 'stretch'
},
defaultType: 'panel',
items: [{
title: 'Dock Left',
docked: 'left',
minWidth: 200,
collapsible: 'left',
resizable: {
split: true,
edges: 'east'
},
html: "Content"
}, {
title: 'Dock Right',
docked: 'right',
minWidth: 200,
resizable: {
split: true,
edges: 'west'
}
}, {
title: 'Dock Top',
docked: 'top',
minHeight: 150,
resizable: {
split: true,
edges: 'south'
}
}, {
title: 'Unresizable region',
flex: 1
}, {
title: 'Dock Bottom',
docked: 'bottom',
minHeight: 150,
resizable: {
split: true,
edges: 'north'
}
}]
});
Ext.application({
name: 'Fiddle',
launch: function () {
Ext.create('KitchenSink.view.panels.SplitResizable', {
renderTo: Ext.getBody(),
fullscreen: true
})
}
});