This commit is contained in:
Yurii
2026-05-07 14:59:09 +03:00
parent 54b6d42502
commit 8c6d7e6fed
2 changed files with 24 additions and 4 deletions

View File

@@ -69,6 +69,7 @@ export interface BaseRecordViewSchema {
}
export interface BaseRecordViewOptions {
model: Model;
recordHelper?: ViewRecordHelper;
}
@@ -174,7 +175,7 @@ class BaseRecordView<S extends BaseRecordViewSchema = BaseRecordViewSchema> exte
options: S['options']
constructor(options: {model: S['model']} & S['options']) {
constructor(options: S['options'] & {model: S['model']}) {
super(options);
}

View File

@@ -42,7 +42,6 @@ import Ui from 'ui';
import type Collection from 'collection';
import type {WhereItem} from 'collection';
import type Model from 'model';
import {BaseRecordViewSchema} from 'views/record/base';
import Ajax from 'ajax';
import type MassUpdateModalView from 'views/modals/mass-update';
@@ -54,6 +53,10 @@ import type {Button, DropdownItem, MassActionItem} from 'views/record/list';
* @internal
*/
export interface ListBaseRecordViewOptions<TLayout = any> {
/**
* A collection.
*/
collection?: Collection;
/**
* A layout.
*/
@@ -217,9 +220,21 @@ export interface ListBaseRecordViewOptions<TLayout = any> {
/**
* @internal
*/
export interface ListBaseRecordViewSchema<TLayout> extends BaseRecordViewSchema {
export interface ListBaseRecordViewSchema<TLayout> {
/**
* A collection.
*/
collection: Collection;
/**
* Options.
*/
options: ListBaseRecordViewOptions<TLayout>;
/**
* A model for related lists.
*
* @internal
*/
model?: Model;
}
/**
@@ -230,6 +245,10 @@ abstract class ListBaseRecordView<
S extends ListBaseRecordViewSchema<TLayout>,
> extends View<S> {
constructor(options: S['options'] & {collection: S['collection']}) {
super(options);
}
protected template: string = 'record/list'
/**
@@ -1627,7 +1646,7 @@ abstract class ListBaseRecordView<
Ui.success(this.translate('Unlinked'));
this.collection.fetch();
this.model.trigger('after:unrelate');
(this.model ?? this.collection.parentModel)?.trigger('after:unrelate');
}
// noinspection JSUnusedGlobalSymbols