Front-End custom row-actions in relationshipPanel

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • item
    Active Community Member
    • Mar 2017
    • 1489

    Front-End custom row-actions in relationshipPanel

    Hi,

    really don't understand ES6. .i hope front end specialist can post "how-to"

    contact.json :

    PHP Code:
            "contactInsurances": {
                "rowActionsView": "custom:views/record/row-actions/relationship-edit-and-remove-and-print",
                "select": false,
                "create": true,
                "layout": "listInsurancesForContact"
            },
    custom:views/record/row-actions/relationship-edit-and-remove-and-print.js

    PHP Code:
    import RelationshipActionsView from 'views/record/row-actions/relationship';
    
    class RelationshipEditAndRemoveAndPrintActionsView extends RelationshipActionsView {
    
        getActionList() {
            const list = [];
    
            if (this.options.acl.edit) {
                list.push({
                    action: 'quickEdit',
                    label: 'Edit',
                    data: {
                        id: this.model.id,
                    },
                });
            }
    
            if (this.options.acl.delete) {
                list.push({
                    action: 'quickRemove',
                    label: 'Remove',
                    data: {
                        id: this.model.id,
                    },
                });
            }
    
            if (this.options.acl.delete) {
                list.push({
                    action: 'quickPrint',
                    label: 'Print',
                    data: {
                        id: this.model.id,
                    },
                });
            }
    
            return list;
        }
    }
    
    export default RelationshipEditAndRemoveAndPrintActionsView;
    result : can't import outside module.

    I have just added "print Action".

    Any help ?
    or transform this to "non ES6"
    If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​
  • yuri
    Member
    • Mar 2014
    • 8562

    #2
    You can't use ES6 modules w/o doing transpiling/transforming. Transpiling is only supported for espo modules (ext-template has the necessary tool).
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • telecastg
      Active Community Member
      • Jun 2018
      • 907

      #3
      In the current implementation, ES6 modules are actually transpiled to AMD modules so they can be executed by the browser.

      Unless you are interested in having modules that can be exported like Node.js modules, or be able to utilize static analysis and other professional software development tools, I would just implement your code customization using standard AMD syntax.

      From the user (your customer) point of view, it will not make any difference.

      Comment

      • yuri
        Member
        • Mar 2014
        • 8562

        #4
        The main benefit of using ES6 modules is IDE support. It's just way easier to write code.

        ES6 running on production unlikely to ever happen. This is the reality of the web.
        If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

        Comment

        Working...