You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

@api-components/api-form-mixin

Package Overview
Dependencies
Maintainers
3
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@api-components/api-form-mixin - npm Package Compare versions

Comparing version

to
3.1.2

src/Utils.d.ts

21

CHANGELOG.md

@@ -272,1 +272,22 @@ <a name="2.0.1"></a>

<a name="3.1.2"></a>
## [3.1.2](https://github.com/advanced-rest-client/api-form-mixin/compare/3.1.0...3.1.2) (2020-05-15)
### Build
* bumping version [86b7f9e](https://github.com/advanced-rest-client/api-form-mixin/commit/86b7f9eec37f436ab4162aa2e824b229793cdddd) by Pawel
* bumping version [a51192a](https://github.com/advanced-rest-client/api-form-mixin/commit/a51192af69b813c0d225aa0596c51c457731443e) by Pawel
### Update
* [ci skip] automated merge master->stage. syncing main branches [a0e1656](https://github.com/advanced-rest-client/api-form-mixin/commit/a0e16564b8a38fa3fe6c7b8fadb19691cb9617fc) by Ci agent
* updating project to open-wc standards [7101c88](https://github.com/advanced-rest-client/api-form-mixin/commit/7101c8831cb93b21aec9b980f06eb5884d36e4f4) by Pawel
* [ci skip] automated merge master->stage. syncing main branches [b8328cd](https://github.com/advanced-rest-client/api-form-mixin/commit/b8328cd2bbdaaf4a3e88c20a1730e0a3355b07b1) by Ci agent
### Refactor
* moving unrelated to component instance logic to a helper [f852f77](https://github.com/advanced-rest-client/api-form-mixin/commit/f852f777cb4c96bbdabaa06e028a30f8eefd2ddb) by Pawel

4

package.json
{
"name": "@api-components/api-form-mixin",
"description": "A mixin that contains common properties, methods and styles for components that implements AMF based forms",
"version": "3.1.1",
"version": "3.1.2",
"license": "Apache-2.0",

@@ -73,3 +73,3 @@ "main": "index.js",

"singleQuote": true,
"arrowParens": "avoid"
"arrowParens": "always"
},

@@ -76,0 +76,0 @@ "husky": {

import { ApiViewModel } from '@api-components/api-view-model-transformer';
import * as Utils from './Utils.js';

@@ -33,3 +34,3 @@ /* eslint-disable class-methods-use-this */

*/
export const ApiFormMixin = base =>
export const ApiFormMixin = (base) =>
class extends base {

@@ -195,15 +196,8 @@ static get properties() {

) {
let clazz = 'param-value';
if (item && item.required) {
clazz += ' required';
} else if (allowHideOptional) {
clazz += ' optional';
}
if (optionalOpened) {
clazz += ' with-optional';
}
if (allowDisableParams) {
clazz += ' has-enable-button';
}
return clazz;
return Utils.rowClass(
item,
allowHideOptional,
optionalOpened,
allowDisableParams
);
}

@@ -272,6 +266,3 @@

_computeHasOptionalParameters(allowHideOptional, model) {
if (!allowHideOptional || !model) {
return false;
}
return model.some(item => item.required === false);
return Utils.hasOptionalParameters(allowHideOptional, model);
}

@@ -287,3 +278,3 @@

_computeRenderCheckbox(render, has) {
return render && has;
return Utils.renderCheckbox(render, has);
}

@@ -299,6 +290,3 @@

_computeIsCustom(model) {
if (!model || !model.schema || !model.schema.isCustom) {
return false;
}
return true;
return Utils.isCustom(model);
}

@@ -370,9 +358,3 @@

computeIsOptional(hasOptional, model) {
if (!hasOptional) {
return false;
}
if (!model || !model.required) {
return true;
}
return false;
return Utils.isOptional(hasOptional, model);
}

@@ -384,7 +366,7 @@

* @param {Boolean} allowCustom True if the form allows to add custom values.
* @param {?Array} model Current model
* @param {Array=} model Current model
* @return {Boolean} `true` when allowCustom is falsy set and model is empty
*/
_computeRenderEmptyMessage(allowCustom, model) {
return !allowCustom && !model;
return Utils.canRenderEmptyMessage(allowCustom, model);
}

@@ -391,0 +373,0 @@

@@ -22,49 +22,50 @@ import { css } from 'lit-element';

export default css`
.form-item {
display: flex;
flex-direction: row;
align-items: center;
}
.form-item {
display: flex;
flex-direction: row;
align-items: center;
}
:host([narrow]) .form-item,
.narrow .form-item {
display: block;
}
:host([narrow]) .form-item,
.narrow .form-item {
display: block;
}
.form-item[data-optional] {
display: none;
}
.form-item[data-optional] {
display: none;
}
:host([optionalopened]) [data-optional] {
display: flex;
flex-direction: row;
}
/* styling form inline markdown */
arc-marked {
background-color: var(--inline-documentation-background-color, #FFF3E0);
padding: 4px;
/* Default inputs margin */
margin: 0 8px;
}
/* wrapped for arc-marked */
.docs {
font-size: var(--arc-font-body1-font-size);
font-weight: var(--arc-font-body1-font-weight);
line-height: var(--arc-font-body1-line-height);
color: var(--inline-documentation-color, rgba(0, 0, 0, 0.87));
margin-right: 40px;
}
:host([optionalopened]) [data-optional] {
display: flex;
flex-direction: row;
}
/* styling form inline markdown */
arc-marked {
background-color: var(--inline-documentation-background-color, #fff3e0);
padding: 4px;
/* Default inputs margin */
margin: 0 8px;
}
/* wrapped for arc-marked */
.docs {
font-size: var(--arc-font-body1-font-size);
font-weight: var(--arc-font-body1-font-weight);
line-height: var(--arc-font-body1-line-height);
color: var(--inline-documentation-color, rgba(0, 0, 0, 0.87));
margin-right: 40px;
}
.markdown-body * {
font-size: var(--inline-documentation-font-size, 13px) !important;
}
.markdown-body * {
font-size: var(--inline-documentation-font-size, 13px) !important;
}
.markdown-body p:first-child {
margin-top: 0;
padding-top: 0;
}
.markdown-body p:first-child {
margin-top: 0;
padding-top: 0;
}
.markdown-body p:last-child {
margin-bottom: 0;
padding-bottom: 0;
}`;
.markdown-body p:last-child {
margin-bottom: 0;
padding-bottom: 0;
}
`;