@useinsider/guido 3.28.1-beta.c5eeeb7 → 3.28.1-beta.d3309a6
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 +10 -0
- package/dist/@types/config/schemas.js +142 -129
- package/dist/@types/display-condition.js +45 -21
- package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +25 -19
- package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +77 -55
- package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +1 -1
- package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +62 -43
- package/dist/components/organisms/display-conditions/LogicBuilderConnector.vue.js +18 -0
- package/dist/components/organisms/display-conditions/LogicBuilderConnector.vue2.js +25 -0
- package/dist/components/organisms/display-conditions/LogicBuilderField.vue.js +28 -0
- package/dist/components/organisms/display-conditions/LogicBuilderField.vue2.js +28 -0
- package/dist/components/organisms/display-conditions/LogicBuilderGroup.vue.js +30 -0
- package/dist/components/organisms/display-conditions/LogicBuilderGroup.vue2.js +32 -0
- package/dist/components/organisms/display-conditions/LogicBuilderRow.vue.js +28 -0
- package/dist/components/organisms/display-conditions/LogicBuilderRow.vue2.js +60 -0
- package/dist/composables/useDisplayConditions.js +83 -68
- package/dist/composables/useScrollToInvalid.js +15 -0
- package/dist/config/migrator/itemsBlockMigrator.js +187 -186
- package/dist/enums/html-validator.js +1 -1
- package/dist/extensions/DisplayConditions/constants.js +19 -10
- package/dist/extensions/DisplayConditions/control.js +120 -99
- package/dist/extensions/DisplayConditions/display-conditions.css.js +58 -6
- package/dist/extensions/DisplayConditions/extension.js +18 -14
- package/dist/guido.css +1 -1
- package/dist/node_modules/valibot/dist/index.js +118 -102
- package/dist/package.json.js +6 -6
- package/dist/services/displayConditionApi.js +18 -19
- package/dist/src/@types/config/schemas.d.ts +65 -0
- package/dist/src/@types/display-condition.d.ts +67 -0
- package/dist/src/components/organisms/display-conditions/LogicBuilderConnector.vue.d.ts +19 -0
- package/dist/src/components/organisms/display-conditions/LogicBuilderField.vue.d.ts +22 -0
- package/dist/src/components/organisms/display-conditions/LogicBuilderGroup.vue.d.ts +24 -0
- package/dist/src/components/organisms/display-conditions/LogicBuilderRow.vue.d.ts +25 -0
- package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
- package/dist/src/composables/useConfig.d.ts +42 -2
- package/dist/src/composables/useDisplayConditions.d.ts +1 -1
- package/dist/src/composables/useScrollToInvalid.d.ts +6 -0
- package/dist/src/extensions/DisplayConditions/constants.d.ts +2 -0
- package/dist/src/extensions/DisplayConditions/control.d.ts +1 -0
- package/dist/src/stores/config.d.ts +441 -21
- package/dist/src/utils/displayConditionBuilder.d.ts +29 -0
- package/dist/src/utils/displayConditionRules.d.ts +12 -0
- package/dist/src/utils/displayConditionSummary.d.ts +11 -0
- package/dist/utils/displayConditionBuilder.js +50 -0
- package/dist/utils/displayConditionRules.js +91 -0
- package/dist/utils/displayConditionSummary.js +28 -0
- package/package.json +1 -1
|
@@ -1,81 +1,103 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import { useDisplayConditions as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
|
|
1
|
+
import { defineComponent as j, reactive as P, ref as i, computed as l, watch as G } from "vue";
|
|
2
|
+
import K from "../../wrappers/WpDrawer.vue.js";
|
|
3
|
+
import { useDisplayConditions as M, DISPLAY_CONDITIONS_TRANS_KEY as c } from "../../../composables/useDisplayConditions.js";
|
|
4
|
+
import { invalidFieldAttrs as W, useScrollToInvalid as q } from "../../../composables/useScrollToInvalid.js";
|
|
5
|
+
import { useTranslations as z } from "../../../composables/useTranslations.js";
|
|
6
|
+
import { DISPLAY_CONDITION_LIMITS as H } from "../../../enums/display-condition.js";
|
|
7
|
+
import { useConfigStore as J } from "../../../stores/config.js";
|
|
8
|
+
import { useDisplayConditionStore as Q } from "../../../stores/display-condition.js";
|
|
9
|
+
import { emptyBuilder as x, builderFromTree as U, treeFromBuilder as V } from "../../../utils/displayConditionBuilder.js";
|
|
10
|
+
import { readLogicBuilderRules as X } from "../../../utils/displayConditionRules.js";
|
|
11
|
+
import { InRadioButton as Z, InBasicTextInput as ee } from "@useinsider/design-system-vue";
|
|
12
|
+
import te from "./CodeEditorField.vue.js";
|
|
13
|
+
import oe from "./LogicBuilderField.vue.js";
|
|
14
|
+
const be = /* @__PURE__ */ j({
|
|
10
15
|
__name: "DisplayConditionCreateDrawer",
|
|
11
|
-
setup(
|
|
12
|
-
const
|
|
13
|
-
validate:
|
|
14
|
-
notifyInvalid:
|
|
15
|
-
createInline:
|
|
16
|
-
createAndSave:
|
|
17
|
-
cancel:
|
|
18
|
-
describeWithAcademyLink:
|
|
19
|
-
} =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
setup(re) {
|
|
17
|
+
const s = z(), p = Q(), S = J(), {
|
|
18
|
+
validate: I,
|
|
19
|
+
notifyInvalid: m,
|
|
20
|
+
createInline: _,
|
|
21
|
+
createAndSave: A,
|
|
22
|
+
cancel: C,
|
|
23
|
+
describeWithAcademyLink: T
|
|
24
|
+
} = M(), v = () => ({
|
|
25
|
+
name: "",
|
|
26
|
+
description: "",
|
|
27
|
+
method: "logicBuilder",
|
|
28
|
+
codeBefore: "",
|
|
29
|
+
codeAfter: "",
|
|
30
|
+
rules: null
|
|
31
|
+
}), e = P(v()), y = i(x()), B = i(!1), F = l(() => {
|
|
32
|
+
var t;
|
|
33
|
+
return ((t = S.template) == null ? void 0 : t.displayConditionAttributes) ?? { custom: [], default: [] };
|
|
34
|
+
}), g = l(() => e.method === "logicBuilder"), r = i({}), a = i(!1), d = i(!1), u = l(() => a.value || d.value), h = i(), D = i(), O = i(), { scrollToFirstInvalid: b } = q(O);
|
|
35
|
+
let f = 0;
|
|
36
|
+
G(() => p.isCreateOpen, (t) => {
|
|
37
|
+
if (f += 1, !t)
|
|
23
38
|
return;
|
|
24
|
-
const { editing:
|
|
25
|
-
Object.assign(e,
|
|
26
|
-
name:
|
|
27
|
-
description:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
39
|
+
const { editing: o } = p, n = o ? X(o.extraData) : null;
|
|
40
|
+
Object.assign(e, v(), o ? {
|
|
41
|
+
name: o.name,
|
|
42
|
+
description: o.description,
|
|
43
|
+
method: n ? "logicBuilder" : "codeOnly",
|
|
44
|
+
codeBefore: n ? "" : o.beforeScript,
|
|
45
|
+
codeAfter: n ? "" : o.afterScript
|
|
46
|
+
} : {}), y.value = n ? U(n) : x(), B.value = !1, r.value = {}, a.value = !1;
|
|
31
47
|
}, { immediate: !0 });
|
|
32
|
-
const
|
|
48
|
+
const $ = l(() => T("create-description")), N = l(() => ({
|
|
33
49
|
cancelOrBackButton: {
|
|
34
50
|
styling: "ghost",
|
|
35
51
|
type: "secondary",
|
|
36
|
-
labelText:
|
|
37
|
-
disabledStatus:
|
|
52
|
+
labelText: s(`${c}.cancel`),
|
|
53
|
+
disabledStatus: u.value
|
|
38
54
|
},
|
|
39
55
|
secondaryButton: {
|
|
40
56
|
styling: "solid",
|
|
41
57
|
type: "subtle-primary",
|
|
42
|
-
labelText:
|
|
43
|
-
loadingStatus:
|
|
58
|
+
labelText: s(`${c}.create-and-save`),
|
|
59
|
+
loadingStatus: a.value
|
|
44
60
|
},
|
|
45
61
|
primaryButton: {
|
|
46
62
|
styling: "solid",
|
|
47
63
|
type: "primary",
|
|
48
|
-
labelText:
|
|
49
|
-
disabledStatus:
|
|
64
|
+
labelText: s(`${c}.create`),
|
|
65
|
+
disabledStatus: u.value
|
|
50
66
|
}
|
|
51
|
-
})),
|
|
52
|
-
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
67
|
+
})), k = (t, o) => {
|
|
68
|
+
o !== e[t] && (e[t] = o, r.value[t] && (r.value = { ...r.value, [t]: void 0 }));
|
|
69
|
+
}, E = l(() => `${s(`${c}.condition-description`)} <span class="guido-display-condition-create__optional t-c-53">(${s(`${c}.optional`)})</span>`), Y = (t) => {
|
|
70
|
+
a.value || (e.method = t);
|
|
71
|
+
}, w = async () => {
|
|
72
|
+
var L, R;
|
|
73
|
+
const t = f;
|
|
74
|
+
d.value = !0;
|
|
75
|
+
const [o, n] = await Promise.all([(L = h.value) == null ? void 0 : L.read(), (R = D.value) == null ? void 0 : R.read()]);
|
|
76
|
+
return d.value = !1, t !== f ? !1 : (e.codeBefore = o ?? e.codeBefore, e.codeAfter = n ?? e.codeAfter, !0);
|
|
77
|
+
};
|
|
78
|
+
return { __sfc: !0, trans: s, store: p, configStore: S, validate: I, notifyInvalid: m, createInline: _, createAndSave: A, cancel: C, describeWithAcademyLink: T, emptyDraft: v, draft: e, builder: y, showRuleErrors: B, attributes: F, isLogicBuilder: g, errors: r, isSaving: a, isReadingCode: d, isBusy: u, codeBeforeRef: h, codeAfterRef: D, contentRef: O, scrollToFirstInvalid: b, openGeneration: f, descriptionText: $, footerButtonGroupOptions: N, updateField: k, descriptionLabel: E, selectMethod: Y, readCode: w, submit: async (t) => {
|
|
79
|
+
if (u.value)
|
|
57
80
|
return;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (l.value = !1, t !== d)
|
|
81
|
+
if (g.value)
|
|
82
|
+
e.rules = V(y.value), B.value = !e.rules;
|
|
83
|
+
else if (!await w())
|
|
62
84
|
return;
|
|
63
|
-
if (
|
|
64
|
-
|
|
85
|
+
if (r.value = I(e), Object.keys(r.value).length || g.value && !e.rules) {
|
|
86
|
+
m(), await b();
|
|
65
87
|
return;
|
|
66
88
|
}
|
|
67
|
-
if (
|
|
68
|
-
|
|
89
|
+
if (t === "inline") {
|
|
90
|
+
_({ ...e });
|
|
69
91
|
return;
|
|
70
92
|
}
|
|
71
|
-
|
|
72
|
-
const
|
|
73
|
-
|
|
93
|
+
a.value = !0;
|
|
94
|
+
const o = await A({ ...e });
|
|
95
|
+
a.value = !1, r.value = o ?? {}, Object.keys(r.value).length && (m(), await b());
|
|
74
96
|
}, close: () => {
|
|
75
|
-
|
|
76
|
-
}, WpDrawer:
|
|
97
|
+
u.value || C();
|
|
98
|
+
}, WpDrawer: K, KEY: c, invalidFieldAttrs: W, DISPLAY_CONDITION_LIMITS: H, InBasicTextInput: ee, InRadioButton: Z, CodeEditorField: te, LogicBuilderField: oe };
|
|
77
99
|
}
|
|
78
100
|
});
|
|
79
101
|
export {
|
|
80
|
-
|
|
102
|
+
be as default
|
|
81
103
|
};
|
|
@@ -1,63 +1,82 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { useDisplayConditions as
|
|
5
|
-
import { useTranslations as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
|
|
1
|
+
import { defineComponent as b, ref as d, watch as j, computed as a } from "vue";
|
|
2
|
+
import K from "../../wrappers/WpDrawer.vue.js";
|
|
3
|
+
import P from "../../wrappers/WpModal.vue.js";
|
|
4
|
+
import { useDisplayConditions as W, DISPLAY_CONDITIONS_TRANS_KEY as n } from "../../../composables/useDisplayConditions.js";
|
|
5
|
+
import { useTranslations as Y } from "../../../composables/useTranslations.js";
|
|
6
|
+
import { useConfigStore as w } from "../../../stores/config.js";
|
|
7
|
+
import { useDisplayConditionStore as F } from "../../../stores/display-condition.js";
|
|
8
|
+
import { parseRuleTree as G } from "../../../utils/displayConditionRules.js";
|
|
9
|
+
import { summarizeRuleTree as H, OPERATOR_TRANS_SUFFIX as q } from "../../../utils/displayConditionSummary.js";
|
|
10
|
+
import { getTooltipOptions as z } from "../../../utils/tooltipUtils.js";
|
|
11
|
+
import { InSkeleton as U, InDropdownMenu as V, InButtonV2 as X, InBasicTextInput as J } from "@useinsider/design-system-vue";
|
|
12
|
+
import Q from "./DisplayConditionListState.vue.js";
|
|
13
|
+
const me = /* @__PURE__ */ b({
|
|
11
14
|
__name: "DisplayConditionSelectDrawer",
|
|
12
|
-
setup(
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
e && (
|
|
15
|
+
setup(Z) {
|
|
16
|
+
const T = [40, 76, 76, 76], o = Y(), t = F(), m = w(), { loadList: f, select: $, deleteSaved: g, cancel: O, describeWithAcademyLink: v } = W(), p = d(""), c = d(null), l = d(null), i = d(!1);
|
|
17
|
+
j(() => t.isSelectOpen, (e) => {
|
|
18
|
+
e && (p.value = "", c.value = null, l.value = null, f());
|
|
16
19
|
}, { immediate: !0 });
|
|
17
|
-
const
|
|
18
|
-
const e =
|
|
19
|
-
return e ? t.list.filter((
|
|
20
|
-
}),
|
|
20
|
+
const y = a(() => {
|
|
21
|
+
const e = p.value.trim().toLocaleLowerCase();
|
|
22
|
+
return e ? t.list.filter((s) => `${s.name} ${s.description}`.toLocaleLowerCase().includes(e)) : t.list;
|
|
23
|
+
}), B = a(() => t.listStatus === "error" ? "error" : t.list.length ? y.value.length ? null : "no-result" : "empty"), I = a(() => v("select-description")), x = a(() => ({
|
|
21
24
|
cancelOrBackButton: {
|
|
22
25
|
styling: "ghost",
|
|
23
26
|
type: "secondary",
|
|
24
|
-
labelText:
|
|
27
|
+
labelText: o(`${n}.back`),
|
|
25
28
|
leftIcon: "line-arrow-left"
|
|
26
29
|
}
|
|
27
|
-
})),
|
|
30
|
+
})), C = a(() => ({
|
|
28
31
|
cancelOrBackButton: {
|
|
29
32
|
type: "secondary",
|
|
30
33
|
styling: "ghost",
|
|
31
|
-
labelText:
|
|
32
|
-
disabledStatus:
|
|
34
|
+
labelText: o(`${n}.cancel`),
|
|
35
|
+
disabledStatus: i.value
|
|
33
36
|
},
|
|
34
37
|
primaryButton: {
|
|
35
38
|
type: "danger",
|
|
36
|
-
labelText:
|
|
37
|
-
loadingStatus:
|
|
39
|
+
labelText: o(`${n}.delete`),
|
|
40
|
+
loadingStatus: i.value
|
|
38
41
|
}
|
|
39
|
-
}))
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}, expandTooltip: (e) => C(
|
|
42
|
+
})), L = (e) => {
|
|
43
|
+
c.value = c.value === e.id ? null : e.id;
|
|
44
|
+
}, h = (e) => {
|
|
45
|
+
l.value = l.value === e.id ? null : e.id;
|
|
46
|
+
}, A = (e) => {
|
|
47
|
+
l.value === e.id && (l.value = null);
|
|
48
|
+
}, E = (e) => z(
|
|
47
49
|
`guido__display-condition-expand-tooltip-${e.id}`,
|
|
48
50
|
{ staticPosition: "top right" }
|
|
49
|
-
),
|
|
50
|
-
{ text:
|
|
51
|
-
],
|
|
52
|
-
|
|
53
|
-
},
|
|
54
|
-
!t.pendingDelete ||
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
},
|
|
58
|
-
|
|
51
|
+
), M = (e) => [
|
|
52
|
+
{ text: o(`${n}.delete`), value: `guido__display-condition-delete-${e.id}` }
|
|
53
|
+
], R = (e) => {
|
|
54
|
+
l.value = null, t.pendingDelete = e;
|
|
55
|
+
}, k = async () => {
|
|
56
|
+
!t.pendingDelete || i.value || (i.value = !0, await g(t.pendingDelete), i.value = !1);
|
|
57
|
+
}, N = () => {
|
|
58
|
+
i.value || (t.pendingDelete = null);
|
|
59
|
+
}, S = (e) => {
|
|
60
|
+
var D;
|
|
61
|
+
const s = G(e.codeBefore);
|
|
62
|
+
if (!s)
|
|
63
|
+
return null;
|
|
64
|
+
const r = (D = m.template) == null ? void 0 : D.displayConditionAttributes, _ = H(
|
|
65
|
+
s,
|
|
66
|
+
[...(r == null ? void 0 : r.custom) ?? [], ...(r == null ? void 0 : r.default) ?? []],
|
|
67
|
+
(u) => o(`${n}.operator-${q[u]}`)
|
|
68
|
+
);
|
|
69
|
+
return _.groups.map((u) => u.lines.join(`
|
|
70
|
+
${o(`${n}.${u.condition}`)} `)).join(`
|
|
71
|
+
|
|
72
|
+
${o(`${n}.${_.condition}`)}
|
|
73
|
+
|
|
74
|
+
`);
|
|
75
|
+
};
|
|
76
|
+
return { __sfc: !0, SKELETON_HEIGHTS: T, trans: o, store: t, configStore: m, loadList: f, select: $, deleteSaved: g, cancel: O, describeWithAcademyLink: v, search: p, expandedId: c, menuId: l, isDeleting: i, filteredList: y, listState: B, descriptionText: I, footerButtonGroupOptions: x, deleteModalButtons: C, toggleExpanded: L, toggleMenu: h, closeMenu: A, expandTooltip: E, menuOptions: M, requestDelete: R, confirmDelete: k, closeDeleteModal: N, summaryOf: S, codeOf: (e) => (e.method === "logicBuilder" ? S(e) : null) ?? [e.codeBefore, e.codeAfter].filter(Boolean).join(`
|
|
77
|
+
`), WpDrawer: K, WpModal: P, KEY: n, InBasicTextInput: J, InButtonV2: X, InDropdownMenu: V, InSkeleton: U, DisplayConditionListState: Q };
|
|
59
78
|
}
|
|
60
79
|
});
|
|
61
80
|
export {
|
|
62
|
-
|
|
81
|
+
me as default
|
|
63
82
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
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
|
+
};
|