easy-email-pro-theme 1.59.5 → 1.59.7
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/lib/index.js +111 -25
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -32632,6 +32632,9 @@ function Columns(props) {
|
|
|
32632
32632
|
const generateLogic = (option) => {
|
|
32633
32633
|
if (!option)
|
|
32634
32634
|
return null;
|
|
32635
|
+
if ("expression" in option) {
|
|
32636
|
+
return /* @__PURE__ */ React__default.createElement(Tag, { color: "arcoblue" }, option.expression);
|
|
32637
|
+
}
|
|
32635
32638
|
const { symbol, groups } = option;
|
|
32636
32639
|
const generateExpression = (condition, symbol2, index2) => {
|
|
32637
32640
|
if (condition.operator === ConditionOperator.TRUTHY) {
|
|
@@ -32654,6 +32657,27 @@ const generateLogic = (option) => {
|
|
|
32654
32657
|
), index2 !== groups.length - 1 && /* @__PURE__ */ React__default.createElement("div", null, symbol.toLocaleUpperCase()));
|
|
32655
32658
|
}));
|
|
32656
32659
|
};
|
|
32660
|
+
function isExpressionCondition(condition) {
|
|
32661
|
+
return !!condition && "expression" in condition;
|
|
32662
|
+
}
|
|
32663
|
+
function createDefaultBuilderCondition() {
|
|
32664
|
+
return {
|
|
32665
|
+
enabled: true,
|
|
32666
|
+
symbol: ConditionOperatorSymbol.AND,
|
|
32667
|
+
groups: [
|
|
32668
|
+
{
|
|
32669
|
+
symbol: ConditionOperatorSymbol.AND,
|
|
32670
|
+
groups: [
|
|
32671
|
+
{
|
|
32672
|
+
left: "",
|
|
32673
|
+
operator: ConditionOperator.EQUAL,
|
|
32674
|
+
right: ""
|
|
32675
|
+
}
|
|
32676
|
+
]
|
|
32677
|
+
}
|
|
32678
|
+
]
|
|
32679
|
+
};
|
|
32680
|
+
}
|
|
32657
32681
|
function Condition(props) {
|
|
32658
32682
|
var _a;
|
|
32659
32683
|
const [conditionModalVisible, setConditionModalVisible] = useState(false);
|
|
@@ -32689,22 +32713,7 @@ function Condition(props) {
|
|
|
32689
32713
|
if (condition)
|
|
32690
32714
|
return { condition };
|
|
32691
32715
|
return {
|
|
32692
|
-
condition:
|
|
32693
|
-
enabled: true,
|
|
32694
|
-
symbol: ConditionOperatorSymbol.AND,
|
|
32695
|
-
groups: [
|
|
32696
|
-
{
|
|
32697
|
-
symbol: ConditionOperatorSymbol.AND,
|
|
32698
|
-
groups: [
|
|
32699
|
-
{
|
|
32700
|
-
left: "",
|
|
32701
|
-
operator: ConditionOperator.EQUAL,
|
|
32702
|
-
right: ""
|
|
32703
|
-
}
|
|
32704
|
-
]
|
|
32705
|
-
}
|
|
32706
|
-
]
|
|
32707
|
-
}
|
|
32716
|
+
condition: createDefaultBuilderCondition()
|
|
32708
32717
|
};
|
|
32709
32718
|
}, [condition]);
|
|
32710
32719
|
return /* @__PURE__ */ React__default.createElement(Collapse, { activeKey: ["Condition"] }, /* @__PURE__ */ React__default.createElement(
|
|
@@ -32736,6 +32745,50 @@ const ConditionModal = ({
|
|
|
32736
32745
|
const { form } = Form.useFormContext();
|
|
32737
32746
|
const { forceUpdate } = useForceUpdate();
|
|
32738
32747
|
const condition = form.getFieldValue("condition");
|
|
32748
|
+
const [mode, setMode] = useState(
|
|
32749
|
+
isExpressionCondition(condition) ? "expression" : "builder"
|
|
32750
|
+
);
|
|
32751
|
+
useEffect(() => {
|
|
32752
|
+
if (!visible)
|
|
32753
|
+
return;
|
|
32754
|
+
const nextCondition = form.getFieldValue("condition");
|
|
32755
|
+
setMode(isExpressionCondition(nextCondition) ? "expression" : "builder");
|
|
32756
|
+
}, [form, visible]);
|
|
32757
|
+
const onModeChange = useCallback(
|
|
32758
|
+
(nextMode) => {
|
|
32759
|
+
if (nextMode === mode)
|
|
32760
|
+
return;
|
|
32761
|
+
const current = form.getFieldValue("condition");
|
|
32762
|
+
if (nextMode === "builder") {
|
|
32763
|
+
const switchToBuilder = () => {
|
|
32764
|
+
form.setFieldValue("condition", createDefaultBuilderCondition());
|
|
32765
|
+
setMode("builder");
|
|
32766
|
+
forceUpdate();
|
|
32767
|
+
};
|
|
32768
|
+
if (isExpressionCondition(current) && current.expression) {
|
|
32769
|
+
Modal.confirm({
|
|
32770
|
+
title: t("Switch to Visual"),
|
|
32771
|
+
content: t(
|
|
32772
|
+
"Switching to visual mode will replace the current expression."
|
|
32773
|
+
),
|
|
32774
|
+
okText: t("Confirm"),
|
|
32775
|
+
cancelText: t("Cancel"),
|
|
32776
|
+
onOk: switchToBuilder
|
|
32777
|
+
});
|
|
32778
|
+
return;
|
|
32779
|
+
}
|
|
32780
|
+
switchToBuilder();
|
|
32781
|
+
return;
|
|
32782
|
+
}
|
|
32783
|
+
form.setFieldValue("condition", {
|
|
32784
|
+
expression: isExpressionCondition(current) ? current.expression : "",
|
|
32785
|
+
enabled: true
|
|
32786
|
+
});
|
|
32787
|
+
setMode("expression");
|
|
32788
|
+
forceUpdate();
|
|
32789
|
+
},
|
|
32790
|
+
[forceUpdate, form, mode]
|
|
32791
|
+
);
|
|
32739
32792
|
const onAddCondition = useCallback(
|
|
32740
32793
|
(path2) => {
|
|
32741
32794
|
const groups = form.getFieldValue(path2);
|
|
@@ -32803,6 +32856,33 @@ const ConditionModal = ({
|
|
|
32803
32856
|
}
|
|
32804
32857
|
},
|
|
32805
32858
|
/* @__PURE__ */ React__default.createElement(
|
|
32859
|
+
Radio.Group,
|
|
32860
|
+
{
|
|
32861
|
+
type: "button",
|
|
32862
|
+
value: mode,
|
|
32863
|
+
onChange: onModeChange,
|
|
32864
|
+
options: [
|
|
32865
|
+
{ label: t("Visual"), value: "builder" },
|
|
32866
|
+
{ label: t("Expression"), value: "expression" }
|
|
32867
|
+
],
|
|
32868
|
+
style: { marginBottom: 16 }
|
|
32869
|
+
}
|
|
32870
|
+
),
|
|
32871
|
+
mode === "expression" ? /* @__PURE__ */ React__default.createElement(
|
|
32872
|
+
Form.Item,
|
|
32873
|
+
{
|
|
32874
|
+
field: "condition.expression",
|
|
32875
|
+
label: t("Expression"),
|
|
32876
|
+
layout: "vertical"
|
|
32877
|
+
},
|
|
32878
|
+
/* @__PURE__ */ React__default.createElement(
|
|
32879
|
+
Input.TextArea,
|
|
32880
|
+
{
|
|
32881
|
+
autoSize: { minRows: 4, maxRows: 8 },
|
|
32882
|
+
placeholder: "ship_1_service_ship_travel_caption|default"
|
|
32883
|
+
}
|
|
32884
|
+
)
|
|
32885
|
+
) : !isExpressionCondition(condition) && /* @__PURE__ */ React__default.createElement(
|
|
32806
32886
|
List$1,
|
|
32807
32887
|
{
|
|
32808
32888
|
header: /* @__PURE__ */ React__default.createElement(Grid.Row, { justify: "space-between" }, /* @__PURE__ */ React__default.createElement(Grid.Col, { span: 16 }, condition.groups.length > 1 && /* @__PURE__ */ React__default.createElement(
|
|
@@ -32864,16 +32944,22 @@ const ConditionModal = ({
|
|
|
32864
32944
|
]
|
|
32865
32945
|
}
|
|
32866
32946
|
)
|
|
32867
|
-
)), /* @__PURE__ */ React__default.createElement(Grid.Col, { span: 8 }, /* @__PURE__ */ React__default.createElement(
|
|
32868
|
-
|
|
32947
|
+
)), /* @__PURE__ */ React__default.createElement(Grid.Col, { span: 8 }, /* @__PURE__ */ React__default.createElement(
|
|
32948
|
+
Form.Item,
|
|
32869
32949
|
{
|
|
32870
|
-
|
|
32871
|
-
|
|
32872
|
-
|
|
32873
|
-
|
|
32874
|
-
|
|
32875
|
-
|
|
32876
|
-
|
|
32950
|
+
wrapperCol: { style: { textAlign: "right" } }
|
|
32951
|
+
},
|
|
32952
|
+
/* @__PURE__ */ React__default.createElement(Tooltip, { content: t("Add logic") }, /* @__PURE__ */ React__default.createElement(
|
|
32953
|
+
Button$2,
|
|
32954
|
+
{
|
|
32955
|
+
size: "small",
|
|
32956
|
+
icon: /* @__PURE__ */ React__default.createElement(IconPlus, null),
|
|
32957
|
+
onClick: () => onAddSubCondition(
|
|
32958
|
+
`condition.groups.${gIndex}.groups`
|
|
32959
|
+
)
|
|
32960
|
+
}
|
|
32961
|
+
))
|
|
32962
|
+
))), /* @__PURE__ */ React__default.createElement(Divider$2, { style: { margin: "0px 0 20px 0" } }), group.groups.map((item2, ggIndex) => /* @__PURE__ */ React__default.createElement(
|
|
32877
32963
|
ConditionItem,
|
|
32878
32964
|
{
|
|
32879
32965
|
onDelete,
|