@orangelogic/design-system 2.101.0 → 2.102.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/{list-editor.DMjclCWz.js → list-editor.CMakbQyU.js} +181 -183
- package/library/chunks/transformation.Dir8s_wm.js +151 -0
- package/library/components/asset-link-format.js +867 -672
- package/library/components/drawer.js +82 -71
- package/library/components/list-editor.js +1 -1
- package/library/components/molecules.js +1 -1
- package/library/components/tag.js +44 -31
- package/library/components/types.js +558 -561
- package/library/package.json +1 -1
- package/library/packages/atoms/src/components/drawer/drawer.d.ts +8 -0
- package/library/packages/atoms/src/components/tag/tag.d.ts +11 -1
- package/library/packages/organisms/src/asset-link-format/asset-link-format.d.ts +8 -0
- package/library/packages/organisms/src/asset-link-format/components/asset-link-format-crop/asset-link-format-crop.d.ts +4 -0
- package/library/packages/organisms/src/asset-link-format/components/asset-link-format-quality/asset-link-format-quality.d.ts +4 -0
- package/library/packages/organisms/src/asset-link-format/components/asset-link-format-resize/asset-link-format-resize.d.ts +4 -0
- package/library/packages/organisms/src/asset-link-format/components/asset-link-format-rotation/asset-link-format-rotation.d.ts +4 -0
- package/library/packages/organisms/src/content-builder/styleController.d.ts +2 -1
- package/library/packages/types/src/asset-link-format.d.ts +2 -0
- package/library/packages/types/src/content-builder.d.ts +5 -1
- package/library/packages/types/src/tag.d.ts +1 -0
- package/library/packages/utils/src/transformation/transformation.d.ts +4 -1
- package/library/react-web-component.d.ts +15 -3
- package/library/utils.js +1 -1
- package/package.json +1 -1
- package/library/chunks/transformation.Cqz3hPaQ.js +0 -144
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
import { C as k } from "./button.DfRnA70F.js";
|
|
2
|
-
import { C as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { C as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { C as
|
|
13
|
-
import { C as
|
|
14
|
-
import { n as o, C as
|
|
15
|
-
import
|
|
16
|
-
import { c as
|
|
2
|
+
import { C as O, D as q } from "./dialog.BTU6B2_4.js";
|
|
3
|
+
import G from "../components/grid.js";
|
|
4
|
+
import j from "../components/grid-item.js";
|
|
5
|
+
import S from "../components/input.js";
|
|
6
|
+
import R from "../components/line-clamp.js";
|
|
7
|
+
import { C as P } from "./option.B7SoEb_q.js";
|
|
8
|
+
import F from "../components/radio.js";
|
|
9
|
+
import B from "../components/radio-group.js";
|
|
10
|
+
import K from "../components/select.js";
|
|
11
|
+
import _ from "../components/space.js";
|
|
12
|
+
import { C as U, H } from "./table.Cm-ynClk.js";
|
|
13
|
+
import { C as E } from "./typography.DJC_UXgs.js";
|
|
14
|
+
import { n as o, C as T } from "./lib-cortex-element.CVMmyPMC.js";
|
|
15
|
+
import V from "../components/dynamic-select.js";
|
|
16
|
+
import { c as L } from "./component.styles.CRO4Odto.js";
|
|
17
17
|
import { c as M } from "./custom-element.L4WJXn1j.js";
|
|
18
|
-
import { d as
|
|
19
|
-
import { L as
|
|
20
|
-
import { w as
|
|
21
|
-
import { a as
|
|
22
|
-
import { i as
|
|
18
|
+
import { d as W } from "./debounce.CIEhztrj.js";
|
|
19
|
+
import { L as D } from "./i18n.DK1uYlJT.js";
|
|
20
|
+
import { w as h } from "./watch.BCJD77bD.js";
|
|
21
|
+
import { a as J } from "./_commonjsHelpers.DQNKXVTB.js";
|
|
22
|
+
import { i as z, x as l } from "./lit-element.jLBm65_O.js";
|
|
23
23
|
import { r as b } from "./state.CSDxrqLd.js";
|
|
24
24
|
import { e as y } from "./query.BBf1UFkC.js";
|
|
25
|
-
import { r as
|
|
26
|
-
import { e as
|
|
27
|
-
import { o as
|
|
25
|
+
import { r as X } from "./choose.BTbF6BAn.js";
|
|
26
|
+
import { e as Y } from "./class-map.BiVq-cVR.js";
|
|
27
|
+
import { o as Z } from "./map.D8heArFD.js";
|
|
28
28
|
import { c as x } from "./repeat.DbF2p5ae.js";
|
|
29
29
|
import { n as N } from "./when.Dr1es41R.js";
|
|
30
|
-
import { t as
|
|
31
|
-
import { C as
|
|
30
|
+
import { t as Q } from "./toString.CL_lYXbK.js";
|
|
31
|
+
import { C as ee } from "./icon-button.CN0NGNQx.js";
|
|
32
32
|
import { C as ae } from "./image.D207g003.js";
|
|
33
|
-
import { a as
|
|
34
|
-
import { a as
|
|
33
|
+
import { a as te } from "./asset.CtL7ACp7.js";
|
|
34
|
+
import { a as ie } from "./index.Cpamj0jB.js";
|
|
35
35
|
import { A as g } from "./content-builder.CcgZciZN.js";
|
|
36
|
-
import { b as
|
|
37
|
-
import { t as
|
|
38
|
-
var
|
|
39
|
-
function
|
|
40
|
-
return
|
|
36
|
+
import { b as ne, t as I } from "./string.DUgD4c9f.js";
|
|
37
|
+
import { t as se } from "./toast.D3AW3RWv.js";
|
|
38
|
+
var C, w;
|
|
39
|
+
function re() {
|
|
40
|
+
return w || (w = 1, C = {
|
|
41
41
|
aa: {
|
|
42
42
|
name: "Afar",
|
|
43
43
|
nativeName: "Afaraf"
|
|
@@ -770,21 +770,21 @@ function oe() {
|
|
|
770
770
|
name: "Zulu",
|
|
771
771
|
nativeName: "isiZulu"
|
|
772
772
|
}
|
|
773
|
-
}),
|
|
773
|
+
}), C;
|
|
774
774
|
}
|
|
775
|
-
var
|
|
776
|
-
function
|
|
777
|
-
if (
|
|
778
|
-
|
|
779
|
-
const e =
|
|
780
|
-
for (const
|
|
781
|
-
const { name: m, nativeName:
|
|
782
|
-
|
|
775
|
+
var A, $;
|
|
776
|
+
function oe() {
|
|
777
|
+
if ($) return A;
|
|
778
|
+
$ = 1;
|
|
779
|
+
const e = re(), a = {}, t = {}, i = [], s = [], p = [];
|
|
780
|
+
for (const d in e) {
|
|
781
|
+
const { name: m, nativeName: v } = e[d];
|
|
782
|
+
a[d] = t[m.toLowerCase()] = t[v.toLowerCase()] = { code: d, name: m, nativeName: v }, i.push(d), s.push(m), p.push(v);
|
|
783
783
|
}
|
|
784
|
-
return
|
|
784
|
+
return A = class f {
|
|
785
785
|
static getLanguages(m = []) {
|
|
786
786
|
return m.map(
|
|
787
|
-
(
|
|
787
|
+
(v) => f.validate(v) ? Object.assign({}, a[v]) : { code: v, name: "", nativeName: "" }
|
|
788
788
|
);
|
|
789
789
|
}
|
|
790
790
|
static getName(m) {
|
|
@@ -800,7 +800,7 @@ function le() {
|
|
|
800
800
|
return p.slice();
|
|
801
801
|
}
|
|
802
802
|
static getCode(m) {
|
|
803
|
-
return m = m.toLowerCase(),
|
|
803
|
+
return m = m.toLowerCase(), t.hasOwnProperty(m) ? t[m].code : "";
|
|
804
804
|
}
|
|
805
805
|
static getAllCodes() {
|
|
806
806
|
return i.slice();
|
|
@@ -808,24 +808,24 @@ function le() {
|
|
|
808
808
|
static validate(m) {
|
|
809
809
|
return e.hasOwnProperty(m);
|
|
810
810
|
}
|
|
811
|
-
},
|
|
811
|
+
}, A;
|
|
812
812
|
}
|
|
813
|
-
var
|
|
814
|
-
const
|
|
815
|
-
var
|
|
816
|
-
function
|
|
817
|
-
var
|
|
818
|
-
return
|
|
813
|
+
var le = oe();
|
|
814
|
+
const me = /* @__PURE__ */ J(le);
|
|
815
|
+
var ce = 0;
|
|
816
|
+
function de(e) {
|
|
817
|
+
var a = ++ce;
|
|
818
|
+
return Q(e) + a;
|
|
819
819
|
}
|
|
820
|
-
const
|
|
821
|
-
var
|
|
822
|
-
for (var s = i > 1 ? void 0 : i ?
|
|
823
|
-
(
|
|
824
|
-
return i && s &&
|
|
820
|
+
const pe = z`:host{isolation:isolate}.asset-picker__input[data-user-invalid]~.asset-picker__button::part(base){border-color:var(--cx-input-invalid-border-color)}.asset-picker__input[data-user-invalid]:focus-within~.asset-picker__button::part(base){border-color:var(--cx-input-invalid-border-color);box-shadow:var(--cx-input-invalid-shadow)}.asset-picker__button-container{position:relative}.asset-picker__button{z-index:1;position:relative}.asset-picker__image{--height:150px;--width:200px;--border-radius:var(--cx-border-radius-medium)}.asset-picker__input{opacity:0;width:100%;height:100%;position:absolute;top:0;left:0}`;
|
|
821
|
+
var ue = Object.defineProperty, he = Object.getOwnPropertyDescriptor, u = (e, a, t, i) => {
|
|
822
|
+
for (var s = i > 1 ? void 0 : i ? he(a, t) : a, p = e.length - 1, d; p >= 0; p--)
|
|
823
|
+
(d = e[p]) && (s = (i ? d(a, t, s) : d(s)) || s);
|
|
824
|
+
return i && s && ue(a, t, s), s;
|
|
825
825
|
};
|
|
826
|
-
let
|
|
826
|
+
let c = class extends T {
|
|
827
827
|
constructor() {
|
|
828
|
-
super(...arguments), this.localize = new
|
|
828
|
+
super(...arguments), this.localize = new D(this), this.value = "", this.name = "", this.type = [g.Image], this.multiple = !1, this.accepts = [], this.required = !1, this.disabled = !1, this.onRequestAsset = void 0, this.recordId = "", this.previewSrc = "", this.apiGetAssets = te;
|
|
829
829
|
}
|
|
830
830
|
async handleRequestAssetClick() {
|
|
831
831
|
if (this.onRequestAsset)
|
|
@@ -841,28 +841,26 @@ let d = class extends L {
|
|
|
841
841
|
this.accepts
|
|
842
842
|
);
|
|
843
843
|
if (this.accepts.length > 0 && Object.values(e).some(
|
|
844
|
-
(
|
|
844
|
+
(t) => !this.accepts.includes(ne(t.src) ?? "")
|
|
845
845
|
))
|
|
846
|
-
|
|
846
|
+
se(this.localize.term("nonAcceptedExtension", this.accepts), {
|
|
847
847
|
notificationType: "warning"
|
|
848
848
|
});
|
|
849
849
|
else if (this.multiple) {
|
|
850
|
-
const
|
|
850
|
+
const t = Object.values(e);
|
|
851
851
|
this.emit("cx-content-builder-asset-select", {
|
|
852
|
-
detail:
|
|
852
|
+
detail: t
|
|
853
853
|
});
|
|
854
854
|
} else {
|
|
855
|
-
const { id:
|
|
856
|
-
|
|
857
|
-
p === g.Audio && (c = (await this.apiGetAssets({
|
|
858
|
-
extraFields: [I],
|
|
859
|
-
recordIds: [a]
|
|
860
|
-
})).items[0]?.[I]), c && this.emit("cx-content-builder-asset-select", {
|
|
855
|
+
const { extension: t, id: i, name: s, representative: p, src: d, type: m } = e;
|
|
856
|
+
this.emit("cx-content-builder-asset-select", {
|
|
861
857
|
detail: {
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
858
|
+
extension: t,
|
|
859
|
+
id: i,
|
|
860
|
+
name: s,
|
|
861
|
+
representative: p,
|
|
862
|
+
src: d,
|
|
863
|
+
type: m
|
|
866
864
|
}
|
|
867
865
|
});
|
|
868
866
|
}
|
|
@@ -886,11 +884,11 @@ let d = class extends L {
|
|
|
886
884
|
return;
|
|
887
885
|
}
|
|
888
886
|
try {
|
|
889
|
-
const
|
|
887
|
+
const a = (await this.apiGetAssets({
|
|
890
888
|
getPermanentAssetsPaths: !0,
|
|
891
889
|
recordIds: [this.recordId]
|
|
892
890
|
})).items[0];
|
|
893
|
-
this.previewSrc =
|
|
891
|
+
this.previewSrc = a?.path_TR1 || a?.originalUrl || "";
|
|
894
892
|
} catch {
|
|
895
893
|
this.previewSrc = "";
|
|
896
894
|
}
|
|
@@ -904,12 +902,12 @@ let d = class extends L {
|
|
|
904
902
|
}
|
|
905
903
|
renderAssetPreview() {
|
|
906
904
|
if ((this.previewSrc || this.value) && this.acceptsType(g.Image))
|
|
907
|
-
return l`<cx-image part="image" class="asset-picker__image" src=${this.previewSrc || this.value} alt=${this.name} width="200px" object-fit=${
|
|
905
|
+
return l`<cx-image part="image" class="asset-picker__image" src=${this.previewSrc || this.value} alt=${this.name} width="200px" object-fit=${ie.Cover}></cx-image>`;
|
|
908
906
|
if (this.name && this.acceptsType(g.Video))
|
|
909
|
-
return l`<cx-typography variant="body-2">${
|
|
907
|
+
return l`<cx-typography variant="body-2">${I(this.name, 30, 11, 11)}</cx-typography>`;
|
|
910
908
|
if (this.name && (this.acceptsType(g.Other) || this.acceptsType(g.All))) {
|
|
911
909
|
const e = this.name.split(",");
|
|
912
|
-
return l`<cx-typography variant="body-2">${
|
|
910
|
+
return l`<cx-typography variant="body-2">${I(e[0], 30, 11, 11)}
|
|
913
911
|
${N(
|
|
914
912
|
e.length > 1,
|
|
915
913
|
() => l` ${this.localize.term("andOthers", e.length - 1)}`
|
|
@@ -929,84 +927,84 @@ let d = class extends L {
|
|
|
929
927
|
)}</cx-space>`;
|
|
930
928
|
}
|
|
931
929
|
};
|
|
932
|
-
|
|
933
|
-
|
|
930
|
+
c.styles = [L, pe];
|
|
931
|
+
c.dependencies = {
|
|
934
932
|
"cx-button": k,
|
|
935
|
-
"cx-icon-button":
|
|
933
|
+
"cx-icon-button": ee,
|
|
936
934
|
"cx-image": ae,
|
|
937
|
-
"cx-input":
|
|
938
|
-
"cx-space":
|
|
939
|
-
"cx-typography":
|
|
935
|
+
"cx-input": S,
|
|
936
|
+
"cx-space": _,
|
|
937
|
+
"cx-typography": E
|
|
940
938
|
};
|
|
941
939
|
u([
|
|
942
940
|
y(".asset-picker__button")
|
|
943
|
-
],
|
|
941
|
+
], c.prototype, "buttonEl", 2);
|
|
944
942
|
u([
|
|
945
943
|
y(".asset-picker__input")
|
|
946
|
-
],
|
|
944
|
+
], c.prototype, "inputEl", 2);
|
|
947
945
|
u([
|
|
948
946
|
o({ reflect: !0, type: String })
|
|
949
|
-
],
|
|
947
|
+
], c.prototype, "value", 2);
|
|
950
948
|
u([
|
|
951
949
|
o({ reflect: !0, type: String })
|
|
952
|
-
],
|
|
950
|
+
], c.prototype, "name", 2);
|
|
953
951
|
u([
|
|
954
952
|
o({
|
|
955
953
|
converter: {
|
|
956
|
-
fromAttribute: (e) => (e ?? "").split(" ").filter((
|
|
954
|
+
fromAttribute: (e) => (e ?? "").split(" ").filter((a) => a !== ""),
|
|
957
955
|
toAttribute: (e) => e.join(" ")
|
|
958
956
|
},
|
|
959
957
|
reflect: !0
|
|
960
958
|
})
|
|
961
|
-
],
|
|
959
|
+
], c.prototype, "type", 2);
|
|
962
960
|
u([
|
|
963
961
|
o({ reflect: !0, type: Boolean })
|
|
964
|
-
],
|
|
962
|
+
], c.prototype, "multiple", 2);
|
|
965
963
|
u([
|
|
966
964
|
o({
|
|
967
965
|
converter: {
|
|
968
|
-
fromAttribute: (e) => (e ?? "").split(" ").filter((
|
|
966
|
+
fromAttribute: (e) => (e ?? "").split(" ").filter((a) => a !== ""),
|
|
969
967
|
toAttribute: (e) => e.join(" ")
|
|
970
968
|
},
|
|
971
969
|
reflect: !0
|
|
972
970
|
})
|
|
973
|
-
],
|
|
971
|
+
], c.prototype, "accepts", 2);
|
|
974
972
|
u([
|
|
975
973
|
o({ reflect: !0, type: Boolean })
|
|
976
|
-
],
|
|
974
|
+
], c.prototype, "required", 2);
|
|
977
975
|
u([
|
|
978
976
|
o({ attribute: "disabled", reflect: !0, type: Boolean })
|
|
979
|
-
],
|
|
977
|
+
], c.prototype, "disabled", 2);
|
|
980
978
|
u([
|
|
981
979
|
o({ attribute: "on-request-asset", type: Function })
|
|
982
|
-
],
|
|
980
|
+
], c.prototype, "onRequestAsset", 2);
|
|
983
981
|
u([
|
|
984
982
|
o({ attribute: "record-id", reflect: !0, type: String })
|
|
985
|
-
],
|
|
983
|
+
], c.prototype, "recordId", 2);
|
|
986
984
|
u([
|
|
987
985
|
b()
|
|
988
|
-
],
|
|
986
|
+
], c.prototype, "previewSrc", 2);
|
|
989
987
|
u([
|
|
990
|
-
|
|
991
|
-
],
|
|
988
|
+
h("value")
|
|
989
|
+
], c.prototype, "handleValueChange", 1);
|
|
992
990
|
u([
|
|
993
|
-
|
|
994
|
-
],
|
|
995
|
-
|
|
991
|
+
h("recordId")
|
|
992
|
+
], c.prototype, "handleRecordIdChange", 1);
|
|
993
|
+
c = u([
|
|
996
994
|
M("cx-asset-picker")
|
|
997
|
-
],
|
|
998
|
-
const
|
|
999
|
-
var
|
|
1000
|
-
for (var s = i > 1 ? void 0 : i ?
|
|
1001
|
-
(
|
|
1002
|
-
return i && s &&
|
|
995
|
+
], c);
|
|
996
|
+
const ve = z`:host{--overridden-min-height:var(--min-height,160px);--overridden-max-height:var(--max-height,260px);width:100%;display:block}.list-editor{width:100%}.list-editor__table{--cell-border-color:transparent;--cell-bottom-border-color:transparent;--header-font-size:var(--cx-font-size-small);--row-header-border-color:transparent;--cell-horizontal-padding:var(--cx-spacing-2x-small);--table-min-height:var(--overridden-min-height);--table-max-height:var(--overridden-max-height)}.list-editor__table--no-header{--cell-hover-background-color:transparent}.list-editor__item::part(expand-button){display:none}.list-editor__item__text{--line-height:1}.list-editor__item__text__description{color:var(--cx-color-neutral-600)}.list-editor__dialog{--body-spacing:0;--header-spacing:var(--cx-spacing-small) var(--cx-spacing-large) 0;--width:540px}.list-editor__tab-group{--padding:0;--tab-group-nav-padding:0 var(--cx-spacing-large)}`;
|
|
997
|
+
var ge = Object.defineProperty, Ne = Object.getOwnPropertyDescriptor, r = (e, a, t, i) => {
|
|
998
|
+
for (var s = i > 1 ? void 0 : i ? Ne(a, t) : a, p = e.length - 1, d; p >= 0; p--)
|
|
999
|
+
(d = e[p]) && (s = (i ? d(a, t, s) : d(s)) || s);
|
|
1000
|
+
return i && s && ge(a, t, s), s;
|
|
1003
1001
|
};
|
|
1004
|
-
const
|
|
1002
|
+
const be = {
|
|
1005
1003
|
resizable: !1
|
|
1006
1004
|
};
|
|
1007
|
-
let n = class extends
|
|
1005
|
+
let n = class extends T {
|
|
1008
1006
|
constructor() {
|
|
1009
|
-
super(...arguments), this.localize = new
|
|
1007
|
+
super(...arguments), this.localize = new D(this), this.data = [], this.canAdd = !1, this.addDialogLabel = "", this.editDialogLabel = "", this.displayField = "", this.descriptionField = "", this.addItemText = "", this.sampleItem = {}, this.useEvents = !1, this.sortable = !1, this.loadingEvent = "", this.loadingItemIndex = void 0, this.columns = [], this.noHeader = !1, this.rowHeight = 40, this.defaultLanguage = "", this.supportedLanguages = ["en"], this.boundary = document.body, this.onRequestAsset = void 0, this.editedItem = null, this.isAdding = !1, this.columnsMap = {}, this.sortedEntries = [], this.translatableControls = [], this.disableCloseConfigDialog = !1, this.hoverMenu = {
|
|
1010
1008
|
data: [
|
|
1011
1009
|
{
|
|
1012
1010
|
icon: "create",
|
|
@@ -1033,7 +1031,7 @@ let n = class extends L {
|
|
|
1033
1031
|
}
|
|
1034
1032
|
],
|
|
1035
1033
|
options: {
|
|
1036
|
-
placement:
|
|
1034
|
+
placement: H.Right
|
|
1037
1035
|
}
|
|
1038
1036
|
}, this.OMITTED_FIELDS = ["id"];
|
|
1039
1037
|
}
|
|
@@ -1054,15 +1052,15 @@ let n = class extends L {
|
|
|
1054
1052
|
}
|
|
1055
1053
|
handleEditedItemChange() {
|
|
1056
1054
|
const e = {};
|
|
1057
|
-
for (const
|
|
1058
|
-
e[
|
|
1059
|
-
this.sortedEntries = Object.entries(this.editedItem || {}).filter(([
|
|
1055
|
+
for (const a of this.columns)
|
|
1056
|
+
e[a.field] = a.configOrder;
|
|
1057
|
+
this.sortedEntries = Object.entries(this.editedItem || {}).filter(([a]) => this.OMITTED_FIELDS.indexOf(a) === -1 && this.columnsMap[a]).sort(([a], [t]) => (e[a] ?? Number.MAX_SAFE_INTEGER) - (e[t] ?? Number.MAX_SAFE_INTEGER));
|
|
1060
1058
|
}
|
|
1061
1059
|
handleTableActions(e) {
|
|
1062
|
-
const { name:
|
|
1060
|
+
const { name: a, row: t } = e.detail, i = "component" in t ? t.component : t;
|
|
1063
1061
|
if (i) {
|
|
1064
1062
|
if (this.useEvents) {
|
|
1065
|
-
this.emit(`cx-list-editor-${
|
|
1063
|
+
this.emit(`cx-list-editor-${a}`, {
|
|
1066
1064
|
detail: {
|
|
1067
1065
|
index: i.getIndex(),
|
|
1068
1066
|
item: i.getData()
|
|
@@ -1070,7 +1068,7 @@ let n = class extends L {
|
|
|
1070
1068
|
});
|
|
1071
1069
|
return;
|
|
1072
1070
|
}
|
|
1073
|
-
|
|
1071
|
+
a === "edit" ? this.editedItem = i.getData() : a === "delete" && this.emit("cx-list-editor-change", {
|
|
1074
1072
|
detail: {
|
|
1075
1073
|
data: this.data.filter((s) => s.id !== i.getData().id)
|
|
1076
1074
|
}
|
|
@@ -1090,22 +1088,22 @@ let n = class extends L {
|
|
|
1090
1088
|
handleAddClick() {
|
|
1091
1089
|
this.isAdding = !0, this.editedItem = {
|
|
1092
1090
|
...this.sampleItem,
|
|
1093
|
-
id:
|
|
1091
|
+
id: de(`${Date.now()}-`)
|
|
1094
1092
|
};
|
|
1095
1093
|
}
|
|
1096
1094
|
handleSaveClick() {
|
|
1097
1095
|
if (this.editedItem) {
|
|
1098
1096
|
const e = this.data.findIndex(
|
|
1099
|
-
(
|
|
1097
|
+
(t) => t.id === this.editedItem.id
|
|
1100
1098
|
);
|
|
1101
1099
|
if (!this.isAdding && e === -1) {
|
|
1102
1100
|
this.editedItem = null;
|
|
1103
1101
|
return;
|
|
1104
1102
|
}
|
|
1105
|
-
let
|
|
1106
|
-
this.isAdding ?
|
|
1103
|
+
let a = this.data;
|
|
1104
|
+
this.isAdding ? a = [...a, this.editedItem] : a = this.data.map((t) => t.id === this.editedItem.id ? this.editedItem : t), this.emit("cx-list-editor-change", {
|
|
1107
1105
|
detail: {
|
|
1108
|
-
data:
|
|
1106
|
+
data: a
|
|
1109
1107
|
}
|
|
1110
1108
|
}), this.editedItem = null, this.isAdding = !1;
|
|
1111
1109
|
}
|
|
@@ -1124,55 +1122,55 @@ let n = class extends L {
|
|
|
1124
1122
|
if (await this.updateComplete, !this.table)
|
|
1125
1123
|
return;
|
|
1126
1124
|
if (!this.loadingItemIndex) {
|
|
1127
|
-
this.table.tabulatorInstance?.getRows().forEach((
|
|
1128
|
-
const i =
|
|
1129
|
-
|
|
1125
|
+
this.table.tabulatorInstance?.getRows().forEach((t) => {
|
|
1126
|
+
const i = t._row.hoverMenuElement;
|
|
1127
|
+
t._row.hoverMenuElement.actions = i.actions.map((s) => (s.options?.buttonProps && (s.options.buttonProps.loading = !1), s));
|
|
1130
1128
|
});
|
|
1131
1129
|
return;
|
|
1132
1130
|
}
|
|
1133
1131
|
const e = this.table.tabulatorInstance?.getRow(this.loadingItemIndex);
|
|
1134
1132
|
if (!e || !e?._row?.hoverMenuElement)
|
|
1135
1133
|
return;
|
|
1136
|
-
const
|
|
1137
|
-
|
|
1134
|
+
const a = e._row.hoverMenuElement;
|
|
1135
|
+
a.actions = a.actions.map((t) => (t.options?.buttonProps && (t.options.buttonProps.loading = t.name === this.loadingEvent && this.loadingItemIndex === e.getIndex()), t));
|
|
1138
1136
|
}
|
|
1139
1137
|
handleChange(e) {
|
|
1140
1138
|
if (!e.target)
|
|
1141
1139
|
return;
|
|
1142
|
-
const
|
|
1143
|
-
if (!
|
|
1140
|
+
const a = e.target, t = a.dataset.id;
|
|
1141
|
+
if (!t)
|
|
1144
1142
|
return;
|
|
1145
|
-
let i =
|
|
1143
|
+
let i = a.value;
|
|
1146
1144
|
Array.isArray(i) ? i = i.join(" ") : i = String(i), this.editedItem = {
|
|
1147
1145
|
...this.editedItem,
|
|
1148
|
-
[
|
|
1146
|
+
[t]: i
|
|
1149
1147
|
};
|
|
1150
1148
|
}
|
|
1151
1149
|
renderControls(e) {
|
|
1152
1150
|
if (e === "translation") {
|
|
1153
|
-
const
|
|
1151
|
+
const a = l`
|
|
1154
1152
|
${x(
|
|
1155
1153
|
this.translatableControls,
|
|
1156
|
-
(
|
|
1157
|
-
(
|
|
1158
|
-
const s = this.localize.languageName(i) ||
|
|
1159
|
-
const m =
|
|
1154
|
+
(t) => t.field,
|
|
1155
|
+
(t) => l`<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">${t.title}</cx-typography></cx-grid-item><cx-grid-item xs="4" sm="3"><cx-space direction="vertical" spacing="x-small" wrap="nowrap">${Z(this.supportedLanguages, (i) => {
|
|
1156
|
+
const s = this.localize.languageName(i) || me.getName(i) || i, p = (d) => {
|
|
1157
|
+
const m = d.target.value;
|
|
1160
1158
|
this.editedItem = {
|
|
1161
1159
|
...this.editedItem,
|
|
1162
|
-
[`${
|
|
1160
|
+
[`${t.field}-${i}`]: m
|
|
1163
1161
|
};
|
|
1164
1162
|
};
|
|
1165
|
-
return l`<cx-input ?disabled=${i.toLowerCase() === this.defaultLanguage?.toLowerCase()} label=${s} value=${this.editedItem?.[`${
|
|
1163
|
+
return l`<cx-input ?disabled=${i.toLowerCase() === this.defaultLanguage?.toLowerCase()} label=${s} value=${this.editedItem?.[`${t.field}-${i}`] ?? this.editedItem?.[`${t.field}`] ?? ""} @cx-change=${p}></cx-input>`;
|
|
1166
1164
|
})}</cx-space></cx-grid-item></cx-grid>`
|
|
1167
1165
|
)}
|
|
1168
1166
|
`;
|
|
1169
|
-
return l`<cx-space direction="vertical" wrap="nowrap">${
|
|
1167
|
+
return l`<cx-space direction="vertical" wrap="nowrap">${a}</cx-space>`;
|
|
1170
1168
|
}
|
|
1171
1169
|
return l`<cx-grid columns="3" spacing="var(--cx-spacing-small)" wrap="wrap">${x(
|
|
1172
1170
|
this.sortedEntries,
|
|
1173
|
-
([
|
|
1174
|
-
([
|
|
1175
|
-
this.columnsMap[
|
|
1171
|
+
([a]) => a,
|
|
1172
|
+
([a, t]) => l`<cx-grid-item xs="3" sm="1"><cx-typography variant="body2">${this.columnsMap[a].title}</cx-typography></cx-grid-item><cx-grid-item xs="3" sm="2">${X(
|
|
1173
|
+
this.columnsMap[a].controlType,
|
|
1176
1174
|
[
|
|
1177
1175
|
[
|
|
1178
1176
|
"image-picker",
|
|
@@ -1180,48 +1178,48 @@ let n = class extends L {
|
|
|
1180
1178
|
const i = async (p) => {
|
|
1181
1179
|
if (Array.isArray(p.detail))
|
|
1182
1180
|
return;
|
|
1183
|
-
const { id:
|
|
1181
|
+
const { id: d, src: m } = p.detail;
|
|
1184
1182
|
this.editedItem = {
|
|
1185
1183
|
...this.editedItem,
|
|
1186
|
-
[
|
|
1187
|
-
recordId:
|
|
1184
|
+
[a]: m,
|
|
1185
|
+
recordId: d
|
|
1188
1186
|
};
|
|
1189
1187
|
}, s = async () => {
|
|
1190
1188
|
this.editedItem = {
|
|
1191
1189
|
...this.editedItem,
|
|
1192
|
-
[
|
|
1190
|
+
[a]: "",
|
|
1193
1191
|
recordId: ""
|
|
1194
1192
|
};
|
|
1195
1193
|
};
|
|
1196
|
-
return l`<cx-asset-picker value=${
|
|
1194
|
+
return l`<cx-asset-picker value=${t} record-id=${this.editedItem.recordId || ""} type="image" id=${a} @cx-content-builder-asset-select=${i} @cx-content-builder-asset-delete=${s} @cx-asset-request-status=${this.handleAssetRequestStatus} .onRequestAsset=${this.onRequestAsset}></cx-asset-picker>`;
|
|
1197
1195
|
}
|
|
1198
1196
|
],
|
|
1199
1197
|
[
|
|
1200
1198
|
"radio-group",
|
|
1201
|
-
() => l`<cx-radio-group data-id=${
|
|
1202
|
-
this.columnsMap[
|
|
1199
|
+
() => l`<cx-radio-group data-id=${a} data-testid="radio-group-control" horizontal value=${(t || this.columnsMap[a].defaultValue) ?? ""} size="medium" @cx-change=${this.handleChange}>${x(
|
|
1200
|
+
this.columnsMap[a].options ?? [],
|
|
1203
1201
|
(i) => i.value,
|
|
1204
1202
|
(i) => l`<cx-radio value=${i.value}>${i.name}</cx-radio>`
|
|
1205
1203
|
)}</cx-radio-group>`
|
|
1206
1204
|
],
|
|
1207
1205
|
[
|
|
1208
1206
|
"select",
|
|
1209
|
-
() => this.columnsMap[
|
|
1210
|
-
this.columnsMap[
|
|
1207
|
+
() => this.columnsMap[a].api ? l`<cx-dynamic-select data-id=${a} hoist value=${t} @cx-change=${this.handleChange} .api=${this.columnsMap[a].api}></cx-dynamic-select>` : l`<cx-select data-id=${a} hoist value=${t} @cx-change=${this.handleChange}>${x(
|
|
1208
|
+
this.columnsMap[a].options ?? [],
|
|
1211
1209
|
(i) => i.value,
|
|
1212
1210
|
(i) => l`<cx-option value=${i.value}>${i.name}</cx-option>`
|
|
1213
1211
|
)}</cx-select>`
|
|
1214
1212
|
]
|
|
1215
1213
|
],
|
|
1216
|
-
() => l`<cx-input data-id=${
|
|
1214
|
+
() => l`<cx-input data-id=${a} value=${t} @cx-change=${this.handleChange}></cx-input>`
|
|
1217
1215
|
)}</cx-grid-item>`
|
|
1218
1216
|
)}</cx-grid>`;
|
|
1219
1217
|
}
|
|
1220
1218
|
render() {
|
|
1221
|
-
return l`<cx-space direction="vertical" align-items="flex-start"><div class="list-editor"><cx-table part="table" class=${
|
|
1219
|
+
return l`<cx-space direction="vertical" align-items="flex-start"><div class="list-editor"><cx-table part="table" class=${Y({
|
|
1222
1220
|
"list-editor__table": !0,
|
|
1223
1221
|
"list-editor__table--no-header": this.noHeader
|
|
1224
|
-
})} ?movable-rows=${this.sortable} ?no-header=${this.noHeader} layout="fitColumns" row-height=${this.rowHeight} .columns=${this.columns} .columnDefaults=${
|
|
1222
|
+
})} ?movable-rows=${this.sortable} ?no-header=${this.noHeader} layout="fitColumns" row-height=${this.rowHeight} .columns=${this.columns} .columnDefaults=${be} .hoverMenu=${this.hoverMenu} .data=${this.data ?? []} no-selectable @cx-table.rowMoved=${this.handleTableRowMoved} @cx-table-row-action-click=${this.handleTableActions}></cx-table><cx-dialog part="dialog" class="list-editor__dialog" divider-position=${q.Footer} use-overlay-scrollbar strategy="fixed" ?open=${!!this.editedItem} .boundary=${this.boundary} @cx-request-close=${this.handleRequestClose}><cx-space slot="label" direction="vertical" spacing="2x-small"><cx-typography variant="h4">${this.isAdding ? this.addDialogLabel : this.editDialogLabel}</cx-typography>${N(
|
|
1225
1223
|
!this.isAdding && this.editedItem?.[this.displayField],
|
|
1226
1224
|
() => l`<cx-typography variant="body3"><cx-line-clamp lines="1">${this.editedItem?.[this.displayField]}</cx-line-clamp></cx-typography>`
|
|
1227
1225
|
)}</cx-space>${N(
|
|
@@ -1238,23 +1236,23 @@ let n = class extends L {
|
|
|
1238
1236
|
)}</cx-space>`;
|
|
1239
1237
|
}
|
|
1240
1238
|
};
|
|
1241
|
-
n.styles = [
|
|
1239
|
+
n.styles = [L, ve];
|
|
1242
1240
|
n.dependencies = {
|
|
1243
|
-
"cx-asset-picker":
|
|
1241
|
+
"cx-asset-picker": c,
|
|
1244
1242
|
"cx-button": k,
|
|
1245
|
-
"cx-dialog":
|
|
1246
|
-
"cx-dynamic-select":
|
|
1247
|
-
"cx-grid":
|
|
1248
|
-
"cx-grid-item":
|
|
1249
|
-
"cx-input":
|
|
1250
|
-
"cx-line-clamp":
|
|
1251
|
-
"cx-option":
|
|
1252
|
-
"cx-radio":
|
|
1253
|
-
"cx-radio-group":
|
|
1254
|
-
"cx-select":
|
|
1255
|
-
"cx-space":
|
|
1256
|
-
"cx-table":
|
|
1257
|
-
"cx-typography":
|
|
1243
|
+
"cx-dialog": O,
|
|
1244
|
+
"cx-dynamic-select": V,
|
|
1245
|
+
"cx-grid": G,
|
|
1246
|
+
"cx-grid-item": j,
|
|
1247
|
+
"cx-input": S,
|
|
1248
|
+
"cx-line-clamp": R,
|
|
1249
|
+
"cx-option": P,
|
|
1250
|
+
"cx-radio": F,
|
|
1251
|
+
"cx-radio-group": B,
|
|
1252
|
+
"cx-select": K,
|
|
1253
|
+
"cx-space": _,
|
|
1254
|
+
"cx-table": U,
|
|
1255
|
+
"cx-typography": E
|
|
1258
1256
|
};
|
|
1259
1257
|
r([
|
|
1260
1258
|
y("cx-dialog")
|
|
@@ -1267,8 +1265,8 @@ r([
|
|
|
1267
1265
|
converter: {
|
|
1268
1266
|
fromAttribute: (e) => {
|
|
1269
1267
|
try {
|
|
1270
|
-
const
|
|
1271
|
-
return Array.isArray(
|
|
1268
|
+
const a = JSON.parse(e);
|
|
1269
|
+
return Array.isArray(a) ? a : [];
|
|
1272
1270
|
} catch {
|
|
1273
1271
|
return [];
|
|
1274
1272
|
}
|
|
@@ -1357,25 +1355,25 @@ r([
|
|
|
1357
1355
|
b()
|
|
1358
1356
|
], n.prototype, "translatableControls", 2);
|
|
1359
1357
|
r([
|
|
1360
|
-
|
|
1361
|
-
|
|
1358
|
+
h("columns"),
|
|
1359
|
+
h("supportedLanguages", { waitUntilFirstUpdate: !0 })
|
|
1362
1360
|
], n.prototype, "handleColumnsChange", 1);
|
|
1363
1361
|
r([
|
|
1364
|
-
|
|
1365
|
-
|
|
1362
|
+
h("editedItem"),
|
|
1363
|
+
h("columns", { waitUntilFirstUpdate: !0 })
|
|
1366
1364
|
], n.prototype, "handleEditedItemChange", 1);
|
|
1367
1365
|
r([
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1366
|
+
h("loadingEvent", { waitUntilFirstUpdate: !0 }),
|
|
1367
|
+
h("loadingItemIndex", { waitUntilFirstUpdate: !0 }),
|
|
1368
|
+
W(10)
|
|
1371
1369
|
], n.prototype, "handleLoadingEventChange", 1);
|
|
1372
1370
|
n = r([
|
|
1373
1371
|
M("cx-list-editor")
|
|
1374
1372
|
], n);
|
|
1375
1373
|
export {
|
|
1376
1374
|
n as C,
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1375
|
+
me as I,
|
|
1376
|
+
c as a,
|
|
1377
|
+
be as c,
|
|
1378
|
+
de as u
|
|
1381
1379
|
};
|