@useinsider/guido 1.0.3-beta.cc614d6 → 1.0.3-beta.cd0d7f3
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 +35 -0
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +44 -41
- package/dist/components/organisms/header/RightSlot.vue.js +1 -1
- package/dist/components/organisms/header/RightSlot.vue2.js +23 -22
- package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +21 -0
- package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +99 -0
- package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +20 -18
- package/dist/composables/useActionsApi.js +1 -1
- package/dist/composables/useBlocksConfig.js +1 -2
- package/dist/composables/useGuidoActions.js +19 -9
- package/dist/composables/useHtmlCompiler.js +15 -13
- package/dist/composables/useHtmlValidator.js +36 -35
- package/dist/composables/useStripo.js +38 -36
- package/dist/config/compiler/itemsCompilerRules.js +14 -0
- package/dist/config/compiler/unsubscribeCompilerRules.js +33 -28
- package/dist/enums/defaults.js +2 -1
- package/dist/enums/extensions/recommendationBlock.js +2 -2
- package/dist/enums/onboarding.js +7 -3
- package/dist/enums/unsubscribe.js +27 -25
- package/dist/extensions/Blocks/Checkbox/block.js +5 -2
- package/dist/extensions/Blocks/Items/block.js +66 -0
- package/dist/extensions/Blocks/Items/controls/button/link.js +68 -0
- package/dist/extensions/Blocks/Items/controls/cardComposition.js +193 -0
- package/dist/extensions/Blocks/Items/controls/image/link.js +68 -0
- package/dist/extensions/Blocks/Items/controls/index.js +217 -0
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +70 -0
- package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +107 -0
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +123 -0
- package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +76 -0
- package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +61 -0
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +309 -0
- package/dist/extensions/Blocks/Items/enums/controlEnums.js +5 -0
- package/dist/extensions/Blocks/Items/enums/productEnums.js +272 -0
- package/dist/extensions/Blocks/Items/enums/settingsEnums.js +76 -0
- package/dist/extensions/Blocks/Items/extension.js +19 -0
- package/dist/extensions/Blocks/Items/iconsRegistry.js +32 -0
- package/dist/extensions/Blocks/Items/items.css.js +23 -0
- package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +62 -0
- package/dist/extensions/Blocks/Items/layouts/vertical.html.js +61 -0
- package/dist/extensions/Blocks/Items/settingsPanel.js +132 -0
- package/dist/extensions/Blocks/Items/store/items-block.js +71 -0
- package/dist/extensions/Blocks/Items/template.js +194 -0
- package/dist/extensions/Blocks/Items/utils/configBlockUtils.js +17 -0
- package/dist/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.js +28 -0
- package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +67 -0
- package/dist/extensions/Blocks/Items/utils/updateAttributes.js +44 -0
- package/dist/extensions/Blocks/RadioButton/block.js +5 -2
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +43 -43
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +1 -1
- package/dist/extensions/Blocks/common-control.js +174 -110
- package/dist/extensions/Blocks/controlFactories.js +223 -0
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +213 -168
- package/dist/node_modules/lodash-es/_DataView.js +6 -0
- package/dist/node_modules/lodash-es/_Promise.js +6 -0
- package/dist/node_modules/lodash-es/_Set.js +6 -0
- package/dist/node_modules/lodash-es/_SetCache.js +13 -0
- package/dist/node_modules/lodash-es/_WeakMap.js +6 -0
- package/dist/node_modules/lodash-es/_arrayFilter.js +10 -0
- package/dist/node_modules/lodash-es/_arrayLikeKeys.js +13 -12
- package/dist/node_modules/lodash-es/_arrayMap.js +8 -0
- package/dist/node_modules/lodash-es/_arrayPush.js +8 -0
- package/dist/node_modules/lodash-es/_arraySome.js +9 -0
- package/dist/node_modules/lodash-es/_baseEach.js +6 -0
- package/dist/node_modules/lodash-es/_baseFlatten.js +13 -0
- package/dist/node_modules/lodash-es/_baseForOwn.js +8 -0
- package/dist/node_modules/lodash-es/_baseGet.js +11 -0
- package/dist/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
- package/dist/node_modules/lodash-es/_baseHasIn.js +6 -0
- package/dist/node_modules/lodash-es/_baseIsEqual.js +8 -0
- package/dist/node_modules/lodash-es/_baseIsEqualDeep.js +32 -0
- package/dist/node_modules/lodash-es/_baseIsMatch.js +29 -0
- package/dist/node_modules/lodash-es/_baseIteratee.js +11 -0
- package/dist/node_modules/lodash-es/_baseKeys.js +14 -0
- package/dist/node_modules/lodash-es/_baseMap.js +11 -0
- package/dist/node_modules/lodash-es/_baseMatches.js +12 -0
- package/dist/node_modules/lodash-es/_baseMatchesProperty.js +17 -0
- package/dist/node_modules/lodash-es/_baseProperty.js +8 -0
- package/dist/node_modules/lodash-es/_basePropertyDeep.js +9 -0
- package/dist/node_modules/lodash-es/_baseRange.js +9 -0
- package/dist/node_modules/lodash-es/_baseToString.js +18 -0
- package/dist/node_modules/lodash-es/_baseTrim.js +8 -0
- package/dist/node_modules/lodash-es/_cacheHas.js +6 -0
- package/dist/node_modules/lodash-es/_castPath.js +10 -0
- package/dist/node_modules/lodash-es/_createBaseEach.js +15 -0
- package/dist/node_modules/lodash-es/_createRange.js +11 -0
- package/dist/node_modules/lodash-es/_equalArrays.js +40 -0
- package/dist/node_modules/lodash-es/_equalByTag.js +45 -0
- package/dist/node_modules/lodash-es/_equalObjects.js +36 -0
- package/dist/node_modules/lodash-es/_getAllKeys.js +9 -0
- package/dist/node_modules/lodash-es/_getMatchData.js +12 -0
- package/dist/node_modules/lodash-es/_getSymbols.js +10 -0
- package/dist/node_modules/lodash-es/_getTag.js +28 -0
- package/dist/node_modules/lodash-es/_hasPath.js +19 -0
- package/dist/node_modules/lodash-es/_isFlattenable.js +10 -0
- package/dist/node_modules/lodash-es/_isKey.js +12 -0
- package/dist/node_modules/lodash-es/_isStrictComparable.js +7 -0
- package/dist/node_modules/lodash-es/_mapToArray.js +9 -0
- package/dist/node_modules/lodash-es/_matchesStrictComparable.js +8 -0
- package/dist/node_modules/lodash-es/_memoizeCapped.js +11 -0
- package/dist/node_modules/lodash-es/_nativeKeys.js +5 -0
- package/dist/node_modules/lodash-es/_setCacheAdd.js +7 -0
- package/dist/node_modules/lodash-es/_setCacheHas.js +6 -0
- package/dist/node_modules/lodash-es/_setToArray.js +9 -0
- package/dist/node_modules/lodash-es/_stringToPath.js +10 -0
- package/dist/node_modules/lodash-es/_toKey.js +10 -0
- package/dist/node_modules/lodash-es/_trimmedEndIndex.js +9 -0
- package/dist/node_modules/lodash-es/flatMap.js +8 -0
- package/dist/node_modules/lodash-es/get.js +8 -0
- package/dist/node_modules/lodash-es/hasIn.js +8 -0
- package/dist/node_modules/lodash-es/isSymbol.js +9 -0
- package/dist/node_modules/lodash-es/keys.js +9 -0
- package/dist/node_modules/lodash-es/keysIn.js +3 -3
- package/dist/node_modules/lodash-es/map.js +11 -0
- package/dist/node_modules/lodash-es/property.js +10 -0
- package/dist/node_modules/lodash-es/range.js +5 -0
- package/dist/node_modules/lodash-es/stubArray.js +6 -0
- package/dist/node_modules/lodash-es/toFinite.js +14 -0
- package/dist/node_modules/lodash-es/toNumber.js +22 -0
- package/dist/node_modules/lodash-es/toString.js +7 -0
- package/dist/package.json.js +1 -1
- package/dist/services/recommendationApi.js +13 -19
- package/dist/src/@types/generic.d.ts +1 -0
- package/dist/src/components/Guido.vue.d.ts +1 -0
- package/dist/src/components/organisms/onboarding/ItemsOnboarding.vue.d.ts +2 -0
- package/dist/src/composables/useGuidoActions.d.ts +9 -0
- package/dist/src/config/compiler/itemsCompilerRules.d.ts +2 -0
- package/dist/src/enums/onboarding.d.ts +4 -0
- package/dist/src/extensions/Blocks/Checkbox/block.d.ts +1 -0
- package/dist/src/extensions/Blocks/Items/block.d.ts +13 -0
- package/dist/src/extensions/Blocks/Items/controls/button/link.d.ts +14 -0
- package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +33 -0
- package/dist/src/extensions/Blocks/Items/controls/image/link.d.ts +14 -0
- package/dist/src/extensions/Blocks/Items/controls/index.d.ts +501 -0
- package/dist/src/extensions/Blocks/Items/controls/name/trimming.d.ts +14 -0
- package/dist/src/extensions/Blocks/Items/controls/price/currencyLocation.d.ts +19 -0
- package/dist/src/extensions/Blocks/Items/controls/price/currencySymbol.d.ts +21 -0
- package/dist/src/extensions/Blocks/Items/controls/price/formattedPrice.d.ts +14 -0
- package/dist/src/extensions/Blocks/Items/controls/price/hideDiscount.d.ts +13 -0
- package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +45 -0
- package/dist/src/extensions/Blocks/Items/enums/controlEnums.d.ts +61 -0
- package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +161 -0
- package/dist/src/extensions/Blocks/Items/enums/settingsEnums.d.ts +49 -0
- package/dist/src/extensions/Blocks/Items/extension.d.ts +2 -0
- package/dist/src/extensions/Blocks/Items/iconsRegistry.d.ts +4 -0
- package/dist/src/extensions/Blocks/Items/settingsPanel.d.ts +4 -0
- package/dist/src/extensions/Blocks/Items/store/items-block.d.ts +41 -0
- package/dist/src/extensions/Blocks/Items/template.d.ts +16 -0
- package/dist/src/extensions/Blocks/Items/utils/configBlockUtils.d.ts +23 -0
- package/dist/src/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.d.ts +32 -0
- package/dist/src/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.d.ts +44 -0
- package/dist/src/extensions/Blocks/Items/utils/updateAttributes.d.ts +8 -0
- package/dist/src/extensions/Blocks/RadioButton/block.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -1
- package/dist/src/extensions/Blocks/common-control.d.ts +44 -7
- package/dist/src/extensions/Blocks/controlFactories.d.ts +312 -0
- package/dist/src/stores/config.d.ts +2 -1
- package/dist/src/stores/dynamic-content.d.ts +1 -1
- package/dist/src/stores/editor.d.ts +1 -1
- package/dist/src/stores/onboarding.d.ts +335 -1
- package/dist/src/stores/preview.d.ts +1 -1
- package/dist/src/stores/recommendation.d.ts +1 -1
- package/dist/src/stores/save-as-template.d.ts +1 -1
- package/dist/src/stores/toaster.d.ts +1 -1
- package/dist/src/stores/unsubscribe.d.ts +1 -1
- package/dist/src/stores/version-history.d.ts +1 -1
- package/dist/src/utils/environmentUtil.d.ts +5 -0
- package/dist/src/utils/pairProductVariables.d.ts +7 -0
- package/dist/static/styles/customEditorStyle.css.js +1 -1
- package/dist/stores/config.js +5 -5
- package/dist/stores/dynamic-content.js +1 -1
- package/dist/stores/editor.js +1 -1
- package/dist/stores/onboarding.js +44 -36
- package/dist/stores/preview.js +1 -1
- package/dist/stores/recommendation.js +3 -3
- package/dist/stores/save-as-template.js +2 -2
- package/dist/stores/toaster.js +1 -1
- package/dist/stores/unsubscribe.js +1 -1
- package/dist/stores/version-history.js +4 -4
- package/dist/utils/environmentUtil.js +4 -0
- package/dist/utils/genericUtil.js +16 -17
- package/dist/utils/pairProductVariables.js +136 -0
- package/package.json +11 -4
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
var r = Object.defineProperty;
|
|
2
|
+
var a = (o, e, t) => e in o ? r(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
|
+
var s = (o, e, t) => a(o, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { CommonControl as u } from "../../../common-control.js";
|
|
5
|
+
import { ItemsBlockControlId as d } from "../../enums/controlEnums.js";
|
|
6
|
+
import { useItemsBlockStore as l } from "../../store/items-block.js";
|
|
7
|
+
import { syncButtonLinkFromAttributes as h } from "../../utils/syncAttributesFromConfigBlock.js";
|
|
8
|
+
import { updateConfigBlockAttributes as m } from "../../utils/updateAttributes.js";
|
|
9
|
+
const i = d.BUTTON_LINK, n = {
|
|
10
|
+
LINK: "link"
|
|
11
|
+
};
|
|
12
|
+
class C extends u {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
s(this, "store", l());
|
|
16
|
+
}
|
|
17
|
+
getId() {
|
|
18
|
+
return i;
|
|
19
|
+
}
|
|
20
|
+
getTemplate() {
|
|
21
|
+
return `
|
|
22
|
+
<div class="${i}">
|
|
23
|
+
${this._getLink()}
|
|
24
|
+
</div>
|
|
25
|
+
`;
|
|
26
|
+
}
|
|
27
|
+
onRender() {
|
|
28
|
+
this.api.updateValues({
|
|
29
|
+
[n.LINK]: this.store.buttonLink
|
|
30
|
+
}), this._listenToFormUpdates();
|
|
31
|
+
}
|
|
32
|
+
onTemplateNodeUpdated(t) {
|
|
33
|
+
super.onTemplateNodeUpdated(t), this.handleBlockInstanceChange(
|
|
34
|
+
() => h(this.currentNode),
|
|
35
|
+
() => {
|
|
36
|
+
this.api.updateValues({
|
|
37
|
+
[n.LINK]: this.store.buttonLink
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
_listenToFormUpdates() {
|
|
43
|
+
this.api.onValueChanged(
|
|
44
|
+
n.LINK,
|
|
45
|
+
(t) => this._onLinkChange(t)
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
_onLinkChange(t) {
|
|
49
|
+
console.debug("Button link changed to: ", t), this.store.setButtonLink(t), m(this.currentNode, this.api);
|
|
50
|
+
}
|
|
51
|
+
_getLink() {
|
|
52
|
+
return `
|
|
53
|
+
${this._GuOneColumn([
|
|
54
|
+
this._GuLabel({ text: "Link" }),
|
|
55
|
+
this._GuTextInput({
|
|
56
|
+
name: n.LINK,
|
|
57
|
+
placeholder: "Enter Link",
|
|
58
|
+
className: "es-100",
|
|
59
|
+
disabled: !0
|
|
60
|
+
})
|
|
61
|
+
])}
|
|
62
|
+
`;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
export {
|
|
66
|
+
C as ButtonLinkControl,
|
|
67
|
+
i as CONTROL_BLOCK_ID
|
|
68
|
+
};
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
var c = Object.defineProperty;
|
|
2
|
+
var I = (a, n, t) => n in a ? c(a, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[n] = t;
|
|
3
|
+
var _ = (a, n, t) => I(a, typeof n != "symbol" ? n + "" : n, t);
|
|
4
|
+
import { ModificationDescription as l } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as R } from "../../common-control.js";
|
|
6
|
+
import { ItemsBlockId as s } from "../enums/controlEnums.js";
|
|
7
|
+
import { configAttributes as C } from "../enums/productEnums.js";
|
|
8
|
+
import { SETTINGS_ENUMS as u } from "../enums/settingsEnums.js";
|
|
9
|
+
import { useItemsBlockStore as O } from "../store/items-block.js";
|
|
10
|
+
import { getConfigBlock as P, attributeToBoolean as U } from "../utils/configBlockUtils.js";
|
|
11
|
+
const h = "ui-elements-items-card-composition-block", i = {
|
|
12
|
+
PRODUCT_IMAGE: "image",
|
|
13
|
+
PRODUCT_NAME: "name",
|
|
14
|
+
PRODUCT_QUANTITY: "quantity",
|
|
15
|
+
PRODUCT_PRICE: "price",
|
|
16
|
+
PRODUCT_ORIGINAL_PRICE: "originalPrice",
|
|
17
|
+
PRODUCT_BUTTON: "button"
|
|
18
|
+
};
|
|
19
|
+
class g extends R {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments);
|
|
22
|
+
_(this, "store", O());
|
|
23
|
+
_(this, "visibilityState", {
|
|
24
|
+
[i.PRODUCT_IMAGE]: !0,
|
|
25
|
+
[i.PRODUCT_NAME]: !0,
|
|
26
|
+
[i.PRODUCT_QUANTITY]: !0,
|
|
27
|
+
[i.PRODUCT_PRICE]: !0,
|
|
28
|
+
[i.PRODUCT_ORIGINAL_PRICE]: !0,
|
|
29
|
+
[i.PRODUCT_BUTTON]: !0
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
getId() {
|
|
33
|
+
return h;
|
|
34
|
+
}
|
|
35
|
+
getTemplate() {
|
|
36
|
+
return `
|
|
37
|
+
<div class="items-controls-container">
|
|
38
|
+
${[
|
|
39
|
+
{ name: i.PRODUCT_IMAGE, label: "Product Image" },
|
|
40
|
+
{ name: i.PRODUCT_NAME, label: "Product Name" },
|
|
41
|
+
{ name: i.PRODUCT_QUANTITY, label: "Product Quantity" },
|
|
42
|
+
{ name: i.PRODUCT_PRICE, label: "Product Price" },
|
|
43
|
+
{ name: i.PRODUCT_ORIGINAL_PRICE, label: "Product Original Price" },
|
|
44
|
+
{ name: i.PRODUCT_BUTTON, label: "Product Button" }
|
|
45
|
+
].map((e) => this._getToggleContainer(e)).join("")}
|
|
46
|
+
</div>
|
|
47
|
+
`;
|
|
48
|
+
}
|
|
49
|
+
onRender() {
|
|
50
|
+
this._syncVisibilityFromAttributes(), this._handleBrowsedItemsQuantity(), this._initializeToggles(), this._listenToFormUpdates();
|
|
51
|
+
}
|
|
52
|
+
onTemplateNodeUpdated(t) {
|
|
53
|
+
super.onTemplateNodeUpdated(t), this.handleBlockInstanceChange(
|
|
54
|
+
() => {
|
|
55
|
+
this._syncVisibilityFromAttributes(), this._handleBrowsedItemsQuantity(), this._applyVisibilityStyles();
|
|
56
|
+
},
|
|
57
|
+
() => {
|
|
58
|
+
this._updateTogglesFromState();
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
_getToggleContainer({ name: t, label: e }) {
|
|
63
|
+
return `
|
|
64
|
+
<div class="container" name="${t}Container">
|
|
65
|
+
<div class="display-flex align-items-center justify-content-between">
|
|
66
|
+
${this._GuLabel({ text: e, name: `${t}Label` })}
|
|
67
|
+
${this._GuToggle(t)}
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
`;
|
|
71
|
+
}
|
|
72
|
+
_initializeToggles() {
|
|
73
|
+
this._updateTogglesFromState();
|
|
74
|
+
}
|
|
75
|
+
_updateTogglesFromState() {
|
|
76
|
+
this.api.updateValues({
|
|
77
|
+
[i.PRODUCT_IMAGE]: this.visibilityState[i.PRODUCT_IMAGE],
|
|
78
|
+
[i.PRODUCT_NAME]: this.visibilityState[i.PRODUCT_NAME],
|
|
79
|
+
[i.PRODUCT_QUANTITY]: this.visibilityState[i.PRODUCT_QUANTITY],
|
|
80
|
+
[i.PRODUCT_PRICE]: this.visibilityState[i.PRODUCT_PRICE],
|
|
81
|
+
[i.PRODUCT_ORIGINAL_PRICE]: this.visibilityState[i.PRODUCT_ORIGINAL_PRICE],
|
|
82
|
+
[i.PRODUCT_BUTTON]: this.visibilityState[i.PRODUCT_BUTTON]
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
_syncVisibilityFromAttributes() {
|
|
86
|
+
const t = P(this.currentNode);
|
|
87
|
+
if (!t)
|
|
88
|
+
return;
|
|
89
|
+
const e = {
|
|
90
|
+
[i.PRODUCT_IMAGE]: "PRODUCT_IMAGE_VISIBLE",
|
|
91
|
+
[i.PRODUCT_NAME]: "PRODUCT_NAME_VISIBLE",
|
|
92
|
+
[i.PRODUCT_QUANTITY]: "PRODUCT_QUANTITY_VISIBLE",
|
|
93
|
+
[i.PRODUCT_PRICE]: "PRODUCT_PRICE_VISIBLE",
|
|
94
|
+
[i.PRODUCT_ORIGINAL_PRICE]: "PRODUCT_ORIGINAL_PRICE_VISIBLE",
|
|
95
|
+
[i.PRODUCT_BUTTON]: "PRODUCT_BUTTON_VISIBLE"
|
|
96
|
+
};
|
|
97
|
+
Object.entries(e).forEach(([o, r]) => {
|
|
98
|
+
const T = t.getAttribute(C[r]);
|
|
99
|
+
this.visibilityState[o] = U(T, !0);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* If itemsType is not BROWSED_ITEMS, show quantity
|
|
104
|
+
* If itemsType is BROWSED_ITEMS, hide quantity
|
|
105
|
+
* and mark it as '0'
|
|
106
|
+
*/
|
|
107
|
+
_handleBrowsedItemsQuantity() {
|
|
108
|
+
var r;
|
|
109
|
+
const t = this.store.itemsType !== u.ITEMS_TYPE.BROWSED_ITEMS, e = (r = this.currentNode) == null ? void 0 : r.querySelector("esd-config-block");
|
|
110
|
+
if (!e)
|
|
111
|
+
return;
|
|
112
|
+
const o = e.getAttribute(C.PRODUCT_QUANTITY_VISIBLE) === "1";
|
|
113
|
+
this.visibilityState[i.PRODUCT_QUANTITY] = t && o, this.api.setVisibility(`${i.PRODUCT_QUANTITY}Container`, t), this._updateVisibilityAttribute(i.PRODUCT_QUANTITY, t && o);
|
|
114
|
+
}
|
|
115
|
+
_applyVisibilityStyles() {
|
|
116
|
+
const t = {
|
|
117
|
+
[i.PRODUCT_IMAGE]: s.IMAGE,
|
|
118
|
+
[i.PRODUCT_NAME]: s.NAME,
|
|
119
|
+
[i.PRODUCT_QUANTITY]: s.QUANTITY,
|
|
120
|
+
[i.PRODUCT_PRICE]: s.PRICE,
|
|
121
|
+
[i.PRODUCT_ORIGINAL_PRICE]: s.ORIGINAL_PRICE,
|
|
122
|
+
[i.PRODUCT_BUTTON]: s.BUTTON
|
|
123
|
+
};
|
|
124
|
+
Object.entries(t).forEach(([e, o]) => {
|
|
125
|
+
var d;
|
|
126
|
+
const r = (d = this.currentNode) == null ? void 0 : d.querySelector(`[esd-extension-block-id="${o}"]`);
|
|
127
|
+
if (!r)
|
|
128
|
+
return;
|
|
129
|
+
const T = this.visibilityState[e];
|
|
130
|
+
this.api.getDocumentModifier().modifyHtml(r).setStyle("display", T ? "table-cell" : "none").apply(new l(`Applied ${e} visibility from attributes`));
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
_updateVisibilityAttribute(t, e) {
|
|
134
|
+
const o = P(this.currentNode);
|
|
135
|
+
if (!o)
|
|
136
|
+
return;
|
|
137
|
+
const T = {
|
|
138
|
+
[i.PRODUCT_IMAGE]: "PRODUCT_IMAGE_VISIBLE",
|
|
139
|
+
[i.PRODUCT_NAME]: "PRODUCT_NAME_VISIBLE",
|
|
140
|
+
[i.PRODUCT_QUANTITY]: "PRODUCT_QUANTITY_VISIBLE",
|
|
141
|
+
[i.PRODUCT_PRICE]: "PRODUCT_PRICE_VISIBLE",
|
|
142
|
+
[i.PRODUCT_ORIGINAL_PRICE]: "PRODUCT_ORIGINAL_PRICE_VISIBLE",
|
|
143
|
+
[i.PRODUCT_BUTTON]: "PRODUCT_BUTTON_VISIBLE"
|
|
144
|
+
}[t];
|
|
145
|
+
T && this.api.getDocumentModifier().modifyHtml(o).setAttribute(C[T], e ? "1" : "0").apply(new l(`Updated ${t} visibility attribute`));
|
|
146
|
+
}
|
|
147
|
+
_listenToFormUpdates() {
|
|
148
|
+
this.api.onValueChanged(i.PRODUCT_IMAGE, (t) => this._onProductImageChange(t)), this.api.onValueChanged(i.PRODUCT_NAME, (t) => this._onProductNameChange(t)), this.api.onValueChanged(i.PRODUCT_QUANTITY, (t) => this._onProductQuantityChange(t)), this.api.onValueChanged(i.PRODUCT_PRICE, (t) => this._onProductPriceChange(t)), this.api.onValueChanged(
|
|
149
|
+
i.PRODUCT_ORIGINAL_PRICE,
|
|
150
|
+
(t) => this._onProductOriginalPriceChange(t)
|
|
151
|
+
), this.api.onValueChanged(i.PRODUCT_BUTTON, (t) => this._onProductButtonChange(t));
|
|
152
|
+
}
|
|
153
|
+
_onProductImageChange(t) {
|
|
154
|
+
var o;
|
|
155
|
+
const e = (o = this.currentNode) == null ? void 0 : o.querySelector(`[esd-extension-block-id="${s.IMAGE}"]`);
|
|
156
|
+
e && (this.visibilityState[i.PRODUCT_IMAGE] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new l(`Product image visibility changed to ${t ? "visible" : "hidden"}`)), this._updateVisibilityAttribute(i.PRODUCT_IMAGE, t));
|
|
157
|
+
}
|
|
158
|
+
_onProductNameChange(t) {
|
|
159
|
+
var o;
|
|
160
|
+
const e = (o = this.currentNode) == null ? void 0 : o.querySelector(`[esd-extension-block-id="${s.NAME}"]`);
|
|
161
|
+
e && (this.visibilityState[i.PRODUCT_NAME] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new l(`Product name visibility changed to ${t ? "visible" : "hidden"}`)), this._updateVisibilityAttribute(i.PRODUCT_NAME, t));
|
|
162
|
+
}
|
|
163
|
+
_onProductQuantityChange(t) {
|
|
164
|
+
var o;
|
|
165
|
+
const e = (o = this.currentNode) == null ? void 0 : o.querySelector(`[esd-extension-block-id="${s.QUANTITY}"]`);
|
|
166
|
+
e && (this.visibilityState[i.PRODUCT_QUANTITY] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new l(
|
|
167
|
+
`Product quantity visibility changed to ${t ? "visible" : "hidden"}`
|
|
168
|
+
)), this._updateVisibilityAttribute(i.PRODUCT_QUANTITY, t));
|
|
169
|
+
}
|
|
170
|
+
_onProductPriceChange(t) {
|
|
171
|
+
var o;
|
|
172
|
+
const e = (o = this.currentNode) == null ? void 0 : o.querySelector(`[esd-extension-block-id="${s.PRICE}"]`);
|
|
173
|
+
e && (this.visibilityState[i.PRODUCT_PRICE] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new l(`Product price visibility changed to ${t ? "visible" : "hidden"}`)), this._updateVisibilityAttribute(i.PRODUCT_PRICE, t));
|
|
174
|
+
}
|
|
175
|
+
_onProductOriginalPriceChange(t) {
|
|
176
|
+
var o;
|
|
177
|
+
const e = (o = this.currentNode) == null ? void 0 : o.querySelector(
|
|
178
|
+
`[esd-extension-block-id="${s.ORIGINAL_PRICE}"]`
|
|
179
|
+
);
|
|
180
|
+
e && (this.visibilityState[i.PRODUCT_ORIGINAL_PRICE] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new l(
|
|
181
|
+
`Product original price visibility changed to ${t ? "visible" : "hidden"}`
|
|
182
|
+
)), this._updateVisibilityAttribute(i.PRODUCT_ORIGINAL_PRICE, t));
|
|
183
|
+
}
|
|
184
|
+
_onProductButtonChange(t) {
|
|
185
|
+
var o;
|
|
186
|
+
const e = (o = this.currentNode) == null ? void 0 : o.querySelector(`[esd-extension-block-id="${s.BUTTON}"]`);
|
|
187
|
+
e && (this.visibilityState[i.PRODUCT_BUTTON] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new l(`Product button visibility changed to ${t ? "visible" : "hidden"}`)), this._updateVisibilityAttribute(i.PRODUCT_BUTTON, t));
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
export {
|
|
191
|
+
h as COMPOSITION_CONTROL_BLOCK_ID,
|
|
192
|
+
g as ItemsBlockCardCompositionControl
|
|
193
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
var r = Object.defineProperty;
|
|
2
|
+
var a = (o, t, e) => t in o ? r(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
|
|
3
|
+
var i = (o, t, e) => a(o, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { CommonControl as m } from "../../../common-control.js";
|
|
5
|
+
import { ItemsBlockControlId as d } from "../../enums/controlEnums.js";
|
|
6
|
+
import { useItemsBlockStore as l } from "../../store/items-block.js";
|
|
7
|
+
import { syncImageLinkFromAttributes as h } from "../../utils/syncAttributesFromConfigBlock.js";
|
|
8
|
+
import { updateConfigBlockAttributes as p } from "../../utils/updateAttributes.js";
|
|
9
|
+
const s = d.IMAGE_LINK, n = {
|
|
10
|
+
LINK: "link"
|
|
11
|
+
};
|
|
12
|
+
class N extends m {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
i(this, "store", l());
|
|
16
|
+
}
|
|
17
|
+
getId() {
|
|
18
|
+
return s;
|
|
19
|
+
}
|
|
20
|
+
getTemplate() {
|
|
21
|
+
return `
|
|
22
|
+
<div class="${s}">
|
|
23
|
+
${this._getLink()}
|
|
24
|
+
</div>
|
|
25
|
+
`;
|
|
26
|
+
}
|
|
27
|
+
onRender() {
|
|
28
|
+
this.api.updateValues({
|
|
29
|
+
[n.LINK]: this.store.imageLink
|
|
30
|
+
}), this._listenToFormUpdates();
|
|
31
|
+
}
|
|
32
|
+
onTemplateNodeUpdated(e) {
|
|
33
|
+
super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(
|
|
34
|
+
() => h(this.currentNode),
|
|
35
|
+
() => {
|
|
36
|
+
this.api.updateValues({
|
|
37
|
+
[n.LINK]: this.store.imageLink
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
_listenToFormUpdates() {
|
|
43
|
+
this.api.onValueChanged(
|
|
44
|
+
n.LINK,
|
|
45
|
+
(e) => this._onLinkChange(e)
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
_onLinkChange(e) {
|
|
49
|
+
console.debug("Image link changed to: ", e), this.store.setImageLink(e), p(this.currentNode, this.api);
|
|
50
|
+
}
|
|
51
|
+
_getLink() {
|
|
52
|
+
return `
|
|
53
|
+
${this._GuOneColumn([
|
|
54
|
+
this._GuLabel({ text: "Link" }),
|
|
55
|
+
this._GuTextInput({
|
|
56
|
+
name: n.LINK,
|
|
57
|
+
placeholder: "Enter Link",
|
|
58
|
+
className: "es-100",
|
|
59
|
+
disabled: !0
|
|
60
|
+
})
|
|
61
|
+
])}
|
|
62
|
+
`;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
export {
|
|
66
|
+
s as CONTROL_BLOCK_ID,
|
|
67
|
+
N as ImageLinkControl
|
|
68
|
+
};
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { createTextAlignControl as r, createTextColorControl as l, createTextSizeControl as e, createTextStyleControl as C, createTextFontFamilyControl as I, createTextBackgroundColorControl as T, createPaddingsControl as i, createImageSizeControl as c, createImageMarginsControl as N, createButtonAlignControl as a, createButtonBorderControl as s, createButtonBorderRadiusControl as A, createButtonColorControl as O, createButtonFontFamilyControl as _, createButtonMarginsControl as E, createButtonPaddingsControl as R, createButtonTextControl as B, createButtonTextSizeControl as P, createButtonTextStyleAndFontColorControl as g, createButtonFitToContainerControl as d } from "../../controlFactories.js";
|
|
2
|
+
import { ItemsBlockId as o, ItemsBlockControlId as t } from "../enums/controlEnums.js";
|
|
3
|
+
const n = ".items-block", u = a(
|
|
4
|
+
t.BUTTON_ALIGN,
|
|
5
|
+
o.BUTTON,
|
|
6
|
+
n
|
|
7
|
+
), S = s(
|
|
8
|
+
t.BUTTON_BORDER,
|
|
9
|
+
o.BUTTON,
|
|
10
|
+
n
|
|
11
|
+
), U = A(
|
|
12
|
+
t.BUTTON_BORDER_RADIUS,
|
|
13
|
+
o.BUTTON,
|
|
14
|
+
n
|
|
15
|
+
), F = O(
|
|
16
|
+
t.BUTTON_COLOR,
|
|
17
|
+
o.BUTTON,
|
|
18
|
+
n
|
|
19
|
+
), L = _(
|
|
20
|
+
t.BUTTON_FONT_FAMILY,
|
|
21
|
+
o.BUTTON,
|
|
22
|
+
n
|
|
23
|
+
), m = E(
|
|
24
|
+
t.BUTTON_MARGINS,
|
|
25
|
+
o.BUTTON,
|
|
26
|
+
n
|
|
27
|
+
), G = R(
|
|
28
|
+
t.BUTTON_PADDINGS,
|
|
29
|
+
o.BUTTON,
|
|
30
|
+
n
|
|
31
|
+
), y = B(
|
|
32
|
+
t.BUTTON_TEXT,
|
|
33
|
+
o.BUTTON,
|
|
34
|
+
n
|
|
35
|
+
), M = P(
|
|
36
|
+
t.BUTTON_TEXT_SIZE,
|
|
37
|
+
o.BUTTON,
|
|
38
|
+
n
|
|
39
|
+
), Y = g(
|
|
40
|
+
t.BUTTON_TEXT_STYLE_AND_FONT_COLOR,
|
|
41
|
+
o.BUTTON,
|
|
42
|
+
n
|
|
43
|
+
), Q = d(
|
|
44
|
+
t.BUTTON_FIT_TO_CONTENT,
|
|
45
|
+
o.BUTTON,
|
|
46
|
+
n
|
|
47
|
+
), No = {
|
|
48
|
+
align: u,
|
|
49
|
+
border: S,
|
|
50
|
+
borderRadius: U,
|
|
51
|
+
color: F,
|
|
52
|
+
fontFamily: L,
|
|
53
|
+
margins: m,
|
|
54
|
+
paddings: G,
|
|
55
|
+
text: y,
|
|
56
|
+
textSize: M,
|
|
57
|
+
textStyleAndFontColor: Y,
|
|
58
|
+
fitToContent: Q
|
|
59
|
+
}, D = c(
|
|
60
|
+
t.IMAGE_SIZE,
|
|
61
|
+
o.IMAGE,
|
|
62
|
+
n
|
|
63
|
+
), x = N(
|
|
64
|
+
t.IMAGE_MARGINS,
|
|
65
|
+
o.IMAGE,
|
|
66
|
+
n
|
|
67
|
+
), ao = {
|
|
68
|
+
size: D,
|
|
69
|
+
margins: x
|
|
70
|
+
}, z = r(
|
|
71
|
+
t.ORIGINAL_PRICE_ALIGN,
|
|
72
|
+
o.ORIGINAL_PRICE,
|
|
73
|
+
n
|
|
74
|
+
), k = l(
|
|
75
|
+
t.ORIGINAL_PRICE_COLOR,
|
|
76
|
+
o.ORIGINAL_PRICE,
|
|
77
|
+
n
|
|
78
|
+
), f = e(
|
|
79
|
+
t.ORIGINAL_PRICE_SIZE,
|
|
80
|
+
o.ORIGINAL_PRICE,
|
|
81
|
+
n
|
|
82
|
+
), p = C(
|
|
83
|
+
t.ORIGINAL_PRICE_STYLE,
|
|
84
|
+
o.ORIGINAL_PRICE,
|
|
85
|
+
n
|
|
86
|
+
), b = I(
|
|
87
|
+
t.ORIGINAL_PRICE_FONT_FAMILY,
|
|
88
|
+
o.ORIGINAL_PRICE,
|
|
89
|
+
n
|
|
90
|
+
), Z = T(
|
|
91
|
+
t.ORIGINAL_PRICE_BACKGROUND,
|
|
92
|
+
o.ORIGINAL_PRICE,
|
|
93
|
+
n
|
|
94
|
+
), K = i(
|
|
95
|
+
t.ORIGINAL_PRICE_PADDINGS,
|
|
96
|
+
o.ORIGINAL_PRICE,
|
|
97
|
+
n
|
|
98
|
+
), so = {
|
|
99
|
+
align: z,
|
|
100
|
+
color: k,
|
|
101
|
+
size: f,
|
|
102
|
+
style: p,
|
|
103
|
+
fontFamily: b,
|
|
104
|
+
background: Z,
|
|
105
|
+
paddings: K
|
|
106
|
+
}, X = r(
|
|
107
|
+
t.PRICE_ALIGN,
|
|
108
|
+
o.PRICE,
|
|
109
|
+
n
|
|
110
|
+
), h = l(
|
|
111
|
+
t.PRICE_COLOR,
|
|
112
|
+
o.PRICE,
|
|
113
|
+
n
|
|
114
|
+
), j = e(
|
|
115
|
+
t.PRICE_SIZE,
|
|
116
|
+
o.PRICE,
|
|
117
|
+
n
|
|
118
|
+
), q = C(
|
|
119
|
+
t.PRICE_STYLE,
|
|
120
|
+
o.PRICE,
|
|
121
|
+
n
|
|
122
|
+
), v = I(
|
|
123
|
+
t.PRICE_FONT_FAMILY,
|
|
124
|
+
o.PRICE,
|
|
125
|
+
n
|
|
126
|
+
), w = T(
|
|
127
|
+
t.PRICE_BACKGROUND,
|
|
128
|
+
o.PRICE,
|
|
129
|
+
n
|
|
130
|
+
), H = i(
|
|
131
|
+
t.PRICE_PADDINGS,
|
|
132
|
+
o.PRICE,
|
|
133
|
+
n
|
|
134
|
+
), Ao = {
|
|
135
|
+
align: X,
|
|
136
|
+
color: h,
|
|
137
|
+
size: j,
|
|
138
|
+
style: q,
|
|
139
|
+
fontFamily: v,
|
|
140
|
+
background: w,
|
|
141
|
+
paddings: H
|
|
142
|
+
}, J = r(
|
|
143
|
+
t.NAME_ALIGN,
|
|
144
|
+
o.NAME,
|
|
145
|
+
n
|
|
146
|
+
), V = l(
|
|
147
|
+
t.NAME_COLOR,
|
|
148
|
+
o.NAME,
|
|
149
|
+
n
|
|
150
|
+
), W = e(
|
|
151
|
+
t.NAME_SIZE,
|
|
152
|
+
o.NAME,
|
|
153
|
+
n
|
|
154
|
+
), $ = C(
|
|
155
|
+
t.NAME_STYLE,
|
|
156
|
+
o.NAME,
|
|
157
|
+
n
|
|
158
|
+
), oo = I(
|
|
159
|
+
t.NAME_FONT_FAMILY,
|
|
160
|
+
o.NAME,
|
|
161
|
+
n
|
|
162
|
+
), to = T(
|
|
163
|
+
t.NAME_BACKGROUND,
|
|
164
|
+
o.NAME,
|
|
165
|
+
n
|
|
166
|
+
), no = i(
|
|
167
|
+
t.NAME_PADDINGS,
|
|
168
|
+
o.NAME,
|
|
169
|
+
n
|
|
170
|
+
), Oo = {
|
|
171
|
+
align: J,
|
|
172
|
+
color: V,
|
|
173
|
+
size: W,
|
|
174
|
+
style: $,
|
|
175
|
+
fontFamily: oo,
|
|
176
|
+
background: to,
|
|
177
|
+
paddings: no
|
|
178
|
+
}, ro = r(
|
|
179
|
+
t.QUANTITY_ALIGN,
|
|
180
|
+
o.QUANTITY,
|
|
181
|
+
n
|
|
182
|
+
), lo = l(
|
|
183
|
+
t.QUANTITY_COLOR,
|
|
184
|
+
o.QUANTITY,
|
|
185
|
+
n
|
|
186
|
+
), eo = I(
|
|
187
|
+
t.QUANTITY_FONT_FAMILY,
|
|
188
|
+
o.QUANTITY,
|
|
189
|
+
n
|
|
190
|
+
), Co = i(
|
|
191
|
+
t.QUANTITY_PADDINGS,
|
|
192
|
+
o.QUANTITY,
|
|
193
|
+
n
|
|
194
|
+
), Io = e(
|
|
195
|
+
t.QUANTITY_SIZE,
|
|
196
|
+
o.QUANTITY,
|
|
197
|
+
n
|
|
198
|
+
), io = C(
|
|
199
|
+
t.QUANTITY_STYLE,
|
|
200
|
+
o.QUANTITY,
|
|
201
|
+
n
|
|
202
|
+
), _o = {
|
|
203
|
+
align: ro,
|
|
204
|
+
color: lo,
|
|
205
|
+
fontFamily: eo,
|
|
206
|
+
paddings: Co,
|
|
207
|
+
size: Io,
|
|
208
|
+
style: io
|
|
209
|
+
};
|
|
210
|
+
export {
|
|
211
|
+
No as ButtonControls,
|
|
212
|
+
ao as ImageControls,
|
|
213
|
+
Oo as NameControls,
|
|
214
|
+
so as OriginalPriceControls,
|
|
215
|
+
Ao as PriceControls,
|
|
216
|
+
_o as QuantityControls
|
|
217
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
var d = Object.defineProperty;
|
|
2
|
+
var h = (i, t, e) => t in i ? d(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
3
|
+
var s = (i, t, e) => h(i, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { ModificationDescription as n, UIElementType as a, UEAttr as g } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as c } from "../../../common-control.js";
|
|
6
|
+
import { ItemsBlockControlId as l } from "../../enums/controlEnums.js";
|
|
7
|
+
import { SETTINGS_ENUMS as I } from "../../enums/settingsEnums.js";
|
|
8
|
+
import { useItemsBlockStore as N } from "../../store/items-block.js";
|
|
9
|
+
import { syncNameTrimmingFromAttributes as y } from "../../utils/syncAttributesFromConfigBlock.js";
|
|
10
|
+
import { updateConfigBlockAttributes as M } from "../../utils/updateAttributes.js";
|
|
11
|
+
const f = l.NAME_TRIMMING, r = {
|
|
12
|
+
TRIMMING: "trimming"
|
|
13
|
+
};
|
|
14
|
+
class R extends c {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
s(this, "store", N());
|
|
18
|
+
}
|
|
19
|
+
getId() {
|
|
20
|
+
return f;
|
|
21
|
+
}
|
|
22
|
+
getTemplate() {
|
|
23
|
+
return `
|
|
24
|
+
<div class="${l.NAME_TRIMMING}">
|
|
25
|
+
${this._getTextTrimming()}
|
|
26
|
+
</div>
|
|
27
|
+
`;
|
|
28
|
+
}
|
|
29
|
+
onRender() {
|
|
30
|
+
this.api.updateValues({ [r.TRIMMING]: this.store.nameTrimming }), this.api.onValueChanged(r.TRIMMING, (e) => {
|
|
31
|
+
this._onTrimmingChange(e);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
onTemplateNodeUpdated(e) {
|
|
35
|
+
super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(
|
|
36
|
+
() => y(this.currentNode),
|
|
37
|
+
() => {
|
|
38
|
+
this.api.updateValues({ [r.TRIMMING]: this.store.nameTrimming });
|
|
39
|
+
}
|
|
40
|
+
), this.store.nameTrimming && this._applyTrimmingStyles();
|
|
41
|
+
}
|
|
42
|
+
_onTrimmingChange(e) {
|
|
43
|
+
this.store.setNameTrimming(e), M(this.currentNode, this.api), this.api.updateValues({ [r.TRIMMING]: e }), this._applyTrimmingStyles(e);
|
|
44
|
+
}
|
|
45
|
+
_applyTrimmingStyles(e) {
|
|
46
|
+
var m;
|
|
47
|
+
const o = (m = this.currentNode) == null ? void 0 : m.querySelector("p");
|
|
48
|
+
if (!o)
|
|
49
|
+
return;
|
|
50
|
+
const p = e !== void 0 ? e : this.store.nameTrimming, T = this.store.orientation === I.ORIENTATION.VERTICAL;
|
|
51
|
+
p ? this.api.getDocumentModifier().modifyHtml(o).setStyle("white-space", "nowrap").setStyle("overflow", "hidden").setStyle("text-overflow", "ellipsis").setStyle("max-width", T ? "130px" : "100%").apply(new n("Text Trimming Enabled")) : this.api.getDocumentModifier().modifyHtml(o).removeStyle("white-space").removeStyle("overflow").removeStyle("text-overflow").removeStyle("max-width").apply(new n("Text Trimming Disabled"));
|
|
52
|
+
}
|
|
53
|
+
_getTextTrimming() {
|
|
54
|
+
return `
|
|
55
|
+
<div class="container">
|
|
56
|
+
<div class="display-flex align-items-center justify-content-between">
|
|
57
|
+
<${a.LABEL}
|
|
58
|
+
${g.LABEL.text}="${this.api.translate("Text Trimming")}"
|
|
59
|
+
>
|
|
60
|
+
</${a.LABEL}>
|
|
61
|
+
${this._GuToggle(r.TRIMMING)}
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
`;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
export {
|
|
68
|
+
f as CONTROL_BLOCK_ID,
|
|
69
|
+
R as NameTrimmingControl
|
|
70
|
+
};
|