New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@vaadin/vaadin-crud

Package Overview
Dependencies
Maintainers
14
Versions
265
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vaadin/vaadin-crud - npm Package Compare versions

Comparing version 1.0.0-beta1 to 1.0.0

src/vaadin-crud-include-mixin.js

3

package.json

@@ -13,3 +13,3 @@ {

"name": "@vaadin/vaadin-crud",
"version": "1.0.0-beta1",
"version": "1.0.0",
"main": "vaadin-crud.js",

@@ -55,3 +55,2 @@ "author": "Vaadin Ltd",

"@vaadin/vaadin-demo-helpers": "^2.0.0",
"@polymer/iron-ajax": "^3.0.0-pre.18",
"@vaadin/vaadin-dropdown-menu": "^1.1.0",

@@ -58,0 +57,0 @@ "@vaadin/vaadin-item": "^2.1.0",

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

import '@vaadin/vaadin-text-field/src/vaadin-text-field.js';
import { IncludedMixin } from './vaadin-crud-include-mixin.js';

@@ -20,4 +21,5 @@ /**

* @memberof Vaadin
* @mixes Vaadin.Crud.IncludedMixin
*/
class CrudFormElement extends (class extends FormLayoutElement {}) {
class CrudFormElement extends IncludedMixin(class extends FormLayoutElement {}) {
static get is() {

@@ -30,25 +32,2 @@ return 'vaadin-crud-form';

/**
* A list of item fields that should not be mapped to form fields.
*
* When [`include`](#/elements/vaadin-crud-form#property-include) is defined, this property is ignored.
*
* Default is to exclude any private property.
*
* @type{String|RegExp}
*/
exclude: {
value: '^_',
observer: '__onExcludeChange'
},
/**
* A list of item properties that should be mapped to form fields.
*
* When it is defined [`exclude`](#/elements/vaadin-crud-form#property-exclude) is ignored.
*
* @type{String|Array}
*/
include: {
observer: '__onIncludeChange'
},
/**
* The item being edited.

@@ -65,7 +44,7 @@ */

/**
* Autogenerate fields for edition based on the JSON structure of the object provided.
* Autogenerate form fields based on the JSON structure of the object provided.
*
* If not already called, the method will be executed the first time an item is assigned.
* If not called, the method will be executed the first time an item is assigned.
*/
configure(object) {
_configure(object) {
this.innerHTML = '';

@@ -77,21 +56,5 @@ this._fields = [];

__onExcludeChange(exclude) {
if (typeof exclude == 'string') {
this.exclude = exclude ? RegExp(exclude.replace(/, */g, '|'), 'i') : undefined;
}
}
__onIncludeChange(include) {
if (typeof include == 'string') {
this.include = include ? include.split(/, */) : undefined;
} else if (!this._fields && Array.isArray(include)) {
const item = {};
this.include.forEach(path => this.__set(path, null, item));
this.configure(item);
}
}
__onItemChange(item) {
if (!this._fields) {
this.configure(item);
this._configure(item);
}

@@ -98,0 +61,0 @@ }

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

import '@vaadin/vaadin-grid/src/vaadin-grid-filter.js';
import { IncludedMixin } from './vaadin-crud-include-mixin.js';
import './vaadin-crud-edit-column.js';

@@ -24,4 +25,5 @@

* @memberof Vaadin
* @mixes Vaadin.Crud.IncludedMixin
*/
class CrudGridElement extends (class extends GridElement {}) {
class CrudGridElement extends IncludedMixin(class extends GridElement {}) {
static get is() {

@@ -44,27 +46,3 @@ return 'vaadin-crud-grid';

*/
noHead: Boolean,
/**
* A list of item fields that should not be mapped to columns.
*
* When [`include`](#/elements/vaadin-crud-grid#property-include) is defined, this property is ignored.
*
* Default is to exclude any private property.
*
* @type{String|RegExp}
*/
exclude: {
type: String,
value: '^_',
observer: '__onExcludeChange'
},
/**
* A list of item properties that should be mapped to columns.
*
* When it is defined [`exclude`](#/elements/vaadin-crud-grid#property-exclude) is ignored.
*
* @type{String|Array}
*/
include: {
observer: '__onIncludeChange'
}
noHead: Boolean
};

@@ -77,21 +55,5 @@ }

__onExcludeChange(exclude) {
if (typeof exclude == 'string') {
this.exclude = exclude ? RegExp(exclude.replace(/, */g, '|'), 'i') : undefined;
}
}
__onIncludeChange(include) {
if (typeof include == 'string') {
this.include = include ? include.split(/, */) : undefined;
} else if (!this._fields && Array.isArray(include)) {
const item = {};
this.include.forEach(path => this.__set(path, null, item));
this.__configure(item);
}
}
__onItemsChange(items) {
if ((!this.dataProvider || this.dataProvider == this._arrayDataProvider) && !this.include && items && items[0]) {
this.__configure(items[0]);
this._configure(items[0]);
}

@@ -103,3 +65,3 @@ }

if (this.innerHTML == '' && !this.include && items[0]) {
this.__configure(items[0]);
this._configure(items[0]);
}

@@ -125,3 +87,8 @@ callback(items, size);

__configure(item) {
/**
* Autogenerate grid columns based on the JSON structure of the object provided.
*
* Method will be executed when items or dataProvider is assigned.
*/
_configure(item) {
this.innerHTML = '';

@@ -128,0 +95,0 @@ this.__createColumns(this, item);

@@ -176,3 +176,3 @@ /**

static get version() {
return '1.0.0-beta1';
return '1.0.0';
}

@@ -488,5 +488,5 @@

if (item) {
if (!this._fields.length && this._form.configure) {
if (!this._fields.length && this._form._configure) {
if (this.__model) {
this._form.configure(this.__model);
this._form._configure(this.__model);
} else {

@@ -493,0 +493,0 @@ console.warn('<vaadin-crud> Unable to autoconfigure form because the data structure is unknown. ' +

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