[IMP] web: expose control panel component and context
This commit exposes the ControlPanel component aswell as its context in order to make it easier to extend. TaskId-2675382
This commit is contained in:
@@ -1173,10 +1173,10 @@ var FieldX2Many = AbstractField.extend(WidgetAdapterMixin, {
|
||||
const _super = this._super.bind(this);
|
||||
if (this.view) {
|
||||
this._renderButtons();
|
||||
this._controlPanelWrapper = new ComponentWrapper(this, ControlPanelX2Many, {
|
||||
cp_content: { $buttons: this.$buttons },
|
||||
pager: this.pagingState,
|
||||
});
|
||||
this._controlPanelWrapper = new ComponentWrapper(this,
|
||||
this._getControlPanelComponent(),
|
||||
this._getControlPanelContext(),
|
||||
);
|
||||
await this._controlPanelWrapper.mount(this.el, { position: 'first-child' });
|
||||
}
|
||||
return _super(...arguments);
|
||||
@@ -1429,6 +1429,25 @@ var FieldX2Many = AbstractField.extend(WidgetAdapterMixin, {
|
||||
return KanbanRenderer;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Provides a way to override the control panel component to be used.
|
||||
*
|
||||
* @private
|
||||
* @returns {Component} The component to use.
|
||||
*/
|
||||
_getControlPanelComponent: function () {
|
||||
return ControlPanelX2Many;
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @returns {Object} The context that will be passed to the control panel.
|
||||
*/
|
||||
_getControlPanelContext: function () {
|
||||
return {
|
||||
cp_content: { $buttons: this.$buttons },
|
||||
pager: this.pagingState,
|
||||
};
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @returns {boolean} true iff the list should contain a 'create' line.
|
||||
|
||||
Reference in New Issue
Block a user