Skip to content

EspoCRM – Open Source CRM Application

TS fixes

Yurii8c6d7e6feda9
diff --git a/client/src/views/record/base.ts b/client/src/views/record/base.ts
index 3c66ba0310..631c01624d 100644
--- a/client/src/views/record/base.ts
+++ b/client/src/views/record/base.ts
@@ -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);
}
diff --git a/client/src/views/record/list-base.ts b/client/src/views/record/list-base.ts
index 851d4bb3b6..c7e70c9948 100644
--- a/client/src/views/record/list-base.ts
+++ b/client/src/views/record/list-base.ts
@@ -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