@react-awesome-query-builder/ui
Advanced tools
Comparing version 6.6.3 to 6.6.4-alpha.0
@@ -56,3 +56,4 @@ "use strict"; | ||
_this.addGroup = function () { | ||
_this.props.actions.addGroup(_this.props.path); | ||
var parentRuleGroupField = itemType == "rule_group" ? _this.props.field : _this.props.parentField; | ||
_this.props.actions.addGroup(_this.props.path, undefined, undefined, parentRuleGroupField); | ||
}; | ||
@@ -66,4 +67,4 @@ _this.addCaseGroup = function () { | ||
_this.addRule = function () { | ||
var parentRuleGroupPath = itemType == "rule_group" ? _this.props.field : null; | ||
_this.props.actions.addRule(_this.props.path, undefined, undefined, undefined, parentRuleGroupPath); | ||
var parentRuleGroupField = itemType == "rule_group" ? _this.props.field : _this.props.parentField; | ||
_this.props.actions.addRule(_this.props.path, undefined, undefined, undefined, parentRuleGroupField); | ||
}; | ||
@@ -70,0 +71,0 @@ // for RuleGroup |
@@ -190,3 +190,4 @@ "use strict"; | ||
isTrueLocked = _this$props4.isTrueLocked, | ||
id = _this$props4.id; | ||
id = _this$props4.id, | ||
parentField = _this$props4.parentField; | ||
return /*#__PURE__*/_react["default"].createElement(_GroupActions.GroupActions, { | ||
@@ -204,3 +205,4 @@ key: "group-actions", | ||
isTrueLocked: isTrueLocked, | ||
id: id | ||
id: id, | ||
parentField: parentField | ||
}); | ||
@@ -244,6 +246,7 @@ } | ||
onDragStart = props.onDragStart, | ||
isLocked = props.isLocked; | ||
isLocked = props.isLocked, | ||
parentField = props.parentField; | ||
var isRuleGroup = item.get("type") == "group" && item.getIn(["properties", "field"]) != null; | ||
var type = isRuleGroup ? "rule_group" : item.get("type"); | ||
return /*#__PURE__*/_react["default"].createElement(_Item.Item, (0, _extends2["default"])({}, this.extraPropsForItem(item), { | ||
return /*#__PURE__*/_react["default"].createElement(_Item.Item, (0, _extends2["default"])({ | ||
key: item.get("id"), | ||
@@ -260,2 +263,3 @@ id: item.get("id"), | ||
children1: item.get("children1"), | ||
parentField: parentField, | ||
reordableNodesCnt: this.reordableNodesCntForItem(item), | ||
@@ -267,3 +271,3 @@ totalRulesCnt: this.totalRulesCntForItem(item), | ||
isParentLocked: isLocked | ||
})); | ||
}, this.extraPropsForItem(item))); | ||
} | ||
@@ -394,2 +398,4 @@ }, { | ||
isTrueLocked: _propTypes["default"].bool, | ||
parentField: _propTypes["default"].string, | ||
//from RuleGroup | ||
//actions | ||
@@ -396,0 +402,0 @@ handleDraggerMouseDown: _propTypes["default"].func, |
@@ -46,2 +46,3 @@ "use strict"; | ||
id = _this$props.id, | ||
parentField = _this$props.parentField, | ||
canAddGroup = _this$props.canAddGroup, | ||
@@ -54,2 +55,4 @@ canAddRule = _this$props.canAddRule, | ||
addGroupLabel = _config$settings.addGroupLabel, | ||
addSubRuleLabel = _config$settings.addSubRuleLabel, | ||
addSubGroupLabel = _config$settings.addSubGroupLabel, | ||
delGroupLabel = _config$settings.delGroupLabel, | ||
@@ -88,5 +91,5 @@ groupActionsPosition = _config$settings.groupActionsPosition, | ||
var addRuleBtn = !immutableGroupsMode && canAddRule && !isLocked && /*#__PURE__*/_react["default"].createElement(Btn, { | ||
type: "addRule", | ||
type: parentField ? "addSubRule" : "addRule", | ||
onClick: addRule, | ||
label: addRuleLabel, | ||
label: parentField ? addSubRuleLabel : addRuleLabel, | ||
readonly: isLocked, | ||
@@ -97,5 +100,5 @@ config: config, | ||
var addGroupBtn = !immutableGroupsMode && canAddGroup && !isLocked && /*#__PURE__*/_react["default"].createElement(Btn, { | ||
type: "addGroup", | ||
type: parentField ? "addSubGroup" : "addGroup", | ||
onClick: addGroup, | ||
label: addGroupLabel, | ||
label: parentField ? addSubGroupLabel : addGroupLabel, | ||
readonly: isLocked, | ||
@@ -102,0 +105,0 @@ config: config, |
@@ -73,3 +73,3 @@ "use strict"; | ||
children1: props.children1, | ||
parentField: null, | ||
parentField: props.parentField, | ||
parentReordableNodesCnt: props.parentReordableNodesCnt | ||
@@ -76,0 +76,0 @@ })); |
@@ -72,4 +72,4 @@ "use strict"; | ||
}); | ||
var addRuleBtn = !immutableGroupsMode && canAddRule && !isLocked && /*#__PURE__*/_react["default"].createElement(Btn, { | ||
type: "addRuleGroup", | ||
var addSubRuleBtn = !immutableGroupsMode && canAddRule && !isLocked && /*#__PURE__*/_react["default"].createElement(Btn, { | ||
type: "addSubRuleSimple", | ||
onClick: addRule, | ||
@@ -92,5 +92,5 @@ label: addRuleLabel, | ||
config: config | ||
}, setLockSwitch, addRuleBtn, delGroupBtn)); | ||
}, setLockSwitch, addSubRuleBtn, delGroupBtn)); | ||
} | ||
}]); | ||
}(_react.PureComponent); |
@@ -52,8 +52,2 @@ "use strict"; | ||
}; | ||
_this.canAddGroup = function () { | ||
return false; | ||
}; | ||
_this.canAddRule = function () { | ||
return true; | ||
}; | ||
_this.canDeleteGroup = function () { | ||
@@ -71,2 +65,20 @@ return true; | ||
}, { | ||
key: "canAddGroup", | ||
value: function canAddGroup() { | ||
// todo | ||
return true; | ||
// return this.props.allowFurtherNesting; | ||
} | ||
}, { | ||
key: "canAddRule", | ||
value: function canAddRule() { | ||
// todo | ||
// const maxNumberOfRules = this.props.config.settings.maxNumberOfRules; | ||
// const totalRulesCnt = this.props.totalRulesCnt; | ||
// if (maxNumberOfRules) { | ||
// return totalRulesCnt < maxNumberOfRules; | ||
// } | ||
return true; | ||
} | ||
}, { | ||
key: "renderHeaderWrapper", | ||
@@ -294,2 +306,3 @@ value: function renderHeaderWrapper() { | ||
addRule = _this$props8.addRule, | ||
addGroup = _this$props8.addGroup, | ||
isLocked = _this$props8.isLocked, | ||
@@ -301,3 +314,5 @@ isTrueLocked = _this$props8.isTrueLocked, | ||
addRule: addRule, | ||
addGroup: addGroup, | ||
canAddRule: this.canAddRule(), | ||
canAddGroup: this.canAddGroup(), | ||
canDeleteGroup: this.canDeleteGroup(), | ||
@@ -304,0 +319,0 @@ removeSelf: this.removeSelf, |
@@ -31,3 +31,5 @@ "use strict"; | ||
addRule = _this$props.addRule, | ||
addGroup = _this$props.addGroup, | ||
canAddRule = _this$props.canAddRule, | ||
canAddGroup = _this$props.canAddGroup, | ||
canDeleteGroup = _this$props.canDeleteGroup, | ||
@@ -42,2 +44,3 @@ removeSelf = _this$props.removeSelf, | ||
addSubRuleLabel = _config$settings.addSubRuleLabel, | ||
addSubGroupLabel = _config$settings.addSubGroupLabel, | ||
delGroupLabel = _config$settings.delGroupLabel, | ||
@@ -73,4 +76,4 @@ renderButton = _config$settings.renderButton, | ||
}); | ||
var addRuleBtn = !immutableGroupsMode && canAddRule && !isLocked && /*#__PURE__*/_react["default"].createElement(Btn, { | ||
type: "addRuleGroupExt", | ||
var addSubRuleBtn = !immutableGroupsMode && canAddRule && !isLocked && /*#__PURE__*/_react["default"].createElement(Btn, { | ||
type: "addSubRule", | ||
onClick: addRule, | ||
@@ -82,2 +85,10 @@ label: addSubRuleLabel, | ||
}); | ||
var addSubGroupBtn = !immutableGroupsMode && canAddGroup && !isLocked && /*#__PURE__*/_react["default"].createElement(Btn, { | ||
type: "addSubGroup", | ||
onClick: addGroup, | ||
label: addSubGroupLabel, | ||
readonly: isLocked, | ||
config: config, | ||
renderIcon: Icon | ||
}); | ||
var delGroupBtn = !immutableGroupsMode && canDeleteGroup && (!isLocked || isLocked && canDeleteLocked) && /*#__PURE__*/_react["default"].createElement(Btn, { | ||
@@ -94,5 +105,5 @@ type: "delRuleGroup", | ||
config: config | ||
}, setLockSwitch, addRuleBtn, delGroupBtn)); | ||
}, setLockSwitch, addSubRuleBtn, addSubGroupBtn, delGroupBtn)); | ||
} | ||
}]); | ||
}(_react.PureComponent); |
@@ -10,4 +10,5 @@ "use strict"; | ||
var typeToLabel = { | ||
"addRuleGroup": "+", | ||
"addRuleGroupExt": "+", | ||
"addSubRuleSimple": "+", | ||
"addSubRule": "+", | ||
"addSubGroup": "+", | ||
"delGroup": "x", | ||
@@ -14,0 +15,0 @@ "delRuleGroup": "x", |
@@ -209,3 +209,3 @@ /* eslint-disable no-extra-semi */ | ||
type ButtonIconType = "addRule" | "addGroup" | "delRule" | "delGroup" | "addRuleGroup" | "delRuleGroup"; | ||
type ButtonIconType = "addRule" | "addGroup" | "delRule" | "delGroup" | "addSubRuleSimple" | "addSubRule" | "addSubGroup" | "delRuleGroup"; | ||
type IconType = ButtonIconType | "drag"; | ||
@@ -212,0 +212,0 @@ |
@@ -46,3 +46,4 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray"; | ||
_this.addGroup = function () { | ||
_this.props.actions.addGroup(_this.props.path); | ||
var parentRuleGroupField = itemType == "rule_group" ? _this.props.field : _this.props.parentField; | ||
_this.props.actions.addGroup(_this.props.path, undefined, undefined, parentRuleGroupField); | ||
}; | ||
@@ -56,4 +57,4 @@ _this.addCaseGroup = function () { | ||
_this.addRule = function () { | ||
var parentRuleGroupPath = itemType == "rule_group" ? _this.props.field : null; | ||
_this.props.actions.addRule(_this.props.path, undefined, undefined, undefined, parentRuleGroupPath); | ||
var parentRuleGroupField = itemType == "rule_group" ? _this.props.field : _this.props.parentField; | ||
_this.props.actions.addRule(_this.props.path, undefined, undefined, undefined, parentRuleGroupField); | ||
}; | ||
@@ -60,0 +61,0 @@ // for RuleGroup |
@@ -180,3 +180,4 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty"; | ||
isTrueLocked = _this$props4.isTrueLocked, | ||
id = _this$props4.id; | ||
id = _this$props4.id, | ||
parentField = _this$props4.parentField; | ||
return /*#__PURE__*/React.createElement(GroupActions, { | ||
@@ -194,3 +195,4 @@ key: "group-actions", | ||
isTrueLocked: isTrueLocked, | ||
id: id | ||
id: id, | ||
parentField: parentField | ||
}); | ||
@@ -234,6 +236,7 @@ } | ||
onDragStart = props.onDragStart, | ||
isLocked = props.isLocked; | ||
isLocked = props.isLocked, | ||
parentField = props.parentField; | ||
var isRuleGroup = item.get("type") == "group" && item.getIn(["properties", "field"]) != null; | ||
var type = isRuleGroup ? "rule_group" : item.get("type"); | ||
return /*#__PURE__*/React.createElement(Item, _extends({}, this.extraPropsForItem(item), { | ||
return /*#__PURE__*/React.createElement(Item, _extends({ | ||
key: item.get("id"), | ||
@@ -250,2 +253,3 @@ id: item.get("id"), | ||
children1: item.get("children1"), | ||
parentField: parentField, | ||
reordableNodesCnt: this.reordableNodesCntForItem(item), | ||
@@ -257,3 +261,3 @@ totalRulesCnt: this.totalRulesCntForItem(item), | ||
isParentLocked: isLocked | ||
})); | ||
}, this.extraPropsForItem(item))); | ||
} | ||
@@ -384,2 +388,4 @@ }, { | ||
isTrueLocked: PropTypes.bool, | ||
parentField: PropTypes.string, | ||
//from RuleGroup | ||
//actions | ||
@@ -386,0 +392,0 @@ handleDraggerMouseDown: PropTypes.func, |
@@ -36,2 +36,3 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; | ||
id = _this$props.id, | ||
parentField = _this$props.parentField, | ||
canAddGroup = _this$props.canAddGroup, | ||
@@ -44,2 +45,4 @@ canAddRule = _this$props.canAddRule, | ||
addGroupLabel = _config$settings.addGroupLabel, | ||
addSubRuleLabel = _config$settings.addSubRuleLabel, | ||
addSubGroupLabel = _config$settings.addSubGroupLabel, | ||
delGroupLabel = _config$settings.delGroupLabel, | ||
@@ -78,5 +81,5 @@ groupActionsPosition = _config$settings.groupActionsPosition, | ||
var addRuleBtn = !immutableGroupsMode && canAddRule && !isLocked && /*#__PURE__*/React.createElement(Btn, { | ||
type: "addRule", | ||
type: parentField ? "addSubRule" : "addRule", | ||
onClick: addRule, | ||
label: addRuleLabel, | ||
label: parentField ? addSubRuleLabel : addRuleLabel, | ||
readonly: isLocked, | ||
@@ -87,5 +90,5 @@ config: config, | ||
var addGroupBtn = !immutableGroupsMode && canAddGroup && !isLocked && /*#__PURE__*/React.createElement(Btn, { | ||
type: "addGroup", | ||
type: parentField ? "addSubGroup" : "addGroup", | ||
onClick: addGroup, | ||
label: addGroupLabel, | ||
label: parentField ? addSubGroupLabel : addGroupLabel, | ||
readonly: isLocked, | ||
@@ -92,0 +95,0 @@ config: config, |
@@ -63,3 +63,3 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; | ||
children1: props.children1, | ||
parentField: null, | ||
parentField: props.parentField, | ||
parentReordableNodesCnt: props.parentReordableNodesCnt | ||
@@ -66,0 +66,0 @@ })); |
@@ -62,4 +62,4 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; | ||
}); | ||
var addRuleBtn = !immutableGroupsMode && canAddRule && !isLocked && /*#__PURE__*/React.createElement(Btn, { | ||
type: "addRuleGroup", | ||
var addSubRuleBtn = !immutableGroupsMode && canAddRule && !isLocked && /*#__PURE__*/React.createElement(Btn, { | ||
type: "addSubRuleSimple", | ||
onClick: addRule, | ||
@@ -82,5 +82,5 @@ label: addRuleLabel, | ||
config: config | ||
}, setLockSwitch, addRuleBtn, delGroupBtn)); | ||
}, setLockSwitch, addSubRuleBtn, delGroupBtn)); | ||
} | ||
}]); | ||
}(PureComponent); |
@@ -45,8 +45,2 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty"; | ||
}; | ||
_this.canAddGroup = function () { | ||
return false; | ||
}; | ||
_this.canAddRule = function () { | ||
return true; | ||
}; | ||
_this.canDeleteGroup = function () { | ||
@@ -64,2 +58,20 @@ return true; | ||
}, { | ||
key: "canAddGroup", | ||
value: function canAddGroup() { | ||
// todo | ||
return true; | ||
// return this.props.allowFurtherNesting; | ||
} | ||
}, { | ||
key: "canAddRule", | ||
value: function canAddRule() { | ||
// todo | ||
// const maxNumberOfRules = this.props.config.settings.maxNumberOfRules; | ||
// const totalRulesCnt = this.props.totalRulesCnt; | ||
// if (maxNumberOfRules) { | ||
// return totalRulesCnt < maxNumberOfRules; | ||
// } | ||
return true; | ||
} | ||
}, { | ||
key: "renderHeaderWrapper", | ||
@@ -287,2 +299,3 @@ value: function renderHeaderWrapper() { | ||
addRule = _this$props8.addRule, | ||
addGroup = _this$props8.addGroup, | ||
isLocked = _this$props8.isLocked, | ||
@@ -294,3 +307,5 @@ isTrueLocked = _this$props8.isTrueLocked, | ||
addRule: addRule, | ||
addGroup: addGroup, | ||
canAddRule: this.canAddRule(), | ||
canAddGroup: this.canAddGroup(), | ||
canDeleteGroup: this.canDeleteGroup(), | ||
@@ -297,0 +312,0 @@ removeSelf: this.removeSelf, |
@@ -21,3 +21,5 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; | ||
addRule = _this$props.addRule, | ||
addGroup = _this$props.addGroup, | ||
canAddRule = _this$props.canAddRule, | ||
canAddGroup = _this$props.canAddGroup, | ||
canDeleteGroup = _this$props.canDeleteGroup, | ||
@@ -32,2 +34,3 @@ removeSelf = _this$props.removeSelf, | ||
addSubRuleLabel = _config$settings.addSubRuleLabel, | ||
addSubGroupLabel = _config$settings.addSubGroupLabel, | ||
delGroupLabel = _config$settings.delGroupLabel, | ||
@@ -63,4 +66,4 @@ renderButton = _config$settings.renderButton, | ||
}); | ||
var addRuleBtn = !immutableGroupsMode && canAddRule && !isLocked && /*#__PURE__*/React.createElement(Btn, { | ||
type: "addRuleGroupExt", | ||
var addSubRuleBtn = !immutableGroupsMode && canAddRule && !isLocked && /*#__PURE__*/React.createElement(Btn, { | ||
type: "addSubRule", | ||
onClick: addRule, | ||
@@ -72,2 +75,10 @@ label: addSubRuleLabel, | ||
}); | ||
var addSubGroupBtn = !immutableGroupsMode && canAddGroup && !isLocked && /*#__PURE__*/React.createElement(Btn, { | ||
type: "addSubGroup", | ||
onClick: addGroup, | ||
label: addSubGroupLabel, | ||
readonly: isLocked, | ||
config: config, | ||
renderIcon: Icon | ||
}); | ||
var delGroupBtn = !immutableGroupsMode && canDeleteGroup && (!isLocked || isLocked && canDeleteLocked) && /*#__PURE__*/React.createElement(Btn, { | ||
@@ -84,5 +95,5 @@ type: "delRuleGroup", | ||
config: config | ||
}, setLockSwitch, addRuleBtn, delGroupBtn)); | ||
}, setLockSwitch, addSubRuleBtn, addSubGroupBtn, delGroupBtn)); | ||
} | ||
}]); | ||
}(PureComponent); |
import React from "react"; | ||
var typeToLabel = { | ||
"addRuleGroup": "+", | ||
"addRuleGroupExt": "+", | ||
"addSubRuleSimple": "+", | ||
"addSubRule": "+", | ||
"addSubGroup": "+", | ||
"delGroup": "x", | ||
@@ -6,0 +7,0 @@ "delRuleGroup": "x", |
@@ -209,3 +209,3 @@ /* eslint-disable no-extra-semi */ | ||
type ButtonIconType = "addRule" | "addGroup" | "delRule" | "delGroup" | "addRuleGroup" | "delRuleGroup"; | ||
type ButtonIconType = "addRule" | "addGroup" | "delRule" | "delGroup" | "addSubRuleSimple" | "addSubRule" | "addSubGroup" | "delRuleGroup"; | ||
type IconType = ButtonIconType | "drag"; | ||
@@ -212,0 +212,0 @@ |
@@ -119,3 +119,4 @@ import React, { Component } from "react"; | ||
addGroup = () => { | ||
this.props.actions.addGroup(this.props.path); | ||
const parentRuleGroupField = itemType == "rule_group" ? this.props.field : this.props.parentField; | ||
this.props.actions.addGroup(this.props.path, undefined, undefined, parentRuleGroupField); | ||
}; | ||
@@ -132,4 +133,4 @@ | ||
addRule = () => { | ||
const parentRuleGroupPath = itemType == "rule_group" ? this.props.field : null; | ||
this.props.actions.addRule(this.props.path, undefined, undefined, undefined, parentRuleGroupPath); | ||
const parentRuleGroupField = itemType == "rule_group" ? this.props.field : this.props.parentField; | ||
this.props.actions.addRule(this.props.path, undefined, undefined, undefined, parentRuleGroupField); | ||
}; | ||
@@ -136,0 +137,0 @@ |
@@ -34,2 +34,3 @@ import React, { Component } from "react"; | ||
isTrueLocked: PropTypes.bool, | ||
parentField: PropTypes.string, //from RuleGroup | ||
//actions | ||
@@ -192,3 +193,3 @@ handleDraggerMouseDown: PropTypes.func, | ||
renderActions() { | ||
const {config, addRule, addGroup, isLocked, isTrueLocked, id} = this.props; | ||
const {config, addRule, addGroup, isLocked, isTrueLocked, id, parentField} = this.props; | ||
@@ -208,2 +209,3 @@ return <GroupActions | ||
id={id} | ||
parentField={parentField} | ||
/>; | ||
@@ -215,2 +217,3 @@ } | ||
} | ||
canAddRule() { | ||
@@ -224,2 +227,3 @@ const maxNumberOfRules = this.props.config.settings.maxNumberOfRules; | ||
} | ||
canDeleteGroup() { | ||
@@ -239,3 +243,3 @@ return !this.props.isRoot; | ||
const props = this.props; | ||
const {config, actions, onDragStart, isLocked} = props; | ||
const {config, actions, onDragStart, isLocked, parentField} = props; | ||
const isRuleGroup = item.get("type") == "group" && item.getIn(["properties", "field"]) != null; | ||
@@ -246,3 +250,2 @@ const type = isRuleGroup ? "rule_group" : item.get("type"); | ||
<Item | ||
{...this.extraPropsForItem(item)} | ||
key={item.get("id")} | ||
@@ -258,2 +261,3 @@ id={item.get("id")} | ||
children1={item.get("children1")} | ||
parentField={parentField} | ||
reordableNodesCnt={this.reordableNodesCntForItem(item)} | ||
@@ -265,2 +269,3 @@ totalRulesCnt={this.totalRulesCntForItem(item)} | ||
isParentLocked={isLocked} | ||
{...this.extraPropsForItem(item)} | ||
/> | ||
@@ -267,0 +272,0 @@ ); |
@@ -18,7 +18,8 @@ import React, { PureComponent } from "react"; | ||
config, | ||
addRule, addGroup, removeSelf, setLock, isLocked, isTrueLocked, id, | ||
addRule, addGroup, removeSelf, setLock, isLocked, isTrueLocked, id, parentField, | ||
canAddGroup, canAddRule, canDeleteGroup | ||
} = this.props; | ||
const { | ||
immutableGroupsMode, addRuleLabel, addGroupLabel, delGroupLabel, groupActionsPosition, | ||
immutableGroupsMode, addRuleLabel, addGroupLabel, addSubRuleLabel, addSubGroupLabel, | ||
delGroupLabel, groupActionsPosition, | ||
renderButton, renderIcon, renderSwitch, renderButtonGroup, | ||
@@ -38,6 +39,6 @@ lockLabel, lockedLabel, showLock, canDeleteLocked, | ||
const addRuleBtn = !immutableGroupsMode && canAddRule && !isLocked && <Btn | ||
type="addRule" onClick={addRule} label={addRuleLabel} readonly={isLocked} config={config} renderIcon={Icon} | ||
type={parentField ? "addSubRule" : "addRule"} onClick={addRule} label={parentField ? addSubRuleLabel : addRuleLabel} readonly={isLocked} config={config} renderIcon={Icon} | ||
/>; | ||
const addGroupBtn = !immutableGroupsMode && canAddGroup && !isLocked && <Btn | ||
type="addGroup" onClick={addGroup} label={addGroupLabel} readonly={isLocked} config={config} renderIcon={Icon} | ||
type={parentField ? "addSubGroup" : "addGroup"} onClick={addGroup} label={parentField ? addSubGroupLabel : addGroupLabel} readonly={isLocked} config={config} renderIcon={Icon} | ||
/>; | ||
@@ -44,0 +45,0 @@ const delGroupBtn = !immutableGroupsMode && canDeleteGroup && (!isLocked || isLocked && canDeleteLocked) && <Btn |
@@ -60,3 +60,3 @@ import React, { PureComponent } from "react"; | ||
children1={props.children1} | ||
parentField={null} | ||
parentField={props.parentField} | ||
parentReordableNodesCnt={props.parentReordableNodesCnt} | ||
@@ -63,0 +63,0 @@ /> |
@@ -24,4 +24,4 @@ import React, { PureComponent } from "react"; | ||
const addRuleBtn = !immutableGroupsMode && canAddRule && !isLocked && <Btn | ||
type="addRuleGroup" onClick={addRule} label={addRuleLabel} readonly={isLocked} config={config} renderIcon={Icon} | ||
const addSubRuleBtn = !immutableGroupsMode && canAddRule && !isLocked && <Btn | ||
type="addSubRuleSimple" onClick={addRule} label={addRuleLabel} readonly={isLocked} config={config} renderIcon={Icon} | ||
/>; | ||
@@ -37,3 +37,3 @@ | ||
{setLockSwitch} | ||
{addRuleBtn} | ||
{addSubRuleBtn} | ||
{delGroupBtn} | ||
@@ -40,0 +40,0 @@ </BtnGrp> |
@@ -44,4 +44,19 @@ import React from "react"; | ||
renderFooterWrapper = () => null; | ||
canAddGroup = () => false; | ||
canAddRule = () => true; | ||
canAddGroup() { | ||
// todo | ||
return true; | ||
// return this.props.allowFurtherNesting; | ||
} | ||
canAddRule() { | ||
// todo | ||
// const maxNumberOfRules = this.props.config.settings.maxNumberOfRules; | ||
// const totalRulesCnt = this.props.totalRulesCnt; | ||
// if (maxNumberOfRules) { | ||
// return totalRulesCnt < maxNumberOfRules; | ||
// } | ||
return true; | ||
} | ||
canDeleteGroup = () => true; | ||
@@ -226,3 +241,3 @@ | ||
renderActions() { | ||
const {config, addRule, isLocked, isTrueLocked, id} = this.props; | ||
const {config, addRule, addGroup, isLocked, isTrueLocked, id} = this.props; | ||
@@ -232,3 +247,5 @@ return <RuleGroupExtActions | ||
addRule={addRule} | ||
addGroup={addGroup} | ||
canAddRule={this.canAddRule()} | ||
canAddGroup={this.canAddGroup()} | ||
canDeleteGroup={this.canDeleteGroup()} | ||
@@ -235,0 +252,0 @@ removeSelf={this.removeSelf} |
@@ -7,7 +7,7 @@ import React, { PureComponent } from "react"; | ||
config, | ||
addRule, canAddRule, canDeleteGroup, removeSelf, | ||
addRule, addGroup, canAddRule, canAddGroup, canDeleteGroup, removeSelf, | ||
setLock, isLocked, isTrueLocked, id, | ||
} = this.props; | ||
const { | ||
immutableGroupsMode, addSubRuleLabel, delGroupLabel, | ||
immutableGroupsMode, addSubRuleLabel, addSubGroupLabel, delGroupLabel, | ||
renderButton, renderIcon, renderSwitch, renderButtonGroup, | ||
@@ -25,6 +25,10 @@ lockLabel, lockedLabel, showLock, canDeleteLocked, | ||
const addRuleBtn = !immutableGroupsMode && canAddRule && !isLocked && <Btn | ||
type="addRuleGroupExt" onClick={addRule} label={addSubRuleLabel} readonly={isLocked} config={config} renderIcon={Icon} | ||
const addSubRuleBtn = !immutableGroupsMode && canAddRule && !isLocked && <Btn | ||
type="addSubRule" onClick={addRule} label={addSubRuleLabel} readonly={isLocked} config={config} renderIcon={Icon} | ||
/>; | ||
const addSubGroupBtn = !immutableGroupsMode && canAddGroup && !isLocked && <Btn | ||
type="addSubGroup" onClick={addGroup} label={addSubGroupLabel} readonly={isLocked} config={config} renderIcon={Icon} | ||
/>; | ||
const delGroupBtn = !immutableGroupsMode && canDeleteGroup && (!isLocked || isLocked && canDeleteLocked) && <Btn | ||
@@ -38,3 +42,4 @@ type="delRuleGroup" onClick={removeSelf} label={delGroupLabel} config={config} renderIcon={Icon} | ||
{setLockSwitch} | ||
{addRuleBtn} | ||
{addSubRuleBtn} | ||
{addSubGroupBtn} | ||
{delGroupBtn} | ||
@@ -41,0 +46,0 @@ </BtnGrp> |
import React from "react"; | ||
const typeToLabel = { | ||
"addRuleGroup": "+", | ||
"addRuleGroupExt": "+", | ||
"addSubRuleSimple": "+", | ||
"addSubRule": "+", | ||
"addSubGroup": "+", | ||
"delGroup": "x", | ||
@@ -7,0 +8,0 @@ "delRuleGroup": "x", |
@@ -209,3 +209,3 @@ /* eslint-disable no-extra-semi */ | ||
type ButtonIconType = "addRule" | "addGroup" | "delRule" | "delGroup" | "addRuleGroup" | "delRuleGroup"; | ||
type ButtonIconType = "addRule" | "addGroup" | "delRule" | "delGroup" | "addSubRuleSimple" | "addSubRule" | "addSubGroup" | "delRuleGroup"; | ||
type IconType = ButtonIconType | "drag"; | ||
@@ -212,0 +212,0 @@ |
{ | ||
"name": "@react-awesome-query-builder/ui", | ||
"version": "6.6.3", | ||
"version": "6.6.4-alpha.0", | ||
"description": "User-friendly query builder for React. Core React UI", | ||
@@ -56,3 +56,3 @@ "keywords": [ | ||
"redux": "^4.2.1", | ||
"@react-awesome-query-builder/core": "^6.6.3" | ||
"@react-awesome-query-builder/core": "^6.6.4-alpha.0" | ||
}, | ||
@@ -59,0 +59,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1095948
24312
1