How to use the dojo/_base/declare function in dojo

To help you get started, we’ve selected a few dojo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Saleslogix / argos-saleslogix / src / Integrations / BOE / Models / SalesOrder / SData.js View on Github external
* distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import declare from 'dojo/_base/declare';
import lang from 'dojo/_base/lang';
import Base from './Base';
import _SDataModelBase from 'argos/Models/_SDataModelBase';
import Manager from 'argos/Models/Manager';
import ErrorManager from 'argos/ErrorManager';
import MODEL_TYPES from 'argos/Models/Types';
import MODEL_NAMES from '../Names';

const __class = declare('crm.Integrations.BOE.Models.SalesOrder.SData', [Base, _SDataModelBase], {
  id: 'salesorder_sdata_model',
  createQueryModels: function createQueryModels() {
    return [{
      name: 'list',
      queryWhere: 'IsQuote eq false',
      queryOrderBy: 'ErpDocumentDate desc, OrderDate desc',
      querySelect: [
        'SalesOrderNumber',
        'Account/AccountName',
        'Status',
        'ErpExtId',
        'CustomerPurchaseOrderNumber',
        'DocGrandTotal', // Document Total
        'GrandTotal', // Base Total
        'OrderDate',
        'CreateDate',
github Saleslogix / argos-saleslogix / src / Views / MainToolbar.js View on Github external
*
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import declare from 'dojo/_base/declare';
import has from 'dojo/has';
import MainToolbar from 'argos/MainToolbar';
import getResource from 'argos/I18n';

const resource = getResource('mainToolbar');

const __class = declare('crm.Views.MainToolbar', [MainToolbar], {
  backTooltipText: resource.backTooltipText,

  showTools: function showTools(tools) {
    let isOnEdit;
    const isOnFirstView = App.isOnFirstView();

    if (tools) {
      for (let i = 0; i < tools.length; i++) {
        if (tools[i].id === 'cancel') {
          isOnEdit = true;
        }
      }
    }

    if (tools !== false) {
      tools = tools || []; // eslint-disable-line
github Saleslogix / argos-saleslogix / src / Views / Lead / List.js View on Github external
*/

import declare from 'dojo/_base/declare';
import action from '../../Action';
import format from '../../Format';
import utility from 'argos/Utility';
import List from 'argos/List';
import _GroupListMixin from '../_GroupListMixin';
import _MetricListMixin from '../_MetricListMixin';
import _RightDrawerListMixin from '../_RightDrawerListMixin';
import getResource from 'argos/I18n';
import MODEL_NAMES from '../../Models/Names';

const resource = getResource('leadList');

const __class = declare('crm.Views.Lead.List', [List, _RightDrawerListMixin, _MetricListMixin, _GroupListMixin], {
  // Templates
  itemTemplate: new Simplate([
    '<p class="micro-text">',
    '{%: $$.joinFields(" | ", [$$.formatPicklist("Title")($.Title), $.Company]) %}',
    '</p>',
    '{% if ($.WorkPhone) { %}',
    '<p class="micro-text">',
    '{%: $$.phoneAbbreviationText %} <span data-key="{%: $.$key %}" data-action="callWork" class="hyperlink">{%: argos.Format.phone($.WorkPhone) %}</span>', // TODO: Avoid global
    '</p>',
    '{% } %}',
    '{% if ($.Mobile) { %}',
    '<p class="micro-text">',
    '{%: $$.mobileAbbreviationText %} <span data-key="{%: $.$key %}" data-action="callMobile" class="hyperlink">{%: argos.Format.phone($.Mobile) %}</span>', // TODO: Avoid global
    '</p>',
    '{% } %}',
    '{% if ($.TollFree) { %}',
github Saleslogix / argos-saleslogix / src / Integrations / BOE / Views / ERPSalesOrderPersons / List.js View on Github external
import declare from 'dojo/_base/declare';
import lang from 'dojo/_base/lang';
import string from 'dojo/string';
import List from 'argos/List';
import _CardLayoutListMixin from 'crm/Views/_CardLayoutListMixin';
import _RightDrawerListMixin from 'crm/Views/_RightDrawerListMixin';
import _MetricListMixin from 'crm/Views/_MetricListMixin';
import MODEL_NAMES from '../../Models/Names';
import getResource from 'argos/I18n';

const resource = getResource('erpSalesOrderPersonsList');

const __class = declare('crm.Integrations.BOE.Views.ERPSalesOrderPersons.List', [List, _RightDrawerListMixin, _MetricListMixin, _CardLayoutListMixin], {
  // Templates
  // TODO: Need template from PM
  itemTemplate: new Simplate([
    '<h3>{%: $.ErpPerson.Name %}</h3>',
    '<div class="h4 address">{%: $.ErpPerson.Address.FullAddress %}</div>',
  ]),

  // Localization
  titleText: resource.titleText,

  // View Properties
  id: 'erpsalesorderperson_list',
  modelName: MODEL_NAMES.ERPSALESORDERPERSON,
  resourceKind: 'erpSalesOrderPersons',
  allowSelection: true,
  enableActions: true,
github Saleslogix / argos-saleslogix / src / Integrations / BOE / Modules / ShipmentLineModule.js View on Github external
*
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import declare from 'dojo/_base/declare';
import lang from 'dojo/_base/lang';
import _Module from './_Module';
import ShipmentItemsDetail from '../Views/ERPShipmentItems/Detail';
import '../Models/ErpShipmentItem/Offline';
import '../Models/ErpShipmentItem/SData';

const __class = declare('crm.Integrations.BOE.Modules.ShipmentLineModule', [_Module], {
  init: function init() {
  },
  loadViews: function loadViews() {
    const am = this.applicationModule;
    am.registerView(new ShipmentItemsDetail());
  },
  loadCustomizations: function loadCustomizations() {
    const am = this.applicationModule;
    am.registerCustomization('detail/tools', 'erpshipment_items_detail', {
      at: function at(tool) {
        return tool.id === 'edit';
      },
      type: 'remove',
    });
  },
  loadToolbars: function loadToolbars() {
github Saleslogix / argos-saleslogix / src / Models / Contact / Base.js View on Github external
import declare from 'dojo/_base/declare';
import _ModelBase from 'argos/Models/_ModelBase';
import MODEL_NAMES from '../Names';
import getResource from 'argos/I18n';

const resource = getResource('contactModel');
const accountResource = getResource('accountModel');
const activityResource = getResource('activityModel');
const historyResource = getResource('historyModel');
const addressResource = getResource('addressModel');
const ticketResource = getResource('ticketModel');

const __class = declare('crm.Models.Contact.Base', [_ModelBase], {
  resourceKind: 'contacts',
  entityName: 'Contact',
  entityDisplayName: resource.entityDisplayName,
  entityDisplayNamePlural: resource.entityDisplayNamePlural,
  modelName: MODEL_NAMES.CONTACT,
  iconClass: 'fa fa-user fa-lg',
  security: 'Entities/Contact/View',
  createRelationships: function createRelationships() {
    const rel = this.relationships || (this.relationships = [{
      name: 'Account',
      displayName: accountResource.entityDisplayName,
      type: 'ManyToOne',
      parentProperty: 'Account',
      parentPropertyType: 'object',
      relatedEntity: 'Account',
      relatedPropertyType: 'object',
github Saleslogix / argos-saleslogix / src / Integrations / BOE / Models / ErpReceivable / Base.js View on Github external
import declare from 'dojo/_base/declare';
import lang from 'dojo/_base/lang';
import _ModelBase from 'argos/Models/_ModelBase';
import MODEL_NAMES from '../Names';
import getResource from 'argos/I18n';

const resource = getResource('erpReceivableModel');
const accountResource = getResource('accountModel');
const billToResource = getResource('erpBillToModel');
const shipToResource = getResource('erpShipToModel');
const receivableItemResource = getResource('erpReceivableItemModel');
const invoiceResource = getResource('erpInvoiceModel');

const __class = declare('crm.Integrations.BOE.Models.ErpReceivable.Base', [_ModelBase], {
  contractName: 'dynamic',
  resourceKind: 'erpReceivables',
  entityName: 'ERPReceivable',
  entityDisplayName: resource.entityDisplayName,
  entityDisplayNamePlural: resource.entityDisplayNamePlural,
  modelName: MODEL_NAMES.ERPRECEIVABLE,
  iconClass: 'checkbox',
  detailViewId: 'erpreceivables_detail',
  listViewId: 'erpreceivables_list',
  editViewId: '',
  createRelationships: function createRelationships() {
    const rel = this.relationships || (this.relationships = [{
      name: 'Account',
      displayName: accountResource.entityDisplayName,
      type: 'ManyToOne',
      parentProperty: 'Account',
github Saleslogix / argos-saleslogix / src / Integrations / SalesNavigator / Views / Contact / Widget.js View on Github external
/*
* See copyright file.
*/
import declare from 'dojo/_base/declare';
import RelatedViewManager from 'argos/RelatedViewManager';
import _WidgetBase from '../../_WidgetBase';
import { getSalesNavigatorUrl } from '../../SalesNavigatorService';

const __class = declare('crm.Integrations.SalesNavigator.ContactWidget', [_WidgetBase], {
  id: 'sales_navigator_contact',
  type: 'contacts',

  initSalesNavigator: function initSalesNavigator(entry) {
    getSalesNavigatorUrl(this.type, entry).then((result) => {
      this.iframeNode.contentWindow.location.replace(result);
    });
  },
});

const rvm = new RelatedViewManager();
rvm.registerType(__class.prototype.id, __class);
export default __class;
github Saleslogix / argos-saleslogix / src / Integrations / BOE / Models / UnitOfMeasure / SData.js View on Github external
import declare from 'dojo/_base/declare';
import lang from 'dojo/_base/lang';
import Base from './Base';
import _SDataModelBase from 'argos/Models/_SDataModelBase';
import Manager from 'argos/Models/Manager';
import MODEL_TYPES from 'argos/Models/Types';
import MODEL_NAMES from '../Names';
import Deferred from 'dojo/Deferred';
import when from 'dojo/when';

const __class = declare('crm.Integrations.BOE.Models.UnitOfMeasure.SData', [Base, _SDataModelBase], {
  id: 'unitofmeasure_sdata_model',
  createQueryModels: function createQueryModels() {
    return [{
      name: 'list',
      queryOrderBy: 'Name',
      querySelect: [
        'Name',
        'Product/*',
      ],
    }, {
      name: 'detail',
      querySelect: [
        'Name',
        'Product/*',
      ],
      queryInclude: [
github Saleslogix / argos-saleslogix / src / Integrations / BOE / Models / Product / Base.js View on Github external
* Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import declare from 'dojo/_base/declare';
import lang from 'dojo/_base/lang';
import _ModelBase from 'argos/Models/_ModelBase';
import MODEL_NAMES from '../Names';
import getResource from 'argos/I18n';

const resource = getResource('productModel');

const __class = declare('crm.Integrations.BOE.Models.Product.Base', [_ModelBase], {
  contractName: 'dynamic',
  resourceKind: 'products',
  entityName: 'Product',
  entityDisplayName: resource.entityDisplayName,
  entityDisplayNamePlural: resource.entityDisplayNamePlural,
  modelName: MODEL_NAMES.PRODUCT,
  iconClass: '',
  detailViewId: '',
  listViewId: '',
  editViewId: '',
  createRelationships: function createRelationships() {
    const rel = this.relationships || (this.relationships = []);
    return rel;
  },
});
lang.setObject('icboe.Models.Product.Base', __class);

dojo

Dojo core is a powerful, lightweight library that makes common tasks quicker and easier. Animate elements, manipulate the DOM, and query with easy CSS syntax, all without sacrificing performance.

BSD-3-Clause OR AFL-2.1
Latest version published 2 years ago

Package Health Score

59 / 100
Full package analysis