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

filter-tree

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

filter-tree - npm Package Compare versions

Comparing version 0.3.34 to 0.3.35

75

js/FilterLeaf.js

@@ -199,2 +199,23 @@ /* eslint-env browser */

if (value === '' && elementName === 'operator') {
var ops = this.root.conditionals.ops,
op = ops[this.operator];
if (op) {
if (getProperty.call(this, this.column, 'opMustBeInMenu')) {
// Operator not found in menu because may be a synonym.
// Check each menu item's op object for equivalency to possible synonym's.
var opMenu = getOpMenu.call(this, this.column);
popMenu.walk.call(opMenu, function(opMenuItem) {
var opName = opMenuItem.name || opMenuItem;
if (ops[opName] === op) {
value = opName;
}
});
} else {
value = this.operator;
}
}
}
if (value === '') {

@@ -224,16 +245,7 @@ if (!focused && options && options.focus) {

getType: function() {
return (
this.op.type // the expression's operator's type (because some operators only work with strings)
||
(this.schema.lookup(this.column) || {}).type // the expression's column schema type
||
this.type // the expression node's type
);
return this.op.type || getProperty.call(this, this.column, 'type');
},
getCalculator: function() {
return (
(this.schema.lookup(this.column) || {}).calculator || // the expression's column schema calculator
this.calculator // the expression node's calculator
);
return getProperty.call(this, this.column, 'calculator');
},

@@ -395,3 +407,3 @@

* Moves focus to next non-blank sibling control.
* @this Bound to this node.
* @this {FilterLeaf}
*/

@@ -431,13 +443,42 @@ function cleanUpAndMoveOn(evt) {

function getOpMenu(columnName) {
var column = this.schema.lookup(columnName) || {};
/**
* @summary Get the node property.
* @desc Priority ladder:
* 1. Schema property.
* 2. Mixin (if given).
* 3. Node property is final priority.
* @this {FilterLeaf}
* @param {string} columnName
* @param {string} propertyName
* @param {function|boolean} [mixin] - Optional function or value if schema property undefined. If function, called in context with `propertyName` and `columnName`.
* @returns {object}
*/
function getProperty(columnName, propertyName, mixin) {
var columnSchema = this.schema.lookup(columnName) || {};
return (
column.opMenu
columnSchema[propertyName] // the expression's column schema property
||
this.typeOpMap && this.typeOpMap[column.type || this.type]
typeof mixin === 'function' && mixin.call(this, columnSchema, propertyName)
||
this.opMenu
typeof mixin !== 'function' && mixin
||
this[propertyName] // the expression node's property
);
}
/**
* @this {FilterLeaf}
* @param {string} columnName
* @returns {undefined|menuItem[]}
*/
function getOpMenu(columnName) {
return getProperty.call(this, columnName, 'opMenu', function(columnSchema) {
return this.typeOpMap && this.typeOpMap[columnSchema.type || this.type];
});
}
/**
* @this {FilterLeaf}
* @param {string} columnName
*/
function makeOpMenu(columnName) {

@@ -444,0 +485,0 @@ var opMenu = getOpMenu.call(this, columnName);

@@ -446,2 +446,10 @@ /* eslint-env browser */

/** @summary Truthy considers op valid only if in menu.
* @desc Otherwise, op is valid if in `this.root.conditionals.ops`.
* > This docs entry describes a property in the FilterNode prototype. It does not describe the optionsSchema property (despite it's position in the source code).
* @type {boolean}
* @memberOf FilterNode.optionsSchema
*/
opMustBeInMenu: {},
typeOpMap: { rootBound: true },

@@ -448,0 +456,0 @@

{
"name": "filter-tree",
"version": "0.3.34",
"version": "0.3.35",
"description": "Complex table filter expressions with GUI editor.",

@@ -5,0 +5,0 @@ "repository": {

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