This commit is contained in:
Yuri Kuznetsov
2022-06-14 22:53:06 +03:00
parent 9e21dc43e9
commit 7de4a806a2
7 changed files with 75 additions and 68 deletions

View File

@@ -2,6 +2,7 @@
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="DuplicatedCode" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="JSIgnoredPromiseFromCall" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="PhpDocMissingThrowsInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="PhpDocSignatureIsNotCompleteInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="PhpMissingFieldTypeInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" />

View File

@@ -29,7 +29,11 @@
define('collection-factory', [], function () {
/**
* @class Espo.CollectionFactory
* A collection factory.
*
* @class
* @name Class
* @memberOf module:collection-factory
*/
var CollectionFactory = function (loader, modelFactory, config) {
this.loader = loader;
@@ -37,7 +41,7 @@
this.config = config;
};
_.extend(CollectionFactory.prototype, /** @lends Espo.CollectionFactory.prototype */ {
_.extend(CollectionFactory.prototype, /** @lends module:collection-factory.Class# */ {
/**
* @private
@@ -57,10 +61,10 @@
/**
* Create a collection.
*
* @param {string} name An entity Type.
* @param {string} name An entity type.
* @param {Function} [callback] Deprecated.
* @param {Object} [context] Deprecated.
* @returns {Promise<Espo.Collection>}
* @returns {Promise<module:collection.Class>}
*/
create: function (name, callback, context) {
return new Promise(resolve => {

View File

@@ -55,8 +55,8 @@ define('collection', [], function () {
*/
/**
* Remove a model or models. Fires a `remove` event for each model, and a single `update` event afterwards,
* unless `{silent: true}`.
* Remove a model or models. Fires a `remove` event for each model, and a single `update` event
* afterwards, unless `{silent: true}`.
*
* @function remove
* @memberof Backbone.Collection.prototype
@@ -82,18 +82,20 @@ define('collection', [], function () {
*/
/**
* @class Espo.Collection
* @class
* @name Class
* @memberOf module:collection
* @extends Backbone.Collection.prototype
* @mixes Backbone.Events
*/
var Collection = Backbone.Collection.extend(/** @lends Espo.Collection.prototype */ {
return Backbone.Collection.extend(/** @lends module:collection.Class# */ {
/**
* An entity type.
*
* @name entityType
* @type {string}
* @memberof Espo.Collection.prototype
* @memberof module:collection.Class#
*/
/**
@@ -101,15 +103,15 @@ define('collection', [], function () {
*
* @name length
* @type {number}
* @memberof Espo.Collection.prototype
* @memberof module:collection.Class#
*/
/**
* Models.
*
* @name length
* @type {Espo.Model[]}
* @memberof Espo.Collection.prototype
* @type {module:model.Class[]}
* @memberof module:collection.Class#
*/
/**
@@ -180,7 +182,7 @@ define('collection', [], function () {
/**
* @protected
* @param {Espo.Model[]} models
* @param {module:model.Class[]} models
* @param {Object} options
*/
initialize: function (models, options) {
@@ -213,7 +215,7 @@ define('collection', [], function () {
/**
* Reset.
*
* @param {Espo.Model[]} models
* @param {module:model.Class[]} models
* @param {Object} options
*/
reset: function (models, options) {
@@ -319,7 +321,7 @@ define('collection', [], function () {
/**
* Fetches from the backend.
*
* @param {Object} options Options.
* @param {Object} [options] Options.
* @returns {Promise}
*/
fetch: function (options) {
@@ -429,6 +431,4 @@ define('collection', [], function () {
}
},
});
return Collection;
});

View File

@@ -29,15 +29,17 @@
define('controller', [], function () {
/**
* @callback Espo.Controller~viewCallback
* @param {Espo.View} view A view.
* @callback module:controller.Class~viewCallback
* @param {module:view.Class} view A view.
*/
/**
* Controller. Views, Models and Collections are created here.
* A controller. To be extended.
*
* @class Espo.Controller
* @class
* @name Class
* @mixes Backbone.Events
* @memberOf module:controller
*
* @param {Object} params
* @param {Object} injections
@@ -70,7 +72,7 @@ define('controller', [], function () {
this.set('masterRendered', false);
};
_.extend(Controller.prototype, /** @lends Espo.Controller.prototype */ {
_.extend(Controller.prototype, /** @lends module:controller.Class# */ {
/**
* A default action.
@@ -105,19 +107,11 @@ define('controller', [], function () {
/**
* A model factory.
*
* @type {Espo.ModelFactory}
* @type {module:model-factory.Class}
* @protected
*/
modelFactory: null,
/**
* A controller factory.
*
* @type {Espo.ControllerFactory}
* @protected
*/
controllerFactory: null,
/**
* Initialize.
*
@@ -129,7 +123,7 @@ define('controller', [], function () {
* Set the router.
*
* @internal
* @param {Espo.Router} router
* @param {module:router.Class} router
*/
setRouter: function (router) {
this._router = router;
@@ -137,7 +131,7 @@ define('controller', [], function () {
/**
* @protected
* @returns {Espo.Models.Settings}
* @returns {modules:models/settings.Class}
*/
getConfig: function () {
return this._settings;
@@ -145,7 +139,7 @@ define('controller', [], function () {
/**
* @protected
* @returns {Espo.Models.User}
* @returns {modules:models/user.Class}
*/
getUser: function () {
return this._user;
@@ -153,7 +147,7 @@ define('controller', [], function () {
/**
* @protected
* @returns {Espo.Models.Preferences}
* @returns {modules:models/preferences.Class}
*/
getPreferences: function () {
return this._preferences;
@@ -161,7 +155,7 @@ define('controller', [], function () {
/**
* @protected
* @returns {Espo.Acl}
* @returns {modules:acl.Class}
*/
getAcl: function () {
return this._acl;
@@ -169,7 +163,7 @@ define('controller', [], function () {
/**
* @protected
* @returns {Espo.Cache}
* @returns {modules:cache.Class}
*/
getCache: function () {
return this._cache;
@@ -177,7 +171,7 @@ define('controller', [], function () {
/**
* @protected
* @returns {Espo.Router}
* @returns {modules:router.Class}
*/
getRouter: function () {
return this._router;
@@ -185,7 +179,7 @@ define('controller', [], function () {
/**
* @protected
* @returns {Espo.Storage}
* @returns {modules:storage.Class}
*/
getStorage: function () {
return this._storage;
@@ -193,7 +187,7 @@ define('controller', [], function () {
/**
* @protected
* @returns {Espo.Metadata}
* @returns {modules:metadata.Class}
*/
getMetadata: function () {
return this._metadata;
@@ -201,7 +195,7 @@ define('controller', [], function () {
/**
* @protected
* @returns {Espo.DateTime}
* @returns {modules:date-time.Class}
*/
getDateTime: function () {
return this._dateTime;
@@ -211,7 +205,7 @@ define('controller', [], function () {
* Get a parameter of all controllers.
*
* @param {string} key A key.
* @return {*} Null if doesn't exist.
* @return {*} Null if a key doesn't exist.
*/
get: function (key) {
if (key in this.params) {
@@ -254,7 +248,7 @@ define('controller', [], function () {
* Get a stored main view.
*
* @param {string} key A key.
* @returns {Espo.View|null}
* @returns {module:view.Class|null}
*/
getStoredMainView: function (key) {
return this.get('storedMainView-' + key);
@@ -287,7 +281,7 @@ define('controller', [], function () {
* Store a main view.
*
* @param {string} key A key.
* @param {Espo.View} view A view.
* @param {module:view.Class} view A view.
*/
storeMainView: function (key, view) {
this.set('storedMainView-' + key, view);
@@ -402,7 +396,7 @@ define('controller', [], function () {
/**
* Create a master view, render if not already rendered.
*
* @param {Espo.Controller~viewCallback} callback A callback with a created master view.
* @param {module:controller.Class~viewCallback} callback A callback with a created master view.
*/
master: function (callback) {
let entire = this.get('entire');
@@ -444,7 +438,7 @@ define('controller', [], function () {
* Create a main view in the master.
* @param {String} view A view name.
* @param {Object} options Options for view.
* @param {Espo.Controller~viewCallback} [callback] A callback with a created view.
* @param {module:controller.Class~viewCallback} [callback] A callback with a created view.
* @param {boolean} [useStored] Use a stored view if available.
* @param {boolean} [storedKey] A stored view key.
*/
@@ -584,7 +578,7 @@ define('controller', [], function () {
*
* @param {String} view A view name.
* @param {Object} options Options for a view.
* @param {Espo.Controller~viewCallback} [callback] A callback with a created view.
* @param {module:controller.Class~viewCallback} [callback] A callback with a created view.
*/
entire: function (view, options, callback) {
let master = this.get('master');

View File

@@ -29,7 +29,11 @@
define('model-factory', [], function () {
/**
* @class Espo.ModelFactory
* A model factory.
*
* @class
* @name Class
* @memberOf module:model-factory
*/
let ModelFactory = function (loader, metadata, user) {
this.loader = loader;
@@ -39,7 +43,7 @@ define('model-factory', [], function () {
this.seeds = {};
};
_.extend(ModelFactory.prototype, /** @lends Espo.ModelFactory.prototype */ {
_.extend(ModelFactory.prototype, /** @lends module:model-factory.Class# */ {
/**
* @private
@@ -72,7 +76,7 @@ define('model-factory', [], function () {
* @param {string} name An entity type.
* @param {Function} [callback] Deprecated.
* @param {Object} [context] Deprecated.
* @returns {Promise<Espo.Model>}
* @returns {Promise<module:model.Class>}
*/
create: function (name, callback, context) {
return new Promise(resolve => {

View File

@@ -61,26 +61,30 @@ define('model', [], function () {
/**
* When attributes have changed.
*
* @event Espo.Model#change
* @param {Espo.Model} model A model.
* @event module:model.Class#change
* @param {module:model.Class} model A model.
* @param {Object} o Options.
*/
/**
* On sync with backend.
*
* @event Espo.Model#sync
* @param {Espo.Model} model A model.
* @event module:model.Class#sync
* @param {module:model.Class} model A model.
* @param {Object} response Response from backend.
* @param {Object} o Options.
*/
/**
* @class Espo.Model
* A model.
*
* @class
* @name Class
* @extends Backbone.Model
* @mixes Backbone.Events
* @memberOf module:model
*/
let Model = Dep.extend(/** @lends Espo.Model.prototype */{
return Dep.extend(/** @lends module:model.Class.prototype */{
/**
* An entity type.
@@ -88,7 +92,7 @@ define('model', [], function () {
* @name entityType
* @property {string}
* @public
* @memberof Espo.Model.prototype
* @memberof module:model.Class.prototype
*/
/**
@@ -97,7 +101,7 @@ define('model', [], function () {
* @name cid
* @type {string|null}
* @public
* @memberof Espo.Model.prototype
* @memberof module:model.Class.prototype
*/
/**
@@ -106,7 +110,7 @@ define('model', [], function () {
* @name cid
* @type {string}
* @public
* @memberof Espo.Model.prototype
* @memberof module:model.Class.prototype
*/
/**
@@ -115,7 +119,7 @@ define('model', [], function () {
* @name attributes
* @type {Object}
* @public
* @memberof Espo.Model.prototype
* @memberof module:model.Class.prototype
*/
/**
@@ -146,6 +150,7 @@ define('model', [], function () {
/**
* Definitions.
*
* @type {Object|null}
*/
defs: null,
@@ -164,7 +169,7 @@ define('model', [], function () {
/**
* @param {string} [method] HTTP method.
* @param {Espo.Model} [model]
* @param {module:model.Class} [model]
* @param {Object} [options]
* @returns {Promise}
*/
@@ -568,8 +573,5 @@ define('model', [], function () {
this.lastXhr.abort();
}
},
});
return Model;
});

View File

@@ -37,10 +37,12 @@ define('router', [], function () {
*/
/**
* @class Espo.Router
* @class
* @name Class
* @memberOf module:router
* @mixes Espo.Events
*/
let Router = Backbone.Router.extend(/** @lends Espo.Router.prototype */ {
let Router = Backbone.Router.extend(/** @lends module:router.Class# */ {
/**
* @private
@@ -251,13 +253,13 @@ define('router', [], function () {
},
/**
* @callback Espo.Router~checkConfirmLeaveOutCallback
* @callback module:router.Class~checkConfirmLeaveOutCallback
*/
/**
* Process confirm-leave-out.
*
* @param {Espo.Router~checkConfirmLeaveOutCallback} callback Proceed if confirmed.
* @param {module:router.Class~checkConfirmLeaveOutCallback} callback Proceed if confirmed.
* @param {Object|null} [context] A context.
* @param {boolean} [navigateBack] To navigate back if not confirmed.
*/