@orangelogic/design-system 4.65.0 → 4.66.0
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/library/chunks/{config-manager.B1JKfOk3.js → config-manager.Dd9dUVRD.js} +63 -33
- package/library/components/types.js +10913 -10907
- package/library/package.json +1 -1
- package/library/packages/events/src/cx-content-builder-translatable-value-change.d.ts +2 -1
- package/library/packages/organisms/src/content-builder/blocks/image/image.d.ts +8 -2
- package/library/packages/organisms/src/content-builder/components/config-form/config-form-controller.d.ts +8 -0
- package/library/packages/organisms/src/content-builder/components/config-form/config-form.d.ts +1 -1
- package/library/packages/organisms/src/content-builder/components/config-manager/config-manager.d.ts +2 -2
- package/library/packages/organisms/src/content-builder/content-builder.d.ts +1 -1
- package/package.json +1 -1
|
@@ -322,26 +322,34 @@ var Y = (e) => M(e) ? e._$litType$.h : e.strings, X = g(class extends h {
|
|
|
322
322
|
}
|
|
323
323
|
return t`<cx-space direction="vertical" wrap="nowrap">${a}</cx-space>`;
|
|
324
324
|
}
|
|
325
|
+
getTranslationAttributes(e) {
|
|
326
|
+
return e === this.host.defaultLanguage ? this.host.blockAttributes : {
|
|
327
|
+
...this.host.blockAttributes,
|
|
328
|
+
...this.host.translatableControlValues[this.host.defaultLanguage],
|
|
329
|
+
...this.host.translatableControlValues[e]
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
isTranslationControlVisible(e, t) {
|
|
333
|
+
return this.host.skipShowCheck && e.skipShowCheck ? !0 : typeof e.show == "boolean" ? e.show : typeof e.show != "function" || e.show(t);
|
|
334
|
+
}
|
|
325
335
|
renderTranslationControls() {
|
|
326
|
-
let e = K(this.host.translatableControls.map((e) => e.translateGroup)), n = t`${R(e, (e) => {
|
|
327
|
-
let
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
let
|
|
333
|
-
e.id && (a = n === this.host.defaultLanguage ? this.host.blockAttributes[e.id] ?? "" : this.host.translatableControlValues[n]?.[e.id] ?? this.host.translatableControlValues[this.host.defaultLanguage]?.[e.id] ?? this.host.blockAttributes[e.id]);
|
|
334
|
-
let o;
|
|
336
|
+
let e = K(this.host.translatableControls.map((e) => e.translateGroup)), n = new Map(this.host.sortedLanguages.map((e) => [e, this.getTranslationAttributes(e)])), r = t`${R(e, (e) => {
|
|
337
|
+
let r = this.host.translatableControls.filter((t) => t.translateGroup === e && this.host.sortedLanguages.some((e) => this.isTranslationControlVisible(t, n.get(e) ?? {})));
|
|
338
|
+
return r.length === 0 ? i : t`<cx-typography variant="h5">${e}</cx-typography>${R(r, (e) => e.id, (e) => e.controlType === "info-text" ? this.renderInfoText(e) : t`<cx-grid columns="4" spacing="var(--cx-spacing-small)" column-spacing="0" use-flex-gap row-spacing="0" wrap="wrap"><cx-grid-item xs="4" sm="1"><cx-typography variant="body2">${e.label}</cx-typography></cx-grid-item><cx-grid-item xs="4" sm="3"><cx-space direction="vertical" spacing="x-small" wrap="nowrap">${Oe(this.host.sortedLanguages, (r) => {
|
|
339
|
+
if (!this.isTranslationControlVisible(e, n.get(r) ?? {})) return i;
|
|
340
|
+
let a = this.localize.languageName(r) || _t.default.getName(r) || r, o = "";
|
|
341
|
+
e.id && (o = r === this.host.defaultLanguage ? this.host.blockAttributes[e.id] ?? "" : this.host.translatableControlValues[r]?.[e.id] ?? this.host.translatableControlValues[this.host.defaultLanguage]?.[e.id] ?? this.host.blockAttributes[e.id]);
|
|
342
|
+
let s;
|
|
335
343
|
switch (e.controlType) {
|
|
336
344
|
case "image-picker":
|
|
337
|
-
|
|
345
|
+
s = async (t) => {
|
|
338
346
|
if (typeof t == "object" && t) {
|
|
339
|
-
let { id:
|
|
347
|
+
let { id: n, src: i } = t, a = e.pickerConfigs?.recordIdKey ?? "record-id", o = e.pickerConfigs?.aspectRatioKey, s = n ? await this.controlRenderer.resolveAssetFormat(n, e.pickerConfigs?.defaultFormat ?? "", !0) : {
|
|
340
348
|
aspectRatio: 0,
|
|
341
349
|
src: ""
|
|
342
350
|
};
|
|
343
351
|
this.host.emit("cx-content-builder-translatable-value-change", { detail: {
|
|
344
|
-
language:
|
|
352
|
+
language: r,
|
|
345
353
|
values: [
|
|
346
354
|
{
|
|
347
355
|
attribute: e.id,
|
|
@@ -351,7 +359,7 @@ var Y = (e) => M(e) ? e._$litType$.h : e.strings, X = g(class extends h {
|
|
|
351
359
|
{
|
|
352
360
|
attribute: a,
|
|
353
361
|
type: "attribute",
|
|
354
|
-
value:
|
|
362
|
+
value: n
|
|
355
363
|
},
|
|
356
364
|
...o ? [{
|
|
357
365
|
attribute: o,
|
|
@@ -365,11 +373,11 @@ var Y = (e) => M(e) ? e._$litType$.h : e.strings, X = g(class extends h {
|
|
|
365
373
|
break;
|
|
366
374
|
case "audio-picker":
|
|
367
375
|
case "video-picker":
|
|
368
|
-
|
|
376
|
+
s = async (t) => {
|
|
369
377
|
if (typeof t == "object" && t) {
|
|
370
|
-
let { id:
|
|
378
|
+
let { id: n, name: i, src: a } = t, o = e.pickerConfigs?.recordIdKey ?? "record-id", s = e.pickerConfigs?.nameKey ?? "name";
|
|
371
379
|
this.host.emit("cx-content-builder-translatable-value-change", { detail: {
|
|
372
|
-
language:
|
|
380
|
+
language: r,
|
|
373
381
|
values: [
|
|
374
382
|
{
|
|
375
383
|
attribute: e.id,
|
|
@@ -379,7 +387,7 @@ var Y = (e) => M(e) ? e._$litType$.h : e.strings, X = g(class extends h {
|
|
|
379
387
|
{
|
|
380
388
|
attribute: o,
|
|
381
389
|
type: "attribute",
|
|
382
|
-
value:
|
|
390
|
+
value: n
|
|
383
391
|
},
|
|
384
392
|
{
|
|
385
393
|
attribute: s,
|
|
@@ -391,9 +399,24 @@ var Y = (e) => M(e) ? e._$litType$.h : e.strings, X = g(class extends h {
|
|
|
391
399
|
}
|
|
392
400
|
};
|
|
393
401
|
break;
|
|
394
|
-
|
|
402
|
+
case "switch":
|
|
403
|
+
s = async (t) => {
|
|
404
|
+
if (typeof t == "object" && t) {
|
|
405
|
+
let { checked: n } = t, i = !!n;
|
|
406
|
+
i && e.checkedValue !== void 0 ? i = e.checkedValue : !i && e.uncheckedValue !== void 0 && (i = e.uncheckedValue), this.host.emit("cx-content-builder-translatable-value-change", { detail: {
|
|
407
|
+
language: r,
|
|
408
|
+
values: [{
|
|
409
|
+
attribute: e.id,
|
|
410
|
+
type: "attribute",
|
|
411
|
+
value: i
|
|
412
|
+
}]
|
|
413
|
+
} });
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
break;
|
|
417
|
+
default: s = async (t) => {
|
|
395
418
|
typeof t == "string" && this.host.emit("cx-content-builder-translatable-value-change", { detail: {
|
|
396
|
-
language:
|
|
419
|
+
language: r,
|
|
397
420
|
values: [{
|
|
398
421
|
attribute: e.id,
|
|
399
422
|
type: "attribute",
|
|
@@ -403,30 +426,30 @@ var Y = (e) => M(e) ? e._$litType$.h : e.strings, X = g(class extends h {
|
|
|
403
426
|
};
|
|
404
427
|
}
|
|
405
428
|
return t`
|
|
406
|
-
${v(e.controlType && e.controlType !== "input", () => t`<cx-typography variant="body3">${
|
|
429
|
+
${v(e.controlType && e.controlType !== "input", () => t`<cx-typography variant="body3">${a}</cx-typography>`, () => i)}
|
|
407
430
|
${this.controlRenderer.renderControl({
|
|
408
431
|
blockAttributes: {
|
|
409
432
|
...this.host.blockAttributes,
|
|
410
|
-
...this.host.translatableControlValues[
|
|
433
|
+
...this.host.translatableControlValues[r]
|
|
411
434
|
},
|
|
412
435
|
container: void 0,
|
|
413
|
-
currentValue:
|
|
414
|
-
disabled:
|
|
415
|
-
handleChange:
|
|
436
|
+
currentValue: o,
|
|
437
|
+
disabled: r.toLowerCase() === this.host.defaultLanguage.toLowerCase(),
|
|
438
|
+
handleChange: s,
|
|
416
439
|
key: e.id,
|
|
417
|
-
label:
|
|
440
|
+
label: a,
|
|
418
441
|
trait: {
|
|
419
442
|
...e,
|
|
420
443
|
inputConfigs: {
|
|
421
444
|
...e.inputConfigs,
|
|
422
|
-
label:
|
|
445
|
+
label: a
|
|
423
446
|
}
|
|
424
447
|
}
|
|
425
448
|
})}
|
|
426
449
|
`;
|
|
427
450
|
})}</cx-space></cx-grid-item></cx-grid>`)}`;
|
|
428
451
|
})}`;
|
|
429
|
-
return t`<cx-space direction="vertical" wrap="nowrap">${
|
|
452
|
+
return t`<cx-space direction="vertical" wrap="nowrap">${r}</cx-space>`;
|
|
430
453
|
}
|
|
431
454
|
}, Z = class extends l {
|
|
432
455
|
constructor(...e) {
|
|
@@ -740,19 +763,26 @@ var Q = Z, yt = n`:host{display:block}.confirm-popover__footer{--color:var(--cx-
|
|
|
740
763
|
}
|
|
741
764
|
}
|
|
742
765
|
handleSave(e) {
|
|
743
|
-
let t = this.getFlattenTraits(this.traits).reduce((e, t) => (e[t.id] = t, e), {}),
|
|
744
|
-
let i = t
|
|
745
|
-
return nt.includes(
|
|
746
|
-
}, {});
|
|
766
|
+
let t = this.getFlattenTraits(this.traits), n = t.reduce((e, t) => (e[t.id] = t, e), {}), r = Object.entries(this.blockAttributes).reduce((e, [t, r]) => {
|
|
767
|
+
let i = n[t];
|
|
768
|
+
return nt.includes(t) || (i ? e[t] = r : typeof r == "boolean" && (e[t] = !1)), e;
|
|
769
|
+
}, {}), i = { ...this.translatableControlValuesMap }, a = i[this.defaultLanguage];
|
|
770
|
+
if (a) {
|
|
771
|
+
i[this.defaultLanguage] = { ...a };
|
|
772
|
+
for (let e of t) {
|
|
773
|
+
let t = r[e.id];
|
|
774
|
+
e.type === "attribute" && e.translatable && e.controlType === "switch" && (typeof t == "string" || typeof t == "boolean") && (i[this.defaultLanguage][e.id] = t);
|
|
775
|
+
}
|
|
776
|
+
}
|
|
747
777
|
this.emit("cx-content-builder-configure", { detail: {
|
|
748
778
|
description: this.description,
|
|
749
779
|
isDetachTemplate: e.detail.isDetachTemplate ?? !1,
|
|
750
780
|
name: this.name,
|
|
751
781
|
settings: {
|
|
752
|
-
attributes:
|
|
782
|
+
attributes: r,
|
|
753
783
|
properties: this.blockProperties,
|
|
754
784
|
styleProps: this.blockStyles,
|
|
755
|
-
translations:
|
|
785
|
+
translations: i
|
|
756
786
|
},
|
|
757
787
|
templateId: e.detail.isNewTemplate ? "" : this.templateId
|
|
758
788
|
} });
|