@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260615115948 → 0.8.1-dev.20260616044503
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +41 -15
- package/dist/index.mjs +41 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5505,17 +5505,36 @@ var getNestedValue3 = (obj, path) => {
|
|
|
5505
5505
|
return current && current[key] !== void 0 ? current[key] : void 0;
|
|
5506
5506
|
}, obj);
|
|
5507
5507
|
};
|
|
5508
|
-
{
|
|
5509
|
-
}
|
|
5510
|
-
function generateCompleteBackgroundString(layers, apiBaseUrl) {
|
|
5508
|
+
function generateCompleteBackgroundString(layers, apiBaseUrl, dataItem) {
|
|
5511
5509
|
if (!layers || !Array.isArray(layers)) return "";
|
|
5512
5510
|
return layers.filter((layer) => layer && layer.type && layer.value).map((layer) => {
|
|
5513
5511
|
if (layer.type === "image" && typeof layer.value === "object") {
|
|
5514
5512
|
const imageValue = layer.value;
|
|
5515
|
-
|
|
5513
|
+
let assetUrl = imageValue.assetUrl || "";
|
|
5514
|
+
if (layer.datafield && dataItem) {
|
|
5515
|
+
const fieldValue = getNestedValue3(
|
|
5516
|
+
dataItem,
|
|
5517
|
+
layer.datafield
|
|
5518
|
+
);
|
|
5519
|
+
if (typeof fieldValue === "string" && fieldValue.trim() !== "") {
|
|
5520
|
+
assetUrl = fieldValue;
|
|
5521
|
+
} else if (fieldValue && typeof fieldValue === "object" && fieldValue.assetUrl) {
|
|
5522
|
+
assetUrl = fieldValue.assetUrl;
|
|
5523
|
+
} else if (Array.isArray(fieldValue)) {
|
|
5524
|
+
const matchedAsset = layer.tag ? fieldValue.find(
|
|
5525
|
+
(x) => x?.tag?.toLowerCase() === layer.tag?.toLowerCase()
|
|
5526
|
+
) : fieldValue[0];
|
|
5527
|
+
if (matchedAsset?.assetUrl) {
|
|
5528
|
+
assetUrl = matchedAsset.assetUrl;
|
|
5529
|
+
}
|
|
5530
|
+
}
|
|
5531
|
+
}
|
|
5532
|
+
if (!assetUrl) {
|
|
5533
|
+
return "";
|
|
5534
|
+
}
|
|
5516
5535
|
const url = `url('${AssetUtility_default.resolveUrl(
|
|
5517
5536
|
apiBaseUrl,
|
|
5518
|
-
|
|
5537
|
+
assetUrl
|
|
5519
5538
|
)}')`;
|
|
5520
5539
|
const repeat = layer.repeat || "no-repeat";
|
|
5521
5540
|
const position = layer.position || "center";
|
|
@@ -5525,7 +5544,9 @@ function generateCompleteBackgroundString(layers, apiBaseUrl) {
|
|
|
5525
5544
|
}
|
|
5526
5545
|
if (layer.type === "gradient" && typeof layer.value === "object") {
|
|
5527
5546
|
const gradient = layer.value;
|
|
5528
|
-
if (!gradient.colors || !gradient.direction)
|
|
5547
|
+
if (!gradient.colors || !gradient.direction) {
|
|
5548
|
+
return "";
|
|
5549
|
+
}
|
|
5529
5550
|
const colors = gradient.colors.map(
|
|
5530
5551
|
(colorStop) => `color-mix(in srgb, ${colorStop.color}, transparent ${colorStop.transparency ?? 0}%) ${colorStop.start || "0%"}`
|
|
5531
5552
|
).join(", ");
|
|
@@ -5628,7 +5649,6 @@ var DivContainer = async (props) => {
|
|
|
5628
5649
|
const tabletStyles = props.node.tabletCssProperties;
|
|
5629
5650
|
const dataBindingProperties = props.node.dataBinding;
|
|
5630
5651
|
const updatedStyles = convertKeysToCamelCase(styles);
|
|
5631
|
-
const background = generateCompleteBackgroundString(props.node.backgroundLayers, props.assetBaseUrl);
|
|
5632
5652
|
let containerPaddingClass = "";
|
|
5633
5653
|
if (props.node.containerPadding == "small") {
|
|
5634
5654
|
containerPaddingClass = "container-small";
|
|
@@ -5638,14 +5658,6 @@ var DivContainer = async (props) => {
|
|
|
5638
5658
|
{
|
|
5639
5659
|
}
|
|
5640
5660
|
const updatedStyle = { ...updatedStyles };
|
|
5641
|
-
const backgroundStyle = background && background !== "" ? { background } : {};
|
|
5642
|
-
const combinedStyles = {
|
|
5643
|
-
...backgroundStyle
|
|
5644
|
-
};
|
|
5645
|
-
if (props.node.enableBackgroundClipText) {
|
|
5646
|
-
combinedStyles.WebkitBackgroundClip = "text";
|
|
5647
|
-
combinedStyles.backgroundClip = "text";
|
|
5648
|
-
}
|
|
5649
5661
|
const guid = "css" + crypto.randomUUID().toLocaleLowerCase();
|
|
5650
5662
|
const { enterAnimation, exitAnimation, hoverAnimation } = props.node;
|
|
5651
5663
|
let animationCSS = "";
|
|
@@ -5766,6 +5778,20 @@ var DivContainer = async (props) => {
|
|
|
5766
5778
|
}
|
|
5767
5779
|
return [props.dataitem];
|
|
5768
5780
|
})();
|
|
5781
|
+
const backgroundDataItem = dataToRender.length > 0 ? dataToRender[0] : props.dataitem;
|
|
5782
|
+
const background = generateCompleteBackgroundString(
|
|
5783
|
+
props.node.backgroundLayers,
|
|
5784
|
+
props.assetBaseUrl,
|
|
5785
|
+
backgroundDataItem
|
|
5786
|
+
);
|
|
5787
|
+
const backgroundStyle = background && background !== "" ? { background } : {};
|
|
5788
|
+
const combinedStyles = {
|
|
5789
|
+
...backgroundStyle
|
|
5790
|
+
};
|
|
5791
|
+
if (props.node.enableBackgroundClipText) {
|
|
5792
|
+
combinedStyles.WebkitBackgroundClip = "text";
|
|
5793
|
+
combinedStyles.backgroundClip = "text";
|
|
5794
|
+
}
|
|
5769
5795
|
const renderLink = result && props.node.dataBinding?.responseType === "array" ? true : false;
|
|
5770
5796
|
{
|
|
5771
5797
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -3899,17 +3899,36 @@ var getNestedValue3 = (obj, path) => {
|
|
|
3899
3899
|
return current && current[key] !== void 0 ? current[key] : void 0;
|
|
3900
3900
|
}, obj);
|
|
3901
3901
|
};
|
|
3902
|
-
{
|
|
3903
|
-
}
|
|
3904
|
-
function generateCompleteBackgroundString(layers, apiBaseUrl) {
|
|
3902
|
+
function generateCompleteBackgroundString(layers, apiBaseUrl, dataItem) {
|
|
3905
3903
|
if (!layers || !Array.isArray(layers)) return "";
|
|
3906
3904
|
return layers.filter((layer) => layer && layer.type && layer.value).map((layer) => {
|
|
3907
3905
|
if (layer.type === "image" && typeof layer.value === "object") {
|
|
3908
3906
|
const imageValue = layer.value;
|
|
3909
|
-
|
|
3907
|
+
let assetUrl = imageValue.assetUrl || "";
|
|
3908
|
+
if (layer.datafield && dataItem) {
|
|
3909
|
+
const fieldValue = getNestedValue3(
|
|
3910
|
+
dataItem,
|
|
3911
|
+
layer.datafield
|
|
3912
|
+
);
|
|
3913
|
+
if (typeof fieldValue === "string" && fieldValue.trim() !== "") {
|
|
3914
|
+
assetUrl = fieldValue;
|
|
3915
|
+
} else if (fieldValue && typeof fieldValue === "object" && fieldValue.assetUrl) {
|
|
3916
|
+
assetUrl = fieldValue.assetUrl;
|
|
3917
|
+
} else if (Array.isArray(fieldValue)) {
|
|
3918
|
+
const matchedAsset = layer.tag ? fieldValue.find(
|
|
3919
|
+
(x) => x?.tag?.toLowerCase() === layer.tag?.toLowerCase()
|
|
3920
|
+
) : fieldValue[0];
|
|
3921
|
+
if (matchedAsset?.assetUrl) {
|
|
3922
|
+
assetUrl = matchedAsset.assetUrl;
|
|
3923
|
+
}
|
|
3924
|
+
}
|
|
3925
|
+
}
|
|
3926
|
+
if (!assetUrl) {
|
|
3927
|
+
return "";
|
|
3928
|
+
}
|
|
3910
3929
|
const url = `url('${AssetUtility_default.resolveUrl(
|
|
3911
3930
|
apiBaseUrl,
|
|
3912
|
-
|
|
3931
|
+
assetUrl
|
|
3913
3932
|
)}')`;
|
|
3914
3933
|
const repeat = layer.repeat || "no-repeat";
|
|
3915
3934
|
const position = layer.position || "center";
|
|
@@ -3919,7 +3938,9 @@ function generateCompleteBackgroundString(layers, apiBaseUrl) {
|
|
|
3919
3938
|
}
|
|
3920
3939
|
if (layer.type === "gradient" && typeof layer.value === "object") {
|
|
3921
3940
|
const gradient = layer.value;
|
|
3922
|
-
if (!gradient.colors || !gradient.direction)
|
|
3941
|
+
if (!gradient.colors || !gradient.direction) {
|
|
3942
|
+
return "";
|
|
3943
|
+
}
|
|
3923
3944
|
const colors = gradient.colors.map(
|
|
3924
3945
|
(colorStop) => `color-mix(in srgb, ${colorStop.color}, transparent ${colorStop.transparency ?? 0}%) ${colorStop.start || "0%"}`
|
|
3925
3946
|
).join(", ");
|
|
@@ -4022,7 +4043,6 @@ var DivContainer = async (props) => {
|
|
|
4022
4043
|
const tabletStyles = props.node.tabletCssProperties;
|
|
4023
4044
|
const dataBindingProperties = props.node.dataBinding;
|
|
4024
4045
|
const updatedStyles = convertKeysToCamelCase(styles);
|
|
4025
|
-
const background = generateCompleteBackgroundString(props.node.backgroundLayers, props.assetBaseUrl);
|
|
4026
4046
|
let containerPaddingClass = "";
|
|
4027
4047
|
if (props.node.containerPadding == "small") {
|
|
4028
4048
|
containerPaddingClass = "container-small";
|
|
@@ -4032,14 +4052,6 @@ var DivContainer = async (props) => {
|
|
|
4032
4052
|
{
|
|
4033
4053
|
}
|
|
4034
4054
|
const updatedStyle = { ...updatedStyles };
|
|
4035
|
-
const backgroundStyle = background && background !== "" ? { background } : {};
|
|
4036
|
-
const combinedStyles = {
|
|
4037
|
-
...backgroundStyle
|
|
4038
|
-
};
|
|
4039
|
-
if (props.node.enableBackgroundClipText) {
|
|
4040
|
-
combinedStyles.WebkitBackgroundClip = "text";
|
|
4041
|
-
combinedStyles.backgroundClip = "text";
|
|
4042
|
-
}
|
|
4043
4055
|
const guid = "css" + crypto.randomUUID().toLocaleLowerCase();
|
|
4044
4056
|
const { enterAnimation, exitAnimation, hoverAnimation } = props.node;
|
|
4045
4057
|
let animationCSS = "";
|
|
@@ -4160,6 +4172,20 @@ var DivContainer = async (props) => {
|
|
|
4160
4172
|
}
|
|
4161
4173
|
return [props.dataitem];
|
|
4162
4174
|
})();
|
|
4175
|
+
const backgroundDataItem = dataToRender.length > 0 ? dataToRender[0] : props.dataitem;
|
|
4176
|
+
const background = generateCompleteBackgroundString(
|
|
4177
|
+
props.node.backgroundLayers,
|
|
4178
|
+
props.assetBaseUrl,
|
|
4179
|
+
backgroundDataItem
|
|
4180
|
+
);
|
|
4181
|
+
const backgroundStyle = background && background !== "" ? { background } : {};
|
|
4182
|
+
const combinedStyles = {
|
|
4183
|
+
...backgroundStyle
|
|
4184
|
+
};
|
|
4185
|
+
if (props.node.enableBackgroundClipText) {
|
|
4186
|
+
combinedStyles.WebkitBackgroundClip = "text";
|
|
4187
|
+
combinedStyles.backgroundClip = "text";
|
|
4188
|
+
}
|
|
4163
4189
|
const renderLink = result && props.node.dataBinding?.responseType === "array" ? true : false;
|
|
4164
4190
|
{
|
|
4165
4191
|
}
|
package/package.json
CHANGED