@bigbinary/neeto-rules-frontend 2.5.43 → 2.5.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/NeetoRulesForm.js +82 -17
- package/dist/NeetoRulesForm.js.map +1 -1
- package/dist/RulePreview.js +16 -8
- package/dist/RulePreview.js.map +1 -1
- package/dist/cjs/NeetoRulesForm.js +82 -17
- package/dist/cjs/NeetoRulesForm.js.map +1 -1
- package/dist/cjs/RulePreview.js +16 -8
- package/dist/cjs/RulePreview.js.map +1 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/NeetoRulesForm.js
CHANGED
|
@@ -1183,6 +1183,7 @@ var Target$i = function Target(_ref) {
|
|
|
1183
1183
|
weight: "normal",
|
|
1184
1184
|
children: separator
|
|
1185
1185
|
}), /*#__PURE__*/jsx(Button, {
|
|
1186
|
+
"data-cy": "custom-action-button-".concat(hyphenate(defaultLabel)),
|
|
1186
1187
|
label: defaultLabel.toLowerCase(),
|
|
1187
1188
|
style: "link",
|
|
1188
1189
|
className: classNames("neeto-ui-text-gray-800 neeto-ui-font-semibold underline", {
|
|
@@ -4599,20 +4600,22 @@ var EventsPanel = function EventsPanel() {
|
|
|
4599
4600
|
}, shallow),
|
|
4600
4601
|
setPanelState = _useUtilityStore.setPanelState;
|
|
4601
4602
|
var _useUtilityStore2 = useUtilityStore(function (store) {
|
|
4602
|
-
var _store$panelState, _store$panelState2, _store$panelState3, _store$panelState4, _store$panelState5;
|
|
4603
|
+
var _store$panelState, _store$panelState2, _store$panelState3, _store$panelState4, _store$panelState5, _store$panelState6;
|
|
4603
4604
|
return {
|
|
4604
4605
|
name: (_store$panelState = store["panelState"]) === null || _store$panelState === void 0 || (_store$panelState = _store$panelState["data"]) === null || _store$panelState === void 0 ? void 0 : _store$panelState["name"],
|
|
4605
4606
|
data: (_store$panelState2 = store["panelState"]) === null || _store$panelState2 === void 0 || (_store$panelState2 = _store$panelState2["data"]) === null || _store$panelState2 === void 0 ? void 0 : _store$panelState2["data"],
|
|
4606
4607
|
performerName: (_store$panelState3 = store["panelState"]) === null || _store$panelState3 === void 0 || (_store$panelState3 = _store$panelState3["data"]) === null || _store$panelState3 === void 0 ? void 0 : _store$panelState3["performerName"],
|
|
4607
4608
|
onSelectEvent: (_store$panelState4 = store["panelState"]) === null || _store$panelState4 === void 0 || (_store$panelState4 = _store$panelState4["data"]) === null || _store$panelState4 === void 0 ? void 0 : _store$panelState4["onSelectEvent"],
|
|
4608
|
-
isMenuDisabled: (_store$panelState5 = store["panelState"]) === null || _store$panelState5 === void 0 || (_store$panelState5 = _store$panelState5["data"]) === null || _store$panelState5 === void 0 ? void 0 : _store$panelState5["isMenuDisabled"]
|
|
4609
|
+
isMenuDisabled: (_store$panelState5 = store["panelState"]) === null || _store$panelState5 === void 0 || (_store$panelState5 = _store$panelState5["data"]) === null || _store$panelState5 === void 0 ? void 0 : _store$panelState5["isMenuDisabled"],
|
|
4610
|
+
singleSelect: (_store$panelState6 = store["panelState"]) === null || _store$panelState6 === void 0 || (_store$panelState6 = _store$panelState6["data"]) === null || _store$panelState6 === void 0 ? void 0 : _store$panelState6["singleSelect"]
|
|
4609
4611
|
};
|
|
4610
4612
|
}, shallow),
|
|
4611
4613
|
name = _useUtilityStore2.name,
|
|
4612
4614
|
data = _useUtilityStore2.data,
|
|
4613
4615
|
performerName = _useUtilityStore2.performerName,
|
|
4614
4616
|
onSelectEvent = _useUtilityStore2.onSelectEvent,
|
|
4615
|
-
isMenuDisabled = _useUtilityStore2.isMenuDisabled
|
|
4617
|
+
isMenuDisabled = _useUtilityStore2.isMenuDisabled,
|
|
4618
|
+
singleSelect = _useUtilityStore2.singleSelect;
|
|
4616
4619
|
var _useFormikContext = useFormikContext(),
|
|
4617
4620
|
values = _useFormikContext.values,
|
|
4618
4621
|
setFieldValue = _useFormikContext.setFieldValue;
|
|
@@ -4676,7 +4679,7 @@ var EventsPanel = function EventsPanel() {
|
|
|
4676
4679
|
return _ref.apply(this, arguments);
|
|
4677
4680
|
};
|
|
4678
4681
|
}();
|
|
4679
|
-
var
|
|
4682
|
+
var handleOptionChange = function handleOptionChange(option) {
|
|
4680
4683
|
setTouched(true);
|
|
4681
4684
|
if (option.value === (defaultData === null || defaultData === void 0 ? void 0 : defaultData.name)) {
|
|
4682
4685
|
handleDefaultData();
|
|
@@ -4706,14 +4709,55 @@ var EventsPanel = function EventsPanel() {
|
|
|
4706
4709
|
_destroy: true
|
|
4707
4710
|
})]));
|
|
4708
4711
|
}
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4712
|
+
if (singleSelect) {
|
|
4713
|
+
// Single select mode: replace all selections with the clicked option
|
|
4714
|
+
if (eventNames.includes(option.value)) {
|
|
4715
|
+
// If already selected, deselect it (set to empty array)
|
|
4716
|
+
// The event deletion is already handled above if it has an id
|
|
4717
|
+
options = [];
|
|
4718
|
+
} else {
|
|
4719
|
+
// Select only this option, mark others for deletion
|
|
4720
|
+
var otherEvents = options.filter(function (e) {
|
|
4721
|
+
return e.name !== option.value;
|
|
4722
|
+
});
|
|
4723
|
+
var deletedEvents = otherEvents.filter(function (e) {
|
|
4724
|
+
return e.id;
|
|
4725
|
+
}).map(function (e) {
|
|
4726
|
+
return _objectSpread$f(_objectSpread$f({}, e), {}, {
|
|
4727
|
+
_destroy: true
|
|
4728
|
+
});
|
|
4729
|
+
});
|
|
4730
|
+
if (deletedEvents.length > 0) {
|
|
4731
|
+
var _values$name4;
|
|
4732
|
+
setFieldValue("".concat(name, ".deleted"), [].concat(_toConsumableArray(((_values$name4 = values[name]) === null || _values$name4 === void 0 ? void 0 : _values$name4.deleted) || []), _toConsumableArray(deletedEvents)));
|
|
4733
|
+
}
|
|
4734
|
+
options = [{
|
|
4735
|
+
name: option.value
|
|
4736
|
+
}];
|
|
4737
|
+
}
|
|
4738
|
+
} else {
|
|
4739
|
+
// Multi-select mode: toggle the option
|
|
4740
|
+
options = eventNames.includes(option.value) ? removeBy({
|
|
4741
|
+
name: option.value
|
|
4742
|
+
}, options) : [].concat(_toConsumableArray(options), [{
|
|
4743
|
+
name: option.value
|
|
4744
|
+
}]);
|
|
4745
|
+
}
|
|
4714
4746
|
onSelectEvent === null || onSelectEvent === void 0 || onSelectEvent(name, options);
|
|
4715
4747
|
setFieldValue("".concat(name, ".value"), options);
|
|
4716
4748
|
};
|
|
4749
|
+
var handleMultiSelectOption = function handleMultiSelectOption(option) {
|
|
4750
|
+
handleOptionChange(option);
|
|
4751
|
+
};
|
|
4752
|
+
var handleRadioChange = function handleRadioChange(_ref2) {
|
|
4753
|
+
var value = _ref2.target.value;
|
|
4754
|
+
var option = findBy({
|
|
4755
|
+
value: value
|
|
4756
|
+
}, dropdownOptions);
|
|
4757
|
+
if (option) {
|
|
4758
|
+
handleOptionChange(option);
|
|
4759
|
+
}
|
|
4760
|
+
};
|
|
4717
4761
|
var handleContinue = function handleContinue() {
|
|
4718
4762
|
setTouched(true);
|
|
4719
4763
|
!error && setPanelState(mergeDeepLeft({
|
|
@@ -4756,9 +4800,25 @@ var EventsPanel = function EventsPanel() {
|
|
|
4756
4800
|
})
|
|
4757
4801
|
}), /*#__PURE__*/jsxs("div", {
|
|
4758
4802
|
className: "space-y-3",
|
|
4759
|
-
children: [isNotEmpty(searchedOptions) ?
|
|
4760
|
-
|
|
4761
|
-
|
|
4803
|
+
children: [isNotEmpty(searchedOptions) ? singleSelect ? /*#__PURE__*/jsx(Radio$1, {
|
|
4804
|
+
stacked: true,
|
|
4805
|
+
value: (eventNames === null || eventNames === void 0 ? void 0 : eventNames[0]) || "",
|
|
4806
|
+
onChange: handleRadioChange,
|
|
4807
|
+
children: searchedOptions.map(function (option, index) {
|
|
4808
|
+
return /*#__PURE__*/createElement(Radio$1.Item, _objectSpread$f(_objectSpread$f({}, index === 0 ? {
|
|
4809
|
+
ref: ref,
|
|
4810
|
+
onFocus: setFieldActive
|
|
4811
|
+
} : {}), {}, {
|
|
4812
|
+
"data-cy": "".concat(joinHyphenCase(option.label), "-radio"),
|
|
4813
|
+
key: option.value,
|
|
4814
|
+
label: option.label,
|
|
4815
|
+
value: option.value
|
|
4816
|
+
}));
|
|
4817
|
+
})
|
|
4818
|
+
}) : searchedOptions.map(function (option, index) {
|
|
4819
|
+
return /*#__PURE__*/createElement(Checkbox, _objectSpread$f(_objectSpread$f({}, index === 0 ? {
|
|
4820
|
+
ref: ref
|
|
4821
|
+
} : {}), {}, {
|
|
4762
4822
|
checked: eventNames === null || eventNames === void 0 ? void 0 : eventNames.includes(option.value),
|
|
4763
4823
|
"data-cy": "".concat(joinHyphenCase(option.label), "-checkbox"),
|
|
4764
4824
|
id: option.value,
|
|
@@ -4768,7 +4828,7 @@ var EventsPanel = function EventsPanel() {
|
|
|
4768
4828
|
return handleMultiSelectOption(option);
|
|
4769
4829
|
},
|
|
4770
4830
|
onFocus: setFieldActive
|
|
4771
|
-
});
|
|
4831
|
+
}));
|
|
4772
4832
|
}) : /*#__PURE__*/jsx("div", {
|
|
4773
4833
|
className: "py-1 text-sm",
|
|
4774
4834
|
"data-cy": "no-options-menu-item",
|
|
@@ -6112,7 +6172,8 @@ var Events = function Events(_ref) {
|
|
|
6112
6172
|
var name = _ref.name,
|
|
6113
6173
|
data = _ref.data,
|
|
6114
6174
|
onSelectEvent = _ref.onSelectEvent,
|
|
6115
|
-
performerName = _ref.performerName
|
|
6175
|
+
performerName = _ref.performerName,
|
|
6176
|
+
singleSelect = _ref.singleSelect;
|
|
6116
6177
|
var _useTranslation = useTranslation(),
|
|
6117
6178
|
t = _useTranslation.t;
|
|
6118
6179
|
var _useActiveField = useActiveField(name),
|
|
@@ -6143,7 +6204,8 @@ var Events = function Events(_ref) {
|
|
|
6143
6204
|
data: data,
|
|
6144
6205
|
performerName: performerName,
|
|
6145
6206
|
onSelectEvent: onSelectEvent,
|
|
6146
|
-
isMenuDisabled: isMenuDisabled
|
|
6207
|
+
isMenuDisabled: isMenuDisabled,
|
|
6208
|
+
singleSelect: singleSelect
|
|
6147
6209
|
}
|
|
6148
6210
|
};
|
|
6149
6211
|
useEffect(function () {
|
|
@@ -6208,7 +6270,7 @@ var Events = function Events(_ref) {
|
|
|
6208
6270
|
});
|
|
6209
6271
|
};
|
|
6210
6272
|
|
|
6211
|
-
var _excluded$6 = ["addButtonTooltipProps", "data", "label", "name", "performerName", "conditionsName", "onSelectEvent", "enableAddingDelay"];
|
|
6273
|
+
var _excluded$6 = ["addButtonTooltipProps", "data", "label", "name", "performerName", "conditionsName", "onSelectEvent", "enableAddingDelay", "singleSelect"];
|
|
6212
6274
|
function ownKeys$8(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6213
6275
|
function _objectSpread$8(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$8(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$8(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6214
6276
|
var EventConditions = function EventConditions(_ref) {
|
|
@@ -6222,6 +6284,8 @@ var EventConditions = function EventConditions(_ref) {
|
|
|
6222
6284
|
onSelectEvent = _ref.onSelectEvent,
|
|
6223
6285
|
_ref$enableAddingDela = _ref.enableAddingDelay,
|
|
6224
6286
|
enableAddingDelay = _ref$enableAddingDela === void 0 ? false : _ref$enableAddingDela,
|
|
6287
|
+
_ref$singleSelect = _ref.singleSelect,
|
|
6288
|
+
singleSelect = _ref$singleSelect === void 0 ? false : _ref$singleSelect,
|
|
6225
6289
|
config = _objectWithoutProperties(_ref, _excluded$6);
|
|
6226
6290
|
var _useFormikContext = useFormikContext(),
|
|
6227
6291
|
values = _useFormikContext.values,
|
|
@@ -6268,7 +6332,8 @@ var EventConditions = function EventConditions(_ref) {
|
|
|
6268
6332
|
data: data,
|
|
6269
6333
|
name: name,
|
|
6270
6334
|
onSelectEvent: onSelectEvent,
|
|
6271
|
-
performerName: performerName
|
|
6335
|
+
performerName: performerName,
|
|
6336
|
+
singleSelect: singleSelect
|
|
6272
6337
|
})
|
|
6273
6338
|
}), showAddButton && /*#__PURE__*/jsx(Tooltip, _objectSpread$8(_objectSpread$8({}, tooltipProps), {}, {
|
|
6274
6339
|
children: /*#__PURE__*/jsx("div", {
|