@useinsider/guido 3.28.1-beta.d3309a6 → 3.28.1-beta.ff58f9a
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/README.md +0 -10
- package/dist/@types/config/schemas.js +129 -142
- package/dist/@types/display-condition.js +21 -45
- package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +19 -25
- package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +55 -77
- package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +1 -1
- package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +43 -62
- package/dist/composables/useDisplayConditions.js +68 -83
- package/dist/enums/html-validator.js +1 -1
- package/dist/extensions/DisplayConditions/constants.js +10 -19
- package/dist/extensions/DisplayConditions/control.js +99 -120
- package/dist/extensions/DisplayConditions/display-conditions.css.js +6 -58
- package/dist/extensions/DisplayConditions/extension.js +14 -18
- package/dist/guido.css +1 -1
- package/dist/node_modules/valibot/dist/index.js +102 -118
- package/dist/package.json.js +1 -1
- package/dist/services/displayConditionApi.js +19 -18
- package/dist/src/@types/config/schemas.d.ts +0 -65
- package/dist/src/@types/display-condition.d.ts +0 -67
- package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
- package/dist/src/composables/useConfig.d.ts +2 -42
- package/dist/src/composables/useDisplayConditions.d.ts +1 -1
- package/dist/src/extensions/DisplayConditions/constants.d.ts +0 -2
- package/dist/src/extensions/DisplayConditions/control.d.ts +0 -1
- package/dist/src/stores/config.d.ts +21 -441
- package/package.json +2 -2
- package/dist/components/organisms/display-conditions/LogicBuilderConnector.vue.js +0 -18
- package/dist/components/organisms/display-conditions/LogicBuilderConnector.vue2.js +0 -25
- package/dist/components/organisms/display-conditions/LogicBuilderField.vue.js +0 -28
- package/dist/components/organisms/display-conditions/LogicBuilderField.vue2.js +0 -28
- package/dist/components/organisms/display-conditions/LogicBuilderGroup.vue.js +0 -30
- package/dist/components/organisms/display-conditions/LogicBuilderGroup.vue2.js +0 -32
- package/dist/components/organisms/display-conditions/LogicBuilderRow.vue.js +0 -28
- package/dist/components/organisms/display-conditions/LogicBuilderRow.vue2.js +0 -60
- package/dist/composables/useScrollToInvalid.js +0 -15
- package/dist/src/components/organisms/display-conditions/LogicBuilderConnector.vue.d.ts +0 -19
- package/dist/src/components/organisms/display-conditions/LogicBuilderField.vue.d.ts +0 -22
- package/dist/src/components/organisms/display-conditions/LogicBuilderGroup.vue.d.ts +0 -24
- package/dist/src/components/organisms/display-conditions/LogicBuilderRow.vue.d.ts +0 -25
- package/dist/src/composables/useScrollToInvalid.d.ts +0 -6
- package/dist/src/utils/displayConditionBuilder.d.ts +0 -29
- package/dist/src/utils/displayConditionRules.d.ts +0 -12
- package/dist/src/utils/displayConditionSummary.d.ts +0 -11
- package/dist/utils/displayConditionBuilder.js +0 -50
- package/dist/utils/displayConditionRules.js +0 -91
- package/dist/utils/displayConditionSummary.js +0 -28
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.28.1-beta.
|
|
3
|
+
"version": "3.28.1-beta.ff58f9a",
|
|
4
4
|
"description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
|
|
5
5
|
"main": "./dist/guido.umd.cjs",
|
|
6
6
|
"module": "./dist/library.js",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@stripoinc/ui-editor-extensions": "3.11.0",
|
|
63
63
|
"@useinsider/design-system-organisms": "0.0.3-beta.d816f06",
|
|
64
|
-
"@useinsider/design-system-vue": "2.
|
|
64
|
+
"@useinsider/design-system-vue": "2.7.0",
|
|
65
65
|
"@vueuse/core": "11.3.0",
|
|
66
66
|
"lodash-es": "4.17.21",
|
|
67
67
|
"pinia": "2.3.1",
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import r from "./LogicBuilderConnector.vue2.js";
|
|
2
|
-
/* empty css */
|
|
3
|
-
import n from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
-
var o = function() {
|
|
5
|
-
var e = this, s = e._self._c, t = e._self._setupProxy;
|
|
6
|
-
return s("div", { staticClass: "guido-logic-builder-connector", attrs: { "data-logic": e.value } }, [s(t.InSegments, { attrs: { id: e.id, disable: e.disabled, "segment-list": t.segments, selected: e.value, "with-icon": !1 }, on: { click: t.select } })], 1);
|
|
7
|
-
}, c = [], i = /* @__PURE__ */ n(
|
|
8
|
-
r,
|
|
9
|
-
o,
|
|
10
|
-
c,
|
|
11
|
-
!1,
|
|
12
|
-
null,
|
|
13
|
-
"6c88ce0c"
|
|
14
|
-
);
|
|
15
|
-
const m = i.exports;
|
|
16
|
-
export {
|
|
17
|
-
m as default
|
|
18
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { defineComponent as i, computed as l } from "vue";
|
|
2
|
-
import { DISPLAY_CONDITIONS_TRANS_KEY as s } from "../../../composables/useDisplayConditions.js";
|
|
3
|
-
import { useTranslations as p } from "../../../composables/useTranslations.js";
|
|
4
|
-
import { InSegments as m } from "@useinsider/design-system-vue";
|
|
5
|
-
const I = /* @__PURE__ */ i({
|
|
6
|
-
__name: "LogicBuilderConnector",
|
|
7
|
-
props: {
|
|
8
|
-
id: null,
|
|
9
|
-
value: null,
|
|
10
|
-
disabled: { type: Boolean }
|
|
11
|
-
},
|
|
12
|
-
emits: ["input"],
|
|
13
|
-
setup(r, { emit: o }) {
|
|
14
|
-
const e = r, t = p(), a = l(() => [
|
|
15
|
-
{ text: t(`${s}.and`), value: "and" },
|
|
16
|
-
{ text: t(`${s}.or`), value: "or" }
|
|
17
|
-
]);
|
|
18
|
-
return { __sfc: !0, props: e, emit: o, trans: t, segments: a, select: (n) => {
|
|
19
|
-
!e.disabled && n !== e.value && o("input", n);
|
|
20
|
-
}, InSegments: m };
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
export {
|
|
24
|
-
I as default
|
|
25
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import n from "./LogicBuilderField.vue2.js";
|
|
2
|
-
/* empty css */
|
|
3
|
-
import s from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
-
var d = function() {
|
|
5
|
-
var t = this, i = t._self._c, o = t._self._setupProxy;
|
|
6
|
-
return i("div", { staticClass: "guido-logic-builder", attrs: { id: "guido__display-condition-logic-builder" } }, [t._l(t.value.groups, function(e, u) {
|
|
7
|
-
return i("div", { key: e.id }, [u > 0 ? i(o.LogicBuilderConnector, { staticClass: "guido-logic-builder__group-connector", attrs: { id: `guido__display-condition-group-logic-${e.id}`, disabled: t.disabled, value: t.value.condition }, on: { input: function(r) {
|
|
8
|
-
return o.emit("input", { ...t.value, condition: r });
|
|
9
|
-
} } }) : t._e(), i(o.LogicBuilderGroup, { attrs: { "custom-attributes": t.customAttributes, "default-attributes": t.defaultAttributes, disabled: t.disabled, group: e, "show-errors": t.showErrors, "sole-group": t.value.groups.length === 1 }, on: { remove: function(r) {
|
|
10
|
-
return o.removeGroup(u);
|
|
11
|
-
}, update: function(r) {
|
|
12
|
-
return o.updateGroup(u, r);
|
|
13
|
-
} } })], 1);
|
|
14
|
-
}), i("div", { staticClass: "guido-logic-builder__footer" }, [i(o.InButtonV2, { attrs: { id: "guido__display-condition-add-group", "left-icon": "line-plus-netural", type: "subtle-primary", "disabled-status": t.disabled, "label-text": o.trans(`${o.KEY}.add-condition-group`) }, on: { click: function(e) {
|
|
15
|
-
o.setGroups([...t.value.groups, o.emptyGroup()]);
|
|
16
|
-
} } })], 1)], 2);
|
|
17
|
-
}, l = [], a = /* @__PURE__ */ s(
|
|
18
|
-
n,
|
|
19
|
-
d,
|
|
20
|
-
l,
|
|
21
|
-
!1,
|
|
22
|
-
null,
|
|
23
|
-
"111861b4"
|
|
24
|
-
);
|
|
25
|
-
const f = a.exports;
|
|
26
|
-
export {
|
|
27
|
-
f as default
|
|
28
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { defineComponent as m } from "vue";
|
|
2
|
-
import { DISPLAY_CONDITIONS_TRANS_KEY as a } from "../../../composables/useDisplayConditions.js";
|
|
3
|
-
import { useTranslations as c } from "../../../composables/useTranslations.js";
|
|
4
|
-
import { emptyGroup as n } from "../../../utils/displayConditionBuilder.js";
|
|
5
|
-
import { InButtonV2 as f } from "@useinsider/design-system-vue";
|
|
6
|
-
import d from "./LogicBuilderConnector.vue.js";
|
|
7
|
-
import _ from "./LogicBuilderGroup.vue.js";
|
|
8
|
-
const C = /* @__PURE__ */ m({
|
|
9
|
-
__name: "LogicBuilderField",
|
|
10
|
-
props: {
|
|
11
|
-
value: null,
|
|
12
|
-
showErrors: { type: Boolean },
|
|
13
|
-
customAttributes: null,
|
|
14
|
-
defaultAttributes: null,
|
|
15
|
-
disabled: { type: Boolean }
|
|
16
|
-
},
|
|
17
|
-
emits: ["input"],
|
|
18
|
-
setup(s, { emit: u }) {
|
|
19
|
-
const r = s, i = c(), t = (o) => u("input", {
|
|
20
|
-
...r.value,
|
|
21
|
-
groups: o.length ? o : [n()]
|
|
22
|
-
});
|
|
23
|
-
return { __sfc: !0, props: r, emit: u, trans: i, setGroups: t, updateGroup: (o, p) => t(r.value.groups.map((e, l) => l === o ? p : e)), removeGroup: (o) => t(r.value.groups.filter((p, e) => e !== o)), KEY: a, emptyGroup: n, InButtonV2: f, LogicBuilderConnector: d, LogicBuilderGroup: _ };
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
export {
|
|
27
|
-
C as default
|
|
28
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import n from "./LogicBuilderGroup.vue2.js";
|
|
2
|
-
/* empty css */
|
|
3
|
-
import d from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
-
var s = function() {
|
|
5
|
-
var t = this, r = t._self._c, o = t._self._setupProxy;
|
|
6
|
-
return r("div", { staticClass: "guido-logic-builder-group", attrs: { "data-group-id": t.group.id } }, [t._l(t.group.rows, function(e, u) {
|
|
7
|
-
return r("div", { key: e.id }, [u > 0 ? r(o.LogicBuilderConnector, { attrs: { id: `guido__display-condition-row-logic-${e.id}`, disabled: t.disabled, value: t.group.condition }, on: { input: function(i) {
|
|
8
|
-
return o.emit("update", { ...t.group, condition: i });
|
|
9
|
-
} } }) : t._e(), r(o.LogicBuilderRow, { attrs: { "custom-attributes": t.customAttributes, "default-attributes": t.defaultAttributes, disabled: t.disabled, errors: t.showErrors ? o.findRowErrors(e) : {}, "remove-disabled": t.soleGroup && t.group.rows.length === 1, row: e }, on: { duplicate: function(i) {
|
|
10
|
-
return o.duplicateRow(u);
|
|
11
|
-
}, remove: function(i) {
|
|
12
|
-
return o.removeRow(u);
|
|
13
|
-
}, update: function(i) {
|
|
14
|
-
return o.updateRow(u, i);
|
|
15
|
-
} } })], 1);
|
|
16
|
-
}), r("div", { staticClass: "guido-logic-builder-group__footer" }, [r(o.InButtonV2, { attrs: { id: `guido__display-condition-add-rule-${t.group.id}`, "left-icon": "line-plus-netural", type: "subtle-primary", "disabled-status": t.disabled, "label-text": o.trans(`${o.KEY}.add-condition`) }, on: { click: function(e) {
|
|
17
|
-
o.setRows([...t.group.rows, o.emptyRow()]);
|
|
18
|
-
} } })], 1)], 2);
|
|
19
|
-
}, a = [], l = /* @__PURE__ */ d(
|
|
20
|
-
n,
|
|
21
|
-
s,
|
|
22
|
-
a,
|
|
23
|
-
!1,
|
|
24
|
-
null,
|
|
25
|
-
"3de36f36"
|
|
26
|
-
);
|
|
27
|
-
const g = l.exports;
|
|
28
|
-
export {
|
|
29
|
-
g as default
|
|
30
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { defineComponent as i } from "vue";
|
|
2
|
-
import { DISPLAY_CONDITIONS_TRANS_KEY as m } from "../../../composables/useDisplayConditions.js";
|
|
3
|
-
import { useTranslations as a } from "../../../composables/useTranslations.js";
|
|
4
|
-
import { findRowErrors as c, emptyRow as w, copyRow as f } from "../../../utils/displayConditionBuilder.js";
|
|
5
|
-
import { InButtonV2 as d } from "@useinsider/design-system-vue";
|
|
6
|
-
import R from "./LogicBuilderConnector.vue.js";
|
|
7
|
-
import g from "./LogicBuilderRow.vue.js";
|
|
8
|
-
const N = /* @__PURE__ */ i({
|
|
9
|
-
__name: "LogicBuilderGroup",
|
|
10
|
-
props: {
|
|
11
|
-
group: null,
|
|
12
|
-
showErrors: { type: Boolean },
|
|
13
|
-
customAttributes: null,
|
|
14
|
-
defaultAttributes: null,
|
|
15
|
-
disabled: { type: Boolean },
|
|
16
|
-
soleGroup: { type: Boolean }
|
|
17
|
-
},
|
|
18
|
-
emits: ["update", "remove"],
|
|
19
|
-
setup(u, { emit: e }) {
|
|
20
|
-
const r = u, n = a(), t = (o) => {
|
|
21
|
-
o.length ? e("update", { ...r.group, rows: o }) : e("remove");
|
|
22
|
-
};
|
|
23
|
-
return { __sfc: !0, props: r, emit: e, trans: n, setRows: t, updateRow: (o, s) => t(r.group.rows.map((p, l) => l === o ? s : p)), duplicateRow: (o) => t([
|
|
24
|
-
...r.group.rows.slice(0, o + 1),
|
|
25
|
-
f(r.group.rows[o]),
|
|
26
|
-
...r.group.rows.slice(o + 1)
|
|
27
|
-
]), removeRow: (o) => t(r.group.rows.filter((s, p) => p !== o)), KEY: m, emptyRow: w, findRowErrors: c, InButtonV2: d, LogicBuilderConnector: R, LogicBuilderRow: g };
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
export {
|
|
31
|
-
N as default
|
|
32
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import l from "./LogicBuilderRow.vue2.js";
|
|
2
|
-
/* empty css */
|
|
3
|
-
import r from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
-
var i = function() {
|
|
5
|
-
var t = this, a = t._self._c, e = t._self._setupProxy;
|
|
6
|
-
return a("div", { staticClass: "guido-logic-builder-row", attrs: { "data-rule-attribute": t.row.attribute } }, [a(e.InSelect, t._b({ staticClass: "guido-logic-builder-row__field", attrs: { id: e.fieldId("property"), "search-status": "", "button-status": !1, "disabled-status": t.disabled, "label-status": !1, options: e.propertyOptions, "placeholder-text": e.trans(`${e.KEY}.select-property`), state: e.fieldState(t.errors.attribute), "state-message": t.errors.attribute ? e.trans(`${e.KEY}.error-property-required`) : "", value: e.selectedProperty }, on: { select: e.selectProperty } }, "InSelect", e.invalidFieldAttrs(t.errors.attribute), !1)), a(e.InSelect, t._b({ staticClass: "guido-logic-builder-row__field", attrs: { id: e.fieldId("operator"), "search-status": "", "button-status": !1, "disabled-status": t.disabled, "label-status": !1, options: e.operatorOptions, "placeholder-text": e.trans(`${e.KEY}.select-operator`), state: e.fieldState(t.errors.operator), "state-message": t.errors.operator ? e.trans(`${e.KEY}.error-operator-required`) : "", value: e.selectedOperator }, on: { select: e.selectOperator } }, "InSelect", e.invalidFieldAttrs(t.errors.operator), !1)), e.valueKind === "multi-select" ? a(e.InMultiSelect, t._b({ staticClass: "guido-logic-builder-row__field", attrs: { id: e.fieldId("value"), "button-status": !1, "disabled-status": t.disabled, "label-status": !1, options: e.valueOptions, "placeholder-text": e.trans(`${e.KEY}.enter-value`), "select-all-option-status": !1, state: e.fieldState(t.errors.value), "state-message": e.valueError, value: e.selectedValues }, on: { change: e.selectValues } }, "InMultiSelect", e.invalidFieldAttrs(t.errors.value), !1)) : e.valueKind === "tags" ? a("div", { staticClass: "guido-logic-builder-row__field", on: { paste: e.pasteTags } }, [a(e.InTags, t._b({ attrs: { id: e.fieldId("value"), "allow-duplicates": !1, disable: t.disabled, invalid: !!t.errors.value, "invalid-message": e.valueError, placeholder: e.trans(`${e.KEY}.enter-value`), validate: e.validateTag, value: t.row.values }, on: { input: e.updateTags } }, "InTags", e.invalidFieldAttrs(t.errors.value), !1))], 1) : e.valueKind === "select" ? a(e.InSelect, t._b({ staticClass: "guido-logic-builder-row__field", attrs: { id: e.fieldId("value"), "button-status": !1, "disabled-status": t.disabled, "label-status": !1, options: e.valueOptions, "placeholder-text": e.trans(`${e.KEY}.enter-value`), state: e.fieldState(t.errors.value), "state-message": e.valueError, value: e.selectedValues }, on: { select: function(s) {
|
|
7
|
-
return e.update({ values: [s.value] });
|
|
8
|
-
} } }, "InSelect", e.invalidFieldAttrs(t.errors.value), !1)) : e.valueKind === "date" ? a(e.InDatePickerV2, t._b({ staticClass: "guido-logic-builder-row__field", attrs: { id: e.fieldId("value"), "single-date-picker-status": "", "disabled-status": t.disabled, "label-status": !1, locale: e.datePickerLocale, name: e.fieldId("value"), "placeholder-text": e.trans(`${e.KEY}.enter-value`), state: e.fieldState(t.errors.value), "state-message": e.valueError, value: e.isoToPickerDate(t.row.values[0] ?? "") }, on: { apply: function(s) {
|
|
9
|
-
e.update({ values: [e.pickerDateToIso(s)] });
|
|
10
|
-
} } }, "InDatePickerV2", e.invalidFieldAttrs(t.errors.value), !1)) : a(e.InBasicTextInput, t._b({ staticClass: "guido-logic-builder-row__field", attrs: { id: e.fieldId("value"), type: "text", "character-counter-status": !1, "disabled-status": t.disabled, "label-status": !1, name: e.fieldId("value"), "placeholder-text": e.trans(`${e.KEY}.enter-value`), "state-message": e.valueError, states: e.fieldState(t.errors.value), "tooltip-status": !1, value: t.row.values[0] ?? "" }, on: { input: function(s) {
|
|
11
|
-
return e.update({ values: [s] });
|
|
12
|
-
} } }, "InBasicTextInput", e.invalidFieldAttrs(t.errors.value), !1)), a("div", { staticClass: "guido-logic-builder-row__actions" }, [a(e.InButtonV2, { attrs: { id: e.fieldId("duplicate"), "left-icon": "line-copy", styling: "ghost", type: "primary", "disabled-status": t.disabled, "label-text-status": !1 }, on: { click: function(s) {
|
|
13
|
-
return e.emit("duplicate");
|
|
14
|
-
} } }), a(e.InButtonV2, { attrs: { id: e.fieldId("remove"), "left-icon": "line-delete", styling: "ghost", type: "danger", "disabled-status": t.disabled || t.removeDisabled, "label-text-status": !1 }, on: { click: function(s) {
|
|
15
|
-
return e.emit("remove");
|
|
16
|
-
} } })], 1)], 1);
|
|
17
|
-
}, o = [], d = /* @__PURE__ */ r(
|
|
18
|
-
l,
|
|
19
|
-
i,
|
|
20
|
-
o,
|
|
21
|
-
!1,
|
|
22
|
-
null,
|
|
23
|
-
"8a2effc2"
|
|
24
|
-
);
|
|
25
|
-
const p = d.exports;
|
|
26
|
-
export {
|
|
27
|
-
p as default
|
|
28
|
-
};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { defineComponent as V, computed as a } from "vue";
|
|
2
|
-
import { DISPLAY_CONDITIONS_TRANS_KEY as u } from "../../../composables/useDisplayConditions.js";
|
|
3
|
-
import { invalidFieldAttrs as B } from "../../../composables/useScrollToInvalid.js";
|
|
4
|
-
import { useTranslations as E } from "../../../composables/useTranslations.js";
|
|
5
|
-
import { locale as F } from "../../../utils/dateUtil.js";
|
|
6
|
-
import { isMultiValue as M, withAttribute as N, withOperator as K } from "../../../utils/displayConditionBuilder.js";
|
|
7
|
-
import { operatorsFor as L, isValidRuleValue as Y } from "../../../utils/displayConditionRules.js";
|
|
8
|
-
import { OPERATOR_TRANS_SUFFIX as C } from "../../../utils/displayConditionSummary.js";
|
|
9
|
-
import { InTags as q, InSelect as G, InMultiSelect as U, InDatePickerV2 as X, InButtonV2 as j, InBasicTextInput as z } from "@useinsider/design-system-vue";
|
|
10
|
-
const lt = /* @__PURE__ */ V({
|
|
11
|
-
__name: "LogicBuilderRow",
|
|
12
|
-
props: {
|
|
13
|
-
row: null,
|
|
14
|
-
errors: null,
|
|
15
|
-
customAttributes: null,
|
|
16
|
-
defaultAttributes: null,
|
|
17
|
-
disabled: { type: Boolean },
|
|
18
|
-
removeDisabled: { type: Boolean }
|
|
19
|
-
},
|
|
20
|
-
emits: ["update", "duplicate", "remove"],
|
|
21
|
-
setup(y, { emit: i }) {
|
|
22
|
-
const e = y, l = E(), A = F(), $ = (t) => `guido__display-condition-rule-${t}-${e.row.id}`, m = (t) => ({ text: t.label, value: t.key }), T = a(() => [
|
|
23
|
-
{ text: l(`${u}.custom-attributes`), value: "guido-custom-attributes", list: e.customAttributes },
|
|
24
|
-
{ text: l(`${u}.default-attributes`), value: "guido-default-attributes", list: e.defaultAttributes }
|
|
25
|
-
].filter(({ list: t }) => t.length).map(({ text: t, value: r, list: o }) => ({ text: t, value: r, children: o.map(m) }))), p = a(() => [...e.customAttributes, ...e.defaultAttributes].find((t) => t.key === e.row.attribute)), g = a(() => {
|
|
26
|
-
var t;
|
|
27
|
-
return e.row.attribute ? [{ text: ((t = p.value) == null ? void 0 : t.label) ?? e.row.attribute, value: e.row.attribute }] : [];
|
|
28
|
-
}), v = a(() => L(e.row.type).map((t) => ({
|
|
29
|
-
text: l(`${u}.operator-${C[t]}`),
|
|
30
|
-
value: t
|
|
31
|
-
}))), _ = a(() => v.value.filter((t) => t.value === e.row.operator)), n = a(() => {
|
|
32
|
-
var t;
|
|
33
|
-
return e.row.type === "boolean" ? [
|
|
34
|
-
{ text: l(`${u}.value-true`), value: "true" },
|
|
35
|
-
{ text: l(`${u}.value-false`), value: "false" }
|
|
36
|
-
] : (((t = p.value) == null ? void 0 : t.options) ?? []).map((r) => ({ text: r.label, value: r.value }));
|
|
37
|
-
}), f = a(() => M(e.row.operator)), x = a(() => n.value.filter((t) => e.row.values.includes(t.value))), I = a(() => f.value ? n.value.length ? "multi-select" : "tags" : n.value.length ? "select" : e.row.type === "date" ? "date" : "text"), O = a(() => e.errors.value ? e.row.values.some((t) => t.trim()) ? l(`${u}.error-value-invalid`) : l(`${u}.error-value-required`) : ""), S = (t) => t ? "error" : "default", c = (t) => i("update", { ...e.row, ...t }), k = (t) => {
|
|
38
|
-
const r = [...e.customAttributes, ...e.defaultAttributes].find((o) => o.key === t.value);
|
|
39
|
-
r && r.key !== e.row.attribute && i("update", N(e.row, r));
|
|
40
|
-
}, D = (t) => c({ values: t.map((r) => r.value) }), h = (t) => {
|
|
41
|
-
t.value !== e.row.operator && i("update", K(e.row, t.value));
|
|
42
|
-
}, P = (t) => {
|
|
43
|
-
const [r, o, s] = t.split("-");
|
|
44
|
-
return r && o && s ? `${o}/${s}/${r}` : "";
|
|
45
|
-
}, R = (t) => {
|
|
46
|
-
const [r, o, s] = t.split("/");
|
|
47
|
-
return s && r && o ? `${s}-${r.padStart(2, "0")}-${o.padStart(2, "0")}` : "";
|
|
48
|
-
}, d = /[,\r\n]/, b = (t) => Y(e.row.type, t), w = (t) => c({
|
|
49
|
-
values: [...new Set(t.flatMap((r) => r.split(d)).map((r) => r.trim()).filter(b))]
|
|
50
|
-
});
|
|
51
|
-
return { __sfc: !0, props: e, emit: i, trans: l, datePickerLocale: A, fieldId: $, toOption: m, propertyOptions: T, attribute: p, selectedProperty: g, operatorOptions: v, selectedOperator: _, valueOptions: n, isMulti: f, selectedValues: x, valueKind: I, valueError: O, fieldState: S, update: c, selectProperty: k, selectValues: D, selectOperator: h, isoToPickerDate: P, pickerDateToIso: R, TAG_SEPARATOR: d, validateTag: b, updateTags: w, pasteTags: (t) => {
|
|
52
|
-
var o;
|
|
53
|
-
const r = ((o = t.clipboardData) == null ? void 0 : o.getData("text")) ?? "";
|
|
54
|
-
d.test(r) && (t.preventDefault(), w([...e.row.values, r]));
|
|
55
|
-
}, KEY: u, invalidFieldAttrs: B, InBasicTextInput: z, InButtonV2: j, InDatePickerV2: X, InMultiSelect: U, InSelect: G, InTags: q };
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
export {
|
|
59
|
-
lt as default
|
|
60
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { nextTick as i } from "vue";
|
|
2
|
-
const r = "data-guido-invalid", a = (e) => e ? { [r]: "true" } : {}, n = () => {
|
|
3
|
-
var e;
|
|
4
|
-
return ((e = window.matchMedia) == null ? void 0 : e.call(window, "(prefers-reduced-motion: reduce)").matches) ?? !1;
|
|
5
|
-
}, l = (e) => ({ scrollToFirstInvalid: async () => {
|
|
6
|
-
var o;
|
|
7
|
-
await i();
|
|
8
|
-
const t = (o = e.value) == null ? void 0 : o.querySelector(`[${r}]`);
|
|
9
|
-
return t ? (t.scrollIntoView({ behavior: n() ? "auto" : "smooth", block: "center" }), !0) : !1;
|
|
10
|
-
} });
|
|
11
|
-
export {
|
|
12
|
-
r as INVALID_FIELD_ATTR,
|
|
13
|
-
a as invalidFieldAttrs,
|
|
14
|
-
l as useScrollToInvalid
|
|
15
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { LogicOperator } from '@@/Types/display-condition';
|
|
2
|
-
type __VLS_Props = {
|
|
3
|
-
id: string;
|
|
4
|
-
value: LogicOperator;
|
|
5
|
-
disabled?: boolean;
|
|
6
|
-
};
|
|
7
|
-
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__VLS_Props>, {}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {
|
|
8
|
-
input: (value: "and" | "or") => void;
|
|
9
|
-
}, string, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<__VLS_Props>>>, {}>;
|
|
10
|
-
export default _default;
|
|
11
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
12
|
-
type __VLS_TypePropsToOption<T> = {
|
|
13
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
14
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
15
|
-
} : {
|
|
16
|
-
type: import('vue').PropType<T[K]>;
|
|
17
|
-
required: true;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { DisplayConditionAttribute } from '@@/Types/display-condition';
|
|
2
|
-
import type { BuilderState } from '@@/Utils/displayConditionBuilder';
|
|
3
|
-
type __VLS_Props = {
|
|
4
|
-
value: BuilderState;
|
|
5
|
-
showErrors: boolean;
|
|
6
|
-
customAttributes: DisplayConditionAttribute[];
|
|
7
|
-
defaultAttributes: DisplayConditionAttribute[];
|
|
8
|
-
disabled?: boolean;
|
|
9
|
-
};
|
|
10
|
-
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__VLS_Props>, {}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {
|
|
11
|
-
input: (value: BuilderState) => void;
|
|
12
|
-
}, string, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<__VLS_Props>>>, {}>;
|
|
13
|
-
export default _default;
|
|
14
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
15
|
-
type __VLS_TypePropsToOption<T> = {
|
|
16
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
17
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
18
|
-
} : {
|
|
19
|
-
type: import('vue').PropType<T[K]>;
|
|
20
|
-
required: true;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { DisplayConditionAttribute } from '@@/Types/display-condition';
|
|
2
|
-
import type { BuilderGroup } from '@@/Utils/displayConditionBuilder';
|
|
3
|
-
type __VLS_Props = {
|
|
4
|
-
group: BuilderGroup;
|
|
5
|
-
showErrors: boolean;
|
|
6
|
-
customAttributes: DisplayConditionAttribute[];
|
|
7
|
-
defaultAttributes: DisplayConditionAttribute[];
|
|
8
|
-
disabled?: boolean;
|
|
9
|
-
soleGroup?: boolean;
|
|
10
|
-
};
|
|
11
|
-
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__VLS_Props>, {}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {
|
|
12
|
-
update: (group: BuilderGroup) => void;
|
|
13
|
-
remove: () => void;
|
|
14
|
-
}, string, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<__VLS_Props>>>, {}>;
|
|
15
|
-
export default _default;
|
|
16
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
17
|
-
type __VLS_TypePropsToOption<T> = {
|
|
18
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
19
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
20
|
-
} : {
|
|
21
|
-
type: import('vue').PropType<T[K]>;
|
|
22
|
-
required: true;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { DisplayConditionAttribute } from '@@/Types/display-condition';
|
|
2
|
-
import type { BuilderRow, RowErrors } from '@@/Utils/displayConditionBuilder';
|
|
3
|
-
type __VLS_Props = {
|
|
4
|
-
row: BuilderRow;
|
|
5
|
-
errors: RowErrors;
|
|
6
|
-
customAttributes: DisplayConditionAttribute[];
|
|
7
|
-
defaultAttributes: DisplayConditionAttribute[];
|
|
8
|
-
disabled?: boolean;
|
|
9
|
-
removeDisabled?: boolean;
|
|
10
|
-
};
|
|
11
|
-
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__VLS_Props>, {}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {
|
|
12
|
-
update: (row: BuilderRow) => void;
|
|
13
|
-
duplicate: () => void;
|
|
14
|
-
remove: () => void;
|
|
15
|
-
}, string, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<__VLS_Props>>>, {}>;
|
|
16
|
-
export default _default;
|
|
17
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
18
|
-
type __VLS_TypePropsToOption<T> = {
|
|
19
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
20
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
21
|
-
} : {
|
|
22
|
-
type: import('vue').PropType<T[K]>;
|
|
23
|
-
required: true;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { type Ref } from 'vue';
|
|
2
|
-
export declare const INVALID_FIELD_ATTR = "data-guido-invalid";
|
|
3
|
-
export declare const invalidFieldAttrs: (invalid: unknown) => Record<string, string>;
|
|
4
|
-
export declare const useScrollToInvalid: (container: Ref<HTMLElement | null | undefined>) => {
|
|
5
|
-
scrollToFirstInvalid: () => Promise<boolean>;
|
|
6
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { AttributeType, DisplayConditionAttribute, LogicOperator, RuleOperator, RuleTree } from '@@/Types/display-condition';
|
|
2
|
-
export interface BuilderRow {
|
|
3
|
-
id: number;
|
|
4
|
-
attribute: string;
|
|
5
|
-
type: AttributeType;
|
|
6
|
-
operator: RuleOperator | '';
|
|
7
|
-
values: string[];
|
|
8
|
-
}
|
|
9
|
-
export interface BuilderGroup {
|
|
10
|
-
id: number;
|
|
11
|
-
condition: LogicOperator;
|
|
12
|
-
rows: BuilderRow[];
|
|
13
|
-
}
|
|
14
|
-
export interface BuilderState {
|
|
15
|
-
condition: LogicOperator;
|
|
16
|
-
groups: BuilderGroup[];
|
|
17
|
-
}
|
|
18
|
-
export type RowField = 'attribute' | 'operator' | 'value';
|
|
19
|
-
export type RowErrors = Partial<Record<RowField, true>>;
|
|
20
|
-
export declare const emptyRow: () => BuilderRow;
|
|
21
|
-
export declare const copyRow: (row: BuilderRow) => BuilderRow;
|
|
22
|
-
export declare const emptyGroup: () => BuilderGroup;
|
|
23
|
-
export declare const emptyBuilder: () => BuilderState;
|
|
24
|
-
export declare const builderFromTree: (tree: RuleTree) => BuilderState;
|
|
25
|
-
export declare const isMultiValue: (operator: RuleOperator | "") => boolean;
|
|
26
|
-
export declare const withAttribute: (row: BuilderRow, attribute: DisplayConditionAttribute) => BuilderRow;
|
|
27
|
-
export declare const withOperator: (row: BuilderRow, operator: RuleOperator) => BuilderRow;
|
|
28
|
-
export declare const findRowErrors: (row: BuilderRow) => RowErrors;
|
|
29
|
-
export declare const treeFromBuilder: (state: BuilderState) => RuleTree | null;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { AttributeType, DisplayConditionSyntax, RuleOperator, RuleTree } from '@@/Types/display-condition';
|
|
2
|
-
export declare const OPERATORS_BY_TYPE: Record<AttributeType, RuleOperator[]>;
|
|
3
|
-
export declare const MULTI_VALUE_OPERATORS: readonly RuleOperator[];
|
|
4
|
-
export declare const LOGIC_BUILDER_AFTER_SCRIPT = "{% endif %}";
|
|
5
|
-
export declare const operatorsFor: (type: AttributeType) => RuleOperator[];
|
|
6
|
-
export declare const isValidRuleValue: (type: AttributeType, value: string) => boolean;
|
|
7
|
-
export declare const parseRuleTree: (raw: unknown) => RuleTree | null;
|
|
8
|
-
export declare const compileRuleTree: (tree: RuleTree, syntax: DisplayConditionSyntax, scope: string) => {
|
|
9
|
-
beforeScript: string;
|
|
10
|
-
afterScript: string;
|
|
11
|
-
};
|
|
12
|
-
export declare const readLogicBuilderRules: (extraData: string | undefined) => RuleTree | null;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { DisplayConditionAttribute, LogicOperator, RuleOperator, RuleTree } from '@@/Types/display-condition';
|
|
2
|
-
export declare const OPERATOR_TRANS_SUFFIX: Record<RuleOperator, string>;
|
|
3
|
-
export interface RuleSummaryGroup {
|
|
4
|
-
condition: LogicOperator;
|
|
5
|
-
lines: string[];
|
|
6
|
-
}
|
|
7
|
-
export interface RuleSummary {
|
|
8
|
-
condition: LogicOperator;
|
|
9
|
-
groups: RuleSummaryGroup[];
|
|
10
|
-
}
|
|
11
|
-
export declare const summarizeRuleTree: (tree: RuleTree, attributes: DisplayConditionAttribute[], operatorLabel: (operator: RuleOperator) => string) => RuleSummary;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { isValidRuleValue as s, MULTI_VALUE_OPERATORS as u, operatorsFor as l } from "./displayConditionRules.js";
|
|
2
|
-
let a = 0;
|
|
3
|
-
const r = () => ++a, p = () => ({
|
|
4
|
-
id: r(),
|
|
5
|
-
attribute: "",
|
|
6
|
-
type: "string",
|
|
7
|
-
operator: "",
|
|
8
|
-
values: []
|
|
9
|
-
}), m = (t) => ({ ...t, id: r(), values: [...t.values] }), c = () => ({ id: r(), condition: "and", rows: [p()] }), g = () => ({ condition: "and", groups: [c()] }), b = (t) => ({
|
|
10
|
-
condition: t.condition,
|
|
11
|
-
groups: t.groups.map((e) => ({
|
|
12
|
-
id: r(),
|
|
13
|
-
condition: e.condition,
|
|
14
|
-
rows: e.rules.map((o) => ({ id: r(), ...o, values: [...o.values] }))
|
|
15
|
-
}))
|
|
16
|
-
}), d = (t) => t !== "" && u.includes(t), f = (t, e) => {
|
|
17
|
-
const o = t.operator && l(e.type).includes(t.operator) ? t.operator : "";
|
|
18
|
-
return { ...t, attribute: e.key, type: e.type, operator: o, values: [] };
|
|
19
|
-
}, h = (t, e) => ({
|
|
20
|
-
...t,
|
|
21
|
-
operator: e,
|
|
22
|
-
values: d(e) ? t.values : t.values.slice(0, 1)
|
|
23
|
-
}), v = (t) => {
|
|
24
|
-
const e = {}, o = t.values.filter((i) => i.trim());
|
|
25
|
-
return t.attribute || (e.attribute = !0), t.operator || (e.operator = !0), (!o.length || !o.every((i) => s(t.type, i))) && (e.value = !0), e;
|
|
26
|
-
}, R = (t) => t.groups.length > 0 && t.groups.every((o) => o.rows.length > 0 && o.rows.every((i) => !Object.keys(v(i)).length)) ? {
|
|
27
|
-
version: 1,
|
|
28
|
-
condition: t.condition,
|
|
29
|
-
groups: t.groups.map((o) => ({
|
|
30
|
-
condition: o.condition,
|
|
31
|
-
rules: o.rows.map((i) => ({
|
|
32
|
-
attribute: i.attribute,
|
|
33
|
-
type: i.type,
|
|
34
|
-
operator: i.operator,
|
|
35
|
-
values: i.values.filter((n) => n.trim()).map((n) => i.type === "number" ? n.trim() : n)
|
|
36
|
-
}))
|
|
37
|
-
}))
|
|
38
|
-
} : null;
|
|
39
|
-
export {
|
|
40
|
-
b as builderFromTree,
|
|
41
|
-
m as copyRow,
|
|
42
|
-
g as emptyBuilder,
|
|
43
|
-
c as emptyGroup,
|
|
44
|
-
p as emptyRow,
|
|
45
|
-
v as findRowErrors,
|
|
46
|
-
d as isMultiValue,
|
|
47
|
-
R as treeFromBuilder,
|
|
48
|
-
f as withAttribute,
|
|
49
|
-
h as withOperator
|
|
50
|
-
};
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { RuleTreeSchema as O } from "../@types/display-condition.js";
|
|
2
|
-
import { safeParse as $ } from "../node_modules/valibot/dist/index.js";
|
|
3
|
-
const N = {
|
|
4
|
-
string: ["is", "isNot", "contains", "notContains", "isOneOf", "isNotOneOf"],
|
|
5
|
-
number: ["is", "isNot", "isOneOf", "isNotOneOf"],
|
|
6
|
-
boolean: ["is", "isNot"],
|
|
7
|
-
date: ["is", "isNot", "isOneOf", "isNotOneOf"],
|
|
8
|
-
strings: ["contains", "notContains", "isOneOf", "isNotOneOf"]
|
|
9
|
-
}, L = ["isOneOf", "isNotOneOf"], k = "{% endif %}", g = /^-?\d+(\.\d+)?$/, R = /^\d{4}-\d{2}-\d{2}$/, T = /[{}]|[^\S ]/, U = (t) => N[t] ?? [], B = (t, n) => {
|
|
10
|
-
if (!n.trim() || T.test(n))
|
|
11
|
-
return !1;
|
|
12
|
-
switch (t) {
|
|
13
|
-
case "number":
|
|
14
|
-
return g.test(n.trim());
|
|
15
|
-
case "boolean":
|
|
16
|
-
return n === "true" || n === "false";
|
|
17
|
-
case "date":
|
|
18
|
-
return R.test(n);
|
|
19
|
-
default:
|
|
20
|
-
return !(n.includes('"') && n.includes("'"));
|
|
21
|
-
}
|
|
22
|
-
}, E = (t) => {
|
|
23
|
-
let n = t;
|
|
24
|
-
if (typeof t == "string")
|
|
25
|
-
try {
|
|
26
|
-
n = JSON.parse(t);
|
|
27
|
-
} catch {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
const s = $(O, n);
|
|
31
|
-
return s.success ? s.output : null;
|
|
32
|
-
}, S = (t, n, s) => t === "number" ? String(Number(n.trim())) : t === "boolean" ? n === "true" ? "true" : "false" : s === "pongo" ? `"${n.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"` : n.includes('"') ? `'${n}'` : `"${n}"`, a = (t, n) => n.length === 1 ? n[0] : { kind: t, nodes: n }, _ = (t, n) => {
|
|
33
|
-
const { attribute: s, type: o, operator: u, values: i } = t, c = (e, l) => {
|
|
34
|
-
const f = S(o, l, n);
|
|
35
|
-
return {
|
|
36
|
-
kind: "cmp",
|
|
37
|
-
text: e === "contains" && n === "pongo" ? `${f} in ${s}` : `${s} ${e} ${f}`
|
|
38
|
-
};
|
|
39
|
-
}, r = o === "strings" ? "contains" : "==";
|
|
40
|
-
switch (u) {
|
|
41
|
-
case "isNot":
|
|
42
|
-
return c("!=", i[0]);
|
|
43
|
-
case "contains":
|
|
44
|
-
return c("contains", i[0]);
|
|
45
|
-
case "notContains":
|
|
46
|
-
return { kind: "not", node: c("contains", i[0]) };
|
|
47
|
-
case "isOneOf":
|
|
48
|
-
return a("any", i.map((e) => c(r, e)));
|
|
49
|
-
case "isNotOneOf":
|
|
50
|
-
return o === "strings" ? { kind: "not", node: a("any", i.map((e) => c("contains", e))) } : a("all", i.map((e) => c("!=", e)));
|
|
51
|
-
default:
|
|
52
|
-
return c("==", i[0]);
|
|
53
|
-
}
|
|
54
|
-
}, b = (t, n) => a(
|
|
55
|
-
t.condition === "and" ? "all" : "any",
|
|
56
|
-
t.groups.map((s) => a(
|
|
57
|
-
s.condition === "and" ? "all" : "any",
|
|
58
|
-
s.rules.map((o) => _(o, n))
|
|
59
|
-
))
|
|
60
|
-
), d = (t) => t === "all" ? " and " : " or ", p = (t) => t.kind === "cmp" ? t.text : t.kind === "not" ? `(${p(t.node)}) != true` : t.nodes.map((n) => n.kind !== "cmp" && n.kind !== t.kind && n.kind !== "not" ? `(${p(n)})` : p(n)).join(d(t.kind)), A = (t, n) => {
|
|
61
|
-
const s = [];
|
|
62
|
-
let o = 0;
|
|
63
|
-
const u = (r) => {
|
|
64
|
-
const e = `${n}_${o++}`, [l, f] = r.kind === "not" ? ["unless", "endunless"] : ["if", "endif"], m = i(r.kind === "not" ? r.node : r);
|
|
65
|
-
return s.push(`{% assign ${e} = false %}{% ${l} ${m} %}{% assign ${e} = true %}{% ${f} %}`), e;
|
|
66
|
-
}, i = (r) => r.kind === "cmp" ? r.text : r.kind === "not" ? u(r) : r.nodes.map((e) => e.kind === "cmp" ? e.text : e.kind === r.kind ? i(e) : u(e)).join(d(r.kind)), c = t.kind === "not" ? u(t) : i(t);
|
|
67
|
-
return `${s.join("")}{% if ${c} %}`;
|
|
68
|
-
}, C = (t, n, s) => {
|
|
69
|
-
const o = b(t, n);
|
|
70
|
-
return {
|
|
71
|
-
beforeScript: n === "pongo" ? `{% if ${p(o)} %}` : A(o, s),
|
|
72
|
-
afterScript: k
|
|
73
|
-
};
|
|
74
|
-
}, j = (t) => {
|
|
75
|
-
try {
|
|
76
|
-
const n = JSON.parse(t || "{}");
|
|
77
|
-
return (n == null ? void 0 : n.method) === "logicBuilder" ? E(n.rules) : null;
|
|
78
|
-
} catch {
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
export {
|
|
83
|
-
k as LOGIC_BUILDER_AFTER_SCRIPT,
|
|
84
|
-
L as MULTI_VALUE_OPERATORS,
|
|
85
|
-
N as OPERATORS_BY_TYPE,
|
|
86
|
-
C as compileRuleTree,
|
|
87
|
-
B as isValidRuleValue,
|
|
88
|
-
U as operatorsFor,
|
|
89
|
-
E as parseRuleTree,
|
|
90
|
-
j as readLogicBuilderRules
|
|
91
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const m = {
|
|
2
|
-
is: "is",
|
|
3
|
-
isNot: "is-not",
|
|
4
|
-
contains: "contains",
|
|
5
|
-
notContains: "not-contains",
|
|
6
|
-
isOneOf: "is-one-of",
|
|
7
|
-
isNotOneOf: "is-not-one-of"
|
|
8
|
-
}, r = (i, e, c) => {
|
|
9
|
-
const a = new Map(e.map((n) => [n.key, n])), p = (n) => {
|
|
10
|
-
const o = a.get(n.attribute), d = (s) => {
|
|
11
|
-
var t;
|
|
12
|
-
return ((t = o == null ? void 0 : o.options.find((l) => l.value === s)) == null ? void 0 : t.label) ?? s;
|
|
13
|
-
};
|
|
14
|
-
return [
|
|
15
|
-
(o == null ? void 0 : o.label) ?? n.attribute,
|
|
16
|
-
c(n.operator),
|
|
17
|
-
n.values.map(d).join(", ")
|
|
18
|
-
].join(" ");
|
|
19
|
-
};
|
|
20
|
-
return {
|
|
21
|
-
condition: i.condition,
|
|
22
|
-
groups: i.groups.map((n) => ({ condition: n.condition, lines: n.rules.map(p) }))
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
export {
|
|
26
|
-
m as OPERATOR_TRANS_SUFFIX,
|
|
27
|
-
r as summarizeRuleTree
|
|
28
|
-
};
|