UNPKG

activator-oce-exporter

Version:

Extract Activator binder and convert it to valid OCE mono pacakge

120 lines (112 loc) 2.94 kB
import { html } from '@polymer/lit-element'; import { FusionBase } from '../../base'; import { applyMixins, EmailComponent } from '../../mixins'; class MJMLColumn extends applyMixins(FusionBase, [EmailComponent]) { static get properties() { return { width: { type: String, fieldType: 'Number', value: '300px', }, 'border-radius': { type: String, fieldType: 'Number', value: '0px', }, 'background-color': { type: String, fieldType: 'ColorPicker', value: 'rgba(255, 255, 255, 0)', }, 'vertical-align': { type: String, fieldType: 'Select', value: 'top', selectOptions: [ 'top', 'middle', 'bottom', ], }, 'padding-top': { type: String, fieldType: 'Number', value: '10px', }, 'padding-right': { type: String, fieldType: 'Number', value: '0px', }, 'padding-bottom': { type: String, fieldType: 'Number', value: '10px', }, 'padding-left': { type: String, fieldType: 'Number', value: '0px', }, }; } static get options() { return { componentName: 'mj-column', componentUIName: 'Column container', componentScope: 'standard', componentType: 'static', componentCategory: 'UI', componentDescription: 'Group column container for editor', componentDomain: 'email', isRootNested: false, isTextEdit: false, nestedTypes: [], nestedComponents: ['mj-text', 'mj-image', 'mj-spacer', 'mj-divider', 'mj-button'], defaultTemplate: '', resizable: false, draggable: false, rotatable: false, sortable: true, }; } disconnectedCallback() { super.disconnectedCallback(); this.emitCustomEvent(`${this.constructor.options.componentName}:removed`); } update(changedProperties) { super.update(changedProperties); if (changedProperties.has('width')) { this.setElementProp('width', this.width); this.emitCustomEvent(`${this.constructor.options.componentName}:resized`); } } static getStyle() { const styleRoot = super.getStyle(); return ` ${styleRoot} :host { display: block; max-width: 100%; border-radius: var(--border-radius); background-color: var(--background-color); padding: var(--padding-top) var(--padding-right) var(--padding-bottom) var(--padding-left); vertical-align: var(--vertical-align); box-sizing: border-box; }`; } render() { super.render(); return html` <style> ${MJMLColumn.getStyle()} </style> <div class='mj-section'> <slot></slot> ${MJMLColumn.getSystemSlotTemplate()} </div> `; } } export { MJMLColumn };