mjml-accordion
Advanced tools
Comparing version 4.8.1 to 4.8.2
@@ -10,2 +10,12 @@ "use strict"; | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")); | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper")); | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
@@ -15,6 +25,13 @@ | ||
class MjAccordion extends _mjmlCore.BodyComponent { | ||
constructor(...args) { | ||
super(...args); | ||
(0, _defineProperty2.default)(this, "headStyle", () => ` | ||
let MjAccordion = /*#__PURE__*/function (_BodyComponent) { | ||
(0, _inherits2.default)(MjAccordion, _BodyComponent); | ||
var _super = (0, _createSuper2.default)(MjAccordion); | ||
function MjAccordion(...args) { | ||
var _this; | ||
(0, _classCallCheck2.default)(this, MjAccordion); | ||
_this = _super.call(this, ...args); | ||
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "headStyle", () => ` | ||
noinput.mj-accordion-checkbox { display:block!important; } | ||
@@ -39,40 +56,45 @@ | ||
`); | ||
return _this; | ||
} | ||
getStyles() { | ||
return { | ||
table: { | ||
width: '100%', | ||
'border-collapse': 'collapse', | ||
border: this.getAttribute('border'), | ||
'border-bottom': 'none', | ||
'font-family': this.getAttribute('font-family') | ||
} | ||
}; | ||
} | ||
render() { | ||
const childrenAttr = ['border', 'icon-align', 'icon-width', 'icon-height', 'icon-position', 'icon-wrapped-url', 'icon-wrapped-alt', 'icon-unwrapped-url', 'icon-unwrapped-alt'].reduce((res, val) => ({ ...res, | ||
[val]: this.getAttribute(val) | ||
}), {}); | ||
return ` | ||
(0, _createClass2.default)(MjAccordion, [{ | ||
key: "getStyles", | ||
value: function getStyles() { | ||
return { | ||
table: { | ||
width: '100%', | ||
'border-collapse': 'collapse', | ||
border: this.getAttribute('border'), | ||
'border-bottom': 'none', | ||
'font-family': this.getAttribute('font-family') | ||
} | ||
}; | ||
} | ||
}, { | ||
key: "render", | ||
value: function render() { | ||
const childrenAttr = ['border', 'icon-align', 'icon-width', 'icon-height', 'icon-position', 'icon-wrapped-url', 'icon-wrapped-alt', 'icon-unwrapped-url', 'icon-unwrapped-alt'].reduce((res, val) => ({ ...res, | ||
[val]: this.getAttribute(val) | ||
}), {}); | ||
return ` | ||
<table | ||
${this.htmlAttributes({ | ||
'cell-spacing': '0', | ||
'cell-padding': '0', | ||
class: 'mj-accordion', | ||
style: 'table' | ||
})} | ||
'cell-spacing': '0', | ||
'cell-padding': '0', | ||
class: 'mj-accordion', | ||
style: 'table' | ||
})} | ||
> | ||
<tbody> | ||
${this.renderChildren(this.props.children, { | ||
attributes: childrenAttr | ||
})} | ||
attributes: childrenAttr | ||
})} | ||
</tbody> | ||
</table> | ||
`; | ||
} | ||
} | ||
}]); | ||
return MjAccordion; | ||
}(_mjmlCore.BodyComponent); | ||
} | ||
exports.default = MjAccordion; | ||
@@ -79,0 +101,0 @@ (0, _defineProperty2.default)(MjAccordion, "componentName", 'mj-accordion'); |
@@ -10,2 +10,10 @@ "use strict"; | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper")); | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
@@ -23,68 +31,81 @@ | ||
class MjAccordionElement extends _mjmlCore.BodyComponent { | ||
getStyles() { | ||
return { | ||
td: { | ||
padding: '0px', | ||
'background-color': this.getAttribute('background-color') | ||
}, | ||
label: { | ||
'font-size': '13px', | ||
'font-family': this.getAttribute('font-family') | ||
}, | ||
input: { | ||
display: 'none' | ||
} | ||
}; | ||
let MjAccordionElement = /*#__PURE__*/function (_BodyComponent) { | ||
(0, _inherits2.default)(MjAccordionElement, _BodyComponent); | ||
var _super = (0, _createSuper2.default)(MjAccordionElement); | ||
function MjAccordionElement() { | ||
(0, _classCallCheck2.default)(this, MjAccordionElement); | ||
return _super.apply(this, arguments); | ||
} | ||
handleMissingChildren() { | ||
const { | ||
children | ||
} = this.props; | ||
const childrenAttr = ['border', 'icon-align', 'icon-width', 'icon-height', 'icon-position', 'icon-wrapped-url', 'icon-wrapped-alt', 'icon-unwrapped-url', 'icon-unwrapped-alt'].reduce((res, val) => ({ ...res, | ||
[val]: this.getAttribute(val) | ||
}), {}); | ||
const result = []; | ||
if (!(0, _find2.default)(children, { | ||
tagName: 'mj-accordion-title' | ||
})) { | ||
result.push(new _AccordionTitle.default({ | ||
attributes: childrenAttr, | ||
context: this.getChildContext() | ||
}).render()); | ||
(0, _createClass2.default)(MjAccordionElement, [{ | ||
key: "getStyles", | ||
value: function getStyles() { | ||
return { | ||
td: { | ||
padding: '0px', | ||
'background-color': this.getAttribute('background-color') | ||
}, | ||
label: { | ||
'font-size': '13px', | ||
'font-family': this.getAttribute('font-family') | ||
}, | ||
input: { | ||
display: 'none' | ||
} | ||
}; | ||
} | ||
}, { | ||
key: "handleMissingChildren", | ||
value: function handleMissingChildren() { | ||
const { | ||
children | ||
} = this.props; | ||
const childrenAttr = ['border', 'icon-align', 'icon-width', 'icon-height', 'icon-position', 'icon-wrapped-url', 'icon-wrapped-alt', 'icon-unwrapped-url', 'icon-unwrapped-alt'].reduce((res, val) => ({ ...res, | ||
[val]: this.getAttribute(val) | ||
}), {}); | ||
const result = []; | ||
result.push(this.renderChildren(children, { | ||
attributes: childrenAttr | ||
})); | ||
if (!(0, _find2.default)(children, { | ||
tagName: 'mj-accordion-title' | ||
})) { | ||
result.push(new _AccordionTitle.default({ | ||
attributes: childrenAttr, | ||
context: this.getChildContext() | ||
}).render()); | ||
} | ||
if (!(0, _find2.default)(children, { | ||
tagName: 'mj-accordion-text' | ||
})) { | ||
result.push(new _AccordionText.default({ | ||
attributes: childrenAttr, | ||
context: this.getChildContext() | ||
}).render()); | ||
} | ||
result.push(this.renderChildren(children, { | ||
attributes: childrenAttr | ||
})); | ||
return result.join('\n'); | ||
} | ||
if (!(0, _find2.default)(children, { | ||
tagName: 'mj-accordion-text' | ||
})) { | ||
result.push(new _AccordionText.default({ | ||
attributes: childrenAttr, | ||
context: this.getChildContext() | ||
}).render()); | ||
} | ||
render() { | ||
return ` | ||
return result.join('\n'); | ||
} | ||
}, { | ||
key: "render", | ||
value: function render() { | ||
return ` | ||
<tr | ||
${this.htmlAttributes({ | ||
class: this.getAttribute('css-class') | ||
})} | ||
class: this.getAttribute('css-class') | ||
})} | ||
> | ||
<td ${this.htmlAttributes({ | ||
style: 'td' | ||
})}> | ||
style: 'td' | ||
})}> | ||
<label | ||
${this.htmlAttributes({ | ||
class: 'mj-accordion-element', | ||
style: 'label' | ||
})} | ||
class: 'mj-accordion-element', | ||
style: 'label' | ||
})} | ||
> | ||
@@ -94,6 +115,6 @@ ${(0, _conditionalTag.default)(` | ||
${this.htmlAttributes({ | ||
class: 'mj-accordion-checkbox', | ||
type: 'checkbox', | ||
style: 'input' | ||
})} | ||
class: 'mj-accordion-checkbox', | ||
type: 'checkbox', | ||
style: 'input' | ||
})} | ||
/> | ||
@@ -108,6 +129,7 @@ `, true)} | ||
`; | ||
} | ||
} | ||
}]); | ||
return MjAccordionElement; | ||
}(_mjmlCore.BodyComponent); | ||
} | ||
exports.default = MjAccordionElement; | ||
@@ -114,0 +136,0 @@ (0, _defineProperty2.default)(MjAccordionElement, "componentName", 'mj-accordion-element'); |
@@ -10,2 +10,10 @@ "use strict"; | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper")); | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
@@ -15,33 +23,45 @@ | ||
class MjAccordionText extends _mjmlCore.BodyComponent { | ||
getStyles() { | ||
return { | ||
td: { | ||
background: this.getAttribute('background-color'), | ||
'font-size': this.getAttribute('font-size'), | ||
'font-family': this.getAttribute('font-family'), | ||
'font-weight': this.getAttribute('font-weight'), | ||
'letter-spacing': this.getAttribute('letter-spacing'), | ||
'line-height': this.getAttribute('line-height'), | ||
color: this.getAttribute('color'), | ||
'padding-bottom': this.getAttribute('padding-bottom'), | ||
'padding-left': this.getAttribute('padding-left'), | ||
'padding-right': this.getAttribute('padding-right'), | ||
'padding-top': this.getAttribute('padding-top'), | ||
padding: this.getAttribute('padding') | ||
}, | ||
table: { | ||
width: '100%', | ||
'border-bottom': this.getAttribute('border') | ||
} | ||
}; | ||
let MjAccordionText = /*#__PURE__*/function (_BodyComponent) { | ||
(0, _inherits2.default)(MjAccordionText, _BodyComponent); | ||
var _super = (0, _createSuper2.default)(MjAccordionText); | ||
function MjAccordionText() { | ||
(0, _classCallCheck2.default)(this, MjAccordionText); | ||
return _super.apply(this, arguments); | ||
} | ||
renderContent() { | ||
return ` | ||
(0, _createClass2.default)(MjAccordionText, [{ | ||
key: "getStyles", | ||
value: function getStyles() { | ||
return { | ||
td: { | ||
background: this.getAttribute('background-color'), | ||
'font-size': this.getAttribute('font-size'), | ||
'font-family': this.getAttribute('font-family'), | ||
'font-weight': this.getAttribute('font-weight'), | ||
'letter-spacing': this.getAttribute('letter-spacing'), | ||
'line-height': this.getAttribute('line-height'), | ||
color: this.getAttribute('color'), | ||
'padding-bottom': this.getAttribute('padding-bottom'), | ||
'padding-left': this.getAttribute('padding-left'), | ||
'padding-right': this.getAttribute('padding-right'), | ||
'padding-top': this.getAttribute('padding-top'), | ||
padding: this.getAttribute('padding') | ||
}, | ||
table: { | ||
width: '100%', | ||
'border-bottom': this.getAttribute('border') | ||
} | ||
}; | ||
} | ||
}, { | ||
key: "renderContent", | ||
value: function renderContent() { | ||
return ` | ||
<td | ||
${this.htmlAttributes({ | ||
class: this.getAttribute('css-class'), | ||
style: 'td' | ||
})} | ||
class: this.getAttribute('css-class'), | ||
style: 'td' | ||
})} | ||
> | ||
@@ -51,17 +71,18 @@ ${this.getContent()} | ||
`; | ||
} | ||
render() { | ||
return ` | ||
} | ||
}, { | ||
key: "render", | ||
value: function render() { | ||
return ` | ||
<div | ||
${this.htmlAttributes({ | ||
class: 'mj-accordion-content' | ||
})} | ||
class: 'mj-accordion-content' | ||
})} | ||
> | ||
<table | ||
${this.htmlAttributes({ | ||
'cell-spacing': '0', | ||
'cell-padding': '0', | ||
style: 'table' | ||
})} | ||
'cell-spacing': '0', | ||
'cell-padding': '0', | ||
style: 'table' | ||
})} | ||
> | ||
@@ -76,6 +97,7 @@ <tbody> | ||
`; | ||
} | ||
} | ||
}]); | ||
return MjAccordionText; | ||
}(_mjmlCore.BodyComponent); | ||
} | ||
exports.default = MjAccordionText; | ||
@@ -82,0 +104,0 @@ (0, _defineProperty2.default)(MjAccordionText, "componentName", 'mj-accordion-text'); |
@@ -10,2 +10,10 @@ "use strict"; | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper")); | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
@@ -17,41 +25,53 @@ | ||
class MjAccordionTitle extends _mjmlCore.BodyComponent { | ||
getStyles() { | ||
return { | ||
td: { | ||
width: '100%', | ||
'background-color': this.getAttribute('background-color'), | ||
color: this.getAttribute('color'), | ||
'font-size': this.getAttribute('font-size'), | ||
'font-family': this.getAttribute('font-family'), | ||
'padding-bottom': this.getAttribute('padding-bottom'), | ||
'padding-left': this.getAttribute('padding-left'), | ||
'padding-right': this.getAttribute('padding-right'), | ||
'padding-top': this.getAttribute('padding-top'), | ||
padding: this.getAttribute('padding') | ||
}, | ||
table: { | ||
width: '100%', | ||
'border-bottom': this.getAttribute('border') | ||
}, | ||
td2: { | ||
padding: '16px', | ||
background: this.getAttribute('background-color'), | ||
'vertical-align': this.getAttribute('icon-align') | ||
}, | ||
img: { | ||
display: 'none', | ||
width: this.getAttribute('icon-width'), | ||
height: this.getAttribute('icon-height') | ||
} | ||
}; | ||
let MjAccordionTitle = /*#__PURE__*/function (_BodyComponent) { | ||
(0, _inherits2.default)(MjAccordionTitle, _BodyComponent); | ||
var _super = (0, _createSuper2.default)(MjAccordionTitle); | ||
function MjAccordionTitle() { | ||
(0, _classCallCheck2.default)(this, MjAccordionTitle); | ||
return _super.apply(this, arguments); | ||
} | ||
renderTitle() { | ||
return ` | ||
(0, _createClass2.default)(MjAccordionTitle, [{ | ||
key: "getStyles", | ||
value: function getStyles() { | ||
return { | ||
td: { | ||
width: '100%', | ||
'background-color': this.getAttribute('background-color'), | ||
color: this.getAttribute('color'), | ||
'font-size': this.getAttribute('font-size'), | ||
'font-family': this.getAttribute('font-family'), | ||
'padding-bottom': this.getAttribute('padding-bottom'), | ||
'padding-left': this.getAttribute('padding-left'), | ||
'padding-right': this.getAttribute('padding-right'), | ||
'padding-top': this.getAttribute('padding-top'), | ||
padding: this.getAttribute('padding') | ||
}, | ||
table: { | ||
width: '100%', | ||
'border-bottom': this.getAttribute('border') | ||
}, | ||
td2: { | ||
padding: '16px', | ||
background: this.getAttribute('background-color'), | ||
'vertical-align': this.getAttribute('icon-align') | ||
}, | ||
img: { | ||
display: 'none', | ||
width: this.getAttribute('icon-width'), | ||
height: this.getAttribute('icon-height') | ||
} | ||
}; | ||
} | ||
}, { | ||
key: "renderTitle", | ||
value: function renderTitle() { | ||
return ` | ||
<td | ||
${this.htmlAttributes({ | ||
class: this.getAttribute('css-class'), | ||
style: 'td' | ||
})} | ||
class: this.getAttribute('css-class'), | ||
style: 'td' | ||
})} | ||
> | ||
@@ -61,45 +81,47 @@ ${this.getContent()} | ||
`; | ||
} | ||
renderIcons() { | ||
return (0, _conditionalTag.default)(` | ||
} | ||
}, { | ||
key: "renderIcons", | ||
value: function renderIcons() { | ||
return (0, _conditionalTag.default)(` | ||
<td | ||
${this.htmlAttributes({ | ||
class: 'mj-accordion-ico', | ||
style: 'td2' | ||
})} | ||
class: 'mj-accordion-ico', | ||
style: 'td2' | ||
})} | ||
> | ||
<img | ||
${this.htmlAttributes({ | ||
src: this.getAttribute('icon-wrapped-url'), | ||
alt: this.getAttribute('icon-wrapped-alt'), | ||
class: 'mj-accordion-more', | ||
style: 'img' | ||
})} | ||
src: this.getAttribute('icon-wrapped-url'), | ||
alt: this.getAttribute('icon-wrapped-alt'), | ||
class: 'mj-accordion-more', | ||
style: 'img' | ||
})} | ||
/> | ||
<img | ||
${this.htmlAttributes({ | ||
src: this.getAttribute('icon-unwrapped-url'), | ||
alt: this.getAttribute('icon-unwrapped-alt'), | ||
class: 'mj-accordion-less', | ||
style: 'img' | ||
})} | ||
src: this.getAttribute('icon-unwrapped-url'), | ||
alt: this.getAttribute('icon-unwrapped-alt'), | ||
class: 'mj-accordion-less', | ||
style: 'img' | ||
})} | ||
/> | ||
</td> | ||
`, true); | ||
} | ||
render() { | ||
const contentElements = [this.renderTitle(), this.renderIcons()]; | ||
const content = (this.getAttribute('icon-position') === 'right' ? contentElements : contentElements.reverse()).join('\n'); | ||
return ` | ||
} | ||
}, { | ||
key: "render", | ||
value: function render() { | ||
const contentElements = [this.renderTitle(), this.renderIcons()]; | ||
const content = (this.getAttribute('icon-position') === 'right' ? contentElements : contentElements.reverse()).join('\n'); | ||
return ` | ||
<div ${this.htmlAttributes({ | ||
class: 'mj-accordion-title' | ||
})}> | ||
class: 'mj-accordion-title' | ||
})}> | ||
<table | ||
${this.htmlAttributes({ | ||
'cell-spacing': '0', | ||
'cell-padding': '0', | ||
style: 'table' | ||
})} | ||
'cell-spacing': '0', | ||
'cell-padding': '0', | ||
style: 'table' | ||
})} | ||
> | ||
@@ -114,6 +136,7 @@ <tbody> | ||
`; | ||
} | ||
} | ||
}]); | ||
return MjAccordionTitle; | ||
}(_mjmlCore.BodyComponent); | ||
} | ||
exports.default = MjAccordionTitle; | ||
@@ -120,0 +143,0 @@ (0, _defineProperty2.default)(MjAccordionTitle, "componentName", 'mj-accordion-title'); |
{ | ||
"name": "mjml-accordion", | ||
"description": "mjml-accordion", | ||
"version": "4.8.1", | ||
"version": "4.8.2", | ||
"main": "lib/index.js", | ||
@@ -26,3 +26,3 @@ "files": [ | ||
"lodash": "^4.17.15", | ||
"mjml-core": "4.8.1" | ||
"mjml-core": "4.8.2" | ||
}, | ||
@@ -33,3 +33,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "45507ebde835129ba62671d341e76bc9892552c9" | ||
"gitHead": "67cb33b5edd2b1d80436a72c213d2e815a685cd5" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26134
522
+ Addedmjml-core@4.8.2(transitive)
+ Addedmjml-migrate@4.8.2(transitive)
+ Addedmjml-parser-xml@4.8.2(transitive)
+ Addedmjml-validator@4.8.2(transitive)
- Removedmjml-core@4.8.1(transitive)
- Removedmjml-migrate@4.8.1(transitive)
- Removedmjml-parser-xml@4.8.1(transitive)
- Removedmjml-validator@4.8.1(transitive)
Updatedmjml-core@4.8.2