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

@react-awesome-query-builder/core

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-awesome-query-builder/core - npm Package Compare versions

Comparing version 6.0.0-beta.3 to 6.0.0-beta.4

.babelrc.js

24

modules/actions/tree.js

@@ -1,2 +0,2 @@

import {List, Map} from "immutable";
import Immutable from "immutable";
import {toImmutableList} from "../utils/stuff";

@@ -10,3 +10,3 @@ import * as constants from "../stores/constants";

* @param {object} config
* @param {Map} tree
* @param {Immutable.Map} tree
*/

@@ -21,4 +21,4 @@ export const setTree = (config, tree) => ({

* @param {object} config
* @param {List} path
* @param {Map} properties
* @param {Immutable.List} path
* @param {Immutable.Map} properties
*/

@@ -37,3 +37,3 @@ export const addRule = (config, path, properties, ruleType = "rule", children = null) => ({

* @param {object} config
* @param {List} path
* @param {Immutable.List} path
*/

@@ -48,4 +48,4 @@ export const removeRule = (config, path) => ({

* @param {object} config
* @param {List} path
* @param {Map} properties
* @param {Immutable.List} path
* @param {Immutable.Map} properties
*/

@@ -66,4 +66,4 @@ export const addDefaultCaseGroup = (config, path, properties, children = null) => ({

* @param {object} config
* @param {List} path
* @param {Map} properties
* @param {Immutable.List} path
* @param {Immutable.Map} properties
*/

@@ -81,4 +81,4 @@ export const addCaseGroup = (config, path, properties, children = null) => ({

* @param {object} config
* @param {List} path
* @param {Map} properties
* @param {Immutable.List} path
* @param {Immutable.Map} properties
*/

@@ -96,3 +96,3 @@ export const addGroup = (config, path, properties, children = null) => ({

* @param {object} config
* @param {List} path
* @param {Immutable.List} path
*/

@@ -99,0 +99,0 @@ export const removeGroup = (config, path) => ({

@@ -1,2 +0,2 @@

import { fromJS, Map, List, isIndexed, OrderedMap } from "immutable";
import Immutable, { fromJS, Map } from "immutable";
import {validateTree} from "../utils/validation";

@@ -70,3 +70,3 @@ import {extendConfig} from "../utils/configUtils";

// only for raw values keep JS representation
outValue = List.of(valueJs);
outValue = Immutable.List.of(valueJs);
}

@@ -76,6 +76,6 @@ } else if (key == "asyncListValues") {

outValue = value.toJS();
} else if (key == "children1" && isIndexed(value)) {
outValue = new OrderedMap(value.map(child => [child.get("id"), child]));
} else if (key == "children1" && Immutable.Iterable.isIndexed(value)) {
outValue = new Immutable.OrderedMap(value.map(child => [child.get("id"), child]));
} else {
outValue = isIndexed(value) ? value.toList() : value.toOrderedMap();
outValue = Immutable.Iterable.isIndexed(value) ? value.toList() : value.toOrderedMap();
}

@@ -82,0 +82,0 @@ return outValue;

@@ -1,2 +0,2 @@

import { List, Map, OrderedMap } from "immutable";
import Immutable from "immutable";
import {

@@ -26,4 +26,4 @@ expandTreePath, expandTreeSubpath, getItemByPath, fixPathsInTree,

* @param {object} config
* @param {List} path
* @param {Map} properties
* @param {Immutable.List} path
* @param {Immutable.Map} properties
*/

@@ -40,3 +40,3 @@ const addNewGroup = (state, path, type, groupUuid, properties, config, children = null, meta = {}) => {

if (!children && !isDefaultCase) {
state = state.setIn(expandTreePath(groupPath, "children1"), new OrderedMap());
state = state.setIn(expandTreePath(groupPath, "children1"), new Immutable.OrderedMap());

@@ -57,4 +57,4 @@ // Add one empty rule into new group

* @param {object} config
* @param {List} path
* @param {Map} properties
* @param {Immutable.List} path
* @param {Immutable.Map} properties
*/

@@ -73,3 +73,3 @@ const removeGroup = (state, path, config) => {

// if whole query is empty, add one empty rule to root
state = addItem(state, new List(), "rule", uuid(), defaultRuleProperties(config), config);
state = addItem(state, new Immutable.List(), "rule", uuid(), defaultRuleProperties(config), config);
}

@@ -83,3 +83,3 @@ }

* @param {object} config
* @param {List} path
* @param {Immutable.List} path
*/

@@ -117,3 +117,3 @@ const removeRule = (state, path, config) => {

// if whole query is empty, add one empty rule to root
state = addItem(state, new List(), "rule", uuid(), defaultRuleProperties(config), config);
state = addItem(state, new Immutable.List(), "rule", uuid(), defaultRuleProperties(config), config);
}

@@ -126,4 +126,4 @@ }

/**
* @param {Map} state
* @param {List} path
* @param {Immutable.Map} state
* @param {Immutable.List} path
* @param {bool} not

@@ -135,4 +135,4 @@ */

/**
* @param {Map} state
* @param {List} path
* @param {Immutable.Map} state
* @param {Immutable.List} path
* @param {bool} lock

@@ -144,4 +144,4 @@ */

/**
* @param {Map} state
* @param {List} path
* @param {Immutable.Map} state
* @param {Immutable.List} path
* @param {string} conjunction

@@ -155,3 +155,3 @@ */

if (children && Array.isArray(children)) {
item.children1 = new OrderedMap(
item.children1 = new Immutable.OrderedMap(
children.reduce((map, it) => {

@@ -168,3 +168,3 @@ const id1 = uuid();

...map,
[id1]: new Map(it1)
[id1]: new Immutable.Map(it1)
};

@@ -177,7 +177,7 @@ }, {})

/**
* @param {Map} state
* @param {List} path
* @param {Immutable.Map} state
* @param {Immutable.List} path
* @param {string} type
* @param {string} id
* @param {OrderedMap} properties
* @param {Immutable.OrderedMap} properties
* @param {object} config

@@ -218,4 +218,4 @@ */

if (canAdd) {
const newChildren = new OrderedMap({
[id]: new Map(item)
const newChildren = new Immutable.OrderedMap({
[id]: new Immutable.Map(item)
});

@@ -226,4 +226,4 @@ if (!hasChildren) {

const last = targetChildren.last();
const newChildrenWithLast = new OrderedMap({
[id]: new Map(item),
const newChildrenWithLast = new Immutable.OrderedMap({
[id]: new Immutable.Map(item),
[last.get("id")]: last

@@ -242,4 +242,4 @@ });

/**
* @param {Map} state
* @param {List} path
* @param {Immutable.Map} state
* @param {Immutable.List} path
*/

@@ -253,5 +253,5 @@ const removeItem = (state, path) => {

/**
* @param {Map} state
* @param {List} fromPath
* @param {List} toPath
* @param {Immutable.Map} state
* @param {Immutable.List} fromPath
* @param {Immutable.List} toPath
* @param {string} placement, see constants PLACEMENT_*: PLACEMENT_AFTER, PLACEMENT_BEFORE, PLACEMENT_APPEND, PLACEMENT_PREPEND

@@ -284,5 +284,5 @@ * @param {object} config

if (isSourceInsideTarget) {
sourceSubpathFromTarget = List(sourcePath.toArray().slice(targetPath.size));
sourceSubpathFromTarget = Immutable.List(sourcePath.toArray().slice(targetPath.size));
} else if (isTargetInsideSource) {
targetSubpathFromSource = List(targetPath.toArray().slice(sourcePath.size));
targetSubpathFromSource = Immutable.List(targetPath.toArray().slice(sourcePath.size));
}

@@ -300,3 +300,3 @@

if (placement == constants.PLACEMENT_BEFORE || placement == constants.PLACEMENT_AFTER) {
newTargetChildren = OrderedMap().withMutations(r => {
newTargetChildren = Immutable.OrderedMap().withMutations(r => {
for (let [itemId, item] of newTargetChildren.entries()) {

@@ -317,3 +317,3 @@ if (itemId == to.get("id") && placement == constants.PLACEMENT_BEFORE) {

} else if (placement == constants.PLACEMENT_PREPEND) {
newTargetChildren = OrderedMap({[from.get("id")]: from}).merge(newTargetChildren);
newTargetChildren = Immutable.OrderedMap({[from.get("id")]: from}).merge(newTargetChildren);
}

@@ -337,4 +337,4 @@

/**
* @param {Map} state
* @param {List} path
* @param {Immutable.Map} state
* @param {Immutable.List} path
* @param {string} field

@@ -362,4 +362,4 @@ */

const _currentValue = currentProperties.get("value");
const _currentValueSrc = currentProperties.get("valueSrc", new List());
const _currentValueType = currentProperties.get("valueType", new List());
const _currentValueSrc = currentProperties.get("valueSrc", new Immutable.List());
const _currentValueType = currentProperties.get("valueType", new Immutable.List());

@@ -394,3 +394,3 @@ // If the newly selected field supports the same operator the rule currently

state = state.deleteIn(expandTreePath(path, "children1"));
state = state.setIn(expandTreePath(path, "properties"), new OrderedMap());
state = state.setIn(expandTreePath(path, "properties"), new Immutable.OrderedMap());
}

@@ -415,3 +415,3 @@

}
state = state.setIn(expandTreePath(path, "children1"), new OrderedMap());
state = state.setIn(expandTreePath(path, "children1"), new Immutable.OrderedMap());
state = state.setIn(expandTreePath(path, "properties"), groupProperties);

@@ -450,4 +450,4 @@ if (newFieldConfig.initialEmptyWhere && operatorCardinality == 1) { // just `COUNT(grp) > 1` without `HAVING ..`

/**
* @param {Map} state
* @param {List} path
* @param {Immutable.Map} state
* @param {Immutable.List} path
* @param {string} operator

@@ -469,4 +469,4 @@ */

const currentOperatorOptions = current.get("operatorOptions");
const _currentValue = current.get("value", new List());
const _currentValueSrc = current.get("valueSrc", new List());
const _currentValue = current.get("value", new Immutable.List());
const _currentValueSrc = current.get("valueSrc", new Immutable.List());
const _currentOperator = current.get("operator");

@@ -506,4 +506,4 @@

/**
* @param {Map} state
* @param {List} path
* @param {Immutable.Map} state
* @param {Immutable.List} path
* @param {integer} delta

@@ -557,5 +557,5 @@ * @param {*} value

state = state
.setIn(expandTreePath(path, "properties", "value"), new List(new Array(operatorCardinality)))
.setIn(expandTreePath(path, "properties", "valueType"), new List(new Array(operatorCardinality)))
.setIn(expandTreePath(path, "properties", "valueError"), new List(new Array(operatorCardinality)));
.setIn(expandTreePath(path, "properties", "value"), new Immutable.List(new Array(operatorCardinality)))
.setIn(expandTreePath(path, "properties", "valueType"), new Immutable.List(new Array(operatorCardinality)))
.setIn(expandTreePath(path, "properties", "valueError"), new Immutable.List(new Array(operatorCardinality)));
}

@@ -594,4 +594,4 @@

/**
* @param {Map} state
* @param {List} path
* @param {Immutable.Map} state
* @param {Immutable.List} path
* @param {integer} delta

@@ -646,4 +646,4 @@ * @param {*} srcKey

/**
* @param {Map} state
* @param {List} path
* @param {Immutable.Map} state
* @param {Immutable.List} path
* @param {string} name

@@ -657,3 +657,3 @@ * @param {*} value

/**
* @param {Map} state
* @param {Immutable.Map} state
*/

@@ -734,3 +734,3 @@ const checkEmptyGroups = (state, config) => {

/**
* @param {Map} state
* @param {Immutable.Map} state
* @param {object} action

@@ -737,0 +737,0 @@ */

@@ -1,2 +0,2 @@

import {Map, List, OrderedMap} from "immutable";
import Immutable from "immutable";
import uuid from "./uuid";

@@ -30,4 +30,4 @@ import {getFieldConfig, getOperatorConfig} from "./configUtils";

if (!operatorConfig)
return null; //new Map();
return operatorConfig.options ? new Map(
return null; //new Immutable.Map();
return operatorConfig.options ? new Immutable.Map(
operatorConfig.options

@@ -48,7 +48,7 @@ && operatorConfig.options.defaults || {}

}
let current = new Map({
let current = new Immutable.Map({
field: field,
operator: operator,
value: new List(),
valueSrc: new List(),
value: new Immutable.List(),
valueSrc: new Immutable.List(),
//used for complex operators like proximity

@@ -58,3 +58,3 @@ operatorOptions: defaultOperatorOptions(config, operator, field),

if (showErrorMessage) {
current = current.set("valueError", new List());
current = current.set("valueError", new Immutable.List());
}

@@ -90,3 +90,3 @@

export const defaultGroupProperties = (config, fieldConfig = null) => new Map({
export const defaultGroupProperties = (config, fieldConfig = null) => new Immutable.Map({
conjunction: defaultGroupConjunction(config, fieldConfig),

@@ -103,3 +103,3 @@ not: false

export const defaultRule = (id, config) => ({
[id]: new Map({
[id]: new Immutable.Map({
type: "rule",

@@ -112,6 +112,6 @@ id: id,

export const defaultRoot = (config) => {
return new Map({
return new Immutable.Map({
type: "group",
id: uuid(),
children1: new OrderedMap({ ...defaultRule(uuid(), config) }),
children1: new Immutable.OrderedMap({ ...defaultRule(uuid(), config) }),
properties: defaultGroupProperties(config)

@@ -122,5 +122,5 @@ });

export const createListFromArray = (ids) => {
return new List(ids);
return new Immutable.List(ids);
};
export const emptyProperies = () => new Map();
export const emptyProperies = () => new Immutable.Map();
import {getFieldConfig, getFuncConfig} from "../utils/configUtils";
import {filterValueSourcesForField} from "../utils/ruleUtils";
import { Map, isIndexed, fromJS } from "immutable";
import Immutable from "immutable";

@@ -23,5 +23,5 @@ // helpers

/**
* @param {Map} value
* @param {Immutable.Map} value
* @param {object} config
* @return {Map | undefined} - undefined if func value is not complete (missing required arg vals); can return completed value != value
* @return {Immutable.Map | undefined} - undefined if func value is not complete (missing required arg vals); can return completed value != value
*/

@@ -77,3 +77,3 @@ export const completeFuncValue = (value, config) => {

/**
* @param {Map} value
* @param {Immutable.Map} value
* @return {array} - [usedFields, badFields]

@@ -112,3 +112,3 @@ */

* Used @ FuncWidget
* @param {Map} value
* @param {Immutable.Map} value
* @param {string} funcKey

@@ -119,3 +119,3 @@ * @param {object} config

const fieldSeparator = config.settings.fieldSeparator;
value = value || new Map();
value = value || new Immutable.Map();
if (Array.isArray(funcKey)) {

@@ -126,3 +126,3 @@ // fix for cascader

value = value.set("func", funcKey);
value = value.set("args", new Map());
value = value.set("args", new Immutable.Map());

@@ -152,5 +152,5 @@ // defaults

const getDefaultArgValue = ({defaultValue: value}) => {
if (isObject(value) && !Map.isMap(value) && value.func) {
return fromJS(value, function (k, v) {
return isIndexed(v) ? v.toList() : v.toOrderedMap();
if (isObject(value) && !Immutable.Map.isMap(value) && value.func) {
return Immutable.fromJS(value, function (k, v) {
return Immutable.Iterable.isIndexed(v) ? v.toList() : v.toOrderedMap();
});

@@ -163,3 +163,3 @@ }

* Used @ FuncWidget
* @param {Map} value
* @param {Immutable.Map} value
* @param {string} argKey

@@ -186,3 +186,3 @@ * @param {*} argVal

* Used @ FuncWidget
* @param {Map} value
* @param {Immutable.Map} value
* @param {string} argKey

@@ -194,5 +194,5 @@ * @param {string} argValSrc

if (value && value.get("func")) {
value = value.setIn(["args", argKey], new Map({valueSrc: argValSrc}));
value = value.setIn(["args", argKey], new Immutable.Map({valueSrc: argValSrc}));
}
return value;
};

@@ -5,3 +5,3 @@ import {

import {defaultValue, getFirstDefined} from "../utils/stuff";
import {Map, List} from "immutable";
import Immutable from "immutable";
import {validateValue} from "../utils/validation";

@@ -20,3 +20,3 @@ import last from "lodash/last";

* @param {object} oldConfig
* @param {Map} current
* @param {Immutable.Map} current
* @param {string} newField

@@ -33,4 +33,4 @@ * @param {string} newOperator

const currentValue = current.get("value");
const currentValueSrc = current.get("valueSrc", new List());
const currentValueType = current.get("valueType", new List());
const currentValueSrc = current.get("valueSrc", new Immutable.List());
const currentValueType = current.get("valueType", new Immutable.List());
const currentAsyncListValues = current.get("asyncListValues");

@@ -117,3 +117,3 @@

let newValue = null, newValueSrc = null, newValueType = null, newValueError = null;
newValue = new List(Array.from({length: operatorCardinality}, (_ignore, i) => {
newValue = new Immutable.List(Array.from({length: operatorCardinality}, (_ignore, i) => {
let v = undefined;

@@ -137,3 +137,3 @@ if (canReuseValue) {

newValueSrc = new List(Array.from({length: operatorCardinality}, (_ignore, i) => {
newValueSrc = new Immutable.List(Array.from({length: operatorCardinality}, (_ignore, i) => {
let vs = null;

@@ -162,6 +162,6 @@ if (canReuseValue) {

}
newValueError = new List(valueErrors);
newValueError = new Immutable.List(valueErrors);
}
newValueType = new List(Array.from({length: operatorCardinality}, (_ignore, i) => {
newValueType = new Immutable.List(Array.from({length: operatorCardinality}, (_ignore, i) => {
let vt = null;

@@ -168,0 +168,0 @@ if (canReuseValue) {

@@ -1,2 +0,2 @@

import { Map, List } from "immutable";
import Immutable, { Map } from "immutable";

@@ -113,3 +113,3 @@ // RegExp.quote = function (str) {

export function toImmutableList(v) {
return (isImmutable(v) ? v : new List(v));
return (isImmutable(v) ? v : new Immutable.List(v));
}

@@ -116,0 +116,0 @@

@@ -1,7 +0,7 @@

import { Map, List, OrderedMap } from "immutable";
import Immutable from "immutable";
/**
* @param {List} path
* @param {Immutable.List} path
* @param {...string} suffix
* @return {List}
* @return {Immutable.List}
*/

@@ -17,5 +17,5 @@ export const expandTreePath = (path, ...suffix) =>

/**
* @param {List} path
* @param {Immutable.List} path
* @param {...string} suffix
* @return {List}
* @return {Immutable.List}
*/

@@ -30,8 +30,8 @@ export const expandTreeSubpath = (path, ...suffix) =>

/**
* @param {Map} path
* @param {List} path
* @return {Map}
* @param {Immutable.Map} path
* @param {Immutable.List} path
* @return {Immutable.Map}
*/
export const getItemByPath = (tree, path) => {
let children = new OrderedMap({ [tree.get("id")] : tree });
let children = new Immutable.OrderedMap({ [tree.get("id")] : tree });
let res = tree;

@@ -48,4 +48,4 @@ path.forEach((id) => {

* Remove `path` in every item
* @param {Map} tree
* @return {Map} tree
* @param {Immutable.Map} tree
* @return {Immutable.Map} tree
*/

@@ -69,3 +69,3 @@ export const removePathsInTree = (tree) => {

_processNode(tree, new List());
_processNode(tree, new Immutable.List());

@@ -78,4 +78,4 @@ return newTree;

* Remove `isLocked` in items that inherit parent's `isLocked`
* @param {Map} tree
* @return {Map} tree
* @param {Immutable.Map} tree
* @return {Immutable.Map} tree
*/

@@ -100,3 +100,3 @@ export const removeIsLockedInTree = (tree) => {

_processNode(tree, new List());
_processNode(tree, new Immutable.List());

@@ -109,4 +109,4 @@ return newTree;

* Set correct `path` and `id` in every item
* @param {Map} tree
* @return {Map} tree
* @param {Immutable.Map} tree
* @return {Immutable.Map} tree
*/

@@ -135,3 +135,3 @@ export const fixPathsInTree = (tree) => {

expandTreePath(itemPath, "children1"),
new OrderedMap(children)
new Immutable.OrderedMap(children)
);

@@ -145,3 +145,3 @@ }

_processNode(tree, new List(), 0);
_processNode(tree, new Immutable.List(), 0);

@@ -173,3 +173,3 @@

_processNode(tree, new List(), 0);
_processNode(tree, new Immutable.List(), 0);

@@ -181,3 +181,3 @@

/**
* @param {Map} tree
* @param {Immutable.Map} tree
* @return {Object} {flat, items}

@@ -276,3 +276,3 @@ */

* Returns count of reorderable(!) nodes
* @param {Map} tree
* @param {Immutable.Map} tree
* @return {Integer}

@@ -313,3 +313,3 @@ */

* Returns count of rules (leafs, i.e. don't count groups)
* @param {Map} tree
* @param {Immutable.Map} tree
* @return {Integer}

@@ -316,0 +316,0 @@ */

{
"name": "@react-awesome-query-builder/core",
"version": "6.0.0-beta.3",
"version": "6.0.0-beta.4",
"description": "User-friendly query builder for React. Core",

@@ -15,13 +15,13 @@ "repository": {

"types": "./modules/index.d.ts",
"import": "./modules/index.js",
"require": "./lib/index.js"
"import": "./esm/index.js",
"require": "./cjs/index.js"
},
"./package.json": "./package.json"
},
"main": "./lib/index.js",
"module": "./modules/index.js",
"main": "./cjs/index.js",
"module": "./esm/index.js",
"types": "./modules/index.d.ts",
"dependencies": {
"clone": "^2.1.2",
"immutable": "^4.2.1",
"immutable": "^3.8.2",
"lodash": "^4.17.21",

@@ -28,0 +28,0 @@ "moment": "^2.29.4",

Sorry, the diff of this file is not supported yet

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