Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

strapi-plugin-content-manager

Package Overview
Dependencies
Maintainers
1
Versions
276
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

strapi-plugin-content-manager - npm Package Compare versions

Comparing version 3.0.0-alpha.11.2 to 3.0.0-alpha.11.3

3

admin/src/components/Edit/index.js

@@ -151,2 +151,3 @@ /**

name={attr}
onBlur={this.props.onBlur}
onChange={this.props.onChange}

@@ -172,2 +173,3 @@ selectOptions={get(this.props.attributes, [attr, 'enum'])}

layout: {},
onBlur: () => {},
onChange: () => {},

@@ -184,2 +186,3 @@ record: {},

layout: PropTypes.object,
onBlur: PropTypes.func,
onChange: PropTypes.func,

@@ -186,0 +189,0 @@ record: PropTypes.object,

@@ -56,2 +56,8 @@ /**

);
const record = Object.keys(attributes).reduce((acc, current) => {
if (attributes[current].default) {
acc[current] = attributes[current].default;
}
return acc;
}, {});

@@ -63,2 +69,3 @@ return {

modelName,
record,
source,

@@ -65,0 +72,0 @@ };

@@ -13,3 +13,3 @@ /**

import PropTypes from 'prop-types';
import { get, includes, isEmpty, isObject, toNumber, toString, replace } from 'lodash';
import { cloneDeep, findIndex, get, includes, isEmpty, isObject, toNumber, toString, replace } from 'lodash';
import cn from 'classnames';

@@ -34,2 +34,4 @@

import { bindLayout } from 'utils/bindLayout';
import inputValidations from 'utils/inputsValidations';
import { checkFormValidity } from 'utils/formValidations';

@@ -115,2 +117,10 @@

/**
*
*
* @type {[type]}
*/
getAttributeValidations = (name) => get(this.props.editPage.formValidations, [findIndex(this.props.editPage.formValidations, ['name', name]), 'validations'], {})
/**
* Retrieve the model

@@ -122,2 +132,9 @@ * @type {Object}

/**
* Retrieve specific attribute
* @type {String} name
*/
getModelAttribute = (name) => get(this.getModelAttributes(), name);
/**
* Retrieve the model's attributes

@@ -149,5 +166,31 @@ * @return {Object}

handleBlur = ({ target }) => {
const defaultValue = get(this.getModelAttribute(target.name), 'default');
if (isEmpty(target.value) && defaultValue && target.value !== false) {
return this.props.changeData({
target: {
name: `record.${target.name}`,
value: defaultValue,
},
});
}
const errorIndex = findIndex(this.props.editPage.formErrors, ['name', target.name]);
const errors = inputValidations(target.value, this.getAttributeValidations(target.name), target.type);
const formErrors = cloneDeep(this.props.editPage.formErrors);
if (errorIndex === -1 && !isEmpty(errors)) {
formErrors.push({ name: target.name, errors });
} else if (errorIndex !== -1 && isEmpty(errors)) {
formErrors.splice(errorIndex, 1);
} else if (!isEmpty(errors)) {
formErrors.splice(errorIndex, 1, { name: target.name, errors });
}
return this.props.setFormErrors(formErrors);
}
handleChange = (e) => {
let value = e.target.value;
// Check if date

@@ -244,2 +287,3 @@ if (isObject(e.target.value) && e.target.value._isAMomentObject === true) {

modelName={this.getModelName()}
onBlur={this.handleBlur}
onChange={this.handleChange}

@@ -246,0 +290,0 @@ record={editPage.record}

@@ -52,2 +52,3 @@ /**

.update('modelName', () => action.modelName)
.update('record', () => Map(action.record))
.update('source', () => action.source);

@@ -54,0 +55,0 @@ case ON_CANCEL:

2

admin/src/translations/pl.json

@@ -18,3 +18,3 @@ {

"EditRelations.title": "Relational data",
"EditRelations.title": "Dane relacyjne",

@@ -21,0 +21,0 @@ "emptyAttributes.title": "Nie ma jeszcze żadnych atrybutów",

@@ -7,3 +7,9 @@ const _ = require('lodash');

_.forEach(params.where, (where, key) => {
qb.where(key, where[0].symbol, where[0].value);
if (_.isArray(where.value)) {
for (const value in where.value) {
qb[value ? 'where' : 'orWhere'](key, where.symbol, where.value[value])
}
} else {
qb.where(key, where.symbol, where.value);
}
});

@@ -10,0 +16,0 @@

{
"name": "strapi-plugin-content-manager",
"version": "3.0.0-alpha.11.2",
"version": "3.0.0-alpha.11.3",
"description": "A powerful UI to easily manage your data.",

@@ -27,3 +27,3 @@ "strapi": {

"react-select": "^1.0.0-rc.5",
"strapi-helper-plugin": "3.0.0-alpha.11.2"
"strapi-helper-plugin": "3.0.0-alpha.11.3"
},

@@ -30,0 +30,0 @@ "author": {

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc