From 58b9b5a775d6e0d1dfca73fae0cea6acb4ef8e86 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Sun, 12 Jun 2022 21:37:42 +0300 Subject: [PATCH] amd require usage change --- client/src/router.js | 2 +- client/src/views/about.js | 2 +- client/src/views/base.js | 3 +- client/src/views/clear-cache.js | 2 +- client/src/views/collapsed-modal-bar.js | 2 +- client/src/views/collapsed-modal.js | 2 +- client/src/views/dashlet.js | 2 +- client/src/views/deleted-detail.js | 2 +- client/src/views/detail.js | 3 +- client/src/views/edit.js | 2 +- client/src/views/fields/base.js | 42 +++++++++++++----------- client/src/views/header.js | 2 +- client/src/views/home.js | 3 +- client/src/views/list-tree.js | 6 ++-- client/src/views/list-with-categories.js | 5 +-- client/src/views/list.js | 1 - client/src/views/login-second-step.js | 4 +-- client/src/views/login.js | 2 +- client/src/views/main.js | 2 +- client/src/views/merge.js | 2 +- client/src/views/modal.js | 2 +- client/src/views/popup-notification.js | 2 +- client/src/views/record/edit.js | 2 +- client/src/views/stream.js | 4 +-- 24 files changed, 50 insertions(+), 51 deletions(-) diff --git a/client/src/router.js b/client/src/router.js index 1f9fdee968..345310fa7f 100644 --- a/client/src/router.js +++ b/client/src/router.js @@ -377,7 +377,7 @@ define('router', [], function () { * Navigate. * * @param {string} fragment An URL fragment. - * @param {Options} options Options: trigger, replace. + * @param {Object} options Options: trigger, replace. */ navigate: function (fragment, options) { this.history.push(fragment); diff --git a/client/src/views/about.js b/client/src/views/about.js index 2a4a7fc411..22bc0bdbd3 100644 --- a/client/src/views/about.js +++ b/client/src/views/about.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -define('views/about', 'view', function (Dep) { +define('views/about', ['view'], function (Dep) { return Dep.extend({ diff --git a/client/src/views/base.js b/client/src/views/base.js index e0c5d5b0a4..8dbb3a3424 100644 --- a/client/src/views/base.js +++ b/client/src/views/base.js @@ -26,9 +26,8 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -define('views/base', 'view', function (Dep) { +define('views/base', ['view'], function (Dep) { return Dep.extend({ }); - }); diff --git a/client/src/views/clear-cache.js b/client/src/views/clear-cache.js index 4c7685f3a7..8634858877 100644 --- a/client/src/views/clear-cache.js +++ b/client/src/views/clear-cache.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -define('views/clear-cache', 'view', function (Dep) { +define('views/clear-cache', ['view'], function (Dep) { return Dep.extend({ diff --git a/client/src/views/collapsed-modal-bar.js b/client/src/views/collapsed-modal-bar.js index 15b33a82de..93d1bee8f7 100644 --- a/client/src/views/collapsed-modal-bar.js +++ b/client/src/views/collapsed-modal-bar.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -define('views/collapsed-modal-bar', 'view', function (Dep) { +define('views/collapsed-modal-bar', ['view'], function (Dep) { return Dep.extend({ diff --git a/client/src/views/collapsed-modal.js b/client/src/views/collapsed-modal.js index d9dfdbe5d1..5a0e2dba2f 100644 --- a/client/src/views/collapsed-modal.js +++ b/client/src/views/collapsed-modal.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -define('views/collapsed-modal', 'view', function (Dep) { +define('views/collapsed-modal', ['view'], function (Dep) { return Dep.extend({ diff --git a/client/src/views/dashlet.js b/client/src/views/dashlet.js index 8255be8776..4171c1c13c 100644 --- a/client/src/views/dashlet.js +++ b/client/src/views/dashlet.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -define('views/dashlet', 'view', function (Dep) { +define('views/dashlet', ['view'], function (Dep) { return Dep.extend({ diff --git a/client/src/views/deleted-detail.js b/client/src/views/deleted-detail.js index 731403f582..995e9d5853 100644 --- a/client/src/views/deleted-detail.js +++ b/client/src/views/deleted-detail.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -define('views/deleted-detail', 'views/detail', function (Dep) { +define('views/deleted-detail', ['views/detail'], function (Dep) { return Dep.extend({ diff --git a/client/src/views/detail.js b/client/src/views/detail.js index d4bc079e3c..243cdfdc03 100644 --- a/client/src/views/detail.js +++ b/client/src/views/detail.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -define('views/detail', 'views/main', function (Dep) { +define('views/detail', ['views/main'], function (Dep) { return Dep.extend({ @@ -460,6 +460,5 @@ define('views/detail', 'views/main', function (Dep) { this.getRouter().navigate(url, {trigger: false}); }); }, - }); }); diff --git a/client/src/views/edit.js b/client/src/views/edit.js index 0db6a1853d..3a36ae817d 100644 --- a/client/src/views/edit.js +++ b/client/src/views/edit.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -define('views/edit', 'views/main', function (Dep) { +define('views/edit', ['views/main'], function (Dep) { return Dep.extend({ diff --git a/client/src/views/fields/base.js b/client/src/views/fields/base.js index c7f08798ac..1dd208b877 100644 --- a/client/src/views/fields/base.js +++ b/client/src/views/fields/base.js @@ -26,12 +26,13 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -define('views/fields/base', 'view', function (Dep) { +define('views/fields/base', ['view'], function (Dep) { /** * A base field view. Can be in different modes. Each mode uses a separate template. * * @todo Document all options. + * @todo Document events. * * @class Espo.Views.Fields.Base * @extends Espo.View @@ -40,43 +41,43 @@ define('views/fields/base', 'view', function (Dep) { /** * A field type. - * @property {string} + * @type {string} */ type: 'base', /** * List mode template. - * @property {string} + * @type {string} */ listTemplate: 'fields/base/list', /** * List-link mode template. - * @property {string} + * @type {string} */ listLinkTemplate: 'fields/base/list-link', /** * Detail mode template. - * @property {string} + * @type {string} */ detailTemplate: 'fields/base/detail', /** * Edit mode template. - * @property {string} + * @type {string} */ editTemplate: 'fields/base/edit', /** * Search mode template. - * @property {string} + * @type {string} */ searchTemplate: 'fields/base/search', /** - * A validation list. There should be a validate{Name} method for each item. - * @property {Array.} + * A validation list. There should be a `validate{Name}` method for each item. + * @type {Array.} */ validations: ['required'], @@ -92,27 +93,30 @@ define('views/fields/base', 'view', function (Dep) { /** * A field name. - * @property {string} + * @type {string} */ name: null, + /** + * @type {Object} + */ defs: null, /** * Field params. - * @property {Object} + * @type {Object} */ params: null, /** * A mode. - * @property {string} + * @type {string} */ mode: null, /** * Search params. - * @property {?Object} + * @type {?Object} */ searchParams: null, @@ -120,19 +124,19 @@ define('views/fields/base', 'view', function (Dep) { /** * Inline edit disabled. - * @property {boolean} + * @type {boolean} */ inlineEditDisabled: false, /** * Field is disabled. - * @property {boolean} + * @type {boolean} */ disabled: false, /** * Field is read-only. - * @property {boolean} + * @type {boolean} */ readOnly: false, @@ -140,7 +144,7 @@ define('views/fields/base', 'view', function (Dep) { /** * Attribute values before edit. - * @property {Object} + * @type {Object} */ initialAttributes: null, @@ -150,7 +154,7 @@ define('views/fields/base', 'view', function (Dep) { /** * A record helper. - * @property {Espo.ViewRecordHelper} + * @type {Espo.ViewRecordHelper} */ recordHelper: null, @@ -166,7 +170,7 @@ define('views/fields/base', 'view', function (Dep) { /** * Get cell element. Works only after rendered. * - * @retrun {$} + * @returns {$} */ getCellElement: function () { return this.$el.parent(); diff --git a/client/src/views/header.js b/client/src/views/header.js index 1fc261b7c8..725949dc50 100644 --- a/client/src/views/header.js +++ b/client/src/views/header.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -define('views/header', 'view', function (Dep) { +define('views/header', ['view'], function (Dep) { return Dep.extend({ diff --git a/client/src/views/home.js b/client/src/views/home.js index 4e247f39e7..49a7fbc8a8 100644 --- a/client/src/views/home.js +++ b/client/src/views/home.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -define('views/home', 'view', function (Dep) { +define('views/home', ['view'], function (Dep) { return Dep.extend({ @@ -34,6 +34,7 @@ define('views/home', 'view', function (Dep) { setup: function () { var view = this.getMetadata().get(['clientDefs', 'Home', 'view']) || 'views/dashboard'; + this.createView('content', view, { el: this.options.el + ' > .home-content' }); diff --git a/client/src/views/list-tree.js b/client/src/views/list-tree.js index 1a3e24e20e..fa4022b6de 100644 --- a/client/src/views/list-tree.js +++ b/client/src/views/list-tree.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -define('views/list-tree', 'views/list', function (Dep) { +define('views/list-tree', ['views/list'], function (Dep) { return Dep.extend({ @@ -37,8 +37,8 @@ define('views/list-tree', 'views/list', function (Dep) { name: 'listTree', getRecordViewName: function () { - return this.getMetadata().get('clientDefs.' + this.scope + '.recordViews.listTree') || 'views/record/list-tree'; + return this.getMetadata() + .get('clientDefs.' + this.scope + '.recordViews.listTree') || 'views/record/list-tree'; }, - }); }); diff --git a/client/src/views/list-with-categories.js b/client/src/views/list-with-categories.js index 2e15529138..3212c1a14e 100644 --- a/client/src/views/list-with-categories.js +++ b/client/src/views/list-with-categories.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -define('views/list-with-categories', 'views/list', function (Dep) { +define('views/list-with-categories', ['views/list'], function (Dep) { return Dep.extend({ @@ -390,7 +390,8 @@ define('views/list-with-categories', 'views/list', function (Dep) { this.nestedCategoriesCollection.parentId = this.currentCategoryId; this.nestedCategoriesCollection.currentCategoryId = this.currentCategoryId; - this.nestedCategoriesCollection.currentCategoryName = this.currentCategoryName || this.currentCategoryId; + this.nestedCategoriesCollection.currentCategoryName = this.currentCategoryName || + this.currentCategoryId; this.nestedCategoriesCollection.where = [filter]; }, diff --git a/client/src/views/list.js b/client/src/views/list.js index 564f11c1e7..c1cb5068b5 100644 --- a/client/src/views/list.js +++ b/client/src/views/list.js @@ -517,6 +517,5 @@ define('views/list', ['views/main', 'search-manager'], function (Dep, SearchMana isActualForReuse: function () { return this.collection.isFetched; }, - }); }); diff --git a/client/src/views/login-second-step.js b/client/src/views/login-second-step.js index 8846fab13e..d36f49e71f 100644 --- a/client/src/views/login-second-step.js +++ b/client/src/views/login-second-step.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -define('views/login-second-step', 'view', function (Dep) { +define('views/login-second-step', ['view'], function (Dep) { return Dep.extend({ @@ -42,8 +42,6 @@ define('views/login-second-step', 'view', function (Dep) { events: { 'submit #login-form': function (e) { this.send(); - - return; }, 'click [data-action="backToLogin"]': function () { this.trigger('back'); diff --git a/client/src/views/login.js b/client/src/views/login.js index b20c63a534..9f7589465f 100644 --- a/client/src/views/login.js +++ b/client/src/views/login.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -define('views/login', 'view', function (Dep) { +define('views/login', ['view'], function (Dep) { return Dep.extend({ diff --git a/client/src/views/main.js b/client/src/views/main.js index 276a519f91..ca9b3dea63 100644 --- a/client/src/views/main.js +++ b/client/src/views/main.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -define('views/main', 'view', function (Dep) { +define('views/main', ['view'], function (Dep) { return Dep.extend({ diff --git a/client/src/views/merge.js b/client/src/views/merge.js index e82124dcf2..ccc51b17e4 100644 --- a/client/src/views/merge.js +++ b/client/src/views/merge.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -define('views/merge', 'views/main', function (Dep) { +define('views/merge', ['views/main'], function (Dep) { return Dep.extend({ diff --git a/client/src/views/modal.js b/client/src/views/modal.js index 0e137adc34..d60a5fd63e 100644 --- a/client/src/views/modal.js +++ b/client/src/views/modal.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -define('views/modal', 'view', function (Dep) { +define('views/modal', ['view'], function (Dep) { return Dep.extend({ diff --git a/client/src/views/popup-notification.js b/client/src/views/popup-notification.js index 2957a1a0a8..cf63bad342 100644 --- a/client/src/views/popup-notification.js +++ b/client/src/views/popup-notification.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -define('views/popup-notification', 'view', function (Dep) { +define('views/popup-notification', ['view'], function (Dep) { return Dep.extend({ diff --git a/client/src/views/record/edit.js b/client/src/views/record/edit.js index b9dc07fd52..7d0d648a9e 100644 --- a/client/src/views/record/edit.js +++ b/client/src/views/record/edit.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -define('views/record/edit', 'views/record/detail', function (Dep) { +define('views/record/edit', ['views/record/detail'], function (Dep) { return Dep.extend({ diff --git a/client/src/views/stream.js b/client/src/views/stream.js index f10e6fb764..4029c02c18 100644 --- a/client/src/views/stream.js +++ b/client/src/views/stream.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -define('views/stream', 'view', function (Dep) { +define('views/stream', ['view'], function (Dep) { return Dep.extend({ @@ -161,7 +161,5 @@ define('views/stream', 'view', function (Dep) { this.collection.offset = 0; this.collection.maxSize = this.getConfig().get('recordsPerPage') || this.collection.maxSize; }, - }); }); -